--- a/imagehandling_plat/3gp_library_api/3gp_library_api.metaxml Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" ?>
-<api id="ea625861e9a32710c78d77d8933339c1" dataversion="2.0">
- <name>3GP Library API</name>
- <description>Interface to 3GP file composing and parsing library.</description>
- <type>c++</type>
- <collection>3gplibrary</collection>
- <libs>
- <lib name="3GPMP4lib.lib" />
- </libs>
- <release category="platform"/>
- <attributes>
- <!-- This indicates wether the api provedes separate html documentation -->
- <!-- or is the additional documentation generated from headers. -->
- <!-- If you are unsuere then the value is "no" -->
- <htmldocprovided>no</htmldocprovided>
- <adaptation>no</adaptation>
- </attributes>
-</api>
--- a/imagehandling_plat/3gp_library_api/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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: File that exports the files belonging to
-: 3GP Library API
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-../inc/mp4lib.h MW_LAYER_PLATFORM_EXPORT_PATH(mp4lib.h)
-../inc/mp4config.h MW_LAYER_PLATFORM_EXPORT_PATH(mp4config.h)
-../inc/3GPMP4Lib.iby CORE_MW_LAYER_IBY_EXPORT_PATH(3GPMP4Lib.iby)
--- a/imagehandling_plat/3gp_library_api/inc/3GPMP4Lib.iby Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2002-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: Iby file for 3GPMP4Lib.
-*
-*/
-
-
-#ifndef __3GPMP4LIB_IBY__
-#define __3GPMP4LIB_IBY__
-
-// 3GP/MP4 File Format Library
-
-// Utilizing constants from data_caging_paths_for_iby.hrh, included in higher level
-file=ABI_DIR\BUILD_DIR\3GPMP4LIB.DLL SHARED_LIB_DIR\3GPMP4LIB.DLL
-
-//data=ZSYSTEM\install\3GPMP4LibStub.sis system\install\3GPMP4LibStub.sis
-
-#endif //__3GPMP4LIB_IBY__
--- a/imagehandling_plat/3gp_library_api/inc/mp4config.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies 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 operating system specific variables have been collected in this file
-*
-*/
-
-// transition header for 3GPMP4Lib clients, new location:
-#include <3gplibrary/mp4config.h>
-
-// End of File
--- a/imagehandling_plat/3gp_library_api/inc/mp4lib.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies 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 is included by the library user.
-*
-*/
-
-// transition header for 3GPMP4Lib clients, new location:
-#include <3gplibrary/mp4lib.h>
-
-// End of File
--- a/imagehandling_plat/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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: Includes all the Domain API specific bld.inf files, which
-* export files.
-*
-*/
-
-
-
-#include "../image_handling_library_api/group/bld.inf"
-#include "../3gp_library_api/group/bld.inf"
-#include "../thumbnailmanager_api/group/bld.inf"
-
-
-
-// End of File
-
-
--- a/imagehandling_plat/image_handling_library_api/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* 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: File that exports the files belonging to
-: Image Handling Library API
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-../inc/IHLProcessorFactory.h MW_LAYER_PLATFORM_EXPORT_PATH(IHLProcessorFactory.h)
-../inc/IHLBitmapUtil.h MW_LAYER_PLATFORM_EXPORT_PATH(IHLBitmapUtil.h)
-../inc/MIHLBitmap.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLBitmap.h)
-../inc/MIHLImage.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLImage.h)
-../inc/MIHLProcessor.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLProcessor.h)
-../inc/IHLViewerFactory.h MW_LAYER_PLATFORM_EXPORT_PATH(IHLViewerFactory.h)
-../inc/MIHLScaler.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLScaler.h)
-../inc/IHLImageFactory.h MW_LAYER_PLATFORM_EXPORT_PATH(IHLImageFactory.h)
-../inc/MIHLBitmapProcessor.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLBitmapProcessor.h)
-../inc/MIHLViewer.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLViewer.h)
-../inc/MIHLViewerObserver.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLViewerObserver.h)
-../inc/MIHLFileImage.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLFileImage.h)
-../inc/TIHLInterfaceType.h MW_LAYER_PLATFORM_EXPORT_PATH(TIHLInterfaceType.h)
-../inc/IHLInterfaceIds.h MW_LAYER_PLATFORM_EXPORT_PATH(IHLInterfaceIds.h)
-../inc/MIHLImageViewer.h MW_LAYER_PLATFORM_EXPORT_PATH(MIHLImageViewer.h)
--- a/imagehandling_plat/image_handling_library_api/image_handling_library_api.metaxml Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" ?>
-<api id="7465e3c7aa4e74d9c8f9d0e706f54456" dataversion="2.0">
- <name>Image Handling Library API</name>
- <description>An interface for viewing images</description>
- <type>c++</type>
- <collection>imagehandlinglib</collection>
- <libs>
- <lib name="IHL.lib" />
- </libs>
- <release category="platform"/>
- <attributes>
- <!-- This indicates wether the api provedes separate html documentation -->
- <!-- or is the additional documentation generated from headers. -->
- <!-- If you are unsuere then the value is "no" -->
- <htmldocprovided>no</htmldocprovided>
- <adaptation>no</adaptation>
- </attributes>
-</api>
--- a/imagehandling_plat/image_handling_library_api/inc/IHLBitmapUtil.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-* 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: Static utility class for synchronous CFbsBitmap operations.
-*
-*/
-
-
-#ifndef IHLBITMAPUTIL_H
-#define IHLBITMAPUTIL_H
-
-// INCLUDES
-#include <e32std.h>
-
-// FORWARD DECLARATION
-class CFbsBitmap;
-
-// CLASS DECLARATION
-/**
-* IHLBitmapUtil
-*
-* Static utility class for synchronous CFbsBitmap operations.
-* @lib IHL.lib
-* @since 3.0
-*/
-class IHLBitmapUtil
- {
- public:
-
- /**
- * Create new bitmap instance using
- * same server handle as in given bitmap.
- * Note that modifying bitmap content will also change
- * all other bitmap content that has same server handle.
- * @since 3.0
- * @param aBitmap Duplicated bitmap reference.
- * @return Duplicated CFbsBitmap instance.
- */
- IMPORT_C static CFbsBitmap* DuplicateBitmapL( const CFbsBitmap& aBitmap );
-
- /**
- * Create new bitmap instance using
- * same server handle as in given bitmap.
- * Note that modifying bitmap content will also change
- * all other bitmap content that has same server handle.
- * New instance is pushed into CleanupStack.
- * @since 3.0
- * @param aBitmap Duplicated bitmap reference.
- * @return Duplicated CFbsBitmap instance.
- */
- IMPORT_C static CFbsBitmap* DuplicateBitmapLC( const CFbsBitmap& aBitmap );
-
- /**
- * Copy bitmap into new same sized bitmap.
- * New bitmap has unique server handle and it can be
- * modified without risk of changes in given source bitmap.
- * @since 3.0
- * @param aBitmap Copied bitmap reference.
- * @return Copied CFbsBitmap instance.
- */
- IMPORT_C static CFbsBitmap* CopyBitmapL( const CFbsBitmap& aBitmap );
-
- /**
- * Copy bitmap into new same sized bitmap.
- * New bitmap has unique server handle and it can be
- * modified without risk of changes in given source bitmap.
- * New instance is pushed into CleanupStack.
- * @since 3.0
- * @param aBitmap Copied bitmap reference.
- * @return Copied CFbsBitmap instance.
- */
- IMPORT_C static CFbsBitmap* CopyBitmapLC( const CFbsBitmap& aBitmap );
-
- /**
- * Copy user defined area from source bitmap into new bitmap.
- * New bitmap has unique server handle and it can be
- * modified without risk of changes in given source bitmap.
- * @since 3.0
- * @param aBitmap Source bitmap reference.
- * @param aRect Copied rectangle from source bitmap.
- * @return Copied CFbsBitmap instance, size of given rect.
- */
- IMPORT_C static CFbsBitmap* CopyBitmapL( const CFbsBitmap& aBitmap, const TRect& aRect );
-
- /**
- * Copy user defined area from source bitmap into new bitmap.
- * New bitmap has unique server handle and it can be
- * modified without risk of changes in given source bitmap.
- * New instance is pushed into CleanupStack.
- * @since 3.0
- * @param aBitmap Source bitmap reference.
- * @param aRect Copied rectangle from source bitmap.
- * @return Copied CFbsBitmap instance, size of given rect.
- */
- IMPORT_C static CFbsBitmap* CopyBitmapLC( const CFbsBitmap& aBitmap, const TRect& aRect );
-
- /**
- * Synchronous bitmap scaler. Use only with small bitmaps!
- * Prefer asynchronous MIHLScaler instead.
- *
- * Scale source bitmap into destination bitmap.
- * @since 3.0
- * @param aSrcBitmap Source bitmap reference.
- * @param aDstBitmap Destination bitmap reference.
- * If destination bitmap has null handle,
- * processor will create new bitmap using size of
- * destination rectangle.
- * @param aOptions Reserved for future use.
- * @return Return system wide error codes:
- * KerrArgument - source bitmap is empty (handle is null).
- * - destination bitmap displaymode differs
- * from source bitmap displaymode.
- */
- IMPORT_C static TInt ScaleBitmap( const CFbsBitmap& aSrcBitmap, CFbsBitmap& aDstBitmap,
- TUint32 aOptions = 0 );
-
- /**
- * Synchronous bitmap scaler. Use only with small bitmaps!
- * Prefer asynchronous MIHLScaler instead.
- *
- * Scale rectangle from source bitmap to a rectangle
- * in destination bitmap. Scaled area can be also
- * rotated and/or mirrored during process.
- * See full usage description from MIHLScaler header.
- * @since 3.0
- * @param aSrcBitmap Source bitmap reference.
- * @param aSrcRect Rectangle that is processed from source bitmap.
- * @param aDstBitmap Destination bitmap reference.
- * If destination bitmap has null handle,
- * processor will create new bitmap using size of
- * destination rectangle.
- * @param aDstRect Rectangle that is filled in destination bitmap.
- * @param aOptions Reserved for future use.
- * @return Return system wide error codes:
- * KerrArgument - rectangles are outside of bitmap area.
- * - source bitmap is empty (handle is null).
- * - destination bitmap displaymode differs
- * from source bitmap displaymode.
- */
- IMPORT_C static TInt ScaleBitmap( const CFbsBitmap& aSrcBitmap, const TRect& aSrcRect,
- CFbsBitmap& aDstBitmap, const TRect& aDstRect,
- TUint32 aOptions = 0 );
- };
-
-#endif // IHLBITMAPUTIL_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/IHLImageFactory.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*
-* Copyright (c) 2004-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: Static factory class for creating image instances.
-*
-*/
-
-
-#ifndef IHLIMAGEFACTORY_H
-#define IHLIMAGEFACTORY_H
-
-// INCLUDES
-#include <e32std.h>
-
-// FORWARD DECLARATION
-class RFs;
-class RFile;
-class MIHLFileImage;
-
-// CLASS DECLARATION
-/**
-* IHLImageFactory
-*
-* Static factory class for creating file instances.
-* @lib IHL.lib
-* @since 3.0
-*/
-class IHLImageFactory
- {
- public:
-
- /**
- * Open file and create new image instance.
- * Default filemode is EFileShareReadersOnly and if opening fails, EFileShareAny is used.
- * Method leaves with appropriate error code if file could not be opened.
- * If file is multi-image, new image contains handle to the first image.
- *
- * Note! Method may leave with KErrBadHandle if RFs::ShareProtected() method is not called!
- *
- * @since 3.0
- * @param aFs Fileserver reference.
- * @param aFilename Full path of image file.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenFileImageL( RFs& aFs, const TDesC& aFilename );
-
- /**
- * Open file and create new image instance.
- * Default filemode is EFileShareReadersOnly and if opening fails, EFileShareAny is used.
- * Method leaves with appropriate error code if
- * file could not be opened or index is out of bounds.
- *
- * Note! Method may leave with KErrBadHandle if RFs::ShareProtected() method is not called!
- *
- * @since 3.0
- * @param aFs Fileserver reference.
- * @param aFilename Full path of image file.
- * @param aImageIndex Image index. This is used in multi-image
- * file to determine which image is opened.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenFileImageL( RFs& aFs, const TDesC& aFilename,
- TInt aImageIndex );
-
- /**
- * Open file and create new image instance.
- * Default filemode is EFileShareReadersOnly and if opening fails, EFileShareAny is used.
- * Method leaves with appropriate error code if
- * file could not be opened or index is out of bounds.
- *
- * Note! Method may leave with KErrBadHandle if RFs::ShareProtected() method is not called!
- *
- * @since 3.0
- * @param aFs Fileserver reference.
- * @param aFilename Full path of image file.
- * @param aImageIndex Image index. This is used in multi-image
- * file to determine which image is opened.
- * @param aOptions Special opening options. Refer to MIHLFileImage header.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenFileImageL( RFs& aFs, const TDesC& aFilename,
- TInt aImageIndex, const TUint32 aOptions );
-
- /**
- * Create new image instance.
- * Method leaves with appropriate error code if file type is unknown.
- * @since 3.0
- * @param aFile Open file handle.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenFileImageL( RFile& aFile );
-
- /**
- * Create new image instance.
- * Method leaves with appropriate error code if
- * file type is unknown or index is out of bounds.
- * @since 3.0
- * @param aFile Open file handle.
- * @param aImageIndex Image index. This is used in multi-image
- * file to determine which image is opened.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenFileImageL( RFile& aFile, TInt aImageIndex );
-
- /**
- * Create new image instance.
- * Method leaves with appropriate error code if
- * file type is unknown or index is out of bounds.
- * @since 3.0
- * @param aFile Open file handle.
- * @param aImageIndex Image index. This is used in multi-image
- * file to determine which image is opened.
- * @param aOptions Special opening options. Refer to MIHLFileImage header.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenFileImageL( RFile& aFile, TInt aImageIndex,
- const TUint32 aOptions );
-
- /**
- * Create new image instance from buffered image data.
- * Method leaves with appropriate error code if buffer data could not be used.
- * If buffer contains multi-image, created image instance contains handle to
- * the first image.
- * @since 3.0
- * @param aFs Fileserver reference.
- * @param aDataBuf Buffer reference.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenBufferedFileImageL( RFs& aFs, const TDesC8& aDataBuf );
-
- /**
- * Create new image instance from buffered image data.
- * Method leaves with appropriate error code if buffer data could not be used
- * or image index is out of bounds. If buffer contains multi-image, created
- * image instance contains handle to the first image.
- * @since 3.0
- * @param aFs Fileserver reference.
- * @param aDataBuf Buffer reference.
- * @param aImageIndex Image index. This is used in multi-image
- * file to determine which image is opened.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenBufferedFileImageL( RFs& aFs, const TDesC8& aDataBuf,
- TInt aImageIndex );
-
- /**
- * Create new image instance from buffered image data.
- * Method leaves with appropriate error code if buffer data could not be used
- * or image index is out of bounds. If buffer contains multi-image, created
- * image instance contains handle to the first image.
- * @since 3.0
- * @param aFs Fileserver reference.
- * @param aDataBuf Buffer reference.
- * @param aImageIndex Image index. This is used in multi-image
- * file to determine which image is opened.
- * @param aOptions Special opening options. Refer to MIHLFileImage header.
- * @return New image instance.
- */
- IMPORT_C static MIHLFileImage* OpenBufferedFileImageL( RFs& aFs, const TDesC8& aDataBuf,
- TInt aImageIndex, const TUint32 aOptions );
-
- };
-
-#endif // IHLIMAGEFACTORY_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/IHLInterfaceIds.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* 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: Interface id's used in IHL interfaces.
-*
-*/
-
-
-#ifndef IHLINTERFACEIDS_H
-#define IHLINTERFACEIDS_H
-
-// INCLUDES
-#include <e32def.h>
-
-// -----------------------------------------------------------------------------
-// INTERFACE IDs
-// -----------------------------------------------------------------------------
-//
-// Images
-const TInt KIHLInterfaceIdFileImage = 0x0100;
-
-// Processors
-const TInt KIHLInterfaceIdBitmapProcessor = 0x0200;
-
-// Viewers
-const TInt KIHLInterfaceIdImageViewer = 0x0300;
-
-// Filters (reserved)
-// const TInt KIHLInterfaceIdFilter = 0x0400; // CSI: 13 #
-
-#endif // IHLINTERFACEIDS_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/IHLProcessorFactory.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* 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: Static factory class for creating processors.
-*
-*/
-
-
-#ifndef IHLPROCESSORFACTORY_H
-#define IHLPROCESSORFACTORY_H
-
-// INCLUDES
-#include <e32std.h>
-
-// FORWARD DECLARATION
-class MIHLBitmapProcessor;
-
-// CLASS DECLARATION
-/**
-* IHLProcessorFactory
-*
-* Static factory class for creating processors.
-* @lib IHL.lib
-* @since 3.0
-*/
-class IHLProcessorFactory
- {
- public:
-
- /**
- * Create new MIHLBitmapProcessor instance.
- * @since 3.0
- * @param aOptions Special options for bitmap processing. Refer to MIHLBitmapProcessor header.
- * @return New MIHLBitmapProcessor instance.
- */
- IMPORT_C static MIHLBitmapProcessor* CreateBitmapProcessorL( const TUint32 aOptions = 0 );
- };
-
-#endif // IHLPROCESSORFACTORY_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/IHLViewerFactory.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* 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: Static factory class for creating viewers.
-*
-*/
-
-
-#ifndef IHLVIEWERFACTORY_H
-#define IHLVIEWERFACTORY_H
-
-// INCLUDES
-#include <e32std.h>
-
-// FORWARD DECLARATION
-class MIHLImageViewer;
-class MIHLViewerObserver;
-class MIHLImage;
-class MIHLBitmap;
-
-// CLASS DECLARATION
-/**
-* IHLViewerFactory
-*
-* Static factory class for creating viewers.
-* @lib IHL.lib
-* @since 3.0
-*/
-class IHLViewerFactory
- {
- public:
-
- /**
- * Create new MIHLImageViewer instance.
- * References to image, bitmap and observer must remain valid
- * through viewer lifespan. Note that viewer start processing
- * immediately after it's created.
- * @since 3.0
- * @param aViewerSize Size of viewer. This is also maximum
- * size of destination bitmap.
- * @param aSource Source image reference.
- * @param aDestination Destination bitmap reference.
- * @param aObserver Viewer observer reference.
- * @param aOptions Viewer options. Refer to MIHLImageViewer header.
- * @return New MIHLImageViewer instance.
- */
- IMPORT_C static MIHLImageViewer* CreateImageViewerL( const TSize& aViewerSize,
- MIHLImage& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions = 0 );
- };
-
-#endif // IHLVIEWERFACTORY_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLBitmap.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-* 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: Pure virtual interface to bitmap and mask container.
-*
-*/
-
-
-#ifndef MIHLBITMAP_H
-#define MIHLBITMAP_H
-
-// INCLUDES
-#include <gdi.h>
-
-// FORWARD DECLARATION
-class MIHLBitmap;
-class CBitmapContext;
-class CFbsBitmap;
-
-
-// FACTORY DECLARATION
-class IHLBitmap
- {
- public:
-
- /**
- * Create new MIHLBitmap instance.
- * @since 3.0
- * @return New default MIHLBitmap instance.
- */
- IMPORT_C static MIHLBitmap* CreateL();
-
- };
-
-// CLASS DECLARATION
-/**
-* MIHLBitmap
-*
-* Pure virtual interface to bitmap and mask container.
-*
-* If interface needs to be pushed into CleanupStack,
-* remember to use CleanupStackDeletePushL() function!
-* DO NOT USE CleanupStack::PushL()!!
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLBitmap
- {
- public:
-
- /**
- * Virtual destructor.
- */
- virtual ~MIHLBitmap() {}
-
- public:
-
- /**
- * Create new bitmap.
- * @since 3.0
- * @param aSize Bitmap size.
- * @param aDisplayMode Bitmap displaymode.
- * @return KErrArgument if size is negative or displaymode is not supported.
- * Otherwise system wide error codes.
- */
- virtual TInt Create( const TSize& aSize, TDisplayMode aDisplayMode ) = 0;
-
- /**
- * Create new bitmap and mask.
- * @since 3.0
- * @param aSize Bitmap and mask size.
- * @param aBitmapDisplayMode Bitmap displaymode.
- * @param aMaskDisplayMode Mask displaymode (EGray2 or EGray256)
- * @return KErrArgument if size is negative or displaymode is not supported.
- * Otherwise system wide error codes.
- */
- virtual TInt Create( const TSize& aSize, TDisplayMode aBitmapDisplayMode,
- TDisplayMode aMaskDisplayMode ) = 0;
-
- /**
- * Copy or duplicate bitmap.
- * Copied bitmap has unique server handle and it can be
- * modified without risk of changes in given source bitmap.
- * Duplicated bitmap has same server handle than source bitmap
- * and modifying duplicated bitmap will also modify source bitmap.
- * @since 3.0
- * @param aBitmap Source bitmap that is copied or duplicated.
- * @param aDuplicate ETrue to duplicate, EFalse to copy.
- * @return System wide error codes.
- */
- virtual TInt Copy( const CFbsBitmap& aBitmap, TBool aDuplicate ) = 0;
-
- /**
- * Copy or duplicate bitmap and mask.
- * Copied bitmaps has unique server handles and they can be
- * modified without risk of changes in given source bitmaps.
- * Duplicated bitmaps has same server handles than source bitmaps
- * and modifying duplicated bitmaps will also modify source bitmaps.
- * @since 3.0
- * @param aBitmap Source bitmap that is copied or duplicated.
- * @param aBitmap Source aMask that is copied or duplicated.
- * @param aDuplicate ETrue to duplicate, EFalse to copy.
- * @return System wide error codes.
- */
- virtual TInt Copy( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask, TBool aDuplicate ) = 0;
-
- /**
- * Copy or duplicate MIHLBitmap.
- * Copied bitmaps has unique server handles and they can be
- * modified without risk of changes in given source bitmaps.
- * Duplicated bitmaps has same server handles than source bitmaps
- * and modifying duplicated bitmaps will also modify source bitmaps.
- * @since 3.0
- * @param aBitmap Source MIHLBitmap that is copied or duplicated.
- * @param aDuplicate ETrue to duplicate, EFalse to copy.
- * @return System wide error codes.
- */
- virtual TInt Copy( const MIHLBitmap& aBitmap, TBool aDuplicate ) = 0;
-
- /**
- * Release bitmap and mask server handles.
- * Create() and Copy() methods will call this
- * automatically if any old bitmaps exist.
- * @since 3.0
- */
- virtual void Reset() = 0;
-
- /**
- * Check if bitmap is created or copied.
- * This checks that bitmap handle is valid and exist.
- * @since 3.0
- * @return ETrue if bitmap exist, EFalse if bitmap handle is zero.
- */
- virtual TBool IsCreated() const = 0;
-
- /**
- * Return bitmap reference.
- * Use MIHLBitmap::IsCreated() method
- * to check if bitmap actually exist.
- * @since 3.0
- * @return Reference to bitmap.
- */
- virtual const CFbsBitmap& Bitmap() const = 0;
-
- /**
- * Check if mask bitmap handle is valid and exist.
- * @since 3.0
- * @return ETrue if mask exist, EFalse if mask handle is zero.
- */
- virtual TBool HasMask() const = 0;
-
- /**
- * Return mask reference.
- * Use MIHLBitmap::HasMask() method
- * to check if mask actually exist.
- * @since 3.0
- * @return Reference to mask.
- */
- virtual const CFbsBitmap& Mask() const = 0;
-
- /**
- * Draw bitmap to bitmap context.
- * If bitmaps are not created, method does nothing.
- * @param aContext Bitmap context where bitmap is drawn.
- * @param aPoint Draw position.
- * @since 3.0
- */
- virtual void Draw( CBitmapContext& aContext, const TPoint& aPoint ) const = 0;
-
- /**
- * Draw bitmap to bitmap context.
- * If bitmaps are not created, method does nothing.
- * @param aContext Bitmap context where bitmap is drawn.
- * @param aPoint Draw position.
- * @param aSourceRect Source rectangle that is drawn.
- * @since 3.0
- */
- virtual void Draw( CBitmapContext& aContext, const TPoint& aPoint,
- const TRect& aSourceRect ) const = 0;
-
- };
-
-#endif // MIHLBITMAP_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLBitmapProcessor.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
-* 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: Pure virtual interface to scaling processor
-* : using MIHLBitmaps.
-*
-*/
-
-
-#ifndef MIHLBITMAPPROCESSOR_H
-#define MIHLBITMAPPROCESSOR_H
-
-// INCLUDES
-#include <MIHLProcessor.h>
-
-// FORWARD DECLARATION
-class MIHLBitmap;
-class MIHFilter;
-
-// CLASS DECLARATION
-/**
-* MIHLBitmapProcessor
-*
-* Pure virtual interface to scaling processor using MIHLBitmaps.
-*
-* If interface needs to be pushed into CleanupStack,
-* remember to use CleanupStackDeletePushL() function!
-* DO NOT USE CleanupStack::PushL()!!
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLBitmapProcessor : public MIHLProcessor
- {
- public:
-
- /**
- * Virtual destructor.
- */
- virtual ~MIHLBitmapProcessor() {}
-
- public:
-
- /**
- * Flags to control scaler functionality.
- * These can be combined using an OR operation.
- * @since 3.0
- */
- enum TOptions
- {
- EOptionUseBilinearInterpolation = 0x01,
- };
-
- public:
-
- /**
- * Process rectangle from source bitmap to a rectangle
- * in destination bitmap. Scaled area can be also
- * rotated and/or mirrored during process.
- * See full description from MIHLScaler header.
- * @since 3.0
- * @param aStatus Process request status reference.
- * @param aSrcBitmap Source bitmap reference.
- * @param aSrcRect Rectangle that is processed from source bitmap.
- * @param aDstBitmap Destination bitmap reference.
- * @param aDstRect Rectangle that is filled in destination bitmap.
- * @return Return system wide error codes:
- * KErrArgument - rectangles are outside of bitmap area.
- * - source bitmap is empty (handle is null).
- * - destination bitmap is empty (handle is null).
- * - destination bitmap displaymode differs
- * from source bitmap displaymode.
- * KErrBusy - processor has request pending already.
- */
- virtual TInt Process( TRequestStatus& aStatus,
- const MIHLBitmap& aSrcBitmap,
- const TRect& aSrcRect,
- MIHLBitmap& aDstBitmap,
- const TRect& aDstRect ) = 0;
-
- /**
- * Check if processor has request pending.
- * @since 3.0
- * @return ETrue if request is pending, EFalse if not.
- */
- virtual TBool IsBusy() const = 0;
-
- /**
- * Cancel pending request.
- * If not active, method does nothing.
- * @since 3.0
- */
- virtual void CancelProcess() = 0;
-
- /**
- * Set filter.
- * For future use, not used currently!
- * @since 3.0
- */
- virtual void SetFilter( MIHFilter* aFilter ) = 0;
- };
-
-#endif // MIHLBITMAPPROCESSOR_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLFileImage.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*
-* 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: Pure virtual interface for file based image class.
-* : This class acts as a window into single image or animation
-* : in one physical file. Note that file will be locked as long
-* : as instance of this class is present.
-*
-*/
-
-
-#ifndef MIHLFILEIMAGE_H
-#define MIHLFILEIMAGE_H
-
-// INCLUDES
-#include <MIHLImage.h>
-#include <gdi.h>
-
-// FORWARD DECLARATION
-class MIHLBitmap;
-class MIHLFilter;
-
-// CLASS DECLARATION
-/**
-* MIHLFileImage
-*
-* Pure virtual interface for file based image class.
-* This class acts as a window into single image or animation
-* in one physical file. Note that file will be locked as long
-* as instance of this class is present.
-*
-* If interface needs to be pushed into CleanupStack,
-* remember to use CleanupDeletePushL() function!
-* DO NOT USE CleanupStack::PushL()!!
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLFileImage : public MIHLImage
- {
- public:
-
- /**
- * Virtual destructor.
- */
- virtual ~MIHLFileImage() {}
-
- public:
-
- /**
- * Flags to control file image functionality.
- * These can be combined using an OR operation.
- * @since 3.0
- */
- enum TOptions
- {
- EOptionNoDRMConsume = 0x01,
- };
-
- public:
-
- /**
- * Return image type's unique identifier.
- * @since 3.0
- * @return Image type Uid.
- */
- virtual const TUid& ImageType() const = 0;
-
- /**
- * Return image subtype's unique identifier.
- * @since 3.0
- * @return Image subtype Uid.
- */
- virtual const TUid& ImageSubType() const = 0;
-
- /**
- * Return image index of this instance from source file.
- * Note that animation is counted as an single image.
- * @since 3.0
- * @return Index of this instance.
- */
- virtual TInt ImageIndex() const = 0;
-
- /**
- * Return count of images in source file.
- * Note that animation is counted as an single image.
- * @since 3.0
- * @return Count of images in source file.
- */
- virtual TInt ImageCount() const = 0;
-
-
- /**
- * Return image size.
- * @since 3.0
- * @return Image size in pixels.
- */
- virtual TSize Size() const = 0;
-
- /**
- * Return preferred display mode for image.
- * Note that this display mode may differ from images original
- * display mode. Image processing may
- * need more colors than image has originally.
- * @since 3.0
- * @return Preferred image display mode.
- */
- virtual TDisplayMode DisplayMode() const = 0;
-
- /**
- * Return display mode of mask bitmap.
- * If image doesn't support transparency, ENone is returned.
- * @since 3.0
- * @return ENone if image is not transparent.
- * Mask display mode if image has transparency.
- */
- virtual TDisplayMode MaskDisplayMode() const = 0;
-
- /**
- * Return image background color.
- * @since 3.0
- * @return Image background color.
- */
- virtual TRgb BackgroundColor() const = 0;
-
- /**
- * Return array of fixed load sizes which can
- * be used in bitmap loading operation.
- * Array contain only sizes that differs from image original size.
- * If image can be loaded only to original size or it's fully
- * scaleable, array is empty.
- * Sizes starts from smallest and ends at largest.
- * @since 3.0
- * @return Array of supported image load sizes.
- */
- virtual const RArray<TSize>& CustomLoadSizeArray() const = 0;
-
- /**
- * Check if image can be loaded directly into any given load size.
- * @since 3.0
- * @return Array of supported image load sizes.
- */
- virtual TBool IsFullyScaleable() const = 0;
-
- /**
- * Check if image is animated.
- * @since 3.0
- * @return ETrue if image is animated, EFalse if not.
- */
- virtual TBool IsAnimation() const = 0;
-
- /**
- * Return animation frame count.
- * If image is not animated, it has no animation frames either.
- * @since 3.0
- * @return Animation frame count.
- */
- virtual TInt AnimationFrameCount() const = 0;
-
- /**
- * Return animation frame delay.
- * If image is not animated, it has no animation frames either.
- * @since 3.0
- * @param aAnimationFrameIndex Animation frame index.
- * @return Animation frame delay.
- */
- virtual TTimeIntervalMicroSeconds32 AnimationFrameDelay( TInt aAnimationFrameIndex ) const = 0;
-
- /**
- * Load image into bitmap.
- * If using scale support, given bitmap must be created with wanted size
- * from CustomLoadSizeArray(). Displaymode can be get from Displaymode() method.
- * Mask bitmap is always reseted. It's recreated if image is transparent by using
- * size of given bitmap and displaymode from MaskDisplayMode() method.
- * If image is animated, first animation frame is loaded.
- * @since 3.0
- * @param aStatus Load request status reference.
- * @param aDestination Destination bitmap reference.
- * @param aFrameIndex for loading single frame from image
- * @return Return system wide error codes:
- * KerrArgument if given bitmap is not created or it's size is incorrect.
- * KErrBusy image has load request pending already.
- */
- virtual TInt Load( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex = 0 ) = 0;
-
- /**
- * Load animation frame into bitmap.
- * If using scale support, given bitmap must be created with wanted size
- * from CustomLoadSizeArray(). Displaymode can be get from Displaymode() method.
- * Because some animations are build on top of previous frames, passing already loaded previous
- * frame as a destination bitmap will increase load speed of next frames.
- * Method will panic if given animation frame index is out of bounds.
- * @since 3.0
- * @param aStatus Load request status reference.
- * @param aDestination Destination bitmap reference.
- * @param aAnimationFrameIndex Animation frame index.
- * @return Return system wide error codes:
- * KErrArgument if given bitmap is not created or it's size is incorrect.
- * KErrBusy image has load request pending already.
- */
- virtual TInt LoadAnimation( TRequestStatus& aStatus, MIHLBitmap& aDestination,
- TInt aAnimationFrameIndex ) = 0;
-
- /**
- * Check if image has load request pending.
- * @since 3.0
- * @return ETrue if request is pending, EFalse if not.
- */
- virtual TBool IsBusy() const = 0;
-
- /**
- * Cancel pending load request.
- * If not active, method does nothing.
- * @since 3.0
- */
- virtual void CancelLoad() = 0;
-
- /**
- * Set filter.
- * For future use, not used currently!
- * @since 3.0
- */
- virtual void SetFilter( MIHLFilter* aFilter ) = 0;
- };
-
-#endif // MIHLFILEIMAGE_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLImage.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* 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: Pure virtual base class for all Image type interfaces.
-* : Class contains method to identify underlaying interface and
-* : implementation.
-*
-*/
-
-
-#ifndef MIHLIMAGE_H
-#define MIHLIMAGE_H
-
-// INCLUDES
-#include <TIHLInterfaceType.h>
-
-// CLASS DECLARATION
-/**
-* MIHLImage
-*
-* This is pure virtual base class for all Image type interfaces.
-* Class contains method to identify underlaying interface and
-* implementation.
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLImage
- {
- public:
-
- /**
- * Return identifier for underlaying interface
- * and implementation.
- * @since 3.0
- * @return Identifier for underlaying
- * interface and implementation.
- */
- virtual TIHLInterfaceType Type() const = 0;
-
- protected:
- // Derived class cannot be destructed through this interface
- ~MIHLImage() {}
- };
-
-#endif // MIHLIMAGE_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLImageViewer.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
-* 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: Pure virtual interface for Image Viewer class.
-* : Class can be used to view, process and play animation
-* : from source image.
-*
-*/
-
-
-#ifndef MIHLIMAGEVIEWER_H
-#define MIHLIMAGEVIEWER_H
-
-// INCLUDES
-#include <MIHLViewer.h>
-#include <e32std.h>
-
-// FORWARD DECLARATION
-class MIHLFilter;
-
-// CLASS DECLARATION
-/**
-* MIHLImageViewer
-*
-* Pure virtual interface for Image Viewer class.
-* Class can be used to view, process and play animation
-* from source image.
-*
-* If interface needs to be pushed into CleanupStack,
-* remember to use CleanupStackDeletePushL() function!
-* DO NOT USE CleanupStack::PushL()!!
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLImageViewer : public MIHLViewer
- {
- public:
-
- /**
- * Virtual destructor.
- */
- virtual ~MIHLImageViewer() {}
-
- public:
-
- /**
- * Flags to control viewer functionality.
- * These can be combined using an OR operation.
- * @since 3.0
- */
- enum TOptions
- {
- EOptionIgnoreAspectRatio = 0x01,
- EOptionUseBilinearInterpolation = 0x02
- };
-
- /**
- * Rotation angle of source image.
- * @since 3.0
- */
- enum TRotationAngle
- {
- ERotationAngle0 = 0,
- ERotationAngle90 = 90,
- ERotationAngle180 = 180,
- ERotationAngle270 = 270,
- };
-
- public:
-
- /**
- * Check if source image is animated.
- * @since 3.0
- * @return ETrue if source image is animated. EFalse if not.
- */
- virtual TBool IsAnimation() const = 0;
-
- /**
- * Start animation playback.
- * If source image is not animated, method does nothing.
- * @since 3.0
- */
- virtual void Play() = 0;
-
- /**
- * Stop animation playback.
- * If source image is not animated or animation is
- * not played currently, method does nothing.
- * @since 3.0
- */
- virtual void Stop() = 0;
-
- /**
- * Check if animation playback is currently running.
- * @since 3.0
- * @return ETrue if animation is running. EFalse if not.
- */
- virtual TBool IsPlaying() const = 0;
-
- /**
- * Count of frames in animated image.
- * If not animated, return zero.
- * @since 3.0
- * @return Frames count of animation.
- */
- virtual TInt AnimationFrameCount() const = 0;
-
- /**
- * Current animation frame in display.
- * @since 3.0
- * @return Current animation frame index.
- */
- virtual TInt AnimationFrame() const = 0;
-
- /**
- * Change current animation frame.
- * @since 3.0
- * @param aFrameIndex New animation frame.
- * @return System wide error code.
- */
- virtual TInt SetAnimationFrame( TInt aFrameIndex ) = 0;
-
- /**
- * Change viewer size.
- * This is also the maximum size of destination bitmap.
- * @since 3.0
- * @param aViewerSize New viewer size.
- * @return System wide error code.
- */
- virtual TInt SetViewerSize( const TSize& aViewerSize, TInt srcBitmapScaleFactor = 1 ) = 0;
-
- /**
- * Viewer size.
- * This is also the maximum size of destination bitmap.
- * @since 3.0
- * @return Viewer size.
- */
- virtual TSize ViewerSize() const = 0;
-
- /**
- * Move source clip rectangle.
- * This is the area that is used from source image
- * and processed to destination bitmap.
- * Check valid move area with SourceRect()
- * and SourceSize() methods.
- * @since 3.0
- * @param aDx Movement in X-axis.
- * @param aDy Movement in Y-axis.
- * @return System wide error code.
- */
- virtual TInt MoveSourceRect( TInt aDx, TInt aDy ) = 0;
-
- /**
- * Set source clip rectangle position.
- * This is the area that is used from source image
- * and processed to destination bitmap.
- * Check valid move area with SourceRect()
- * and SourceSize() methods.
- * @since 3.0
- * @param aPosition Topleft posion of rectangle.
- * @return System wide error code.
- */
- virtual TInt SetSourceRectPosition( const TPoint& aPosition ) = 0;
-
- /**
- * This is the area that is used from source image
- * and processed to destination bitmap.
- * @since 3.0
- * @return Source clip rectangle.
- */
- virtual TRect SourceRect() const = 0;
-
- /**
- * Source image size.
- * Note that this will change if image is rotated.
- * @since 3.0
- * @return Source image size.
- */
- virtual TSize SourceSize() const = 0;
-
- /**
- * Set new zoom ratio.
- * Zoom ratio is multiplier for scaling,
- * 0,5 is 50%, 1.0 is 100%, 2,0 is 200% and so on.
- * Value cannot be zero or negative.
- * @since 3.0
- * @param aZoomRatio New zoom ratio.
- * @return System wide error code.
- */
- virtual TInt SetZoomRatio( TReal aZoomRatio ) = 0;
-
- /**
- * Current zoom ratio.
- * @since 3.0
- * @return Current zoom ratio.
- */
- virtual TReal ZoomRatio() const = 0;
-
- /**
- * Zoom to fit ratio.
- * Using this zoom ratio, image will fit
- * exactly to viewer.
- * @since 3.0
- * @return Zoom to fit ratio.
- */
- virtual TReal ZoomToFitRatio() const = 0;
-
- /**
- * Rotate source image 90 degree clockwise.
- * Source rect is also moved to remain in same position
- * where it was according to source image data.
- * @since 3.0
- * @return System wide error code.
- */
- virtual TInt RotateClockwise() = 0;
-
- /**
- * Rotate source image 90 degree counterclockwise.
- * Source rect is also moved to remain in same position
- * where it was according to source image data.
- * @since 3.0
- * @return System wide error code.
- */
- virtual TInt RotateCounterClockwise() = 0;
-
- /**
- * Set rotation angle. Use values from TRotationAngle enumeration.
- * Source rect is also moved to remain in same position
- * where it was according to source image data.
- * @since 3.0
- * @param aRotationAngle New rotation angle.
- * @return System wide error code.
- */
- virtual TInt SetRotationAngle( TInt aRotationAngle ) = 0;
-
- /**
- * Current rotation angle.
- * @since 3.0
- * @return Current rotation angle.
- */
- virtual TInt RotationAngle() const = 0;
-
- /**
- * Set vertical mirroring for source image.
- * Source rect is also moved to remain in same position
- * where it was according to source image data.
- * @since 3.0
- * @param aValue Mirroring flag.
- * @return System wide error code.
- */
- virtual TInt SetVerticalMirroring( TBool aValue ) = 0;
-
- /**
- * Check if source is vertically mirrored.
- * @since 3.0
- * @return ETrue if mirrored, EFalse if not.
- */
- virtual TBool VerticalMirroring() const = 0;
-
- /**
- * Set horizontal mirroring for source image.
- * Source rect is also moved to remain in same position
- * where it was according to source image data.
- * @since 3.0
- * @param aValue Mirroring flag.
- * @return System wide error code.
- */
- virtual TInt SetHorizontalMirroring( TBool aValue ) = 0;
-
- /**
- * Check if source is horizontally mirrored.
- * @since 3.0
- * @return ETrue if mirrored, EFalse if not.
- */
- virtual TBool HorizontalMirroring() const = 0;
-
- /**
- * Set filter.
- * For future use, not used currently!
- * @since 3.0
- */
- virtual void SetFilter( MIHLFilter* aFilter ) = 0;
- };
-
-#endif // MIHLIMAGEVIEWER_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLProcessor.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* 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: Pure virtual base class for all Processor type interfaces.
-* : Class contains method to identify underlaying interface and
-* : implementation.
-*
-*/
-
-
-#ifndef MIHLPROCESSOR_H
-#define MIHLPROCESSOR_H
-
-// INCLUDES
-#include <TIHLInterfaceType.h>
-
-// CLASS DECLARATION
-/**
-* MIHLProcessor
-*
-* This is pure virtual base class for all Processor type interfaces.
-* Class contains method to identify underlaying interface and
-* implementation.
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLProcessor
- {
- public:
-
- /**
- * Return identifier for underlaying interface
- * and implementation.
- * @since 3.0
- * @return Identifier for underlaying
- * interface and implementation.
- */
- virtual TIHLInterfaceType Type() const = 0;
-
- protected:
- // Derived class cannot be destructed through this interface
- ~MIHLProcessor() {}
- };
-
-#endif // MIHLPROCESSOR_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLScaler.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
-* 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: Pure virtual interface to bitmap scaler
-* : using Font and Bitmap Server bitmaps.
-*
-*/
-
-
-#ifndef MIHLSCALER_H
-#define MIHLSCALER_H
-
-// INCLUDES
-#include <e32std.h>
-
-// FORWARD DECLARATION
-class MIHLScaler;
-class MIHFilter;
-class CFbsBitmap;
-
-// FACTORY DECLARATION
-class IHLScaler
- {
- public:
-
- /**
- * Create new MIHLScaler instance.
- * @since 3.0
- * @param aOptions Special options for bitmap scaling. Use MIHLScaler::TOptions values.
- * @return New scaler instance.
- */
- IMPORT_C static MIHLScaler* CreateL( const TUint32 aOptions = 0 );
- };
-
-// CLASS DECLARATION
-/**
-* MIHLScaler
-*
-* Pure virtual interface to bitmap scaler
-* using Font and Bitmap Server bitmaps.
-*
-* If interface needs to be pushed into CleanupStack,
-* remember to use CleanupStackDeletePushL() function!
-* DO NOT USE CleanupStack::PushL()!!
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLScaler
- {
- public:
-
- /**
- * Virtual destructor.
- */
- virtual ~MIHLScaler() {}
-
- public:
-
- /**
- * Flags to control scaler functionality.
- * These can be combined using an OR operation.
- * @since 3.0
- */
- enum TOptions
- {
- EOptionUseBilinearInterpolation = 0x01,
- };
-
- public:
-
- /**
- * Scale rectangle from source bitmap to a rectangle
- * in destination bitmap. Scaled area can be also
- * rotated and/or mirrored during process.
- *
- * Rotating is done by defining SOURCE rectangle
- * topleft and bottomright corners in following way:
- *
- * No rotate: tl----- 90 degree: -----tl
- * | | | |
- * | | | |
- * -----br br-----
- *
- * 180 degree: br----- 270 degree: -----br
- * | | | |
- * | | | |
- * -----tl tl-----
- *
- * Mirroring is done by defining DESTINATION rectangle
- * topleft and bottomright corners in following way:
- *
- * No mirroring: tl-----
- * | |
- * | |
- * -----br
- *
- * X-axis mirroring: -----tl
- * | |
- * | |
- * br-----
- *
- * Y-axis mirroring: -----br
- * | |
- * | |
- * tl-----
- *
- * X and Y-axis br-----
- * mirroring: | |
- * | |
- * -----tl
- *
- * @since 3.0
- * @param aStatus Process request status reference.
- * @param aSrcBitmap Source bitmap reference.
- * @param aSrcRect Rectangle that is processed from source bitmap.
- * @param aDstBitmap Destination bitmap reference.
- * If destination bitmap has null handle,
- * processor will create new bitmap using size of
- * destination rectangle.
- * @param aDstRect Rectangle that is filled in destination bitmap.
- * @return Return system wide error codes:
- * KerrArgument - rectangles are outside of bitmap area.
- * - source bitmap is empty (handle is null).
- * - destination bitmap displaymode differs
- * from source bitmap displaymode.
- * KErrBusy - processor has request pending already.
- */
- virtual TInt Scale( TRequestStatus& aStatus,
- const CFbsBitmap& aSrcBitmap,
- const TRect& aSrcRect,
- CFbsBitmap& aDstBitmap,
- const TRect& aDstRect ) = 0;
-
- /**
- * Check if processor has request pending.
- * @since 3.0
- * @return ETrue if request is pending, EFalse if not.
- */
- virtual TBool IsBusy() const = 0;
-
- /**
- * Cancel pending request.
- * If not active, method does nothing.
- * @since 3.0
- */
- virtual void CancelProcess() = 0;
-
- /**
- * Set filter.
- * For future use, not used currently!
- * @since 3.0
- */
- virtual void SetFilter( MIHFilter* aFilter ) = 0;
- };
-
-#endif // MIHLSCALER_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLViewer.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* 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: Pure virtual base class for all Viewer type interfaces.
-* : Class contains method to identify underlaying interface and
-* : implementation.
-*
-*/
-
-
-#ifndef MIHLVIEWER_H
-#define MIHLVIEWER_H
-
-// INCLUDES
-#include <TIHLInterfaceType.h>
-
-// CLASS DECLARATION
-/**
-* MIHLViewer
-*
-* This is pure virtual base class for all Viewer type interfaces.
-* Class contains method to identify underlaying interface and
-* implementation.
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLViewer
- {
- public:
-
- /**
- * Return identifier for underlaying interface
- * and implementation.
- * @since 3.0
- * @return Identifier for underlaying
- * interface and implementation.
- */
- virtual TIHLInterfaceType Type() const = 0;
-
- protected:
- // Derived class cannot be destructed through this interface
- ~MIHLViewer() {}
- };
-
-#endif // MIHLVIEWER_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/MIHLViewerObserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-* 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: Pure virtual base class for viewer observer.
-*
-*/
-
-
-#ifndef IHLVIEWEROBSERVER_H
-#define IHLVIEWEROBSERVER_H
-
-// INCLUDES
-#include <e32std.h>
-
-// CLASS DECLARATION
-/**
-* MIHLViewerObserver
-*
-* Pure virtual base class for viewer observer.
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLViewerObserver
- {
- public:
-
- /**
- * This callback is currently not supported!
- *
- * Notifies client of viewer events.
- * Event codes are defined in viewer header.
- * Leave situation is handled in ViewerError() callback.
- * @since 3.0
- * @param aEvent Type of event.
- * @param aEventCode1 Event specific code 1.
- * @param aEventCode2 Event specific code 2.
- */
- virtual void ViewerEventL( TInt /*aEvent*/, TInt /*aEventCode1*/, TInt /*aEventCode2*/ ) {}
-
- /**
- * Notifies client when viewer bitmap content is changed.
- * Leave situation is handled in ViewerError() callback.
- * @since 3.0
- */
- virtual void ViewerBitmapChangedL() = 0;
-
- /**
- * Notifies client if error occurs in viewer.
- * @since 3.0
- * @param aError System wide error code.
- */
- virtual void ViewerError( TInt aError ) = 0;
-
- };
-
-#endif // IHLIMAGEVIEWEROBSERVER_H
-
-// End of File
--- a/imagehandling_plat/image_handling_library_api/inc/TIHLInterfaceType.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
-* 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: This struct contain interface and
-* : implementation ids for IHL classes.
-*
-*/
-
-
-#ifndef TIHLINTERFACETYPE_H
-#define TIHLINTERFACETYPE_H
-
-// INCLUDES
-#include <e32std.h>
-
-// CLASS DECLARATION
-/**
-* TIHLInterfaceType
-*
-* This struct contain interface and
-* implementation ids for IHL classes.
-*
-* Used id values are defined in IHLInterfaceIds.h header.
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class TIHLInterfaceType
- {
- public: // Constructor and destructor
-
- inline TIHLInterfaceType( TInt aInterfaceId, TInt aImplementationId );
- virtual ~TIHLInterfaceType() {};
-
- public: // Public data
-
- /**
- * Class interface id.
- * Used to identify interface type currently in use.
- */
- TInt iInterfaceId;
-
- /**
- * Class implementation id.
- * Used to identify implementation class behind interface.
- * For internal use.
- */
- TInt iImplementationId;
-
- };
-
-inline TIHLInterfaceType::TIHLInterfaceType( TInt aInterfaceId, TInt aImplementationId )
-:iInterfaceId( aInterfaceId ), iImplementationId( aImplementationId ) {}
-
-#endif // TIHLINTERFACETYPE_H
-
-// End of File
--- a/imagehandling_plat/thumbnailmanager_api/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-* 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: File that exports the files belonging to
-* : Thumbnailmanager API
-*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-#ifdef RD_THUMBNAILMANAGER
-
-../inc/thumbnaildata.h MW_LAYER_PLATFORM_EXPORT_PATH(thumbnaildata.h)
-../inc/thumbnailmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(thumbnailmanager.h)
-../inc/thumbnailmanagerobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(thumbnailmanagerobserver.h)
-../inc/thumbnailobjectsource.h MW_LAYER_PLATFORM_EXPORT_PATH(thumbnailobjectsource.h)
-../inc/thumbnailmanager_qt.h MW_LAYER_PLATFORM_EXPORT_PATH(thumbnailmanager_qt.h)
-
-#endif // RD_THUMBNAILMANAGER
-
-// End of File
-
-
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnaildata.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-* 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: Thumbnail object
- *
-*/
-
-
-#ifndef THUMBNAILDATA_H
-#define THUMBNAILDATA_H
-
-#include <e32std.h>
-
-class CFbsBitmap;
-
-/**
- * Thumbnail object.
- *
- * @since S60 S60 v5.0
- */
-NONSHARABLE_CLASS( MThumbnailData )
- {
-public:
-
- /**
- * Get a pointer to a CFbsBitmap containing the thumbnail image. Ownership
- * of the object is not transferred (i.e. client must not delete the
- * pointer).
- *
- * @since S60 v5.0
- * @return Pointer to a bitmap representing the thumbnail or NULL if
- * thumbnail pointer is not available or it has been detached.
- */
- virtual CFbsBitmap* Bitmap() = 0;
-
- /**
- * Get a pointer to a CFbsBitmap containing the thumbnail image. Ownership
- * of the object is transferred to the caller. Client must delete the
- * bitmap after it is done processing it.
- *
- * @since S60 v5.0
- * @return Pointer to a bitmap representing the thumbnail or NULL if
- * thumbnail pointer is not available or it has been detached.
- * Caller assumes ownership of the bitmap.
- */
- virtual CFbsBitmap* DetachBitmap() = 0;
-
- /**
- * Get client data structure.
- *
- * @since S60 v5.0
- * @return A pointer for client data specified as a parameter for
- * GetThumbnailL() or NULL if not specified.
- */
- virtual TAny* ClientData() = 0;
-};
-
-#endif // THUMBNAILDATA_H
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,590 +0,0 @@
-/*
-* 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: Main interface class to Thumbnail Manager
- *
-*/
-
-
-#ifndef THUMBNAILMANAGER_H
-#define THUMBNAILMANAGER_H
-
-#include <e32base.h>
-#include <gdi.h>
-#include <badesca.h>
-
-#include <thumbnailobjectsource.h>
-
-class MThumbnailManagerObserver;
-class MThumbnailManagerRequestObserver;
-
-typedef TInt TThumbnailRequestId;
-
-typedef TUint32 TThumbnailId;
-typedef enum
-{
-EUnknownThumbnailSize,
-ECustomThumbnailSize,
-EImageGridThumbnailSize,
-EImageListThumbnailSize,
-EImageFullScreenThumbnailSize,
-EVideoGridThumbnailSize,
-EVideoListThumbnailSize,
-EVideoFullScreenThumbnailSize,
-EAudioGridThumbnailSize,
-EAudioListThumbnailSize,
-EAudioFullScreenThumbnailSize,
-EGridThumbnailSize,
-EListThumbnailSize,
-EFullScreenThumbnailSize,
-EContactGridThumbnailSize,
-EContactListThumbnailSize,
-EContactFullScreenThumbnailSize,
-EThumbnailSizeCount //last item, don't remove
-} TThumbnailSize;
-/**
- * Thumbnail engine.
- *
- * This is the main interface class to thumbnail engine. Thumbnail engine
- * can be used to request thumbnails for different kinds of media objects.
- *
- * The client using thumbnail engine must implement the
- * MThumbnailManagerObserver. The observer interface is used to provide
- * thumbnail data when it is available.
- *
- * Typical use of thumbnail engine consists of 4 parts:
- * - creating an engine instance using NewL
- * - setting thumbnail parameters using SetThumbnailSizeL(), SetFlags(),
- * and so on
- * - creating an object source (CThumbnailObjectSource) and using it to
- * request thumbnails
- * - handling MThumbnailManagerObserver callbacks when the thumbnail request
- * is complete
- *
- * Here is an example of how thumbnail engine could be used by a typical
- * application:
- *
- * @code
- *
- * #include <thumbnailmanagerobserver.h>
- * #include <thumbnailmanager.h>
- *
- * class CMyThumbnailControl: public CCoeControl,
- * public MThumbnailManagerObserver
- * {
- * public:
- * CMyThumbnailControl();
- * ~CMyThumbnailControl();
- * ...
- *
- * // Callbacks from MThumbnailManagerObserver for getting thumbnails
- * void ThumbnailPreviewReady(
- * MThumbnailData& aThumbnail,
- * TThumbnailRequestId aId );
- * void ThumbnailReady(
- * TInt aError,
- * MThumbnailData& aThumbnail,
- * TThumbnailRequestId aId );
- *
- * private:
- * void ConstructL();
- * CThumbnailManager* iManager;
- * CFbsBitmap* iBitmap;
- * }
- *
- * _LIT( KTestFilePath, "e:\\TestImage.jpg" );
- * _LIT( KTestFileType, "image/jpeg" );
- *
- * void CMyThumbnailControl::ConstructL()
- * {
- * // Create Thumbnail Manager instance. This object is the observer.
- * iManager = CThumbnailManager::NewL( *this );
- *
- * // Set flags: If the aspect ratio of the media object does not match
- * // 4:3 then we would like it to be cropped. We don’t mind getting
- * // smaller images than requested.
- * iManager->SetFlagsL( CThumbnailManager::ECropToAspectRatio |
- * CThumbnailManager::EAllowAnySize );
- *
- * // Preferred size is 160x120 (or less)
- * iManager->SetSizeL( TSize( 160, 120 ) );
- *
- * // Get a preview thumbnail first, if available.
- * // The preview thumbnail is delivered via a ThumbnailPreviewReady()
- * // callback.
- * iManager->SetQualityPreferenceL(
- * CThumbnailManager::EOptimizeForQualityWithPreview );
- *
- * // Create an object source representing a path to a file on local
- * // file system.
- * CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(
- * KTestFilePath, // File path
- * KTestFileType ); // Let Thumbnail Manager know it’s a JPEG, so
- * // it doesn’t need to recognize the file format
- *
- * // Issue the request using default priority
- * iManager->GetThumbnailL( *source );
- *
- * // If GetThumbnailL() did not leave, the ThumbnailReady() callback is
- * // now guaranteed to be called, unless the request is cancelled or
- * // CThumbnailManager instance is deleted.
- *
- * // The source can be deleted immediately after issuing the request
- * CleanupStack::PopAndDestroy( source );
- * }
- *
- * CMyThumbnailControl::~CMyThumbnailControl()
- * {
- * // Bitmap should be destroyed before Thumbnail Manager
- * delete iBitmap;
- * delete iManager;
- * }
- *
- * void CMyThumbnailControl::ThumbnailReady(
- * TInt aError,
- * MThumbnailData& aThumbnail,
- * TThumbnailRequestId aId )
- * {
- * // This function must not leave.
- *
- * delete iBitmap; iBitmap = NULL;
- * if ( !aError )
- * {
- * // Claim ownership of the bitmap instance for later use
- * iBitmap = aThumbnail.DetachBitmap();
- *
- * // We can now use iBitmap in our Draw() method
- * DrawDeferred();
- * }
- * else
- * {
- * // An error occurred while getting the thumbnail.
- * // Perhaps we should show a broken image icon to the user.
- * }
- * }
- *
- * @endcode
- *
- * @lib thumbnailmanager.lib
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbnailManager ): public CBase
- {
-public:
- /**
- * Flags for thumbnail creation.
- * These can be combined using bitwise or.
- */
- enum TThumbnailFlags
- {
- /**
- * Default flags. This means that:
- * - Thumbnail must be as large as requested (unless the actual
- * object is smaller).
- * - Smaller thumbnails may be up scaled to desired resolution.
- * - Aspect ratio is maintained and thumbnails are not cropped. The
- * resulting thumbnail may smaller in either width or height if
- * the aspect ratio of the object does not match the aspect ratio
- * of the requested size.
- */
- EDefaultFlags = 0,
-
- /**
- * Allow thumbnails which are smaller than requested are. Thumbnail
- * bitmaps are never up scaled if this flag is set.
- */
- EAllowAnySize = 1,
-
- /**
- * New thumbnail images are not created if this flag is set. Only
- * existing thumbnails may be returned. If a requested thumbnail does
- * not exist, KErrNotFound error is returned in ThumbnailReady()
- * callback.
- */
- EDoNotCreate = 2,
-
- /**
- * Thumbnail images are cropped to match requested aspect ratio. If
- * this flag is set, the size of the resulting thumbnail always
- * matches the requested size.
- */
- ECropToAspectRatio = 4
- };
-
- /** Quality versus speed preference setting */
- enum TThumbnailQualityPreference
- {
- /**
- * Prefer thumbnails in the highest quality possible disregarding
- * any negative impact on performance.
- */
- EOptimizeForQuality,
-
- /**
- * Get thumbnails as fast as possible, even if
- * it means lower quality.
- */
- EOptimizeForPerformance,
-
- /**
- * Get lower quality preview thumbnail as fast as possible first and
- * then a higher quality thumbnail later. The preview thumbnail is
- * provided in the ThumbnailPreviewReady() callback and the high
- * quality thumbnail in ThumbnailReady(). ThumbnailPreviewReady()
- * is not get called at all if a suitable existing thumbnail is not
- * found or if a high quality version is already available.
- */
- EOptimizeForQualityWithPreview
- };
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @param aObserver Observer to receive notifications about completed
- * operations.
- * @return New CThumbnailManager instance.
- */
- IMPORT_C static CThumbnailManager* NewL( MThumbnailManagerObserver&
- aObserver );
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @param aObserver Observer to receive notifications about completed
- * operations.
- * @return New CThumbnailManager instance (on cleanup stack).
- */
- IMPORT_C static CThumbnailManager* NewLC( MThumbnailManagerObserver&
- aObserver );
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailManager();
-
- /**
- * Get the current display mode for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @return Current display mode for the thumbnail bitmaps.
- */
- virtual TDisplayMode DisplayMode()const = 0;
-
- /**
- * Set the current display mode for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @param aDisplayMode New display mode value for the thumbnail bitmaps.
- */
- virtual void SetDisplayModeL( TDisplayMode aDisplayMode ) = 0;
-
- /**
- * Get the current quality versus performance preference.
- *
- * @since S60 v5.0
- * @return Current quality versus performance preference.
- */
- virtual TThumbnailQualityPreference QualityPreference()const = 0;
-
- /**
- * Set quality versus performance preference.
- *
- * @since S60 v5.0
- * @param aQualityPreference New quality versus performance preference
- * value.
- */
- virtual void SetQualityPreferenceL( TThumbnailQualityPreference
- aQualityPreference ) = 0;
-
- /**
- * Get the current desired size for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @return Current desired size for thumbnail bitmaps (in pixels).
- */
- virtual const TSize& ThumbnailSize()const = 0;
-
- /**
- * Set desired size for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @param aThumbnailSize New quality for the desired thumbnail size.
- */
- virtual void SetThumbnailSizeL( const TSize& aThumbnailSize ) = 0;
-
-
- /**
- * Get current flags for thumbnail generation.
- *
- * @since S60 v5.0
- * @return Current flags.
- */
- virtual TThumbnailFlags Flags()const = 0;
-
- /**
- * Set flags for thumbnail generation. Several flags may be enabled
- * by combining the values using bitwise or.
- *
- * @since S60 v5.0
- * @param aFlags New flags.
- */
- virtual void SetFlagsL( TThumbnailFlags aFlags ) = 0;
-
- /**
- * Get a thumbnail for an object file. If a thumbnail already exists, it
- * is loaded and if a thumbnail does not exist, it is created
- * transparently. ThumbnailReady() callback will be called when the
- * operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- virtual TThumbnailRequestId GetThumbnailL( CThumbnailObjectSource&
- aObjectSource, TAny* aClientData = NULL, TInt aPriority = CActive
- ::EPriorityStandard ) = 0;
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- */
- virtual void DeleteThumbnails( CThumbnailObjectSource& aObjectSource ) = 0;
-
- /**
- * Create thumbnail for a given object. This is an asynchronous
- * operation, which always returns immediately. No callbacks are
- * emitted.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- virtual TThumbnailRequestId CreateThumbnails( CThumbnailObjectSource&
- aObjectSource, TInt aPriority = CActive::EPriorityIdle ) = 0;
-
- /**
- * Cancel a thumbnail operation.
- *
- * @since S60 v5.0
- * @param aId Request ID for the operation to be cancelled.
- * @return Symbian OS error code or KErrNone if cancelling was
- * successful.
- */
- virtual TInt CancelRequest( TThumbnailRequestId aId ) = 0;
-
- /**
- * Change the priority of a queued thumbnail operation.
- *
- * @since S60 v5.0
- * @param aId Request ID for the request which to assign a new
- * priority.
- * @param aNewPriority New priority value
- * @return Symbian OS error code or KErrNone if change was
- * successful.
- */
- virtual TInt ChangePriority( TThumbnailRequestId aId, TInt aNewPriority ) = 0;
-
- /**
- * Get a list of supported file formats for object files.
- *
- * The return value is a reference to a list that contains each
- * supported MIME type. There may also be wildcards, such as "image/*".
- *
- * The returned reference is valid until CThumbnailManager is
- * destroyed or GetSupportedMimeTypesL() is called again.
- *
- * @since S60 v5.0
- * @return A list of supported MIME types. May contain wildcards.
- * Ownership not transferred.
- */
- virtual const CDesCArray& GetSupportedMimeTypesL() = 0;
-
- /**
- * Delete thumbnails by TThumbnailId. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aItemId TThumbnailId
- */
- virtual void DeleteThumbnails( const TThumbnailId aItemId ) = 0;
-
-/**
- * Set desired size for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @param aThumbnailSize Desired thumbnail size.
- */
- virtual void SetThumbnailSizeL( const TThumbnailSize aThumbnailSize ) = 0;
-
- /**
- * Get a persistent thumbnail for an object file. If a thumbnail already
- * exists, it is loaded and if a thumbnail does not exist, it is created
- * transparently. ThumbnailReady() callback will be called when the
- * operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aThumbnailId Thumbnail ID
- * @param aThumbnailSizeType Thumbnail size enumeration
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- virtual TThumbnailRequestId GetThumbnailL( const TThumbnailId aThumbnailId,
- TAny* aClientData = NULL,
- TInt aPriority = CActive::EPriorityStandard ) = 0;
-
-
- /**
- * Set a thumbnail for an object file generated from buffer delivered in source
- * object. ThumbnailReady() callback will be called when the
- * operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aThumbnailId Thumbnail ID
- * @param aThumbnailSizeType Thumbnail size enumeration
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- virtual TThumbnailRequestId SetThumbnailL( CThumbnailObjectSource& aObjectSource,
- TAny* = NULL,
- TInt aPriority = CActive::EPriorityIdle ) = 0;
-
-
- /**
- * Import an image to be used as thumbnail for an object. If a
- * thumbnail already exists, it is loaded and if a thumbnail does not
- * exist, it is created transparently. ThumbnailReady() callback will be
- * called when the operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- virtual TThumbnailRequestId ImportThumbnailL( CThumbnailObjectSource& aObjectSource,
- const TDesC& aTargetUri, TAny* aClientData = NULL,
- TInt aPriority = CActive::EPriorityIdle ) = 0;
-
- /**
- * Update Thumbnails by TThumbnailId. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aItemId TThumbnailId
- * @param aPath (New) path for the Thumbnail
- * @param aOrientation Thumbnail orientation
- * @param aModified Last modified
- */
- virtual void UpdateThumbnailsL( const TThumbnailId aItemId, const TDesC& aPath,
- const TInt aOrientation, const TInt64 aModified, const TInt aPriority ) = 0;
-
- /**
- * Rename Thumbnails. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aCurrentPath Current path of the Thumbnail
- * @param aNewPath New path for the Thumbnail
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- virtual TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath,
- const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle ) = 0;
-
- /**
- * Set optional request observer for getting information about completed
- * requests that don't include a thumbnail.
- *
- * @since Symbian^3
- * @param aObserver Observer to receive notifications.
- */
- virtual void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver ) = 0;
-
- /**
- * Remove optional request observer.
- *
- * @since Symbian^3
- */
- virtual void RemoveRequestObserver() = 0;
-};
-
-#endif // THUMBNAILMANAGER_H
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Qt interface class to Thumbnail Manager
-*
-*/
-
-#ifndef THUMBNAILMANAGER_QT_H
-#define THUMBNAILMANAGER_QT_H
-
-#include <QObject>
-#include <QPixmap>
-#include <QImage>
-
-#include <QtGlobal>
-
-class QString;
-class QSize;
-
-class ThumbnailManagerPrivate;
-class TestThumbnailManager;
-
-#ifdef TNMQT_DLL
-# define TNM_EXPORT Q_DECL_EXPORT
-#else
-# define TNM_EXPORT Q_DECL_IMPORT
-#endif
-
-
-/** default priority value */
-const int tnmWrapperPriorityIdle = -100;
-
-class ThumbnailManager : public QObject
- {
- Q_OBJECT
-
-public:
-
- /** Thumbnail size. */
- enum ThumbnailSize
- {
- /**
- * Small thumbnail
- */
- ThumbnailSmall = 0,
- /**
- * Medium thumbnail
- */
- ThumbnailMedium,
- /**
- * Large thumbnail
- */
- ThumbnailLarge
- };
-
- /** Mode of thumbnail creation. */
- enum ThumbnailMode
- {
- /**
- * Default mode. This means that:
- * - Thumbnail must be as large as requested (unless the actual object is smaller).
- * - Smaller thumbnails may be up scaled to desired resolution.
- * - Aspect ratio is maintained and thumbnails are not cropped. The
- * resulting thumbnail may smaller in either width or height if
- * the aspect ratio of the object does not match the aspect ratio
- * of the requested size.
- */
- Default = 0,
-
- /**
- * Allow thumbnails which are smaller than requested are. Thumbnail
- * bitmaps are never up scaled if this flag is set.
- */
- AllowAnySize = 1,
-
- /**
- * New thumbnail images are not created if this flag is set. Only
- * existing thumbnails may be returned. If a requested thumbnail does
- * not exist null pixmap will be returned.
- */
- DoNotCreate = 2,
-
- /**
- * Thumbnail images are cropped to match requested aspect ratio. If
- * this mode is set, the size of the resulting thumbnail always
- * matches the requested size.
- */
- CropToAspectRatio = 4
- };
-
- /** Quality versus speed preference setting */
- enum QualityPreference
- {
- /**
- * Prefer thumbnails in the highest quality possible disregarding
- * any negative impact on performance.
- */
- OptimizeForQuality,
-
- /**
- * Get thumbnails as fast as possible, even if
- * it means lower quality.
- */
- OptimizeForPerformance
- };
-
-
- /**
- * Constructor
- *
- * @param parentPtr parent
- */
- TNM_EXPORT ThumbnailManager( QObject* parentPtr = NULL );
-
- /**
- * Destructor
- */
- TNM_EXPORT ~ThumbnailManager();
-
- /**
- * Get quality versus performance preference.
- *
- * @return quality versus performance preference
- */
- TNM_EXPORT QualityPreference qualityPreference() const;
-
- /**
- * Set quality versus performance preference.
- *
- * @param qualityPreference New quality versus performance preference
- * value.
- * @return true on success
- */
- TNM_EXPORT bool setQualityPreference( QualityPreference qualityPreference );
-
- /**
- * Get the current desired size for thumbnail bitmaps.
- *
- * @return Current desired size for thumbnail bitmaps (in pixels).
- */
- TNM_EXPORT QSize thumbnailSize() const;
-
- /**
- * Set desired size for thumbnail bitmaps.
- *
- * @param thumbnailSize New desired thumbnail size.
- * @return true on success
- */
- TNM_EXPORT bool setThumbnailSize( const QSize& thumbnailSize );
-
- /**
- * Set desired size for thumbnail bitmaps.
- *
- * @param thumbnailSize New desired thumbnail size.
- * @return true on success
- */
- TNM_EXPORT bool setThumbnailSize( ThumbnailSize thumbnailSize );
-
- /**
- * Get current mode for thumbnail generation.
- *
- * @return Current mode.
- */
- TNM_EXPORT ThumbnailMode mode() const;
-
- /**
- * Set mode for thumbnail generation.
- *
- * @param mode New flags.
- * @return true on success
- */
- TNM_EXPORT bool setMode( ThumbnailMode mode );
-
- /**
- * Get a thumbnail for an object file. If a thumbnail already exists, it
- * is loaded and if a thumbnail does not exist, it is created
- * transparently. If thumbnail loadinf fails thumbnailReady signal is emited
- * with null pixmap and error code.
- *
- * @param fileName Source object or file
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady signal.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this tnm
- * instance and may not be shared with other
- * instances.
- */
- TNM_EXPORT int getThumbnail( const QString& fileName, void * clientData = NULL,
- int priority = tnmWrapperPriorityIdle );
-
- /**
- * Get a persistent thumbnail for an object file. If a thumbnail already
- * exists, it is loaded and if a thumbnail does not exist, it is created
- * transparently. If thumbnail loading fails thumbnailReady signal is emited
- * with null pixmap and error code.
- *
- * @param thumbnailId Thumbnail ID
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady signal.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this tnm
- * instance and may not be shared with other
- * instances.
- */
- TNM_EXPORT int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL,
- int priority = tnmWrapperPriorityIdle );
-
- /**
- * Set a thumbnail for an object file generated from pixmap delivered.
- * thumbnailReady() signal will be emited when the operation is complete.
- *
- * @param source Pixmap from which the thumbnail will be created
- * @param fileName file name
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- *
- */
- TNM_EXPORT int setThumbnail( const QPixmap& source, const QString& fileName,
- void * clientData = NULL, int priority = tnmWrapperPriorityIdle );
-
- /**
- * Set a thumbnail for an object file generated from pixmap delivered.
- * thumbnailReady() signal will be emited when the operation is complete.
- *
- * @param source QImage from which the thumbnail will be created
- * @param fileName file name
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- *
- */
- TNM_EXPORT int setThumbnail( const QImage& source, const QString& fileName,
- void * clientData = NULL, int priority = tnmWrapperPriorityIdle );
-
- /**
- * Set a thumbnail for an object file generated from source file.
- * thumbnailReady() signal will be emited when the operation is complete.
- *
- * @param sourceFileName Source file name from which the thumbnail will be created
- * @param targetFileName Target file name
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- *
- */
- TNM_EXPORT int setThumbnail( const QString& sourceFileName, const QString& targetFileName,
- const QString& mimeType = QString(""), void * clientData = NULL,
- int priority = tnmWrapperPriorityIdle );
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @param fileName Source file
- */
- TNM_EXPORT void deleteThumbnails( const QString& fileName );
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @param thumbnailId thumbnail id
- */
- TNM_EXPORT void deleteThumbnails( unsigned long int thumbnailId );
-
- /**
- * Cancel a thumbnail operation.
- *
- * @param id Request ID for the operation to be cancelled.
- * @return true if cancelling was successful.
- */
- TNM_EXPORT bool cancelRequest( int id );
-
- /**
- * Change the priority of a queued thumbnail operation.
- *
- * @param id Request ID for the request which to assign a new
- * priority.
- * @param newPriority New priority value
- * @return true if change was successful.
- */
- TNM_EXPORT bool changePriority( int id, int newPriority );
-
-signals:
- /**
- * Final thumbnail bitmap generation or loading is complete.
- *
- * @param pixmap An object representing the resulting thumbnail.
- * @param clientData Client data
- * @param id Request ID for the operation
- * @param errorCode error code
- */
- TNM_EXPORT void thumbnailReady( QPixmap , void * , int , int );
-
- /**
- * Final thumbnail bitmap generation or loading is complete.
- *
- * @param image An object representing the resulting thumbnail.
- * @param clientData Client data
- * @param id Request ID for the operation
- * @param errorCode error code
- */
- TNM_EXPORT void thumbnailReady( QImage , void * , int , int );
-
-protected:
-
- void connectNotify(const char *signal);
-
- void disconnectNotify(const char *signal);
-
-private:
- ThumbnailManagerPrivate* d;
-
- friend class ThumbnailManagerPrivate;
- friend class TestThumbnailManager;
-};
-
-#endif // THUMBNAILMANAGER_QT
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanagerobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
-* 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: Thumbnail Manager observer.
- *
-*/
-
-
-#ifndef THUMBNAILMANAGEROBSERVER_H
-#define THUMBNAILMANAGEROBSERVER_H
-
-#include "thumbnailobjectsource.h"
-
-class MThumbnailData;
-
-/**
- * Thumbnail observer.
- *
- * Callback interface for getting information about completed thumbnail
- * operations. This should be implemented by the client using the API.
- *
- * Example of how the client may implement the ThumbnailReady()
- * method:
- * @code
- * void CMyThumbnailControl::ThumbnailReady(
- * TInt aError,
- * MThumbnailData& aThumbnail,
- * TThumbnailRequestId aId )
- * {
- * // This function must not leave.
- * delete iBitmap;
- * iBitmap = NULL;
- *
- * if ( !aError )
- * {
- * // Claim ownership of the bitmap instance for later use
- * iBitmap = aThumbnail.DetachBitmap();
- * // We can now use iBitmap in our Draw() method
- * DrawDeferred();
- * }
- * else
- * {
- * // An error occurred while getting the thumbnail.
- * // Perhaps we should show a broken image icon to the user.
- * }
- * }
- * @endcode
- * @since S60 v5.0
- */
-class MThumbnailManagerObserver
- {
-public:
-
- /**
- * Preview thumbnail generation or loading is complete.
- *
- * This callback is not called unless EOptimizeForQualityWithPreview flag
- * was specified.
- *
- * This callback is not called if any of the following is true:
- * - an error occurred while processing the preview thumbnail
- * - a suitable existing thumbnail was not found
- * - a high quality thumbnail is already available
- *
- * The MThumbnailData instance is only valid for the duration of
- * this call. It may not be stored for later use. If the client should
- * want to use the bitmap data later, it can claim ownership of the
- * CFbsBitmap object by calling DetachBitmap().
- *
- * @since S60 v5.0
- * @param aThumbnail An object representing the resulting thumbnail.
- * @param aId Request ID for the operation
- */
- virtual void ThumbnailPreviewReady( MThumbnailData& aThumbnail,
- TThumbnailRequestId aId ) = 0;
-
- /**
- * Final thumbnail bitmap generation or loading is complete.
- *
- * The MThumbnailData instance is only valid for the duration of
- * this call. It may not be stored for later use. If the client should
- * want to use the bitmap data later, it can claim ownership of the
- * CFbsBitmap object by calling DetachBitmap().
- *
- * @since S60 v5.0
- * @param aError Error code.
- * @param aThumbnail An object representing the resulting thumbnail.
- * @param aId Request ID for the operation.
- */
- virtual void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail,
- TThumbnailRequestId aId ) = 0;
-};
-
-/** Thumbnail request types */
-enum TThumbnailRequestType
- {
- ERequestDeleteThumbnails = 0
- };
-
-/**
- * Optional callback interface for getting information about other completed
- * requests that don't include a thumbnail.
- *
- * Request types:
- * - ERequestDeleteThumbnails
- *
- * Can be added using SetRequestObserver(MThumbnailManagerRequestObserver& aObserver)
- * and removed using RemoveRequestObserver().
- *
- * @since Symbian^3
- */
-class MThumbnailManagerRequestObserver
- {
-public:
- /**
- * A request is complete.
- *
- * @since Symbian^3
- * @param aError Error code.
- * @param aRequestType Type of the completed request.
- * @param aId Request ID for the operation.
- */
- virtual void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType,
- TThumbnailRequestId aId ) = 0;
-};
-
-#endif // THUMBNAILMANAGEROBSERVER_H
--- a/imagehandling_plat/thumbnailmanager_api/inc/thumbnailobjectsource.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,364 +0,0 @@
-/*
-* 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: Class for encapsulating the data source for objects.
- *
-*/
-
-
-#ifndef THUMBNAILOBJECTSOURCE_H
-#define THUMBNAILOBJECTSOURCE_H
-
-#include <e32base.h>
-#include <f32file.h>
-
-typedef TUint32 TThumbnailId;
-
-class CFbsBitmap;
-
-/**
- * Object source for thumbnails.
- *
- * Class for encapsulating the data source for objects.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbnailObjectSource ): public CBase
- {
-public:
- /**
- * Construct a new CThumbnailObjectSource referring to an URI.
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri, const
- TDesC& aMimeType = KNullDesC );
-
- /**
- * Construct a new CThumbnailObjectSource referring to an URI.
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri, const
- TDesC& aMimeType = KNullDesC );
-
- /**
- * Construct a new CThumbnailObjectSource referring to a file handle.
- * The file handle must refer to an open file and it must remain
- * valid until this object source is deleted.
- *
- * @param aFile File handle.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewL( const RFile64& aFile, const
- TDesC& aMimeType = KNullDesC );
-
- /**
- * Construct a new CThumbnailObjectSource referring to a file handle.
- * The file handle must refer to an open file and it must remain
- * valid until this object source is deleted.
- *
- * @param aFile File handle.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewLC( const RFile64& aFile, const
- TDesC& aMimeType = KNullDesC );
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailObjectSource();
-
-public:
-
- /**
- * Returns file handle.
- *
- * @since S60 v5.0
- * @return reference to file handle
- */
- IMPORT_C RFile64& FileHandle();
-
- /**
- * Returns source uri.
- *
- * @since S60 v5.0
- * @return uri
- */
- IMPORT_C const TDesC& Uri();
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- */
- CThumbnailObjectSource();
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- */
- void ConstructL( const TDesC& aUri, const TDesC& aMimeType );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aFile File handle.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- */
- void ConstructL( const RFile64& aFile, const TDesC& aMimeType );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aURI URI.
- * @param aMimeType MimeType.
- * @param aThumbnailId ThumbnailId
- */
- void ConstructL( const TDesC& aUri, const TDesC& aMimeType, TThumbnailId aThumbnailId );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aBitmap Bitmap.
- * @param aURI URI.
- */
- void ConstructL( CFbsBitmap* aBitmap, const TDesC& aUri );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- * @param aBuffer Buffer.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @param aURI URI.
- */
- void ConstructL( TDesC8* aBuffer, const TDesC& aMimeType, const TDesC& aUri );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since Symbian^3
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aTargetUri For linking the thumbnail to a different URI.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- */
- void ConstructL( const TDesC& aUri, const TDesC& aTargetUri, const TDesC& aMimeType );
-
-private:
- // data
-
- /**
- * File
- */
- RFile64 iFile;
-
- /**
- * Uri
- */
- HBufC* iUri; // own
-
- /**
- * Mime type
- */
- HBufC8* iMimeType; // own
-
- /**
- * Buffer
- */
- TDesC8* iBuffer; // own
-
- /**
- * Bitmap
- */
- CFbsBitmap* iBitmap; // own
-
- /**
- * ThumbnailId
- */
- TThumbnailId iThumbnailId; //own
-
- /**
- * Uri
- */
- HBufC* iTargetUri; // own
-
-public:
-
- /**
- * Construct a new CThumbnailObjectSource referring to a buffer
- * containing an image.
- *
- * @param aBuffer Buffer.
- * @param aUri Object URI or a full path to a file in the file system.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewL( CFbsBitmap* aBitmap, const TDesC& aUri );
-
- /**
- * Construct a new CThumbnailObjectSource referring to a buffer
- * containing an image.
- *
- * @param aFile File handle.
- * @param aUri Object URI or a full path to a file in the file system.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewLC( CFbsBitmap* aBitmap, const TDesC& aUri );
-
- /**
- * Construct a new CThumbnailObjectSource referring to a buffer
- * containing an image.
- *
- * @param aBuffer Buffer.
- * @param aUri Object URI or a full path to a file in the file system.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewL( TDesC8* aBuffer, TDesC& aMimeType,
- const TDesC& aUri );
-
- /**
- * Construct a new CThumbnailObjectSource referring to a buffer
- * containing an image.
- *
- * @param aBuffer Buffer.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @param aUri Object URI or a full path to a file in the file system.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewLC( TDesC8* aBuffer, TDesC& aMimeType,
- const TDesC& aUri);
-
- /**
- * Construct a new CThumbnailObjectSource referring to an URI.
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri,
- TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
-
- /**
- * Construct a new CThumbnailObjectSource referring to an URI.
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @since S60 v5.0
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri,
- TThumbnailId aThumbnailId = 0, const TDesC& aMimeType = KNullDesC );
-
- /**
- * Returns source buffer.
- *
- * @since S60 v5.0
- * @return buffer
- */
- IMPORT_C TDesC8* Buffer();
-
- /**
- * Gets ownership of buffer from source object.
- * After that Buffer() returns NULL.
- *
- * @since S60 v5.0
- * @return buffer
- */
- IMPORT_C TDesC8* GetBufferOwnership();
-
- /**
- * Gets MIME type.
- *
- * @since S60 v5.0
- * @return MIME type
- */
- IMPORT_C const TDesC8& MimeType();
-
- /**
- * Gets ThumbnailId.
- *
- * @since S60 v5.0
- * @return ThumbnailId
- */
- IMPORT_C TThumbnailId Id();
-
- /**
- * Returns source bitmap.
- *
- * @since S60 v5.0
- * @return bitmap
- */
- IMPORT_C CFbsBitmap* Bitmap();
-
- /**
- * Gets ownership of bitmap from source object.
- * After that Bitmap() returns NULL.
- *
- * @since S60 v5.0
- * @return bitmap
- */
- IMPORT_C CFbsBitmap* GetBitmapOwnership();
-
- /**
- * Construct a new CThumbnailObjectSource referring to an URI.
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aTargetUri For linking the thumbnail to a different URI.
- * @param aMimeType MIME type. Optional, but should be specified if known.
- * @since Symbian^3
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewL( const TDesC& aUri,
- const TDesC& aTargetUri, const TDesC& aMimeType );
-
- /**
- * Construct a new CThumbnailObjectSource referring to an URI.
- * @param aUri Object URI or a full path to a file in the file system.
- * @param aTargetUri For linking the thumbnail to a different URI.
- * @param aMimeType MIME type.
- * @since Symbian^3
- * @return New CThumbnailObjectSource instance.
- */
- IMPORT_C static CThumbnailObjectSource* NewLC( const TDesC& aUri,
- const TDesC& aTargetUri, const TDesC& aMimeType );
-
- /**
- * Returns target uri.
- *
- * @since Symbian^3
- * @return uri
- */
- IMPORT_C const TDesC& TargetUri();
-};
-
-#endif // THUMBNAILOBJECTSOURCE_H
--- a/imagehandling_plat/thumbnailmanager_api/thumbnailmanager_api.metaxml Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0" ?>
-<api id="993e774dd87521bc864e0a849ee5c3fe" dataversion="2.0">
-<name>thumbnailmanager_api</name>
-<description>Thumbnail engine can be used to request thumbnails for different kinds of media objects.</description>
-<type>c++</type>
-<collection>imagehandlingutilities</collection>
-<libs><lib name="thumbnailmanager.lib"/>
-</libs>
-<release category="platform" sinceversion="5.0"/>
-<attributes>
-<htmldocprovided>no</htmldocprovided>
-<adaptation>no</adaptation>
-</attributes>
-</api>
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/Bmarm/ThumbnailManagerTestu.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
-
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/Bwins/ThumbnailManagerTestu.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
-
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/conf/ThumbnailManagerTest.cfg Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2268 +0,0 @@
-/*
-* 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 Manager API tests
-*
-*/
-
-
-[StifSettings]
-TestThreadStackSize= 32768
-TestThreadMinHeap= 4096
-TestThreadMaxHeap= 67108860
-[EndStifSettings]
-
-
-// ---------------------------------------------------------------------------
-// Thumbnail Manager API test cases
-// ---------------------------------------------------------------------------
-
-// These should be run in sequential mode if several cases are run at the same
-// time! Running multiple cases in parallel will not work, because the test
-// cases assume they can delete the database file between tests.
-
-
-// ---------------------------------------------------------------------------
-// Define constants
-// ---------------------------------------------------------------------------
-[Define]
-
-KErrNotFound -1
-KErrGeneral -2
-KErrNotSupported -5
-KErrArgument -6
-
-KMaxTInt 2147483647
-
-// Delay between test cases (milliseconds)
-KTestDelay 1000
-
-KOneSecondDelay 1000
-KFiveSecondDelay 5000
-KTenSecondDelay 10000
-
-// A delay to make sure the client-server request to generate a thumbnail
-// reaches the server, but doesn't have enough time to complete yet
-// (milliseconds)
-KClientServerDelay 150
-KClientServerDelay2 25
-KClientServerDelay3 10
-
-// From TDisplayMode: value for 24-bit display mode
-EColor16M 8
-EColor64K 7
-KDefaultDisplayMode 7
-
-// From CThumbnailManager::TThumbeFlags
-EDefaultFlags 0
-EAllowAnySize 1
-EDoNotCreate 2
-ECropToAspectRatio 4
-
-// From CThumbnailManager::TThumbeQualityPreference
-EOptimizeForQuality 0
-EOptimizeForPerformance 1
-EOptimizeForQualityWithPreview 2
-
-EUnknownThumbnailSize 0
-ECustomThumbnailSize 1
-EImageGridThumbnailSize 2
-EImageListThumbnailSize 3
-EImageFullScreenThumbnailSize 4
-EVideoGridThumbnailSize 5
-EVideoListThumbnailSize 6
-EVideoFullScreenThumbnailSize 7
-EAudioGridThumbnailSize 8
-EAudioListThumbnailSize 9
-EAudioFullScreenThumbnailSize 10
-EGridThumbnailSize = 11
-EListThumbnailSize = 12
-EFullScreenThumbnailSize = 13
-EContactGridThumbnailSize = 14
-EContactListThumbnailSize = 15
-EContactFullScreenThumbnailSize = 16
-
-// Custom sizes
-KCustomSizeX 111
-KCustomSizeY 222
-KCustomSize2X 222
-KCustomSize2Y 111
-KCustomSize3X 10
-KCustomSize3Y 100
-KCustomSize4X 100
-KCustomSize4Y 10
-KCustomSize5X 1000
-KCustomSize5Y 1000
-KCustomSize6X 1000
-KCustomSize6Y 2000
-KCustomSize7X 2000
-KCustomSize7Y 1000
-KCustomSize8X 1
-KCustomSize8Y 1
-KCustomSize9X 555
-KCustomSize9Y 556
-KCustomSize10X 556
-KCustomSize10Y 555
-
-[Enddefine]
-
-
-// ---------------------------------------------------------------------------
-// Create and delete CThumbnailManager
-// ---------------------------------------------------------------------------
-[Test]
-title Create and delete CThumbnailManager
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-pause KOneSecondDelay
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Set and check parameters
-// ---------------------------------------------------------------------------
-[Test]
-title Set and check parameters
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-
-tn SetThumbnailSizeL 0 0
-tn CheckThumbnailSizeL 0 0
-tn SetThumbnailSizeL 1 1
-tn CheckThumbnailSizeL 1 1
-tn SetThumbnailSizeL KMaxTInt KMaxTInt
-tn CheckThumbnailSizeL KMaxTInt KMaxTInt
-tn SetThumbnailEnumSizeL EUnknownThumbnailSize
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn SetThumbnailEnumSizeL KMaxTInt
-
-tn SetFlagsL EDefaultFlags
-tn CheckFlags EDefaultFlags
-tn SetFlagsL EAllowAnySize
-tn CheckFlags EAllowAnySize
-tn SetFlagsL KMaxTInt
-tn CheckFlags KMaxTInt
-
-tn SetQualityPreferenceL EOptimizeForQuality
-tn CheckQualityPreference EOptimizeForQuality
-tn SetQualityPreferenceL EOptimizeForPerformance
-tn CheckQualityPreference EOptimizeForPerformance
-tn SetQualityPreferenceL KMaxTInt
-tn CheckQualityPreference KMaxTInt
-
-tn SetDisplayModeL EColor16M
-tn CheckDisplayModeL EColor16M
-tn SetDisplayModeL EColor64K
-tn CheckDisplayModeL EColor64K
-tn SetDisplayModeL 0
-tn CheckDisplayModeL 0
-tn SetDisplayModeL KMaxTInt
-tn CheckDisplayModeL KMaxTInt
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create object sources
-// ---------------------------------------------------------------------------
-[Test]
-title Create object sources
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Tiny_1x1.jpg
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\video.3gp
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\empty_file.bmp
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\Tiny_1x1.jpg
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\video.3gp
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\empty_file.bmp
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_VGA.jpg image/jpeg
-tn DeleteSourceInstance
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\Tiny_1x1.jpg image/jpeg
-tn DeleteSourceInstance
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\empty_file.bmp image/bmp
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Create JPEG thumbnail
-// ---------------------------------------------------------------------------
-[Test]
-title Create JPEG thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create GIF thumbnail
-// ---------------------------------------------------------------------------
-[Test]
-title Create GIF thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create SVG thumbnail
-// ---------------------------------------------------------------------------
-[Test]
-title Create SVG thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create BMP thumbnail
-// ---------------------------------------------------------------------------
-[Test]
-title Create BMP thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_400x300.bmp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\RGB_400x300.bmp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create 3GP thumbnail
-// ---------------------------------------------------------------------------
-[Test]
-title Create 3GP thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\video.3gp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\video.3gp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create MPEG4 thumbnail
-// ---------------------------------------------------------------------------
-[Test]
-title Create MPEG4 thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\Videoclip.mp4
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create MP3 thumbnail
-// ---------------------------------------------------------------------------
-[Test]
-title Create MP3 thumbnail
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\mp3.mp3
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\mp3.mp3
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create MP3 thumbnail with PNG album art
-// ---------------------------------------------------------------------------
-[Test]
-title Create MP3 thumbnail with PNG album art
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\mp3_png.mp3
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create thumbnail preview from JPG with EXIF
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbnail preview from JPG with EXIF
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// jpg with exif
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetQualityPreferenceL EOptimizeForQualityWithPreview
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// png with exif
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\exif.png
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetQualityPreferenceL EOptimizeForQualityWithPreview
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// no exif
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\no_exif.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetQualityPreferenceL EOptimizeForQualityWithPreview
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create thumbnail from WMA PNG & empty album arts
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbnail from WMA PNG & empty album arts
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// try to create thumbnail from PNG
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_png.wma
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// try to create thumbnail without album art
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\wma_empty.wma
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Create thumbs from buffer
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbs from buffer
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_VGA.jpg image/jpeg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_400x300.bmp image/bmp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\8bit_PNG.png image/png
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\SVG_640x480.svg image/svg+xml
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Create thumbs from CFbsBitmap
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbs from CFbsBitmap
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstanceBitmapL \data\ThumbnailManagerTest\TestMBM.mbm \data\ThumbnailManagerTest\camera.jpg
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\camera.jpg
-tn SetFlagsL EDoNotCreate
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Create image/audio/video thumbs
-// ---------------------------------------------------------------------------
-[Test]
-title Create image/audio/video thumbs
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// try to create thumbnail from image
-tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\RGB_VGA.jpg
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// try to create thumbnail from music
-tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\mp3_png.mp3
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// try to create thumbnail from video
-tn CreateThumbnailsByUrlL \data\ThumbnailManagerTest\Videoclip.mp4
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Create thumbnails for each persistent size
-// ---------------------------------------------------------------------------
-[Test]
-title Create thumbnails for each persistent size
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageListThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageListThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_VGA.jpg image/jpeg
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageListThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageListThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_400x300.bmp
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageListThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageListThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_400x300.bmp image/bmp
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageListThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageListThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\video.3gp
-tn DeleteThumbnails
-tn CreateThumbnails
-waittestclass tn
-
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EVideoListThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoListThumbnailSize EColor16M
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Custom size thumbs
-// ---------------------------------------------------------------------------
-[Test]
-title Custom size thumbs
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize2X KCustomSize2Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize2X KCustomSize2Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize3X KCustomSize3Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize3X KCustomSize3Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize4X KCustomSize4Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize4X KCustomSize4Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize6X KCustomSize6Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize6X KCustomSize6Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize7X KCustomSize7Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize7X KCustomSize7Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize8X KCustomSize8Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize8X KCustomSize8Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize9X KCustomSize9Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize9X KCustomSize9Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize10X KCustomSize10Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize10X KCustomSize10Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize2X KCustomSize2Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize2X KCustomSize2Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize3X KCustomSize3Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize3X KCustomSize3Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize4X KCustomSize4Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize4X KCustomSize4Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize6X KCustomSize6Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize6X KCustomSize6Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize7X KCustomSize7Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize7X KCustomSize7Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize8X KCustomSize8Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize8X KCustomSize8Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize9X KCustomSize9Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize9X KCustomSize9Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize10X KCustomSize10Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize10X KCustomSize10Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize2X KCustomSize2Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize2X KCustomSize2Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize3X KCustomSize3Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize3X KCustomSize3Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize4X KCustomSize4Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize4X KCustomSize4Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize6X KCustomSize6Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize6X KCustomSize6Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize7X KCustomSize7Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize7X KCustomSize7Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize8X KCustomSize8Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize8X KCustomSize8Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize9X KCustomSize9Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize9X KCustomSize9Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize10X KCustomSize10Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize10X KCustomSize10Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Custom size thumbs with cropping
-// ---------------------------------------------------------------------------
-[Test]
-title Custom size thumbs with cropping
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-
-tn SetFlagsL ECropToAspectRatio
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize2X KCustomSize2Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize2X KCustomSize2Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize3X KCustomSize3Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize3X KCustomSize3Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize4X KCustomSize4Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize4X KCustomSize4Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize6X KCustomSize6Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize6X KCustomSize6Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize7X KCustomSize7Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize7X KCustomSize7Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize8X KCustomSize8Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize8X KCustomSize8Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize9X KCustomSize9Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize9X KCustomSize9Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize10X KCustomSize10Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize10X KCustomSize10Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize2X KCustomSize2Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize2X KCustomSize2Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize3X KCustomSize3Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize3X KCustomSize3Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize4X KCustomSize4Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize4X KCustomSize4Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize6X KCustomSize6Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize6X KCustomSize6Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize7X KCustomSize7Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize7X KCustomSize7Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize8X KCustomSize8Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize8X KCustomSize8Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize9X KCustomSize9Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize9X KCustomSize9Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize10X KCustomSize10Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize10X KCustomSize10Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize2X KCustomSize2Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize2X KCustomSize2Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize3X KCustomSize3Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize3X KCustomSize3Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize4X KCustomSize4Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize4X KCustomSize4Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize6X KCustomSize6Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize6X KCustomSize6Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize7X KCustomSize7Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize7X KCustomSize7Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize8X KCustomSize8Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize8X KCustomSize8Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize9X KCustomSize9Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize9X KCustomSize9Y EColor16M
-tn DeleteThumbnails
-tn SetThumbnailSizeL KCustomSize10X KCustomSize10Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize10X KCustomSize10Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Different display modes
-// ---------------------------------------------------------------------------
-[Test]
-title Different display modes
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-
-// 24-bit
-tn SetDisplayModeL EColor16M
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_VGA.jpg image/jpeg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_400x300.bmp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_400x300.bmp image/bmp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\video.3gp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// 16-bit
-tn SetDisplayModeL EColor64K
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor64K
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_VGA.jpg image/jpeg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor64K
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_400x300.bmp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor64K
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_400x300.bmp image/bmp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor64K
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\video.3gp
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor64K
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoGridThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EVideoFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EVideoFullScreenThumbnailSize EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor64K
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSize5X KCustomSize5Y
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSize5X KCustomSize5Y EColor64K
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Thumbnail from missing or unsupported file
-// ---------------------------------------------------------------------------
-[Test]
-title Thumbnail from missing or unsupported file
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\does_not_exist.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Unsupported.txt
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\Unsupported.txt
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\Unsupported.txt plain/text
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Thumbnail from corrupt file
-// ---------------------------------------------------------------------------
-[Test]
-title Thumbnail from corrupt file
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Set thumbnail from buffer
-// ---------------------------------------------------------------------------
-[Test]
-title Set thumbnail from buffer
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetFlagsL EDefaultFlags
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_VGA.jpg image/jpeg
-tn DeleteThumbnails
-tn SetThumbnailL
-
-waittestclass tn
-
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\RGB_400x300.bmp image/bmp
-tn DeleteThumbnails
-tn SetThumbnailL
-
-waittestclass tn
-
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\WIDE_800x400.gif image/gif
-tn DeleteThumbnails
-tn SetThumbnailL
-
-waittestclass tn
-
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Set thumbnail from path
-// ---------------------------------------------------------------------------
-[Test]
-title Set thumbnail from path
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// normal uri
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathTargetL \data\ThumbnailManagerTest\RGB_VGA.jpg \data\ThumbnailManagerTest\target.jpg image/jpeg 0 0
-tn SetThumbnailL
-
-waittestclass tn
-
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\target.jpg
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// virtual uri
-tn SetFlagsL EDefaultFlags
-tn CreateSourceInstancePathTargetL \data\ThumbnailManagerTest\RGB_VGA.jpg \data\ThumbnailManagerTest\target.vcf contact/x-vcard 0 1
-tn SetThumbnailL
-
-waittestclass tn
-
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\target.vcf
-tn SetThumbnailEnumSizeL EContactGridThumbnailSize
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-
-waittestclass tn
-tn CheckThumbnailCenrepL EContactGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Delete thumbnails
-// ---------------------------------------------------------------------------
-[Test]
-title Delete thumbnails
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-
-// one thumbnail
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-
-tn DeleteThumbnails
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-
-// all persistent thumbnails created
-tn SetFlagsL EDefaultFlags
-tn CreateThumbnails
-waittestclass tn
-pause KTenSecondDelay
-
-tn DeleteThumbnails
-pause KTenSecondDelay
-
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Run multiple tests
-// ---------------------------------------------------------------------------
-[Test]
-title Run misc multiple tests
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-// using path
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// mp3 using handle
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\mp3.mp3
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioGridThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioGridThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL EAudioFullScreenThumbnailSize
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EAudioFullScreenThumbnailSize EColor16M
-tn DeleteThumbnails
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailL KCustomSizeX KCustomSizeY EColor16M
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// corrupted file
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-tn SetThumbnailSizeL KCustomSizeX KCustomSizeY
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_jpg.jpg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-tn CreateSourceInstanceBufferL \data\ThumbnailManagerTest\not_jpg.jpg image/jpeg
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\not_3gp.3gp
-tn GetThumbnailL
-allownextresult KErrNotSupported
-waittestclass tn
-tn DeleteSourceInstance
-
-// delete one thumbnail
-tn SetThumbnailEnumSizeL EImageGridThumbnailSize
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\RGB_VGA.jpg
-tn DeleteThumbnails
-tn GetThumbnailL
-waittestclass tn
-tn CheckThumbnailCenrepL EImageGridThumbnailSize EColor16M
-tn DeleteThumbnails
-pause KTenSecondDelay
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-
-// delete all persistent thumbnails created
-tn SetFlagsL EDefaultFlags
-tn CreateThumbnails
-waittestclass tn
-pause KTenSecondDelay
-tn DeleteThumbnails
-pause KTenSecondDelay
-tn SetFlagsL EDoNotCreate
-tn GetThumbnailL
-allownextresult KErrNotFound
-waittestclass tn
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-
-// ---------------------------------------------------------------------------
-// Delete engine when requests are pending
-// ---------------------------------------------------------------------------
-[Test]
-title Delete engine when requests are pending
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn GetThumbnailL
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn GetThumbnailL
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Cancel request
-// ---------------------------------------------------------------------------
-[Test]
-title Cancel request
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-
-tn SetThumbnailEnumSizeL EImageFullScreenThumbnailSize
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\Videoclip.mp4
-tn GetThumbnailL
-tn DeleteSourceInstance
-
-tn CreateSourceInstancePathL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn GetThumbnailL
-tn DeleteSourceInstance
-
-pause KClientServerDelay2
-
-// The server should have the two thumbnail requests queued by now.
-// This should cancel the second one while letting the first one finish.
-tn CancelPrevious
-
-waittestclass tn
-tn CheckThumbnailCenrepL EImageFullScreenThumbnailSize EColor16M
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Priority handling
-// ---------------------------------------------------------------------------
-[Test]
-title Priority handling
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// First request with 100 priority
-tn SetThumbnailSizeL 80 40
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn GetThumbnailL 0 100
-tn DeleteSourceInstance
-
-// Second request with negative priority
-tn SetThumbnailSizeL 1 1
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn GetThumbnailL 0 -100
-tn DeleteSourceInstance
-
-// Third request with positive priority
-tn SetThumbnailSizeL 40 30
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn GetThumbnailL 0 0
-tn DeleteSourceInstance
-
-// First request should complete first, since the server started processing
-// it before the other requests were done
-waittestclass tn
-tn CheckThumbnailL 80 40 EColor16M
-
-// The third request should finish next
-waittestclass tn
-tn CheckThumbnailL 40 30 EColor16M
-
-// The second request should finish last, since it had the lowest priority
-waittestclass tn
-tn CheckThumbnailL 1 1 EColor16M
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Change priority
-// ---------------------------------------------------------------------------
-[Test]
-title Change priority
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn SetDisplayModeL EColor16M
-tn SetThumbnailEnumSizeL ECustomThumbnailSize
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-// First request with 0 priority
-tn SetThumbnailSizeL 80 40
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn GetThumbnailL 0 0
-tn DeleteSourceInstance
-
-// Second request with negative priority
-tn SetThumbnailSizeL 1 1
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn GetThumbnailL 0 -50
-tn DeleteSourceInstance
-
-// Third request with positive priority
-tn SetThumbnailSizeL 40 30
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn GetThumbnailL 0 50
-tn DeleteSourceInstance
-
-// Change the priority of the third request to a low value
-tn ChangePreviousPriority -100
-
-// First request should complete first, since the server started processing
-// it before the other requests were done
-waittestclass tn
-tn CheckThumbnailL 80 40 EColor16M
-
-// The second request should finish next
-waittestclass tn
-tn CheckThumbnailL 1 1 EColor16M
-
-// The third request should finish last, since the priority was changed to the
-// lowest value.
-waittestclass tn
-tn CheckThumbnailL 40 30 EColor16M
-
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\WIDE_800x400.gif
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\TALL_400x800.bmp
-tn DeleteThumbnails
-tn DeleteSourceInstance
-tn CreateSourceInstanceHandleL \data\ThumbnailManagerTest\SVG_640x480.svg
-tn DeleteThumbnails
-tn DeleteSourceInstance
-
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
-// ---------------------------------------------------------------------------
-// Get supported mime types
-// ---------------------------------------------------------------------------
-[Test]
-title Get supported mime types
-create ThumbnailManagerTest tn
-tn CreateInstanceL
-tn GetSupportedMimeTypesL
-tn DeleteInstance
-delete tn
-pause KTestDelay
-[Endtest]
-
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/8bit_PNG.png has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/RGB_400x300.bmp has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/RGB_VGA.jpg has changed
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/SVG_640x480.svg Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://web.resource.org/cc/"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="640"
- height="480"
- id="svg2"
- sodipodi:version="0.32"
- inkscape:version="0.43"
- version="1.0"
- sodipodi:docbase="c:\"
- sodipodi:docname="SVG_640x480.svg">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="0.98994949"
- inkscape:cx="308.77594"
- inkscape:cy="313.99918"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- inkscape:window-width="812"
- inkscape:window-height="793"
- inkscape:window-x="195"
- inkscape:window-y="44" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1">
- <rect
- style="opacity:1;color:#000000;fill:#fe8f00;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:12;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:12, 36;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="rect1308"
- width="640"
- height="480"
- x="0"
- y="-1.5258789e-005" />
- <rect
- style="opacity:1;color:#000000;fill:#000000;fill-opacity:0.35185188;fill-rule:nonzero;stroke:#000000;stroke-width:12;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:12, 36;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="rect2190"
- width="600"
- height="400"
- x="28.284269"
- y="30.482117"
- rx="40"
- ry="40" />
- <path
- style="font-size:199.21853638px;font-style:normal;font-weight:normal;line-height:125%;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
- d="M 122.70914,300.73115 C 114.39836,300.73115 104.3021,299.07946 92.420334,295.77611 L 92.420334,280.42518 C 104.69167,283.92288 114.07372,285.67172 120.56652,285.6717 C 128.81231,285.67172 134.98044,283.8581 139.07095,280.23087 C 143.22627,276.60367 145.30396,271.16284 145.30401,263.90837 C 145.30396,257.23692 143.71323,251.79609 140.53182,247.58587 C 137.41524,243.37576 131.01985,238.35595 121.34566,232.52643 C 110.89226,226.04931 103.62036,219.60453 99.529927,213.19204 C 95.439462,206.77972 93.394244,199.49289 93.394244,191.33154 C 93.394244,178.24776 97.517148,168.7587 105.763,162.86433 C 114.07372,156.90546 124.98158,153.92597 138.4866,153.92582 C 147.57643,153.92597 156.7637,155.18902 166.04844,157.71497 L 166.04844,172.77442 C 157.21819,170.31322 149.49179,169.08256 142.86922,169.08243 C 135.14277,169.08256 129.36419,170.53993 125.5335,173.45453 C 121.70273,176.36938 119.78736,180.74147 119.7874,186.57081 C 119.78736,191.2345 120.98852,195.37989 123.39089,199.00701 C 125.79317,202.63432 131.37696,207.23312 140.14225,212.8034 C 147.60889,217.66138 153.41992,221.90392 157.57536,225.53107 C 161.79559,229.09359 165.17184,233.46568 167.70409,238.64736 C 170.30112,243.76439 171.59968,250.07963 171.59976,257.59312 C 171.59968,271.97249 167.50924,282.75699 159.32841,289.94665 C 151.21238,297.13631 139.00597,300.73115 122.70914,300.73115 M 205.39468,299.56526 L 178.80675,154.8974 L 206.75816,154.8974 L 222.7304,259.53627 L 243.08526,154.8974 L 263.6349,154.8974 L 232.66434,299.56526 L 205.39468,299.56526 M 312.33074,300.34251 C 301.3579,300.34251 293.11209,297.00677 287.59325,290.33527 C 282.07437,283.59901 278.50334,275.08154 276.88016,264.78279 C 275.25696,254.41934 274.44537,241.59453 274.44538,226.30833 C 274.44537,209.14389 276.0361,195.31512 279.21757,184.82198 C 282.46394,174.32907 287.65815,166.55646 294.80023,161.50412 C 302.00718,156.45207 312.10345,153.92597 325.08905,153.92582 C 334.30873,153.92597 343.36614,155.25379 352.26133,157.90929 L 352.26133,173.26021 C 341.74295,169.76266 333.10756,168.01383 326.35514,168.0137 C 316.03157,168.01383 309.27908,172.4183 306.09767,181.22714 C 302.98109,189.97145 301.42283,204.09169 301.42287,223.58791 C 301.42283,248.39557 302.2669,265.04191 303.95505,273.52699 C 305.64313,282.01211 309.70112,286.25466 316.12901,286.25465 C 320.6739,286.25466 324.08261,284.73252 326.35514,281.68823 C 328.62755,278.57921 329.76379,273.91564 329.76385,267.69752 L 329.76385,232.91505 L 316.51858,232.91505 L 316.51858,219.79876 L 356.0596,219.79876 L 356.0596,299.56526 L 342.91172,299.56526 L 339.30823,287.22623 C 336.38641,291.63072 332.65307,294.93407 328.10819,297.13631 C 323.62811,299.27378 318.36896,300.34251 312.33074,300.34251"
- id="text2192" />
- <path
- id="path2203"
- d="M 114.62791,292.64992 C 106.31714,292.64992 96.220883,290.99824 84.339113,287.69489 L 84.339113,272.34396 C 96.610453,275.84165 105.9925,277.5905 112.4853,277.59048 C 120.73109,277.5905 126.89922,275.77688 130.98972,272.14965 C 135.14505,268.52245 137.22273,263.08162 137.22278,255.82715 C 137.22273,249.1557 135.632,243.71486 132.4506,239.50465 C 129.33401,235.29454 122.93863,230.27473 113.26444,224.4452 C 102.81104,217.96809 95.539143,211.52331 91.448703,205.11081 C 87.358243,198.6985 85.313023,191.41167 85.313023,183.25032 C 85.313023,170.16654 89.435923,160.67748 97.681773,154.78311 C 105.9925,148.82424 116.90035,145.84475 130.40537,145.8446 C 139.4952,145.84475 148.68247,147.1078 157.96722,149.63375 L 157.96722,164.69319 C 149.13697,162.232 141.41056,161.00134 134.788,161.00121 C 127.06154,161.00134 121.28297,162.4587 117.45228,165.3733 C 113.6215,168.28816 111.70613,172.66025 111.70617,178.48959 C 111.70613,183.15328 112.9073,187.29867 115.30966,190.92578 C 117.71195,194.5531 123.29574,199.15189 132.06103,204.72218 C 139.52766,209.58015 145.33869,213.8227 149.49414,217.44984 C 153.71437,221.01237 157.09062,225.38445 159.62287,230.56614 C 162.2199,235.68317 163.51846,241.99841 163.51854,249.5119 C 163.51846,263.89126 159.42801,274.67577 151.24718,281.86542 C 143.13115,289.05509 130.92475,292.64992 114.62791,292.64992 M 197.31346,291.48404 L 170.72553,146.81618 L 198.67693,146.81618 L 214.64917,251.45505 L 235.00403,146.81618 L 255.55367,146.81618 L 224.58312,291.48404 L 197.31346,291.48404 M 304.24951,292.26129 C 293.27668,292.26129 285.03086,288.92555 279.51203,282.25404 C 273.99315,275.51779 270.42212,267.00031 268.79894,256.70157 C 267.17574,246.33812 266.36414,233.51331 266.36415,218.22711 C 266.36414,201.06266 267.95487,187.2339 271.13635,176.74075 C 274.38272,166.24784 279.57693,158.47524 286.71901,153.4229 C 293.92596,148.37085 304.02222,145.84475 317.00782,145.8446 C 326.2275,145.84475 335.28492,147.17257 344.1801,149.82806 L 344.1801,165.17899 C 333.66173,161.68144 325.02634,159.9326 318.27392,159.93247 C 307.95034,159.9326 301.19786,164.33708 298.01645,173.14592 C 294.89987,181.89023 293.34161,196.01046 293.34165,215.50669 C 293.34161,240.31435 294.18567,256.96068 295.87383,265.44576 C 297.56191,273.93089 301.6199,278.17344 308.04779,278.17343 C 312.59268,278.17344 316.00139,276.6513 318.27392,273.60701 C 320.54633,270.49798 321.68256,265.83442 321.68262,259.6163 L 321.68262,224.83383 L 308.43736,224.83383 L 308.43736,211.71754 L 347.97838,211.71754 L 347.97838,291.48404 L 334.8305,291.48404 L 331.22701,279.14501 C 328.30519,283.5495 324.57184,286.85285 320.02696,289.05509 C 315.54689,291.19256 310.28774,292.26129 304.24951,292.26129"
- style="font-size:199.21853638px;font-style:normal;font-weight:normal;line-height:125%;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" />
- <path
- sodipodi:type="star"
- style="opacity:1;color:#000000;fill:#ffe500;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:12;stroke-linecap:square;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:12, 36;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path3080"
- sodipodi:sides="5"
- sodipodi:cx="284.86301"
- sodipodi:cy="134.52783"
- sodipodi:r1="183.79225"
- sodipodi:r2="91.896126"
- sodipodi:arg1="0.58190512"
- sodipodi:arg2="1.2102236"
- inkscape:flatsided="false"
- inkscape:rounded="0"
- inkscape:randomized="0"
- d="M 438.40619,235.54309 L 317.2849,220.51457 L 236.23924,311.77151 L 213.10367,191.93424 L 101.26868,143.05519 L 208.09141,84.020209 L 220.01924,-37.445646 L 309.17488,45.905992 L 428.38168,19.715014 L 376.66017,130.26415 L 438.40619,235.54309 z "
- transform="matrix(0.62966,0,0,0.608487,301.9621,151.6859)" />
- </g>
-</svg>
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/TALL_400x800.bmp has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/TestMBM.mbm has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/Tiny_1x1.jpg has changed
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/Unsupported.txt Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-Text file for testing purposes
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/Videoclip.mp4 has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/WIDE_800x400.gif has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/camera.jpg has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/exif.jpg has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/exif.png has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/mp3.mp3 has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/mp3_png.mp3 has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/no_exif.jpg has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/not_3gp.3gp has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/not_jpg.jpg has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/video.3gp has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/wma.wma has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/wma_empty.wma has changed
Binary file imagehandling_plat/thumbnailmanager_api/tsrc/data/mmc/ThumbnailManagerTest/wma_png.wma has changed
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/eabi/ThumbnailManagerTestu.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-EXPORTS
- _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
- _ZTI16CThumbnailCenRep @ 2 NONAME ; #<TI>#
- _ZTV16CThumbnailCenRep @ 3 NONAME ; #<VT>#
-
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/group/ThumbnailManagerTest.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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 Manager API tests
-*
-*/
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-
-TARGET ThumbnailManagerTest.dll
-TARGETTYPE dll
-UID 0x1000008D 0x101FB3E3
-
-CAPABILITY ALL -TCB
-VENDORID VID_DEFAULT
-EPOCSTACKSIZE 0x8192
-
-DEFFILE ThumbnailManagerTest.def
-
-SOURCEPATH ../src
-SOURCE ThumbnailManagerTest.cpp
-SOURCE ThumbnailManagerTestBlocks.cpp
-SOURCE thumbnailcenrep.cpp
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-
-LIBRARY euser.lib
-LIBRARY PlatformEnv.lib
-LIBRARY stiftestinterface.lib
-LIBRARY stiftestengine.lib
-LIBRARY efsrv.lib
-LIBRARY sqldb.lib
-LIBRARY fbscli.lib
-LIBRARY imageconversion.lib
-LIBRARY centralrepository.lib
-LIBRARY thumbnailmanager.lib
-
-PAGED
-BYTEPAIRCOMPRESSTARGET
-
-// End of File
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/group/ThumbnailManagerTest.pkg Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description: Thumbnail Manager API tests
-;
-
-; Languages
-&EN
-
-; Header
-#{"ThumbnailManagerTest"},(0x101FB3E3),1,0,0,TYPE=SA
-
-; Localised Vendor name
-%{"Nokia"}
-
-; Unique Vendor name
-:"Nokia"
-
-; Install files
-"\epoc32\release\armv5\udeb\ThumbnailManagerTest.dll" - "c:\sys\bin\ThumbnailManagerTest.dll"
-"..\conf\ThumbnailManagerTest.cfg" - "c:\TestFramework\ThumbnailManagerTest.cfg"
-"..\init\ThumbnailManagerTest.ini" - "c:\TestFramework\ThumbnailManagerTest.ini"
-"..\data\mmc\ThumbnailManagerTest\8bit_PNG.png" - "e:\testing\data\ThumbnailManagerTest\8bit_PNG.png"
-"..\data\mmc\ThumbnailManagerTest\empty_file.bmp" - "e:\testing\data\ThumbnailManagerTest\empty_file.bmp"
-"..\data\mmc\ThumbnailManagerTest\not_3gp.3gp" - "e:\testing\data\ThumbnailManagerTest\not_3gp.3gp"
-"..\data\mmc\ThumbnailManagerTest\not_jpg.jpg" - "e:\testing\data\ThumbnailManagerTest\not_jpg.jpg"
-"..\data\mmc\ThumbnailManagerTest\RGB_400x300.bmp" - "e:\testing\data\ThumbnailManagerTest\RGB_400x300.bmp"
-"..\data\mmc\ThumbnailManagerTest\RGB_VGA.jpg" - "e:\testing\data\ThumbnailManagerTest\RGB_VGA.jpg"
-"..\data\mmc\ThumbnailManagerTest\SVG_640x480.svg" - "e:\testing\data\ThumbnailManagerTest\SVG_640x480.svg"
-"..\data\mmc\ThumbnailManagerTest\TALL_400x800.bmp" - "e:\testing\data\ThumbnailManagerTest\TALL_400x800.bmp"
-"..\data\mmc\ThumbnailManagerTest\Tiny_1x1.jpg" - "e:\testing\data\ThumbnailManagerTest\Tiny_1x1.jpg"
-"..\data\mmc\ThumbnailManagerTest\Unsupported.txt" - "e:\testing\data\ThumbnailManagerTest\Unsupported.txt"
-"..\data\mmc\ThumbnailManagerTest\video.3gp" - "e:\testing\data\ThumbnailManagerTest\video.3gp"
-"..\data\mmc\ThumbnailManagerTest\Videoclip.mp4" - "e:\testing\data\ThumbnailManagerTest\Videoclip.mp4"
-"..\data\mmc\ThumbnailManagerTest\WIDE_800x400.gif" - "e:\testing\data\ThumbnailManagerTest\WIDE_800x400.gif"
-"..\data\mmc\ThumbnailManagerTest\TestMBM.mbm" - "e:\testing\data\ThumbnailManagerTest\TestMBM.mbm"
-"..\data\mmc\ThumbnailManagerTest\mp3.mp3" - "e:\testing\data\ThumbnailManagerTest\mp3.mp3"
-"..\data\mmc\ThumbnailManagerTest\camera.jpg" - "e:\testing\data\ThumbnailManagerTest\camera.jpg"
-"..\data\mmc\ThumbnailManagerTest\mp3_png.mp3" - "e:\testing\data\ThumbnailManagerTest\mp3_png.mp3"
-"..\data\mmc\ThumbnailManagerTest\no_exif.jpg" - "e:\testing\data\ThumbnailManagerTest\no_exif.jpg"
-"..\data\mmc\ThumbnailManagerTest\wma.wma" - "e:\testing\data\ThumbnailManagerTest\wma.wma"
-"..\data\mmc\ThumbnailManagerTest\wma_empty.wma" - "e:\testing\data\ThumbnailManagerTest\wma_empty.wma"
-"..\data\mmc\ThumbnailManagerTest\wma_png.wma" - "e:\testing\data\ThumbnailManagerTest\wma_png.wma"
-"..\data\mmc\ThumbnailManagerTest\exif.jpg" - "e:\testing\data\ThumbnailManagerTest\exif.jpg"
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* 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 Manager API tests
-*
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-
-PRJ_TESTMMPFILES
-ThumbnailManagerTest.mmp
-
-PRJ_TESTEXPORTS
-../conf/ThumbnailManagerTest.cfg /epoc32/winscw/c/TestFramework/ThumbnailManagerTest.cfg
-../init/ThumbnailManagerTest.ini /epoc32/winscw/c/TestFramework/ThumbnailManagerTest.ini
-../data/mmc/ThumbnailManagerTest/8bit_PNG.png /epoc32/winscw/c/data/ThumbnailManagerTest/8bit_PNG.png
-../data/mmc/ThumbnailManagerTest/empty_file.bmp /epoc32/winscw/c/data/ThumbnailManagerTest/empty_file.bmp
-../data/mmc/ThumbnailManagerTest/not_3gp.3gp /epoc32/winscw/c/data/ThumbnailManagerTest/not_3gp.3gp
-../data/mmc/ThumbnailManagerTest/not_jpg.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/not_jpg.jpg
-../data/mmc/ThumbnailManagerTest/RGB_400x300.bmp /epoc32/winscw/c/data/ThumbnailManagerTest/RGB_400x300.bmp
-../data/mmc/ThumbnailManagerTest/RGB_VGA.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/RGB_VGA.jpg
-../data/mmc/ThumbnailManagerTest/SVG_640x480.svg /epoc32/winscw/c/data/ThumbnailManagerTest/SVG_640x480.svg
-../data/mmc/ThumbnailManagerTest/TALL_400x800.bmp /epoc32/winscw/c/data/ThumbnailManagerTest/TALL_400x800.bmp
-../data/mmc/ThumbnailManagerTest/Tiny_1x1.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/Tiny_1x1.jpg
-../data/mmc/ThumbnailManagerTest/Unsupported.txt /epoc32/winscw/c/data/ThumbnailManagerTest/Unsupported.txt
-../data/mmc/ThumbnailManagerTest/video.3gp /epoc32/winscw/c/data/ThumbnailManagerTest/video.3gp
-../data/mmc/ThumbnailManagerTest/Videoclip.mp4 /epoc32/winscw/c/data/ThumbnailManagerTest/Videoclip.mp4
-../data/mmc/ThumbnailManagerTest/WIDE_800x400.gif /epoc32/winscw/c/data/ThumbnailManagerTest/WIDE_800x400.gif
-../data/mmc/ThumbnailManagerTest/TestMBM.mbm /epoc32/winscw/c/data/ThumbnailManagerTest/TestMBM.mbm
-../data/mmc/ThumbnailManagerTest/mp3.mp3 /epoc32/winscw/c/data/ThumbnailManagerTest/mp3.mp3
-../data/mmc/ThumbnailManagerTest/camera.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/camera.jpg
-../data/mmc/ThumbnailManagerTest/mp3_png.mp3 /epoc32/winscw/c/data/ThumbnailManagerTest/mp3_png.mp3
-../data/mmc/ThumbnailManagerTest/no_exif.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/no_exif.jpg
-../data/mmc/ThumbnailManagerTest/wma.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma.wma
-../data/mmc/ThumbnailManagerTest/wma_empty.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma_empty.wma
-../data/mmc/ThumbnailManagerTest/wma_png.wma /epoc32/winscw/c/data/ThumbnailManagerTest/wma_png.wma
-../data/mmc/ThumbnailManagerTest/exif.jpg /epoc32/winscw/c/data/ThumbnailManagerTest/exif.jpg
-// End of File
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/inc/ThumbnailManagerTest.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
-* 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 Manager API tests
-*
-*/
-
-#ifndef THUMBNAILMANAGERTEST_H
-#define THUMBNAILMANAGERTEST_H
-
-// INCLUDES
-#include <StifLogger.h>
-#include <TestScripterInternal.h>
-#include <StifTestModule.h>
-
-#include <thumbnailmanager.h>
-#include <thumbnailmanagerobserver.h>
-#include <thumbnailobjectsource.h>
-#include <thumbnaildata.h>
-
-#include "thumbnailcenrep.h"
-
-const TInt KPathPrefixLength( 2 );
-
-// MACROS
-#if ( defined (__WINS__) || defined (__WINSCW__) )
-_LIT( KTMTestDataPath, "" );
-#else
-_LIT( KTMTestDataPath, "\\testing" );
-#endif
-
-// Logging path
-_LIT( KThumbnailManagerTestLogPath, "\\logs\\testframework\\ThumbnailManagerTest\\" );
-// Log file
-_LIT( KThumbnailManagerTestLogFile, "ThumbnailManagerTest.txt" );
-_LIT( KThumbnailManagerTestLogFileWithTitle, "ThumbnailManagerTest_[%S].txt" );
-
-// FORWARD DECLARATIONS
-class CThumbnailManagerTest;
-
-// CLASS DECLARATION
-
-/**
-* CThumbnailManagerTest test class for STIF Test Framework TestScripter.
-* ?other_description_lines
-*
-* @lib ?library
-* @since ?Series60_version
-*/
-NONSHARABLE_CLASS(CThumbnailManagerTest): public CScriptBase,
- public MThumbnailManagerObserver
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CThumbnailManagerTest* NewL( CTestModuleIf& aTestModuleIf );
-
- /**
- * Destructor.
- */
- virtual ~CThumbnailManagerTest();
-
- 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: // Functions from base classes
-
- /**
- * From MThumbnailManagerObserver
- */
- void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
-
- void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
-
- private:
-
- /**
- * C++ default constructor.
- */
- CThumbnailManagerTest( CTestModuleIf& aTestModuleIf );
-
- /**
- * By default Symbian 2nd phase constructor is private.
- */
- void ConstructL();
-
- /**
- * Frees all resources allocated from test methods.
- * @since ?Series60_version
- */
- void Delete();
-
- /**
- * Test methods are listed below.
- */
-
- virtual TInt CreateInstanceL( CStifItemParser& aItem );
- virtual TInt DeleteInstance( CStifItemParser& aItem );
-
- virtual TInt CreateSourceInstancePathL( CStifItemParser& aItem );
- virtual TInt CreateSourceInstancePathTargetL( CStifItemParser& aItem );
- virtual TInt CreateSourceInstanceHandleL( CStifItemParser& aItem );
- virtual TInt CreateSourceInstanceBufferL( CStifItemParser& aItem );
- virtual TInt CreateSourceInstanceBitmapL( CStifItemParser& aItem );
- virtual TInt DeleteSourceInstance( CStifItemParser& aItem );
-
- virtual TInt GetThumbnailL( CStifItemParser& aItem );
- virtual TInt GetThumbnailByIdL( CStifItemParser& aItem );
-
- virtual TInt SetThumbnailL( CStifItemParser& aItem );
- virtual TInt ImportThumbnailL( CStifItemParser& aItem );
-
- virtual TInt CheckPreviewThumbnailL( CStifItemParser& aItem );
- virtual TInt CheckThumbnailL( CStifItemParser& aItem );
- virtual TInt CheckThumbnailCenrepL( CStifItemParser& aItem );
-
- virtual TInt CancelPrevious( CStifItemParser& aItem );
- virtual TInt ChangePreviousPriority( CStifItemParser& aItem );
-
- virtual TInt SetThumbnailSizeL( CStifItemParser& aItem );
- virtual TInt CheckThumbnailSizeL( CStifItemParser& aItem );
- virtual TInt SetThumbnailEnumSizeL( CStifItemParser& aItem );
- virtual TInt SetFlagsL( CStifItemParser& aItem );
- virtual TInt CheckFlags( CStifItemParser& aItem );
- virtual TInt SetQualityPreferenceL( CStifItemParser& aItem );
- virtual TInt CheckQualityPreference( CStifItemParser& aItem );
- virtual TInt SetDisplayModeL( CStifItemParser& aItem );
- virtual TInt CheckDisplayModeL( CStifItemParser& aItem );
-
- virtual TInt DeleteThumbnails( CStifItemParser& aItem );
- virtual TInt CreateThumbnailsByUrlL( CStifItemParser& aItem );
-
- virtual TInt CreateThumbnails( CStifItemParser& aItem );
- virtual TInt UpdatePathL( CStifItemParser& aItem );
-
- virtual TInt GetSupportedMimeTypesL( CStifItemParser& aItem );
-
- /**
- * Method used to log version of test class
- */
- void SendTestClassVersion();
-
- private: // Data
-
- // Own. Thumbnail engine
- CThumbnailManager* iEngine;
-
- // Own. Thumbnail object source
- CThumbnailObjectSource* iObjectSource;
-
- // Own. File server session
- RFs iFs;
-
- // Own.
- RFile64 iFile;
-
- // Own. Bitmap from previous ThumbnailPreviewReady() callback
- CFbsBitmap* iPreviewThumbnail;
-
- // Own. Bitmap from previous ThumbnailReady() callback
- CFbsBitmap* iThumbnail;
-
- // Value for aId for previous ThumbnailPreviewReady() callback
- TThumbnailRequestId iPreviewThumbnailCbId;
-
- // Value for aId for previous ThumbnailReady() callback
- TThumbnailRequestId iThumbnailCbId;
-
- // Request ID of the previous request
- TThumbnailRequestId iPreviousRequestId;
-
- // Test data path
- TFileName iDataPath;
-
- // Temp buffer
- HBufC8* iBuffer;
-
- // Temp bitmap
- CFbsBitmap* iBitmap;
-
- // Own. Central repository data handler
- CThumbnailCenRep* iCenrep;
-
- // persistent sizes
- RArray < TThumbnailPersistentSize > iPersistentSizes;
-
- TThumbnailSize iCurrentThumbnailSize;
-
- TBool iDoNotCreate;
- TBool iCreateThumbnails;
- };
-
-#endif // THUMBNAILMANAGERTEST_H
-
-// End of File
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/inc/thumbnailcenrep.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
-* 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: Class for handling central repositoty data
- *
-*/
-
-
-#ifndef THUMBNAILCENREP_H
-#define THUMBNAILCENREP_H
-
-#include <gdi.h>
-
-#include <thumbnailmanager.h> // TThumbnailSize
-
-class CRepository;
-class TThumbnailPersistentSize;
-class TThumbnailAutoCreate;
-
-/**
- * Class for handling central repositoty data.
- *
- * @since S60 v5.0
- */
-class CThumbnailCenRep: public CBase
- {
-
-public:
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailCenRep();
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailCenRep instance.
- */
- static CThumbnailCenRep* NewL();
-
- /**
- * GetPersistentSizes
- *
- * @since S60 v5.0
- * @return Reference to array of central repository settings
- */
- RArray < TThumbnailPersistentSize > & GetPersistentSizes();
-
- /**
- * GetAutoCreateParams
- *
- * @since S60 v5.0
- * @return Reference to auto creation settings
- */
- TThumbnailAutoCreate & GetAutoCreateParams();
-
- /**
- * Get concrete persistent size associated to relative size
- *
- * @since S60 v5.0
- * @param aThumbnailSize Relative size
- * @return Persistent size object
- */
- TThumbnailPersistentSize & PersistentSizeL( TThumbnailSize
- aThumbnailSize );
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailCenRep instance.
- */
- CThumbnailCenRep();
-
- /**
- * ConstructL
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
- // data
-
- /**
- * Central Repository
- * Own.
- */
- CRepository* iRepository;
-
- /**
- * Persistent sizes.
- */
- RArray < TThumbnailPersistentSize > iPersistentSizes;
-
- /**
- * Auto creation parameters.
- */
- TThumbnailAutoCreate * iAutoCreate;
-
-};
-
-/**
- * Class for representing persistent thumbnail sizes and related
- * parameters.
- *
- * @since S60 v5.0
- */
-class TThumbnailPersistentSize
- {
- /**
- * Format used for storing bitmaps.
- * @since S60 v5.0
- */
- enum TThumbnailImageFormat
- {
- /**
- * Use JPEG compression for stored bitmaps.
- */
- EJpeg,
-
- /**
- * Use native Symbian bitmap format for stored bitmaps.
- */
- EBmp
- };
-
-public:
- enum { EUnknownSourceType, EImage, EVideo, EAudio, EContact };
- enum { EUnknownSizeType, EGrid, EList, EFullscreen };
-
-public:
-
- /**
- * C++ constructor.
- *
- * @since S60 v5.0
- * @param aSize Thumbnail size (in pixels) which will be stored.
- * @param aCrop If true, stored thumbnails are cropped to aspect ratio.
- * @param aMode Display mode used for stored bitmaps
- * @param aFormat Format used when storing thumbnails
- */
- TThumbnailPersistentSize( const TSize& aSize, TBool aCrop, TDisplayMode
- aMode, TInt aFormat );
-
- TThumbnailPersistentSize( TThumbnailSize aType, const TSize& aSize, TBool aCrop, TDisplayMode
- aMode, TInt aFormat, TBool aAutoCreate );
-
-public:
-
- // data
- TThumbnailSize iType;
- TInt iSourceType;
- TInt iSizeType;
-
- TSize iSize;
- TBool iCrop;
- TDisplayMode iMode;
- TInt iFormat;
-
- TBool iAutoCreate;
-};
-
-/**
- * Class for representing thumbnail auto creation parameters.
- *
- * @since S60 v5.0
- */
-class TThumbnailAutoCreate
- {
-
-public:
-
- /**
- * C++ constructor.
- *
- * @since S60 v5.0
- */
- TThumbnailAutoCreate();
-
-public:
-
- // data
- TBool iImageGrid;
- TBool iImageList;
- TBool iImageFullscreen;
- TBool iVideoGrid;
- TBool iVideoList;
- TBool iVideoFullscreen;
- TBool iAudioGrid;
- TBool iAudioList;
- TBool iAudioFullscreen;
- TBool iContactGrid;
- TBool iContactList;
- TBool iContactFullscreen;
-};
-
-#endif // THUMBNAILCENREP_H
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/init/ThumbnailManagerTest.ini Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-#
-# This is STIF 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'.
-# + XML, Test report will be xml type, for example 'TestReport.xml'.
-# Note, that xml format is available only when output is set to FILE.
-#
-# - 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.
-# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
-# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
-#
-
-[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, HTML or XML
-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
-
-DisableMeasurement= stifmeasurementdisablenone # Possible values are:
- # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
- # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
- # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
- # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
-
-Timeout= 180000 # Default timeout value for each test case. In milliseconds
-#UITestingSupport= YES # Possible values: YES or NO
-#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
-[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= TestScripter
-TestCaseFile= c:\testframework\ThumbnailManagerTest.cfg
-[End_Module]
-
-
-# Load testmoduleXXX, optionally with initialization file and/or test case files
-#[New_Module]
-#ModuleName= testmodulexxx
-
-#TestModuleXXX used initialization file
-#IniFile= c:\testframework\init.txt
-
-#TestModuleXXX used configuration file(s)
-#TestCaseFile= c:\testframework\testcases1.cfg
-#TestCaseFile= c:\testframework\testcases2.cfg
-#TestCaseFile= c:\testframework\manualtestcases.cfg
-
-#[End_Module]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set STIF 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.
-#
-# - Will write log file in unicode format.
-# + YES, Log file will be written in unicode format
-# + NO, Log will be written as normal, not unicode, file.
-#
-
-[Logger_Defaults]
-
-#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
-#NOTE: TestEngine and TestServer logging settings cannot change here
-
-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= C:\
-#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
-
-#FileUnicode= YES # Possible values: YES or NO
-#AddTestCaseTitle= YES # Possible values: YES or NO
-[End_Logger_Defaults]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-
-
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-# Set filters to be used by ConsoleUI.
-# If you want to use filter with ConsoleUI, simply remove comments
-# from section below and provide valid filter entries.
-# Each filter line has to start with "filter= " keyword.
-# Filter can contain special wildcard characters:
-# * which stands for none or any literal;
-# ? which stands for single character.
-# Filters are not case-sensitive.
-
-#[Filters]
-#filter= *math*
-#filter= *radio*
-#[End_Filters]
-# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-
-# End of file
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTest.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
-* 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 Manager API tests
-*
-*/
-
-// INCLUDE FILES
-#include <Stiftestinterface.h>
-#include <SettingServerClient.h>
-
-#include <PathInfo.h>
-
-#include "ThumbnailManagerTest.h"
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CThumbnailManagerTest::CThumbnailManagerTest
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CThumbnailManagerTest::CThumbnailManagerTest( CTestModuleIf& aTestModuleIf ):
- CScriptBase( aTestModuleIf )
- {
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailManagerTest::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailManagerTest::ConstructL()
- {
- iLog = CStifLogger::NewL( KThumbnailManagerTestLogPath,
- KThumbnailManagerTestLogFile,
- CStifLogger::ETxt,
- CStifLogger::EFile,
- EFalse );
-
- User::LeaveIfError( iFs.Connect());
- User::LeaveIfError( iFs.ShareProtected());
-
- // set test data path according to env
-#if ( defined (__WINS__) || defined (__WINSCW__) )
- iDataPath.Copy( PathInfo::PhoneMemoryRootPath().Left( KPathPrefixLength ));
-#else
- iDataPath.Copy( PathInfo::MemoryCardRootPath ().Left( KPathPrefixLength ));
-#endif
- iDataPath.Append( KTMTestDataPath );
- iDataPath.ZeroTerminate();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailManagerTest::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CThumbnailManagerTest* CThumbnailManagerTest::NewL( CTestModuleIf& aTestModuleIf )
- {
- CThumbnailManagerTest* self = new (ELeave) CThumbnailManagerTest( aTestModuleIf );
-
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop();
-
- return self;
- }
-
-// Destructor
-CThumbnailManagerTest::~CThumbnailManagerTest()
- {
- // Delete resources allocated from test methods
- Delete();
-
- // Delete logger
- delete iLog;
-
- iFs.Close();
- }
-
-// ========================== 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
- {
- return ( CScriptBase* ) CThumbnailManagerTest::NewL( aTestModuleIf );
- }
-
-
-// End of File
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/ThumbnailManagerTestBlocks.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,889 +0,0 @@
-/*
-* 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 Manager API tests
-*
-*/
-
-// [INCLUDE FILES] - do not remove
-#include <e32svr.h>
-#include <StifParser.h>
-#include <Stiftestinterface.h>
-
-#include <fbs.h>
-#include <sqldb.h>
-#include <ImageConversion.h>
-#include <thumbnailmanager.h>
-
-#include "ThumbnailManagerTest.h"
-
-
-// ============================= LOCAL FUNCTIONS ===============================
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CThumbnailManagerTest::Delete
-// Delete here all resources allocated and opened from test methods.
-// Called from destructor.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailManagerTest::Delete()
- {
- delete iPreviewThumbnail;
- iPreviewThumbnail = NULL;
- delete iThumbnail;
- iThumbnail = NULL;
- delete iEngine;
- iEngine = NULL;
- delete iObjectSource;
- iObjectSource = NULL;
- delete iCenrep;
- iCenrep = NULL;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailManagerTest::RunMethodL
-// Run specified method. Contains also table of test mothods and their names.
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailManagerTest::RunMethodL( CStifItemParser& aItem )
- {
- static TStifFunctionInfo const KFunctions[] =
- {
- ENTRY( "CreateInstanceL", CThumbnailManagerTest::CreateInstanceL ),
- ENTRY( "DeleteInstance", CThumbnailManagerTest::DeleteInstance ),
- ENTRY( "SetThumbnailSizeL", CThumbnailManagerTest::SetThumbnailSizeL ),
- ENTRY( "CheckThumbnailSizeL", CThumbnailManagerTest::CheckThumbnailSizeL ),
- ENTRY( "SetThumbnailEnumSizeL", CThumbnailManagerTest::SetThumbnailEnumSizeL ),
- ENTRY( "CreateSourceInstancePathL", CThumbnailManagerTest::CreateSourceInstancePathL ),
- ENTRY( "CreateSourceInstancePathTargetL", CThumbnailManagerTest::CreateSourceInstancePathTargetL ),
- ENTRY( "CreateSourceInstanceHandleL", CThumbnailManagerTest::CreateSourceInstanceHandleL ),
- ENTRY( "CreateSourceInstanceBufferL", CThumbnailManagerTest::CreateSourceInstanceBufferL ),
- ENTRY( "CreateSourceInstanceBitmapL", CThumbnailManagerTest::CreateSourceInstanceBitmapL ),
- ENTRY( "DeleteSourceInstance", CThumbnailManagerTest::DeleteSourceInstance ),
- ENTRY( "GetThumbnailL", CThumbnailManagerTest::GetThumbnailL ),
- ENTRY( "GetThumbnailByIdL", CThumbnailManagerTest::GetThumbnailByIdL ),
- ENTRY( "SetThumbnailL", CThumbnailManagerTest::SetThumbnailL ),
- ENTRY( "ImportThumbnailL", CThumbnailManagerTest::ImportThumbnailL ),
- ENTRY( "CheckPreviewThumbnailL", CThumbnailManagerTest::CheckPreviewThumbnailL ),
- ENTRY( "CheckThumbnailL", CThumbnailManagerTest::CheckThumbnailL ),
- ENTRY( "CheckThumbnailCenrepL", CThumbnailManagerTest::CheckThumbnailCenrepL ),
- ENTRY( "CancelPrevious", CThumbnailManagerTest::CancelPrevious ),
- ENTRY( "ChangePreviousPriority", CThumbnailManagerTest::ChangePreviousPriority ),
- ENTRY( "SetFlagsL", CThumbnailManagerTest::SetFlagsL ),
- ENTRY( "CheckFlags", CThumbnailManagerTest::CheckFlags ),
- ENTRY( "SetQualityPreferenceL", CThumbnailManagerTest::SetQualityPreferenceL ),
- ENTRY( "CheckQualityPreference", CThumbnailManagerTest::CheckQualityPreference ),
- ENTRY( "SetDisplayModeL", CThumbnailManagerTest::SetDisplayModeL ),
- ENTRY( "CheckDisplayModeL", CThumbnailManagerTest::CheckDisplayModeL ),
- ENTRY( "DeleteThumbnails", CThumbnailManagerTest::DeleteThumbnails ),
- ENTRY( "CreateThumbnailsByUrlL", CThumbnailManagerTest::CreateThumbnailsByUrlL ),
- ENTRY( "CreateThumbnails", CThumbnailManagerTest::CreateThumbnails ),
- ENTRY( "UpdatePathL", CThumbnailManagerTest::UpdatePathL ),
- ENTRY( "GetSupportedMimeTypesL", CThumbnailManagerTest::GetSupportedMimeTypesL )
- };
-
- const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
-
- return RunInternalL( KFunctions, count, aItem );
- }
-
-TInt CThumbnailManagerTest::CreateInstanceL( CStifItemParser& /*aItem*/ )
- {
- _LIT( KPanicTxt, "CreateInstanceL" );
- __ASSERT_ALWAYS( !iEngine, User::Panic( KPanicTxt, 0 ));
-
- iEngine = CThumbnailManager::NewL( *this );
-
- iCenrep = CThumbnailCenRep::NewL();
- iPersistentSizes = iCenrep->GetPersistentSizes();
-
- iCurrentThumbnailSize = EUnknownThumbnailSize;
- iDoNotCreate = EFalse;
- iCreateThumbnails = EFalse;
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::DeleteInstance( CStifItemParser& /*aItem*/ )
- {
- // Bitmaps must be deleted before CThumbnailManager, since
- // CThumbnailManager will close the FBS session
- delete iPreviewThumbnail;
- iPreviewThumbnail = NULL;
- delete iThumbnail;
- iThumbnail = NULL;
- delete iEngine;
- iEngine = NULL;
- delete iObjectSource;
- iObjectSource = NULL;
- delete iCenrep;
- iCenrep = NULL;
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::SetThumbnailSizeL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "SetThumbnailSizeL" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt width = 0;
- TInt height = 0;
- User::LeaveIfError( aItem.GetNextInt( width ));
- User::LeaveIfError( aItem.GetNextInt( height ));
- iEngine->SetThumbnailSizeL( TSize( width, height ));
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CheckThumbnailSizeL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CheckThumbnailSize" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt width = 0;
- TInt height = 0;
- User::LeaveIfError( aItem.GetNextInt( width ));
- User::LeaveIfError( aItem.GetNextInt( height ));
- TInt ret = KErrArgument;
- TSize size = iEngine->ThumbnailSize();
-
- if ( size == TSize( width, height ))
- {
- ret = KErrNone;
- }
-
- return ret;
- }
-
-TInt CThumbnailManagerTest::SetThumbnailEnumSizeL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "SetThumbnailEnumSizeL" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt enumSize = 0;
- User::LeaveIfError( aItem.GetNextInt( enumSize ));
-
- iEngine->SetThumbnailSizeL( (TThumbnailSize)enumSize );
- iCurrentThumbnailSize = (TThumbnailSize)enumSize;
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::SetFlagsL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "SetFlagsL" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt flags = 0;
- User::LeaveIfError( aItem.GetNextInt( flags ));
-
- iEngine->SetFlagsL(( CThumbnailManager::TThumbnailFlags )flags );
-
- if (flags == CThumbnailManager::EDoNotCreate)
- {
- iDoNotCreate = ETrue;
- }
- else
- {
- iDoNotCreate = EFalse;
- }
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CheckFlags( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CheckFlags" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt flags = 0;
- aItem.GetNextInt( flags );
-
- if ( iEngine->Flags() != flags )
- {
- return KErrArgument;
- }
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::SetQualityPreferenceL( CStifItemParser& aItem
- )
- {
- _LIT( KPanicTxt, "SetQualityPreferenceL" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt qp = 0;
- User::LeaveIfError( aItem.GetNextInt( qp ));
-
- iEngine->SetQualityPreferenceL( (CThumbnailManager::TThumbnailQualityPreference)qp );
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CheckQualityPreference( CStifItemParser&
- aItem )
- {
- _LIT( KPanicTxt, "CheckQualityPreference" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt qp = 0;
- aItem.GetNextInt( qp );
-
- if ( iEngine->QualityPreference() != qp )
- {
- return KErrArgument;
- }
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::SetDisplayModeL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "SetDisplayModeL" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt displaymode = 0;
- User::LeaveIfError( aItem.GetNextInt( displaymode ));
-
- iEngine->SetDisplayModeL( (TDisplayMode)displaymode );
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CheckDisplayModeL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CheckDisplayModeL" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt displaymode = 0;
- User::LeaveIfError( aItem.GetNextInt( displaymode ));
-
- if ( iEngine->DisplayMode() != displaymode )
- {
- return KErrArgument;
- }
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CreateSourceInstancePathL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CreateSrcPath" );
- __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
-
- TPtrC path;
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TInt id = 0;
- aItem.GetNextInt( id );
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- iLog->Log( _L( "CreateSourceInstancePathL - path = %S" ), &filePath );
-
- delete iObjectSource;
- iObjectSource = NULL;
-
- iObjectSource = CThumbnailObjectSource::NewL( filePath, id );
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CreateSourceInstancePathTargetL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CreateSrcPathTarget" );
- __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
-
- TPtrC path;
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TPtrC target;
- User::LeaveIfError( aItem.GetNextString( target ));
-
- TPtrC mimeType;
- User::LeaveIfError( aItem.GetNextString( mimeType ));
-
- TInt virtual1 = 0;
- aItem.GetNextInt( virtual1 );
-
- TInt virtual2 = 0;
- aItem.GetNextInt( virtual2 );
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- if (virtual1)
- {
- filePath.Delete(2,1);
- }
-
- TFileName targetPath( iDataPath );
- targetPath.Append( target );
- targetPath.ZeroTerminate();
-
- if (virtual2)
- {
- targetPath.Delete(2,1);
- }
-
- iLog->Log( _L( "CreateSourceInstancePathTargetL - path = %S, target = %S" ), &filePath );
-
- delete iObjectSource;
- iObjectSource = NULL;
-
- iObjectSource = CThumbnailObjectSource::NewL( filePath, targetPath, mimeType );
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CreateSourceInstanceHandleL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CreateSrcHandle" );
- __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
-
- TPtrC path;
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- User::LeaveIfError( iFile.Open( iFs, filePath, EFileShareReadersOrWriters ));
- iLog->Log( _L( "CreateSourceInstanceHandleL - path = %S" ), &filePath );
-
- delete iObjectSource;
- iObjectSource = NULL;
- iObjectSource = CThumbnailObjectSource::NewL( iFile );
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CreateSourceInstanceBufferL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CreateSrcBuffer" );
- __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
-
- TPtrC path;
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TPtrC mimeType;
- User::LeaveIfError( aItem.GetNextString( mimeType ));
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- User::LeaveIfError( iFile.Open( iFs, filePath, EFileShareReadersOrWriters ));
- iLog->Log( _L( "CreateSourceInstanceBufferL - path = %S" ), &filePath );
-
- TInt64 size;
- User::LeaveIfError( iFile.Size( size ) );
- iBuffer = HBufC8::NewL( size );
- TPtr8 ptr = iBuffer->Des();
- iFile.Read( ptr );
- iFile.Close();
-
- delete iObjectSource;
- iObjectSource = NULL;
- iObjectSource = CThumbnailObjectSource::NewL( iBuffer, mimeType, filePath );
-
- iBuffer = NULL;
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CreateSourceInstanceBitmapL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CreateSrcBuffer" );
- __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
-
- TPtrC path;
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- TPtrC target;
- User::LeaveIfError( aItem.GetNextString( target ));
-
- TFileName targetPath( iDataPath );
- targetPath.Append( target );
- targetPath.ZeroTerminate();
-
- iLog->Log( _L( "CreateSourceInstanceBitmapL - bitmap = %S" ), &filePath );
- iLog->Log( _L( "CreateSourceInstanceBitmapL - target = %S" ), &targetPath );
-
- iBitmap = new (ELeave) CFbsBitmap();
- User::LeaveIfError(iBitmap->Load(filePath, 0));
-
- delete iObjectSource;
- iObjectSource = NULL;
- iObjectSource = CThumbnailObjectSource::NewL( iBitmap, targetPath );
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::DeleteSourceInstance( CStifItemParser& /*aItem*/ )
- {
- delete iObjectSource;
- iObjectSource = NULL;
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::GetThumbnailL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "GetThumbnailL" );
- __ASSERT_ALWAYS( iObjectSource, User::Panic( KPanicTxt, 0 ));
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 1 ));
-
- TInt clientData = NULL;
- TInt priority = 0;
-
- TInt err = aItem.GetNextInt( clientData );
- if ( !err )
- {
- aItem.GetNextInt( priority );
- }
-
- iPreviousRequestId = iEngine->GetThumbnailL( *iObjectSource, ( TAny* )
- clientData, priority );
- iLog->Log( _L( "GetThumbnailL - request id %d" ), iPreviousRequestId );
-
- if (!iDoNotCreate)
- {
- iCreateThumbnails = EFalse;
- }
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::GetThumbnailByIdL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "GetThumbnailByIdL" );
- __ASSERT_ALWAYS( iObjectSource, User::Panic( KPanicTxt, 0 ));
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 1 ));
-
- TInt id = 0;
- TInt clientData = NULL;
- TInt priority = 0;
-
- User::LeaveIfError( aItem.GetNextInt( id ));
- TInt err = aItem.GetNextInt( clientData );
- if ( !err )
- {
- aItem.GetNextInt( priority );
- }
-
- iPreviousRequestId = iEngine->GetThumbnailL( id, (TAny*)clientData, priority );
- iLog->Log( _L( "GetThumbnailByIdL - request id %d" ), iPreviousRequestId );
-
- if (!iDoNotCreate)
- {
- iCreateThumbnails = EFalse;
- }
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::SetThumbnailL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "SetThumbnailL" );
- __ASSERT_ALWAYS( iObjectSource, User::Panic( KPanicTxt, 0 ));
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 1 ));
-
- TInt clientData = NULL;
- TInt priority = 0;
-
- TInt err = aItem.GetNextInt( clientData );
- if ( !err )
- {
- aItem.GetNextInt( priority );
- }
-
- iPreviousRequestId = iEngine->SetThumbnailL( *iObjectSource, ( TAny* )
- clientData, priority );
- iLog->Log( _L( "SetThumbnailL - request id %d" ), iPreviousRequestId );
-
- if (!iDoNotCreate)
- {
- iCreateThumbnails = EFalse;
- }
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::ImportThumbnailL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "ImportThumbnailL" );
- __ASSERT_ALWAYS( iObjectSource, User::Panic( KPanicTxt, 0 ));
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 1 ));
-
- TInt clientData = NULL;
- TInt priority = 0;
- TPtrC path;
-
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- TInt err = aItem.GetNextInt( clientData );
- if ( !err )
- {
- aItem.GetNextInt( priority );
- }
-
- iPreviousRequestId = iEngine->ImportThumbnailL( *iObjectSource, filePath,
- (TAny*)clientData, priority );
- iLog->Log( _L( "ImportThumbnailL - request id %d" ), iPreviousRequestId );
-
- if (!iDoNotCreate)
- {
- iCreateThumbnails = EFalse;
- }
-
- return KErrNone;
- }
-
-void CThumbnailManagerTest::ThumbnailPreviewReady( MThumbnailData&
- aThumbnail, TThumbnailRequestId aId )
- {
- iLog->Log( _L( "ThumbnailPreviewReady aId=%d" ), aId );
- delete iPreviewThumbnail;
- iPreviewThumbnail = aThumbnail.DetachBitmap();
- iPreviewThumbnailCbId = aId;
- Signal( KErrNone );
- }
-
-void CThumbnailManagerTest::ThumbnailReady( TInt aError, MThumbnailData&
- aThumbnail, TThumbnailRequestId aId )
- {
- iLog->Log( _L( "ThumbnailReady aError=%d aId=%d" ), aError, aId );
- delete iThumbnail;
- iThumbnail = aThumbnail.DetachBitmap();
- iThumbnailCbId = aId;
-
- // ignore KErrNotFound, if auto create disabled (CreateThumbnails used)
- if (aError == KErrNotFound && iCreateThumbnails)
- {
- for ( TInt i = 0 ; i < iPersistentSizes.Count(); i++ )
- {
- if ( iPersistentSizes[i].iType == iCurrentThumbnailSize &&
- !iPersistentSizes[i].iAutoCreate )
- {
- aError = KErrNone;
- break;
- }
- }
- }
-
- Signal( aError );
- }
-
-TInt CThumbnailManagerTest::CheckPreviewThumbnailL( CStifItemParser& aItem )
- {
- if ( iPreviewThumbnail )
- {
- TInt width = 0;
- TInt height = 0;
- TInt displaymode = 0;
- User::LeaveIfError( aItem.GetNextInt( width ));
- User::LeaveIfError( aItem.GetNextInt( height ));
- User::LeaveIfError( aItem.GetNextInt( displaymode ));
- TSize size = iPreviewThumbnail->SizeInPixels();
- iLog->Log( _L(
- "CheckPreviewThumbnailL - bitmap size %dx%d (expecting %dx%d)" ),
- size.iWidth, size.iHeight, width, height );
- iLog->Log( _L( "CheckPreviewThumbnailL - bitmap mode %d (expecting %d)"
- ), iPreviewThumbnail->DisplayMode(), displaymode );
- if ( size != TSize( width, height ))
- {
- iLog->Log( _L( "CheckPreviewThumbnailL - size mismatch" ));
- User::Leave( KErrArgument );
- }
- else if ( displaymode != iPreviewThumbnail->DisplayMode())
- {
- iLog->Log( _L( "CheckPreviewThumbnailL - displaymode mismatch" ));
- User::Leave( KErrArgument );
- }
- else
- {
- iLog->Log( _L( "CheckPreviewThumbnailL - ok" ));
- }
- }
- else
- {
- // Bitmap missing
- iLog->Log( _L( "CheckPreviewThumbnailL - preview bitmap NULL" ));
- User::Leave( KErrUnknown );
- }
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CheckThumbnailL( CStifItemParser& aItem )
- {
- if ( iThumbnail )
- {
- TInt width = 0;
- TInt height = 0;
- TInt displaymode = 0;
- User::LeaveIfError( aItem.GetNextInt( width ));
- User::LeaveIfError( aItem.GetNextInt( height ));
- User::LeaveIfError( aItem.GetNextInt( displaymode ));
- TSize size = iThumbnail->SizeInPixels();
- iLog->Log( _L( "CheckThumbnailL - bitmap size %dx%d (expecting %dx%d)" )
- , size.iWidth, size.iHeight, width, height );
- iLog->Log( _L( "CheckThumbnailL - bitmap mode %d (expecting %d)" ),
- iThumbnail->DisplayMode(), displaymode );
-
- // one needs to match, aspect ratio scaling makes this difficult...
- if ( size.iWidth != width && size.iHeight != height )
- {
- iLog->Log( _L( "CheckThumbnailL - size mismatch" ));
- User::Leave( KErrArgument );
- }
- else if ( displaymode != iThumbnail->DisplayMode())
- {
- iLog->Log( _L( "CheckThumbnailL - displaymode mismatch" ));
- }
- else
- {
- iLog->Log( _L( "CheckThumbnailL - ok" ));
- }
- }
- else
- {
- // Bitmap missing
- iLog->Log( _L( "CheckThumbnailL - bitmap NULL" ));
- User::Leave( KErrNotFound );
- }
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CheckThumbnailCenrepL( CStifItemParser& aItem )
- {
- TInt err = KErrNone;
- TBool full = EFalse;
-
- TInt sizeType;
- TInt displaymode = 0;
- User::LeaveIfError( aItem.GetNextInt( sizeType ));
- User::LeaveIfError( aItem.GetNextInt( displaymode ));
-
- TThumbnailSize size = (TThumbnailSize)sizeType;
- if (size == EImageFullScreenThumbnailSize ||
- size == EVideoFullScreenThumbnailSize ||
- size == EAudioFullScreenThumbnailSize)
- {
- full = ETrue;
- }
-
- if ( iThumbnail )
- {
- TInt width = 0;
- TInt height = 0;
-
- for ( TInt i = 0 ; i < iPersistentSizes.Count(); i++ )
- {
- if ( iPersistentSizes[i].iType == size )
- {
- width = iPersistentSizes[i].iSize.iWidth;
- height = iPersistentSizes[i].iSize.iHeight;
- break;
- }
- }
-
- TSize thumbSize = iThumbnail->SizeInPixels();
-
- iLog->Log( _L( "CheckThumbnailCenrepL - bitmap size %dx%d (expecting %dx%d)" )
- , thumbSize.iWidth, thumbSize.iHeight, width, height );
- iLog->Log( _L( "CheckThumbnailCenrepL - bitmap mode %d (expecting %d)" ),
- iThumbnail->DisplayMode(), displaymode );
-
- // one needs to match, and both need to be smaller than cenrep value
- if ( (thumbSize.iWidth == width || thumbSize.iHeight == height) &&
- thumbSize.iWidth <= width && thumbSize.iHeight <= height)
- {
- iLog->Log( _L( "CheckThumbnailCenrepL - ok" ));
- }
- else if (full && (thumbSize.iWidth <= width && thumbSize.iHeight <= height))
- {
- iLog->Log( _L( "CheckThumbnailCenrepL - fullscreen ok, not upscaled" ));
- }
- else
- {
- iLog->Log( _L( "CheckThumbnailCenrepL - size mismatch" ));
- err = KErrArgument;
- }
-
- // check display mode
- if ( displaymode != iThumbnail->DisplayMode())
- {
- iLog->Log( _L( "CheckThumbnailCenrepL - displaymode mismatch" ));
- err = KErrArgument;
- }
- }
- else
- {
- for ( TInt i = 0 ; i < iPersistentSizes.Count(); i++ )
- {
- if ( iPersistentSizes[i].iType == size && iPersistentSizes[i].iAutoCreate)
- {
- // Bitmap missing
- iLog->Log( _L( "CheckThumbnailCenrepL - bitmap NULL" ));
- err = KErrNotFound;
- break;
- }
- }
- }
-
- return err;
- }
-
-TInt CThumbnailManagerTest::CancelPrevious( CStifItemParser& /*aItem*/ )
- {
- _LIT( KPanicTxt, "CancelPrevious" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt err = iEngine->CancelRequest( iPreviousRequestId );
- iLog->Log( _L( "CancelPrevious() returned %d" ), err );
- return err;
- }
-
-TInt CThumbnailManagerTest::ChangePreviousPriority( CStifItemParser&
- aItem )
- {
- _LIT( KPanicTxt, "ChangePreviousPriority" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt priority = 0;
- aItem.GetNextInt( priority );
-
- TInt err = iEngine->ChangePriority( iPreviousRequestId, priority );
- iLog->Log( _L( "ChangePriority() returned %d" ), err );
- return err;
- }
-
-
-TInt CThumbnailManagerTest::DeleteThumbnails( CStifItemParser& /*aItem*/ )
- {
- iEngine->DeleteThumbnails( *iObjectSource );
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::CreateThumbnailsByUrlL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CreateSrcPath" );
- __ASSERT_ALWAYS( !iObjectSource, User::Panic( KPanicTxt, 0 ));
-
- TPtrC path;
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TInt id = 0;
- aItem.GetNextInt( id );
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- iLog->Log( _L( "CreateSourceInstancePathL - path = %S" ), &filePath );
-
- delete iObjectSource;
- iObjectSource = NULL;
-
- iObjectSource = CThumbnailObjectSource::NewL( filePath, id );
-
- id = iEngine->CreateThumbnails( *iObjectSource );
- if (id < 0)
- {
- iLog->Log( _L( "CreateThumbnails - error %d" ), id );
- return id;
- }
- else
- {
- iPreviousRequestId = id;
- iLog->Log( _L( "CreateThumbnails - request id %d" ), iPreviousRequestId );
- }
-
- iCreateThumbnails = ETrue;
-
- return KErrNone;
- }
-
-
-TInt CThumbnailManagerTest::CreateThumbnails( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "CreateThumbnails" );
- __ASSERT_ALWAYS( iObjectSource, User::Panic( KPanicTxt, 0 ));
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 1 ));
-
- TInt priority = 0;
-
- aItem.GetNextInt( priority );
-
- TInt id;
- id = iEngine->CreateThumbnails( *iObjectSource, priority );
- if (id < 0)
- {
- iLog->Log( _L( "CreateThumbnails - error %d" ), id );
- return id;
- }
- else
- {
- iPreviousRequestId = id;
- iLog->Log( _L( "CreateThumbnails - request id %d" ), iPreviousRequestId );
- }
-
- iCreateThumbnails = ETrue;
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::UpdatePathL( CStifItemParser& aItem )
- {
- _LIT( KPanicTxt, "UpdatePath" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- TInt id = 0;
- TPtrC path;
- User::LeaveIfError( aItem.GetNextInt( id ));
- User::LeaveIfError( aItem.GetNextString( path ));
-
- TFileName filePath( iDataPath );
- filePath.Append( path );
- filePath.ZeroTerminate();
-
- iLog->Log( _L( "UpdatePath - path = %S" ), &filePath );
-
- iEngine->UpdateThumbnailsL(id, filePath, 0, 1000, CActive::EPriorityIdle);
-
- return KErrNone;
- }
-
-TInt CThumbnailManagerTest::GetSupportedMimeTypesL( CStifItemParser& /*aItem*/ )
- {
- _LIT( KPanicTxt, "GetSupportedMimeTypesL" );
- __ASSERT_ALWAYS( iEngine, User::Panic( KPanicTxt, 0 ));
-
- iEngine->GetSupportedMimeTypesL();
-
- return KErrNone;
- }
-
-
-// ========================== OTHER EXPORTED FUNCTIONS =========================
-// None
-
-// [End of File] - Do not remove
--- a/imagehandling_plat/thumbnailmanager_api/tsrc/src/thumbnailcenrep.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +0,0 @@
-/*
-* 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: Class for handling central repositoty data
- *
-*/
-
-
-#include <centralrepository.h>
-#include <thumbnailmanager.h>
-
-#include "thumbnailcenrep.h"
-
-
-#define THUMBNAIL_CENREP_UID 0x102830B0
-
-const TUint32 KSizeImageGridWidth = 0x0;
-const TUint32 KSizeImageGridHeight = 0x1;
-const TUint32 KSizeImageListWidth = 0x2;
-const TUint32 KSizeImageListHeight = 0x3;
-const TUint32 KSizeImageFullscreenWidth = 0x4;
-const TUint32 KSizeImageFullscreenHeight = 0x5;
-const TUint32 KSizeVideoGridWidth = 0x6;
-const TUint32 KSizeVideoGridHeight = 0x7;
-const TUint32 KSizeVideoListWidth = 0x8;
-const TUint32 KSizeVideoListHeight = 0x9;
-const TUint32 KSizeVideoFullscreenWidth = 0x10;
-const TUint32 KSizeVideoFullscreenHeight = 0x11;
-const TUint32 KSizeAudioGridWidth = 0x12;
-const TUint32 KSizeAudioGridHeight = 0x13;
-const TUint32 KSizeAudioListWidth = 0x14;
-const TUint32 KSizeAudioListHeight = 0x15;
-const TUint32 KSizeAudioFullscreenWidth = 0x16;
-const TUint32 KSizeAudioFullscreenHeight = 0x17;
-const TUint32 KSizeContactListWidth = 0x18;
-const TUint32 KSizeContactListHeight = 0x19;
-const TUint32 KSizeContactGridWidth = 0x20;
-const TUint32 KSizeContactGridHeight = 0x21;
-const TUint32 KSizeContactFullscreenWidth = 0x22;
-const TUint32 KSizeContactFullscreenHeight = 0x23;
-
-const TUint32 KAutoCreateImageGrid = 0x100;
-const TUint32 KAutoCreateImageList = 0x101;
-const TUint32 KAutoCreateImageFullscreen = 0x102;
-const TUint32 KAutoCreateVideoGrid = 0x103;
-const TUint32 KAutoCreateVideoList = 0x104;
-const TUint32 KAutoCreateVideoFullscreen = 0x105;
-const TUint32 KAutoCreateAudioGrid = 0x106;
-const TUint32 KAutoCreateAudioList = 0x107;
-const TUint32 KAutoCreateAudioFullscreen = 0x108;
-const TUint32 KAutoCreateContactGrid = 0x109;
-const TUint32 KAutoCreateContactList = 0x110;
-const TUint32 KAutoCreateContactFullscreen = 0x111;
-
-
-// ---------------------------------------------------------------------------
-// TThumbnailPersistentSize::TThumbnailPersistentSize
-// ---------------------------------------------------------------------------
-//
-TThumbnailPersistentSize::TThumbnailPersistentSize( const TSize& aSize, TBool
- aCrop, TDisplayMode aMode, TInt aFormat ): iSize( aSize ), iCrop( aCrop ),
- iMode( aMode ), iFormat( aFormat )
- {
- iType = EUnknownThumbnailSize;
- iSourceType = EUnknownSourceType;
- iAutoCreate = ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// TThumbnailPersistentSize::TThumbnailPersistentSize
-// ---------------------------------------------------------------------------
-//
-TThumbnailPersistentSize::TThumbnailPersistentSize( TThumbnailSize aType,
- const TSize& aSize, TBool aCrop, TDisplayMode aMode, TInt aFormat,
- TBool aAutoCreate )
- : iType( aType ), iSize( aSize ), iCrop( aCrop ), iMode( aMode ),
- iFormat( aFormat ), iAutoCreate( aAutoCreate )
- {
- switch ( aType )
- {
- case EImageGridThumbnailSize:
- case EImageListThumbnailSize:
- case EImageFullScreenThumbnailSize:
- iSourceType = EImage;
- break;
- case EVideoGridThumbnailSize:
- case EVideoListThumbnailSize:
- case EVideoFullScreenThumbnailSize:
- iSourceType = EVideo;
- break;
- case EAudioGridThumbnailSize:
- case EAudioListThumbnailSize:
- case EAudioFullScreenThumbnailSize:
- iSourceType = EAudio;
- break;
- case EContactGridThumbnailSize:
- case EContactListThumbnailSize:
- case EContactFullScreenThumbnailSize:
- iSourceType = EContact;
- break;
- default:
- iSourceType = EUnknownSourceType;
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// TThumbnailAutoCreate::TThumbnailAutoCreate
-// ---------------------------------------------------------------------------
-//
-TThumbnailAutoCreate::TThumbnailAutoCreate()
- : iImageGrid(EFalse), iImageList(EFalse), iImageFullscreen(EFalse),
- iVideoGrid(EFalse), iVideoList(EFalse), iVideoFullscreen(EFalse),
- iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse),
- iContactGrid(EFalse), iContactList(EFalse), iContactFullscreen(EFalse)
- {
- // No implementation required
- }
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::CThumbnailCenRep()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailCenRep::CThumbnailCenRep()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::~CThumbnailCenRep()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailCenRep::~CThumbnailCenRep()
- {
- iPersistentSizes.Close();
- delete iAutoCreate;
- delete iRepository;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailCenRep* CThumbnailCenRep::NewL()
- {
- CThumbnailCenRep* self = new( ELeave )CThumbnailCenRep();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::ConstructL()
-// Returns id of specific task.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailCenRep::ConstructL()
- {
- iRepository = CRepository::NewL( TUid::Uid( THUMBNAIL_CENREP_UID ));
-
- TInt xSize( 0 );
- TInt ySize( 0 );
- TBool flags( EFalse );
- const TBool KGridAndListThumbnailCropped = ETrue;
- TInt raw_mode( EColor64K );
- TInt format( 0 );
- TBool autoCreate( EFalse );
-
- User::LeaveIfError( iRepository->Get( KSizeImageGridWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeImageGridHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageGrid, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EImageGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeImageListWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeImageListHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageList, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EImageListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeImageFullscreenWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeImageFullscreenHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageFullscreen, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EImageFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeVideoGridWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeVideoGridHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoGrid, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EVideoGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeVideoListWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeVideoListHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoList, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EVideoListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeVideoFullscreenWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeVideoFullscreenHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoFullscreen, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EVideoFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeAudioGridWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeAudioGridHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeAudioListWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeAudioListHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeAudioFullscreenWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeAudioFullscreenHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeContactGridWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeContactGridHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeContactListWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeContactListHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateContactList, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- User::LeaveIfError( iRepository->Get( KSizeContactFullscreenWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeContactFullscreenHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate ));
-
- iAutoCreate = new (ELeave) TThumbnailAutoCreate();
-
- User::LeaveIfError( iRepository->Get( KAutoCreateImageGrid, iAutoCreate->iImageGrid ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageList, iAutoCreate->iImageList ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageFullscreen, iAutoCreate->iImageFullscreen ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoGrid, iAutoCreate->iVideoGrid ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoList, iAutoCreate->iVideoList ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoFullscreen, iAutoCreate->iVideoFullscreen ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, iAutoCreate->iAudioGrid ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, iAutoCreate->iAudioList ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, iAutoCreate->iAudioFullscreen ));
- User::LeaveIfError( iRepository->Get( KAutoCreateContactGrid, iAutoCreate->iContactGrid ));
- User::LeaveIfError( iRepository->Get( KAutoCreateContactList, iAutoCreate->iContactList ));
- User::LeaveIfError( iRepository->Get( KAutoCreateContactFullscreen, iAutoCreate->iContactFullscreen ));
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::GetPersistentSizes()
-// ---------------------------------------------------------------------------
-//
-RArray < TThumbnailPersistentSize > & CThumbnailCenRep::GetPersistentSizes()
- {
- return iPersistentSizes;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::GetAutoCreateParams()
-// ---------------------------------------------------------------------------
-//
-TThumbnailAutoCreate & CThumbnailCenRep::GetAutoCreateParams()
- {
- return *iAutoCreate;
- }
-
-TThumbnailPersistentSize & CThumbnailCenRep::PersistentSizeL( TThumbnailSize
- aThumbnailSize )
- {
- TThumbnailPersistentSize* persistentSize = NULL;
- TInt i = iPersistentSizes.Count();
- for ( ; --i >= 0; )
- {
- persistentSize = &iPersistentSizes[i];
- if ( persistentSize->iType == aThumbnailSize )
- {
- break;
- }
- }
- if ( i < 0 )
- { // size not found
- User::Leave( KErrNotFound );
- }
-
- return *persistentSize;
- }
-
-// End of file
--- a/imagehandlinglib/BWINS/IHLu.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-EXPORTS
- ?CopyBitmapL@IHLBitmapUtil@@SAPAVCFbsBitmap@@ABV2@@Z @ 1 NONAME ; class CFbsBitmap * IHLBitmapUtil::CopyBitmapL(class CFbsBitmap const &)
- ?CopyBitmapL@IHLBitmapUtil@@SAPAVCFbsBitmap@@ABV2@ABVTRect@@@Z @ 2 NONAME ; class CFbsBitmap * IHLBitmapUtil::CopyBitmapL(class CFbsBitmap const &, class TRect const &)
- ?CopyBitmapLC@IHLBitmapUtil@@SAPAVCFbsBitmap@@ABV2@@Z @ 3 NONAME ; class CFbsBitmap * IHLBitmapUtil::CopyBitmapLC(class CFbsBitmap const &)
- ?CopyBitmapLC@IHLBitmapUtil@@SAPAVCFbsBitmap@@ABV2@ABVTRect@@@Z @ 4 NONAME ; class CFbsBitmap * IHLBitmapUtil::CopyBitmapLC(class CFbsBitmap const &, class TRect const &)
- ?CreateBitmapProcessorL@IHLProcessorFactory@@SAPAVMIHLBitmapProcessor@@K@Z @ 5 NONAME ; class MIHLBitmapProcessor * IHLProcessorFactory::CreateBitmapProcessorL(unsigned long)
- ?CreateImageViewerL@IHLViewerFactory@@SAPAVMIHLImageViewer@@ABVTSize@@AAVMIHLImage@@AAVMIHLBitmap@@AAVMIHLViewerObserver@@K@Z @ 6 NONAME ; class MIHLImageViewer * IHLViewerFactory::CreateImageViewerL(class TSize const &, class MIHLImage &, class MIHLBitmap &, class MIHLViewerObserver &, unsigned long)
- ?CreateL@IHLBitmap@@SAPAVMIHLBitmap@@XZ @ 7 NONAME ; class MIHLBitmap * IHLBitmap::CreateL(void)
- ?CreateL@IHLScaler@@SAPAVMIHLScaler@@K@Z @ 8 NONAME ; class MIHLScaler * IHLScaler::CreateL(unsigned long)
- ?DuplicateBitmapL@IHLBitmapUtil@@SAPAVCFbsBitmap@@ABV2@@Z @ 9 NONAME ; class CFbsBitmap * IHLBitmapUtil::DuplicateBitmapL(class CFbsBitmap const &)
- ?DuplicateBitmapLC@IHLBitmapUtil@@SAPAVCFbsBitmap@@ABV2@@Z @ 10 NONAME ; class CFbsBitmap * IHLBitmapUtil::DuplicateBitmapLC(class CFbsBitmap const &)
- ?OpenFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFile@@@Z @ 11 NONAME ; class MIHLFileImage * IHLImageFactory::OpenFileImageL(class RFile &)
- ?OpenFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFile@@H@Z @ 12 NONAME ; class MIHLFileImage * IHLImageFactory::OpenFileImageL(class RFile &, int)
- ?OpenFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFs@@ABVTDesC16@@@Z @ 13 NONAME ; class MIHLFileImage * IHLImageFactory::OpenFileImageL(class RFs &, class TDesC16 const &)
- ?OpenFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFs@@ABVTDesC16@@H@Z @ 14 NONAME ; class MIHLFileImage * IHLImageFactory::OpenFileImageL(class RFs &, class TDesC16 const &, int)
- ?ScaleBitmap@IHLBitmapUtil@@SAHABVCFbsBitmap@@AAV2@K@Z @ 15 NONAME ; int IHLBitmapUtil::ScaleBitmap(class CFbsBitmap const &, class CFbsBitmap &, unsigned long)
- ?ScaleBitmap@IHLBitmapUtil@@SAHABVCFbsBitmap@@ABVTRect@@AAV2@1K@Z @ 16 NONAME ; int IHLBitmapUtil::ScaleBitmap(class CFbsBitmap const &, class TRect const &, class CFbsBitmap &, class TRect const &, unsigned long)
- ?OpenFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFile@@HK@Z @ 17 NONAME ; class MIHLFileImage * IHLImageFactory::OpenFileImageL(class RFile &, int, unsigned long)
- ?OpenFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFs@@ABVTDesC16@@HK@Z @ 18 NONAME ; class MIHLFileImage * IHLImageFactory::OpenFileImageL(class RFs &, class TDesC16 const &, int, unsigned long)
- ?OpenBufferedFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFs@@ABVTDesC8@@@Z @ 19 NONAME ; class MIHLFileImage * IHLImageFactory::OpenBufferedFileImageL(class RFs &, class TDesC8 const &)
- ?OpenBufferedFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFs@@ABVTDesC8@@H@Z @ 20 NONAME ; class MIHLFileImage * IHLImageFactory::OpenBufferedFileImageL(class RFs &, class TDesC8 const &, int)
- ?OpenBufferedFileImageL@IHLImageFactory@@SAPAVMIHLFileImage@@AAVRFs@@ABVTDesC8@@HK@Z @ 21 NONAME ; class MIHLFileImage * IHLImageFactory::OpenBufferedFileImageL(class RFs &, class TDesC8 const &, int, unsigned long)
-
--- a/imagehandlinglib/Group/IHL.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2004-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: Image Handling Library project file.*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET IHL.dll
-TARGETTYPE dll
-UID 0x1000008D 0x101f4d90 // Image Viewer uid
-CAPABILITY CAP_GENERAL_DLL
-VENDORID VID_DEFAULT
-
-OPTION ARMCC --cpu 6
-
-SOURCEPATH ../Src
-
-SOURCE IHLBitmapUtil.cpp
-SOURCE CIHLScaler.cpp
-SOURCE CIHLBitmap.cpp
-
-SOURCE IHLImageFactory.cpp
-SOURCE CIHLFileImage.cpp
-SOURCE CIHLFileImageExtJpg.cpp
-
-SOURCE IHLProcessorFactory.cpp
-SOURCE CIHLBitmapProcessor.cpp
-
-SOURCE IHLViewerFactory.cpp
-SOURCE CIHLImageViewer.cpp
-SOURCE CIHLImageViewerExtJpg.cpp
-
-USERINCLUDE .
-USERINCLUDE ../Src
-USERINCLUDE ../Inc // subsystem level inc dir
-USERINCLUDE ../../inc // ADo level inc dir
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE /epoc32/include/icl
-
-
-LIBRARY euser.lib
-LIBRARY fbscli.lib
-LIBRARY bitgdi.lib
-LIBRARY ImageConversion.lib
-LIBRARY efsrv.lib
-LIBRARY CAF.lib
-LIBRARY IclExtJpegApi.lib
-LIBRARY hal.lib
-
-//Remove comment to enable debug print
-//MACRO IHL_ENABLE_DEBUG_PRINT
--- a/imagehandlinglib/Group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2004-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: This file provides the information required for building.*
-*/
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-// export iby file
-../Rom/Ihl.iby CORE_MW_LAYER_IBY_EXPORT_PATH( Ihl.iby )
-
-PRJ_MMPFILES
-
-IHL.mmp
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// You can specify "manual" to denote that a test should be listed in a
-// generated batch file for running a group of tests
-// which require user input during testing.
-// You can specify "support" to denote that a file is a test support file
-// and shouldn't be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group
-// of tests which can be left to run without requiring watching over
-// by the person running the tests, i.e. tests where no user
-// input is required. The default will apply if neither "manual"
-// or "support" is specified.
-// Example:
-
-// ../tsrc/IHLValidation.mmp
-
--- a/imagehandlinglib/Rom/Ihl.iby Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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: IBY file for Image Handling Library
-*
-*/
-
-
-#ifndef IMAGEHANDLINGLIBRARY_IBY
-#define IMAGEHANDLINGLIBRARY_IBY
-
-file=ABI_DIR\BUILD_DIR\Ihl.dll SHARED_LIB_DIR\Ihl.dll
-
-#endif // IMAGEHANDLINGLIBRARY_IBY
-
-// End of File
--- a/imagehandlinglib/Src/CIHLBitmap.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,371 +0,0 @@
-/*
-* 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: Default implementation of bitmap class.
-*
-*/
-
-
-// INCLUDE FILES
-#include "CIHLBitmap.h"
-#include <fbs.h>
-
-// ======================== STATIC FACTORY FUNCTIONS ===========================
-// -----------------------------------------------------------------------------
-// IHLBitmap::CreateL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLBitmap* IHLBitmap::CreateL()
- {
- return CIHLBitmap::NewL();
- }
-
-// ============================ MEMBER FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-CIHLBitmap::CIHLBitmap()
- {
- }
-
-// -----------------------------------------------------------------------------
-//
-// Second phase constructors. Can leave.
-// -----------------------------------------------------------------------------
-void CIHLBitmap::ConstructL()
- {
- iBitmap = new (ELeave) CFbsBitmap;
- iMask = new (ELeave) CFbsBitmap;
- }
-
-// -----------------------------------------------------------------------------
-//
-// Two-phased constructors.
-// -----------------------------------------------------------------------------
-CIHLBitmap* CIHLBitmap::NewL()
- {
- CIHLBitmap* self = new( ELeave ) CIHLBitmap;
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop(); // self
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-CIHLBitmap::~CIHLBitmap()
- {
- delete iBitmap;
- delete iMask;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Create
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::Create( const TSize& aSize, TDisplayMode aDisplayMode )
- {
- Reset();
- return iBitmap->Create( aSize, aDisplayMode );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Create
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::Create( const TSize& aSize, TDisplayMode aBitmapDisplayMode,
- TDisplayMode aMaskDisplayMode )
- {
- Reset();
- TInt err( KErrArgument );
- if( aMaskDisplayMode == EGray2 || aMaskDisplayMode == EGray256 )
- {
- err = iBitmap->Create( aSize, aBitmapDisplayMode );
- if( err )
- {
- return err;
- }
- err = iMask->Create( aSize, aMaskDisplayMode );
- if( err )
- {
- iBitmap->Reset();
- }
- }
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Copy
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::Copy( const CFbsBitmap& aBitmap, TBool aDuplicate )
- {
- Reset();
- TInt err( KErrNone );
- TInt bitmapHandle( aBitmap.Handle() );
- if( bitmapHandle )
- {
- if( aDuplicate )
- {
- err = iBitmap->Duplicate( bitmapHandle );
- }
- else
- {
- err = CopyBitmap( aBitmap, *iBitmap );
- }
- }
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Copy
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::Copy( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask, TBool aDuplicate )
- {
- Reset();
- TInt bitmapHandle( aBitmap.Handle() );
- TInt maskHandle( aMask.Handle() );
- if( bitmapHandle && maskHandle &&
- aBitmap.SizeInPixels() != aMask.SizeInPixels() )
- {
- return KErrArgument;
- }
-
- if( maskHandle )
- {
- switch( aMask.DisplayMode() )
- {
- case EGray2:
- case EGray256:
- {
- break;
- }
- default:
- {
- return KErrArgument;
- }
- }
- }
-
- TInt err( KErrNone );
- if( bitmapHandle )
- {
- if( aDuplicate )
- {
- err = iBitmap->Duplicate( bitmapHandle );
- }
- else
- {
- err = CopyBitmap( aBitmap, *iBitmap );
- }
- }
-
- if( !err && maskHandle )
- {
- if( aDuplicate )
- {
- err = iMask->Duplicate( maskHandle );
- }
- else
- {
- err = CopyBitmap( aMask, *iMask );
- }
- if( err )
- {
- iBitmap->Reset();
- }
- }
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Copy
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::Copy( const MIHLBitmap& aBitmap, TBool aDuplicate )
- {
- return Copy( aBitmap.Bitmap(), aBitmap.Mask(), aDuplicate );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Reset
-// -----------------------------------------------------------------------------
-void CIHLBitmap::Reset()
- {
- iBitmap->Reset();
- iMask->Reset();
- iEditorPtr = NULL;
- iEditorValue = 0;
- }
-
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::IsCreated
-// -----------------------------------------------------------------------------
-TBool CIHLBitmap::IsCreated() const
- {
- return ( iBitmap->Handle() != 0 );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Bitmap
-// -----------------------------------------------------------------------------
-const CFbsBitmap& CIHLBitmap::Bitmap() const
- {
- return *iBitmap;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::HasMask
-// -----------------------------------------------------------------------------
-TBool CIHLBitmap::HasMask() const
- {
- return ( iMask->Handle() != 0 );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Mask
-// -----------------------------------------------------------------------------
-const CFbsBitmap& CIHLBitmap::Mask() const
- {
- return *iMask;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Draw
-// -----------------------------------------------------------------------------
-void CIHLBitmap::Draw( CBitmapContext& aContext, const TPoint& aPoint ) const
- {
- if( iBitmap->Handle() )
- {
- if( iMask->Handle() )
- {
- aContext.BitBltMasked( aPoint, iBitmap, iBitmap->SizeInPixels(), iMask, EFalse );
- }
- else
- {
- aContext.BitBlt( aPoint, iBitmap, iBitmap->SizeInPixels() );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::Draw
-// -----------------------------------------------------------------------------
-void CIHLBitmap::Draw( CBitmapContext& aContext, const TPoint& aPoint,
- const TRect& aSourceRect ) const
- {
- if( iBitmap->Handle() )
- {
- if( iMask->Handle() )
- {
- aContext.BitBltMasked( aPoint, iBitmap, aSourceRect, iMask, EFalse );
- }
- else
- {
- aContext.BitBlt( aPoint, iBitmap, aSourceRect );
- }
- }
- }
-
-// Internal interface
-// -----------------------------------------------------------------------------
-// CIHLBitmap::SetFilename
-// -----------------------------------------------------------------------------
-CFbsBitmap& CIHLBitmap::BitmapModifyable()
- {
- return *iBitmap;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::SetFilename
-// -----------------------------------------------------------------------------
-CFbsBitmap& CIHLBitmap::MaskModifyable()
- {
- return *iMask;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::SetEditorPtr
-// -----------------------------------------------------------------------------
-void CIHLBitmap::SetEditorPtr( const TAny* aEditorPtr )
- {
- iEditorPtr = aEditorPtr;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::SetEditorValue
-// -----------------------------------------------------------------------------
-void CIHLBitmap::SetEditorValue( TInt aEditorValue )
- {
- iEditorValue = aEditorValue;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::EditorPtr
-// -----------------------------------------------------------------------------
-const TAny* CIHLBitmap::EditorPtr() const
- {
- return iEditorPtr;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::FrameIndex
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::EditorValue() const
- {
- return iEditorValue;
- }
-
-// Private methods
-// -----------------------------------------------------------------------------
-// CIHLBitmap::CopyBitmap
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::CopyBitmap( const CFbsBitmap& aSource, CFbsBitmap& aDestination )
- {
- TSize size( aSource.SizeInPixels() );
- TDisplayMode displayMode( aSource.DisplayMode() );
- TInt err( aDestination.Create( size, displayMode ) );
- if( !err )
- {
- err = CopyBitmapData( aSource, aDestination, size, displayMode );
- if( err )
- {
- aDestination.Reset();
- }
- }
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmap::CopyBitmapData
-// -----------------------------------------------------------------------------
-TInt CIHLBitmap::CopyBitmapData( const CFbsBitmap& aSource, CFbsBitmap& aDestination,
- const TSize& aSize, const TDisplayMode& aDisplayMode )
- {
- HBufC8* scanLine = HBufC8::New( aSource.ScanLineLength( aSize.iWidth, aDisplayMode ) );
- if( scanLine )
- {
- TPtr8 scanPtr( scanLine->Des() );
- TPoint pp;
- for( pp.iY = 0; pp.iY < aSize.iHeight; ++pp.iY )
- {
- aSource.GetScanLine( scanPtr, pp, aSize.iWidth, aDisplayMode );
- aDestination.SetScanLine( scanPtr, pp.iY );
- }
-
- delete scanLine;
- return KErrNone;
- }
- return KErrNoMemory; // scanLine alloc failed
- }
-
-// End of File
--- a/imagehandlinglib/Src/CIHLBitmap.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
-* 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: Default implementation of bitmap class.
-*
-*/
-
-
-#ifndef CIHLBITMAP_H
-#define CIHLBITMAP_H
-
-// INCLUDES
-#include <MIHLBitmap.h>
-#include <e32base.h>
-
-// CLASS DECLARATION
-/**
-* CIHLBitmap
-*
-* Default implementation of bitmap class.
-* @lib IHL.lib
-* @since 3.0
-*/
-NONSHARABLE_CLASS( CIHLBitmap ) : public CBase, public MIHLBitmap
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructors
- */
- static CIHLBitmap* NewL();
-
- /**
- * Virtual destructor.
- */
- virtual ~CIHLBitmap();
-
- public: // From base class MIHLBitmap
-
- /**
- * From MIHLBitmap, see base class header.
- */
- TInt Create( const TSize& aSize, TDisplayMode aDisplayMode );
-
- /**
- * From MIHLBitmap, see base class header.
- */
- TInt Create( const TSize& aSize, TDisplayMode aBitmapDisplayMode,
- TDisplayMode aMaskDisplayMode );
-
- /**
- * From MIHLBitmap, see base class header.
- */
- TInt Copy( const CFbsBitmap& aBitmap, TBool aDuplicate );
-
- /**
- * From MIHLBitmap, see base class header.
- */
- TInt Copy( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask, TBool aDuplicate );
-
- /**
- * From MIHLBitmap, see base class header.
- */
- TInt Copy( const MIHLBitmap& aBitmap, TBool aDuplicate );
-
- /**
- * From MIHLBitmap, see base class header.
- */
- void Reset();
-
- /**
- * From MIHLBitmap, see base class header.
- */
- TBool IsCreated() const;
-
- /**
- * From MIHLBitmap, see base class header.
- */
- const CFbsBitmap& Bitmap() const;
-
- /**
- * From MIHLBitmap, see base class header.
- */
- TBool HasMask() const;
-
- /**
- * From MIHLBitmap, see base class header.
- */
- const CFbsBitmap& Mask() const;
-
- /**
- * From MIHLBitmap, see base class header.
- */
- void Draw( CBitmapContext& aContext, const TPoint& aPoint ) const;
-
- /**
- * From MIHLBitmap, see base class header.
- */
- void Draw( CBitmapContext& aContext, const TPoint& aPoint, const TRect& aSourceRect ) const;
-
- public: // Internal interface
-
- /**
- * Non-const bitmap reference.
- * @since 3.0
- * @return Non-const bitmap reference.
- */
- CFbsBitmap& BitmapModifyable();
-
- /**
- * Non-const bitmap reference.
- * @since 3.0
- * @return Non-const bitmap reference.
- */
- CFbsBitmap& MaskModifyable();
-
- /**
- * Set editor pointer. This information is used
- * internally to detect what class has made changes to bitmap data.
- * @since 3.0
- * @param aEditorPtr Editor pointer
- */
- void SetEditorPtr( const TAny* aEditorPtr );
-
- /**
- * Set editor value. Meaning of this value may vary depending
- * on type of editor class.
- * @since 3.0
- * @param aEditorValue Editor custom value
- */
- void SetEditorValue( TInt aEditorValue );
-
- /**
- * Return Editor pointer. NULL if just created or reseted.
- * @return Editor pointer.
- */
- const TAny* EditorPtr() const;
-
- /**
- * Return editor value.
- * @since 3.0
- * @return Editor custom value.
- */
- TInt EditorValue() const;
-
- public: // Private methods
-
- TInt CopyBitmap( const CFbsBitmap& aSource, CFbsBitmap& aDestination );
-
- TInt CopyBitmapData( const CFbsBitmap& aSource, CFbsBitmap& aDestination,
- const TSize& aSize, const TDisplayMode& aDisplayMode );
-
- private: // Private constructors
-
- CIHLBitmap();
- void ConstructL();
-
- private: // Data
-
- // Own: Bitmap pointers
- CFbsBitmap* iBitmap;
- CFbsBitmap* iMask;
-
- // Ref: Editor ptr
- const TAny* iEditorPtr;
-
- // Editor value
- TInt iEditorValue;
-
- };
-
-#endif // CIHLBITMAP_H
-
-// End of File
--- a/imagehandlinglib/Src/CIHLBitmapProcessor.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,293 +0,0 @@
-/*
-* 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 scaling processor
-* : using MIHLBitmap type bitmaps.
-*
-*/
-
-
-
-// INCLUDE FILES
-#include "CIHLBitmapProcessor.h"
-
-#include "CIHLScaler.h"
-#include "CIHLBitmap.h"
-#include "IHLImplementationIds.h"
-#include "IHLDebugPrint.h" // Debug print
-
-#include <IHLInterfaceIds.h>
-#include <fbs.h> // CFbsBitmap
-#include <bitdev.h> // CFbsBitmapDevice, CFbsBitGc
-
-// Private namespace for constants and functions
-namespace
- {
- // Panic function
- _LIT( KIHLPanicString, "IHLBitmapProcessor" );
- void Panic( TInt aPanicCode ) { User::Panic( KIHLPanicString, aPanicCode ); }
- }
-
-// ============================ MEMBER FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-//
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-CIHLBitmapProcessor::CIHLBitmapProcessor()
-:CActive( CActive::EPriorityStandard )
- {
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-//
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-CIHLBitmapProcessor* CIHLBitmapProcessor::NewL( const TUint32 aOptions )
- {
- CIHLBitmapProcessor* self = new( ELeave ) CIHLBitmapProcessor();
- CleanupStack::PushL( self );
- self->ConstructL( aOptions );
- CleanupStack::Pop(); // self
- return self;
- }
-
-// -----------------------------------------------------------------------------
-//
-// Symbian constructor can leave.
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::ConstructL( const TUint32 aOptions )
- {
- iScaler = CIHLScaler::NewL( aOptions );
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-CIHLBitmapProcessor::~CIHLBitmapProcessor()
- {
- Cancel();
- delete iScaler;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::Type
-// -----------------------------------------------------------------------------
-TIHLInterfaceType CIHLBitmapProcessor::Type() const
- {
- return TIHLInterfaceType( KIHLInterfaceIdBitmapProcessor, KIHLImplementationIdBitmapProcessor );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::Process
-// -----------------------------------------------------------------------------
-TInt CIHLBitmapProcessor::Process( TRequestStatus& aStatus,
- const MIHLBitmap& aSrcBitmap,
- const TRect& aSrcRect,
- MIHLBitmap& aDstBitmap,
- const TRect& aDstRect )
- {
- if( IsBusy() )
- {
- return KErrNotReady;
- }
-
- // Check bitmaps (no checking of masks is needed)
- const CFbsBitmap& srcBitmap = aSrcBitmap.Bitmap();
- const CFbsBitmap& dstBitmap = aDstBitmap.Bitmap();
- if( !srcBitmap.Handle() ||
- !iScaler->IsValidRect( srcBitmap.SizeInPixels(), aSrcRect ) ||
- !dstBitmap.Handle() ||
- !iScaler->IsValidRect( dstBitmap.SizeInPixels(), aDstRect ) )
- {
- return KErrArgument;
- }
-
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLBitmapProcessor - Start asynchronous bitmap processing" );
-
- // Set references to member data
- iSrcBitmap = &aSrcBitmap;
- iSrcRect = aSrcRect;
- iDstBitmap = static_cast<CIHLBitmap*>( &aDstBitmap ); //lint !e826
- iDstRect = aDstRect;
-
- // Start processing
- iProcessorStatus = &aStatus;
- *iProcessorStatus = KRequestPending;
-
- iProcessorState = EProcessBitmap;
- SelfComplete();
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::IsBusy
-// -----------------------------------------------------------------------------
-TBool CIHLBitmapProcessor::IsBusy() const
- {
- return ( iProcessorState != EInactive );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::CancelProcess
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::CancelProcess()
- {
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLBitmapProcessor - Process cancelled" );
-
- Cancel();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::SetFilter
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::SetFilter( MIHFilter* /*aFilter*/ )
- {
- // Not in use
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::DoCancel
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::DoCancel()
- {
- iScaler->CancelProcess();
- iProcessorState = EInactive;
- RequestComplete( KErrCancel );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::RunL
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::RunL()
- {
- User::LeaveIfError( iStatus.Int() );
-
- switch( iProcessorState )
- {
- case EProcessBitmap:
- {
- ProcessBitmapL();
- if( iDstBitmap->Mask().Handle() )
- {
- iProcessorState = EProcessMask;
- }
- else
- {
- // Destination has no mask -> finish process
- iProcessorState = EFinish;
- }
- break;
- }
- case EProcessMask:
- {
- ProcessMaskL();
- iProcessorState = EFinish;
- break;
- }
- case EFinish:
- {
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLBitmapProcessor - Process complete!" );
-
- iProcessorState = EInactive;
- RequestComplete( KErrNone );
- break;
- }
- default:
- {
- Panic( KErrTotalLossOfPrecision );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::RunError
-// -----------------------------------------------------------------------------
-TInt CIHLBitmapProcessor::RunError( TInt aError )
- {
- IHL_DEBUG2( KIHLDebug, "IHL - CIHLBitmapProcessor - Processing error: %d", aError );
-
- iProcessorState = EInactive;
- RequestComplete( aError );
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::ProcessBitmapL
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::ProcessBitmapL()
- {
- User::LeaveIfError( iScaler->Scale( iStatus,
- iSrcBitmap->Bitmap(),
- iSrcRect,
- iDstBitmap->BitmapModifyable(),
- iDstRect ) );
- SetActive();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::ProcessMaskL
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::ProcessMaskL()
- {
- if( iSrcBitmap->Mask().Handle() )
- {
- User::LeaveIfError( iScaler->Scale( iStatus,
- iSrcBitmap->Mask(),
- iSrcRect,
- iDstBitmap->MaskModifyable(),
- iDstRect ) );
- SetActive();
- }
- else
- {
- // No source bitmap where mask can be copied
- // -> clear destination mask at given rectangle
- CFbsBitGc* bitGc;
- CFbsBitmapDevice* bitDev = CFbsBitmapDevice::NewL(
- &(iDstBitmap->BitmapModifyable()) );
- CleanupStack::PushL( bitDev );
- User::LeaveIfError( bitDev->CreateContext( bitGc ) );
- CleanupStack::PushL( bitGc );
-
- bitGc->SetPenColor( KRgbWhite ); // white is non-transparent
- bitGc->SetBrushColor( KRgbWhite );
- bitGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
- bitGc->DrawRect( iDstRect );
-
- CleanupStack::PopAndDestroy( 2 ); // bitGc, bitDev
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::SelfComplete
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::SelfComplete()
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLBitmapProcessor::RequestComplete
-// -----------------------------------------------------------------------------
-void CIHLBitmapProcessor::RequestComplete( TInt aReason )
- {
- ASSERT( iProcessorStatus );
- User::RequestComplete( iProcessorStatus, aReason );
- }
-
-// End of File
--- a/imagehandlinglib/Src/CIHLBitmapProcessor.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
-* 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 scaling processor
-* : using MIHLBitmap type bitmaps.
-*
-*/
-
-
-#ifndef CIHLBITMAPPROCESSOR_H
-#define CIHLBITMAPPROCESSOR_H
-
-// INCLUDES
-#include <MIHLBitmapProcessor.h>
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-class CIHLScaler;
-class CIHLBitmap;
-
-// CLASS DECLARATION
-/**
-* CIHLBitmapProcessor
-*
-* Implementation of scaling processor
-* using MIHLBitmap type bitmaps.
-* @lib IHL.lib
-* @since 3.0
-*/
-NONSHARABLE_CLASS( CIHLBitmapProcessor ) : public CActive,
- public MIHLBitmapProcessor
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CIHLBitmapProcessor* NewL( const TUint32 aOptions = 0 );
-
- /*
- * Virtual destructor.
- */
- virtual ~CIHLBitmapProcessor();
-
- public: // From base class MIHLProcessor
-
- /*
- * From MIHLProcessor, see base class header.
- */
- TIHLInterfaceType Type() const;
-
- public: // From base class MIHLBitmapProcessor
-
- /*
- * From MIHLBitmapProcessor, see base class header.
- */
- TInt Process( TRequestStatus& aStatus,
- const MIHLBitmap& aSrcBitmap,
- const TRect& aSrcRect,
- MIHLBitmap& aDstBitmap,
- const TRect& aDstRect );
-
- /*
- * From MIHLBitmapProcessor, see base class header.
- */
- TBool IsBusy() const;
-
- /*
- * From MIHLBitmapProcessor, see base class header.
- */
- void CancelProcess();
-
- /*
- * From MIHLBitmapProcessor, see base class header.
- */
- void SetFilter( MIHFilter* aFilter );
-
- private: // From base class CActive
-
- /*
- * From CActive, see base class header.
- */
- void DoCancel();
-
- /*
- * From CActive, see base class header.
- */
- void RunL();
-
- /*
- * From CActive, see base class header.
- */
- TInt RunError( TInt aError );
-
-
- private: // Private methods
-
- /*
- * Process bitmap part of source image
- */
- void ProcessBitmapL();
-
- /*
- * Process mask part of source image
- */
- void ProcessMaskL();
-
- /*
- * Set this active object to completed state
- * -> one process step (RunL) will be executed.
- */
- void SelfComplete();
-
- /*
- * Set client request to completed state
- * -> process complete.
- * @param aReason Request complete reason
- */
- void RequestComplete( TInt aReason );
-
- private: // Private constructors
-
- CIHLBitmapProcessor();
- void ConstructL( const TUint32 aOptions );
-
- private: // Private data types
-
- enum TProcessorState
- {
- EInactive,
- EProcessBitmap,
- EProcessMask,
- EFinish,
- };
-
- private: // Data
-
- // Ref: Process status & state
- TRequestStatus* iProcessorStatus;
- TProcessorState iProcessorState;
-
- // Ref: Source bitmap & rect
- const MIHLBitmap* iSrcBitmap;
- TRect iSrcRect;
-
- // Ref: Destination bitmap & rect
- CIHLBitmap* iDstBitmap;
- TRect iDstRect;
-
- // Own: Scaler
- CIHLScaler* iScaler;
-
- };
-
-#endif // CIHLBITMAPPROCESSOR_H
-
-// End of File
--- a/imagehandlinglib/Src/CIHLFileImage.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,992 +0,0 @@
-/*
-* 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 Image class.
-*
-*/
-
-
-// INCLUDE FILES
-#include "CIHLFileImage.h"
-
-#include "CIHLBitmap.h"
-#include "IHLImplementationIds.h"
-#include "IHLDebugPrint.h" // Debug print
-#include <IHLInterfaceIds.h>
-
-// Private namespace for constants and functions
-namespace
- {
- // Fixed scale factors
- enum TScaleFactors
- {
- EFull = 1,
- EHalf = 2,
- EQuarter = 4,
- EEighth = 8,
- };
-
- // Panic function
- _LIT( KIHLPanicString, "IHLImage" );
- void Panic( TInt aPanicCode ) { User::Panic( KIHLPanicString, aPanicCode ); }
- }
-
-// ============================ MEMBER FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-//
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-CIHLFileImage::CIHLFileImage( TInt aImageIndex )
-:CActive( CActive::EPriorityStandard ),
-iImageIndex( aImageIndex )
- {
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-//
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-CIHLFileImage* CIHLFileImage::NewL( RFile& aFile, TInt aImageIndex, const TUint32 aOptions )
- {
- CIHLFileImage* self = new (ELeave) CIHLFileImage( aImageIndex );
- CleanupStack::PushL( self );
- self->ConstructL( aFile, aOptions );
- CleanupStack::Pop(); // self
- return self;
- }
-
-CIHLFileImage* CIHLFileImage::NewL( RFs& aFs, const TDesC8& aDataBuf,
- TInt aImageIndex, const TUint32 aOptions )
- {
- CIHLFileImage* self = new (ELeave) CIHLFileImage( aImageIndex );
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aDataBuf, aOptions );
- CleanupStack::Pop(); // self
- return self;
- }
-
-// -----------------------------------------------------------------------------
-//
-// Symbian constructor can leave.
-// -----------------------------------------------------------------------------
-void CIHLFileImage::ConstructL( RFile& aFile, const TUint32 aOptions )
- {
- TInt decoderOptions( CImageDecoder::EOptionNoDither | CImageDecoder::EOptionUseFrameSizeInPixels );
-
- // Open decoder
- IHL_DEBUG1( KIHLDebug1, "IHL - CIHLFileImage - Start create ICL image decoder" );
- if( aOptions & MIHLFileImage::EOptionNoDRMConsume )
- {
- iDecoder = CImageDecoder::FileNewL( aFile, ContentAccess::EPeek,
- (CImageDecoder::TOptions)decoderOptions );
- }
- else
- {
- iDecoder = CImageDecoder::FileNewL( aFile, ContentAccess::EView,
- (CImageDecoder::TOptions)decoderOptions );
- }
- ConstructCommonL();
- IHL_DEBUG1( KIHLDebug2, "IHL - CIHLFileImage - ICL image decoder ready!" );
- }
-
-void CIHLFileImage::ConstructL( RFs& aFs, const TDesC8& aDataBuf, const TUint32 /*aOptions*/ )
- {
- TInt decoderOptions( CImageDecoder::EOptionNoDither | CImageDecoder::EOptionUseFrameSizeInPixels );
-
- IHL_DEBUG1( KIHLDebug1, "IHL - CIHLFileImage - Start create buffered ICL image decoder" );
-
- iDecoder = CImageDecoder::DataNewL( aFs, aDataBuf, (CImageDecoder::TOptions)decoderOptions );
- ConstructCommonL();
-
- IHL_DEBUG1( KIHLDebug2, "IHL - CIHLFileImage - Buffered ICL image decoder ready!" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ConstructCommonL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImage::ConstructCommonL()
- {
- // Check frame count and image index
- iImageCount = iDecoder->FrameCount();
- __ASSERT_ALWAYS( iImageCount > 0, User::Leave( KErrCorrupt ) );
-
- // Get image types
- iDecoder->ImageType( iImageIndex, iImageType, iImageSubType );
-
- if( KImageTypeGIFUid == iImageType )
- {
- iGif = ETrue;
- if( iImageCount > 1 )
- {
- iAnimation = ETrue;
- iAnimationFrameCount = iImageCount;
- iImageCount = 1; // Handled as one animated image
- }
- }
- __ASSERT_ALWAYS( iImageIndex >= 0 && iImageIndex < iImageCount, User::Leave( KErrArgument ) );
-
- // cache frame info and set scale sizes
- iFrameInfo = iDecoder->FrameInfo( iImageIndex );
- if( !iAnimation )
- {
- // Animation must always be loaded 1:1
- if( !iGif &&
- iFrameInfo.iFlags & TFrameInfo::EFullyScaleable )
- {
- // Gif cannot be fully scaleable
- iFullyScaleable = ETrue;
- }
- else
- {
- TSize size( iFrameInfo.iOverallSizeInPixels );
- iLoadSizeArray.AppendL( ScaledLoadSize( size, EEighth ) );
- iLoadSizeArray.AppendL( ScaledLoadSize( size, EQuarter ) );
- iLoadSizeArray.AppendL( ScaledLoadSize( size, EHalf ) );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-CIHLFileImage::~CIHLFileImage()
- {
- Cancel();
- delete iPrevAnimationFrame;
- delete iSubFrameBitmap;
- delete iDecoder;
- iLoadSizeArray.Reset();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::Type
-// -----------------------------------------------------------------------------
-TIHLInterfaceType CIHLFileImage::Type() const
- {
- return TIHLInterfaceType( KIHLInterfaceIdFileImage,
- KIHLImplementationIdFileImage );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ImageType
-// -----------------------------------------------------------------------------
-const TUid& CIHLFileImage::ImageType() const
- {
- return iImageType;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ImageSubType
-// -----------------------------------------------------------------------------
-const TUid& CIHLFileImage::ImageSubType() const
- {
- return iImageSubType;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ImageIndex
-// -----------------------------------------------------------------------------
-TInt CIHLFileImage::ImageIndex() const
- {
- return iImageIndex;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ImageCount
-// -----------------------------------------------------------------------------
-TInt CIHLFileImage::ImageCount() const
- {
- return iImageCount;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::Size
-// -----------------------------------------------------------------------------
-TSize CIHLFileImage::Size() const
- {
- return iFrameInfo.iOverallSizeInPixels;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::DisplayMode
-// -----------------------------------------------------------------------------
-TDisplayMode CIHLFileImage::DisplayMode() const
- {
- if( iGif )
- {
- // We cannot trust iFrameDisplayMode for GIF images. It always return EColor256.
- // This is error because palette sure holds only 256 colors but these colors can
- // be still any RGB values and so for cannot be directly put to 8 bit bitmap (EColor256).
- // To decrypt image correctly and without color dithering, we must use 24 bit (EColor16M)
- // destination bitmap. Note that CFbsBitmap has palette methods but they are
- // not supported currently.
- // Return maximum color mode to ensure best image quality.
- return EColor16MU;
- }
- else if( iFrameInfo.iFrameDisplayMode < EColor16MU ||
- iFrameInfo.iFrameDisplayMode == EColor4K )
- {
- return EColor64K;
- }
- return EColor16MU;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::MaskDisplayMode
-// -----------------------------------------------------------------------------
-TDisplayMode CIHLFileImage::MaskDisplayMode() const
- {
- if( iFrameInfo.iFlags & TFrameInfo::ETransparencyPossible )
- {
- if( iFrameInfo.iFlags & TFrameInfo::EAlphaChannel )
- {
- return EGray256;
- }
- return EGray2;
- }
- return ENone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::BackgroundColor
-// -----------------------------------------------------------------------------
-TRgb CIHLFileImage::BackgroundColor() const
- {
- return iFrameInfo.iBackgroundColor;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::CustomLoadSizeArray
-// -----------------------------------------------------------------------------
-const RArray<TSize>& CIHLFileImage::CustomLoadSizeArray() const
- {
- return iLoadSizeArray;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::CustomLoadSizeArray
-// -----------------------------------------------------------------------------
-TBool CIHLFileImage::IsFullyScaleable() const
- {
- return iFullyScaleable;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::IsAnimation
-// -----------------------------------------------------------------------------
-TBool CIHLFileImage::IsAnimation() const
- {
- return iAnimation;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::AnimationFrameCount
-// -----------------------------------------------------------------------------
-TInt CIHLFileImage::AnimationFrameCount() const
- {
- return iAnimationFrameCount;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::AnimationFrameDelay
-// -----------------------------------------------------------------------------
-TTimeIntervalMicroSeconds32 CIHLFileImage::AnimationFrameDelay( TInt aAnimationFrameIndex ) const
- {
- __ASSERT_ALWAYS( aAnimationFrameIndex >= 0 &&
- aAnimationFrameIndex < iAnimationFrameCount, Panic( KErrArgument ) );
-
- return I64INT( iDecoder->FrameInfo( aAnimationFrameIndex ).iDelay.Int64() );
- }
-
-// ------------------------------------------------------------------------------
-// CIHLFileImage::Load
-// ------------------------------------------------------------------------------
-
-TInt CIHLFileImage::Load( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex )
- {
- iImageIndex = aFrameIndex;
- return LoadRequest( aStatus, aDestination, iImageIndex );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::LoadAnimation
-// -----------------------------------------------------------------------------
-TInt CIHLFileImage::LoadAnimation( TRequestStatus& aStatus, MIHLBitmap& aDestination,
- TInt aAnimationFrameIndex )
- {
- __ASSERT_ALWAYS( aAnimationFrameIndex >= 0 &&
- aAnimationFrameIndex < iAnimationFrameCount, Panic( KErrArgument ) );
-
- return LoadRequest( aStatus, aDestination, aAnimationFrameIndex );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::IsBusy
-// -----------------------------------------------------------------------------
-TBool CIHLFileImage::IsBusy() const
- {
- return ( iImageState != EInactive );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::CancelLoad
-// -----------------------------------------------------------------------------
-void CIHLFileImage::CancelLoad()
- {
- Cancel();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::SetFilter
-// -----------------------------------------------------------------------------
-void CIHLFileImage::SetFilter( MIHLFilter* /*aFilter*/ )
- {
- // Not in use
- }
-
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::Decoder
-// -----------------------------------------------------------------------------
-const CImageDecoder& CIHLFileImage::Decoder() const
- {
- return *iDecoder;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::DoCancel
-// -----------------------------------------------------------------------------
-void CIHLFileImage::DoCancel()
- {
- iDecoder->Cancel();
-
- // Delete all processed bitmaps
- ErrorCleanup();
-
- // Complete with cancel
- iImageState = EInactive;
- RequestComplete( KErrCancel );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::RunL
-// -----------------------------------------------------------------------------
-void CIHLFileImage::RunL()
- {
- __ASSERT_DEBUG( iDestination, Panic( KErrGeneral ) );
- User::LeaveIfError( iStatus.Int() );
-
- switch( iImageState )
- {
- case EStartLoad:
- {
- // start loading the bitmaps
- StartLoadL();
- break;
- }
- case ECompleteLoad:
- {
- // complete loading the bitmaps
- CompleteLoadL();
- break;
- }
- default:
- {
- Panic( KErrTotalLossOfPrecision );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::RunError
-// -----------------------------------------------------------------------------
-TInt CIHLFileImage::RunError( TInt aError )
- {
- IHL_DEBUG2( KIHLDebug, "IHL - CIHLFileImage - Loading error: %d", aError );
-
- // Delete all processed bitmaps
- ErrorCleanup();
-
- // Complete with error
- iImageState = EInactive;
- RequestComplete( aError );
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::LoadRequest
-// -----------------------------------------------------------------------------
-TInt CIHLFileImage::LoadRequest( TRequestStatus& aStatus,
- MIHLBitmap& aDestination,
- TInt aFrameIndex )
- {
- if( IsBusy() )
- {
- return KErrNotReady;
- }
-
- if( aFrameIndex < 0 || aFrameIndex >= iDecoder->FrameCount() )
- {
- return KErrArgument;
- }
-
- const CFbsBitmap& dstBitmap = aDestination.Bitmap();
- if( !dstBitmap.Handle() )
- {
- return KErrArgument;
- }
-
- TSize dstSize( dstBitmap.SizeInPixels() );
- if( dstSize != Size() &&
- !iFullyScaleable )
- {
- TBool sizeFound( EFalse );
- const TInt count( iLoadSizeArray.Count() );
- for( TInt i( 0 ); i < count; ++i )
- {
- if( dstSize == iLoadSizeArray[ i ] )
- {
- sizeFound = ETrue;
- }
- }
- if( !sizeFound )
- {
- return KErrArgument;
- }
- }
-
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLFileImage - Frame loading requested" );
-
- iImageStatus = &aStatus;
- *iImageStatus = KRequestPending;
-
- iDestination = static_cast<CIHLBitmap*>( &aDestination ); //lint !e826
- iFrameIndex = aFrameIndex;
-
- // Start the active object
- iImageState = EStartLoad;
- SelfComplete();
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::StartLoadL
-// -----------------------------------------------------------------------------
-void CIHLFileImage::StartLoadL()
- {
- __ASSERT_DEBUG( !iSubFrameBitmap, Panic( KErrGeneral ) );
-
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLFileImage - Start ICL convert" );
-
- if( iAnimation )
- {
- // Start animation from first frame by default
- iSubFrameIndex = 0;
-
- // Check is animation can be continued on top of destination bitmap
- if( iDestination->IsCreated() &&
- iDestination->EditorPtr() == this &&
- iDestination->EditorValue() < iFrameIndex )
- {
- // Editor value means frame index
- iSubFrameIndex = iDestination->EditorValue() + 1;
- }
-
- StartLoadSubFrameL( iSubFrameIndex, ETrue );
- }
- else if( iGif )
- {
- StartLoadSubFrameL( iFrameIndex, EFalse );
- }
- else
- {
- // Frame fills the whole image -> normal load
- StartLoadNormalFrame( iFrameIndex );
- }
-
- iImageState = ECompleteLoad;
- SetActive();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::StartLoadNormalFrame
-// -----------------------------------------------------------------------------
-void CIHLFileImage::StartLoadNormalFrame( TInt aFrameIndex )
- {
- CFbsBitmap& dstBitmap = iDestination->BitmapModifyable();
- CFbsBitmap& dstMask = iDestination->MaskModifyable();
-
- if( MaskDisplayMode() && dstMask.Handle() )
- {
- iDecoder->Convert( &iStatus, dstBitmap, dstMask, aFrameIndex );
- }
- else
- {
- dstMask.Reset();
- iDecoder->Convert( &iStatus, dstBitmap, aFrameIndex );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::StartLoadSubFrameL
-// -----------------------------------------------------------------------------
-void CIHLFileImage::StartLoadSubFrameL( TInt aFrameIndex, TBool aAnimation )
- {
- __ASSERT_DEBUG( !iSubFrameBitmap, Panic( KErrGeneral ) );
-
- // Create animation bitmap
- iSubFrameBitmap = CIHLBitmap::NewL();
- CFbsBitmap& subBitmap = iSubFrameBitmap->BitmapModifyable();
- CFbsBitmap& subMask = iSubFrameBitmap->MaskModifyable();
-
- TSize dstSize( iDestination->Bitmap().SizeInPixels() );
- TFrameInfo subFrameInfo( iDecoder->FrameInfo( aFrameIndex ) );
-
- // Check is client uses downscaling (not used in animations)
- TSize loadSize( subFrameInfo.iFrameSizeInPixels );
- iSubFrameScaleFactor = EFull;
- if( !aAnimation &&
- dstSize != iFrameInfo.iOverallSizeInPixels )
- {
- if( dstSize == ScaledLoadSize( iFrameInfo.iOverallSizeInPixels, EHalf ) )
- {
- iSubFrameScaleFactor = EHalf;
- loadSize = ScaledLoadSize( loadSize, EHalf );
- }
- else if( dstSize == ScaledLoadSize( iFrameInfo.iOverallSizeInPixels, EQuarter ) )
- {
- iSubFrameScaleFactor = EQuarter;
- loadSize = ScaledLoadSize( loadSize, EQuarter );
- }
- else if( dstSize == ScaledLoadSize( iFrameInfo.iOverallSizeInPixels, EEighth ) )
- {
- iSubFrameScaleFactor = EEighth;
- loadSize = ScaledLoadSize( loadSize, EEighth );
- }
- }
- User::LeaveIfError( subBitmap.Create( loadSize, EColor16M ) );
-
- if( subFrameInfo.iFlags & TFrameInfo::ETransparencyPossible )
- {
- User::LeaveIfError( subMask.Create( loadSize,
- subFrameInfo.iFlags & TFrameInfo::EAlphaChannel ? EGray256 : EGray2 ) );
- iDecoder->Convert( &iStatus, subBitmap, subMask, aFrameIndex );
- }
- else
- {
- iDecoder->Convert( &iStatus, subBitmap, aFrameIndex );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::CompleteLoadL
-// -----------------------------------------------------------------------------
-void CIHLFileImage::CompleteLoadL()
- {
- IHL_DEBUG1( KIHLDebug1, "IHL - CIHLFileImage - ICL convert complete!" );
-
- if( iSubFrameBitmap )
- {
- IHL_DEBUG1( KIHLDebug2, "IHL - CIHLFileImage - Start build animation frame" );
-
- // Copy animation bitmap to destination
- BuildSubFrameL();
- delete iSubFrameBitmap;
- iSubFrameBitmap = NULL;
-
- IHL_DEBUG1( KIHLDebug3, "IHL - CIHLFileImage - Animation frame complete!" );
-
- // Save source info destination
- iDestination->SetEditorPtr( this );
- iDestination->SetEditorValue( iSubFrameIndex );
-
- if( iSubFrameIndex < iFrameIndex )
- {
- // re-start the active object and load next subframe
- iSubFrameIndex++;
- iImageState = EStartLoad;
- SelfComplete();
- }
- else
- {
- // Animation/subframe image ready
- iDestination = NULL;
- iImageState = EInactive;
- RequestComplete( KErrNone );
- }
- }
- else
- {
- // Save source info destination
- iDestination->SetEditorPtr( this );
- iDestination->SetEditorValue( iFrameIndex );
-
- // Normal image ready
- iDestination = NULL;
- iImageState = EInactive;
- RequestComplete( KErrNone );
- }
-
- IHL_DEBUG1( KIHLDebug4, "IHL - CIHLFileImage - Frame loading request complete!" );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::BuildSubFrameL
-// -----------------------------------------------------------------------------
-void CIHLFileImage::BuildSubFrameL()
- {
- __ASSERT_DEBUG( iSubFrameBitmap, Panic( KErrGeneral ) );
- const CFbsBitmap& subBitmap = iSubFrameBitmap->Bitmap();
- const CFbsBitmap& subMask = iSubFrameBitmap->Mask();
- __ASSERT_DEBUG( subBitmap.Handle(), Panic( KErrGeneral ) );
-
- if( !iAnimation ||
- ( iAnimation && iSubFrameIndex == 0 ) )
- {
- TFrameInfo frameInfo( iDecoder->FrameInfo( iSubFrameIndex ) );
- if( iDestination->Bitmap().SizeInPixels() == subBitmap.SizeInPixels() &&
- frameInfo.iFrameCoordsInPixels.iTl == TPoint(0,0) )
- {
- // Sub frame is same size as destination image and has no offset
- // -> put directly into destination
- User::LeaveIfError( iDestination->Copy( subBitmap, subMask, ETrue ) );
- }
- else
- {
- // Sub frame size differs from destination image size
- CFbsBitmap& desBitmap = iDestination->BitmapModifyable();
- CFbsBitmap& desMask = iDestination->MaskModifyable();
-
- // Other frames must be build on top of previous frames
- __ASSERT_DEBUG( desBitmap.Handle(), Panic( KErrGeneral ) );
-
- // Fill destination using background color
- FillL( desBitmap, frameInfo.iBackgroundColor );
-
- // Copy loaded frame on top of background
- CFbsBitGc* bitGc;
- CFbsBitmapDevice* bitDevice = CFbsBitmapDevice::NewL( &desBitmap );
- CleanupStack::PushL( bitDevice );
- User::LeaveIfError( bitDevice->CreateContext( bitGc ) );
- CleanupStack::PushL( bitGc );
-
- TPoint framePos( ScaledFramePosition(
- frameInfo.iFrameCoordsInPixels.iTl, iSubFrameScaleFactor ) );
- if( subMask.Handle() )
- {
- bitGc->BitBltMasked( framePos, &subBitmap,
- subBitmap.SizeInPixels(), &subMask, EFalse );
- }
- else
- {
- bitGc->BitBlt( framePos, &subBitmap, subBitmap.SizeInPixels() );
- }
- CleanupStack::PopAndDestroy( 2, bitDevice ); // bitGc, bitDevice
-
- if( desMask.Handle() )
- {
- // Fill mask to transparent
- FillL( desMask, KRgbBlack );
-
- // Fill bg mask with transparency (=black)
- CFbsBitmapDevice* maskDev = CFbsBitmapDevice::NewL( &desMask );
- CleanupStack::PushL( maskDev );
- CFbsBitGc* maskGc;
- User::LeaveIfError( maskDev->CreateContext( maskGc ) );
- CleanupStack::PushL( maskGc );
-
- // Combine bg mask with first frame mask
- maskGc->BitBlt( framePos, &subMask, subMask.SizeInPixels() );
-
- CleanupStack::PopAndDestroy( 2, maskDev ); // maskGc, maskDev
- }
- }
-
- // Create "previous frame" if animation
- if( iAnimation )
- {
- if( !iPrevAnimationFrame )
- {
- iPrevAnimationFrame = CIHLBitmap::NewL();
- }
- CFbsBitmap& desBitmap = iDestination->BitmapModifyable();
- CFbsBitmap& desMask = iDestination->MaskModifyable();
- if( iSubFrameBitmap->HasMask() )
- {
- User::LeaveIfError(
- iPrevAnimationFrame->Create( desBitmap.SizeInPixels(),
- desBitmap.DisplayMode(), desMask.DisplayMode() ) );
- FillL( iPrevAnimationFrame->BitmapModifyable(), frameInfo.iBackgroundColor );
- FillL( iPrevAnimationFrame->MaskModifyable(), KRgbBlack );
- }
- else
- {
- User::LeaveIfError(
- iPrevAnimationFrame->Create( desBitmap.SizeInPixels(),
- desBitmap.DisplayMode() ) );
- FillL( iPrevAnimationFrame->BitmapModifyable(), frameInfo.iBackgroundColor );
- }
- }
- }
- else // same as iAnimation && iSubFrameIndex > 0
- {
- TFrameInfo prevFrameInfo( iDecoder->FrameInfo( iSubFrameIndex - 1 ) );
- if ( prevFrameInfo.iFlags & TFrameInfo::ERestoreToPrevious )
- {
- // Restore destination to "previous frame"
- User::LeaveIfError( iDestination->Copy( *iPrevAnimationFrame, EFalse ) );
- }
-
- CFbsBitmap& prevBitmap = iDestination->BitmapModifyable();
- CFbsBitmap& prevMask = iDestination->MaskModifyable();
-
- // Other frames must be build on top of previous frames
- __ASSERT_DEBUG( prevBitmap.Handle(), Panic( KErrGeneral ) );
-
- // Restore area in destination bitmap if needed
- TRect restoreRect;
- TBool restoreToBackground( EFalse );
- if( prevFrameInfo.iFlags & TFrameInfo::ERestoreToBackground )
- {
- restoreToBackground = ETrue;
- restoreRect = prevFrameInfo.iFrameCoordsInPixels;
- FillRectL( prevBitmap, restoreRect, prevFrameInfo.iBackgroundColor );
-
- // Cache new "previous frame"
- User::LeaveIfError( iPrevAnimationFrame->Copy( *iDestination, EFalse ) );
- }
- else if( prevFrameInfo.iFlags & TFrameInfo::ELeaveInPlace )
- {
- // Cache new "previous frame"
- User::LeaveIfError( iPrevAnimationFrame->Copy( *iDestination, EFalse ) );
- }
-
- // Copy animation frame to destination bitmap
- TFrameInfo frameInfo( iDecoder->FrameInfo( iSubFrameIndex ) );
- CFbsBitGc* bitGc;
- CFbsBitmapDevice* bitDevice = CFbsBitmapDevice::NewL( &prevBitmap );
- CleanupStack::PushL( bitDevice );
- User::LeaveIfError( bitDevice->CreateContext( bitGc ) );
- CleanupStack::PushL( bitGc );
- if( subMask.Handle() )
- {
- bitGc->BitBltMasked( frameInfo.iFrameCoordsInPixels.iTl, &subBitmap,
- subBitmap.SizeInPixels(), &subMask, EFalse );
- }
- else
- {
- bitGc->BitBlt( frameInfo.iFrameCoordsInPixels.iTl, &subBitmap,
- subBitmap.SizeInPixels() );
- }
- CleanupStack::PopAndDestroy( 2 ); // bitGc, bitDevice
-
- // Combine masks if any
- if( prevMask.Handle() && subMask.Handle() )
- {
- //////////////////////////////////////////////////////////////////////////
- // ALTERNATIVE WAY TO COMBINE MASKS!
- // Current solution doesn't combine soft masks.
- // Following code could be used if soft masks are enabled in animations.
- // Do not delete!
- //////////////////////////////////////////////////////////////////////////
- /*
- if( restoreToBackground )
- {
- bitDevice = CFbsBitmapDevice::NewL( &prevMask );
- CleanupStack::PushL( bitDevice );
- User::LeaveIfError( bitDevice->CreateContext( bitGc ) );
- CleanupStack::PushL( bitGc );
-
- bitGc->SetBrushColor( KRgbBlack );
- bitGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
- bitGc->DrawRect( restoreRect );
- bitGc->SetBrushStyle( CGraphicsContext::ENullBrush );
-
- CleanupStack::PopAndDestroy( 2 ); // bitDevice, bitGc
- }
-
- prevMask.LockHeap();
-
- TUint8* srcAddress = reinterpret_cast<TUint8*>( animMask.DataAddress() );
- TSize srcSize( animMask.SizeInPixels() );
- TPoint srcPos( 0,0 );
- TInt srcScanLen8 = CFbsBitmap::ScanLineLength( srcSize.iWidth, EGray256 );
-
- TUint8* dstAddress = reinterpret_cast<TUint8*>( prevMask.DataAddress() );
- TSize dstSize( prevMask.SizeInPixels() );
- TPoint dstPos( frameInfo.iFrameCoordsInPixels.iTl );
- TPoint dstEndPos( frameInfo.iFrameCoordsInPixels.iBr );
- TInt dstScanLen8 = CFbsBitmap::ScanLineLength( dstSize.iWidth, EGray256 );
-
- while( dstPos.iY < dstEndPos.iY )
- {
- TUint8* srcAddressCur = srcAddress + ( srcPos.iY * srcScanLen8 );
- TUint8* dstAddressCur = dstAddress + ( dstPos.iY * dstScanLen8 );
- while( dstPos.iX < dstEndPos.iX )
- {
- TUint8& srcPixel = srcAddressCur[ srcPos.iX++ ];
- TUint8& dstPixel = dstAddressCur[ dstPos.iX++ ];
- if( srcPixel > dstPixel )
- {
- dstPixel = srcPixel;
- }
- }
-
- srcPos.iX = 0;
- srcPos.iY++;
- dstPos.iX = frameInfo.iFrameCoordsInPixels.iTl.iX;
- dstPos.iY++;
- }
-
- animMask.UnlockHeap();
- */
-
- if( restoreToBackground )
- {
- FillRectL( prevMask, restoreRect, KRgbBlack );
- }
-
- bitDevice = CFbsBitmapDevice::NewL( &prevMask );
- CleanupStack::PushL( bitDevice );
- User::LeaveIfError( bitDevice->CreateContext( bitGc ) );
- CleanupStack::PushL( bitGc );
-
- CFbsBitmap* tmpMask = new(ELeave) CFbsBitmap;
- CleanupStack::PushL( tmpMask );
- User::LeaveIfError( tmpMask->Create( prevMask.SizeInPixels(), prevMask.DisplayMode() ) );
- CFbsBitmapDevice* tmpMaskDev = CFbsBitmapDevice::NewL( tmpMask );
- CleanupStack::PushL( tmpMaskDev );
- CFbsBitGc* tmpMaskGc;
- User::LeaveIfError( tmpMaskDev->CreateContext( tmpMaskGc ) );
- CleanupStack::PushL( tmpMaskGc );
-
- tmpMaskGc->BitBlt( TPoint( 0, 0 ), &prevMask, frameInfo.iFrameCoordsInPixels );
-
- bitGc->BitBltMasked( frameInfo.iFrameCoordsInPixels.iTl, &subMask,
- subMask.SizeInPixels(), tmpMask, ETrue );
-
- CleanupStack::PopAndDestroy( 5 ); // tmpMaskGc,tmpMaskDev,tmpMask,bitGc,bitDevice
- }
- else
- {
- prevMask.Reset(); // Mask not valid anymore -> reset
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::FillL
-// -----------------------------------------------------------------------------
-void CIHLFileImage::FillL( CFbsBitmap& aBitmap, const TRgb& aColor )
- {
- CFbsBitGc* bitGc;
- CFbsBitmapDevice* bitDevice = CFbsBitmapDevice::NewL( &aBitmap );
- CleanupStack::PushL( bitDevice );
- User::LeaveIfError( bitDevice->CreateContext( bitGc ) );
- CleanupStack::PushL( bitGc );
-
- bitGc->SetBrushColor( aColor );
- bitGc->SetPenColor( aColor );
- bitGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
- bitGc->Clear();
- bitGc->SetBrushStyle( CGraphicsContext::ENullBrush );
-
- CleanupStack::PopAndDestroy( 2 ); // bitGc, bitDevice
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::FillRectL
-// -----------------------------------------------------------------------------
-void CIHLFileImage::FillRectL( CFbsBitmap& aBitmap, const TRect& aRect,
- const TRgb& aColor )
- {
- CFbsBitGc* bitGc;
- CFbsBitmapDevice* bitDevice = CFbsBitmapDevice::NewL( &aBitmap );
- CleanupStack::PushL( bitDevice );
- User::LeaveIfError( bitDevice->CreateContext( bitGc ) );
- CleanupStack::PushL( bitGc );
-
- bitGc->SetBrushColor( aColor );
- bitGc->SetPenColor( aColor );
- bitGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
- bitGc->DrawRect( aRect );
- bitGc->SetBrushStyle( CGraphicsContext::ENullBrush );
-
- CleanupStack::PopAndDestroy( 2 ); // bitGc, bitDevice
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ErrorCleanup
-// -----------------------------------------------------------------------------
-void CIHLFileImage::ErrorCleanup()
- {
- if( iSubFrameBitmap )
- {
- delete iSubFrameBitmap;
- iSubFrameBitmap = NULL;
- }
-
- if( iDestination )
- {
- iDestination = NULL;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::SelfComplete
-// -----------------------------------------------------------------------------
-void CIHLFileImage::SelfComplete()
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::RequestComplete
-// -----------------------------------------------------------------------------
-void CIHLFileImage::RequestComplete( TInt aReason )
- {
- ASSERT( iImageStatus );
- User::RequestComplete( iImageStatus, aReason );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ScaledLoadSize
-// -----------------------------------------------------------------------------
-TSize CIHLFileImage::ScaledLoadSize( const TSize& aOriginalSize, TInt aScaleFactor )
- {
- // Divide original size with scalefactor
- // Round always up if result is not integer
- return ( aScaleFactor == EFull ) ? aOriginalSize :
- TSize( aOriginalSize.iWidth / aScaleFactor + ( aOriginalSize.iWidth % aScaleFactor ? 1 : 0 ),
- aOriginalSize.iHeight / aScaleFactor + ( aOriginalSize.iHeight % aScaleFactor ? 1 : 0 ) );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImage::ScaledLoadSize
-// -----------------------------------------------------------------------------
-TPoint CIHLFileImage::ScaledFramePosition( const TPoint& aOriginalPos, TInt aScaleFactor )
- {
- // Divide original position with scalefactor
- // Round always up if result is not integer
- return ( aScaleFactor == EFull ) ? aOriginalPos :
- TPoint( aOriginalPos.iX / aScaleFactor + ( aOriginalPos.iX % aScaleFactor ? 1 : 0 ),
- aOriginalPos.iY / aScaleFactor + ( aOriginalPos.iY % aScaleFactor ? 1 : 0 ) );
- }
-// End of File
--- a/imagehandlinglib/Src/CIHLFileImage.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,314 +0,0 @@
-/*
-* 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 ImageFile class.
-*
-*/
-
-
-#ifndef CIHLFILEIMAGE_H
-#define CIHLFILEIMAGE_H
-
-// INCLUDES
-#include <MIHLFileImage.h>
-#include <e32base.h>
-#include <imageconversion.h> // TFrameInfo
-#include <gdi.h> // TDisplayMode
-#include <TIHLInterfaceType.h>
-
-// FORWARD DECLARATIONS
-class MIHLBitmap;
-class CIHLBitmap;
-class CImageDecoder;
-class TRequestStatus;
-
-// CLASS DECLARATION
-/**
-* CIHLImage
-*
-* Implementation of file based image class.
-* @lib IHL.lib
-* @since 3.0
-*/
-NONSHARABLE_CLASS( CIHLFileImage ) : public CActive, public MIHLFileImage
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CIHLFileImage* NewL( RFile& aFile, TInt aImageIndex, const TUint32 aOptions );
- static CIHLFileImage* NewL( RFs& aFs, const TDesC8& aDataBuf,
- TInt aImageIndex, const TUint32 aOptions );
-
- /*
- * Virtual destructor.
- */
- virtual ~CIHLFileImage();
-
- public: // From base class MIHLImage
-
- /*
- * From MIHLImage, see base class header.
- */
- TIHLInterfaceType Type() const;
-
- public: // From base class MIHLFileImage
-
- /*
- * From MIHLFileImage, see base class header.
- */
- const TUid& ImageType() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- const TUid& ImageSubType() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt ImageIndex() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt ImageCount() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TSize Size() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TDisplayMode DisplayMode() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TDisplayMode MaskDisplayMode() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TRgb BackgroundColor() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- const RArray<TSize>& CustomLoadSizeArray() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TBool IsFullyScaleable() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TBool IsAnimation() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt AnimationFrameCount() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TTimeIntervalMicroSeconds32 AnimationFrameDelay( TInt aAnimationFrameIndex ) const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt Load( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex = 0 );
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt LoadAnimation( TRequestStatus& aStatus, MIHLBitmap& aDestination,
- TInt aAnimationFrameIndex );
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TBool IsBusy() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- void CancelLoad();
-
- /*
- * From MIHLFileImage, see base class header.
- */
- void SetFilter( MIHLFilter* aFilter );
-
- private: // From base class CActive
-
- /*
- * From CActive, see base class header.
- */
- void DoCancel();
-
- /*
- * From CActive, see base class header.
- */
- void RunL();
-
- /*
- * From CActive, see base class header.
- */
- TInt RunError( TInt aError );
-
- public: // Internal interface
-
- /**
- * Return reference to used CImageDecoder instance.
- * For internal use.
- * @since 3.0
- * @return Reference to used CImageDecoder instance.
- */
- const CImageDecoder& Decoder() const;
-
- private: // Private methods
-
- /*
- * Request load and start ActiveScheduler.
- * Called from Load() and LoadAnimation() methods.
- */
- TInt LoadRequest( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex );
-
- /*
- * Start loading from file. Checks if image is still or animation.
- * Called by ActiveSheduler when state is EStartLoad.
- */
- void StartLoadL();
-
- /*
- * Start loading normal frame. Called by StartLoadL() method.
- */
- void StartLoadNormalFrame( TInt aFrameIndex );
-
- /*
- * Start loading sub frame. Called by StartLoadL() method.
- */
- void StartLoadSubFrameL( TInt aFrameIndex, TBool aAnimation );
-
- /*
- * Loading complete. Build possible animation and notify client.
- * Called by ActiveSheduler when state is ECompleteLoad.
- */
- void CompleteLoadL();
-
- /*
- * Build sub frame. Called by CompleteLoadL() method.
- */
- void BuildSubFrameL();
-
- /*
- * Fill whole bitmap using given color.
- * Used by BuildAnimationFrameL().
- */
- void FillL( CFbsBitmap& aBitmap, const TRgb& aColor );
-
- /*
- * Fill bitmap rect using given color.
- * Used by BuildAnimationFrameL().
- */
- void FillRectL( CFbsBitmap& aBitmap, const TRect& aRect, const TRgb& aColor );
-
- /*
- * Error cleanup. Called if error occurs during load.
- */
- void ErrorCleanup();
-
- /*
- * Complete dummy request. This causes RunL() method to be called.
- * Needed by state machine.
- */
- void SelfComplete();
-
- /*
- * Complete client load request.
- * This causes client RunL() method to be called.
- */
- void RequestComplete( TInt aReason );
-
- /*
- * Calculate scaled size.
- * Original size is divided by scale factor and result is rounded up
- * to next integer.
- */
- TSize ScaledLoadSize( const TSize& aOriginalSize, TInt aScaleFactor );
-
- /*
- * Calculate scaled frame position.
- * Original position is divided by scale factor and result is rounded up
- * to next integer.
- */
- TPoint ScaledFramePosition( const TPoint& aOriginalPos, TInt aScaleFactor );
-
- private: // Private constructors
-
- CIHLFileImage( TInt aImageIndex );
- void ConstructL( RFile& aFile, const TUint32 aOptions );
- void ConstructL( RFs& aFs, const TDesC8& aDataBuf, const TUint32 aOptions );
- void ConstructCommonL();
-
- private: // Private data types
-
- enum TImageState
- {
- EInactive,
- EStartLoad,
- ECompleteLoad,
- };
-
- private: // Data
-
- // Ref: Image status & state
- TRequestStatus* iImageStatus;
- TImageState iImageState;
-
- // Own: Image decoder
- CImageDecoder* iDecoder;
-
- // Image information
- TUid iImageType;
- TUid iImageSubType;
- TInt iImageIndex;
- TInt iImageCount;
- RArray<TSize> iLoadSizeArray;
- TBool iFullyScaleable;
- TFrameInfo iFrameInfo;
- TBool iGif;
- TBool iAnimation;
- TInt iAnimationFrameCount;
-
- // Ref: Destination bitmap
- CIHLBitmap* iDestination;
- TInt iFrameIndex;
-
- // Own: Temporary animation bitmap
- CIHLBitmap* iSubFrameBitmap;
- TInt iSubFrameIndex;
- CIHLBitmap* iPrevAnimationFrame;
- TInt iSubFrameScaleFactor;
- };
-
-#endif // CIHLFILEIMAGE_H
-
-// End of File
--- a/imagehandlinglib/Src/CIHLFileImageExtJpg.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,610 +0,0 @@
-/*
-* 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: Implementation of FileImageExtJpg class.
-*
-*/
-
-
-// INCLUDE FILES
-#include "CIHLFileImageExtJpg.h"
-
-#include "CIHLBitmap.h"
-#include "IHLImplementationIds.h"
-#include <IHLInterfaceIds.h>
-#include <IclExtJpegApi.h>
-
-// Private namespace for constants and functions
-namespace
- {
- // Fixed scale factors
- enum TScaleFactors
- {
- EHalf = 2,
- EQuarter = 4,
- EEighth = 8,
- };
-
- // Panic function
- _LIT( KIHLExtJpgPanic, "IHLImageExtJpg" );
- void Panic( TInt aPanicCode ) { User::Panic( KIHLExtJpgPanic, aPanicCode ); }
- }
-
-// ============================ MEMBER FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-//
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-CIHLFileImageExtJpg::CIHLFileImageExtJpg( TInt aImageIndex )
-:CActive( CActive::EPriorityStandard ),
-iImageIndex( aImageIndex )
- {
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-//
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-
-CIHLFileImageExtJpg* CIHLFileImageExtJpg::NewL( RFs& aFs, const TDesC8& aDataBuf,
- TInt aImageIndex, const TUint32 aOptions )
- {
- CIHLFileImageExtJpg* self = new (ELeave) CIHLFileImageExtJpg( aImageIndex );
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aDataBuf, aOptions );
- CleanupStack::Pop(); // self
- return self;
- }
-
-CIHLFileImageExtJpg* CIHLFileImageExtJpg::NewL( RFs& aFs, const TDesC& aFilename,
- TInt aImageIndex, const TUint32 aOptions )
- {
- CIHLFileImageExtJpg* self = new (ELeave) CIHLFileImageExtJpg( aImageIndex );
- CleanupStack::PushL( self );
- self->ConstructL( aFs, aFilename, aOptions );
- CleanupStack::Pop(); // self
- return self;
- }
-
-// -----------------------------------------------------------------------------
-//
-// Symbian constructor can leave.
-// -----------------------------------------------------------------------------
-
-
-void CIHLFileImageExtJpg::ConstructL( RFs& aFs, const TDesC& aFilename, const TUint32 /*aOptions*/ )
- {
- TRAPD( err, iDecoder = CExtJpegDecoder::FileNewL( CExtJpegDecoder::EHwImplementation, aFs, aFilename ) );
-
- if ( err != KErrNone )
- {
- iDecoder = CExtJpegDecoder::FileNewL( CExtJpegDecoder::ESwImplementation, aFs, aFilename );
- }
-
- ConstructCommonL();
- }
-
-void CIHLFileImageExtJpg::ConstructL( RFs& aFs, const TDesC8& aDataBuf, const TUint32 /*aOptions*/ )
- {
- TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( CExtJpegDecoder::EHwImplementation, aFs, aDataBuf ) );
-
- if ( err != KErrNone )
- {
- iDecoder = CExtJpegDecoder::DataNewL( CExtJpegDecoder::ESwImplementation, aFs, aDataBuf );
- }
-
- ConstructCommonL();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ConstructCommonL
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::ConstructCommonL()
- {
- // Check frame count and image index
- iImageCount = iDecoder->FrameCount();
- __ASSERT_ALWAYS( iImageCount > 0, User::Leave( KErrCorrupt ) );
-
- // Get image types
- iDecoder->ImageType( iImageIndex, iImageType, iImageSubType );
-
- __ASSERT_ALWAYS( iImageIndex >= 0 && iImageIndex < iImageCount, User::Leave( KErrArgument ) );
-
- // cache frame info and set scale sizes
- iFrameInfo = iDecoder->FrameInfo( iImageIndex );
- if( iFrameInfo.iFlags & TFrameInfo::EFullyScaleable )
- {
- iFullyScaleable = ETrue;
- }
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-CIHLFileImageExtJpg::~CIHLFileImageExtJpg()
- {
- Cancel();
- delete iDecoder;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::Type
-// -----------------------------------------------------------------------------
-TIHLInterfaceType CIHLFileImageExtJpg::Type() const
- {
- return TIHLInterfaceType( KIHLInterfaceIdFileImage,
- KIHLImplementationIdFileImageExtJpg );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ImageType
-// -----------------------------------------------------------------------------
-const TUid& CIHLFileImageExtJpg::ImageType() const
- {
- return iImageType;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ImageSubType
-// -----------------------------------------------------------------------------
-const TUid& CIHLFileImageExtJpg::ImageSubType() const
- {
- return iImageSubType;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ImageIndex
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::ImageIndex() const
- {
- return iImageIndex;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ImageCount
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::ImageCount() const
- {
- return iImageCount;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::Size
-// -----------------------------------------------------------------------------
-TSize CIHLFileImageExtJpg::Size() const
- {
- return iFrameInfo.iOverallSizeInPixels;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::DisplayMode
-// -----------------------------------------------------------------------------
-TDisplayMode CIHLFileImageExtJpg::DisplayMode() const
- {
- TDisplayMode displayMode( iFrameInfo.iFrameDisplayMode );
- if( iFrameInfo.iFrameDisplayMode <= EGray256 )
- {
- displayMode = EGray256;
- }
- else if( iFrameInfo.iFrameDisplayMode <= EColor256 )
- {
- displayMode = EColor256;
- }
-
- return displayMode;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::MaskDisplayMode
-// -----------------------------------------------------------------------------
-TDisplayMode CIHLFileImageExtJpg::MaskDisplayMode() const
- {
- if( iFrameInfo.iFlags & TFrameInfo::ETransparencyPossible )
- {
- if( iFrameInfo.iFlags & TFrameInfo::EAlphaChannel )
- {
- return EGray256;
- }
- return EGray2;
- }
- return ENone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::BackgroundColor
-// -----------------------------------------------------------------------------
-TRgb CIHLFileImageExtJpg::BackgroundColor() const
- {
- return iFrameInfo.iBackgroundColor;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::CustomLoadSizeArray
-// -----------------------------------------------------------------------------
-const RArray<TSize>& CIHLFileImageExtJpg::CustomLoadSizeArray() const
- {
- return iLoadSizeArray;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::IsFullyScaleable
-// -----------------------------------------------------------------------------
-TBool CIHLFileImageExtJpg::IsFullyScaleable() const
- {
- return iFullyScaleable;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::IsAnimation
-// -----------------------------------------------------------------------------
-TBool CIHLFileImageExtJpg::IsAnimation() const
- {
- return iAnimation;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::AnimationFrameCount
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::AnimationFrameCount() const
- {
- return iAnimationFrameCount;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::AnimationFrameDelay
-// -----------------------------------------------------------------------------
-TTimeIntervalMicroSeconds32 CIHLFileImageExtJpg::AnimationFrameDelay( TInt aAnimationFrameIndex ) const
- {
- //Animation is not supported
- ( void ) aAnimationFrameIndex;
- Panic( KErrNotSupported );
- return 0;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::Load
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::Load( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex )
- {
- iImageIndex = aFrameIndex;
- return LoadRequest( aStatus, aDestination, iImageIndex );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::Load
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::Load( TRect aSrcRect, TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex )
- {
- TRAPD( err, SetCroppingL( aSrcRect ) );
- if( err )
- {
- return err;
- }
- iImageIndex = aFrameIndex;
- return LoadRequest( aStatus, aDestination, iImageIndex );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::LoadAnimation
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::LoadAnimation( TRequestStatus& aStatus, MIHLBitmap& aDestination,
- TInt aAnimationFrameIndex )
- {
- //Animation is not supported
- ( void ) aStatus;
- ( void ) aDestination;
- ( void ) aAnimationFrameIndex;
- Panic( KErrNotSupported );
- return 0;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::IsBusy
-// -----------------------------------------------------------------------------
-TBool CIHLFileImageExtJpg::IsBusy() const
- {
- return ( iImageState != EInactive );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::CancelLoad
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::CancelLoad()
- {
- Cancel();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SetFilter
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::SetFilter( MIHLFilter* /*aFilter*/ )
- {
- // Not in use
- }
-
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::Decoder
-// -----------------------------------------------------------------------------
-const CExtJpegDecoder& CIHLFileImageExtJpg::Decoder() const
- {
- return *iDecoder;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::DoCancel
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::DoCancel()
- {
- iDecoder->Cancel();
-
- // Delete all processed bitmaps
- ErrorCleanup();
-
- // Complete with cancel
- iImageState = EInactive;
- RequestComplete( KErrCancel );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::RunL
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::RunL()
- {
- __ASSERT_DEBUG( iDestination, Panic( KErrGeneral ) );
- User::LeaveIfError( iStatus.Int() );
-
- switch( iImageState )
- {
- case EStartLoad:
- {
- // start loading the bitmaps
- StartLoadL();
- break;
- }
- case ECompleteLoad:
- {
- // complete loading the bitmaps
- CompleteLoadL();
- break;
- }
- default:
- {
- Panic( KErrTotalLossOfPrecision );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::RunError
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::RunError( TInt aError )
- {
- // Delete all processed bitmaps
- ErrorCleanup();
-
- // Complete with error
- iImageState = EInactive;
- RequestComplete( aError );
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::LoadRequest
-// -----------------------------------------------------------------------------
-TInt CIHLFileImageExtJpg::LoadRequest( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex )
- {
- if( IsBusy() )
- {
- return KErrNotReady;
- }
-
- if( aFrameIndex < 0 || aFrameIndex >= iDecoder->FrameCount() )
- {
- return KErrArgument;
- }
-
- const CFbsBitmap& dstBitmap = aDestination.Bitmap();
- if( !dstBitmap.Handle() )
- {
- return KErrArgument;
- }
-
- iImageStatus = &aStatus;
- *iImageStatus = KRequestPending;
-
- iDestination = static_cast<CIHLBitmap*>( &aDestination ); //lint !e826
- iFrameIndex = aFrameIndex;
-
- // Start the active object
- iImageState = EStartLoad;
- SelfComplete();
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::StartLoadL
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::StartLoadL()
- {
- CFbsBitmap& dstBitmap = iDestination->BitmapModifyable();
- CFbsBitmap& dstMask = iDestination->MaskModifyable();
-
- if( MaskDisplayMode() && dstMask.Handle() )
- {
- iDecoder->Convert( &iStatus, dstBitmap, dstMask, iFrameIndex );
- }
- else
- {
- dstMask.Reset();
- iDecoder->Convert( &iStatus, dstBitmap, iFrameIndex );
- }
- iImageState = ECompleteLoad;
- SetActive();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::CompleteLoadL
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::CompleteLoadL()
- {
- // Save source info destination
- iDestination->SetEditorPtr( this );
- iDestination->SetEditorValue( iFrameIndex );
-
- // Normal image ready
- iDestination = NULL;
- iImageState = EInactive;
- RequestComplete( KErrNone );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ErrorCleanup
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::ErrorCleanup()
- {
- if( iDestination )
- {
- iDestination = NULL;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SelfComplete
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::SelfComplete()
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::RequestComplete
-// -----------------------------------------------------------------------------
-void CIHLFileImageExtJpg::RequestComplete( TInt aReason )
- {
- ASSERT( iImageStatus );
- User::RequestComplete( iImageStatus, aReason );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SetCroppingL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::SetCroppingL( TRect aCropRect )
- {
- iDecoder->SetCroppingL( aCropRect );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SetStreamingL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::SetStreamingL( TSize& aMacroBlockSize )
- {
- iDecoder->SetStreamingL( aMacroBlockSize );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SetRotationL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::SetRotationL( TInt aDegree )
- {
- iDecoder->SetRotationL( aDegree );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SetFlippingL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::SetFlippingL()
- {
- iDecoder->SetFlippingL();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SetMirroringL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::SetMirroringL()
- {
- iDecoder->SetMirroringL();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SetDctDecodingL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::SetDctDecodingL()
- {
- iDecoder->SetDctDecodingL();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ConvertL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::ConvertL(
- TRequestStatus* aRequestStatus,
- const CVisualFrame* aDestinationFrame,
- TInt& aNoOfDecodedMBlocks,
- TInt aFrameNumber )
- {
- iDecoder->ConvertL(
- aRequestStatus,
- aDestinationFrame,
- aNoOfDecodedMBlocks,
- aFrameNumber );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::ContinueConvertL
-// -----------------------------------------------------------------------------
-
-void CIHLFileImageExtJpg::ContinueConvertL(
- TRequestStatus* aRequestStatus,
- const CVisualFrame* aDestinationFrame,
- TInt& aNoOfDecodedMBlocks,
- TInt aFrameNumber )
- {
- iDecoder->ContinueConvertL(
- aRequestStatus,
- aDestinationFrame,
- aNoOfDecodedMBlocks,
- aFrameNumber );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::SupportedFormatsL
-// -----------------------------------------------------------------------------
-
-TInt CIHLFileImageExtJpg::SupportedFormatsL()
- {
- return iDecoder->SupportedFormatsL();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLFileImageExtJpg::CapabilitiesL
-// -----------------------------------------------------------------------------
-
-TInt CIHLFileImageExtJpg::CapabilitiesL()
- {
- return iDecoder->CapabilitiesL();
- }
-
-//End of file
--- a/imagehandlinglib/Src/CIHLFileImageExtJpg.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,330 +0,0 @@
-/*
-* 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: Implementation of ImageFile class.
-*
-*/
-
-
-#ifndef CIHLFILEIMAGEEXTJPG_H
-#define CIHLFILEIMAGEEXTJPG_H
-
-// INCLUDES
-#include <e32base.h>
-#include <imageconversion.h> // TFrameInfo
-#include <gdi.h> // TDisplayMode
-#include "MIHLFileImageExtJpg.h"
-
-// FORWARD DECLARATIONS
-class MIHLBitmap;
-class CIHLBitmap;
-class CExtJpegDecoder;
-class CVisualFrame;
-
-// CLASS DECLARATION
-/**
-* CIHLFileImageExtJpg
-*
-* Implementation of file based ext jpg image class.
-* @lib IHL.lib
-* @since 3.0
-*/
-
-NONSHARABLE_CLASS( CIHLFileImageExtJpg ) : public CActive, public MIHLFileImageExtJpg
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CIHLFileImageExtJpg* NewL( RFs& aFs, const TDesC8& aDataBuf,
- TInt aImageIndex, const TUint32 aOptions );
- static CIHLFileImageExtJpg* NewL( RFs& aFs, const TDesC& aFilename,
- TInt aImageIndex, const TUint32 aOptions );
- /*
- * Virtual destructor.
- */
- virtual ~CIHLFileImageExtJpg();
-
- public: // From base class MIHLImage
-
- TIHLInterfaceType Type() const;
-
- public: // From base class MIHLFileImage
-
- /*
- * From MIHLFileImage, see base class header.
- */
- const TUid& ImageType() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- const TUid& ImageSubType() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt ImageIndex() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt ImageCount() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TSize Size() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TDisplayMode DisplayMode() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TDisplayMode MaskDisplayMode() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TRgb BackgroundColor() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- const RArray<TSize>& CustomLoadSizeArray() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TBool IsFullyScaleable() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TBool IsAnimation() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt AnimationFrameCount() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TTimeIntervalMicroSeconds32 AnimationFrameDelay( TInt aAnimationFrameIndex ) const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt Load( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex = 0 );
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TInt LoadAnimation( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aAnimationFrameIndex );
-
- /*
- * From MIHLFileImage, see base class header.
- */
- TBool IsBusy() const;
-
- /*
- * From MIHLFileImage, see base class header.
- */
- void CancelLoad();
-
- /*
- * From MIHLFileImage, see base class header.
- */
- void SetFilter( MIHLFilter* aFilter );
-
- public: // From MIHLFileImageExtJpg
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- TInt Load( TRect aSrcRect, TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex = 0 );
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void SetCroppingL( TRect aCropRect );
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void SetStreamingL( TSize& aMacroBlockSize );
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void SetRotationL( TInt aDegree );
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void SetFlippingL();
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void SetMirroringL();
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void SetDctDecodingL();
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void ConvertL(
- TRequestStatus* aRequestStatus,
- const CVisualFrame* aDestinationFrame,
- TInt& aNoOfDecodedMBlocks,
- TInt aFrameNumber = 0 );
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- void ContinueConvertL(
- TRequestStatus* aRequestStatus,
- const CVisualFrame* aDestinationFrame,
- TInt& aNoOfDecodedMBlocks,
- TInt aFrameNumber = 0 );
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- TInt SupportedFormatsL();
-
- /*
- * From MIHLFileImageExtJpg, see base class header.
- */
- TInt CapabilitiesL();
-
- private: // From base class CActive
-
- /*
- * From CActive, see base class header.
- */
- void DoCancel();
-
- /*
- * From CActive, see base class header.
- */
- void RunL();
-
- /*
- * From CActive, see base class header.
- */
- TInt RunError( TInt aError );
-
- public: // Internal interface
-
- /**
- * Return reference to used CExtJpegDecoder instance.
- * For internal use.
- * @since 3.0
- * @return Reference to used CExtJpegDecoder instance.
- */
- const CExtJpegDecoder& Decoder() const;
-
- private: // Private methods
-
- /*
- * Request load and start ActiveScheduler.
- * Called from Load() and LoadAnimation() methods.
- */
- TInt LoadRequest( TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex );
-
- /*
- * Start loading from file. Checks if image is still or animation.
- * Called by ActiveSheduler when state is EStartLoad.
- */
- void StartLoadL();
-
- /*
- * Loading complete. Build possible animation and notify client.
- * Called by ActiveSheduler when state is ECompleteLoad.
- */
- void CompleteLoadL();
-
- /*
- * Error cleanup. Called if error occurs during load.
- */
- void ErrorCleanup();
-
- /*
- * Complete dummy request. This causes RunL() method to be called.
- * Needed by state machine.
- */
- void SelfComplete();
-
- /*
- * Complete client load request.
- * This causes client RunL() method to be called.
- */
- void RequestComplete( TInt aReason );
-
- private: // Private constructors
-
- CIHLFileImageExtJpg( TInt aImageIndex );
-
- void ConstructL( RFs& aFs, const TDesC& aFilename, const TUint32 aOptions );
- void ConstructL( RFs& aFs, const TDesC8& aDataBuf, const TUint32 aOptions );
- void ConstructCommonL();
-
- private: // Private data types
-
- enum TImageState
- {
- EInactive,
- EStartLoad,
- ECompleteLoad,
- };
-
- private: // Data
-
- // Ref: Image status & state
- TRequestStatus* iImageStatus;
- TImageState iImageState;
-
- // Own: Image decoder
- CExtJpegDecoder* iDecoder;
-
- // Image information
- TUid iImageType;
- TUid iImageSubType;
- TInt iImageIndex;
- TInt iImageCount;
-
- TBool iFullyScaleable;
- TFrameInfo iFrameInfo;
- TBool iAnimation;
- TInt iAnimationFrameCount;
-
- // Ref: Destination bitmap
- CIHLBitmap* iDestination;
- TInt iFrameIndex;
-
- RArray<TSize> iLoadSizeArray;
- };
-
-#endif // CIHLFILEIMAGEEXTJPG_H
-
-// End of File
--- a/imagehandlinglib/Src/CIHLImageViewer.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1369 +0,0 @@
-/*
-* 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 Image Viewer class.
-*
-*/
-
-
-// INCLUDE FILES
-#include "CIHLImageViewer.h"
-
-#include "CIHLBitmap.h"
-#include "CIHLBitmapProcessor.h"
-#include "IHLImplementationIds.h"
-#include "IHLDebugPrint.h" // Debug print
-#include <IHLInterfaceIds.h>
-#include <MIHLViewerObserver.h>
-#include <MIHLFileImage.h>
-#include <fbs.h>
-#include <e32math.h>
-
-// Private namespace for constants and functions
-namespace
- {
- // Panic function
- _LIT( KIHLPanicString, "IHLImageViewer" );
- void Panic( TInt aPanicCode ) { User::Panic( KIHLPanicString, aPanicCode ); }
- }
-
-// ============================ MEMBER FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-//
-// C++ constructor can NOT contain any code, that might leave.
-// -----------------------------------------------------------------------------
-CIHLImageViewer::CIHLImageViewer( const TSize& aViewerSize,
- MIHLFileImage& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions )
-:CTimer( EPriorityNormal ), iObserver( aObserver ),
-iSource( aSource ), iDestination( aDestination ),
-iOptions( aOptions ), iViewerSize( aViewerSize ), iSrcBitmapScaleFactor(1)
- {
- CActiveScheduler::Add( this );
- iAnimDelay = 0;
- iAnimLastFrameDrawTime = 0;
- iAnimDrawStartFastTime = 0;
- }
-
-// -----------------------------------------------------------------------------
-//
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-CIHLImageViewer* CIHLImageViewer::NewL( const TSize& aViewerSize,
- MIHLFileImage& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions )
- {
- CIHLImageViewer* self = new( ELeave ) CIHLImageViewer(
- aViewerSize, aSource, aDestination, aObserver, aOptions );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop(); // self
- return self;
- }
-
-// -----------------------------------------------------------------------------
-//
-// Symbian constructor can leave.
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::ConstructL()
- {
- CTimer::ConstructL();
-
- HAL::Get(HALData::EFastCounterFrequency, iTickPeriod);
-
- iCacheSource = CIHLBitmap::NewL();
- iCacheDestination = CIHLBitmap::NewL();
- iProcessor = CIHLBitmapProcessor::NewL( iOptions );
-
- // Initialize settings and start load (default is zoom to fit)
- iSourceSize = iSource.Size();
- CalculateZoomToFitRatio();
- User::LeaveIfError( SetZoomRatio( iZoomToFitRatio ) );
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-CIHLImageViewer::~CIHLImageViewer()
- {
- Cancel();
- delete iProcessor;
- delete iCacheDestination;
- delete iCacheSource;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::Id
-// -----------------------------------------------------------------------------
-TIHLInterfaceType CIHLImageViewer::Type() const
- {
- return TIHLInterfaceType( KIHLInterfaceIdImageViewer, KIHLImplementationIdImageViewer );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::IsAnimation
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewer::IsAnimation() const
- {
- return iSource.IsAnimation();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SheduleNextFrame
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::SheduleNextFrame(TTimeIntervalMicroSeconds32 aDelay)
- {
- TInt delay=aDelay.Int();
-
- if (delay == 0) // 0 second deleay set in GIF file
- {
- iAnimDelay = TTimeIntervalMicroSeconds32(100000-iAnimLastFrameDrawTime);
- }
- else
- {
- iAnimDelay = delay - iAnimLastFrameDrawTime;
- }
-
- if (iAnimDelay.Int() <=0) //last frame drawn longer than animation frame interval.
- {
- iAnimDelay = KMinimumInterval;
- }
- iAnimInitFastTime=User::FastCounter(); //store the start time
- HighRes(iAnimDelay);
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::Play
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::Play()
- {
- if( iSource.IsAnimation() )
- {
- iIsPlaying = ETrue;
- if( iViewerState == EInactive)
- {
- iViewerState = EAnimation;
- SheduleNextFrame( iSource.AnimationFrameDelay( iAnimationIndex ) );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::Stop
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::Stop()
- {
- iIsPlaying = EFalse;
- if( iViewerState == EAnimation )
- {
- Cancel();
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::IsPlaying
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewer::IsPlaying() const
- {
- return iIsPlaying;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::AnimationFrameCount
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::AnimationFrameCount() const
- {
- return iSource.AnimationFrameCount();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::AnimationFrame
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::AnimationFrame() const
- {
- return iAnimationIndex;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetAnimationFrame
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SetAnimationFrame( TInt aFrameIndex )
- {
- // Public API, boundary check -> panic also on hardware
- __ASSERT_ALWAYS( aFrameIndex >= 0 &&
- aFrameIndex < iSource.AnimationFrameCount(), Panic( KErrArgument ) );
-
- // Save new index and clear old source cache to force load new frame
- iAnimationIndex = aFrameIndex;
- iCacheSource->Reset();
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetViewerSize
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SetViewerSize( const TSize& aViewerSize, int aSrcBitmapScaleFactor )
- {
- // Public API, negative value check -> panic also on hardware
- __ASSERT_ALWAYS( aViewerSize.iWidth >= 0 &&
- aViewerSize.iHeight >= 0, Panic( KErrArgument ) );
-
- iSrcBitmapScaleFactor = aSrcBitmapScaleFactor;
-
- // Save new viewer size
- iViewerSize = aViewerSize;
-
- // Recalculate source rect and destination size
- CalculateSourceRectAndDestinationSize();
-
- // Recalculate zoom to fit ratio
- CalculateZoomToFitRatio();
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::ViewerSize
-// -----------------------------------------------------------------------------
-TSize CIHLImageViewer::ViewerSize() const
- {
- return iViewerSize;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::MoveSourceRect
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::MoveSourceRect( TInt aDx, TInt aDy )
- {
- TInt dx( aDx );
- TInt dy( aDy );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- dx = aDy;
- dy = -aDx;
- break;
- }
- case ERotationAngle180:
- {
- dx = -aDx;
- dy = -aDy;
- break;
- }
- case ERotationAngle270:
- {
- dx = -aDy;
- dy = aDx;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
- if( iHorizontalMirroring )
- {
- dx = -dx;
- }
- if( iVerticalMirroring )
- {
- dy = -dy;
- }
-
- if( iSourceRect.iTl.iX + dx < 0 ||
- iSourceRect.iBr.iX + dx > iSourceSize.iWidth ||
- iSourceRect.iTl.iY + dy < 0 ||
- iSourceRect.iBr.iY + dy > iSourceSize.iHeight )
- {
- return KErrArgument;
- }
-
- iSourceRect.Move( dx, dy );
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetSourceRectPosition
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SetSourceRectPosition( const TPoint& aPosition )
- {
- TPoint newPosition( aPosition );
- TSize sourceRectSize( iSourceRect.Size() );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- newPosition.iX = aPosition.iY;
- newPosition.iY = iSourceSize.iHeight - sourceRectSize.iHeight - aPosition.iX;
- break;
- }
- case ERotationAngle180:
- {
- newPosition.iX = iSourceSize.iWidth - sourceRectSize.iWidth - aPosition.iX;
- newPosition.iY = iSourceSize.iHeight - sourceRectSize.iHeight - aPosition.iY;
- break;
- }
- case ERotationAngle270:
- {
- newPosition.iX = iSourceSize.iWidth - sourceRectSize.iWidth - aPosition.iY;
- newPosition.iY = aPosition.iX;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
- if( iHorizontalMirroring )
- {
- newPosition.iX = iSourceSize.iWidth - sourceRectSize.iWidth - newPosition.iX;
- }
- if( iVerticalMirroring )
- {
- newPosition.iY = iSourceSize.iHeight - sourceRectSize.iHeight - newPosition.iY;
- }
-
- if( newPosition.iX < 0 ||
- newPosition.iX > ( iSourceSize.iWidth - sourceRectSize.iWidth ) ||
- newPosition.iY < 0 ||
- newPosition.iY > ( iSourceSize.iHeight - sourceRectSize.iHeight ) )
- {
- return KErrArgument;
- }
-
- iSourceRect = TRect( newPosition, sourceRectSize );
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SourceRect
-// -----------------------------------------------------------------------------
-TRect CIHLImageViewer::SourceRect() const
- {
- TRect mirroredSourceRect( iSourceRect );
- if( iHorizontalMirroring )
- {
- mirroredSourceRect.iTl.iX = iSourceSize.iWidth - iSourceRect.iBr.iX;
- mirroredSourceRect.iBr.iX = iSourceSize.iWidth - iSourceRect.iTl.iX;
- }
- if( iVerticalMirroring )
- {
- mirroredSourceRect.iTl.iY = iSourceSize.iHeight - iSourceRect.iBr.iY;
- mirroredSourceRect.iBr.iY = iSourceSize.iHeight - iSourceRect.iTl.iY;
- }
-
- TRect rotatedSourceRect( mirroredSourceRect );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- rotatedSourceRect.iTl.iX = iSourceSize.iHeight - mirroredSourceRect.iBr.iY;
- rotatedSourceRect.iTl.iY = mirroredSourceRect.iTl.iX;
- rotatedSourceRect.iBr.iX = iSourceSize.iHeight - mirroredSourceRect.iTl.iY;
- rotatedSourceRect.iBr.iY = mirroredSourceRect.iBr.iX;
- break;
- }
- case ERotationAngle180:
- {
- rotatedSourceRect.iTl.iX = iSourceSize.iWidth - mirroredSourceRect.iBr.iX;
- rotatedSourceRect.iTl.iY = iSourceSize.iHeight - mirroredSourceRect.iBr.iY;
- rotatedSourceRect.iBr.iX = iSourceSize.iWidth - mirroredSourceRect.iTl.iX;
- rotatedSourceRect.iBr.iY = iSourceSize.iHeight - mirroredSourceRect.iTl.iY;
- break;
- }
- case ERotationAngle270:
- {
- rotatedSourceRect.iTl.iX = mirroredSourceRect.iTl.iY;
- rotatedSourceRect.iTl.iY = iSourceSize.iWidth - mirroredSourceRect.iBr.iX;
- rotatedSourceRect.iBr.iX = mirroredSourceRect.iBr.iY;
- rotatedSourceRect.iBr.iY = iSourceSize.iWidth - mirroredSourceRect.iTl.iX;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
-
- return rotatedSourceRect;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SourceSize
-// -----------------------------------------------------------------------------
-TSize CIHLImageViewer::SourceSize() const
- {
- if( iRotationAngle == ERotationAngle90 ||
- iRotationAngle == ERotationAngle270 )
- {
- return TSize( iSourceSize.iHeight, iSourceSize.iWidth );
- }
- else
- {
- return iSourceSize;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetZoomRatio
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SetZoomRatio( TReal aZoomRatio )
- {
- if( aZoomRatio <= 0 || Math::IsInfinite( aZoomRatio ) )
- {
- return KErrArgument;
- }
-
- iZoomRatio = aZoomRatio;
-
- // Recalculate source rect and destination size
- CalculateSourceRectAndDestinationSize();
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::ZoomRatio
-// -----------------------------------------------------------------------------
-TReal CIHLImageViewer::ZoomRatio() const
- {
- return iZoomRatio;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::ZoomToFitRatio
-// -----------------------------------------------------------------------------
-TReal CIHLImageViewer::ZoomToFitRatio() const
- {
- return iZoomToFitRatio;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::RotateClockwise
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::RotateClockwise()
- {
- TInt rotationAngle( iRotationAngle + ERotationAngle90 );
- if( rotationAngle > ERotationAngle270 )
- {
- rotationAngle = ERotationAngle0;
- }
-
- return SetRotationAngle( rotationAngle );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::RotateCounterClockwise
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::RotateCounterClockwise()
- {
- TInt rotationAngle( iRotationAngle - ERotationAngle90 );
- if( rotationAngle < ERotationAngle0 )
- {
- rotationAngle = ERotationAngle270;
- }
-
- return SetRotationAngle( rotationAngle );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetRotationAngle
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SetRotationAngle( TInt aRotationAngle )
- {
- if( aRotationAngle != ERotationAngle0 &&
- aRotationAngle != ERotationAngle90 &&
- aRotationAngle != ERotationAngle180 &&
- aRotationAngle != ERotationAngle270 )
- {
- return KErrArgument;
- }
-
- iRotationAngle = aRotationAngle;
-
- // Recalculate source rect and destination size
- CalculateSourceRectAndDestinationSize();
-
- // Recalculate zoom to fit ratio
- CalculateZoomToFitRatio();
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::RotationAngle
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::RotationAngle() const
- {
- return iRotationAngle;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetVerticalMirroring
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SetVerticalMirroring( TBool aValue )
- {
- if( iVerticalMirroring != aValue )
- {
- iVerticalMirroring = aValue;
-
- // Start load
- return ApplySettings();
- }
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::VerticalMirroring
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewer::VerticalMirroring() const
- {
- return iVerticalMirroring;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetHorizontalMirroring
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SetHorizontalMirroring( TBool aValue )
- {
- if( iHorizontalMirroring != aValue )
- {
- iHorizontalMirroring = aValue;
- return ApplySettings();
- }
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::HorizontalMirroring
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewer::HorizontalMirroring() const
- {
- return iHorizontalMirroring;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SetFilter
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::SetFilter( MIHLFilter* /*aFilter*/ )
- {
- // Not in use
- }
-
-
-
-// Private methods
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::DoCancel
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::DoCancel()
- {
- CTimer::DoCancel();
- switch( iViewerState )
- {
- case ELoad:
- {
- // Cancel asynchronous source loading
- iSource.CancelLoad();
- iCacheSource->Reset();
- break;
- }
- case EProcess:
- {
- // Cancel asynchronous processing
- iProcessor->CancelProcess();
- iCacheDestination->Reset();
- break;
- }
- default:
- {
- break;
- }
- }
-
- // Set state to inactive
- iViewerState = EInactive;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::RunL
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::RunL()
- {
- User::LeaveIfError( iStatus.Int() );
-
-
- TInt err( KErrNone );
- switch( iViewerState )
- {
- case ELoad:
- {
- // Async load successful; start async processing if needed
- if( NeedAsyncProcess() )
- {
- err = AsyncProcess();
- if( !err )
- {
- iViewerState = EProcess;
- SetActive();
- }
- break;
- }
- else
- {
- iViewerState=EInactive;
- // Flowtrough to EProcess if no error
- err = SyncProcess();
- if( err )
- {
- break;
- }
- }
- }
- case EProcess:
- {
- // Process successful; finish and check if animation is needed
- err = Finish();
- if( !err )
- {
- TInt64 currentTime = User::FastCounter();
- if(iAnimDrawStartFastTime > 0)
- {
- iAnimLastFrameDrawTime=(currentTime-iAnimDrawStartFastTime)*1000000/iTickPeriod;
- }
-
- if( iIsPlaying )
- {
- iViewerState = EAnimation;
- SheduleNextFrame(iSource.AnimationFrameDelay( iAnimationIndex ));
- }
- else
- {
- iViewerState = EInactive;
- }
- // Notify client
- // NOTE! client may call any API method in this point!
- iObserver.ViewerBitmapChangedL();
- }
- break;
- }
- case EAnimation:
- {
- // Check if still playing..
- iAnimDrawStartFastTime = User::FastCounter();
- if( iIsPlaying )
- {
- // Change animation frame + 1
- UpdateAnimationIndex();
- err = AsyncLoad();
- if( !err )
- {
- iViewerState = ELoad;
- SetActive();
- }
- else
- {
- iViewerState = EInactive;
- }
- }
- else
- {
- iViewerState = EInactive;
- }
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
-
-
- User::LeaveIfError( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::RunError
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::RunError( TInt aError )
- {
- switch( iViewerState )
- {
- case ELoad:
- {
- // Cleanup cached source if load has been failed
- iCacheSource->Reset();
- break;
- }
- case EProcess:
- {
- // Cleanup cached destination if process has been failed
- iCacheDestination->Reset();
- break;
- }
- default:
- {
- break;
- }
- }
-
- iViewerState = EInactive;
- iObserver.ViewerError( aError );
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::Set
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::ApplySettings()
- {
- // Assert source rect and destination, debug build only
-#ifdef _DEBUG
- AssertSourceRectAndDestinationSize();
-#endif
-
- // Cancel current process if any
- Cancel();
-
- // Check if cached source bitmap is already valid for processing..
- TBool validSourceCache( EFalse );
- const CFbsBitmap& cacheSource = iCacheSource->Bitmap();
- if( cacheSource.Handle() )
- {
- const TSize cacheSize( cacheSource.SizeInPixels() );
- const TSize minLoadSize( MinimumSourceLoadSize() );
- if( cacheSize.iWidth >= minLoadSize.iWidth &&
- cacheSize.iHeight >= minLoadSize.iHeight )
- {
- validSourceCache = ETrue;
- }
- }
-
- // Start async load/process..
- TInt err( KErrNone );
- if( validSourceCache )
- {
- if( NeedAsyncProcess() )
- {
- err = AsyncProcess();
- if( !err )
- {
- iViewerState = EProcess;
- SetActive();
- }
- }
- else
- {
- err = SyncProcess();
- if( !err )
- {
- iViewerState = EProcess;
- SelfComplete();
- }
- }
- }
- else
- {
- err = AsyncLoad();
- if( !err )
- {
- iViewerState = ELoad;
- SetActive();
- }
- }
-
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::AsyncLoad
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::AsyncLoad()
- {
- // Internal state check, debug panic only
- __ASSERT_DEBUG( !iCacheDestination->Bitmap().Handle(), Panic( KErrGeneral ) );
-
- TInt err( KErrNone );
- if( !iSource.IsAnimation() )
- {
- // Do not reset animation frame because loading
- // might be faster if previous frame can be utilized
- iCacheSource->Reset();
- }
- if( !iCacheSource->Bitmap().Handle() )
- {
- TDisplayMode transparency( iSource.MaskDisplayMode() );
- if( transparency )
- {
- err = iCacheSource->Create( MinimumSourceLoadSize(),
- iSource.DisplayMode(),
- transparency );
- }
- else
- {
- err = iCacheSource->Create( MinimumSourceLoadSize(),
- iSource.DisplayMode() );
- }
- }
-
- // Load source bitmap
- if( !err )
- {
- if( iSource.IsAnimation() )
- {
- err = iSource.LoadAnimation( iStatus, *iCacheSource, iAnimationIndex );
- }
- else
- {
- err = iSource.Load( iStatus, *iCacheSource, iSource.ImageIndex() );
- }
-
- }
-
- // Error cleanup if needed
- if( err )
- {
- iCacheSource->Reset();
- }
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::NeedAsyncProcess
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewer::NeedAsyncProcess()
- {
- // Internal state check, debug panic only
- __ASSERT_DEBUG( iCacheSource->Bitmap().Handle(), Panic( KErrGeneral ) );
- __ASSERT_DEBUG( !iCacheDestination->Bitmap().Handle(), Panic( KErrGeneral ) );
-
- // First check if destination size differs from source size
- // (=scaling needed)
- TSize scaledSrcSize( iCacheSource->Bitmap().SizeInPixels() );
- if( scaledSrcSize.iWidth != iDestinationSize.iWidth ||
- scaledSrcSize.iHeight != iDestinationSize.iHeight )
- {
- return ETrue;
- }
-
- // Then check if source rect and source size differs
- // (=clipping needed)
- if( iSourceRect.iTl != TPoint( 0,0 ) ||
- iSourceRect.iBr != iSource.Size().AsPoint() )
- {
- return ETrue;
- }
-
- // Finally check rotation and mirroring
- if( iRotationAngle == ERotationAngle0 &&
- !iHorizontalMirroring &&
- !iVerticalMirroring )
- {
- return EFalse;
- }
- else if( iRotationAngle == ERotationAngle180 &&
- iHorizontalMirroring &&
- iVerticalMirroring )
- {
- return EFalse;
- }
- else
- {
- return ETrue;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::AsyncProcess
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::AsyncProcess()
- {
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLImageViewer - AsyncProcess" );
-
- // Internal state check, debug panic only
- __ASSERT_DEBUG( iCacheSource->Bitmap().Handle(), Panic( KErrGeneral ) );
- __ASSERT_DEBUG( !iCacheDestination->Bitmap().Handle(), Panic( KErrGeneral ) );
-
- const CFbsBitmap& srcBitmap = iCacheSource->Bitmap();
- const CFbsBitmap& srcMask = iCacheSource->Mask();
- TInt err( KErrNone );
-
- // Create new cached destination
- if( srcMask.Handle() )
- {
- err = iCacheDestination->Create( iDestinationSize,
- srcBitmap.DisplayMode(), srcMask.DisplayMode() );
- }
- else
- {
- err = iCacheDestination->Create( iDestinationSize, srcBitmap.DisplayMode() );
- }
-
- // Scale and clip bitmap from cached source to new cached destination
- if( !err )
- {
- TRect scaledSourceRect(
- CalculateProcessSourceRect( srcBitmap.SizeInPixels() ) );
-
- TRect destinationRect( CalculateProcessDestinationRect() );
-
- err = iProcessor->Process( iStatus, *iCacheSource, scaledSourceRect,
- *iCacheDestination, destinationRect );
- }
-
- // Error cleanup if needed
- if( err )
- {
- iCacheDestination->Reset();
- }
-
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SyncProcess
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::SyncProcess()
- {
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLImageViewer - SyncProcess" );
-
- // Internal state check, debug panic only
- __ASSERT_DEBUG( iCacheSource->Bitmap().Handle(), Panic( KErrGeneral ) );
- __ASSERT_DEBUG( !iCacheDestination->Bitmap().Handle(), Panic( KErrGeneral ) );
-
- // Duplicate destination cache to destination bitmap
- TInt err( iCacheDestination->Copy( *iCacheSource, EFalse ) );
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::Finish
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewer::Finish()
- {
- // Internal state check, debug panic only
- __ASSERT_DEBUG( iCacheDestination->Bitmap().Handle(), Panic( KErrGeneral ) );
-
- // Duplicate destination cache to destination bitmap
- TInt err( iDestination.Copy( *iCacheDestination, ETrue ) );
- iCacheDestination->Reset();
-
- // Error cleanup if needed
- if( err )
- {
- iDestination.Reset();
- }
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::UpdateAnimationIndex
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::UpdateAnimationIndex()
- {
- // Internal state check, debug panic only
- __ASSERT_DEBUG( iIsPlaying, Panic( KErrGeneral ) );
-
- // Check if animation is in last frame
- if( iAnimationIndex == iSource.AnimationFrameCount() - 1 )
- {
- iAnimationIndex = 0;
- }
- else
- {
- // Not in last frame; move to next frame
- iAnimationIndex++;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::SelfComplete
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::SelfComplete()
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::MinimumSourceLoadSize
-// -----------------------------------------------------------------------------
-TSize CIHLImageViewer::MinimumSourceLoadSize()
- {
- TSize minumumLoadSize( iSource.Size() );
-
- if( iSource.IsFullyScaleable() )
- {
- const TSize originalSize( iSource.Size() );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- case ERotationAngle180:
- {
- minumumLoadSize.iWidth = originalSize.iWidth * iDestinationSize.iWidth / Abs( iSourceRect.Width() );
- minumumLoadSize.iHeight = originalSize.iHeight * iDestinationSize.iHeight / Abs( iSourceRect.Height() );
- break;
- }
- case ERotationAngle90:
- case ERotationAngle270:
- {
- minumumLoadSize.iWidth = originalSize.iWidth * iDestinationSize.iWidth / Abs( iSourceRect.Height() );
- minumumLoadSize.iHeight = originalSize.iHeight * iDestinationSize.iHeight / Abs( iSourceRect.Width() );
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
-
- // Limit fully scaleable loadsize to original size
- if( minumumLoadSize.iWidth > originalSize.iWidth ||
- minumumLoadSize.iHeight > originalSize.iHeight )
- {
- minumumLoadSize = originalSize;
- }
- }
- else
- {
- const RArray<TSize>& loadSizeArray = iSource.CustomLoadSizeArray();
- const TInt count( loadSizeArray.Count() );
-
- if( count )
- {
- TRect loadRect;
- TSize loadRectSize;
- TBool indexFound( EFalse );
- for( TInt i( 0 ); ( i < count ) && !indexFound; ++i )
- {
- loadRect = CalculateProcessSourceRect( loadSizeArray[ i ] );
- loadRectSize = loadRect.Size();
- loadRectSize.iWidth = Abs( loadRectSize.iWidth );
- loadRectSize.iHeight = Abs( loadRectSize.iHeight );
-
- if( iDestinationSize.iWidth <= loadRectSize.iWidth &&
- iDestinationSize.iHeight <= loadRectSize.iHeight )
- {
- minumumLoadSize = loadSizeArray[ i ];
- indexFound = ETrue;
- }
- }
- }
- }
-
- return minumumLoadSize;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::CalculateProcessSourceRect
-// -----------------------------------------------------------------------------
-TRect CIHLImageViewer::CalculateProcessSourceRect( const TSize& aLoadSize )
- {
- const TSize originalSize( iSource.Size() );
- TRect loadRect;
- if ( aLoadSize.iWidth > KErrNone && aLoadSize.iHeight > KErrNone )
- {
- loadRect.iTl.iX = iSourceRect.iTl.iX * aLoadSize.iWidth / originalSize.iWidth;
- loadRect.iTl.iY = iSourceRect.iTl.iY * aLoadSize.iHeight / originalSize.iHeight;
- loadRect.iBr.iX = iSourceRect.iBr.iX * aLoadSize.iWidth / originalSize.iWidth;
- loadRect.iBr.iY = iSourceRect.iBr.iY * aLoadSize.iHeight / originalSize.iHeight;
- }
- else
- {
- loadRect.SetRect(0,0,0,0);
- return loadRect;
- }
-
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- TInt tmp( loadRect.iTl.iY );
- loadRect.iTl.iY = loadRect.iBr.iY;
- loadRect.iBr.iY = tmp;
- break;
- }
- case ERotationAngle180:
- {
- TPoint tmp( loadRect.iTl );
- loadRect.iTl = loadRect.iBr;
- loadRect.iBr = tmp;
- break;
- }
- case ERotationAngle270:
- {
- TInt tmp( loadRect.iTl.iX );
- loadRect.iTl.iX = loadRect.iBr.iX;
- loadRect.iBr.iX = tmp;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
-
- return loadRect;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::CalculateProcessDestinationRect
-// -----------------------------------------------------------------------------
-TRect CIHLImageViewer::CalculateProcessDestinationRect()
- {
- TRect dstRect( iDestinationSize );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- case ERotationAngle180:
- {
- if( iHorizontalMirroring )
- {
- TInt tmp( dstRect.iTl.iX );
- dstRect.iTl.iX = dstRect.iBr.iX;
- dstRect.iBr.iX = tmp;
- }
- if( iVerticalMirroring )
- {
- TInt tmp( dstRect.iTl.iY );
- dstRect.iTl.iY = dstRect.iBr.iY;
- dstRect.iBr.iY = tmp;
- }
- break;
- }
- case ERotationAngle90:
- case ERotationAngle270:
- {
- if( iHorizontalMirroring )
- {
- TInt tmp( dstRect.iTl.iY );
- dstRect.iTl.iY = dstRect.iBr.iY;
- dstRect.iBr.iY = tmp;
- }
- if( iVerticalMirroring )
- {
- TInt tmp( dstRect.iTl.iX );
- dstRect.iTl.iX = dstRect.iBr.iX;
- dstRect.iBr.iX = tmp;
- }
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
- return dstRect;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::CalculateZoomToFitRatio
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::CalculateZoomToFitRatio()
- {
- TSize sourceSize( SourceSize() );
- TReal widthRatio( TReal( iViewerSize.iWidth ) / TReal( sourceSize.iWidth ) );
- TReal heightRatio( TReal( iViewerSize.iHeight ) / TReal( sourceSize.iHeight ) );
-
- if( iOptions & MIHLImageViewer::EOptionIgnoreAspectRatio )
- {
- iZoomToFitRatio = ( widthRatio > heightRatio ) ? widthRatio : heightRatio;
- }
- else
- {
- iZoomToFitRatio = ( widthRatio < heightRatio ) ? widthRatio : heightRatio;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::CalculateSourceRectAndDestinationSize
-// -----------------------------------------------------------------------------
-void CIHLImageViewer::CalculateSourceRectAndDestinationSize()
- {
- // Calculate new source rect
- TSize oldSourceRectSize( iSourceRect.Size() );
-
- TReal newSourceRectWidth;
- TReal newSourceRectHeight;
- TReal widthZoomRatio( iZoomRatio );
- TReal heightZoomRatio( iZoomRatio );
-
- if( iOptions & MIHLImageViewer::EOptionIgnoreAspectRatio )
- {
- TReal widthRatio( TReal( iViewerSize.iWidth ) / TReal( iSourceSize.iWidth ) );
- TReal heightRatio( TReal( iViewerSize.iHeight ) / TReal( iSourceSize.iHeight ) );
- if( widthRatio < heightRatio )
- {
- widthZoomRatio = widthZoomRatio * widthRatio / heightRatio;
- }
- else
- {
- heightZoomRatio = heightZoomRatio * heightRatio / widthRatio;
- }
- }
-
- if( iRotationAngle == ERotationAngle90 ||
- iRotationAngle == ERotationAngle270 )
- {
- newSourceRectWidth = iSrcBitmapScaleFactor * iViewerSize.iHeight / heightZoomRatio; //widthZoomRatio
- newSourceRectHeight = iSrcBitmapScaleFactor * iViewerSize.iWidth / widthZoomRatio; //heightZoomRatio
- }
- else
- {
- newSourceRectWidth = iSrcBitmapScaleFactor * iViewerSize.iWidth / widthZoomRatio;
- newSourceRectHeight = iSrcBitmapScaleFactor * iViewerSize.iHeight / heightZoomRatio;
- }
-
- // Check if source rect is not larger than source area
- if( newSourceRectWidth > iSourceSize.iWidth )
- {
- newSourceRectWidth = iSourceSize.iWidth;
- }
- if( newSourceRectHeight > iSourceSize.iHeight )
- {
- newSourceRectHeight = iSourceSize.iHeight;
- }
-
- // Rounding the results
- TReal roundedWidth;
- Math::Round( roundedWidth, newSourceRectWidth, 0 );
- TReal roundedHeight;
- Math::Round( roundedHeight, newSourceRectHeight, 0 );
-
- iSourceRect.SetWidth( (TInt)roundedWidth );
- iSourceRect.SetHeight( (TInt)roundedHeight );
-
- // Calculate actual destination size (always same or smaller than iViewerSize !)
- if( iRotationAngle == ERotationAngle90 ||
- iRotationAngle == ERotationAngle270 )
- {
- iDestinationSize.iWidth = (TInt)( newSourceRectHeight * widthZoomRatio ); //heightZoomRatio
- iDestinationSize.iHeight = (TInt)( newSourceRectWidth * heightZoomRatio ); //widthZoomRatio
- }
- else
- {
- iDestinationSize.iWidth = (TInt)( newSourceRectWidth * widthZoomRatio );
- iDestinationSize.iHeight = (TInt)( newSourceRectHeight * heightZoomRatio );
- }
- // Check that destination size is not rounded to zero
- if( iDestinationSize.iWidth == 0 )
- {
- iDestinationSize.iWidth = 1;
- }
- if( iDestinationSize.iHeight == 0 )
- {
- iDestinationSize.iHeight = 1;
- }
-
- // Move source rect keeping center point in same location
- iSourceRect.Move( ( oldSourceRectSize.iWidth - (TInt)newSourceRectWidth ) / 2,
- ( oldSourceRectSize.iHeight - (TInt)newSourceRectHeight ) / 2 );
-
- // Move rect if partially out of source area
- TPoint moveOffset( 0, 0 );
- if( iSourceRect.iTl.iX < 0 )
- {
- moveOffset.iX = -iSourceRect.iTl.iX;
- }
- else if( iSourceRect.iBr.iX > iSourceSize.iWidth )
- {
- moveOffset.iX = iSourceSize.iWidth - iSourceRect.iBr.iX;
- }
- if( iSourceRect.iTl.iY < 0 ) //lint !e961
- {
- moveOffset.iY = -iSourceRect.iTl.iY;
- }
- else if( iSourceRect.iBr.iY > iSourceSize.iHeight )
- {
- moveOffset.iY = iSourceSize.iHeight - iSourceRect.iBr.iY;
- }
- iSourceRect.Move( moveOffset ); //lint !e961
-
- // Assert that rectangle is valid, debug build only
-#ifdef _DEBUG
- AssertSourceRectAndDestinationSize();
-#endif
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewer::AssertSourceRectAndDestinationSize
-// Used in debug build only
-// -----------------------------------------------------------------------------
-#ifdef _DEBUG
-void CIHLImageViewer::AssertSourceRectAndDestinationSize()
- {
- if( iSourceRect.iTl.iX < 0 ||
- iSourceRect.iBr.iX > iSourceSize.iWidth ||
- iSourceRect.iTl.iY < 0 ||
- iSourceRect.iBr.iY > iSourceSize.iHeight ||
- iDestinationSize.iWidth <= 0 || iDestinationSize.iHeight <= 0 )
- {
- Panic( KErrGeneral );
- }
- }
-#endif
-
-// End of File
--- a/imagehandlinglib/Src/CIHLImageViewer.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,374 +0,0 @@
-/*
-* 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 Image Viewer class.
-*
-*/
-
-
-#ifndef CIHLIMAGEVIEWER_H
-#define CIHLIMAGEVIEWER_H
-
-// INCLUDES
-#include <MIHLImageViewer.h>
-#include <e32base.h>
-#include <hal.h>
-
-//FORWARD DECLARATIONS
-class MIHLFileImage;
-class MIHLBitmap;
-class MIHLViewerObserver;
-class CIHLBitmap;
-class CIHLBitmapProcessor;
-
-#define KMinimumInterval 10000
-
-// CLASS DECLARATION
-/**
-* CIHLImageViewer
-*
-* Image Viewer implementation class.
-* @lib IHL.lib
-* @since 3.0
-*/
-NONSHARABLE_CLASS( CIHLImageViewer ) : public CTimer, public MIHLImageViewer
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CIHLImageViewer* NewL( const TSize& aViewerSize,
- MIHLFileImage& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions );
-
- /*
- * Virtual destructor.
- */
- virtual ~CIHLImageViewer();
-
- public: // From base class MIHLViewer
-
- /*
- * From MIHLViewer, see base class header.
- */
- TIHLInterfaceType Type() const;
-
- public: // From base class MIHLImageViewer
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool IsAnimation() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- void Play();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- void Stop();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool IsPlaying() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt AnimationFrameCount() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt AnimationFrame() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetAnimationFrame( TInt aFrameIndex );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetViewerSize( const TSize& aViewerSize, TInt srcBitmapScaleFactor = 1 );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TSize ViewerSize() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt MoveSourceRect( TInt aDx, TInt aDy );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetSourceRectPosition( const TPoint& aPosition );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TRect SourceRect() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TSize SourceSize() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetZoomRatio( TReal aZoomRatio );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TReal ZoomRatio() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TReal ZoomToFitRatio() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt RotateClockwise();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt RotateCounterClockwise();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetRotationAngle( TInt aRotationAngle );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt RotationAngle() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetVerticalMirroring( TBool aValue );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool VerticalMirroring() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetHorizontalMirroring( TBool aValue );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool HorizontalMirroring() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- void SetFilter( MIHLFilter* aFilter );
-
- public: // From base class CTimer
-
- /*
- * From CTimer, see base class header.
- */
- void DoCancel();
-
- /*
- * From CTimer, see base class header.
- */
- void RunL();
-
- /*
- * From CTimer, see base class header.
- */
- TInt RunError( TInt aError );
-
- private: // Private methods
-
- /*
- * Start asynchronous processing with new settings.
- * This is needed always when settings are changed.
- */
- TInt ApplySettings();
-
- /*
- * Start load process source bitmap.
- */
- TInt AsyncLoad();
-
- /*
- * Check if process is needed.
- */
- TBool NeedAsyncProcess();
-
- /*
- * Start processing with new settings.
- */
- TInt AsyncProcess();
-
- /*
- * No external processing.
- * Just duplicates source to destination.
- */
- TInt SyncProcess();
-
- /*
- * Finish processing and notify client.
- */
- TInt Finish();
-
- /*
- * Update frame index when playing animation.
- */
- void UpdateAnimationIndex();
-
- /*
- * Complete dummy request. This causes RunL() method to be called.
- * Needed by state machine.
- */
- void SelfComplete();
-
- /*
- * Calculate minimum source bitmap size (using fixed loadsizes)
- * needed by processing and destination bitmap.
- */
- TSize MinimumSourceLoadSize();
-
- /*
- * Calculate source bitmap rectangle needed by processor.
- * Rectangle is affected by rotating and mirroring settings etc.
- */
- TRect CalculateProcessSourceRect( const TSize& aLoadSize );
-
- /*
- * Calculate destination bitmap rectangle needed by processor.
- * Rectangle is affected by rotating and mirroring settings etc.
- */
- TRect CalculateProcessDestinationRect();
-
- /*
- * Calculate needed zoomratio for "fit-to-screen" zooming.
- */
- void CalculateZoomToFitRatio();
-
- /*
- * Calculate source bitmap rectangle and destination bitmap size.
- * These values needs to be recalculated when rectangle setting is changed.
- */
- void CalculateSourceRectAndDestinationSize( );
-
- /*
- * Shedules next frame of animation in using aDelay CTimer::Hires().
- * If this is not the first frame the shedule time is decreased by
- * previous frame draw time.
- */
- void SheduleNextFrame(TTimeIntervalMicroSeconds32 aDelay);
-
- /*
- * Assert if source bitmap rectangle and destination bitmpa size are valid.
- * This method is called by CalculateSourceRectAndDestinationSize()
- */
-#ifdef _DEBUG
- void AssertSourceRectAndDestinationSize();
-#endif
-
- private: // Private constructors
-
- void ConstructL();
- CIHLImageViewer( const TSize& aViewerSize,
- MIHLFileImage& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions );
-
- private: // Private data types
-
- enum TViewerState
- {
- EInactive,
- ELoad,
- EProcess,
- EAnimation,
- };
-
- private: // Data
-
- // Viewer state
- TViewerState iViewerState;
-
- // Ref: Observers
- MIHLViewerObserver& iObserver;
-
- // Ref: Viewer source image
- MIHLFileImage& iSource;
- TSize iSourceSize;
- TRect iSourceRect;
-
- // Ref: Viewer destination bitmap
- MIHLBitmap& iDestination;
- TSize iDestinationSize;
-
- // Viewing settings
- const TUint32 iOptions;
- TSize iViewerSize;
- TReal iZoomRatio;
- TReal iZoomToFitRatio;
- TInt iRotationAngle;
- TBool iVerticalMirroring;
- TBool iHorizontalMirroring;
-
- // Own: Bitmap caches
- CIHLBitmap* iCacheSource;
- CIHLBitmap* iCacheDestination;
-
- // Own: Bitmap processor
- CIHLBitmapProcessor* iProcessor;
-
- // Animation info
- TBool iIsPlaying;
- TInt iAnimationIndex;
-
- // src bitmap scale factor
- TInt iSrcBitmapScaleFactor;
-
- // Animation time tweaking
- TInt64 iAnimInitFastTime; //clock ticks
- TInt64 iAnimDrawStartFastTime; //clock tics
- TInt iAnimLastFrameDrawTime; //micro seconds
- TInt iTickPeriod; //clock tick period
- TTimeIntervalMicroSeconds32 iAnimDelay;
-
-
-
- };
-
-#endif // CIHLIMAGEVIEWER_H
-
-// End of File
--- a/imagehandlinglib/Src/CIHLImageViewerExtJpg.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1037 +0,0 @@
-/*
-* 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: Implementation of Image Viewer class.
-*
-*/
-
-
-// INCLUDE FILES
-#include "CIHLImageViewerExtJpg.h"
-
-#include "CIHLBitmap.h"
-#include "CIHLBitmapProcessor.h"
-#include "IHLImplementationIds.h"
-#include <IHLInterfaceIds.h>
-#include <IclExtJpegApi.h>
-#include <imagecodecdata.h>
-#include <MIHLViewerObserver.h>
-#include "MIHLFileImageExtJpg.h"
-#include <fbs.h>
-
-// Private namespace for constants and functions
-namespace
- {
- // Panic function
- _LIT( KIHLImageViewerExtJpgPanic, "IHLImageViewerExtJpg" );
- void Panic( TInt aPanicCode ) { User::Panic( KIHLImageViewerExtJpgPanic, aPanicCode ); }
- }
-
-// ============================ MEMBER FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-//
-// C++ constructor can NOT contain any code, that might leave.
-// -----------------------------------------------------------------------------
-CIHLImageViewerExtJpg::CIHLImageViewerExtJpg( const TSize& aViewerSize,
- MIHLFileImageExtJpg& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions )
-: CTimer( EPriorityNormal ), iObserver( aObserver ),
-iSource( aSource ), iDestination( aDestination ),
-iOptions( aOptions ), iViewerSize( aViewerSize ), iSrcBitmapScaleFactor(1)
- {
-
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-//
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-CIHLImageViewerExtJpg* CIHLImageViewerExtJpg::NewL( const TSize& aViewerSize,
- MIHLFileImageExtJpg& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions )
- {
- CIHLImageViewerExtJpg* self = new( ELeave ) CIHLImageViewerExtJpg(
- aViewerSize, aSource, aDestination, aObserver, aOptions );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop(); // self
- return self;
- }
-
-// -----------------------------------------------------------------------------
-//
-// Symbian constructor can leave.
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::ConstructL()
- {
- CTimer::ConstructL();
-
- iCacheSource = CIHLBitmap::NewL();
- iCacheDestination = CIHLBitmap::NewL();
-
- // Check codec capabilities
- iCapabilities = iSource.CapabilitiesL();
- if( !( iCapabilities & ( CExtJpegDecoder::ECapRotation +
- CExtJpegDecoder::ECapMirroring +
- CExtJpegDecoder::ECapFlipping ) ) )
- {
- iInternalProcessingNeeded = ETrue;
- iProcessor = CIHLBitmapProcessor::NewL( iOptions );
- }
-
- // Initialize settings and start load (default is zoom to fit)
- iSourceSize = iSource.Size();
- CalculateZoomToFitRatio();
- User::LeaveIfError( SetZoomRatio( iZoomToFitRatio ) );
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-CIHLImageViewerExtJpg::~CIHLImageViewerExtJpg()
- {
- Cancel();
- if( iProcessor )
- {
- delete iProcessor;
- }
- delete iCacheSource;
- delete iCacheDestination;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::Id
-// -----------------------------------------------------------------------------
-TIHLInterfaceType CIHLImageViewerExtJpg::Type() const
- {
- return TIHLInterfaceType( KIHLInterfaceIdImageViewer, KIHLImplementationIdImageViewerExtJpg );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::IsAnimation
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewerExtJpg::IsAnimation() const
- {
- return EFalse;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::Play
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::Play()
- {
-
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::Stop
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::Stop()
- {
-
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::IsPlaying
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewerExtJpg::IsPlaying() const
- {
- return EFalse;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::AnimationFrameCount
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::AnimationFrameCount() const
- {
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::AnimationFrame
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::AnimationFrame() const
- {
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetAnimationFrame
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::SetAnimationFrame( TInt /*aFrameIndex*/ )
- {
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetViewerSize
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::SetViewerSize( const TSize& aViewerSize, int aSrcBitmapScaleFactor )
- {
- // Public API, negative value check -> panic also on hardware
- __ASSERT_ALWAYS( aViewerSize.iWidth >= 0 &&
- aViewerSize.iHeight >= 0, Panic( KErrArgument ) );
-
- iSrcBitmapScaleFactor = aSrcBitmapScaleFactor;
-
- // Save new viewer size
- iViewerSize = aViewerSize;
-
- // Recalculate source rect and destination size
- CalculateSourceRectAndDestinationSize();
-
- // Recalculate zoom to fit ratio
- CalculateZoomToFitRatio();
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::ViewerSize
-// -----------------------------------------------------------------------------
-TSize CIHLImageViewerExtJpg::ViewerSize() const
- {
- return iViewerSize;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::MoveSourceRect
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::MoveSourceRect( TInt aDx, TInt aDy )
- {
- TInt dx( aDx );
- TInt dy( aDy );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- dx = aDy;
- dy = -aDx;
- break;
- }
- case ERotationAngle180:
- {
- dx = -aDx;
- dy = -aDy;
- break;
- }
- case ERotationAngle270:
- {
- dx = -aDy;
- dy = aDx;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
- if( iHorizontalMirroring )
- {
- dx = -dx;
- }
- if( iVerticalMirroring )
- {
- dy = -dy;
- }
-
- if( iSourceRect.iTl.iX + dx < 0 ||
- iSourceRect.iBr.iX + dx > iSourceSize.iWidth ||
- iSourceRect.iTl.iY + dy < 0 ||
- iSourceRect.iBr.iY + dy > iSourceSize.iHeight )
- {
- return KErrArgument;
- }
-
- iSourceRect.Move( dx, dy );
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetSourceRectPosition
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::SetSourceRectPosition( const TPoint& aPosition )
- {
- TPoint newPosition( aPosition );
- TSize sourceRectSize( iSourceRect.Size() );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- newPosition.iX = aPosition.iY;
- newPosition.iY = iSourceSize.iHeight - sourceRectSize.iHeight - aPosition.iX;
- break;
- }
- case ERotationAngle180:
- {
- newPosition.iX = iSourceSize.iWidth - sourceRectSize.iWidth - aPosition.iX;
- newPosition.iY = iSourceSize.iHeight - sourceRectSize.iHeight - aPosition.iY;
- break;
- }
- case ERotationAngle270:
- {
- newPosition.iX = iSourceSize.iWidth - sourceRectSize.iWidth - aPosition.iY;
- newPosition.iY = aPosition.iX;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
- if( iHorizontalMirroring )
- {
- newPosition.iX = iSourceSize.iWidth - sourceRectSize.iWidth - newPosition.iX;
- }
- if( iVerticalMirroring )
- {
- newPosition.iY = iSourceSize.iHeight - sourceRectSize.iHeight - newPosition.iY;
- }
-
- if( newPosition.iX < 0 ||
- newPosition.iX > ( iSourceSize.iWidth - sourceRectSize.iWidth ) ||
- newPosition.iY < 0 ||
- newPosition.iY > ( iSourceSize.iHeight - sourceRectSize.iHeight ) )
- {
- return KErrArgument;
- }
-
- iSourceRect = TRect( newPosition, sourceRectSize );
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SourceRect
-// -----------------------------------------------------------------------------
-TRect CIHLImageViewerExtJpg::SourceRect() const
- {
- TRect mirroredSourceRect( iSourceRect );
- if( iHorizontalMirroring )
- {
- mirroredSourceRect.iTl.iX = iSourceSize.iWidth - iSourceRect.iBr.iX;
- mirroredSourceRect.iBr.iX = iSourceSize.iWidth - iSourceRect.iTl.iX;
- }
- if( iVerticalMirroring )
- {
- mirroredSourceRect.iTl.iY = iSourceSize.iHeight - iSourceRect.iBr.iY;
- mirroredSourceRect.iBr.iY = iSourceSize.iHeight - iSourceRect.iTl.iY;
- }
-
- TRect rotatedSourceRect( mirroredSourceRect );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- rotatedSourceRect.iTl.iX = iSourceSize.iHeight - mirroredSourceRect.iBr.iY;
- rotatedSourceRect.iTl.iY = mirroredSourceRect.iTl.iX;
- rotatedSourceRect.iBr.iX = iSourceSize.iHeight - mirroredSourceRect.iTl.iY;
- rotatedSourceRect.iBr.iY = mirroredSourceRect.iBr.iX;
- break;
- }
- case ERotationAngle180:
- {
- rotatedSourceRect.iTl.iX = iSourceSize.iWidth - mirroredSourceRect.iBr.iX;
- rotatedSourceRect.iTl.iY = iSourceSize.iHeight - mirroredSourceRect.iBr.iY;
- rotatedSourceRect.iBr.iX = iSourceSize.iWidth - mirroredSourceRect.iTl.iX;
- rotatedSourceRect.iBr.iY = iSourceSize.iHeight - mirroredSourceRect.iTl.iY;
- break;
- }
- case ERotationAngle270:
- {
- rotatedSourceRect.iTl.iX = mirroredSourceRect.iTl.iY;
- rotatedSourceRect.iTl.iY = iSourceSize.iWidth - mirroredSourceRect.iBr.iX;
- rotatedSourceRect.iBr.iX = mirroredSourceRect.iBr.iY;
- rotatedSourceRect.iBr.iY = iSourceSize.iWidth - mirroredSourceRect.iTl.iX;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
-
- return rotatedSourceRect;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SourceSize
-// -----------------------------------------------------------------------------
-TSize CIHLImageViewerExtJpg::SourceSize() const
- {
- if( iRotationAngle == ERotationAngle90 ||
- iRotationAngle == ERotationAngle270 )
- {
- return TSize( iSourceSize.iHeight, iSourceSize.iWidth );
- }
- else
- {
- return iSourceSize;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetZoomRatio
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::SetZoomRatio( TReal aZoomRatio )
- {
- if( aZoomRatio <= 0 )
- {
- return KErrArgument;
- }
-
- iZoomRatio = aZoomRatio;
-
- // Recalculate source rect and destination size
- CalculateSourceRectAndDestinationSize();
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::ZoomRatio
-// -----------------------------------------------------------------------------
-TReal CIHLImageViewerExtJpg::ZoomRatio() const
- {
- return iZoomRatio;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::ZoomToFitRatio
-// -----------------------------------------------------------------------------
-TReal CIHLImageViewerExtJpg::ZoomToFitRatio() const
- {
- return iZoomToFitRatio;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::RotateClockwise
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::RotateClockwise()
- {
- TInt rotationAngle( iRotationAngle + ERotationAngle90 );
- if( rotationAngle > ERotationAngle270 )
- {
- rotationAngle = ERotationAngle0;
- }
-
- return SetRotationAngle( rotationAngle );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::RotateCounterClockwise
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::RotateCounterClockwise()
- {
- TInt rotationAngle( iRotationAngle - ERotationAngle90 );
- if( rotationAngle < ERotationAngle0 )
- {
- rotationAngle = ERotationAngle270;
- }
-
- return SetRotationAngle( rotationAngle );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetRotationAngle
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::SetRotationAngle( TInt aRotationAngle )
- {
- if( aRotationAngle != ERotationAngle0 &&
- aRotationAngle != ERotationAngle90 &&
- aRotationAngle != ERotationAngle180 &&
- aRotationAngle != ERotationAngle270 )
- {
- return KErrArgument;
- }
-
- iRotationAngle = aRotationAngle;
-
- // Recalculate source rect and destination size
- CalculateSourceRectAndDestinationSize();
-
- // Recalculate zoom to fit ratio
- CalculateZoomToFitRatio();
-
- // Start load
- return ApplySettings();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::RotationAngle
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::RotationAngle() const
- {
- return iRotationAngle;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetVerticalMirroring
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::SetVerticalMirroring( TBool aValue )
- {
- if( iVerticalMirroring != aValue )
- {
- iVerticalMirroring = aValue;
-
- // Start load
- return ApplySettings();
- }
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::VerticalMirroring
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewerExtJpg::VerticalMirroring() const
- {
- return iVerticalMirroring;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetHorizontalMirroring
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::SetHorizontalMirroring( TBool aValue )
- {
- if( iHorizontalMirroring != aValue )
- {
- iHorizontalMirroring = aValue;
- return ApplySettings();
- }
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::HorizontalMirroring
-// -----------------------------------------------------------------------------
-TBool CIHLImageViewerExtJpg::HorizontalMirroring() const
- {
- return iHorizontalMirroring;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SetFilter
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::SetFilter( MIHLFilter* /*aFilter*/ )
- {
- // Not in use
- }
-
-
-
-// Private methods
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::DoCancel
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::DoCancel()
- {
- CTimer::DoCancel();
- // Set state to inactive
- switch( iViewerState )
- {
- case ELoad:
- {
- // Cancel asynchronous source loading
- iSource.CancelLoad();
- iCacheSource->Reset();
- break;
- }
- case EProcess:
- {
- // Cancel asynchronous processing
- iProcessor->CancelProcess();
- iCacheDestination->Reset();
- break;
- }
- default:
- {
- break;
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::RunL
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::RunL()
- {
- User::LeaveIfError( iStatus.Int() );
-
- // Save previous state and set current state immediately
- // to inactive to keep state up-to-date
- TViewerState prevState( iViewerState );
- iViewerState = EInactive;
-
- switch( prevState )
- {
- case ELoad:
- {
- //Use the internal processor if the codec is lacking some processing capability
- if( iInternalProcessingNeeded )
- {
- const CFbsBitmap& srcBitmap = iCacheSource->Bitmap();
- User::LeaveIfError( iCacheDestination->Create( iDestinationSize, srcBitmap.DisplayMode() ) );
- TRect processSourceRect( CalculateProcessSourceRect( iCacheSource->Bitmap().SizeInPixels() ) );
- TRect destinationRect( CalculateProcessDestinationRect() );
-
- User::LeaveIfError( iProcessor->Process( iStatus, *iCacheSource, processSourceRect,
- *iCacheDestination, destinationRect ) );
-
- iViewerState = EProcess;
- SetActive();
- }
- else
- {
- User::LeaveIfError( Finish() );
- iObserver.ViewerBitmapChangedL();
- }
- break;
- }
- case EProcess:
- {
- User::LeaveIfError( Finish() );
- iObserver.ViewerBitmapChangedL();
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::RunError
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::RunError( TInt aError )
- {
- switch( iViewerState )
- {
- case ELoad:
- {
- // Cleanup cached source if load has been failed
- iCacheSource->Reset();
- break;
- }
- case EProcess:
- {
- // Cleanup cached destination if process has been failed
- iCacheDestination->Reset();
- break;
- }
- default:
- {
- break;
- }
- }
-
- iViewerState = EInactive;
- iObserver.ViewerError( aError );
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::ApplySettings
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::ApplySettings()
- {
- // Assert source rect and destination, debug build only
-#ifdef _DEBUG
- AssertSourceRectAndDestinationSize();
-#endif
-
- // Cancel current process if any
- Cancel();
-
- // Perform processing if supported by codec
- if( !iInternalProcessingNeeded )
- {
- TRAPD( err, iSource.SetRotationL( iRotationAngle ) );
- if( !err && iHorizontalMirroring )
- {
- TRAP( err, iSource.SetFlippingL() );
- }
- if( !err && iVerticalMirroring )
- {
- TRAP( err, iSource.SetMirroringL() );
- }
- if( err )
- {
- return err;
- }
- }
-
- // Start async load/process.
- TInt err( KErrNone );
-
- err = AsyncLoad();
- if( !err )
- {
- iViewerState = ELoad;
- SetActive();
- }
-
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::AsyncLoad
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::AsyncLoad()
- {
- // Internal state check, debug panic only
- __ASSERT_DEBUG( !iCacheDestination->Bitmap().Handle(), Panic( KErrGeneral ) );
-
- TInt err( KErrNone );
-
- // Load source bitmap
-
- iCacheSource->Reset();
-
- err = iCacheSource->Create( iDestinationSize, iSource.DisplayMode() );
-
- if( !err )
- {
- err = iSource.Load( iSourceRect, iStatus, *iCacheSource );
- }
-
- // Error cleanup if needed
- if( err )
- {
- iCacheSource->Reset();
- }
- return err;
- }
-
-
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::Finish
-// -----------------------------------------------------------------------------
-TInt CIHLImageViewerExtJpg::Finish()
- {
- // Internal state check, debug panic only
- __ASSERT_DEBUG( iCacheSource->Bitmap().Handle(), Panic( KErrGeneral ) );
-
- TInt err( KErrNone );
-
- // Check if internal processor was used
- if( iInternalProcessingNeeded )
- {
- err = iDestination.Copy( *iCacheDestination, ETrue );
- iCacheDestination->Reset();
- }
- else
- {
- err = iDestination.Copy( *iCacheSource, ETrue );
- iCacheSource->Reset();
- }
-
- // Error cleanup if needed
- if( err )
- {
- iDestination.Reset();
- }
-
- return err;
- }
-
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::SelfComplete
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::SelfComplete()
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::CalculateProcessSourceRect
-// -----------------------------------------------------------------------------
-TRect CIHLImageViewerExtJpg::CalculateProcessSourceRect( const TSize& aSourceCacheSize )
- {
-
- TRect loadRect( aSourceCacheSize );
-
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- {
- break;
- }
- case ERotationAngle90:
- {
- TInt tmp( loadRect.iTl.iY );
- loadRect.iTl.iY = loadRect.iBr.iY;
- loadRect.iBr.iY = tmp;
- break;
- }
- case ERotationAngle180:
- {
- TPoint tmp( loadRect.iTl );
- loadRect.iTl = loadRect.iBr;
- loadRect.iBr = tmp;
- break;
- }
- case ERotationAngle270:
- {
- TInt tmp( loadRect.iTl.iX );
- loadRect.iTl.iX = loadRect.iBr.iX;
- loadRect.iBr.iX = tmp;
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
-
- return loadRect;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::CalculateProcessDestinationRect
-// -----------------------------------------------------------------------------
-TRect CIHLImageViewerExtJpg::CalculateProcessDestinationRect()
- {
- TRect dstRect( iDestinationSize );
- switch( iRotationAngle )
- {
- case ERotationAngle0:
- case ERotationAngle180:
- {
- if( iHorizontalMirroring )
- {
- TInt tmp( dstRect.iTl.iX );
- dstRect.iTl.iX = dstRect.iBr.iX;
- dstRect.iBr.iX = tmp;
- }
- if( iVerticalMirroring )
- {
- TInt tmp( dstRect.iTl.iY );
- dstRect.iTl.iY = dstRect.iBr.iY;
- dstRect.iBr.iY = tmp;
- }
- break;
- }
- case ERotationAngle90:
- case ERotationAngle270:
- {
- if( iHorizontalMirroring )
- {
- TInt tmp( dstRect.iTl.iY );
- dstRect.iTl.iY = dstRect.iBr.iY;
- dstRect.iBr.iY = tmp;
- }
- if( iVerticalMirroring )
- {
- TInt tmp( dstRect.iTl.iX );
- dstRect.iTl.iX = dstRect.iBr.iX;
- dstRect.iBr.iX = tmp;
- }
- break;
- }
- default:
- {
- // Internal state error, debug panic only
- #ifdef _DEBUG
- Panic( KErrGeneral );
- #endif
- }
- }
- return dstRect;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::CalculateZoomToFitRatio
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::CalculateZoomToFitRatio()
- {
- TSize sourceSize( SourceSize() );
- TReal widthRatio( TReal( iViewerSize.iWidth ) / TReal( sourceSize.iWidth ) );
- TReal heightRatio( TReal( iViewerSize.iHeight ) / TReal( sourceSize.iHeight ) );
-
- if( iOptions & MIHLImageViewer::EOptionIgnoreAspectRatio )
- {
- iZoomToFitRatio = ( widthRatio > heightRatio ) ? widthRatio : heightRatio;
- }
- else
- {
- iZoomToFitRatio = ( widthRatio < heightRatio ) ? widthRatio : heightRatio;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::CalculateSourceRectAndDestinationSize
-// -----------------------------------------------------------------------------
-void CIHLImageViewerExtJpg::CalculateSourceRectAndDestinationSize()
- {
- // Calculate new source rect
- TSize oldSourceRectSize( iSourceRect.Size() );
-
- TReal newSourceRectWidth;
- TReal newSourceRectHeight;
- TReal widthZoomRatio( iZoomRatio );
- TReal heightZoomRatio( iZoomRatio );
-
- if( iOptions & MIHLImageViewer::EOptionIgnoreAspectRatio )
- {
- TReal widthRatio( TReal( iViewerSize.iWidth ) / TReal( iSourceSize.iWidth ) );
- TReal heightRatio( TReal( iViewerSize.iHeight ) / TReal( iSourceSize.iHeight ) );
- if( widthRatio < heightRatio )
- {
- widthZoomRatio = widthZoomRatio * widthRatio / heightRatio;
- }
- else
- {
- heightZoomRatio = heightZoomRatio * heightRatio / widthRatio;
- }
- }
-
- if( iRotationAngle == ERotationAngle90 ||
- iRotationAngle == ERotationAngle270 )
- {
- newSourceRectWidth = iSrcBitmapScaleFactor * iViewerSize.iHeight / heightZoomRatio; //widthZoomRatio
- newSourceRectHeight = iSrcBitmapScaleFactor * iViewerSize.iWidth / widthZoomRatio; //heightZoomRatio
- }
- else
- {
- newSourceRectWidth = iSrcBitmapScaleFactor * iViewerSize.iWidth / widthZoomRatio;
- newSourceRectHeight = iSrcBitmapScaleFactor * iViewerSize.iHeight / heightZoomRatio;
- }
-
- // Check if source rect is not larger than source area
- if( newSourceRectWidth > iSourceSize.iWidth )
- {
- newSourceRectWidth = iSourceSize.iWidth;
- }
- if( newSourceRectHeight > iSourceSize.iHeight )
- {
- newSourceRectHeight = iSourceSize.iHeight;
- }
- iSourceRect.SetWidth( (TInt)newSourceRectWidth );
- iSourceRect.SetHeight( (TInt)newSourceRectHeight );
-
- // Calculate actual destination size (always same or smaller than iViewerSize !)
- if( iRotationAngle == ERotationAngle90 ||
- iRotationAngle == ERotationAngle270 )
- {
- iDestinationSize.iWidth = (TInt)( newSourceRectHeight * widthZoomRatio ); //heightZoomRatio
- iDestinationSize.iHeight = (TInt)( newSourceRectWidth * heightZoomRatio ); //widthZoomRatio
- }
- else
- {
- iDestinationSize.iWidth = (TInt)( newSourceRectWidth * widthZoomRatio );
- iDestinationSize.iHeight = (TInt)( newSourceRectHeight * heightZoomRatio );
- }
- // Check that destination size is not rounded to zero
- if( iDestinationSize.iWidth == 0 )
- {
- iDestinationSize.iWidth = 1;
- }
- if( iDestinationSize.iHeight == 0 )
- {
- iDestinationSize.iHeight = 1;
- }
-
- // Move source rect keeping center point in same location
- iSourceRect.Move( ( oldSourceRectSize.iWidth - (TInt)newSourceRectWidth ) / 2,
- ( oldSourceRectSize.iHeight - (TInt)newSourceRectHeight ) / 2 );
-
- // Move rect if partially out of source area
- TPoint moveOffset( 0, 0 );
- if( iSourceRect.iTl.iX < 0 )
- {
- moveOffset.iX = -iSourceRect.iTl.iX;
- }
- else if( iSourceRect.iBr.iX > iSourceSize.iWidth )
- {
- moveOffset.iX = iSourceSize.iWidth - iSourceRect.iBr.iX;
- }
- if( iSourceRect.iTl.iY < 0 ) //lint !e961
- {
- moveOffset.iY = -iSourceRect.iTl.iY;
- }
- else if( iSourceRect.iBr.iY > iSourceSize.iHeight )
- {
- moveOffset.iY = iSourceSize.iHeight - iSourceRect.iBr.iY;
- }
- iSourceRect.Move( moveOffset ); //lint !e961
-
- // Assert that rectangle is valid, debug build only
-#ifdef _DEBUG
- AssertSourceRectAndDestinationSize();
-#endif
- }
-
-// -----------------------------------------------------------------------------
-// CIHLImageViewerExtJpg::AssertSourceRectAndDestinationSize
-// Used in debug build only
-// -----------------------------------------------------------------------------
-#ifdef _DEBUG
-void CIHLImageViewerExtJpg::AssertSourceRectAndDestinationSize()
- {
- if( iSourceRect.iTl.iX < 0 ||
- iSourceRect.iBr.iX > iSourceSize.iWidth ||
- iSourceRect.iTl.iY < 0 ||
- iSourceRect.iBr.iY > iSourceSize.iHeight ||
- iDestinationSize.iWidth <= 0 || iDestinationSize.iHeight <= 0 )
- {
- Panic( KErrGeneral );
- }
- }
-#endif
-
-// End of File
-
-
--- a/imagehandlinglib/Src/CIHLImageViewerExtJpg.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-/*
-* 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: Implementation of Image Viewer class.
-*
-*/
-
-
-#ifndef CIHLIMAGEVIEWEREXTJPG_H
-#define CIHLIMAGEVIEWEREXTJPG_H
-
-// INCLUDES
-#include "MIHLImageViewer.h"
-#include <e32base.h>
-
-//FORWARD DECLARATIONS
-class MIHLFileImageExtJpg;
-class MIHLBitmap;
-class MIHLViewerObserver;
-class CIHLBitmap;
-class CIHLBitmapProcessor;
-
-// CLASS DECLARATION
-/**
-* CIHLImageViewer
-*
-* Image Viewer implementation class.
-* @lib IHL.lib
-* @since 3.0
-*/
-NONSHARABLE_CLASS( CIHLImageViewerExtJpg ) : public CTimer, public MIHLImageViewer
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CIHLImageViewerExtJpg* NewL( const TSize& aViewerSize,
- MIHLFileImageExtJpg& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions );
-
- /*
- * Virtual destructor.
- */
- virtual ~CIHLImageViewerExtJpg();
-
- public: // From base class MIHLViewer
-
- /*
- * From MIHLViewer, see base class header.
- */
- TIHLInterfaceType Type() const;
-
- public:
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool IsAnimation() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- void Play();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- void Stop();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool IsPlaying() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt AnimationFrameCount() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt AnimationFrame() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetAnimationFrame( TInt aFrameIndex );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetViewerSize( const TSize& aViewerSize, TInt srcBitmapScaleFactor = 1 );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TSize ViewerSize() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt MoveSourceRect( TInt aDx, TInt aDy );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetSourceRectPosition( const TPoint& aPosition );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TRect SourceRect() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TSize SourceSize() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetZoomRatio( TReal aZoomRatio );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TReal ZoomRatio() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TReal ZoomToFitRatio() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt RotateClockwise();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt RotateCounterClockwise();
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetRotationAngle( TInt aRotationAngle );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt RotationAngle() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetVerticalMirroring( TBool aValue );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool VerticalMirroring() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TInt SetHorizontalMirroring( TBool aValue );
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- TBool HorizontalMirroring() const;
-
- /*
- * From MIHLImageViewer, see base class header.
- */
- void SetFilter( MIHLFilter* aFilter );
-
- public:
-
-
-
- public: // From base class CTimer
-
- /*
- * From CTimer, see base class header.
- */
- void DoCancel();
-
- /*
- * From CTimer, see base class header.
- */
- void RunL();
-
- /*
- * From CTimer, see base class header.
- */
- TInt RunError( TInt aError );
-
-
- private: // Private methods
-
- /*
- * Start asynchronous processing with new settings.
- * This is needed always when settings are changed.
- */
- TInt ApplySettings();
-
- /*
- * Start load process source bitmap.
- */
- TInt AsyncLoad();
-
- /*
- * Finish processing and notify client.
- */
- TInt Finish();
-
- /*
- * Complete dummy request. This causes RunL() method to be called.
- * Needed by state machine.
- */
- void SelfComplete();
-
- /*
- * Calculate source bitmap rectangle needed by processor.
- * Rectangle is affected by rotating and mirroring settings etc.
- */
- TRect CalculateProcessSourceRect( const TSize& aSourceCacheSize );
-
- /*
- * Calculate destination bitmap rectangle needed by processor.
- * Rectangle is affected by rotating and mirroring settings etc.
- */
- TRect CalculateProcessDestinationRect();
-
- /*
- * Calculate needed zoomratio for "fit-to-screen" zooming.
- */
- void CalculateZoomToFitRatio();
-
- /*
- * Calculate source bitmap rectangle and destination bitmap size.
- * These values needs to be recalculated when rectangle setting is changed.
- */
- void CalculateSourceRectAndDestinationSize();
-
- /*
- * Assert if source bitmap rectangle and destination bitmpa size are valid.
- * This method is called by CalculateSourceRectAndDestinationSize()
- */
-#ifdef _DEBUG
- void AssertSourceRectAndDestinationSize();
-#endif
-
- private: // Private constructors
-
- void ConstructL();
- CIHLImageViewerExtJpg( const TSize& aViewerSize,
- MIHLFileImageExtJpg& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions );
-
- private: // Private data types
-
- enum TViewerState
- {
- EInactive,
- ELoad,
- EProcess
- };
-
- private: // Data
-
- // Viewer state
- TViewerState iViewerState;
-
- // Ref: Observers
- MIHLViewerObserver& iObserver;
-
- // Ref: Viewer source image
- MIHLFileImageExtJpg& iSource;
- TSize iSourceSize;
- TRect iSourceRect;
-
- // Ref: Viewer destination bitmap
- MIHLBitmap& iDestination;
- TSize iDestinationSize;
-
- // Viewing settings
- const TUint32 iOptions;
- TSize iViewerSize;
- TReal iZoomRatio;
- TReal iZoomToFitRatio;
- TInt iRotationAngle;
- TBool iVerticalMirroring;
- TBool iHorizontalMirroring;
-
- // Decoder capabilities
- TInt iCapabilities;
-
- // Internal processor flag
- TBool iInternalProcessingNeeded;
-
- // Own: Bitmap caches
- CIHLBitmap* iCacheSource;
- CIHLBitmap* iCacheDestination;
- // Own: Bitmap processor
- CIHLBitmapProcessor* iProcessor;
- // src bitmap scale factor
- TInt iSrcBitmapScaleFactor;
-
- };
-
-#endif // CIHLIMAGEVIEWEREXTJPG_H
-
-// End of File
--- a/imagehandlinglib/Src/CIHLScaler.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1315 +0,0 @@
-/*
-* 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 Scaling processor
-* : using Font and Bitmap Server bitmaps.
-*
-*/
-
-// INCLUDE FILES
-#include "CIHLScaler.h"
-#include "IHLDebugPrint.h" // Debug print
-#include <MIHLImageViewer.h> // MIHLImageViewer
-#include <fbs.h>
-#include <hal.h>
-
-// Private namespace for constants and functions
-namespace
- {
- // Processed pixels per one activesheduler step
- const TInt KProcessPixelsPerStep = 16384;
-
- // These make the fast path scalings step out about every 5-10ms
- // no reason to cut more aggressively since it just slows down everything
- const TInt KBytesPerStepFastPath = 640*480;
- const TInt KBytesPerStepFastPathScaleOnly = 640*480*2;
-
- const TInt KStepPrecision = 16; // 16 bit = 65k subpixels
- const TInt KMaxProcessSize = KMaxTInt / 2;
- }
-
-//functions and typedefs used inside ProcessBilinear scaling
-namespace
- {
- // using our own RGB instead of TRGB as we need TInt32 for each value
- typedef struct
- {
- TInt32 r, g, b, a;
- } TColorRGB;
-
- // structure for handling data of 4 pixels
- typedef struct
- {
- TColorRGB colXY00, colXY01, colXY10, colXY11;
- TColorRGB col0, col1, col;
- } TPixelData;
-
- // functions to handle conversion between TColorRGB and colr value stored in TInt32
- inline void IntToRgb(TInt32 aIntRGB_val, TColorRGB &col)
- {
- col.r = (aIntRGB_val >> 16) & 0x00ff;
- col.g = (aIntRGB_val >> 8) & 0x00ff;
- col.b = aIntRGB_val & 0x00ff;
- col.a = (aIntRGB_val >> 24) & 0x00ff;
- }
- inline TUint32 RgbToInt(TColorRGB &col)
- {
- return 0x00000000 | ( ( col.r & 0xff) << 16 ) | ( ( col.g & 0xff) << 8 )
- | ( col.b & 0xff) | ( ( col.a & 0xff) << 24 );
- }
-
- // function which interpolates color using gathered data
- inline void ProcessColorData( TPixelData &dat, TPoint aSrcPos )
- {
- TInt32 pixel_width = 1 << KStepPrecision;
-
- //first pass (Y axis)
- dat.col0.r = (dat.colXY01.r - dat.colXY00.r)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY00.r;
- dat.col0.g = (dat.colXY01.g - dat.colXY00.g)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY00.g;
- dat.col0.b = (dat.colXY01.b - dat.colXY00.b)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY00.b;
- dat.col0.a = (dat.colXY01.a - dat.colXY00.a)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY00.a;
-
- dat.col1.r = (dat.colXY11.r - dat.colXY10.r)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY10.r;
- dat.col1.g = (dat.colXY11.g - dat.colXY10.g)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY10.g;
- dat.col1.b = (dat.colXY11.b - dat.colXY10.b)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY10.b;
- dat.col1.a = (dat.colXY11.a - dat.colXY10.a)*(aSrcPos.iY % pixel_width) / pixel_width + dat.colXY10.a;
-
- //second pass (X axis)
- dat.col.r = (dat.col1.r - dat.col0.r)*(aSrcPos.iX % pixel_width) / pixel_width + dat.col0.r;
- dat.col.g = (dat.col1.g - dat.col0.g)*(aSrcPos.iX % pixel_width) / pixel_width + dat.col0.g;
- dat.col.b = (dat.col1.b - dat.col0.b)*(aSrcPos.iX % pixel_width) / pixel_width + dat.col0.b;
- dat.col.a = (dat.col1.a - dat.col0.a)*(aSrcPos.iX % pixel_width) / pixel_width + dat.col0.a;
- }
- }
-
-// ======================== STATIC FACTORY FUNCTION ============================
-// -----------------------------------------------------------------------------
-// IHLScaler::CreateL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLScaler* IHLScaler::CreateL( const TUint32 aOptions )
- {
- return CIHLScaler::NewL( aOptions );
- }
-
-// ============================ MEMBER FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-//
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-CIHLScaler::CIHLScaler( const TUint32 aOptions )
-:CActive( CActive::EPriorityStandard ), iOptions( aOptions )
- {
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-//
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-CIHLScaler* CIHLScaler::NewL( const TUint32 aOptions )
- {
- CIHLScaler* self = new( ELeave ) CIHLScaler( aOptions );
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------------
-CIHLScaler::~CIHLScaler()
- {
- Cancel();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::Scale
-// -----------------------------------------------------------------------------
-TInt CIHLScaler::Scale( TRequestStatus& aStatus,
- const CFbsBitmap& aSrcBitmap, const TRect& aSrcRect,
- CFbsBitmap& aDstBitmap, const TRect& aDstRect )
- {
- if( IsBusy() )
- {
- return KErrNotReady;
- }
-
- TSize srcRectSize( aSrcRect.Size() );
- TSize dstRectSize( aDstRect.Size() );
- if( Abs( srcRectSize.iWidth ) > KMaxProcessSize ||
- Abs( srcRectSize.iHeight ) > KMaxProcessSize ||
- Abs( dstRectSize.iWidth ) > KMaxProcessSize ||
- Abs( dstRectSize.iHeight ) > KMaxProcessSize )
- {
- return KErrTooBig;
- }
-
- if( !aSrcBitmap.Handle() ||
- !IsValidRect( aSrcBitmap.SizeInPixels(), aSrcRect ) )
- {
- return KErrArgument;
- }
-
- if( aDstBitmap.Handle() )
- {
- if( !IsValidRect( aDstBitmap.SizeInPixels(), aDstRect ) )
- {
- return KErrArgument;
- }
- }
- else
- {
- // Create destination bitmap
- TSize dstSize( Abs( dstRectSize.iWidth ), Abs( dstRectSize.iHeight ) );
- TInt err = aDstBitmap.Create( dstSize, aSrcBitmap.DisplayMode() );
- if( err )
- {
- return err;
- }
- }
-
-#ifdef RD_MEASURE_THROUGHPUT
- iStartTime = User::FastCounter(); // For measuring scaler throughput
-#endif
-
- TSize srcSize( aSrcBitmap.SizeInPixels() );
- TSize dstSize( aDstBitmap.SizeInPixels() );
-
- if( srcSize.iWidth == 0 || srcSize.iHeight == 0 ||
- dstSize.iWidth == 0 || dstSize.iHeight == 0 ||
- aSrcRect.iTl.iX == aSrcRect.iBr.iX ||
- aSrcRect.iTl.iY == aSrcRect.iBr.iY ||
- aDstRect.iTl.iX == aDstRect.iBr.iX ||
- aDstRect.iTl.iY == aDstRect.iBr.iY )
- {
- // Bitmap or rect width or height is zero so there is nothing to do.
- // Complete process without error.
- iNeedProcess = EFalse;
- }
- else
- {
- iNeedProcess = ETrue;
-
- // Set parameters to member data references
- iSrcBitmap = &aSrcBitmap;
- iSrcRect = aSrcRect;
- iDstBitmap = &aDstBitmap;
- iDstRect = aDstRect;
-
- TDisplayMode srcMode(iSrcBitmap->DisplayMode());
- TDisplayMode dstMode(iDstBitmap->DisplayMode());
-
- IHL_DEBUG3( KIHLDebug1, "CIHLScaler: src bitmap size %dx%d", srcSize.iWidth, srcSize.iHeight);
- IHL_DEBUG3( KIHLDebug2, "CIHLScaler: dst bitmap size %dx%d", dstSize.iWidth, dstSize.iHeight);
- IHL_DEBUG5( KIHLDebug3, "CIHLScaler: src bitmap rect %d.%d -> %d.%d", iSrcRect.iTl.iX, iSrcRect.iTl.iY, iSrcRect.iBr.iX, iSrcRect.iBr.iY);
- IHL_DEBUG5( KIHLDebug4, "CIHLScaler: dst bitmap rect %d.%d -> %d.%d", iDstRect.iTl.iX, iDstRect.iTl.iY, iDstRect.iBr.iX, iDstRect.iBr.iY);
- IHL_DEBUG2( KIHLDebug5, "CIHLScaler: src bitmap mode %d", srcMode);
- IHL_DEBUG2( KIHLDebug6, "CIHLScaler: dst bitmap mode %d", dstMode);
- IHL_DEBUG2( KIHLDebug7, "CIHLScaler: src compressed %d", iSrcBitmap->IsCompressedInRAM());
- IHL_DEBUG2( KIHLDebug8, "CIHLScaler: dst compressed %d", iSrcBitmap->IsCompressedInRAM());
-
- // Init stepper values
- TBool onlyScaling = InitStepperValues();
-
- // Select correct code path
- InitCodePath(srcSize, srcMode, dstSize, dstMode, onlyScaling);
- }
-
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLScaler - Start bitmap scaling" );
-
- // Start processing
- iScalerStatus = &aStatus;
- *iScalerStatus = KRequestPending;
-
- SelfComplete();
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::IsBusy
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::IsBusy() const
- {
- return IsActive();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::CancelProcess
-// -----------------------------------------------------------------------------
-void CIHLScaler::CancelProcess()
- {
- Cancel();
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::SetFilter
-// -----------------------------------------------------------------------------
-void CIHLScaler::SetFilter( MIHFilter* /*aFilter*/ )
- {
- // Not in use
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::DoCancel
-// -----------------------------------------------------------------------------
-void CIHLScaler::DoCancel()
- {
- RequestComplete( KErrCancel );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::RunL
-// -----------------------------------------------------------------------------
-void CIHLScaler::RunL()
- {
- User::LeaveIfError( iStatus.Int() );
-
- // Process bitmap (this if-else may look weird but it removes one extra triggering of the AS
- if( iNeedProcess )
- {
- // Call the selected code path directly via a function pointer
- iNeedProcess = (this->*ProcessingFunc)();
- }
-
- if(!iNeedProcess)
- {
-#ifdef RD_MEASURE_THROUGHPUT
- // Calculate throughput
- TUint32 end = User::FastCounter();
-
- TInt tickPeriod;
- HAL::Get(HALData::EFastCounterFrequency, tickPeriod);
- TReal time = TReal(end-iStartTime) / TReal(tickPeriod);
- TReal bytes = iProcessSize.iWidth*iProcessSize.iHeight*2;
-
- IHL_DEBUG3("IHL - CIHLScaler - Scaling complete, %.3f ms, %.3f MB/s", time*1000.0, (bytes/time)/1024.0/1024.0);
-#else
- IHL_DEBUG1( KIHLDebug, "IHL - CIHLScaler - Scaling complete!" );
-#endif
- // Process complete
- RequestComplete( KErrNone );
- }
- else
- {
- // Another round
- SelfComplete();
- }
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::RunError
-// -----------------------------------------------------------------------------
-TInt CIHLScaler::RunError( TInt aError )
- {
- IHL_DEBUG2( KIHLDebug, "IHL - CIHLScaler - Scaling error: %d", aError );
-
- RequestComplete( aError );
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::IsValidRect
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::IsValidRect( const TSize& aSize, const TRect& aRect )
- {
- if( aRect.iTl.iX >= 0 &&
- aRect.iTl.iX <= aSize.iWidth &&
- aRect.iTl.iY >= 0 &&
- aRect.iTl.iY <= aSize.iHeight &&
- aRect.iBr.iX >= 0 &&
- aRect.iBr.iX <= aSize.iWidth &&
- aRect.iBr.iY >= 0 &&
- aRect.iBr.iY <= aSize.iHeight )
- {
- return ETrue;
- }
- return EFalse;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::InitStepperValues
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::InitStepperValues()
- {
- TBool onlyScaling = EFalse;
-
- TSize srcRectSize( Abs( iSrcRect.Width() ), Abs( iSrcRect.Height() ) );
- TSize dstRectSize( Abs( iDstRect.Width() ), Abs( iDstRect.Height() ) );
-
- TReal srcW = srcRectSize.iWidth << KStepPrecision;
- TReal srcH = srcRectSize.iHeight << KStepPrecision;
-
- // -----------------------------------------
- // Set source start point and increment
- // -----------------------------------------
- if( iSrcRect.iTl.iX > iSrcRect.iBr.iX &&
- iSrcRect.iTl.iY < iSrcRect.iBr.iY )
- {
- TReal incrementInner( srcH / TReal(dstRectSize.iWidth) );
- TReal incrementOuter( srcW / TReal(dstRectSize.iHeight) );
-
- iSrcIncrementInner.iX = 0;
- iSrcIncrementInner.iY = incrementInner;
- iSrcIncrementOuter.iX = -incrementOuter;
- iSrcIncrementOuter.iY = 0;
-
- iSrcPos.SetXY( (iSrcRect.iTl.iX << KStepPrecision) - (incrementOuter / 2.0),
- (iSrcRect.iTl.iY << KStepPrecision) + (incrementInner / 2.0) );
- }
- else if ( iSrcRect.iTl.iX > iSrcRect.iBr.iX &&
- iSrcRect.iTl.iY > iSrcRect.iBr.iY )
- {
- TReal incrementInner( srcW / TReal(dstRectSize.iWidth) );
- TReal incrementOuter( srcH / TReal(dstRectSize.iHeight) );
-
- iSrcIncrementInner.iX = -incrementInner;
- iSrcIncrementInner.iY = 0;
- iSrcIncrementOuter.iX = 0;
- iSrcIncrementOuter.iY = -incrementOuter;
-
- iSrcPos.SetXY( (iSrcRect.iTl.iX << KStepPrecision) - (incrementInner / 2.0),
- (iSrcRect.iTl.iY << KStepPrecision) - (incrementOuter / 2.0) );
- }
- else if ( iSrcRect.iTl.iX < iSrcRect.iBr.iX &&
- iSrcRect.iTl.iY > iSrcRect.iBr.iY )
- {
- TReal incrementInner( srcH / TReal(dstRectSize.iWidth) );
- TReal incrementOuter( srcW / TReal(dstRectSize.iHeight) );
-
- iSrcIncrementInner.iX = 0;
- iSrcIncrementInner.iY = -incrementInner;
- iSrcIncrementOuter.iX = incrementOuter;
- iSrcIncrementOuter.iY = 0;
-
- iSrcPos.SetXY( (iSrcRect.iTl.iX << KStepPrecision) + (incrementOuter / 2.0),
- (iSrcRect.iTl.iY << KStepPrecision) - (incrementInner / 2.0) );
- }
- else
- {
- TReal incrementInner( srcW / TReal(dstRectSize.iWidth) );
- TReal incrementOuter( srcH / TReal(dstRectSize.iHeight) );
-
- IHL_DEBUG3(KIHLDebug, "incrementInner: %f, incrementOuter: %f", incrementInner, incrementOuter);
-
- iSrcIncrementInner.iX = incrementInner;
- iSrcIncrementInner.iY = 0;
- iSrcIncrementOuter.iX = 0;
- iSrcIncrementOuter.iY = incrementOuter;
-
- iSrcPos.SetXY( (iSrcRect.iTl.iX << KStepPrecision) + (incrementInner / 2.0),
- (iSrcRect.iTl.iY << KStepPrecision) + (incrementOuter / 2.0) );
-
- onlyScaling = ETrue;
- }
-
- // -----------------------------------------
- // Set destination start point and increment
- // -----------------------------------------
-
- iDstPos.iX = iDstRect.iTl.iX;
- iDstIncrementInner = 1;
- iDstPos.iY = iDstRect.iTl.iY;
- iDstIncrementOuter = 1;
-
- if( iDstRect.iTl.iX > iDstRect.iBr.iX )
- {
- // From right to left
- iDstPos.iX--;
- iDstIncrementInner = -1;
- onlyScaling = EFalse;
- }
-
- if( iDstRect.iTl.iY > iDstRect.iBr.iY )
- {
- // From bottom to up
- iDstPos.iY--;
- iDstIncrementOuter = -1;
- onlyScaling = EFalse;
- }
-
- // -----------------------------------------
- // Reset process counters
- // -----------------------------------------
- iProcessInner = 0;
- iProcessOuter = 0;
- iProcessSize = dstRectSize;
-
- // These are for fast code path
-
- // Init how many scanlines to process
- iScanlinesLeft = iProcessSize.iHeight;
-
- return onlyScaling;
- }
-
-
-// Optimize the fast code paths properly for ARM
-#ifdef __ARMCC__
-#pragma push
-#pragma O3
-#pragma Otime
-#pragma arm
-#endif
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::ProcessNearestNeighbour64K
-// Description: Scales & rotates 64K color bitmaps
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::ProcessNearestNeighbour64K()
- {
- // Lock bitmap heaps
- iSrcBitmap->LockHeap();
- iDstBitmap->LockHeap();
-
- // Pointers to start of bitmap data
- TUint16 *srcBitmapPtr = (TUint16*)iSrcBitmap->DataAddress();
- TUint16 *dstBitmapPtr = (TUint16*)iDstBitmap->DataAddress();
-
- // Get pointer to correct destination pixel (offset is updated after every round)
- register TUint16* dst = dstBitmapPtr + iDstStartOffset;
-
- TUint32 width = iProcessSize.iWidth;
-
- // Check how many scanlines we can process this round
- register TUint32 scanlinesLeft = iScanlinesLeft;
- if(scanlinesLeft>iScanlinesPerRound)
- {
- scanlinesLeft = iScanlinesPerRound;
- }
-
- // How many scanlines left for the next round
- iScanlinesLeft-=scanlinesLeft;
-
- // Faster access to variables (it's slow to use member variables)
- register TInt srcPosX(iSrcPos.iX);
- register TInt srcPosY(iSrcPos.iY);
- register TInt srcPitch = iSrcPitchInPixels;
-
- TInt incOuterSrcX = (-iSrcIncrementInner.iX * width) + iSrcIncrementOuter.iX;
- TInt incOuterSrcY = (-iSrcIncrementInner.iY * width) + iSrcIncrementOuter.iY;
-
- while(scanlinesLeft!=0)
- {
- for(register TUint32 x = width; x!=0; x--)
- {
- register TUint16* src = srcBitmapPtr + ((srcPosY >> KStepPrecision) * srcPitch) + (srcPosX>>KStepPrecision);
- *dst = *src;
-
- // Add inner counters
- srcPosX+=iSrcIncrementInner.iX;
- srcPosY+=iSrcIncrementInner.iY;
-
- dst+=iDstIncrementInner;
- }
-
- // Reset inner counters and add outer counters
- srcPosX += incOuterSrcX;
- srcPosY += incOuterSrcY;
-
- // Move destination pointer to next pixel
- dst += iDstResidualPixels;
-
- // One scanline done, n to go
- scanlinesLeft--;
- }
- // Unlock bitmap heaps
- iDstBitmap->UnlockHeap();
- iSrcBitmap->UnlockHeap();
-
- if(iScanlinesLeft)
- {
- // Not all scanlines were processed yet
-
- // Save the necessary offsets for next round
- iSrcPos.iX = srcPosX;
- iSrcPos.iY = srcPosY;
- iDstStartOffset = dst - dstBitmapPtr;
-
- return ETrue;
- }
-
- // Processing done
- return EFalse;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::ProcessNearestNeighbour64KScaleOnly
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::ProcessNearestNeighbour64KScaleOnly()
- {
- // Lock bitmap heaps
- iSrcBitmap->LockHeap();
- iDstBitmap->LockHeap();
-
- // Get bitmap data start addresses
- TUint16 *srcBitmapPtr = (TUint16*)iSrcBitmap->DataAddress();
- TUint16 *dstBitmapPtr = (TUint16*)iDstBitmap->DataAddress();
-
- // Target height and width
- TInt width = iProcessSize.iWidth;
-
- // fixed point source coordinates
- TInt startX = iSrcPos.iX;
- TInt srcY = iSrcPos.iY;
-
- // How much to increase src position (in fixed point)
- TInt srcYIncrement = iSrcIncrementOuter.iY;
- register TInt srcXIncrement = iSrcIncrementInner.iX;
-
- // Set pointers to correct location (src = start of scanline, dst = start pixel)
- register TUint16* dst = dstBitmapPtr + iDstStartOffset;
-
- // Calculate how many scanlines we can process this round
- register TInt scanlinesLeft = iScanlinesLeft;
- if(scanlinesLeft>iScanlinesPerRound)
- {
- scanlinesLeft = iScanlinesPerRound;
- }
-
- iScanlinesLeft-=scanlinesLeft;
-
- while(scanlinesLeft--)
- {
- // Outer loop
-
- // Reset src X and scanline pointer
- register TInt srcX = startX;
- register TUint16* src = srcBitmapPtr + (srcY >> KStepPrecision) * iSrcPitchInPixels;
-
- // Init pixel counter
- register TUint32 pixels = width;
-
- // Unaligned pixels to the left of 8B-aligned section
- while((TUint32(dst)&0x7) && pixels)
- {
- *dst++ = (*(src + (srcX >> KStepPrecision)));
-
- srcX += srcXIncrement;
-
- pixels--;
- }
-
- // Aligned middle section
- register TUint32 middle = pixels&0xFFFFFFFC;
- pixels &= 0x3;
-
- while(middle)
- {
- // Read four pixels
- register TUint16 p1 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
- register TUint16 p2 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
- register TUint16 p3 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
- register TUint16 p4 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
-
- // Write four pixels
- *(dst++) = p1;
- *(dst++) = p2;
- *(dst++) = p3;
- *(dst++) = p4;
-
- middle-=4;
- }
-
- // Unaligned residual pixels to the right of 8-aligned section
- while(pixels)
- {
- *dst++ = (*(src + (srcX >> KStepPrecision)));
-
- srcX += srcXIncrement;
-
- pixels--;
- }
-
- // Move to next correct src scanline
- srcY += srcYIncrement;
-
- // Advance dst to start of correct pixel in the next row
- dst += iDstResidualPixels;
- }
-
- iDstBitmap->UnlockHeap();
- iSrcBitmap->UnlockHeap();
-
- if(iScanlinesLeft)
- {
- // Not all scanlines were processed yet
-
- // Save the necessary offsets for next round
- iSrcPos.iY = srcY;
- iDstStartOffset = dst - dstBitmapPtr;
-
- return ETrue;
- }
-
- return EFalse;
-
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::ProcessNearestNeighbour16MX
-// Description: Scales & rotates 16MU/MA color bitmaps
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::ProcessNearestNeighbour16MX()
- {
- // Lock bitmap heaps
- iSrcBitmap->LockHeap();
- iDstBitmap->LockHeap();
-
- // Pointers to start of bitmap data
- TUint32 *srcBitmapPtr = (TUint32*)iSrcBitmap->DataAddress();
- TUint32 *dstBitmapPtr = (TUint32*)iDstBitmap->DataAddress();
-
- // Get pointer to correct destination pixel (offset is updated after every round)
- register TUint32* dst = dstBitmapPtr + iDstStartOffset;
-
- TUint32 width = iProcessSize.iWidth;
-
- // Check how many scanlines we can process this round
- register TUint32 scanlinesLeft = iScanlinesLeft;
- if(scanlinesLeft>iScanlinesPerRound)
- {
- scanlinesLeft = iScanlinesPerRound;
- }
-
- // How many scanlines left for the next round
- iScanlinesLeft-=scanlinesLeft;
-
- // Faster access to variables (it's slow to use member variables)
- register TInt srcPosX(iSrcPos.iX);
- register TInt srcPosY(iSrcPos.iY);
- register TInt srcPitch = iSrcPitchInPixels;
-
- TInt incOuterSrcX = (-iSrcIncrementInner.iX * width) + iSrcIncrementOuter.iX;
- TInt incOuterSrcY = (-iSrcIncrementInner.iY * width) + iSrcIncrementOuter.iY;
-
- while(scanlinesLeft!=0)
- {
- for(register TUint32 x = width; x!=0; x--)
- {
- register TUint32* src = srcBitmapPtr + ((srcPosY >> KStepPrecision) * srcPitch) + (srcPosX>>KStepPrecision);
- *dst = *src;
-
- // Add inner counters
- srcPosX+=iSrcIncrementInner.iX;
- srcPosY+=iSrcIncrementInner.iY;
-
- dst+=iDstIncrementInner;
- }
-
- // Reset inner counters and add outer counters
- srcPosX += incOuterSrcX;
- srcPosY += incOuterSrcY;
-
- // Move destination pointer to next pixel
- dst += iDstResidualPixels;
-
- // One scanline done, n to go
- scanlinesLeft--;
- }
- // Unlock bitmap heaps
- iDstBitmap->UnlockHeap();
- iSrcBitmap->UnlockHeap();
-
- if(iScanlinesLeft)
- {
- // Not all scanlines were processed yet
-
- // Save the necessary offsets for next round
- iSrcPos.iX = srcPosX;
- iSrcPos.iY = srcPosY;
- iDstStartOffset = dst - dstBitmapPtr;
-
- return ETrue;
- }
-
- // Processing done
- return EFalse;
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::ProcessNearestNeighbour64KScaleOnly
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::ProcessNearestNeighbour16MXScaleOnly()
- {
- // Lock bitmap heaps
- iSrcBitmap->LockHeap();
- iDstBitmap->LockHeap();
-
- // Get bitmap data start addresses
- TUint32 *srcBitmapPtr = (TUint32*)iSrcBitmap->DataAddress();
- TUint32 *dstBitmapPtr = (TUint32*)iDstBitmap->DataAddress();
-
- // Target height and width
- TInt width = iProcessSize.iWidth;
-
- // fixed point source coordinates
- TInt startX = iSrcPos.iX;
- TInt srcY = iSrcPos.iY;
-
- // How much to increase src position (in fixed point)
- TInt srcYIncrement = iSrcIncrementOuter.iY;
- register TInt srcXIncrement = iSrcIncrementInner.iX;
-
- // Set pointers to correct location (src = start of scanline, dst = start pixel)
- register TUint32* dst = dstBitmapPtr + iDstStartOffset;
-
- // Calculate how many scanlines we can process this round
- register TInt scanlinesLeft = iScanlinesLeft;
- if(scanlinesLeft>iScanlinesPerRound)
- {
- scanlinesLeft = iScanlinesPerRound;
- }
-
- iScanlinesLeft-=scanlinesLeft;
-
- while(scanlinesLeft--)
- {
- // Outer loop
-
- // Reset src X and scanline pointer
- register TInt srcX = startX;
- register TUint32* src = srcBitmapPtr + (srcY >> KStepPrecision) * iSrcPitchInPixels;
-
- // Init pixel counter
- register TUint32 pixels = width;
-
- // Unaligned pixels to the left of 16B-aligned section
- while((TUint32(dst)&0xF) && pixels)
- {
- *dst++ = (*(src + (srcX >> KStepPrecision)));
-
- srcX += srcXIncrement;
-
- pixels--;
- }
-
- // Aligned middle section
- register TUint32 middle = pixels&0xFFFFFFFC;
- pixels &= 0x3;
-
- while(middle)
- {
- // Read four pixels
- register TUint32 p1 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
- register TUint32 p2 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
- register TUint32 p3 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
- register TUint32 p4 = (*(src + (srcX >> KStepPrecision)));
- srcX += srcXIncrement;
-
- // Write four pixels
- *(dst+0) = p1;
- *(dst+1) = p2;
- *(dst+2) = p3;
- *(dst+3) = p4;
-
- middle-=4;
- dst+=4;
- }
-
- // Unaligned residual pixels to the right of 8-aligned section
- while(pixels)
- {
- *dst++ = (*(src + (srcX >> KStepPrecision)));
-
- srcX += srcXIncrement;
-
- pixels--;
- }
-
- // Move to next correct src scanline
- srcY += srcYIncrement;
-
- // Advance dst to start of correct pixel in the next row
- dst += iDstResidualPixels;
- }
-
- iDstBitmap->UnlockHeap();
- iSrcBitmap->UnlockHeap();
-
- if(iScanlinesLeft)
- {
- // Not all scanlines were processed yet
-
- // Save the necessary offsets for next round
- iSrcPos.iY = srcY;
- iDstStartOffset = dst - dstBitmapPtr;
-
- return ETrue;
- }
-
- return EFalse;
-
- }
-
-// Restore previous pragma state
-#ifdef __ARMCC__
-#pragma pop
-#endif
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::ProcessNearestNeighbour
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::ProcessNearestNeighbour()
- {
- // Util needs non-const pointers even if it's only used for reading pixels
- TBitmapUtil srcBitmap( const_cast<CFbsBitmap*>( iSrcBitmap ) );
- TBitmapUtil dstBitmap( iDstBitmap );
- srcBitmap.Begin( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.Begin( iDstPos ); // heap already locked by srcBitmap
- TInt pixelCounter( KProcessPixelsPerStep );
-
- // Start outer and inner process loops
- while( iProcessOuter < iProcessSize.iHeight && pixelCounter )
- {
- while( iProcessInner < iProcessSize.iWidth && pixelCounter )
- {
- srcBitmap.SetPos( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.SetPos( iDstPos );
- dstBitmap.SetPixel( srcBitmap );
-
- // Add inner counters
- iSrcPos += iSrcIncrementInner;
- iDstPos.iX += iDstIncrementInner;
- ++iProcessInner;
- --pixelCounter;
- }
- // Check if inner loop is finished (not just pixel counter)
- if( iProcessInner == iProcessSize.iWidth )
- {
- // Reset inner counters
- iSrcPos.iX -= iSrcIncrementInner.iX * iProcessInner;
- iSrcPos.iY -= iSrcIncrementInner.iY * iProcessInner;
-
- iDstPos.iX -= iDstIncrementInner * iProcessInner;
- iProcessInner = 0;
-
- // Add outer counters
- iSrcPos += iSrcIncrementOuter;
- iDstPos.iY += iDstIncrementOuter;
- ++iProcessOuter;
- }
- }
-
- // Release heap lock
- dstBitmap.End();
- srcBitmap.End();
-
- // ETrue if more processing is still needed
- return ( iProcessOuter < iProcessSize.iHeight );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::ProcessBilinear
-// -----------------------------------------------------------------------------
-TBool CIHLScaler::ProcessBilinear()
- {
- // Util needs non-const pointers
- //even if it's only used for reading pixels
- TBitmapUtil srcBitmap( const_cast<CFbsBitmap*>( iSrcBitmap ) );
- TBitmapUtil dstBitmap( iDstBitmap );
-
- srcBitmap.Begin( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.Begin( iDstPos ); // heap already locked by srcBitmap
- TInt pixelCounter( KProcessPixelsPerStep );
-
- TInt incSrcX = iSrcIncrementInner.iX + iSrcIncrementOuter.iX;
- TInt incSrcY = iSrcIncrementInner.iY + iSrcIncrementOuter.iY;
-
- TPixelData pixelData;
- TUint32 color;
-
- TInt32 pixel_width = 1 << KStepPrecision;
-
- //if there is no scaling then process through loop using NearestNeighbour alghoritm
- if ( incSrcX == pixel_width || -incSrcX == pixel_width )
- {
- while( iProcessOuter < iProcessSize.iHeight && pixelCounter )
- {
- while( iProcessInner < iProcessSize.iWidth && pixelCounter )
- {
- srcBitmap.SetPos( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.SetPos( iDstPos );
- dstBitmap.SetPixel( srcBitmap );
-
- // Add inner counters
- iSrcPos += iSrcIncrementInner;
- iDstPos.iX += iDstIncrementInner;
- ++iProcessInner;
- --pixelCounter;
- }
-
- // Check if inner loop is finished (not just pixel counter)
- if( iProcessInner == iProcessSize.iWidth )
- {
- // Reset inner counters
- iSrcPos.iX -= iSrcIncrementInner.iX * iProcessInner;
- iSrcPos.iY -= iSrcIncrementInner.iY * iProcessInner;
-
- iDstPos.iX -= iDstIncrementInner * iProcessInner;
- iProcessInner = 0;
-
- // Add outer counters
- iSrcPos += iSrcIncrementOuter;
- iDstPos.iY += iDstIncrementOuter;
- ++iProcessOuter;
- }
- }
- }
- // Process using bilinear method according to
- // orientation between source and destination bitmap
- //
- // There are 4 possibilities of orientation and can be
- // determined by this if we're increasing or decreasing
- // position on source bitmap.
- else if ( ( incSrcY >= 0) && (incSrcX >= 0 ) )
- {
- while( iProcessOuter < iProcessSize.iHeight && pixelCounter )
- {
- while( iProcessInner < iProcessSize.iWidth && pixelCounter )
- {
- srcBitmap.SetPos( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.SetPos( iDstPos );
-
- // gather pixel data with step:
- // 00 > 10
- // V
- // 01 < 11
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY00);
- srcBitmap.IncXPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY10);
- srcBitmap.IncYPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY11);
- srcBitmap.DecXPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY01);
- //return to starting position
- srcBitmap.DecYPos();
-
- // interpolate color using gathered pixel-data
- ProcessColorData(pixelData, iSrcPos);
-
- // put color in destination package
- color = RgbToInt(pixelData.col);
- dstBitmap.SetPixel(color);
-
- // Add inner counters
- iSrcPos += iSrcIncrementInner;
- iDstPos.iX += iDstIncrementInner;
- ++iProcessInner;
- --pixelCounter;
- }
-
- // Check if inner loop is finished (not just pixel counter)
- if( iProcessInner == iProcessSize.iWidth )
- {
- // Reset inner counters
- iSrcPos.iX -= iSrcIncrementInner.iX * iProcessInner;
- iSrcPos.iY -= iSrcIncrementInner.iY * iProcessInner;
-
- iDstPos.iX -= iDstIncrementInner * iProcessInner;
- iProcessInner = 0;
-
- // Add outer counters
- iSrcPos += iSrcIncrementOuter;
- iDstPos.iY += iDstIncrementOuter;
- ++iProcessOuter;
- }
- }
- }
- else if ( ( incSrcY >= 0) && (incSrcX < 0 ) )
- {
- while( iProcessOuter < iProcessSize.iHeight && pixelCounter )
- {
- while( iProcessInner < iProcessSize.iWidth && pixelCounter )
- {
- srcBitmap.SetPos( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.SetPos( iDstPos );
-
- // gather pixel data with step:
- // 00 10
- // /\ V
- // 01 < 11
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY10);
- srcBitmap.IncYPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY11);
- srcBitmap.DecXPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY01);
- srcBitmap.DecYPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY00);
- //return to starting position
- srcBitmap.IncXPos();
-
- // interpolate color using gathered pixel-data
- ProcessColorData(pixelData, iSrcPos);
-
- // put color in destination package
- color = RgbToInt(pixelData.col);
- dstBitmap.SetPixel(color);
-
- // Add inner counters
- iSrcPos += iSrcIncrementInner;
- iDstPos.iX += iDstIncrementInner;
- ++iProcessInner;
- --pixelCounter;
- }
-
- // Check if inner loop is finished (not just pixel counter)
- if( iProcessInner == iProcessSize.iWidth )
- {
- // Reset inner counters
- iSrcPos.iX -= iSrcIncrementInner.iX * iProcessInner;
- iSrcPos.iY -= iSrcIncrementInner.iY * iProcessInner;
-
- iDstPos.iX -= iDstIncrementInner * iProcessInner;
- iProcessInner = 0;
-
- // Add outer counters
- iSrcPos += iSrcIncrementOuter;
- iDstPos.iY += iDstIncrementOuter;
- ++iProcessOuter;
- }
-
- }
- }
- else if ( ( incSrcY < 0) && (incSrcX >= 0 ) )
- {
- while( iProcessOuter < iProcessSize.iHeight && pixelCounter )
- {
- while( iProcessInner < iProcessSize.iWidth && pixelCounter )
- {
- srcBitmap.SetPos( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.SetPos( iDstPos );
-
- // gather pixel data with step:
- // 00 > 10
- // /\ V
- // 01 11
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY01);
- srcBitmap.DecYPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY00);
- srcBitmap.IncXPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY10);
- srcBitmap.IncYPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY11);
- //return to starting position
- srcBitmap.DecXPos();
-
- // interpolate color using gathered pixel-data
- ProcessColorData(pixelData, iSrcPos);
-
- // put color in destination package
- color = RgbToInt(pixelData.col);
- dstBitmap.SetPixel(color);
-
- // Add inner counters
- iSrcPos += iSrcIncrementInner;
- iDstPos.iX += iDstIncrementInner;
- ++iProcessInner;
- --pixelCounter;
- }
-
- // Check if inner loop is finished (not just pixel counter)
- if( iProcessInner == iProcessSize.iWidth )
- {
- // Reset inner counters
- iSrcPos.iX -= iSrcIncrementInner.iX * iProcessInner;
- iSrcPos.iY -= iSrcIncrementInner.iY * iProcessInner;
-
- iDstPos.iX -= iDstIncrementInner * iProcessInner;
- iProcessInner = 0;
-
- // Add outer counters
- iSrcPos += iSrcIncrementOuter;
- iDstPos.iY += iDstIncrementOuter;
- ++iProcessOuter;
- }
- }
- }
- else
- {
- while( iProcessOuter < iProcessSize.iHeight && pixelCounter )
- {
- while( iProcessInner < iProcessSize.iWidth && pixelCounter )
- {
- srcBitmap.SetPos( TPoint( iSrcPos.iX >> KStepPrecision, iSrcPos.iY >> KStepPrecision ) );
- dstBitmap.SetPos( iDstPos );
-
- // gather pixel data with step:
- // 00 > 10
- // /\
- // 01 < 11
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY11);
- srcBitmap.DecXPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY01);
- srcBitmap.DecYPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY00);
- srcBitmap.IncXPos();
- IntToRgb(srcBitmap.GetPixel(),pixelData.colXY10);
- //return to starting position
- srcBitmap.IncYPos();
-
- // interpolate color using gathered pixel-data
- ProcessColorData(pixelData, iSrcPos);
-
- // put color in destination package
- color = RgbToInt(pixelData.col);
- dstBitmap.SetPixel(color);
-
- // Add inner counters
- iSrcPos += iSrcIncrementInner;
- iDstPos.iX += iDstIncrementInner;
- ++iProcessInner;
- --pixelCounter;
- }
-
- // Check if inner loop is finished (not just pixel counter)
- if( iProcessInner == iProcessSize.iWidth )
- {
- // Reset inner counters
- iSrcPos.iX -= iSrcIncrementInner.iX * iProcessInner;
- iSrcPos.iY -= iSrcIncrementInner.iY * iProcessInner;
-
- iDstPos.iX -= iDstIncrementInner * iProcessInner;
- iProcessInner = 0;
-
- // Add outer counters
- iSrcPos += iSrcIncrementOuter;
- iDstPos.iY += iDstIncrementOuter;
- ++iProcessOuter;
- }
-
- }
- }
-
- // Release heap lock
- dstBitmap.End();
- srcBitmap.End();
-
- // ETrue if more processing is still needed
- return ( iProcessOuter < iProcessSize.iHeight );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::SelfComplete
-// -----------------------------------------------------------------------------
-void CIHLScaler::SelfComplete()
- {
- SetActive();
- iStatus = KRequestPending;
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::RequestComplete
-// -----------------------------------------------------------------------------
-void CIHLScaler::RequestComplete( TInt aReason )
- {
- ASSERT( iScalerStatus );
- User::RequestComplete( iScalerStatus, aReason );
- }
-
-// -----------------------------------------------------------------------------
-// CIHLScaler::InitCodePath
-// -----------------------------------------------------------------------------
-void CIHLScaler::InitCodePath(const TSize& aSrcSize, const TDisplayMode &aSrcMode, const TSize& aDstSize, const TDisplayMode &aDstMode, TBool aOnlyScaling)
- {
- // Choose the correct processing code path
- ProcessingFunc = &CIHLScaler::ProcessNearestNeighbour;
-
- if( iOptions & MIHLImageViewer::EOptionUseBilinearInterpolation )
- {
- // TODO: optimize bilinear scaling
- IHL_DEBUG("CIHLScaler::InitCodePath: slow bilinear");
- ProcessingFunc = &CIHLScaler::ProcessBilinear;
- iScanlinesPerRound = KProcessPixelsPerStep / iProcessSize.iWidth;
- }
- else if(aSrcMode == EColor64K && aSrcMode==aDstMode && !iSrcBitmap->IsCompressedInRAM() && !iDstBitmap->IsCompressedInRAM())
- {
- // 16 bit non-compressed bitmaps
-
- // Calculate how many pixels the scanline is actually wide in the memory
- iSrcPitchInPixels = CFbsBitmap::ScanLineLength( aSrcSize.iWidth, aSrcMode ) >> 1;
- iDstPitchInPixels = CFbsBitmap::ScanLineLength( aDstSize.iWidth, aDstMode ) >> 1;
-
- // How many pixels to move destination pointer at the end of each scanline to get to next pixel
- iDstResidualPixels = iDstIncrementOuter*iDstPitchInPixels - iDstIncrementInner*iProcessSize.iWidth;
-
- // Buffer offset to the first destination pixel
- iDstStartOffset = iDstPos.iY * iDstPitchInPixels + iDstPos.iX;
-
- if(!aOnlyScaling)
- {
- IHL_DEBUG("CIHLScaler::InitCodePath: fast 64K scale&rotate");
- ProcessingFunc = &CIHLScaler::ProcessNearestNeighbour64K;
-
- // Calculate how often the process should allow AS to run
- iScanlinesPerRound = KBytesPerStepFastPath / (iProcessSize.iWidth<<1);
- }
- else
- {
- IHL_DEBUG("CIHLScaler::InitCodePath: fast 64K scale only");
- ProcessingFunc = &CIHLScaler::ProcessNearestNeighbour64KScaleOnly;
-
- // Calculate how often the process should allow AS to run
- iScanlinesPerRound = KBytesPerStepFastPathScaleOnly / (iProcessSize.iWidth<<1);
- }
- }
-
- else if((aSrcMode == EColor16MU || aSrcMode == EColor16MA) && aSrcMode==aDstMode && !iSrcBitmap->IsCompressedInRAM() && !iDstBitmap->IsCompressedInRAM())
- {
- // 32 bit non-compressed bitmaps
-
- // Calculate how many pixels the scanline is actually wide in the memory
- iSrcPitchInPixels = CFbsBitmap::ScanLineLength( aSrcSize.iWidth, aSrcMode ) >> 2;
- iDstPitchInPixels = CFbsBitmap::ScanLineLength( aDstSize.iWidth, aDstMode ) >> 2;
-
- // How many pixels to move destination pointer at the end of each scanline to get to next pixel
- iDstResidualPixels = iDstIncrementOuter*iDstPitchInPixels - iDstIncrementInner*iProcessSize.iWidth;
-
- // Buffer offset to the first destination pixel
- iDstStartOffset = iDstPos.iY * iDstPitchInPixels + iDstPos.iX;
-
- if(!aOnlyScaling)
- {
- IHL_DEBUG("CIHLScaler::InitCodePath: fast 16MX scale&rotate");
- ProcessingFunc = &CIHLScaler::ProcessNearestNeighbour16MX;
-
- // Calculate how often the process should allow AS to run
- iScanlinesPerRound = KBytesPerStepFastPath / (iProcessSize.iWidth<<2);
- }
- else
- {
- IHL_DEBUG("CIHLScaler::InitCodePath: fast 16MX scale only");
- ProcessingFunc = &CIHLScaler::ProcessNearestNeighbour16MXScaleOnly;
-
- // Calculate how often the process should allow AS to run
- iScanlinesPerRound = KBytesPerStepFastPathScaleOnly / (iProcessSize.iWidth<<2);
- }
- }
- else
- {
- IHL_DEBUG("CIHLScaler::InitCodePath: slow nearest neighbor");
- iScanlinesPerRound = KProcessPixelsPerStep / iProcessSize.iWidth;
- }
-
- IHL_DEBUG2(KIHLDebug, "CIHLScaler::InitCodePath: scanlines per round = %d", iScanlinesPerRound);
- }
-
-// End of File
--- a/imagehandlinglib/Src/CIHLScaler.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
-* 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 bitmap scaler class
-* : using Font and Bitmap Server bitmaps.
-*
-*/
-
-#ifndef CIHLSCALER_H
-#define CIHLSCALER_H
-
-// INCLUDES
-#include <MIHLScaler.h>
-#include <e32base.h>
-#include <gdi.h>
-
-// Define this to show throughput measurements
-//#define RD_MEASURE_THROUGHPUT
-
-// FORWARD DECLARATIONS
-class CFbsBitmap;
-
-// CLASS DECLARATION
-/**
-* CIHLScaler
-*
-* Implementation of Scaling processor
-* using Font and Bitmap Server bitmaps.
-* @lib IHL.lib
-* @since 3.0
-*/
-NONSHARABLE_CLASS( CIHLScaler ) : public CActive, public MIHLScaler
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor.
- */
- static CIHLScaler* NewL( const TUint32 aOptions = 0 );
-
- /*
- * Virtual destructor.
- */
- virtual ~CIHLScaler();
-
- public: // From base class MIHLScaler
-
- /*
- * From MIHLScaler, see base class header.
- */
- TInt Scale( TRequestStatus& aStatus,
- const CFbsBitmap& aSrcBitmap,
- const TRect& aSrcRect,
- CFbsBitmap& aDstBitmap,
- const TRect& aDstRect );
-
- /*
- * From MIHLScaler, see base class header.
- */
- TBool IsBusy() const;
-
- /*
- * From MIHLScaler, see base class header.
- */
- void CancelProcess();
-
- /*
- * From MIHLScaler, see base class header.
- */
- void SetFilter( MIHFilter* aFilter );
-
- private: // From base class CActive
-
- /*
- * From CActive, see base class header.
- */
- void DoCancel();
-
- /*
- * From CActive, see base class header.
- */
- void RunL();
-
- /*
- * From CActive, see base class header.
- */
- TInt RunError( TInt aError );
-
- public: // Internal interface
-
- /**
- * Check if rectangle is inside size.
- * @since 3.0
- * @return ETrue if rectangle is fully inside given area, EFalse if not.
- */
- TBool IsValidRect( const TSize& aSize, const TRect& aRect );
-
- private: // Private methods
-
- /*
- * Initialize process parameters and stepper values.
- * @return ETrue if only doing scaling (and not rotating)
- */
- TBool InitStepperValues();
-
- /*
- * Select and initialize fastest possible code path
- */
-
- void InitCodePath(const TSize& aSrcSize, const TDisplayMode &aSrcMode, const TSize& aDstSize, const TDisplayMode &aDstMode, TBool aOnlyScaling);
-
- /*
- * Process step using nearest neighbour method.
- */
- TBool ProcessNearestNeighbour();
- TBool ProcessNearestNeighbour64K(); // For 16-bit non-compressed bitmaps
- TBool ProcessNearestNeighbour64KScaleOnly(); // For 16-bit non-compressed bitmaps (only scaling)
- TBool ProcessNearestNeighbour16MX(); // For 32-bit non-compressed bitmaps
- TBool ProcessNearestNeighbour16MXScaleOnly(); // For 32-bit non-compressed bitmaps (only scaling)
-
- /*
- * Process step using bilinear interpolation method.
- */
- TBool ProcessBilinear();
-
- /*
- * Complete dummy request. This causes RunL() method to be called.
- * Needed by state machine.
- */
- void SelfComplete();
-
- /*
- * Complete client process request.
- * This causes client RunL() method to be called.
- */
- void RequestComplete( TInt aReason );
-
- private: // Private constructors
-
- CIHLScaler( const TUint32 aOptions );
-
- private: // Data
-
- // Ref: Process status
- TRequestStatus* iScalerStatus;
- TBool iNeedProcess;
-
- // Process options
- const TUint32 iOptions;
-
- // Ref: Source bitmap
- const CFbsBitmap* iSrcBitmap;
- TRect iSrcRect;
-
- // Ref: Destination bitmaps
- CFbsBitmap* iDstBitmap;
- TRect iDstRect;
-
- // Process position and stepping
- TPoint iSrcIncrementInner;
- TPoint iSrcIncrementOuter;
- TPoint iSrcPos;
-
- TInt iDstIncrementInner;
- TInt iDstIncrementOuter;
- TPoint iDstPos;
-
- TInt iProcessInner;
- TInt iProcessOuter;
- TSize iProcessSize;
-
- // For fast code path
- TInt iSrcPitchInPixels;
- TInt iDstPitchInPixels;
- TUint32 iScanlinesLeft;
- TUint32 iScanlinesPerRound;
- TInt iDstStartOffset;
- TInt iDstResidualPixels;
-
- // Only for measuring scaler throughput
-#ifdef RD_MEASURE_THROUGHPUT
- TUint32 iStartTime;
-#endif
-
- /*
- * Forward process step event to selected processing code path
- * Called by RunL() method.
- */
- TBool (CIHLScaler::*ProcessingFunc)();
- };
-
-#endif // CIHLSCALER_H
-
-// End of File
--- a/imagehandlinglib/Src/IHLBitmapUtil.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/*
-* 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: Static utility class for synchronous CFbsBitmap operations.
-*
-*/
-
-
-// INCLUDE FILES
-#include <IHLBitmapUtil.h>
-#include <fbs.h>
-
-// ============================ STATIC FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::DuplicateBitmapL
-// -----------------------------------------------------------------------------
-EXPORT_C CFbsBitmap* IHLBitmapUtil::DuplicateBitmapL( const CFbsBitmap& aBitmap )
- {
- CFbsBitmap* bitmap = DuplicateBitmapLC( aBitmap );
- CleanupStack::Pop(); // bitmap
- return bitmap;
- }
-
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::DuplicateBitmapLC
-// -----------------------------------------------------------------------------
-EXPORT_C CFbsBitmap* IHLBitmapUtil::DuplicateBitmapLC( const CFbsBitmap& aBitmap )
- {
- CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
- CleanupStack::PushL( bitmap );
- User::LeaveIfError( bitmap->Duplicate( aBitmap.Handle() ) );
- return bitmap;
- }
-
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::CopyBitmapL
-// -----------------------------------------------------------------------------
-EXPORT_C CFbsBitmap* IHLBitmapUtil::CopyBitmapL( const CFbsBitmap& aBitmap )
- {
- CFbsBitmap* bitmap = CopyBitmapLC( aBitmap );
- CleanupStack::Pop(); // bitmap
- return bitmap;
- }
-
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::CopyBitmapLC
-// -----------------------------------------------------------------------------
-EXPORT_C CFbsBitmap* IHLBitmapUtil::CopyBitmapLC( const CFbsBitmap& aBitmap )
- {
- CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
- CleanupStack::PushL( bitmap );
- if( !aBitmap.Handle() )
- {
- return bitmap;
- }
-
- TSize size( aBitmap.SizeInPixels() );
- TDisplayMode displayMode( aBitmap.DisplayMode() );
-
- User::LeaveIfError( bitmap->Create( size, displayMode ) );
-
- HBufC8* scanLine = HBufC8::NewLC(
- aBitmap.ScanLineLength( size.iWidth, displayMode ) );
- TPtr8 scanPtr( scanLine->Des() );
-
- TPoint pp;
- for ( TInt y( 0 ); y < size.iHeight; ++y )
- {
- pp.iY = y;
- aBitmap.GetScanLine( scanPtr, pp, size.iWidth, displayMode );
- bitmap->SetScanLine( scanPtr, y );
- }
-
- CleanupStack::PopAndDestroy(); // scanLine
-
- return bitmap;
- }
-
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::CopyBitmapL
-// -----------------------------------------------------------------------------
-EXPORT_C CFbsBitmap* IHLBitmapUtil::CopyBitmapL( const CFbsBitmap& aBitmap, const TRect& aRect )
- {
- CFbsBitmap* bitmap = CopyBitmapLC( aBitmap, aRect );
- CleanupStack::Pop(); // bitmap
- return bitmap;
- }
-
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::CopyBitmapLC
-// -----------------------------------------------------------------------------
-EXPORT_C CFbsBitmap* IHLBitmapUtil::CopyBitmapLC( const CFbsBitmap& aBitmap, const TRect& aRect )
- {
- CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
- CleanupStack::PushL( bitmap );
- if( !aBitmap.Handle() )
- {
- return bitmap;
- }
-
- TSize clipSize( aRect.Size() );
- TSize sourceSize( aBitmap.SizeInPixels() );
- if( aRect.iTl.iX == aRect.iBr.iX ||
- aRect.iTl.iY == aRect.iBr.iY ||
- aRect.iTl.iX < 0 ||
- aRect.iTl.iX > sourceSize.iWidth ||
- aRect.iTl.iY < 0 ||
- aRect.iTl.iY > sourceSize.iHeight )
- {
- User::Leave( KErrArgument );
- }
-
- TDisplayMode dispMode( aBitmap.DisplayMode() );
- User::LeaveIfError( bitmap->Create( clipSize, dispMode ) );
-
- HBufC8* scanLine = HBufC8::NewLC(
- aBitmap.ScanLineLength( clipSize.iWidth, dispMode ) );
- TPtr8 scanPtr( scanLine->Des() );
-
- TPoint pp( aRect.iTl );
- for ( TInt y( 0 ); y < clipSize.iHeight; ++y, ++pp.iY )
- {
- aBitmap.GetScanLine( scanPtr, pp, clipSize.iWidth, dispMode );
- bitmap->SetScanLine( scanPtr, y );
- }
-
- CleanupStack::PopAndDestroy(); // scanLine
- return bitmap;
- }
-
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::ScaleBitmap
-// -----------------------------------------------------------------------------
-EXPORT_C TInt IHLBitmapUtil::ScaleBitmap( const CFbsBitmap& /*aSrcBitmap*/,
- CFbsBitmap& /*aDstBitmap*/,
- TUint32 /*aOptions*/ )
- {
- return KErrNotSupported;
- }
-
-// -----------------------------------------------------------------------------
-// IHLBitmapUtil::ScaleBitmap
-// -----------------------------------------------------------------------------
-EXPORT_C TInt IHLBitmapUtil::ScaleBitmap( const CFbsBitmap& /*aSrcBitmap*/,
- const TRect& /*aSrcRect*/,
- CFbsBitmap& /*aDstBitmap*/,
- const TRect& /*aDstRect*/,
- TUint32 /*aOptions*/ )
- {
- return KErrNotSupported;
- }
-
-// End of File
--- a/imagehandlinglib/Src/IHLDebugPrint.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
-* 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: IHL debug macros
-*
-*/
-
-
-#ifndef IHLDEBUGPRINT_H
-#define IHLDEBUGPRINT_H
-
-// Debug logging is enabled, you may enable debug printing in release builds also
-#ifdef IHL_ENABLE_DEBUG_PRINT
-
- // warn if this is a release build!!
- #ifndef __WINSCW__
- #ifndef _DEBUG
- #if defined(__VC32__)
- #pragma message( "Warning: IHL debug printing is on in release build!" ) // CSI: 68 #
- #else // __GCC32__
- #warning "IHL debug printing is on in release build!"
- #endif // __VC32__
- #endif
- #endif // __WINSCW__
-
-// no include files if no debug printing --> faster compile time
-// INCLUDES
-#include <e32std.h>
-#include <e32svr.h>
-
- /**
- * Helper macro for defining debug strings with just the debug text.
- */
- #define IHL_DEBUG_STRING(name,s) _LIT(name,s)
-
- /**
- * Output to debugger output
- */
- #define IHL_DEBUG_PRINT RDebug::Print
-
-#else // IHL_ENABLE_DEBUG_PRINT
-
- /**
- * Dummy struct for checking that all IHL_DEBUG_PRINT's define string
- * literals using space-saving IHL_DEBUG_STRING.
- */
- struct TIHLEmptyDebugString { }; // CSI: 80 #
-
- /**
- * Macro for defining debug-only literal strings (empty release version)
- */
- #define IHL_DEBUG_STRING(name, s) const TIHLEmptyDebugString name = {}
-
- /**
- * Output to debugger output (empty)
- */
- #define IHL_DEBUG_PRINT IHL_EmptyPrint
-
- namespace {
-
- /// Empty debug print function for release builds.
- inline void IHL_EmptyPrint(TIHLEmptyDebugString)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1,class T2>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1,T2)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1,class T2,class T3>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1,T2,T3)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1,class T2,class T3,class T4>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1,T2,T3,T4)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1,class T2,class T3,class T4,class T5>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1,T2,T3,T4,T5)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1,class T2,class T3,class T4,class T5,class T6>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1,T2,T3,T4,T5,T6)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1,T2,T3,T4,T5,T6,T7)
- {
- }
-
- /// Empty debug print function for release builds.
- template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
- inline void IHL_EmptyPrint(TIHLEmptyDebugString,T1,T2,T3,T4,T5,T6,T7,T8)
- {
- }
-
- } // unnamed namespace
-
-
-#endif // IHL_ENABLE_DEBUG_PRINT
-
-/**
- * Short variant for easier basic usage.
- */
-#define IHL_DEBUG1( name, s ) IHL_DEBUG_STRING( name, s ); IHL_DEBUG_PRINT( name );
-
-#ifdef IHL_ENABLE_DEBUG_PRINT
-#define IHL_DEBUG( s ) RDebug::Print( _L( s ) )
-#define IHL_DEBUG2( name, s, i ) IHL_DEBUG_STRING( name, s ); IHL_DEBUG_PRINT( name, i );
-#define IHL_DEBUG3( name, s, i, j ) IHL_DEBUG_STRING( name, s ); IHL_DEBUG_PRINT( name, i, j );
-#define IHL_DEBUG4( name, s, i, j, k ) IHL_DEBUG_STRING( name, s ); IHL_DEBUG_PRINT( name, i, j, k );
-#define IHL_DEBUG5( name, s, i, j, k, l ) IHL_DEBUG_STRING( name, s ); IHL_DEBUG_PRINT( name, i, j, k, l );
-#else
-// If debug printing is not enabled, strip other parameters than the string
-// away to prevent unwanted function calls in release build.
-#define IHL_DEBUG( s )
-#define IHL_DEBUG2( name, s, i ) IHL_DEBUG1( name, s )
-#define IHL_DEBUG3( name, s, i, j ) IHL_DEBUG1( name, s )
-#define IHL_DEBUG4( name, s, i, j, k ) IHL_DEBUG1( name, s )
-#define IHL_DEBUG5( name, s, i, j, k, l ) IHL_DEBUG1( name, s )
-#endif
-
-#endif // __IHLDEBUGPRINT_H__
--- a/imagehandlinglib/Src/IHLImageFactory.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/*
-* Copyright (c) 2004-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: Static factory class for creating file instances.
-*
-*/
-
-
-// INCLUDE FILES
-#include <IHLImageFactory.h>
-
-#include "CIHLFileImage.h"
-#include "CIHLFileImageExtJpg.h"
-#include <IclExtJpegApi.h>
-
-// Private namespace for constants and functions
-namespace
- {
- // First image index
- const TInt KIHLFirstImage = 0;
- const TInt KIHLNullOptions = 0;
-
- const TInt KMimeTypeStringLength = 255;
- _LIT( KJpgType, "image/jpeg" );
-
-
- // Helper functions
- // -----------------------------------------------------------------------------
- // OpenExtendedFileImageL
- // -----------------------------------------------------------------------------
- //
- CIHLFileImageExtJpg* OpenExtendedFileImageL( RFs& aFs, const TDesC& aFilename,
- TInt aImageIndex, const TUint32 aOptions )
- {
- CIHLFileImageExtJpg* fileImageExtJpg = NULL;
- TRAPD( err, fileImageExtJpg = CIHLFileImageExtJpg::NewL( aFs, aFilename,
- aImageIndex, aOptions ) );
- if( !err )
- {
- // Hw or Sw extended decoder found; check for cropping capability
- CleanupStack::PushL( fileImageExtJpg );
- if( !( fileImageExtJpg->CapabilitiesL() & CExtJpegDecoder::ECapCropping ) )
- {
- //Decoder does not support cropping, use the old implementation
- CleanupStack::PopAndDestroy( fileImageExtJpg );
- fileImageExtJpg = NULL;
- }
- else
- {
- CleanupStack::Pop( fileImageExtJpg );
- }
- }
-
- return fileImageExtJpg;
- }
-
- // -----------------------------------------------------------------------------
- // MimeTypeIsJpgL
- // -----------------------------------------------------------------------------
- //
- TBool MimeTypeIsJpgL( RFile& aFile )
- {
- using namespace ContentAccess;
-
- TBuf<KMimeTypeStringLength> mime;
- CContent* content = CContent::NewL( aFile );
- CleanupStack::PushL( content );
- CData* data = content->OpenContentL( EPeek );
- CleanupStack::PushL( data );
- User::LeaveIfError( data->GetStringAttribute( EMimeType, mime ) );
- CleanupStack::PopAndDestroy( 2 ); //data, content
- if( mime.Compare( KJpgType ) == 0 ) return ETrue;
- return EFalse;
- }
- }
-
-// ============================ STATIC FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenFileImageL( RFs& aFs, const TDesC& aFilename )
- {
- RFile fileHandle;
- TInt err( fileHandle.Open( aFs, aFilename, EFileShareReadersOnly ) );
- if( err )
- {
- User::LeaveIfError( fileHandle.Open( aFs, aFilename, EFileShareAny ) );
- }
- CleanupClosePushL( fileHandle );
-
- if ( MimeTypeIsJpgL( fileHandle ) )
- {
- CIHLFileImageExtJpg* fileImageExtJpg = OpenExtendedFileImageL( aFs,
- aFilename,
- KIHLFirstImage,
- KIHLNullOptions );
- if ( fileImageExtJpg )
- {
- CleanupStack::PopAndDestroy(); // fileHandle.Close()
- return fileImageExtJpg;
- }
- }
-
- CIHLFileImage* fileImage = CIHLFileImage::NewL( fileHandle, KIHLFirstImage, KIHLNullOptions );
-
- CleanupStack::PopAndDestroy(); // fileHandle.Close()
-
- return fileImage;
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenFileImageL( RFs& aFs, const TDesC& aFilename,
- TInt aImageIndex )
- {
- RFile fileHandle;
- TInt err( fileHandle.Open( aFs, aFilename, EFileShareReadersOnly ) );
- if( err )
- {
- User::LeaveIfError( fileHandle.Open( aFs, aFilename, EFileShareAny ) );
- }
- CleanupClosePushL( fileHandle );
-
- if ( MimeTypeIsJpgL( fileHandle ) )
- {
- CIHLFileImageExtJpg* fileImageExtJpg = OpenExtendedFileImageL( aFs,
- aFilename,
- aImageIndex,
- KIHLNullOptions );
- if ( fileImageExtJpg )
- {
- CleanupStack::PopAndDestroy(); // fileHandle.Close()
- return fileImageExtJpg;
- }
- }
-
- CIHLFileImage* fileImage = CIHLFileImage::NewL( fileHandle, aImageIndex, KIHLNullOptions );
-
- CleanupStack::PopAndDestroy(); // fileHandle.Close()
-
- return fileImage;
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenFileImageL( RFs& aFs, const TDesC& aFilename,
- TInt aImageIndex, const TUint32 aOptions )
- {
- RFile fileHandle;
- TInt err( fileHandle.Open( aFs, aFilename, EFileShareReadersOnly ) );
- if( err )
- {
- User::LeaveIfError( fileHandle.Open( aFs, aFilename, EFileShareAny ) );
- }
- CleanupClosePushL( fileHandle );
-
- if ( MimeTypeIsJpgL( fileHandle ) )
- {
- CIHLFileImageExtJpg* fileImageExtJpg = OpenExtendedFileImageL( aFs,
- aFilename,
- aImageIndex,
- aOptions );
- if ( fileImageExtJpg )
- {
- CleanupStack::PopAndDestroy(); // fileHandle.Close()
- return fileImageExtJpg;
- }
- }
-
- CIHLFileImage* fileImage = CIHLFileImage::NewL( fileHandle, aImageIndex, aOptions );
-
- CleanupStack::PopAndDestroy(); // fileHandle.Close()
-
- return fileImage;
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenFileImageL( RFile& aFile )
- {
- return CIHLFileImage::NewL( aFile, KIHLFirstImage, KIHLNullOptions );
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenFileImageL( RFile& aFile, TInt aImageIndex )
- {
- return CIHLFileImage::NewL( aFile, aImageIndex, KIHLNullOptions );
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenFileImageL( RFile& aFile, TInt aImageIndex,
- const TUint32 aOptions )
- {
- return CIHLFileImage::NewL( aFile, aImageIndex, aOptions );
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenBufferedFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenBufferedFileImageL( RFs& aFs, const TDesC8& aDataBuf )
- {
- return CIHLFileImage::NewL( aFs, aDataBuf, KIHLFirstImage, KIHLNullOptions );
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenBufferedFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenBufferedFileImageL( RFs& aFs,
- const TDesC8& aDataBuf, TInt aImageIndex )
- {
- return CIHLFileImage::NewL( aFs, aDataBuf, aImageIndex, KIHLNullOptions );
- }
-
-// -----------------------------------------------------------------------------
-// IHLImageFactory::OpenBufferedFileImageL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLFileImage* IHLImageFactory::OpenBufferedFileImageL( RFs& aFs,
- const TDesC8& aDataBuf, TInt aImageIndex, const TUint32 aOptions )
- {
- return CIHLFileImage::NewL( aFs, aDataBuf, aImageIndex, aOptions );
- }
-
-// End of File
--- a/imagehandlinglib/Src/IHLImplementationIds.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
-* 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 id's used in internal classes.
-*
-*/
-
-
-#ifndef IHLIMPLEMENTATIONIDS_H
-#define IHLIMPLEMENTATIONIDS_H
-
-// INCLUDES
-#include <e32def.h>
-
-// -----------------------------------------------------------------------------
-// IMPLEMENTATION IDs
-// -----------------------------------------------------------------------------
-//
-// Images
-const TInt KIHLImplementationIdFileImage = 0x0101;
-const TInt KIHLImplementationIdFileImageExtJpg = 0x0102;
-
-// Processors
-const TInt KIHLImplementationIdBitmapProcessor = 0x0201;
-
-// Viewers
-const TInt KIHLImplementationIdImageViewer = 0x0301;
-const TInt KIHLImplementationIdImageViewerExtJpg = 0x0302;
-
-// Filters (reserved)
-// const TInt KIHLImplementationIdFilter = 0x0401; // CSI: 13 #
-
-#endif // IHLIMPLEMENTATIONIDS_H
-
-// End of File
--- a/imagehandlinglib/Src/IHLProcessorFactory.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* 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: Static factory class for creating processors.
-*
-*/
-
-
-
-// INCLUDE FILES
-#include <IHLProcessorFactory.h>
-#include "CIHLScaler.h"
-#include "CIHLBitmapProcessor.h"
-
-// ============================ STATIC FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// IHLProcessorFactory::CreateBitmapProcessorL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLBitmapProcessor* IHLProcessorFactory::CreateBitmapProcessorL( const TUint32 aOptions )
- {
- return CIHLBitmapProcessor::NewL( aOptions );
- }
-
-// End of File
--- a/imagehandlinglib/Src/IHLViewerFactory.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2004-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: Static factory class for creating viewers.
-*
-*/
-
-
-// INCLUDE FILES
-#include <IHLViewerFactory.h>
-
-#include "CIHLImageViewerExtJpg.h"
-#include "MIHLFileImageExtJpg.h"
-#include "IHLImplementationIds.h"
-
-#include "CIHLImageViewer.h"
-#include <MIHLImage.h>
-#include <MIHLFileImage.h>
-#include <IHLInterfaceIds.h>
-
-
-// ============================ STATIC FUNCTIONS ===============================
-// -----------------------------------------------------------------------------
-// IHLViewerFactory::CreateImageViewerL
-// -----------------------------------------------------------------------------
-//
-EXPORT_C MIHLImageViewer* IHLViewerFactory::CreateImageViewerL(
- const TSize& aViewerSize,
- MIHLImage& aSource,
- MIHLBitmap& aDestination,
- MIHLViewerObserver& aObserver,
- const TUint32 aOptions )
- {
- MIHLImageViewer* viewer = NULL;
- if( aSource.Type().iInterfaceId == KIHLInterfaceIdFileImage )
- {
- if( aSource.Type().iImplementationId == KIHLImplementationIdFileImageExtJpg )
- {
- viewer = CIHLImageViewerExtJpg::NewL( aViewerSize, static_cast< MIHLFileImageExtJpg& >( aSource ), // CSI: 35 #
- aDestination, aObserver, aOptions );
- }
- else
- {
- viewer = CIHLImageViewer::NewL( aViewerSize, static_cast< MIHLFileImage& >( aSource ), // CSI: 35 #
- aDestination, aObserver, aOptions );
- }
- }
- else
- {
- User::Leave( KErrArgument );
- }
- return viewer;
- }
-
-// End of File
--- a/imagehandlinglib/Src/MIHLFileImageExtJpg.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* 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: Pure virtual interface for file based external jpg image class.
-* : This class acts as a window into single image or animation
-* : in one physical file. Note that file will be locked as long
-* : as instance of this class is present.
-*
-*/
-
-
-#ifndef MIHLFILEIMAGEEXTJPG_H
-#define MIHLFILEIMAGEEXTJPG_H
-
-// INCLUDES
-#include <MIHLFileImage.h>
-#include <gdi.h>
-
-// FORWARD DECLARATION
-class MIHLBitmap;
-class MIHLFilter;
-class CVisualFrame;
-
-// CLASS DECLARATION
-/**
-* MIHLFileImageExtJpg
-*
-* Pure virtual interface for file based image class that uses IclExtJpegApi.
-* This class acts as a window into single image or animation
-* in one physical file. Note that file will be locked as long
-* as instance of this class is present.
-*
-* If interface needs to be pushed into CleanupStack,
-* remember to use CleanupDeletePushL() function!
-* DO NOT USE CleanupStack::PushL()!!
-*
-* @lib IHL.lib
-* @since 3.0
-*/
-class MIHLFileImageExtJpg : public MIHLFileImage
- {
- public:
-
- /**
- * Virtual destructor.
- */
- virtual ~MIHLFileImageExtJpg() {}
-
- public:
- /**
- * Load part of the image into bitmap.
- * @since 3.0
- * @param aSrcRect Part of the picture to be loaded
- * @param aStatus Load request status reference.
- * @param aDestination Destination bitmap reference.
- * @param aFrameIndex frame index for loading single frame from image
- * @return Return system wide error codes:
- * KerrArgument if given bitmap is not created or it's size is incorrect.
- * KErrBusy image has load request pending already.
- */
- virtual TInt Load( TRect aSrcRect, TRequestStatus& aStatus, MIHLBitmap& aDestination, TInt aFrameIndex = 0 ) = 0;
-
- public: //CExtJpegDecoder wrapper, see IclExtJpegApi.h
-
- virtual void SetCroppingL( TRect aCropRect ) = 0;
-
- virtual void SetStreamingL( TSize& aMacroBlockSize ) = 0;
-
- virtual void SetRotationL( TInt aDegree ) = 0;
-
- virtual void SetFlippingL() = 0;
-
- virtual void SetMirroringL() = 0;
-
- virtual void SetDctDecodingL() = 0;
-
- virtual void ConvertL(
- TRequestStatus* aRequestStatus,
- const CVisualFrame* aDestinationFrame,
- TInt& aNoOfDecodedMBlocks,
- TInt aFrameNumber = 0 ) = 0;
-
- virtual void ContinueConvertL(
- TRequestStatus* aRequestStatus,
- const CVisualFrame* aDestinationFrame,
- TInt& aNoOfDecodedMBlocks,
- TInt aFrameNumber = 0 ) = 0;
-
- virtual TInt SupportedFormatsL() = 0;
-
- virtual TInt CapabilitiesL() = 0;
-
-
- };
-#endif
--- a/imagehandlinglib/eabi/IHLu.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-EXPORTS
- _ZN13IHLBitmapUtil11CopyBitmapLERK10CFbsBitmap @ 1 NONAME
- _ZN13IHLBitmapUtil11CopyBitmapLERK10CFbsBitmapRK5TRect @ 2 NONAME
- _ZN13IHLBitmapUtil11ScaleBitmapERK10CFbsBitmapRK5TRectRS0_S5_m @ 3 NONAME
- _ZN13IHLBitmapUtil11ScaleBitmapERK10CFbsBitmapRS0_m @ 4 NONAME
- _ZN13IHLBitmapUtil12CopyBitmapLCERK10CFbsBitmap @ 5 NONAME
- _ZN13IHLBitmapUtil12CopyBitmapLCERK10CFbsBitmapRK5TRect @ 6 NONAME
- _ZN13IHLBitmapUtil16DuplicateBitmapLERK10CFbsBitmap @ 7 NONAME
- _ZN13IHLBitmapUtil17DuplicateBitmapLCERK10CFbsBitmap @ 8 NONAME
- _ZN15IHLImageFactory14OpenFileImageLER3RFsRK7TDesC16 @ 9 NONAME
- _ZN15IHLImageFactory14OpenFileImageLER3RFsRK7TDesC16i @ 10 NONAME
- _ZN15IHLImageFactory14OpenFileImageLER5RFile @ 11 NONAME
- _ZN15IHLImageFactory14OpenFileImageLER5RFilei @ 12 NONAME
- _ZN16IHLViewerFactory18CreateImageViewerLERK5TSizeR9MIHLImageR10MIHLBitmapR18MIHLViewerObserverm @ 13 NONAME
- _ZN19IHLProcessorFactory22CreateBitmapProcessorLEm @ 14 NONAME
- _ZN9IHLBitmap7CreateLEv @ 15 NONAME
- _ZN9IHLScaler7CreateLEm @ 16 NONAME
- _ZN15IHLImageFactory14OpenFileImageLER3RFsRK7TDesC16im @ 17 NONAME
- _ZN15IHLImageFactory14OpenFileImageLER5RFileim @ 18 NONAME
- _ZN15IHLImageFactory22OpenBufferedFileImageLER3RFsRK6TDesC8 @ 19 NONAME
- _ZN15IHLImageFactory22OpenBufferedFileImageLER3RFsRK6TDesC8i @ 20 NONAME
- _ZN15IHLImageFactory22OpenBufferedFileImageLER3RFsRK6TDesC8im @ 21 NONAME
-
--- a/imagehandlingutilities/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-
-#include "../thumbnailmanager/group/bld.inf"
-
-
-
-// End of File
-
-
Binary file imagehandlingutilities/thumbnailmanager/conf/102830B0.txt has changed
Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager.confml has changed
Binary file imagehandlingutilities/thumbnailmanager/conf/thumbnailmanager_102830B0.crml has changed
--- a/imagehandlingutilities/thumbnailmanager/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* 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 ?myapp
-*
-*/
-
-#include <platform_paths.hrh>
-
-#ifdef RD_THUMBNAILMANAGER
-
-#include "../thumbnailclient/group/bld.inf"
-#include "../thumbnailserver/group/bld.inf"
-#include "../plugins/image/group/bld.inf"
-#include "../plugins/video/group/bld.inf"
-#include "../plugins/audio/group/bld.inf"
-#include "../tmiadrestart/group/bld.inf"
-#ifdef RD_MDS_2_5
-#include "../thumbagdaemon/group/bld.inf"
-#endif
-
-PRJ_PLATFORMS
-WINSCW ARMV5
-
-PRJ_EXPORTS
-../sis/thumbnailmanager/thumbnailmanager_stub.sis /epoc32/data/z/system/install/thumbnailmanager_stub.sis
-../conf/thumbnailmanager.confml MW_LAYER_CONFML(thumbnailmanager.confml)
-../conf/thumbnailmanager_102830B0.crml MW_LAYER_CRML(thumbnailmanager_102830b0.crml)
-../rom/thumbnailmanager.iby CORE_MW_LAYER_IBY_EXPORT_PATH(thumbnailmanager.iby)
-#ifdef RD_MDS_2_5
-../rom/thumbagdaemon.iby CORE_MW_LAYER_IBY_EXPORT_PATH(thumbagdaemon.iby)
-#endif
-
-PRJ_TESTMMPFILES
-
-PRJ_TESTEXPORTS
-../conf/102830B0.txt /epoc32/release/winscw/udeb/z/private/10202be9/102830b0.txt
-../conf/102830B0.txt /epoc32/release/winscw/urel/z/private/10202be9/102830b0.txt
-
-#endif // RD_THUMBNAILMANAGER
-
-// End of File
-
-
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnaillog.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
-* 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: Logging functions
- *
-*/
-
-
-#ifndef THUMBNAILLOG_H
-#define THUMBNAILLOG_H
-
-#include <e32std.h>
-#include <e32svr.h>
-
-//log to file instead of RDebug
-//#define LOG_TO_FILE
-
-//#define _DEBUG
-
-#ifdef _DEBUG
-#ifdef LOG_TO_FILE
-//
-// Log to file
-//
-#include <flogger.h>
-_LIT( KThumbnailLogDir, "thumbnail" );
-_LIT( KThumbnailLogFile, "thumbnail.txt" );
-
-#define TN_DEBUG1( s ) \
-RFileLogger::Write( \
-KThumbnailLogDir, \
-KThumbnailLogFile, \
-EFileLoggingModeAppend, \
-_L( s ) );
-
-#define TN_DEBUG2( s, a ) \
-RFileLogger::WriteFormat( \
-KThumbnailLogDir, \
-KThumbnailLogFile, \
-EFileLoggingModeAppend, \
-_L( s ), a );
-
-#define TN_DEBUG3( s, a, b ) \
-RFileLogger::WriteFormat( \
-KThumbnailLogDir, \
-KThumbnailLogFile, \
-EFileLoggingModeAppend, \
-_L( s ), a, b );
-
-#define TN_DEBUG4( s, a, b, c ) \
-RFileLogger::WriteFormat( \
-KThumbnailLogDir, \
-KThumbnailLogFile, \
-EFileLoggingModeAppend, \
-_L( s ), a, b, c );
-
-#define TN_DEBUG5( s, a, b, c, d ) \
-RFileLogger::WriteFormat( \
-KThumbnailLogDir, \
-KThumbnailLogFile, \
-EFileLoggingModeAppend, \
-_L( s ), a, b, c, d );
-
-#define TN_DEBUG6( s, a, b, c, d, e ) \
-RFileLogger::WriteFormat( \
-KThumbnailLogDir, \
-KThumbnailLogFile, \
-EFileLoggingModeAppend, \
-_L( s ), a, b, c, d, e );
-
-#define TN_DEBUG7( s, a, b, c, d, e, f ) \
-RFileLogger::WriteFormat( \
-KThumbnailLogDir, \
-KThumbnailLogFile, \
-EFileLoggingModeAppend, \
-_L( s ), a, b, c, d, e, f );
-
-#else // LOG_TO_FILE
-//
-// Log to RDebug
-//
-#define TN_DEBUG1( s ) RDebug::Print( _L( s ) )
-#define TN_DEBUG2( s, a ) RDebug::Print( _L( s ), a )
-#define TN_DEBUG3( s, a, b ) RDebug::Print( _L( s ), a, b )
-#define TN_DEBUG4( s, a, b, c ) RDebug::Print( _L( s ), a, b, c )
-#define TN_DEBUG5( s, a, b, c, d ) RDebug::Print( _L( s ), a, b, c, d )
-#define TN_DEBUG6( s, a, b, c, d, e ) RDebug::Print( _L( s ), a, b, c, d, e )
-#define TN_DEBUG7( s, a, b, c, d, e, f ) RDebug::Print( _L( s ), a, b, c, d, e, f )
-
-#endif // LOG_TO_FILE
-
-#else // _DEBUG
-//
-// No logging
-//
-#define TN_DEBUG1( s )
-#define TN_DEBUG2( s, a )
-#define TN_DEBUG3( s, a, b )
-#define TN_DEBUG4( s, a, b, c )
-#define TN_DEBUG5( s, a, b, c, d )
-#define TN_DEBUG6( s, a, b, c, d, e )
-#define TN_DEBUG7( s, a, b, c, d, e, f )
-#endif // _DEBUG
-
-#endif // THUMBNAILLOG_H
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerconstants.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,533 +0,0 @@
-/*
-* 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: Thumbnail manager constants
- *
-*/
-
-
-#ifndef THUMBNAILMANAGERCONSTANTS_H
-#define THUMBNAILMANAGERCONSTANTS_H
-
-#include <e32base.h>
-#include <gdi.h>
-#include <etel3rdparty.h>
-#include <mdccommon.h>
-#include <apmstd.h>
-
-#include "thumbnailmanager.h" // TThumbnailFlags
-
-class CThumbnailServerSession;
-
-// P&S stuff
-static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
-static _LIT_SECURITY_POLICY_C1(KPowerMgmtPolicy,ECapabilityPowerMgmt);
-
-const TUid KTMPSNotification = { 0x102830AB };
-const TUid KTAGDPSNotification = { 0x2001FD51 };
-const TUid KMdSPSShutdown = { 0x20022E94 };
-const TUid KServerIdle = { 0x102830AB };
-const TUid KDaemonUid = { 0x2001FD51 };
-
-const TInt KShutdown = 0x00000001;
-const TInt KMdSShutdown = 0x00000002;
-//used to signal from server side when it's idle
-const TInt KIdle = 0x00000004;
-//daemon exposes items in processing queues
-const TInt KItemsleft = 0x00000008;
-const TInt KForceBackgroundGeneration = 0x00000010;
-const TInt KMPXHarvesting = 0x00000020;
-const TInt KDaemonProcessing = 0x00000040;
-
-//insert to temp table first wo indexing and move data to main table as batch
-//actual batch size will vary and will be between min...max batch size values below
-
-//minimum batch size
-const TUint KMInBatchItems = 6;
-//maximum batch size
-const TUint KMaxBatchItems = 60;
-//Max allowed flush time ms
-const TUint KMaxFlushDelay = 3000; // 3 sec
-//Max allowed flush time on MTP/music collection refresh
-const TUint KMaxMTPFlushDelay = 15000; // 15 seconds
-
-//how many items daemon will query at once from MDS
-const TUint KMaxQueryItems = 100;
-// max items for PH & AllItems query
-const TUint KMaxQueryBatchSize = 100;
-
-// maximum number of active client side queue requests
-const TUint KMaxClientRequests = 2;
-
-#ifdef __RETRY_ON_SERVERCRASH
-// maximum number of request retry
-const TUint KMaxRequestRetryCount = 2;
-#endif
-
-// maximum number of active daemon requests
-const TUint KMaxDaemonRequests = 2;
-
-const TUint KMdEReconnect = 1*1000*1000; //1 second
-
-const TUint KUnmountTimerTimeout = 5*1000*1000; //5 seconds
-
-const TUint KClientRequestTimeout = 60000000; //60 sec
-const TUint KClientRequestStartErrorTimeout = 100000; //100 ms
-
-const TUint KThumbnailServerMajorVersionNumber = 0;
-const TUint KThumbnailServerMinorVersionNumber = 1;
-const TUint KThumbnailServerBuildVersionNumber = 1;
-
-const TInt KThumbnailErrThumbnailNotFound = -62000;
-
-//give MDS some to settle before starting generating TNs
-const TInt KHarvestingCompleteTimeout = 10000000; //10 sec
-
-//after MMC mount wait while before count is calculated
-const TInt KMountTimeout = 5*1000*1000; //5 sec
-
-const TInt KPSKeyTimeout = 10000000; //10 sec
-//Store's auto flush timeout
-const TInt KAutoFlushTimeout = 65; //65 sec
-
-// minimum background generation idle time seconds
-const TInt KBackgroundGenerationIdle = 60;
-// minimum store maintenance idle time seconds
-const TInt KStoreMaintenanceIdle = 65; // 65 sec
-// interval for store maintenance rounds
-const TInt KStoreMaintenancePeriodic = 100000; //100 ms
-
-// maximum number of rows deleted in one transaction
-const TInt KStoreMaintenanceDeleteLimit = 10;
-// maximum number of thumbs checked for source file existance
-const TInt KStoreMaintenanceExistLimit = 50;
-
-// video decoder timeout
-const TInt KVideoDecoderTimeout = 12000000; // 12 seconds
-
-const TDisplayMode KThumbnailDefaultDisplayMode = EColor64K;
-
-//default displaymode (bpp - bits per pixel) for TNs in DB
-//this makes possible to provide all colour depths up to 16M aka 24 -bit full colour
-//Symbian^4 EColor16MAP
-const TDisplayMode KStoreDisplayMode = EColor16MAP;
-
-//required amount of memory to keep bitmaps on RAM in bits
-const TInt KMemoryNeed = 5000000;
-
-const TInt64 KDiskFullThreshold = 1024*1024*10; // 10 MB
-
-_LIT( KThumbnailServerName, "ThumbnailServer" );
-_LIT( KThumbnailServerProcess, "*ThumbnailServer*" );
-_LIT( KThumbnailServerExe, "thumbnailserver.exe" );
-_LIT( KThumbnailServerShutdown, "Thumbnailserver_Shutdown" );
-
-_LIT( KTAGDaemonName, "ThumbAGDaemon" );
-_LIT( KTAGDaemonProcess, "*ThumbAGDaemon*" );
-_LIT( KTAGDaemonExe, "thumbagdaemon.exe" );
-
-// server message slots, -1 doesn't reserve fixed amount from global but uses free available amount instead
-const TInt KMessageSlots = -1;
-
-const TInt KMinPriority = KMinTInt;
-const TInt KMinPlaceholderPriority = (KMinTInt +1000);
-const TInt KLowPriority = -1000;
-const TInt KNormalPriority = 0;
-const TInt KHighPriority = 1000;
-const TInt KMaxGeneratePriority = (KMaxTInt -1000);
-const TInt KMaxPriority = KMaxTInt; // For scaling tasks
-const TInt KImeiBufferSize = CTelephony::KPhoneSerialNumberSize;
-const TInt KCheckValue = 123456;
-
-_LIT8( KJpegMime, "image/jpeg" ); _LIT( KJpegExt, ".jpeg" );
-_LIT8( KJpeg2000Mime, "image/jp2" ); _LIT( KJpeg2000Ext, ".jp2" );
-_LIT8( KJpgMime, "image/jpeg" ); _LIT( KJpgExt, ".jpg" );
-_LIT8( KGifMime, "image/gif" ); _LIT( KGifExt, ".gif" );
-_LIT8( KPngMime, "image/png" ); _LIT( KPngExt, ".png" );
-_LIT8( KSvgMime, "image/svg+xml" ); _LIT( KSvgExt, ".svg" );
-_LIT8( KMpgMime1, "video/mpeg"); _LIT( KMpgExt1, ".mpg" );
-_LIT8( KMpeg4Mime, "video/mpeg4" ); _LIT( KMpeg4Ext,".mpeg4" );
-_LIT8( KMp4Mime, "video/mp4" ); _LIT( KMp4Ext, ".mp4" ); _LIT( KM4vExt, ".m4v" );
-_LIT8( KAviMime, "video/x-msvideo" ); _LIT( KAviExt, ".avi" );
-_LIT8( KMp3Mime, "audio/mpeg" ); _LIT( KMp3Ext, ".mp3" );
-_LIT8( KNonEmbeddArtMime, "audio/mpeg" ); _LIT( KNonEmbeddArtExt, ".alb" );
-_LIT8( KM4aMime, "audio/mp4" ); _LIT( KM4aExt, ".m4a" );
-_LIT8( KAacMime, "audio/aac" ); _LIT( KAacExt, ".aac" );
-_LIT8( KWmaMime, "audio/x-ms-wma" ); _LIT( KWmaExt, ".wma" );
-_LIT8( KBmpMime, "image/bmp" ); _LIT( KBmpExt, ".bmp" );
-_LIT8( KAudio3gppMime, "audio/3gpp" );
-_LIT8( KVideo3gppMime, "video/3gpp" ); _LIT( K3gpExt, ".3gp" ); _LIT( K3gppExt, ".3gpp" );
-_LIT8( KAudioAmrMime, "audio/AMR" ); _LIT( KAmrExt, ".amr" );
-_LIT8( KVideoWmvMime, "video/x-ms-wmv" ); _LIT( KWmvExt, ".wmv" );
-_LIT8( KRealAudioMime, "audio/vnd.rn-realaudio" ); _LIT( KRealAudioExt, ".ra" );
-_LIT8( KPmRealAudioPluginMime, "audio/x-pn-realaudio-plugin" ); _LIT( KPmRealAudioPluginExt, ".rpm" );
-_LIT8( KPmRealVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVideoPluginExt, ".rm" );
-_LIT8( KPmRealVbVideoPluginMime, "video/x-pn-realvideo" ); _LIT( KPmRealVbVideoPluginExt, ".rmvb" );
-_LIT8( KPmRealAudioMime, "audio/x-pn-realaudio" ); _LIT( KPmRealAudioExt, ".ra" );
-_LIT8( KRealVideoMime, "video/vnd.rn-realvideo" ); _LIT( KRealVideoExt, ".rv" );
-_LIT8( KFlashVideoMime, "video/x-flv" ); _LIT( KFlashVideoExt, ".flv" );
-_LIT8( KMatroskaVideoMime, "video/x-matroska" ); _LIT( KMatroskaVideoExt, ".mkv" );
-_LIT8( KContactMime, "contact/x-vcard" ); _LIT( KContactExt, ".vcf" );
-
-_LIT( KNonEmbeddedArtExt, ".alb" );
-
-_LIT8( KAlbumArtMime, "audio/albumart" ); _LIT( KAlbumArtExt, ".maa" );
-
-_LIT( KImageMime, "image/*" );
-_LIT( KVideoMime, "video/*" );
-_LIT( KAudioMime, "audio/*" );
-
-_LIT( KPrivateFolder, ":\\private\\");
-_LIT( KSysFolder, ":\\sys\\");
-
-_LIT( KDrv, ":");
-_LIT( KBackSlash, "\\");
-
-const TInt KExtLength = 4;
-
-/**
- * Control flags set by the server for handling specific situations
- * (for example for distinguishing between preview thumbnails and
- * final thumbnails).
- *
- * @since S60 v5.0
- */
-enum TThumbnailControlFlags
- {
- /**
- * Default value. No flags set.
- */
- EThumbnailNoControlFlags = 0,
-
- /**
- * Set by the server when the request is completed and it is only the
- * first part of a two-phase request
- */
- EThumbnailPreviewThumbnail = 1,
-
- /**
- * Set by the client to inform server to create only missing persistent sizes thumbnails
- */
- EThumbnailGeneratePersistentSizesOnly = 2
-};
-
-
-/**
- * Thumbnail request parameters used for client-server communication.
- *
- * @since S60 v5.0
- */
-struct TThumbnailRequestParams
- {
-public:
- /**
- * Bitmap handle for completed requests
- */
- TInt iBitmapHandle;
-
- /**
- * Flags for new requests.
- */
- CThumbnailManager::TThumbnailFlags iFlags;
-
- /**
- * Quality-preference value for new requests.
- */
- CThumbnailManager::TThumbnailQualityPreference iQualityPreference;
-
- /**
- * Priority for new requests.
- */
- TInt iPriority;
-
- /**
- * Requested thumbnail size new requests.
- */
- TSize iSize;
-
- /**
- * Requested display mode new requests.
- */
- TDisplayMode iDisplayMode;
-
- /**
- * Full path to object file for new requests. Should be set even
- * when file handles are used.
- */
- TFileName iFileName;
-
- /**
- * Full path to object to which the imported thumb is to be linked.
- */
- TFileName iTargetUri;
-
- /**
- * Thumbnail ID
- */
- TThumbnailId iThumbnailId;
-
- /**
- * Relative thumbnail size
- */
- TThumbnailSize iThumbnailSize;
-
- /**
- * MIME type
- */
- TDataType iMimeType;
-
- /**
- * Image buffer used to create & set the thumbnail
- */
- TDesC8* iBuffer;
-
- /**
- * Session specific request ID allocated by the client.
- */
- TThumbnailRequestId iRequestId;
-
- /**
- * Control flags set by the server for handling specific situations
- * (for example for distinguishing between preview thumbnails and
- * final thumbnails).
- * Control flags may be modified by server to signal client side what actually was done, like preview TN
- */
- TThumbnailControlFlags iControlFlags;
-
- /**
- * Original control flags set by the server for handling specific situations
- * (for example for distinguishing between preview thumbnails and
- * final thumbnails).
- */
- TThumbnailControlFlags iOriginalControlFlags;
-
- /**
- * Thumbnail's modify timestamp
- */
- TInt64 iModified;
-
- /**
- * Thumbnail's orientation
- */
- TInt iOrientation;
-
- /**
- * Overwrite old thumbs (SetThumbnailL)
- */
- TBool iOverwrite;
-
- /**
- * URI is virtual
- */
- TBool iVirtualUri;
-
- /**
- * Target differs from source
- */
- TBool iImport;
- };
-
-
-typedef TPckg < TThumbnailRequestParams > TThumbnailRequestParamsPckg;
-typedef TPckgBuf < TThumbnailRequestParams > TThumbnailRequestParamsPckgBuf;
-
-
-/**
- * Request ID class used on the server side. Consists of a pointer to a
- * session and a session specific ID.
- *
- * @since S60 v5.0
- */
-struct TThumbnailServerRequestId
- {
- /**
- * Default C++ constructor
- *
- * @since S60 v5.0
- */
- inline TThumbnailServerRequestId(): iSession( NULL ), iRequestId( 0 ){}
-
- /**
- * C++ constructor
- *
- * @since S60 v5.0
- * @param aSession Pointer to the server-side session object, which
- * created the request.
- * @param aRequestId Session specific request ID as allocated by the
- * client.
- */
- inline TThumbnailServerRequestId( CThumbnailServerSession* aSession,
- TThumbnailRequestId aRequestId ): iSession( aSession ), iRequestId(
- aRequestId ){}
-
- /**
- * Compare request IDs. Both session and client-side request ID must
- * match.
- *
- * @param aRequestId Another TThumbnailServerRequestId to compare to
- * @since S60 v5.0
- */
- inline TBool operator == ( const TThumbnailServerRequestId& aRequestId )
- const
- {
- return aRequestId.iSession == iSession && aRequestId.iRequestId ==
- iRequestId;
- }
-
-public:
- /**
- * Pointer to the server-side session object, which created the request.
- * Not own.
- */
- CThumbnailServerSession* iSession;
-
- /**
- * Session specific request ID as allocated by the client.
- */
- TThumbnailRequestId iRequestId;
-};
-
-/**
- * Client-server message IDs
- *
- * @since S60 v5.0
- * Start from 0 so that TPolicy range matches to function count.
- */
-enum TThumbnailServerRequest
- {
- /**
- * Thumbnail request using file path. A TThumbnailRequestParams
- * struct is passed as a parameter.
- * @see TThumbnailRequestParams
- */
- ERequestThumbByPathAsync = 0,
-
- /**
- * Thumbnail request using file path. A TThumbnailRequestParams
- * struct is passed as a parameter as well as the file handle using
- * TransferToServer()/AdoptFromClient().
- * @see TThumbnailRequestParams
- */
- ERequestThumbByFileHandleAsync,
-
- /**
- * Release a bitmap after the client callback has returned. Bitmap
- * handle is passed as a parameter.
- */
- EReleaseBitmap,
-
- /**
- * Cancel a thumbnail request. Session specific request ID is passed
- * as a parameter.
- */
- ECancelRequest,
-
- /**
- * Change the priority of a thumbnail request. Session specific request
- * ID and new priority value are passed as parameters.
- */
- EChangePriority,
-
- /**
- * Deprecated
- *
- */
- ECreateThumbnails,
-
- /**
- * Delete existing thumbnails for a file. File path is passed as a
- * parameter.
- */
- EDeleteThumbnails,
-
- /**
- * Get the required size (in characters) for a buffer that contains the
- * list of supported MIME types. Size in integers is returned in the
- * first parameter.
- */
- EGetMimeTypeBufferSize,
-
- /**
- * Get the list of supported MIME types and store them as the first
- * parameter. The first parameter should be allocated by the client
- * to be large enough (using EGetMimeTypeBufferSize).
- */
- EGetMimeTypeList,
-
- /**
- * Thumbnail request using ID.
- */
- ERequestThumbByIdAsync,
-
- ERequestThumbByBufferAsync,
-
- /**
- * Request to set thumbnail created from buffered image
- */
- ERequestSetThumbnailByBuffer,
-
- /**
- * Delete existing thumbnails. Id as parameter.
- */
- EDeleteThumbnailsById,
-
- ERenameThumbnails,
-
- /**
- * Update thumbnails by given Id.
- */
- EUpdateThumbnails,
-
- /**
- * Request to set thumbnail created from given bitmap
- */
- ERequestSetThumbnailByBitmap,
-
- /**
- * Do not remove and keep as last item! Holds count of functions supported.
- */
- EThumbnailServerRequestCount
- };
-
-/**
- * Thumbnail format in storage
- *
- * @since S60 v5.0
- */
-enum TThumbnailFormat
- {
- /**
- * Symbian internal bitmap format, usually as extranlized BLOB in the db.
- */
- EThumbnailFormatFbsBitmap,
- /**
- * Stantard JPEG
- */
- EThumbnailFormatJpeg
- };
-
-
-/**
- * MDS query modes used during thumbnail generation
- *
- * @since S60 v5.0
- */
-enum TMDSQueryType
- {
- /**
- * Query Path by Id
- */
- EURI
- };
-
-#endif // THUMBNAILMANAGERCONSTANTS_H
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanagerprivatecrkeys.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* 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: Central Repository keys for Thumbnail Manager
- *
-*/
-
-
-#ifndef THUMBNAILMANAGERPRIVATECRKEYS_H
-#define THUMBNAILMANAGERPRIVATECRKEYS_H
-
-#include "thumbnailmanageruids.hrh"
-
-const TUid KThumbnailSettingsUid =
- {
- THUMBNAIL_CENREP_UID
- };
-
-const TUint32 KSizeImageGridWidth = 0x0;
-const TUint32 KSizeImageGridHeight = 0x1;
-const TUint32 KSizeImageListWidth = 0x2;
-const TUint32 KSizeImageListHeight = 0x3;
-const TUint32 KSizeImageFullscreenWidth = 0x4;
-const TUint32 KSizeImageFullscreenHeight = 0x5;
-const TUint32 KSizeVideoGridWidth = 0x6;
-const TUint32 KSizeVideoGridHeight = 0x7;
-const TUint32 KSizeVideoListWidth = 0x8;
-const TUint32 KSizeVideoListHeight = 0x9;
-const TUint32 KSizeVideoFullscreenWidth = 0x10;
-const TUint32 KSizeVideoFullscreenHeight = 0x11;
-const TUint32 KSizeAudioGridWidth = 0x12;
-const TUint32 KSizeAudioGridHeight = 0x13;
-const TUint32 KSizeAudioListWidth = 0x14;
-const TUint32 KSizeAudioListHeight = 0x15;
-const TUint32 KSizeAudioFullscreenWidth = 0x16;
-const TUint32 KSizeAudioFullscreenHeight = 0x17;
-const TUint32 KSizeContactListWidth = 0x18;
-const TUint32 KSizeContactListHeight = 0x19;
-const TUint32 KSizeContactGridWidth = 0x20;
-const TUint32 KSizeContactGridHeight = 0x21;
-const TUint32 KSizeContactFullscreenWidth = 0x22;
-const TUint32 KSizeContactFullscreenHeight = 0x23;
-
-const TUint32 KAutoCreateImageGrid = 0x100;
-const TUint32 KAutoCreateImageList = 0x101;
-const TUint32 KAutoCreateImageFullscreen = 0x102;
-const TUint32 KAutoCreateVideoGrid = 0x103;
-const TUint32 KAutoCreateVideoList = 0x104;
-const TUint32 KAutoCreateVideoFullscreen = 0x105;
-const TUint32 KAutoCreateAudioGrid = 0x106;
-const TUint32 KAutoCreateAudioList = 0x107;
-const TUint32 KAutoCreateAudioFullscreen = 0x108;
-const TUint32 KAutoCreateContactGrid = 0x109;
-const TUint32 KAutoCreateContactList = 0x110;
-const TUint32 KAutoCreateContactFullscreen = 0x111;
-
-const TUint32 KColorDepthGrid = 0x200;
-const TUint32 KColorDepthList = 0x201;
-const TUint32 KColorDepthFullscreen = 0x202;
-
-const TUint32 KEnableDaemon = 0x300;
-
-#endif // THUMBNAILMANAGERPRIVATECRKEYS_H
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailmanageruids.hrh Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* 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: UID values for Thumbnail Manager components
-*
-*/
-
-
-#ifndef THUMBNAILMANAGERUIDS_HRH
-#define THUMBNAILMANAGERUIDS_HRH
-
-#define THUMBNAIL_PROVIDER_IF_UID 0x102830A9
-#define THUMBNAIL_MANAGER_CLIENT_DLL_UID 0x102830AA
-#define THUMBNAIL_MANAGER_SERVER_UID 0x102830AB
-#define THUMBNAIL_IMAGE_PROVIDER_DLL_UID 0x102830AC
-#define THUMBNAIL_IMAGE_PROVIDER_IMP_UID 0x102830AD
-#define THUMBNAIL_VIDEO_PROVIDER_DLL_UID 0x102830AE
-#define THUMBNAIL_VIDEO_PROVIDER_IMP_UID 0x102830AF
-#define THUMBNAIL_CENREP_UID 0x102830B0
-#define THUMBNAIL_AUDIO_PROVIDER_DLL_UID 0x20022D5D
-#define THUMBNAIL_AUDIO_PROVIDER_IMP_UID 0x20022D5E
-
-#define THUMBAGDAEMON_UID 0x2001FD51
-#define THUMBAGDAEMON_SIS 0x102830A9
-
-#endif // THUMBNAILMANAGERUIDS_HRH
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Panic codes for Thumbnail Manager
- *
-*/
-
-
-#ifndef THUMBNAILPANIC_H
-#define THUMBNAILPANIC_H
-
-#include <e32std.h>
-
-_LIT( KThumbnailPanicCategory, "ThumbnailManager" );
-
-enum TThumbnailPanicCode
- {
- // Numerical values used to help finding the reason based on
- // panic code.
- EThumbnailNullPointer = 0, EThumbnailBadSize = 1, EThumbnailBadBitmapHandle
- = 2, EThumbnailBadPath = 3, EThumbnailUnknownMessage = 4,
- EThumbnailMessageNotCompleted = 5, EThumbnailBitmapNotReleased = 6,
- EThumbnailEmptyDescriptor = 7, EThumbnailWrongId = 8, EThumbnailAlreadyRunning =
- 9, EThumbnailDatabaseUnrecoverable = 10, EThumbnailSQLTransaction = 11
- };
-
-/**
- * Call User::Panic() with Thumbnail Manager panic category using
- * one of the panic codes above
- * @param aCode Panic code
- */
-inline void ThumbnailPanic( TThumbnailPanicCode aCode );
-
-/**
- * Panic if a pointer is NULL
- */
-#define TN_ASSERT_NOT_NULL( ptr ) \
-__ASSERT_ALWAYS( ptr, ThumbnailPanic( EThumbnailNullPointer ) );
-
-#include "thumbnailpanic.inl"
-
-
-#endif // THUMBNAILPANIC_H
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailpanic.inl Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Panic codes for Thumbnail Manager
-*
-*/
-
-
-// -----------------------------------------------------------------------------
-// Panic using numeric code
-// -----------------------------------------------------------------------------
-//
-inline void ThumbnailPanic( TThumbnailPanicCode aCode )
- {
- User::Panic( KThumbnailPanicCategory, static_cast<TInt>( aCode ) );
- }
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailprovider.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*
-* 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 thumbnail provider plug-ins
- *
-*/
-
-
-#ifndef THUMBNAILPROVIDER_H
-#define THUMBNAILPROVIDER_H
-
-#include <ecom/ecom.h>
-#include <apmstd.h>
-
-#include "thumbnailmanager.h" // TThumbnailFlags
-#include "thumbnaillog.h"
-
-/**
- * Thumbnail provider observer class
- *
- * @since S60 v5.0
- */
-class MThumbnailProviderObserver
- {
-public:
- /**
- * Thumbnail provider observer callback to notify the server when
- * thumbnail has been generated.
- *
- * @since S60 5.0
- * @param aError Error code
- * @param aBitmap Thumbnail bitmap. The observer implementation will
- * assume ownership of the bitmap.
- * @param aOriginalSize Original size of the object in pixels.
- * @param aEXIF ETrue if thumbnail origin is EXIF.
- */
- virtual void ThumbnailProviderReady( TInt aError, CFbsBitmap* aBitmap,
- const TSize& aOriginalSize, const TBool aEXIF, const TBool aPortrait ) = 0;
-};
-
-
-/**
- * Base class for thumbnail provider plug-ins.
- *
- * @since S60 v5.0
- */
-class CThumbnailProvider: public CBase
- {
-public:
- /**
- * Create a provider instance. The instance is identified
- * by the implementation UID.
- */
- static CThumbnailProvider* NewL( TUid aUid );
-
- /**
- * Get the UID of this provider.
- *
- * @since S60 5.0
- * @return Provider implementation UID
- */
- TUid Uid();
-
- /**
- * Set the observer to receive notification
- * about thumbnail generation completion.
- *
- * @since S60 5.0
- * @param aObserver Reference to the observing object. Ownership not
- * transferred.
- */
- void SetObserver( MThumbnailProviderObserver& aObserver );
-
- /**
- * Set the target size for uncropped thumbnails. The actual thumbnail
- * at least this wide or high, depending on which is the limiting
- * factor.
- *
- * @since S60 5.0
- * @param aSize Target size in pixels for uncropped thumbnails.
- */
- void SetTargetSize( const TSize& aSize );
-
- /**
- * Set the target size for cropped thumbnails. The actual thumbnail
- * at least this large and it will include the whole thumbnail,
- * not just the cropped portion.
- *
- * @since S60 5.0
- * @param aCroppedSize Target size in pixels for cropped thumbnails.
- */
- void SetCroppedTargetSize( const TSize& aCroppedSize );
-
- /**
- * Reset thumbnail parameters to defaults.
- */
- void Reset();
-
- /**
- * Get thumbnail bitmap. Must be implemented by provider plug-ins.
- *
- * @since S60 5.0
- * @param aFs File server session that can be used
- * @param aFile File handle to the object file
- * @param aMimeType MIME-type of the object file.
- * @param aFlags Thumbnail generation flags
- * @param aDisplayMode Display mode
- */
- virtual void GetThumbnailL( RFs& aFs, RFile64& aFile, const TDataType&
- aMimeType, const CThumbnailManager::TThumbnailFlags aFlags, const
- TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference ) = 0;
-
- /**
- * Get thumbnail bitmap. Must be implemented by provider plug-ins.
- *
- * @since S60 5.0
- * @param aFs File server session that can be used
- * @param aBuffer object buffer
- * @param aMimeType MIME-type of the object file.
- * @param aFlags Thumbnail generation flags
- * @param aDisplayMode Display mode
- */
- virtual void GetThumbnailL( RFs& aFs, TDesC8* aBuffer, const
- TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference ) = 0;
-
- /**
- * Get thumbnail bitmap. Must be implemented by provider plug-ins.
- *
- * @since S60 5.0
- * @param aFs File server session that can be used
- * @param aBuffer object buffer
- */
-
- virtual void GetThumbnailL( RFs& aFs, TDesC8& aBuffer) = 0;
-
- /**
- * Cancel a previous thumbnail request, if any.
- *
- * @since S60 5.0
- */
- virtual void CancelGetThumbnail() = 0;
-
- virtual ~CThumbnailProvider(){}
-
-protected:
- /**
- * Get the actual target size for the thumbnail.
- * This is the maximum of the non-cropped and cropped
- * target sizes.
- *
- * @since S60 5.0
- */
- inline void ResolveSize();
-
- /**
- * Calculate the scaled down size for the thumbnail.
- * Aspect ratio is always preserved. If cropping is disabled
- * the resulting size at most as wide or tall as requested.
- * If cropping is enabled, the result is at least as wide
- * and as tall as requested (unless original size is smaller
- * than requested).
- *
- * @since S60 5.0
- * @param aOriginalSize Original size in pixels
- * @param aTargetSize Target size in pixels
- * @param aCrop Enable cropping
- * @return Result size
- */
- inline TSize FitToSize( const TSize& aOriginalSize, const TSize&
- aTargetSize, TBool aCrop );
-
-protected:
- /**
- * Provider observer. Implemented by thumbnail generation task.
- * Not own.
- */
- MThumbnailProviderObserver* iObserver;
-
- /**
- * Thumbnail generation flags.
- */
- CThumbnailManager::TThumbnailFlags iFlags;
-
- /**
- * Thumbnail generation flags.
- */
- CThumbnailManager::TThumbnailQualityPreference iQualityPreference;
-
- /**
- * Size of the original object.
- */
- TSize iOriginalSize;
-
- /**
- * Target size for uncropped thumbnails.
- */
- TSize iTargetSize;
-
- /**
- * Target size for cropped thumbnails.
- */
- TSize iCroppedTargetSize;
-
- /**
- * Display mode for thumbnail bitmap
- */
- TDisplayMode iDisplayMode;
-
- /**
- * ECOM plug-in destructor key.
- */
- TUid iDtor_ID_Key;
-
- /**
- * UID of this implementation.
- */
- TUid iUid;
-};
-
-
-#endif // THUMBNAILPROVIDER_H
--- a/imagehandlingutilities/thumbnailmanager/inc/thumbnailprovider.inl Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* 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: Thumbnail provider class inline functions
-*
-*/
-
-
-#include <e32math.h>
-
-
-inline TSize CThumbnailProvider::FitToSize( const TSize& aOrigSize,
- const TSize& aTargetSize,
- TBool aCrop )
- {
- TSize res;
- TReal32 srcAspect =
- static_cast<TReal32>( aOrigSize.iWidth ) / aOrigSize.iHeight;
- TReal32 reqAspect =
- static_cast<TReal32>( aTargetSize.iWidth ) / aTargetSize.iHeight;
-
- res = aTargetSize;
-
- // Check whether the width or the height is the limiting factor for
- // the size
- TBool widthLimited = srcAspect > reqAspect;
- if ( aCrop )
- {
- // When cropping, this works exactly the opposite way
- widthLimited = srcAspect < reqAspect;
- }
-
- if ( res.iWidth >= aOrigSize.iWidth &&
- res.iHeight >= aOrigSize.iHeight )
- {
- // Original is smaller than requested. No scaling needed.
- res = aOrigSize;
- }
- else if ( widthLimited )
- {
- // Width is the limiting factor, ie. the thumbnail is
- // wide compared to requested size.
- TReal trg;
- TReal src( aTargetSize.iWidth / srcAspect );
- Math::Round( trg, src, 1 );
- res.SetSize(
- aTargetSize.iWidth,
- trg );
- }
- else
- {
- // Height is the limiting factor, ie. the thumbnail is
- // taller compared to requested size.
- TReal trg;
- TReal src( aTargetSize.iHeight * srcAspect );
- Math::Round( trg, src, 1 );
- res.SetSize(
- trg,
- aTargetSize.iHeight );
- }
- return res;
- }
-
-
-inline void CThumbnailProvider::ResolveSize()
- {
- // Get the actual target size for the thumbnail.
- // This is the maximum of the non-cropped and cropped
- // target sizes.
-
- TSize scaledSize = FitToSize( iOriginalSize, iTargetSize, EFalse );
- if ( iCroppedTargetSize.iHeight && iCroppedTargetSize.iWidth )
- {
- TSize croppedSize = FitToSize(
- iOriginalSize, iCroppedTargetSize, ETrue );
- scaledSize.iWidth = Max( scaledSize.iWidth, croppedSize.iWidth );
- scaledSize.iHeight = Max( scaledSize.iHeight, croppedSize.iHeight );
- }
- iTargetSize = scaledSize;
- TN_DEBUG3("CThumbnailProvider::ResolveSize() - iTargetSize=(%d, %d)",
- iTargetSize.iWidth, iTargetSize.iHeight);
- }
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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 ?myapp
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-thumbnailaudioprovider.mmp
-
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/group/thumbnailaudioprovider.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
-* 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: Thumbnail image provider plugin definition file
-*
-*/
-
-
-// To get the MW_LAYER_SYSTEMINCLUDE-definition
-#include <platform_paths.hrh>
-
-#include "../../../inc/thumbnailmanageruids.hrh"
-
-TARGET thumbnailaudioprovider.dll
-CAPABILITY CAP_ECOM_PLUGIN
-TARGETTYPE PLUGIN
-
-UID 0x10009D8D THUMBNAIL_AUDIO_PROVIDER_DLL_UID
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE thumbnailaudioprovider.cpp
-SOURCE thumbnailimagedecoderv3.cpp
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../inc ../traces
-
-SYSTEMINCLUDE /epoc32/include/ecom
-SYSTEMINCLUDE /epoc32/include/icl
-
-START RESOURCE thumbnailaudioprovider.rss
-END
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY efsrv.lib
-LIBRARY imageconversion.lib
-LIBRARY fbscli.lib
-LIBRARY exiflib.lib
-LIBRARY iclextjpegapi.lib
-LIBRARY apmime.lib
-LIBRARY metadatautility.lib
-
-
-DEBUGLIBRARY flogger.lib
-
-OPTION ARMCC -O3 -OTime
-
-PAGED
-BYTEPAIRCOMPRESSTARGET
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/inc/thumbnailaudioprovider.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
-* 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: Image thumbnail provider plugin.
- *
-*/
-
-
-#ifndef THUMBNAILAUDIOPROVIDER_H
-#define THUMBNAILAUDIOPROVIDER_H
-
-#include "thumbnailprovider.h"
-
-class CThumbnailImageDecoderv3;
-
-/**
- * Image thumbnail provider plugin.
- *
- * @since S60 v5.0
- */
-class CThumbnailAudioProvider: public CThumbnailProvider
- {
-
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return New image thumbnail provider instance.
- */
- static CThumbnailAudioProvider* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailAudioProvider();
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aFile Source image file.
- * @param aMimeType MIME-type of the image file.
- * @param aFlags Flags for thumbnail creation.
- * @param aDisplayMode Used display mode.
- */
- void GetThumbnailL( RFs& aFs, RFile64& aFile, const TDataType& aMimeType,
- const CThumbnailManager::TThumbnailFlags aFlags, const TDisplayMode
- aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aBuffer Source image buffer.
- * @param aMimeType MIME-type of the image file.
- * @param aFlags Flags for thumbnail creation.
- * @param aDisplayMode Used display mode.
- */
- void GetThumbnailL( RFs& aFs, TDesC8* aBuffer, const
- TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aBuffer Source image buffer.
- */
- void GetThumbnailL( RFs& aFs, TDesC8& aBuffer);
-
- /**
- * Cancel a previous thumbnail request, if any.
- *
- * @since S60 5.0
- */
- void CancelGetThumbnail();
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New image thumbnail provider instance.
- */
- CThumbnailAudioProvider();
-
-private:
-
- /**
- * Thumbnail decoder.
- */
- CThumbnailImageDecoderv3* iImageDecoderv3;
-
-
- /**
- * File server session.
- * Not own.
- */
- RFs iFs;
-
- /**
- * Mime-type of image
- */
- TDataType iMimeType;
-};
-
-#include "thumbnailprovider.inl"
-
-#endif // THUMBNAILIMAGEPROVIDER_H
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/inc/thumbnailimagedecoderv3.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
-* 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: Image thumbnail decoder.
- *
-*/
-
-
-#ifndef THUMBNAILIMAGEDECODERV3_H
-#define THUMBNAILIMAGEDECODERV3_H
-
-#include "thumbnailprovider.h"
-
-class CImageDecoder;
-class CFbsBitmap;
-
-// Size of buffer to load from file start to get EXIF thumbnail
-const TInt KJpegLoadBufferSize = 64 * 1024;
-
-
-/**
- * Image thumbnail decoder.
- *
- * @since S60 v5.0
- */
-class CThumbnailImageDecoderv3: public CActive
- {
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @return New image thumbnail decoder instance.
- */
- CThumbnailImageDecoderv3( RFs& aFs );
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailImageDecoderv3();
-
-
- /**
- * Creates a decoder from the given image buffer and gets image
- * information
- *
- * @since S60 v5.0
- * @param aBuffer Source image buffer.
- * @param aObserver Observer to relay notifications about completed
- * operations.
- * @param aFlags Decoding option flags.
- * @param aMimeType Mime-type of image to be decoded.
- * @param aSize desired size of thumbnail.
- */
- void CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver&
- aObserver, const CThumbnailManager::TThumbnailFlags aFlags, const
- TDataType& aMimeType, const TSize& aSize );
-
- /**
- * Decode image.
- *
- * @since S60 v5.0
- * @param aDisplayMode Preferred display mode.
- */
- void DecodeL( const TDisplayMode aDisplayMode );
-
- /**
- * Returns the size of original image.
- *
- * @since S60 v5.0
- * @return Size of original image.
- */
- const TSize& OriginalSize()const;
-
- /**
- * Leave if image is corrupt
- *
- * @since S60 v5.0
- */
- void LeaveIfCorruptL(const TInt aError );
-
-private:
- /**
- * Used to release reserved resources.
- *
- * @since S60 v5.0
- */
- void Release();
-
- /**
- * Implements cancellation of an outstanding request.
- *
- * @since S60 v5.0
- */
- void DoCancel();
-
- /**
- * Handles an active object's request completion event.
- *
- * @since S60 v5.0
- */
- void RunL();
-
-
- /**
- * Creates image decoder to be used.
- *
- * @since S60 v5.0
- */
- void CreateDecoderL();
-
-
-
-private:
- // data
-
- /**
- * Requested size.
- */
- TSize iSize;
-
- /**
- * Image decoder.
- * Own.
- */
- CImageDecoder* iDecoder;
-
- /**
- * Decoded bitmap.
- * Own.
- */
- CFbsBitmap* iBitmap;
-
- /**
- * Image info flags (from TFrameInfo)
- */
- TUint32 iFrameInfoFlags;
-
- /**
- * Original size of the image in pixels.
- */
- TSize iOriginalSize;
-
- /**
- * Used fileserver.
- */
- RFs& iFs;
-
-
- /**
- * Buffer from which thumbnail is to be created.
- */
- const TDesC8* iBuffer;
-
- /**
- * Observer.
- */
- MThumbnailProviderObserver* iObserver; // not own
-
- /**
- * Mime-type.
- */
- TDataType iMimeType;
-};
-
-#endif // THUMBNAILIMAGEDECODERV3_H
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
-* 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: Audio thumbnail provider plugin
- *
-*/
-
-
-#include <ecom/ecom.h>
-#include <implementationproxy.h>
-
-#include "thumbnailaudioprovider.h"
-#include "thumbnailimagedecoderv3.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnaillog.h"
-#include <MetaDataUtility.h>
-#include <MetaDataFieldContainer.h>
-#include "thumbnailmanagerconstants.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailaudioproviderTraces.h"
-#endif
-
-
-
-#ifndef IMPLEMENTATION_PROXY_ENTRY
-typedef TAny* TProxyNewLPtr;
-#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) \
-{ {aUid}, static_cast<TProxyNewLPtr>(aFuncPtr) }
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailAudioProvider* CThumbnailAudioProvider::NewL()
- {
- CThumbnailAudioProvider* self = new( ELeave )CThumbnailAudioProvider();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailAudioProvider::CThumbnailAudioProvider()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailAudioProvider::CThumbnailAudioProvider()
- {
- TN_DEBUG1( "CThumbnailAudioProvider::CThumbnailAudioProvider()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILAUDIOPROVIDER_CTHUMBNAILAUDIOPROVIDER, "CThumbnailAudioProvider::CThumbnailAudioProvider" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailAudioProvider::~CThumbnailAudioProvider()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailAudioProvider::~CThumbnailAudioProvider()
- {
- TN_DEBUG1( "CThumbnailAudioProvider::~CThumbnailAudioProvider()" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILAUDIOPROVIDER_CTHUMBNAILAUDIOPROVIDER, "CThumbnailAudioProvider::~CThumbnailAudioProvider" );
-
- delete iImageDecoderv3;
- iImageDecoderv3 = NULL;
- REComSession::DestroyedImplementation( iDtor_ID_Key );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailAudioProvider::GetThumbnailL()
-// Provides the thumbnail image
-// ---------------------------------------------------------------------------
-//
-void CThumbnailAudioProvider::GetThumbnailL( RFs& aFs, RFile64& aFile, const
- TDataType& aMimeType , const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference /*aQualityPreference*/ )
- {
- TN_DEBUG1( "CThumbnailAudioProvider::GetThumbnailL() - rfile " );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILAUDIOPROVIDER_GETTHUMBNAILL, "CThumbnailAudioProvider::GetThumbnailL - rfile" );
- CMetaDataUtility* metaDataUtil = CMetaDataUtility::NewL();
- CleanupStack::PushL( metaDataUtil );
-
- RArray<TMetaDataFieldId> wantedFields;
- CleanupClosePushL(wantedFields);
- wantedFields.AppendL(EMetaDataJpeg);
-
- metaDataUtil->OpenFileL(aFile, wantedFields, aMimeType.Des8());
- const CMetaDataFieldContainer& metaCont = metaDataUtil->MetaDataFieldsL();
- TPtrC8 ptr = metaCont.Field8( EMetaDataJpeg );
- HBufC8* data = ptr.AllocL();
-
- CleanupStack::PopAndDestroy(&wantedFields);
- CleanupStack::PopAndDestroy(metaDataUtil);
- CleanupStack::PushL( data );
-
- if(data->Length() == 0)
- {
- User::Leave( KErrNotFound );
- }
-
- if ( !iImageDecoderv3 )
- {
- iImageDecoderv3 = new( ELeave )CThumbnailImageDecoderv3( aFs );
- }
-
- iMimeType = TDataType(KJpegMime);
- iFlags = aFlags;
- //set default mode displaymode from global constants
- iDisplayMode = KStoreDisplayMode;
- TRAPD( err, iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize ) );
- if (err == KErrNone)
- {
- CleanupStack::Pop( data );
- }
- else
- {
- // this is because data buffer is already released in CreateDecoderL
- // and we must prevent automatic PopAndDestroy
- CleanupStack::Pop( data );
- User::Leave(err);
- }
-
- iOriginalSize = iImageDecoderv3->OriginalSize();
- iImageDecoderv3->DecodeL( iDisplayMode );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailAudioProvider::GetThumbnailL()
-// Provides the thumbnail image
-// ---------------------------------------------------------------------------
-//
-void CThumbnailAudioProvider::GetThumbnailL( RFs& /* aFs */, TDesC8* /* aBuffer */, const
- TDataType& /*aMimeType */, const CThumbnailManager::TThumbnailFlags /* aFlags */,
- const TDisplayMode /* aDisplayMode */, const CThumbnailManager::TThumbnailQualityPreference /*aQualityPreference*/ )
- {
- TN_DEBUG1( "CThumbnailAudioProvider::GetThumbnailL() - buffer" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILAUDIOPROVIDER_GETTHUMBNAILL, "CThumbnailAudioProvider::GetThumbnailL - buffer" );
- __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbnailAudioProvider::GetThumbnailL"), KErrNotSupported));
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailAudioProvider::GetThumbnailL()
-// Provides the thumbnail image
-// ---------------------------------------------------------------------------
-//
-void CThumbnailAudioProvider::GetThumbnailL( RFs& /* aFs */, TDesC8& /*aBuffer */)
- {
- TN_DEBUG1( "CThumbnailAudioProvider::GetThumbnailL() - buffer no mime" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILAUDIOPROVIDER_GETTHUMBNAILL, "CThumbnailAudioProvider::GetThumbnailL - buffer no mime" );
- __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbnailAudioProvider::GetThumbnailL"), KErrNotSupported));
- User::Leave( KErrNotSupported );
- }
-
-// ---------------------------------------------------------------------------
-// Cancel thumbnail request
-// ---------------------------------------------------------------------------
-//
-void CThumbnailAudioProvider::CancelGetThumbnail()
- {
- if ( iImageDecoderv3)
- {
- iImageDecoderv3->Cancel();
- }
-
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
-// -----------------------------------------------------------------------------
-// ImplementationTable
-// Define the interface UIDs
-// -----------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( THUMBNAIL_AUDIO_PROVIDER_IMP_UID,
- CThumbnailAudioProvider::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
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailaudioprovider.rss Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* 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: Image thumbnail provider plugin resource file
-*
-*/
-
-
-#include "registryinfov2.rh"
-#include "thumbnailmanageruids.hrh"
-
-RESOURCE REGISTRY_INFO theInfo
-{
-// resource_format_version must always be set as follows
-resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
-// Normal plug-in parameters
-dll_uid = THUMBNAIL_AUDIO_PROVIDER_DLL_UID;
-interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = THUMBNAIL_PROVIDER_IF_UID;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = THUMBNAIL_AUDIO_PROVIDER_IMP_UID;
- version_no = 1;
- display_name = "";
- default_data = "";
- opaque_data = "audio/*";
- rom_only = 0;
- }
- };
- }
- };
-}
--- a/imagehandlingutilities/thumbnailmanager/plugins/audio/src/thumbnailimagedecoderv3.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,302 +0,0 @@
-/*
-* 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: Image thumbnail decoder
- *
-*/
-
-
-//INCLUDE FILES
-#include <e32base.h>
-#include <imageconversion.h>
-#include <ExifRead.h>
-
-#include <IclExtJpegApi.h>
-#include "thumbnailimagedecoderv3.h"
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailimagedecoderv3Traces.h"
-#endif
-
-
-
-// CImageDecoder supports up to 1/8 size reduction if EFullyScaleable is
-// not set.
-const TInt KMaximumReductionFactor = 8;
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageDecoder::CThumbnailImageDecoder()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageDecoderv3::CThumbnailImageDecoderv3( RFs& aFs ):
- CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
- {
- CActiveScheduler::Add( this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::~CThumbnailImageDecoderv3()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageDecoderv3::~CThumbnailImageDecoderv3()
- {
- Release();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::CreateL()
-// Creates thumbnail of image
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv3::CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver&
- aObserver, const CThumbnailManager::TThumbnailFlags /*aFlags*/, const
- TDataType& aMimeType, const TSize& aSize )
- {
-
- TN_DEBUG1( "CCThumbnailImageDecoderv3::CreateL() called" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV3_CREATEL, "CThumbnailImageDecoderv3::CreateL" );
-
- iSize = aSize;
- iMimeType = aMimeType;
- iObserver = &aObserver;
- iBuffer = aBuffer;
-
- CreateDecoderL();
-
- const TFrameInfo info( iDecoder->FrameInfo());
- if (( info.iOverallSizeInPixels.iWidth < 1 ) || (
- info.iOverallSizeInPixels.iHeight < 1 ))
- {
- User::Leave( KErrCorrupt );
- }
- iFrameInfoFlags = info.iFlags;
- iOriginalSize = info.iOverallSizeInPixels;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::DecodeL()
-// Decode the thumbnail image
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv3::DecodeL( const TDisplayMode aDisplayMode )
- {
- TN_DEBUG1( "CThumbnailImageDecoderv3::DecodeL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV3_DECODEL, "CThumbnailImageDecoderv3::DecodeL - start" );
-
- // Create the bitmap
- if ( !iBitmap )
- {
- iBitmap = new( ELeave )CFbsBitmap();
- }
-
- //Size in both x and y dimension must be non-zero, positive value
- TSize loadSize( iOriginalSize) ;
-
- // If EFullyScaleable flag is not set, we need to figure out a size
- // reduction factor. 1/1, 1/2, 1/4, and 1/8 are possible values for all
- // plug-ins. SVG graphics can be rendered at any size even though
- // EFullyScaleable is not set.
- if ( !( iFrameInfoFlags& TFrameInfo::EFullyScaleable ) )
- {
- loadSize = iOriginalSize;
- TInt reductionFactor = 1;
- while ( reductionFactor < KMaximumReductionFactor && ( iSize.iWidth <
- loadSize.iWidth / 2 ) && ( iSize.iHeight < loadSize.iHeight / 2 ))
- {
- // magic: use loadSize that is half of previous size
- loadSize.iWidth /= 2;
- loadSize.iHeight /= 2;
- reductionFactor *= 2;
- }
- // If original size is not an exact multiple of reduction factor,
- // we need to round loadSize up
- if ( reductionFactor && iOriginalSize.iWidth % reductionFactor )
- {
- loadSize.iWidth++;
- }
- if ( reductionFactor && iOriginalSize.iHeight % reductionFactor )
- {
- loadSize.iHeight++;
- }
- TN_DEBUG4(
- "EFullyScaleable not set for image - loadSize=(%d,%d) reduction=1/%d ", loadSize.iWidth, loadSize.iHeight, reductionFactor );
- OstTraceExt3( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODERV3_DECODEL, "CThumbnailImageDecoderv3::DecodeL;loadSize.iWidth=%d;loadSize.iHeight=%d;reductionFactor=%d", loadSize.iWidth, loadSize.iHeight, reductionFactor );
- }
-
- TInt err = iBitmap->Create( loadSize, aDisplayMode );
- if (err != KErrNone)
- {
- Release();
- User::Leave(err);
- }
-
- iDecoder->Convert( &iStatus, * iBitmap );
-
- SetActive();
-
- TN_DEBUG1( "CThumbnailImageDecoderv3::DecodeL() end" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODERV3_DECODEL, "CThumbnailImageDecoderv3::DecodeL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::Release()
-// Releases resources
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv3::Release()
- {
- Cancel();
-
- delete iDecoder;
- iDecoder = NULL;
-
- delete iBitmap;
- iBitmap = NULL;
- delete iBuffer; // we own the buffer
- iBuffer = NULL;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::DoCancel()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv3::DoCancel()
- {
- if ( iDecoder )
- {
- iDecoder->Cancel();
- delete iDecoder;
- iDecoder = NULL;
- }
-
- delete iBitmap;
- iBitmap = NULL;
- delete iBuffer; // we own the buffer
- iBuffer = NULL;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::RunL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv3::RunL()
- {
- // This call takes ownership of iBitmap
- iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse );
-
- iBitmap = NULL; // owned by server now
- delete iBuffer; // we own the buffer
- iBuffer = NULL;
-
- Release();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::CreateDecoderL
-// Creates image decoder
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv3::CreateDecoderL()
- {
- delete iDecoder;
- iDecoder = NULL;
-
- CImageDecoder::TOptions options = ( CImageDecoder::TOptions )(
- CImageDecoder::EOptionNoDither );
-
- TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
- CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV3_CREATEDECODERL, "CThumbnailImageDecoderv3::CreateDecoderL - HW CExtJpegDecoder failed;decErr=%d", decErr );
-
- LeaveIfCorruptL( decErr );
-
- TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
- CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODERV3_CREATEDECODERL, "CThumbnailImageDecoderv3::CreateDecoderL - SW CExtJpegDecoder failed;decErr=%d", decErr );
-
- LeaveIfCorruptL( decErr );
- // don't force any mime type
- TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
- if ( decErr != KErrNone )
- {
- Release();
- TN_DEBUG2( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder error %d", decErr );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODERV3_CREATEDECODERL, "CThumbnailImageDecoderv3::CreateDecoderL - CImageDecoder error;decErr=%d", decErr );
-
- User::Leave( decErr );
- }
-
- TN_DEBUG1( "CThumbnailImageDecoderv3::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODERV3_CREATEDECODERL, "CThumbnailImageDecoderv3::CreateDecoderL - CImageDecoder created" );
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoderv3::CreateDecoderL() - SW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODERV3_CREATEDECODERL, "CThumbnailImageDecoderv3::CreateDecoderL - SW CExtJpegDecoder created" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoderv3::CreateDecoderL() - HW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODERV3_CREATEDECODERL, "CThumbnailImageDecoderv3::CreateDecoderL - HW CExtJpegDecoder created" );
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv3::CreateExifDecoderL()
-// Returns size of original image
-// -----------------------------------------------------------------------------
-//
-const TSize& CThumbnailImageDecoderv3::OriginalSize()const
- {
- return iOriginalSize;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder3::LeaveIfCorruptL()
-// Leave is image is corrupted
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv3::LeaveIfCorruptL(const TInt aError )
- {
- //no sense to try other codecs if image is corrupted
- if( aError == KErrCorrupt || aError == KErrUnderflow)
- {
- Release();
- User::Leave( aError );
- }
- }
-
-//End of file
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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 ?myapp
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-thumbnailimageprovider.mmp
-
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/group/thumbnailimageprovider.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* 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: Thumbnail image provider plugin definition file
-*
-*/
-
-
-// To get the MW_LAYER_SYSTEMINCLUDE-definition
-#include <platform_paths.hrh>
-
-#include "../../../inc/thumbnailmanageruids.hrh"
-
-TARGET thumbnailimageprovider.dll
-CAPABILITY CAP_ECOM_PLUGIN
-TARGETTYPE PLUGIN
-
-UID 0x10009D8D THUMBNAIL_IMAGE_PROVIDER_DLL_UID
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE thumbnailimageprovider.cpp
-SOURCE thumbnailimagedecoder.cpp
-SOURCE thumbnailimagedecoderv2.cpp
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../inc ../traces
-
-SYSTEMINCLUDE /epoc32/include/ecom
-SYSTEMINCLUDE /epoc32/include/icl
-
-START RESOURCE ../src/thumbnailimageprovider.rss
-END
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY efsrv.lib
-LIBRARY imageconversion.lib
-LIBRARY fbscli.lib
-LIBRARY exiflib.lib
-LIBRARY iclextjpegapi.lib
-LIBRARY apmime.lib
-
-DEBUGLIBRARY flogger.lib
-
-OPTION ARMCC -O3 -OTime
-
-PAGED
-BYTEPAIRCOMPRESSTARGET
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/inc/thumbnailimagedecoder.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-/*
-* 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: Image thumbnail decoder.
- *
-*/
-
-
-#ifndef THUMBNAILIMAGEDECODER_H
-#define THUMBNAILIMAGEDECODER_H
-
-#include "thumbnailprovider.h"
-
-class CImageDecoder;
-class CFbsBitmap;
-
-// Size of buffer to load from file start to get EXIF thumbnail
-const TInt KJpegLoadBufferSize = 64 * 1024;
-
-
-/**
- * Image thumbnail decoder.
- *
- * @since S60 v5.0
- */
-class CThumbnailImageDecoder: public CActive
- {
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @return New image thumbnail decoder instance.
- */
- CThumbnailImageDecoder( RFs& aFs );
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailImageDecoder();
-
- /**
- * Creates a decoder from the given image file and gets image
- * information
- *
- * @since S60 v5.0
- * @param aFile Source image file.
- * @param aObserver Observer to relay notifications about completed
- * operations.
- * @param aFlags Decoding option flags.
- * @param aMimeType Mime-type of image to be decoded.
- * @param aSize desired size of thumbnail.
- * @param aRotateIfNeeded If ETrue rectangle is rotated to maximize the decoded size (full screen images only)
- */
- void CreateL( RFile64& aFile, MThumbnailProviderObserver& aObserver, const
- CThumbnailManager::TThumbnailQualityPreference aFlags, const TDataType& aMimeType,
- const TSize& aSize );
-
- /**
- * Creates a decoder from the given image buffer and gets image
- * information
- *
- * @since S60 v5.0
- * @param aBuffer Source image buffer.
- * @param aObserver Observer to relay notifications about completed
- * operations.
- * @param aFlags Decoding option flags.
- * @param aMimeType Mime-type of image to be decoded.
- * @param aSize desired size of thumbnail.
- * @param aRotateIfNeeded If ETrue rectangle is rotated to maximize the decoded size (full screen images only)
- */
- void CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver&
- aObserver, const CThumbnailManager::TThumbnailQualityPreference aFlags, const
- TDataType& aMimeType, const TSize& aSize);
-
- /**
- * Decode image.
- *
- * @since S60 v5.0
- * @param aDisplayMode Preferred display mode.
- */
- void DecodeL( const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailFlags aFlags );
-
- /**
- * Returns the size of original image.
- *
- * @since S60 v5.0
- * @return Size of original image.
- */
- const TSize& OriginalSize()const;
-
- /**
- * Leave if image is corrupt
- *
- * @since S60 v5.0
- */
- void LeaveIfCorruptL(const TInt aError );
-
-private:
- /**
- * Used to release reserved resources.
- *
- * @since S60 v5.0
- */
- void Release();
-
- /**
- * Implements cancellation of an outstanding request.
- *
- * @since S60 v5.0
- */
- void DoCancel();
-
- /**
- * Handles an active object's request completion event.
- *
- * @since S60 v5.0
- */
- void RunL();
-
- /**
- * Used to check if source is jpg/jpeg image.
- *
- * @since S60 v5.0
- * @return ETrue if image was jpg/jpeg format, otherwise EFalse
- */
- TBool IsJpeg();
-
- /**
- * Used to check if source is svg image.
- *
- * @since S60 v5.0
- * @return ETrue if image was in svg format, otherwise EFalse
- */
- TBool IsSvg();
-
- /**
- * Creates image decoder to be used.
- *
- * @since S60 v5.0
- */
- void CreateDecoderL( CThumbnailManager::TThumbnailQualityPreference aFlags );
-
- /**
- * Creates ExifDecoder.
- *
- * @since S60 v5.0
- */
- void CreateExifDecoderL( CThumbnailManager::TThumbnailQualityPreference aFlags );
-
-private:
- // data
-
- /**
- * Requested size.
- */
- TSize iSize;
-
- /**
- * Image decoder.
- * Own.
- */
- CImageDecoder* iDecoder;
-
- /**
- * Decoded bitmap.
- * Own.
- */
- CFbsBitmap* iBitmap;
-
- /**
- * Image info flags (from TFrameInfo)
- */
- TUint32 iFrameInfoFlags;
-
- /**
- * Original size of the image in pixels.
- */
- TSize iOriginalSize;
-
- /**
- * Buffer for reading the beginning of a JPEG file to get the
- * EXIF thumbnail data.
- */
- HBufC8* iJpegReadBuffer;
-
- /**
- * EXIF thumbnail image compressed as JPEG
- */
- HBufC8* iExifThumbImage;
-
- /**
- * Used fileserver.
- */
- RFs& iFs;
-
- /**
- * File from which thumbnail is to be created.
- */
- RFile64 iFile;
-
- /**
- * Buffer from which thumbnail is to be created.
- */
- const TDesC8* iBuffer;
-
- /**
- * Observer.
- */
- MThumbnailProviderObserver* iObserver; // not own
-
- /**
- * Mime-type.
- */
- TDataType iMimeType;
-
- /**
- * Is origin EXIF
- */
- TBool iEXIF;
-
- /**
- * Portrait image
- */
- TBool iPortrait;
-};
-
-#endif // THUMBNAILIMAGEDECODER_H
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/inc/thumbnailimagedecoderv2.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
-* 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: Image thumbnail decoderv2.
- *
-*/
-
-
-#ifndef THUMBNAILIMAGEDECODERV2_H
-#define THUMBNAILIMAGEDECODERV2_H
-
-#include "thumbnailprovider.h"
-
-class CImageDecoder;
-class CFbsBitmap;
-
-/**
- * Image thumbnail decoder.
- *
- * @since S60 v5.0
- */
-class CThumbnailImageDecoderv2: public CActive
- {
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @return New image thumbnail decoder instance.
- */
- CThumbnailImageDecoderv2( RFs& aFs);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailImageDecoderv2();
-
- /**
- * Creates a decoder from the given image buffer and gets image
- * information
- *
- * @since S60 v5.0
- * @param aBuffer Source image buffer.
- * @param aObserver Observer to relay notifications about completed
- * operations.
- */
- void CreateL(TDesC8& aBuffer, MThumbnailProviderObserver& aObserver);
-
- /**
- * Decode image.
- *
- * @since S60 v5.0
- * @param aDisplayMode Preferred display mode.
- */
- void DecodeL();
-
-private:
- /**
- * Used to release reserved resources.
- *
- * @since S60 v5.0
- */
- void Release();
-
- /**
- * Implements cancellation of an outstanding request.
- *
- * @since S60 v5.0
- */
- void DoCancel();
-
- /**
- * Handles an active object's request completion event.
- *
- * @since S60 v5.0
- */
- void RunL();
-
- /**
- * Creates image decoder to be used.
- *
- * @since S60 v5.0
- */
- void CreateDecoderL();
-
- /**
- * Leave if image is corrupt
- *
- * @since S60 v5.0
- */
- void LeaveIfCorruptL(const TInt aError );
-
-private:
- // data
-
- /**
- * Image decoder.
- * Own.
- */
- CImageDecoder* iDecoder;
-
- /**
- * Original size of the image in pixels.
- */
- TSize iOriginalSize;
-
- /**
- * Decoded bitmap.
- * Own.
- */
- CFbsBitmap* iBitmap;
-
- /**
- * Used fileserver.
- */
- RFs& iFs;
-
- /**
- * Buffer from which thumbnail is to be created.
- */
- TDesC8* iBuffer;
-
- /**
- * Observer.
- */
- MThumbnailProviderObserver* iObserver; // not own
-};
-
-#endif // THUMBNAILIMAGEDECODERV2_H
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/inc/thumbnailimageprovider.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
-* 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: Image thumbnail provider plugin.
- *
-*/
-
-
-#ifndef THUMBNAILIMAGEPROVIDER_H
-#define THUMBNAILIMAGEPROVIDER_H
-
-#include "thumbnailprovider.h"
-
-class CThumbnailImageDecoder;
-class CThumbnailImageDecoderv2;
-
-/**
- * Image thumbnail provider plugin.
- *
- * @since S60 v5.0
- */
-class CThumbnailImageProvider: public CThumbnailProvider
- {
-
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return New image thumbnail provider instance.
- */
- static CThumbnailImageProvider* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailImageProvider();
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aFile Source image file.
- * @param aMimeType MIME-type of the image file.
- * @param aFlags Flags for thumbnail creation.
- * @param aDisplayMode Used display mode.
- */
- void GetThumbnailL( RFs& aFs, RFile64& aFile, const TDataType& aMimeType,
- const CThumbnailManager::TThumbnailFlags aFlags, const TDisplayMode
- aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aBuffer Source image buffer.
- * @param aMimeType MIME-type of the image file.
- * @param aFlags Flags for thumbnail creation.
- * @param aDisplayMode Used display mode.
- */
- void GetThumbnailL( RFs& aFs, TDesC8* aBuffer, const
- TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aBuffer Source image buffer.
- */
- void GetThumbnailL( RFs& aFs, TDesC8& aBuffer);
-
- /**
- * Cancel a previous thumbnail request, if any.
- *
- * @since S60 5.0
- */
- void CancelGetThumbnail();
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New image thumbnail provider instance.
- */
- CThumbnailImageProvider();
-
-private:
-
- /**
- * Thumbnail decoder.
- */
- CThumbnailImageDecoder* iImageDecoder;
-
- /**
- * Thumbnail decoderv2.
- */
- CThumbnailImageDecoderv2* iImageDecoderv2;
-
- /**
- * File server session.
- * Not own.
- */
- RFs iFs;
-
- /**
- * Mime-type of image
- */
- TDataType iMimeType;
-};
-
-#include "thumbnailprovider.inl"
-
-#endif // THUMBNAILIMAGEPROVIDER_H
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoder.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,674 +0,0 @@
-/*
-* 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: Image thumbnail decoder
- *
-*/
-
-
-
-//INCLUDE FILES
-#include <e32base.h>
-#include <imageconversion.h>
-#include <ExifRead.h>
-#include <e32math.h>
-
-#include <IclExtJpegApi.h>
-#include "thumbnailimagedecoder.h"
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailimagedecoderTraces.h"
-#endif
-
-
-const TUid KImageTypeSVGUid =
- {
- 0x102073E7
-};
-
-// CImageDecoder supports up to 1/8 size reduction if EFullyScaleable is
-// not set.
-const TInt KMaximumReductionFactor = 8;
-
-// Matchers for recognizing JPEG files
-_LIT( KJpegMime, "image/jpeg" );
-
-// Matcher for recognizing SVG files
-_LIT( KSvgMime, "image/svg+xml" );
-
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageDecoder::CThumbnailImageDecoder()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageDecoder::CThumbnailImageDecoder( RFs& aFs ):
- CActive(EPriorityStandard ), iBitmap( NULL ), iJpegReadBuffer( NULL ),
- iExifThumbImage( NULL ), iFs( aFs ), iBuffer( NULL )
- {
- CActiveScheduler::Add( this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageDecoder::~CThumbnailImageDecoder()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageDecoder::~CThumbnailImageDecoder()
- {
- Release();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::CreateL()
-// Creates thumbnail of image
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::CreateL( RFile64& aFile, MThumbnailProviderObserver&
- aObserver, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const
- TDataType& aMimeType, const TSize& aSize)
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - start" );
-
- iBuffer = NULL;
- iSize = aSize;
- iMimeType = aMimeType;
- iObserver = &aObserver;
- iFile = aFile;
-
- CreateDecoderL( aQualityPreference );
-
- const TFrameInfo info( iDecoder->FrameInfo());
- if (( info.iOverallSizeInPixels.iWidth < 1 ) || (
- info.iOverallSizeInPixels.iHeight < 1 ))
- {
- User::Leave( KErrCorrupt );
- }
- iFrameInfoFlags = info.iFlags;
- iOriginalSize = info.iOverallSizeInPixels;
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateL() end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::CreateL()
-// Creates thumbnail of image
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::CreateL( const TDesC8* aBuffer, MThumbnailProviderObserver&
- aObserver, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const
- TDataType& aMimeType, const TSize& aSize)
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateL() start" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - start" );
-
- iSize = aSize;
- iMimeType = aMimeType;
- iObserver = &aObserver;
- iBuffer = aBuffer;
-
- CreateDecoderL( aQualityPreference );
-
- const TFrameInfo info( iDecoder->FrameInfo());
- if (( info.iOverallSizeInPixels.iWidth < 1 ) || (
- info.iOverallSizeInPixels.iHeight < 1 ))
- {
- User::Leave( KErrCorrupt );
- }
- iFrameInfoFlags = info.iFlags;
- iOriginalSize = info.iOverallSizeInPixels;
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateL() end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODER_CREATEL, "CThumbnailImageDecoder::CreateL - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::DecodeL()
-// Decode the thumbnail image
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::DecodeL( const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailFlags aFlags)
- {
- TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - start" );
-
- // Create the bitmap
- if ( !iBitmap )
- {
- iBitmap = new( ELeave )CFbsBitmap();
- }
-
- TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight );
- OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iSize.iWidth=%d;iSize.iHeight=%d", iSize.iWidth, iSize.iHeight );
- if( iOriginalSize.iWidth < iOriginalSize.iHeight )
- {
- TInt height = iSize.iHeight;
- iSize.iHeight = iSize.iWidth;
- iSize.iWidth = height;
- iPortrait = ETrue;
- TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() %d x %d", iSize.iWidth, iSize.iHeight );
- OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iSize.iWidth=%d;iSize.iHeight=%d", iSize.iWidth, iSize.iHeight );
- }
- else
- {
- iPortrait = EFalse;
- }
-
- TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() iOriginalSize = %d x %d", iOriginalSize.iWidth, iOriginalSize.iHeight );
- OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;iOriginalSize.iWidth=%d;iOriginalSize.iHeight=%d", iOriginalSize.iWidth, iOriginalSize.iHeight );
-
- //Size in both x and y dimension must be non-zero, positive value
- TSize loadSize( iOriginalSize) ;
-
- if(iOriginalSize.iHeight < iSize.iHeight || iOriginalSize.iWidth < iSize.iWidth )
- {
- loadSize = iOriginalSize;
- TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() LoadSize is OriginalSize" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - LoadSize is OriginalSize" );
- }
- else if((iFrameInfoFlags& TFrameInfo::EFullyScaleable || IsSvg()) && aFlags == !CThumbnailManager::ECropToAspectRatio)
- {
- loadSize = iSize;
- TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() EFullyScaleable start" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - EFullyScaleable start" );
- const TReal32 srcAspect = static_cast < TReal32 > (
- iOriginalSize.iWidth ) / iOriginalSize.iHeight;
-
- // set loadsize to maximum size within target size
- if ( (loadSize.iHeight * srcAspect) <= loadSize.iWidth )
- {
- TReal trg = 0;
- TReal src( loadSize.iHeight * srcAspect );
- Math::Round( trg, src, 0 );
- loadSize.SetSize( trg, loadSize.iHeight );
- }
- else
- {
- TReal trg;
- TReal src( loadSize.iWidth / srcAspect );
- Math::Round( trg, src, 0 );
- loadSize.SetSize( loadSize.iWidth, trg );
- }
-
- TN_DEBUG3( "CThumbnailImageDecoder::DecodeL() EFullyScaleable loadSize = %d x %d", loadSize.iWidth, loadSize.iHeight );
- OstTraceExt2( TRACE_NORMAL, DUP6_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - EFullyScaleable;loadSize.iWidth=%d;loadSize.iHeight=%d", loadSize.iWidth, loadSize.iHeight );
- }
- else
- {
-
- // Size reduction factor. 1/1, 1/2, 1/4, and 1/8 are possible values for all
- // plug-ins. SVG graphics can be rendered at any size.
- TInt reductionFactor = 1;
- while ( reductionFactor < KMaximumReductionFactor && ( iSize.iWidth <
- loadSize.iWidth / 2 ) && ( iSize.iHeight < loadSize.iHeight / 2 ))
- {
- // magic: use loadSize that is half of previous size
- loadSize.iWidth /= 2;
- loadSize.iHeight /= 2;
- reductionFactor *= 2;
- }
- // If original size is not an exact multiple of reduction factor,
- // we need to round loadSize up
- if ( reductionFactor && iOriginalSize.iWidth % reductionFactor )
- {
- loadSize.iWidth++;
- }
- if ( reductionFactor && iOriginalSize.iHeight % reductionFactor )
- {
- loadSize.iHeight++;
- }
- TN_DEBUG4(
- "CThumbnailImageDecoder::DecodeL() - loadSize = (%d,%d) reduction = 1/%d ", loadSize.iWidth, loadSize.iHeight, reductionFactor );
- OstTraceExt3( TRACE_NORMAL, DUP7_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL;loadSize.iWidth=%d;loadSize.iHeight=%d;reductionFactor=%d", loadSize.iWidth, loadSize.iHeight, reductionFactor );
- }
-
- TInt err = iBitmap->Create( loadSize, aDisplayMode );
- if (err != KErrNone)
- {
- delete iBitmap;
- iBitmap = NULL;
- User::Leave(err);
- }
-
- iDecoder->Convert( &iStatus, * iBitmap );
-
- SetActive();
-
- TN_DEBUG1( "CThumbnailImageDecoder::DecodeL() end" );
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILIMAGEDECODER_DECODEL, "CThumbnailImageDecoder::DecodeL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::Release()
-// Releases resources
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::Release()
- {
- Cancel();
-
- delete iDecoder;
- iDecoder = NULL;
-
- delete iBitmap;
- iBitmap = NULL;
- delete iJpegReadBuffer;
- iJpegReadBuffer = NULL;
- delete iExifThumbImage;
- iExifThumbImage = NULL;
-
- iBuffer = NULL; // we don't own the buffer
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::DoCancel()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::DoCancel()
- {
- if ( iDecoder )
- {
- iDecoder->Cancel();
- delete iDecoder;
- iDecoder = NULL;
- }
-
- delete iBitmap;
- iBitmap = NULL;
- delete iJpegReadBuffer;
- iJpegReadBuffer = NULL;
- delete iExifThumbImage;
- iExifThumbImage = NULL;
-
- iBuffer = NULL; // we don't own the buffer
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::RunL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::RunL()
- {
- // This call takes ownership of iBitmap
- iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, iEXIF, iPortrait );
-
- iBitmap = NULL; // owned by server now
- iBuffer = NULL; // we don't own the buffer
-
- Release();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::IsJpeg()
-// -----------------------------------------------------------------------------
-//
-TBool CThumbnailImageDecoder::IsJpeg()
- {
- __ASSERT_DEBUG(( iMimeType.Des() != KNullDesC ), ThumbnailPanic(
- EThumbnailEmptyDescriptor ));
-
- if ( KJpegMime() == iMimeType.Des())
- {
- return ETrue;
- }
- return EFalse;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::IsSvg()
-// -----------------------------------------------------------------------------
-//
-TBool CThumbnailImageDecoder::IsSvg()
- {
- __ASSERT_DEBUG(( iMimeType.Des() != KNullDesC ), ThumbnailPanic(
- EThumbnailEmptyDescriptor ));
-
- if ( KSvgMime() == iMimeType.Des())
- {
- return ETrue;
- }
- return EFalse;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::CreateDecoderL
-// Creates image decoder
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::CreateDecoderL( CThumbnailManager::TThumbnailQualityPreference
- aFlags )
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - start" );
-
- TBool thumbFound( EFalse );
-
- // If the image is in jpeg format, try to get thumbnail from EXIF data (if EOptimizeForQuality not set)
- if ( IsJpeg() && !( aFlags == CThumbnailManager::EOptimizeForQuality ))
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create exif decoder" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - create exif decoder" );
- TRAPD( err, CreateExifDecoderL( aFlags ));
- thumbFound = ( err == KErrNone );
- iEXIF = ETrue;
- }
-
- if ( !thumbFound )
- {
- iEXIF = EFalse;
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() create normal decoder" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - create normal decoder" );
-
- delete iDecoder;
- iDecoder = NULL;
-
- TFileName fullName;
- if ( !iBuffer )
- {
- iFile.FullName( fullName );
- }
-
- CImageDecoder::TOptions options;
- if ( aFlags == CThumbnailManager::EOptimizeForQuality )
- {
- options = ( CImageDecoder::TOptions )( CImageDecoder
- ::EOptionNoDither );
- }
- else
- {
- options = ( CImageDecoder::TOptions )( CImageDecoder
- ::EOptionNoDither | CImageDecoder::EPreferFastDecode );
- }
-
- if ( IsSvg())
- {
- if ( !iBuffer )
- {
- iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek,
- options, KImageTypeSVGUid, KNullUid, KNullUid );
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
- }
- else
- {
- TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options, KImageTypeSVGUid ) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - error 1" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - error 1" );
-
- User::Leave( decErr );
- }
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
- }
- }
- else if ( !IsJpeg())
- {
- if ( !iBuffer )
- {
- iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options );
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
- }
- else
- {
- TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, iMimeType.Des8(), options) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder error %d", decErr );
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder error;decErr=%d", decErr );
- LeaveIfCorruptL(decErr);
-
- // don't force any mime type
- TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime error %d", decErr );
- OstTrace1( TRACE_NORMAL, DUP8_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder no mime error;decErr=%d", decErr );
-
- User::Leave( decErr );
- }
- }
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP9_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
- }
- }
- else
- {
- if ( !iBuffer )
- {
- TRAPD( decErr, iDecoder = CExtJpegDecoder::FileNewL(
- CExtJpegDecoder::EHwImplementation, iFs, fullName, options) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP10_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL;decErr=%d - HW CExtJpegDecoder failed ", decErr );
- LeaveIfCorruptL(decErr);
-
- TRAP( decErr, iDecoder = CExtJpegDecoder::FileNewL(
- CExtJpegDecoder::ESwImplementation, iFs, fullName, options) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP11_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder failed;decErr=%d", decErr );
- LeaveIfCorruptL(decErr);
-
- TRAP( decErr, iDecoder = CImageDecoder::FileNewL( iFile, ContentAccess::EPeek, options ));
-
- if( decErr != KErrNone)
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP12_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder failed ;decErr=%d", decErr );
- User::Leave( decErr );
- }
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP13_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP14_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder created" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP15_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL" );
- }
- }
- else
- {
- TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
- CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP16_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - HW CExtJpegDecoder failed;decErr=%d", decErr );
- LeaveIfCorruptL(decErr);
-
- TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
- CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP17_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder failed;decErr=%d", decErr );
- LeaveIfCorruptL(decErr);
- TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, iMimeType.Des8(), options) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP18_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder failed;decErr=%d", decErr );
- LeaveIfCorruptL(decErr);
- // don't force any mime type
- TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder no mime failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP19_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder no mime failed;decErr=%d", decErr );
- User::Leave( decErr );
- }
- }
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP20_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - CImageDecoder created" );
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - SW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP21_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - SW CExtJpegDecoder created" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() - HW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP22_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - HW CExtJpegDecoder created" );
- }
- }
- }
- }
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateDecoderL() end" );
- OstTrace0( TRACE_NORMAL, DUP23_CTHUMBNAILIMAGEDECODER_CREATEDECODERL, "CThumbnailImageDecoder::CreateDecoderL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::CreateExifDecoderL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::CreateExifDecoderL( CThumbnailManager
- ::TThumbnailQualityPreference aFlags )
- {
- TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODER_CREATEEXIFDECODERL, "CThumbnailImageDecoder::CreateExifDecoderL - start" );
-
- // If the image is in jpeg format, try to get thumbnail from EXIF data.
- CExifRead* reader = NULL;
-
- if ( !iBuffer )
- {
- TInt64 size( 0 );
- User::LeaveIfError( iFile.Size( size ));
-
- TInt readSize = Min( size, KJpegLoadBufferSize );
-
- delete iJpegReadBuffer;
- iJpegReadBuffer = NULL;
- iJpegReadBuffer = HBufC8::NewL( readSize );
- TPtr8 localBuffer = iJpegReadBuffer->Des();
-
- User::LeaveIfError( iFile.Read( localBuffer, readSize ));
- reader = CExifRead::NewL( localBuffer, CExifRead::ENoJpeg );
- }
- else
- {
- reader = CExifRead::NewL( *iBuffer, CExifRead::ENoJpeg );
- }
-
- CleanupStack::PushL( reader );
-
- iExifThumbImage = reader->GetThumbnailL();
- CleanupStack::PopAndDestroy( reader );
-
- User::LeaveIfNull( iExifThumbImage );
-
- delete iDecoder;
- iDecoder = NULL;
-
- CImageDecoder::TOptions options;
- if ( aFlags == CThumbnailManager::EOptimizeForQuality )
- {
- options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither );
- }
- else
- {
- options = ( CImageDecoder::TOptions )( CImageDecoder::EOptionNoDither |
- CImageDecoder::EPreferFastDecode );
- }
-
- TRAPD( err, iDecoder = CExtJpegDecoder::DataNewL( iFs, * iExifThumbImage, options ));
-
- if ( err == KErrNotFound || err == KErrNotSupported )
- {
- delete iDecoder;
- iDecoder = NULL;
-
- iDecoder = CImageDecoder::DataNewL( iFs, * iExifThumbImage, options );
- }
- else
- {
- TN_DEBUG2( "CThumbnailImageDecoder::CreateExifDecoderL() - CExtJpegDecoder err == %d", err );
- User::LeaveIfError( err );
- }
-
- TN_DEBUG1( "CThumbnailImageDecoder::CreateExifDecoderL() end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODER_CREATEEXIFDECODERL, "CThumbnailImageDecoder::CreateExifDecoderL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::CreateExifDecoderL()
-// Returns size of original image
-// -----------------------------------------------------------------------------
-//
-const TSize& CThumbnailImageDecoder::OriginalSize()const
- {
- return iOriginalSize;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::LeaveIfCorruptL()
-// Leave is image is corrupted
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoder::LeaveIfCorruptL(const TInt aError )
- {
- //no sense to try other codecs if image is corrupted
- if( aError == KErrCorrupt || aError == KErrUnderflow)
- {
- User::Leave( aError );
- }
- }
-
-//End of file
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimagedecoderv2.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,252 +0,0 @@
-/*
-* 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: Image thumbnail decoder
- *
-*/
-
-
-//INCLUDE FILES
-#include <e32base.h>
-#include <imageconversion.h>
-#include <ExifRead.h>
-
-#include <IclExtJpegApi.h>
-#include "thumbnailimagedecoderv2.h"
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-#include "thumbnailmanagerconstants.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailimagedecoderv2Traces.h"
-#endif
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-//------------------------------------------------------------------------
-// CThumbnailImageDecoder::CThumbnailImageDecoder()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageDecoderv2::CThumbnailImageDecoderv2( RFs& aFs):
- CActive(EPriorityStandard ), iBitmap( NULL ), iFs( aFs ), iBuffer( NULL )
- {
- CActiveScheduler::Add( this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageDecoder::~CThumbnailImageDecoder()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageDecoderv2::~CThumbnailImageDecoderv2()
- {
- Release();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::CreateL()
-// Creates thumbnail of image
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv2::CreateL(TDesC8& aBuffer, MThumbnailProviderObserver& aObserver)
- {
- TN_DEBUG1( "CThumbnailImageDecoderv2::CreateL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV2_CREATEL, "CThumbnailImageDecoderv2::CreateL - start" );
-
- iBuffer = &aBuffer;
- iObserver = &aObserver;
-
- CreateDecoderL();
-
- TN_DEBUG1( "CThumbnailImageDecoderv2::CreateL() end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODERV2_CREATEL, "CThumbnailImageDecoderv2::CreateL - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::DecodeL()
-// Decode the thumbnail image
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv2::DecodeL( )
- {
- TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV2_DECODEL, "CThumbnailImageDecoderv2::DecodeL - start" );
-
- // Create the bitmap
- if ( !iBitmap )
- {
- iBitmap = new( ELeave )CFbsBitmap();
- }
-
- //set displaymode from global constants
- TInt err = iBitmap->Create( iDecoder->FrameInfo().iOverallSizeInPixels, iDecoder->FrameInfo().iFrameDisplayMode);
- if (err != KErrNone)
- {
- delete iBitmap;
- iBitmap = NULL;
- User::Leave(err);
- }
-
- iDecoder->Convert( &iStatus, * iBitmap );
-
- SetActive();
-
- TN_DEBUG1( "CThumbnailImageDecoderv2::DecodeL() end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODERV2_DECODEL, "CThumbnailImageDecoderv2::DecodeL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::Release()
-// Releases resources
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv2::Release()
- {
- Cancel();
-
- delete iDecoder;
- iDecoder = NULL;
-
- delete iBitmap;
- iBitmap = NULL;
-
- iBuffer = NULL; // we don't own the buffer
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::DoCancel()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv2::DoCancel()
- {
- if ( iDecoder )
- {
- iDecoder->Cancel();
- delete iDecoder;
- iDecoder = NULL;
- }
-
- delete iBitmap;
- iBitmap = NULL;
-
- iBuffer = NULL; // we don't own the buffer
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::RunL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv2::RunL()
- {
- // This call takes ownership of iBitmap
- // EXIF always false
- // Rotated always false
- iObserver->ThumbnailProviderReady( iStatus.Int(), iBitmap, iOriginalSize, EFalse, EFalse);
-
- iBitmap = NULL; // owned by server now
- iBuffer = NULL; // we don't own the buffer
-
- Release();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::CreateDecoderL
-// Creates image decoder
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv2::CreateDecoderL()
- {
- TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - start" );
-
- delete iDecoder;
- iDecoder = NULL;
-
- CImageDecoder::TOptions options = ( CImageDecoder::TOptions )(
- CImageDecoder::EOptionNoDither );
-
- TRAPD( decErr, iDecoder = CExtJpegDecoder::DataNewL(
- CExtJpegDecoder::EHwImplementation, iFs, *iBuffer, options ));
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - HW CExtJpegDecoder failed = %d", decErr );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - HW CExtJpegDecoder failed;decErr=%d", decErr );
- TRAP( decErr, iDecoder = CExtJpegDecoder::DataNewL(
- CExtJpegDecoder::ESwImplementation, iFs, *iBuffer, options ));
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - SW CExtJpegDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - SW CExtJpegDecoder failed;decErr=%d", decErr );
- LeaveIfCorruptL( decErr );
-
- TRAP( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, KJpegMime(), options ) );
-
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoderv2::CreateDecoderL() - CImageDecoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - CImageDecoder failed;decErr=%d", decErr );
- LeaveIfCorruptL( decErr );
-
- // don't force any mime type
- TRAPD( decErr, iDecoder = CImageDecoder::DataNewL( iFs, *iBuffer, options ) );
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailImageDecoderv2::CImageDecoder() - CImageDecoder no mime error %d", decErr );
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - CImageDecoder no mime error;decErr=%d", decErr );
- User::Leave( decErr );
- }
- }
-
- TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() - CImageDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - CImageDecoder created" );
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoderv2:CreateDecoderL() - SW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - SW CExtJpegDecoder created" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() - HW CExtJpegDecoder created" );
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - HW CExtJpegDecoder created" );
- }
-
- TN_DEBUG1( "CThumbnailImageDecoderv2::CreateDecoderL() end" );
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILIMAGEDECODERV2_CREATEDECODERL, "CThumbnailImageDecoderv2::CreateDecoderL - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoderv2::LeaveIfCorruptL()
-// Leave if image is corrupted
-// -----------------------------------------------------------------------------
-//
-void CThumbnailImageDecoderv2::LeaveIfCorruptL(const TInt aError )
- {
- //no sense to try other codecs if image is corrupted
- if( aError == KErrCorrupt || aError == KErrUnderflow)
- {
- User::Leave( aError );
- }
- }
-
-//End of file
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-/*
-* 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: Image thumbnail provider plugin
- *
-*/
-
-
-#include <ecom/ecom.h>
-#include <implementationproxy.h>
-
-#include "thumbnailimageprovider.h"
-#include "thumbnailimagedecoder.h"
-#include "thumbnailimagedecoderv2.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnaillog.h"
-#include "thumbnailmanagerconstants.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailimageproviderTraces.h"
-#endif
-
-
-#ifndef IMPLEMENTATION_PROXY_ENTRY
-typedef TAny* TProxyNewLPtr;
-#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) \
-{ {aUid}, static_cast<TProxyNewLPtr>(aFuncPtr) }
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageProvider* CThumbnailImageProvider::NewL()
- {
- CThumbnailImageProvider* self = new( ELeave )CThumbnailImageProvider();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::CThumbnailImageProvider()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageProvider::CThumbnailImageProvider()
- {
- TN_DEBUG1( "CThumbnailImageProvider::CThumbnailImageProvider()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEPROVIDER_CTHUMBNAILIMAGEPROVIDER, "CThumbnailImageProvider::CThumbnailImageProvider" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::~CThumbnailImageProvider()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailImageProvider::~CThumbnailImageProvider()
- {
- TN_DEBUG1( "CThumbnailImageProvider::~CThumbnailImageProvider()" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEPROVIDER_CTHUMBNAILIMAGEPROVIDER, "CThumbnailImageProvider::~CThumbnailImageProvider" );
- delete iImageDecoder;
- iImageDecoder = NULL;
- delete iImageDecoderv2;
- iImageDecoderv2 = NULL;
- REComSession::DestroyedImplementation( iDtor_ID_Key );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::GetThumbnailL()
-// Provides the thumbnail image
-// ---------------------------------------------------------------------------
-//
-void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, RFile64& aFile, const
- TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference )
- {
- TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - start" );
-
- if ( !iImageDecoder )
- {
- iImageDecoder = new( ELeave )CThumbnailImageDecoder( aFs );
- }
-
- iMimeType = aMimeType;
- iFlags = aFlags;
- iQualityPreference = aQualityPreference;
- //set default mode displaymode from global constants
- iDisplayMode = KStoreDisplayMode;
-
-//Symbian^4 specific
- if ( KJpegMime() != iMimeType.Des8() )
- {
- iDisplayMode = EColor16M;
- }
-
-//TODO currently only ARM platforms supports MAP mode
-#if !(defined(__CC_ARM) || defined(__ARMCC__))
- iDisplayMode = EColor16M;
-#endif
-
- iImageDecoder->CreateL( aFile, *iObserver, iQualityPreference, iMimeType, iTargetSize );
- iOriginalSize = iImageDecoder->OriginalSize();
- iImageDecoder->DecodeL( iDisplayMode, iFlags );
-
- TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::GetThumbnailL()
-// Provides the thumbnail image
-// ---------------------------------------------------------------------------
-//
-void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, TDesC8* aBuffer, const
- TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference )
- {
- TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - start" );
-
- if ( !iImageDecoder )
- {
- iImageDecoder = new( ELeave )CThumbnailImageDecoder( aFs );
- }
-
- iMimeType = aMimeType;
- iFlags = aFlags;
- iQualityPreference = aQualityPreference;
- //set default mode displaymode from global constants
- iDisplayMode = KStoreDisplayMode;
-
-//Symbian^4 specific
- if ( KJpegMime() != iMimeType.Des8() )
- {
- iDisplayMode = EColor16M;
- }
-
-//TODO currently only ARM platforms supports MAP mode
-#if !(defined(__CC_ARM) || defined(__ARMCC__))
- iDisplayMode = EColor16M;
-#endif
-
- iImageDecoder->CreateL( aBuffer, *iObserver, iQualityPreference, iMimeType, iTargetSize );
- iOriginalSize = iImageDecoder->OriginalSize();
- iImageDecoder->DecodeL( iDisplayMode, iFlags );
-
- TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::GetThumbnailL()
-// Provides the thumbnail image
-// ---------------------------------------------------------------------------
-//
-void CThumbnailImageProvider::GetThumbnailL( RFs& aFs, TDesC8& aBuffer)
- {
- TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() start" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - start" );
-
- if ( !iImageDecoderv2 )
- {
- iImageDecoderv2 = new( ELeave )CThumbnailImageDecoderv2( aFs);
- }
-
- iImageDecoderv2->CreateL(aBuffer, *iObserver);
-
- iImageDecoderv2->DecodeL();
-
- TN_DEBUG1( "CThumbnailImageProvider::GetThumbnailL() end" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILIMAGEPROVIDER_GETTHUMBNAILL, "CThumbnailImageProvider::GetThumbnailL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// Cancel thumbnail request
-// ---------------------------------------------------------------------------
-//
-void CThumbnailImageProvider::CancelGetThumbnail()
- {
- if ( iImageDecoder )
- {
- iImageDecoder->Cancel();
- }
- if ( iImageDecoderv2)
- {
- iImageDecoderv2->Cancel();
- }
- }
-
-// ======== GLOBAL FUNCTIONS ========
-
-// -----------------------------------------------------------------------------
-// ImplementationTable
-// Define the interface UIDs
-// -----------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( THUMBNAIL_IMAGE_PROVIDER_IMP_UID,
- CThumbnailImageProvider::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
--- a/imagehandlingutilities/thumbnailmanager/plugins/image/src/thumbnailimageprovider.rss Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* 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: Image thumbnail provider plugin resource file
-*
-*/
-
-
-#include "registryinfov2.rh"
-#include "thumbnailmanageruids.hrh"
-
-RESOURCE REGISTRY_INFO theInfo
-{
-// resource_format_version must always be set as follows
-resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
-// Normal plug-in parameters
-dll_uid = THUMBNAIL_IMAGE_PROVIDER_DLL_UID;
-interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = THUMBNAIL_PROVIDER_IF_UID;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = THUMBNAIL_IMAGE_PROVIDER_IMP_UID;
- version_no = 1;
- display_name = "";
- default_data = "";
- opaque_data = "image/*";
- rom_only = 0;
- }
- };
- }
- };
-}
-
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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 ?myapp
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-thumbnailvideoprovider.mmp
-
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/group/thumbnailvideoprovider.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* 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: Video thumbnail provider plugin
-*
-*/
-
-
-// To get the MW_LAYER_SYSTEMINCLUDE-definition
-#include <platform_paths.hrh>
-
-#include "../../../inc/thumbnailmanageruids.hrh"
-
-TARGET thumbnailvideoprovider.dll
-CAPABILITY CAP_ECOM_PLUGIN
-TARGETTYPE PLUGIN
-
-UID 0x10009D8D THUMBNAIL_VIDEO_PROVIDER_DLL_UID
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE thumbnailvideoprovider.cpp
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../../inc ../traces
-
-SYSTEMINCLUDE /epoc32/include/ecom
-
-START RESOURCE ../src/thumbnailvideoprovider.rss
-END
-
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY tneengine.lib
-LIBRARY efsrv.lib
-LIBRARY fbscli.lib
-
-DEBUGLIBRARY flogger.lib
-
-OPTION ARMCC -O3 -OTime
-
-PAGED
-BYTEPAIRCOMPRESSTARGET
-
-// End of File
-
-
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/inc/thumbnailvideoprovider.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-/*
-* 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: Video thumbnail provider.
- *
-*/
-
-
-#ifndef THUMBNAILVIDEOPROVIDER_H
-#define THUMBNAILVIDEOPROVIDER_H
-
-#include <ecom.h>
-#include <TNEVideoClipInfo.h>
-
-#include "thumbnailprovider.h"
-
-/**
- * Video thumbnail provider plugin.
- *
- * @since S60 v5.0
- */
-class CThumbnailVideoProvider: public CThumbnailProvider, public CActive,
- public MTNEVideoClipThumbObserver, public MTNEVideoClipInfoObserver
- {
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return New video thumbnail provider instance.
- */
- static CThumbnailVideoProvider* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailVideoProvider();
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aFile Source image file.
- * @param aMimeType Mime-type of the clip to be processed.
- * @param aFlags Flags for thumbnail creation.
- * @param aDisplayMode Used display mode.
- */
- void GetThumbnailL( RFs& aFs, RFile64& aFile, const TDataType& aMimeType,
- const CThumbnailManager::TThumbnailFlags aFlags, const TDisplayMode
- aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aBuffer Source image buffer.
- * @param aMimeType Mime-type of the clip to be processed.
- * @param aFlags Flags for thumbnail creation.
- * @param aDisplayMode Used display mode.
- */
- void GetThumbnailL( RFs& aFs, TDesC8* aBuffer, const
- TDataType& aMimeType, const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode aDisplayMode, const CThumbnailManager::TThumbnailQualityPreference aQualityPreference );
-
- /**
- * Function that will provide thumbnail from given parameters.
- *
- * @since S60 v5.0
- * @param aFs File server session
- * @param aBuffer Source image buffer.
- */
-
- void GetThumbnailL( RFs& aFs, TDesC8& aBuffer);
- /**
- * Cancel a previous thumbnail request, if any.
- *
- * @since S60 5.0
- */
- void CancelGetThumbnail();
-
-protected:
-
- /**
- * Notifies when video clip thumbnail is ready.
- *
- * @since S60 v5.0
- * @param aInfo Video clip info.
- * @param aError Error code.
- * @param aThumb Thumbnail image.
- */
- void NotifyVideoClipThumbCompleted( CTNEVideoClipInfo& aInfo, TInt aError,
- CFbsBitmap* aThumb );
-
- /**
- * Notifies when info about video clip is ready.
- *
- * @since S60 v5.0
- * @param aInfo Video clip info.
- * @param aError Error code.
- */
- void NotifyVideoClipInfoReady( CTNEVideoClipInfo& aInfo, TInt aError );
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New video thumbnail provider instance.
- */
- CThumbnailVideoProvider();
-
- /**
- * Implements cancellation of an outstanding request.
- *
- * @since S60 v5.0
- */
- void DoCancel();
-
- /**
- * Handles an active object's request completion event.
- *
- * @since S60 v5.0
- */
- void RunL();
-
-private:
- // data
-
- /**
- * Video clip info.
- */
- CTNEVideoClipInfo* iVideoClipInfo;
-
- RTimer iTimer;
- TBool iTimeout;
-
-};
-
-#endif // THUMBNAILVIDEOPROVIDER_H
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,308 +0,0 @@
-/*
-* 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: Video thumbnail provider
- *
-*/
-
-
-#include <e32base.h>
-#include <ecom/ecom.h>
-#include <implementationproxy.h>
-#include <fbs.h>
-
-#include "thumbnailvideoprovider.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailvideoproviderTraces.h"
-#endif
-
-
-#ifndef IMPLEMENTATION_PROXY_ENTRY
-typedef TAny* TProxyNewLPtr;
-#define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) \
-{ {aUid}, static_cast<TProxyNewLPtr>(aFuncPtr) }
-#endif
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailVideoProvider::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailVideoProvider* CThumbnailVideoProvider::NewL()
- {
- CThumbnailVideoProvider* self = new( ELeave )CThumbnailVideoProvider();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailImageProvider::CThumbnailImageProvider()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailVideoProvider::CThumbnailVideoProvider():CActive( EPriorityStandard )
- {
- CActiveScheduler::Add( this );
-
- iTimer.CreateLocal();
- iTimeout = EFalse;
-
- TN_DEBUG1( "CThumbnailVideoProvider::CThumbnailVideoProvider()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILVIDEOPROVIDER_CTHUMBNAILVIDEOPROVIDER, "CThumbnailVideoProvider::CThumbnailVideoProvider" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailVideoProvider::~CThumbnailVideoProvider()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailVideoProvider::~CThumbnailVideoProvider()
- {
- // run DoCancel even if not active
- if ( IsActive() )
- {
- Cancel();
- }
- else
- {
- DoCancel();
- }
-
- iTimer.Close();
-
- TN_DEBUG1( "CThumbnailVideoProvider::~CThumbnailVideoProvider()" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILVIDEOPROVIDER_CTHUMBNAILVIDEOPROVIDER, "CThumbnailVideoProvider::~CThumbnailVideoProvider" );
- REComSession::DestroyedImplementation( iDtor_ID_Key );
- }
-// -----------------------------------------------------------------------------
-// CThumbnailVideoProvider::DoCancel()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::DoCancel()
- {
- iTimer.Cancel();
-
- if ( iVideoClipInfo )
- {
- iVideoClipInfo->CancelThumb();
-
- delete iVideoClipInfo;
- iVideoClipInfo = NULL;
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailImageDecoder::RunL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::RunL()
- {
- DoCancel();
-
- // video thumbnail engine doesn't respond
- if (iTimeout)
- {
- iObserver->ThumbnailProviderReady( KErrCompletion, NULL, TSize(), EFalse, EFalse);
- iTimeout = EFalse;
-
- TN_DEBUG1( "CThumbnailVideoProvider::RunL() - timeout" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILVIDEOPROVIDER_RUNL, "CThumbnailVideoProvider::RunL - timeout" );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailVideoProvider::GetThumbnailL()
-// Provides the thumbnail image of video clip
-// ---------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::GetThumbnailL( RFs& /*aFs*/, RFile64& aFile, const
- TDataType& /*aMimeType*/, const CThumbnailManager::TThumbnailFlags aFlags,
- const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference /*aQualityPreference */)
- {
- TN_DEBUG1( "CThumbnailVideoProvider::GetThumbnailL() start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILVIDEOPROVIDER_GETTHUMBNAILL, "CThumbnailVideoProvider::GetThumbnailL - start" );
-
- iFlags = aFlags;
- //set default mode displaymode from global constants
- iDisplayMode = KStoreDisplayMode;
-
-//Symbian^4 specific
-//TODO currently only ARM platforms supports MAP mode
-#if !(defined(__CC_ARM) || defined(__ARMCC__))
- iDisplayMode = EColor16M;
-#endif
-
- TFileName filename;
- User::LeaveIfError( aFile.FullName( filename ));
-
- TRAPD( err, iVideoClipInfo = CTNEVideoClipInfo::NewL( filename, * this ));
-
- if ( err != KErrNone )
- {
- User::Leave( KErrCorrupt );
- }
-
- TN_DEBUG1( "CThumbnailVideoProvider::GetThumbnailL() end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILVIDEOPROVIDER_GETTHUMBNAILL, "CThumbnailVideoProvider::GetThumbnailL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailVideoProvider::GetThumbnailL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::GetThumbnailL( RFs& /*aFs*/,
- TDesC8* /* aBuffer */,
- const TDataType& /* aMimeType */,
- const CThumbnailManager::TThumbnailFlags /*aFlags*/,
- const TDisplayMode /* aDisplayMode */,
- const CThumbnailManager::TThumbnailQualityPreference /*aQualityPreference */)
- {
- TN_DEBUG1( "CThumbnailVideoProvider::GetThumbnailL() - nothing to do" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILVIDEOPROVIDER_GETTHUMBNAILL, "CThumbnailVideoProvider::GetThumbnailL - nothing to do" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailVideoProvider::GetThumbnailL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::GetThumbnailL( RFs& /*aFs*/, TDesC8& /*aBuffer*/)
- {
- TN_DEBUG1( "CThumbnailVideoProvider::GetThumbnailL() - nothing to do" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILVIDEOPROVIDER_GETTHUMBNAILL, "CThumbnailVideoProvider::GetThumbnailL - nothing to do" );
- User::Leave( KErrNotSupported );
- }
-
-// ---------------------------------------------------------------------------
-// Cancel thumbnail request
-// ---------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::CancelGetThumbnail()
- {
- // run DoCancel even if not active
- if ( IsActive() )
- {
- Cancel();
- }
- else
- {
- DoCancel();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailVideoProvider::NotifyVideoClipThumbCompleted()
-// Used to notify when thumbnail image of video clip is ready
-// ---------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::NotifyVideoClipThumbCompleted( CTNEVideoClipInfo&
- /*aInfo*/, TInt aError, CFbsBitmap* aThumb )
- {
- TN_DEBUG2( "CThumbnailVideoProvider::NotifyVideoClipThumbCompleted(aError=%d)", aError );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILVIDEOPROVIDER_NOTIFYVIDEOCLIPTHUMBCOMPLETED, "CThumbnailVideoProvider::NotifyVideoClipThumbCompleted;aError=%d", aError );
-
- iTimer.Cancel();
- iTimeout = EFalse;
-
- if (( aError == KErrNone ) && aThumb )
- {
- iOriginalSize = aThumb->SizeInPixels();
- }
-
- iObserver->ThumbnailProviderReady( aError, aThumb, iOriginalSize, EFalse, EFalse);
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailVideoProvider::NotifyVideoClipInfoReady()
-// Used to notify when information of video clip is available
-// ---------------------------------------------------------------------------
-//
-void CThumbnailVideoProvider::NotifyVideoClipInfoReady( CTNEVideoClipInfo&
- aInfo, TInt aError )
- {
- TN_DEBUG2( "CThumbnailVideoProvider::NotifyVideoClipInfoReady(aError=%d)", aError );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILVIDEOPROVIDER_NOTIFYVIDEOCLIPINFOREADY, "CThumbnailVideoProvider::NotifyVideoClipInfoReady;aError=%d", aError );
-
- if ( aError == KErrNone )
- {
- TInt err( KErrNone );
-
- // cannot determine target size, aspect ratio scaling fails
- TRAP( err, aInfo.GetThumbL( *this, KBestThumbIndex, NULL, iDisplayMode, ETrue ));
-
- if ( err != KErrNone )
- {
- TN_DEBUG2( "CThumbnailVideoProvider::NotifyVideoClipInfoReady() -- GetThumbL() left with %d", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILVIDEOPROVIDER_NOTIFYVIDEOCLIPINFOREADY, "CThumbnailVideoProvider::NotifyVideoClipInfoReady - GetThumbL() left with;err=%d", err );
-
- iObserver->ThumbnailProviderReady( err, NULL, TSize(), EFalse, EFalse);
-
- SetActive();
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete( statusPtr, KErrNone );
- }
- else
- {
- // request timeout
- iTimeout = ETrue;
- iTimer.After(iStatus, KVideoDecoderTimeout);
- SetActive();
- }
- }
- else
- {
- iObserver->ThumbnailProviderReady( aError, NULL, TSize(), EFalse, EFalse);
-
- SetActive();
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete( statusPtr, KErrNone );
- }
- }
-
-
-// ======== GLOBAL FUNCTIONS ========
-
-// -----------------------------------------------------------------------------
-// ImplementationTable
-// Define the interface UIDs
-// -----------------------------------------------------------------------------
-//
-const TImplementationProxy ImplementationTable[] =
- {
- IMPLEMENTATION_PROXY_ENTRY( THUMBNAIL_VIDEO_PROVIDER_IMP_UID,
- CThumbnailVideoProvider::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
--- a/imagehandlingutilities/thumbnailmanager/plugins/video/src/thumbnailvideoprovider.rss Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* 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: Video thumbnail provider plugin resource file
-*
-*/
-
-
-#include "registryinfov2.rh"
-#include "thumbnailmanageruids.hrh"
-
-RESOURCE REGISTRY_INFO theInfo
-{
-// resource_format_version must always be set as follows
-resource_format_version = RESOURCE_FORMAT_VERSION_2;
-
-// Normal plug-in parameters
-dll_uid = THUMBNAIL_VIDEO_PROVIDER_DLL_UID;
-interfaces =
- {
- INTERFACE_INFO
- {
- interface_uid = THUMBNAIL_PROVIDER_IF_UID;
- implementations =
- {
- IMPLEMENTATION_INFO
- {
- implementation_uid = THUMBNAIL_VIDEO_PROVIDER_IMP_UID;
- version_no = 1;
- display_name = "";
- default_data = "";
- opaque_data = "video/*";
- rom_only = 0;
- }
- };
- }
- };
-}
--- a/imagehandlingutilities/thumbnailmanager/rom/thumbagdaemon.iby Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* 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: Iby file
-*
-*/
-
-
-#ifdef RD_THUMBNAILMANAGER
-
-#ifndef THUMBAGDAEMON_IBY
-#define THUMBAGDAEMON_IBY
-
-file=ABI_DIR\BUILD_DIR\thumbagdaemon.exe PROGRAMS_DIR\thumbagdaemon.exe
-
-#endif // THUMBNAILMANAGER_IBY
-
-#endif // RD_THUMBNAILMANAGER
--- a/imagehandlingutilities/thumbnailmanager/rom/thumbnailmanager.iby Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-* 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: Iby file
-*
-*/
-
-
-#ifdef RD_THUMBNAILMANAGER
-
-#ifndef THUMBNAILMANAGER_IBY
-#define THUMBNAILMANAGER_IBY
-
-file=ABI_DIR\BUILD_DIR\thumbnailmanager.dll SHARED_LIB_DIR\thumbnailmanager.dll
-file=ABI_DIR\BUILD_DIR\thumbnailserver.exe PROGRAMS_DIR\thumbnailserver.exe
-
-ECOM_PLUGIN(thumbnailvideoprovider.dll, thumbnailvideoprovider.rsc)
-ECOM_PLUGIN(thumbnailimageprovider.dll, thumbnailimageprovider.rsc)
-ECOM_PLUGIN(thumbnailaudioprovider.dll, thumbnailaudioprovider.rsc)
-
-data=ZSYSTEM\install\thumbnailmanager_stub.sis system\install\thumbnailmanager_stub.sis
-
-#endif // THUMBNAILMANAGER_IBY
-
-#endif // RD_THUMBNAILMANAGER
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/depends.xml Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ad:metadata xmlns="http://nokia.com/arrow/repository/ia_component"
- xmlns:ad="http://nokia.com/arrow/application_metadata">
- <appResources>
- <appResource>
- <language>1</language>
- <iacName>Thumbnail Manager</iacName>
- <iacDescription>Upgrade package for Thumbnail Manager</iacDescription>
- </appResource>
- </appResources>
- <swPlatformDep>
- <platform>S60</platform>
- <versionFrom>
- <major>5</major>
- <minor>0</minor>
- <date>
- <year>2009</year>
- <week>1</week>
- </date>
- </versionFrom>
- </swPlatformDep>
- <interDeps>
- </interDeps>
- <firmwareDependencies></firmwareDependencies>
-</ad:metadata>
\ No newline at end of file
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/package.pkg Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description:
-;
-; Languages
-&EN
-
-; Header
-#{"Thumbnail Manager"},(0x102830AB), 10, 10, 9, TYPE=SA, RU
-
-; Localised Vendor name
-%{"Nokia"}
-
-; Unique Vendor name
-:"Nokia"
-
-;Files
-@"..\thumbnailmanagercenrep\thumbnailmanagercenrep.sisx",(0x10202BE9)
-"\epoc32\release\armv5\urel\thumbnailserver.exe"-"c:\sys\bin\thumbnailserver.exe"
-"\epoc32\release\armv5\urel\thumbagdaemon.exe"-"c:\sys\bin\thumbagdaemon.exe"
-"\epoc32\release\armv5\urel\thumbnailmanager.dll"-"c:\sys\bin\thumbnailmanager.dll"
-"\epoc32\release\armv5\urel\thumbnailimageprovider.dll"-"c:\sys\bin\thumbnailimageprovider.dll"
-"\epoc32\release\armv5\urel\thumbnailvideoprovider.dll"-"c:\sys\bin\thumbnailvideoprovider.dll"
-"\epoc32\release\armv5\urel\thumbnailaudioprovider.dll"-"c:\sys\bin\thumbnailaudioprovider.dll"
-"\epoc32\data\z\resource\plugins\thumbnailimageprovider.rsc"-"c:\resource\plugins\thumbnailimageprovider.rsc"
-"\epoc32\data\z\resource\plugins\thumbnailvideoprovider.rsc"-"c:\resource\plugins\thumbnailvideoprovider.rsc"
-"\epoc32\data\z\resource\plugins\thumbnailaudioprovider.rsc"-"c:\resource\plugins\thumbnailaudioprovider.rsc"
-"\epoc32\release\armv5\urel\tmiadrestart.exe"-"c:\sys\bin\tmiadrestart.exe",FILERUN,RB
\ No newline at end of file
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/stub.pkg Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description:
-;
-; Languages
-&EN
-
-; Header
-#{"ThumbnailManager"},(0x102830AB), 10, 10, 9, TYPE=SA
-
-; Localised Vendor name
-%{"Nokia"}
-
-; Unique Vendor name
-:"Nokia"
-
-;Files
Binary file imagehandlingutilities/thumbnailmanager/sis/thumbnailmanager/thumbnailmanager_stub.sis has changed
--- a/imagehandlingutilities/thumbnailmanager/sis/thumbnailmanagercenrep/package.pkg Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-;
-; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-; All rights reserved.
-; This component and the accompanying materials are made available
-; under the terms of "Eclipse Public License v1.0"
-; which accompanies this distribution, and is available
-; at the URL "http://www.eclipse.org/legal/epl-v10.html".
-;
-; Initial Contributors:
-; Nokia Corporation - initial contribution.
-;
-; Contributors:
-;
-; Description:
-;
-; Languages
-&EN
-
-; Header
-#{"Thumbnail Manager Cenrep"},(0x10202BE9), 10, 10, 9, TYPE=SP
-
-; Localised Vendor name
-%{"Symbian Software Ltd."}
-
-; Unique Vendor name
-:"Symbian Software Ltd."
-
-;Files
-"..\..\conf\102830B0.txt"-"c:\private\10202be9\102830B0.txt"
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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: Build information file
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-thumbagdaemon.mmp
-
-
-// End of File
-
-
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/group/thumbagdaemon.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* 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: Project definition file
-*
-*/
-
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-#include "../../inc/thumbnailmanageruids.hrh"
-
-VERSION 10.0
-TARGET thumbagdaemon.exe
-TARGETTYPE EXE
-UID 0x0 THUMBAGDAEMON_UID
-
-#ifdef WINSCW
-EPOCHEAPSIZE 4096 0x200000 // heap 2MB
-#else
-EPOCHEAPSIZE 4096 0x800000 // max heap 8MB
-#endif
-
-CAPABILITY ALL -AllFiles -DRM -TCB
-VENDORID VID_DEFAULT
-
-EPOCPROCESSPRIORITY background
-
-MACRO MDS_URI_OBSERVER
-MACRO MDS_MODIFY_OBSERVER
-
-SOURCEPATH ../src
-SOURCE thumbagdaemon.cpp
-SOURCE thumbagprocessor.cpp
-
-SOURCEPATH ../../tmcommon/src
-SOURCE tmactivitymanager.cpp
-SOURCE tmshutdownobserver.cpp
-SOURCE tmformatobserver.cpp
-SOURCE tmsrproptertyobserver.cpp
-
-SOURCEPATH ../src
-SOURCE thumbagimageobserver.cpp
-SOURCE thumbagcameraobserver.cpp
-SOURCE thumbagaudioobserver.cpp
-SOURCE thumbagvideoobserver.cpp
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../inc
-USERINCLUDE ../../tmcommon/inc ../traces ../../thumbnailserver/traces
-
-LIBRARY euser.lib
-LIBRARY mdeclient.lib
-LIBRARY thumbnailmanager.lib
-LIBRARY centralrepository.lib
-LIBRARY harvesterclient.lib
-LIBRARY bafl.lib
-LIBRARY mpxcollectionhelper.lib mpxcollectionutility.lib mpxcommon.lib
-LIBRARY hwrmlightclient.lib
-
-DEBUGLIBRARY flogger.lib
-
-OPTION ARMCC -O3 -OTime
-
-PAGED
-BYTEPAIRCOMPRESSTARGET
-
-// End of File
-
-
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagaudioobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
- *
-*/
-
-
-#ifndef THUMBAGAUDIOOBSERVER_H
-#define THUMBAGAUDIOOBSERVER_H
-
-#include <e32base.h>
-#include <w32std.h>
-
-#include <mdesession.h>
-
-#include "thumbagprocessor.h"
-#include "tmshutdownobserver.h"
-#include "thumbnaillog.h"
-
-
-/**
- * ThumbAG daemon.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbAGAudioObserver ): public CBase,
- public MMdESessionObserver,
- public MMdEObjectObserver,
- public MTMShutdownObserver
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGAudioObserver server.
- */
- static CThumbAGAudioObserver* NewLC(CThumbAGProcessor* aProcessor);
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGAudioObserver server.
- */
- static CThumbAGAudioObserver* NewL(CThumbAGProcessor* aProcessor);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbAGAudioObserver();
-
-
-public:
-
- // from MMdESessionObserver
- void HandleSessionOpened( CMdESession& aSession, TInt aError );
- void HandleSessionError( CMdESession& aSession, TInt aError );
-
- // from MMdEObjectObserver
- void HandleObjectNotification(CMdESession& aSession,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray);
-
- // from MTMShutdownObserver
- void ShutdownNotification();
-
-protected:
-
- /**
- * AddObserversL
- *
- * @since S60 v5.0
- */
- void AddObserversL();
-
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGAudioObserver instance.
- */
- CThumbAGAudioObserver(CThumbAGProcessor* aProcessor);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Initilization helper
- *
- * @since S60 v5.2
- */
- void InitializeL();
-
- /**
- * Callback for reconnect timer
- *
- * @since S60 v5.0
- */
- static TInt ReconnectCallBack(TAny* aAny);
-
- void Shutdown();
-
-private:
-
- // own
- CTMShutdownObserver* iShutdownObserver;
- CTMShutdownObserver* iMDSShutdownObserver;
- CMdESession* iMdESession;
-
- //not owned
- CThumbAGProcessor* iProcessor;
-
- TBool iShutdown;
-
- // reconnect timer
- CPeriodic* iReconnect;
-
- TBool iSessionError;
-
-#ifdef _DEBUG
- TUint32 iAddCounter;
- TUint32 iModCounter;
-#endif
-};
-
-#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagcameraobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
- *
-*/
-
-
-#ifndef THUMBAGCAMERAOBSERVER_H
-#define THUMBAGCAMERAOBSERVER_H
-
-#include <e32base.h>
-#include <w32std.h>
-
-#include <mdesession.h>
-
-#include "thumbagprocessor.h"
-#include "tmshutdownobserver.h"
-#include "thumbnaillog.h"
-
-
-/**
- * ThumbAG daemon.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbAGCameraObserver ): public CBase,
- public MMdESessionObserver,
- public MMdEObjectObserver,
- public MTMShutdownObserver
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGCameraObserver server.
- */
- static CThumbAGCameraObserver* NewLC(CThumbAGProcessor* aProcessor);
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGCameraObserver server.
- */
- static CThumbAGCameraObserver* NewL(CThumbAGProcessor* aProcessor);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbAGCameraObserver();
-
-
-public:
-
- // from MMdESessionObserver
- void HandleSessionOpened( CMdESession& aSession, TInt aError );
- void HandleSessionError( CMdESession& aSession, TInt aError );
-
- // from MMdEObjectObserver
- void HandleObjectNotification(CMdESession& aSession,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray);
-
- // from MTMShutdownObserver
- void ShutdownNotification();
-
-protected:
-
- /**
- * AddObserversL
- *
- * @since S60 v5.0
- */
- void AddObserversL();
-
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGCameraObserver instance.
- */
- CThumbAGCameraObserver(CThumbAGProcessor* aProcessor);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Initilization helper
- *
- * @since S60 v5.2
- */
- void InitializeL();
-
- /**
- * Callback for reconnect timer
- *
- * @since S60 v5.0
- */
- static TInt ReconnectCallBack(TAny* aAny);
-
-private:
-
- // own
- CTMShutdownObserver* iShutdownObserver;
- CTMShutdownObserver* iMDSShutdownObserver;
- CMdESession* iMdESession;
- //not owned
- CThumbAGProcessor* iProcessor;
-
- TBool iShutdown;
-
- // reconnect timer
- CPeriodic* iReconnect;
-
- TBool iSessionError;
-
-#ifdef _DEBUG
- TUint32 iAddCounter;
- TUint32 iModCounter;
-#endif
-};
-
-#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagdaemon.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
- *
-*/
-
-
-#ifndef THUMBAGDAEMON_H
-#define THUMBAGDAEMON_H
-
-#include <e32base.h>
-#include <w32std.h>
-
-#include <mdesession.h>
-
-#include "thumbagprocessor.h"
-#include "tmshutdownobserver.h"
-#include "thumbnaillog.h"
-#include "thumbagimageobserver.h"
-#include "thumbagcameraobserver.h"
-#include "thumbagaudioobserver.h"
-#include "thumbagvideoobserver.h"
-
-
-/**
- * ThumbAG daemon.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbAGDaemon ): public CServer2,
- public MMdESessionObserver,
- public MMdEObjectObserver,
- public MTMShutdownObserver,
- public MMdEObjectPresentObserver
-#ifdef MDS_URI_OBSERVER
- ,public MMdEObjectObserverWithUri
-#endif
-
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGDaemon server.
- */
- static CThumbAGDaemon* NewLC();
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGDaemon server.
- */
- static CThumbAGDaemon* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbAGDaemon();
-
-public:
-
- /**
- * Creates new server session.
- *
- * @since S60 v5.0
- * @param aVersion Version info.
- * @param aMessage Message to be passed.
- * @return New session.
- */
- CSession2* NewSessionL( const TVersion& aVersion,
- const RMessage2& aMessage ) const;
-
- /**
- * ThreadFunctionL
- *
- * @since S60 v5.0
- */
- static void ThreadFunctionL();
-
-public:
-
- // from MMdESessionObserver
- void HandleSessionOpened( CMdESession& aSession, TInt aError );
- void HandleSessionError( CMdESession& aSession, TInt aError );
-
- // from MMdEObjectObserver
- void HandleObjectNotification(CMdESession& aSession,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray);
-
-#ifdef MDS_URI_OBSERVER
- void HandleUriObjectNotification(CMdESession& aSession,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray,
- const RPointerArray<HBufC>& aObjectUriArray);
-#endif
-
- void HandleObjectPresentNotification(CMdESession& aSession,
- TBool aPresent, const RArray<TItemId>& aObjectIdArray);
-
- // from MTMShutdownObserver
- void ShutdownNotification();
-
-protected:
-
- /**
- * AddObserversL
- *
- * @since S60 v5.0
- */
- void AddObserversL();
-
- /**
- * Check if daemon needs to run
- *
- * @since S60 v5.0
- */
- TBool DaemonEnabledL();
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGDaemon instance.
- */
- CThumbAGDaemon();
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Initilization helper
- *
- * @since S60 v5.2
- */
- void InitializeL();
-
- /**
- * Callback for reconnect timer
- *
- * @since S60 v5.0
- */
- static TInt ReconnectCallBack(TAny* aAny);
-
-private:
-
- // own
- CTMShutdownObserver* iShutdownObserver;
- CTMShutdownObserver* iMDSShutdownObserver;
- CMdESession* iMdESession;
- CThumbAGProcessor* iProcessor;
-
- TBool iShutdown;
-
- // reconnect timer
- CPeriodic* iReconnect;
-
- TBool iSessionError;
-
-#ifdef _DEBUG
- TUint32 iAddCounter;
- TUint32 iDelCounter;
-#endif
-
- //observers
- CThumbAGImageObserver* iImageObserver;
- CThumbAGCameraObserver* iCameraObserver;
- CThumbAGAudioObserver* iAudioObserver;
- CThumbAGVideoObserver* iVideoObserver;
-};
-
-#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagimageobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
- *
-*/
-
-
-#ifndef THUMBAGIMAGEOBSERVER_H
-#define THUMBAGIMAGEOBSERVER_H
-
-#include <e32base.h>
-#include <w32std.h>
-
-#include <mdesession.h>
-
-#include "thumbagprocessor.h"
-#include "thumbnaillog.h"
-#include "tmshutdownobserver.h"
-
-/**
- * ThumbAG daemon.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbAGImageObserver ): public CBase,
- public MMdESessionObserver,
- public MMdEObjectObserver,
- public MTMShutdownObserver
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGImageObserver server.
- */
- static CThumbAGImageObserver* NewLC(CThumbAGProcessor* aProcessor);
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGImageObserver server.
- */
- static CThumbAGImageObserver* NewL(CThumbAGProcessor* aProcessor);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbAGImageObserver();
-
-
-public:
-
- // from MMdESessionObserver
- void HandleSessionOpened( CMdESession& aSession, TInt aError );
- void HandleSessionError( CMdESession& aSession, TInt aError );
-
- // from MMdEObjectObserver
- void HandleObjectNotification(CMdESession& aSession,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray);
-
- // from MTMShutdownObserver
- void ShutdownNotification();
-
-protected:
-
- /**
- * AddObserversL
- *
- * @since S60 v5.0
- */
- void AddObserversL();
-
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGImageObserver instance.
- */
- CThumbAGImageObserver(CThumbAGProcessor* aProcessor);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Initilization helper
- *
- * @since S60 v5.2
- */
- void InitializeL();
-
- /**
- * Callback for reconnect timer
- *
- * @since S60 v5.0
- */
- static TInt ReconnectCallBack(TAny* aAny);
-
-private:
-
- // own
- CTMShutdownObserver* iShutdownObserver;
- CTMShutdownObserver* iMDSShutdownObserver;
- CMdESession* iMdESession;
- //not owned
- CThumbAGProcessor* iProcessor;
-
- TBool iShutdown;
-
- // reconnect timer
- CPeriodic* iReconnect;
-
- TBool iSessionError;
-
-#ifdef _DEBUG
- TUint32 iAddCounter;
- TUint32 iModCounter;
-#endif
-};
-
-#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,482 +0,0 @@
-/*
-* 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: Processor
- *
-*/
-
-
-#ifndef THUMBAGPROCESSOR_H
-#define THUMBAGPROCESSOR_H
-
-#include <thumbnailmanager.h>
-#include <thumbnailmanagerobserver.h>
-#include <thumbnaildata.h>
-#include <mdesession.h>
-#include <mdccommon.h>
-#include <mdeobjectquery.h>
-#include "thumbnaillog.h"
-#include <harvesterclient.h>
-#include <e32property.h>
-#include <mpxcollectionobserver.h>
-#include "tmactivitymanager.h"
-#include "tmformatobserver.h"
-#include "tmrpropertyobserver.h"
-#include "thumbnailmanagerconstants.h"
-
-//FORWARD DECLARATIONS
-class MMPXCollectionUtility;
-
-
-enum TThumbnailGenerationItemType
- {
- EGenerationItemTypeUnknown,
- EGenerationItemTypeNotFound,
- EGenerationItemTypeCamera,
- EGenerationItemTypeAny,
- EGenerationItemTypeAudio,
- EGenerationItemTypeVideo,
- EGenerationItemTypeImage,
- EGenerationItemTypeItemCount
- };
-
- enum TThumbnailGenerationItemAction
- {
- EGenerationItemActionAdd,
- EGenerationItemActionDelete,
- EGenerationItemActionModify,
- EGenerationItemAction2ndAdd,
- EGenerationItemActionResolveType,
- EGenerationItemActionCount
- };
-
- struct TThumbnailGenerationItem
- {
- inline TThumbnailGenerationItem(): iItemId( KErrNotFound ), iItemType(EGenerationItemTypeUnknown),
- iItemAction(EGenerationItemActionAdd), iPlaceholder(EFalse), iUri(NULL){}
- inline ~TThumbnailGenerationItem(){delete iUri; iUri = NULL;}
-
- TItemId iItemId;
- TThumbnailGenerationItemType iItemType;
- TThumbnailGenerationItemAction iItemAction;
- TBool iPlaceholder;
- HBufC* iUri;
- };
-
-/**
- * Processor object for handling thumb generation
- *
- * @since S60 v5.0
- */
-class CThumbAGProcessor: public CActive,
- public MThumbnailManagerObserver,
- public MThumbnailManagerRequestObserver,
- public MMdEQueryObserver,
- public MHarvesterEventObserver,
- public MMPXCollectionObserver,
- public MTMActivityManagerObserver,
- public MTMFormatObserver,
- public MTMRPropertyObserver
- {
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return Instance of CThumbAGProcessor.
- */
- static CThumbAGProcessor* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbAGProcessor();
-
-public:
-
- // From MMdEQueryObserver
- void HandleQueryNewResults( CMdEQuery& aQuery,
- TInt aFirstNewItemIndex,
- TInt aNewItemCount );
- void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError );
-
- // from MThumbnailManagerObserver
- void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
- void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
- // from MThumbnailManagerRequestObserver
- void ThumbnailRequestReady( TInt aError, TThumbnailRequestType aRequestType, TThumbnailRequestId aId );
-
- // from MHarvesterEventObserver
- void HarvestingUpdated(
- HarvesterEventObserverType aHEObserverType,
- HarvesterEventState aHarvesterEventState,
- TInt aItemsLeft );
-
- //From MTMFormatObserver
- void FormatNotification(TBool aFormat);
-
-private:
- // From MMPXCollectionObserver
- /// See @ref MMPXCollectionObserver::HandleCollectionMessageL
- void HandleCollectionMessage( CMPXMessage* aMessage, TInt aError );
-
- /// 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 );
-
-private: //From MTMActivityManagerObserver
- void ActivityChanged(const TBool aActive);
-
-private: //From MTMRPropertyObserver
- void RPropertyNotification(const TInt aError, const TUid aKeyCategory, const TUint aPropertyKey, const TInt aValue);
-
-public:
-
- /**
- * Sets MdE Session
- *
- * @since S60 v5.0
- * @param aMdESession MdE Session
- */
- void SetMdESessionL( CMdESession* aMdESession );
-
- /**
- * Adds new IDs to queue
- *
- * @since S60 v5.0
- * @param aType TObserverNotificationType
- * @param TThumbnailGenerationItemType
- * @param aIDArray IDs for thumbnail creation
- * @param aForce pass ETrue if processor is forced to run without waiting harvesting complete
- */
- void AddToQueueL( TObserverNotificationType aType, TThumbnailGenerationItemType aItemType,
- const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray,
- TBool aPresent );
-
- /**
- * Calls Thumbnail Manager to create thumbnails
- *
- * @since S60 v5.0
- * @param aObject MdEObject
- */
- void CreateThumbnailsL( const CMdEObject* aObject );
-
- /**
- * Remove IDs from queue
- *
- * @since S60 v5.0
- * @param aIDArray IDs for thumbnail creation
- */
- void RemoveFromQueues( const RArray<TItemId>& aIDArray, const TBool aRemoveFromDelete = EFalse);
-
- void SetForceRun( const TBool aForceRun );
-
- //prepare processor for shutdown
- void Shutdown();
-
-protected:
-
- void QueryAllItemsL();
-
- /**
- * QueryL
- *
- * @since S60 v5.0
- * @param TThumbnailGenerationItemAction
- */
- void QueryL( TThumbnailGenerationItemAction aType);
-
- /**
- * QueryPlaceholdersL
- *
- * @since S60 v5.0
- * @param aPresent item should not be present item
- */
- void QueryPlaceholdersL(const TBool aPresent);
-
- /**
- * DeleteAndCancelQuery
- *
- * @since Symbian^3
- * @param aRemoveItems restore IDs back to original queue, default = ETrue
- */
- void DeleteAndCancelQuery(TBool aRestoreItems);
-
-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();
-
- /**
- * Implements RunL error handling.
- *
- * @since S60 v5.0
- */
- TInt RunError(TInt aError);
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return Instance of CThumbAGProcessor.
- */
- CThumbAGProcessor();
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Activate AO
- *
- * @since S60 v5.0
- */
- void ActivateAO();
-
- /**
- * Callback for harvesting complete timer
- *
- * @since S60 v5.0
- */
- static TInt PeriodicTimerCallBack(TAny* aAny);
-
- /**
- * Check auto creation values from cenrep
- *
- * @since S60 v5.0
- */
- void CheckAutoCreateValuesL();
-
- /**
- * Start timeout timer
- *
- * @since S60 v5.0
- */
- void StartTimeout();
-
- /**
- * Cancel timeout timer
- *
- * @since S60 v5.0
- */
- void CancelTimeout();
-
- /**
- * Update KItemsLeft PS value
- *
- * @since S60 v5.0
- * @param aDefine (re)define PS key before setting value
- */
- void UpdatePSValues(const TBool aDefine, const TBool aForce);
-
- /**
- * Comparison function for logaritmic use of queue arrays
- *
- * @since S60 S^3
- */
- static TInt Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight);
-
- /**
- * Comparison function for logaritmic use of queue arrays
- *
- * @since S60 S^3
- */
- static TInt CompareId(const TItemId& aLeft, const TItemId& aRight);
-
- /**
- * Recalculate item counts
- *
- * @since S60 S^3
- */
- void UpdateItemCounts();
-
- /**
- * Callback for mount timeout
- *
- * @since S60 v5.0
- */
- static TInt MountTimerCallBack(TAny* aAny);
-
- /**
- * Set item's action from type
- *
- * @since S^3
- */
- void SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, const TThumbnailGenerationItemType aItemType );
-
- /**
- * Set item type property from TDedIf
- * @param aGenerationItem TThumbnailGenerationItem
- * @param aItemType TThumbnailGenerationItemType
- * @since S^3
- */
- void SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId );
-
- /**
- * Append item to processing queue or update existing
- * @param aGenerationItem modified TThumbnailGenerationItem
- * @param aDefId items MDS object definition ID
- * @since S^3
- */
- void AppendProcessingQueue(TThumbnailGenerationItem& item );
-
-private:
-
- // not own
- CMdESession* iMdESession;
- CMdENamespaceDef* iDefNamespace;
-
- // own
- CThumbnailManager* iTMSession;
- CMdEObjectQuery* iQuery;
- CMdEObjectQuery* iQueryAllItems;
- CMdEObjectQuery* iQueryPlaceholders;
-
- RArray<TThumbnailGenerationItem> iGenerationQueue;
- //RPointerArray<HBufC> iRemoveQueue;
- RArray<TItemId> iQueryQueue;
-
- //background generation state
- // EFalse = 1st round, create only grid size thumbnail for images and videos
- // ETrue = 2nds round, create all missing sizes for all media items
- TBool i2ndRound;
-
- // query state
- // EFalse = normal mode
- // ETrue = querying unknown items
- TBool iUnknown;
-
- //MDS query issues
- TBool iQueryActive;
- //MDS query complete
- TBool iQueryReady;
-
- //Processing MDS itens which are modified
- TBool iModify;
- TUint iProcessingCount;
-
- //MDS harvester's overall state
- TBool iHarvesting;
- TBool iHarvestingTemp;
-
- //MDS Harvester's placeholder harvesting state
- TBool iPHHarvesting;
- TBool iPHHarvestingTemp;
-
- //MDS Harvester's SD card harvesting state
- TBool iMMCHarvesting;
- TBool iMMCHarvestingTemp;
-
- CPeriodic* iPeriodicTimer;
- CPeriodic* iMountTimer;
-
- //MDS Harvester client
- RHarvesterClient iHarvesterClient;
-
- //Set when running RunL() first time
- TBool iInit;
-
- //2nd phase init after MDE session is open
- TBool iInit2;
-
- // auto create values from centrep
- TBool iAutoImage;
- TBool iAutoVideo;
- TBool iAutoAudio;
-
- // in case of modified files force TN update
- TBool iForceRun;
- // controlled by Photos application to run TN generation on foreground
- TBool iForegroundRun;
- //request pending in TNM side
-
- CTMFormatObserver* iFormatObserver;
-
- //formating started
- TBool iFormatting;
- //TNM server session died
- TBool iSessionDied;
-
- //pending request count
- TUint iActiveCount;
-
- MMPXCollectionUtility* iCollectionUtility; // own
-
- //Flag is MPX harvesting or MTP synchronisation in progress
- TBool iMPXHarvesting;
-
- //overall status of device
- TBool iIdle;
-
- //monitors device activity
- CTMActivityManager* iActivityManager;
-
- //Observer foreground generation
- CTMRPropertyObserver* iForegroundGenerationObserver;
-
- //Previously notified amount of items in processing queues (add/modify)
- TInt iPreviousItemsLeft;
- TBool iPreviousDaemonProcessing;
- //set ETrue when QueryAllItems needs to be run after placeholder query
- TBool iDoQueryAllItems;
-
- TBool iShutdown;
-
- //item counts
- TUint32 iModifyItemCount;
- TUint32 iImageItemCount;
- TUint32 iVideoItemCount;
- TUint32 iAudioItemCount;
- TUint32 iDeleteItemCount;
- TUint32 iAddItemCount;
- TUint32 iCameraItemCount;
- TUint32 iUnknownItemCount;
- TUint32 i2ndAddItemCount;
- TUint32 iPlaceholderItemCount;
-
- //for book keeping previous items left count got from MDS harvester
- TUint32 iMMCHarvestingItemsLeftTemp;
- TUint32 iPHHarvestingItemsLeftTemp;
-
- //MdE object definitons used in query
- CMdEObjectDef* iImageObjectDef;
- CMdEObjectDef* iVideoObjectDef;
- CMdEObjectDef* iAudioObjectDef;
- TBool iHarvesterActivated;
- };
-
-#endif // THUMBAGPROCESSOR_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagvideoobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
- *
-*/
-
-
-#ifndef THUMBAGVIDEOBSERVER_H
-#define THUMBAGVIDEOBSERVER_H
-
-#include <e32base.h>
-#include <w32std.h>
-
-#include <mdesession.h>
-
-#include "thumbagprocessor.h"
-#include "thumbnaillog.h"
-#include "tmshutdownobserver.h"
-
-
-/**
- * ThumbAG daemon.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbAGVideoObserver ): public CBase,
- public MMdESessionObserver,
- public MMdEObjectObserver,
- public MTMShutdownObserver
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGVideoObserver server.
- */
- static CThumbAGVideoObserver* NewLC(CThumbAGProcessor* aProcessor);
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGVideoObserver server.
- */
- static CThumbAGVideoObserver* NewL(CThumbAGProcessor* aProcessor);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbAGVideoObserver();
-
-
-public:
-
- // from MMdESessionObserver
- void HandleSessionOpened( CMdESession& aSession, TInt aError );
- void HandleSessionError( CMdESession& aSession, TInt aError );
-
- // from MMdEObjectObserver
- void HandleObjectNotification(CMdESession& aSession,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray);
-
- // from MTMShutdownObserver
- void ShutdownNotification();
-
-protected:
-
- /**
- * AddObserversL
- *
- * @since S60 v5.0
- */
- void AddObserversL();
-
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbAGVideoObserver instance.
- */
- CThumbAGVideoObserver(CThumbAGProcessor* aProcessor);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Initilization helper
- *
- * @since S60 v5.2
- */
- void InitializeL();
-
- /**
- * Callback for reconnect timer
- *
- * @since S60 v5.0
- */
- static TInt ReconnectCallBack(TAny* aAny);
-
-private:
-
- // own
- CTMShutdownObserver* iShutdownObserver;
- CTMShutdownObserver* iMDSShutdownObserver;
- CMdESession* iMdESession;
- //not owned
- CThumbAGProcessor* iProcessor;
-
- TBool iShutdown;
-
- // reconnect timer
- CPeriodic* iReconnect;
-
- TBool iSessionError;
-
-#ifdef _DEBUG
- TUint32 iAddCounter;
- TUint32 iModCounter;
-#endif
-};
-
-#endif // THUMBAGDAEMON_H
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagaudioobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,380 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
-*
-*/
-
-
-#include <e32svr.h>
-#include <centralrepository.h>
-
-#include <mdesession.h>
-#include <mdeconstants.h>
-#include <mdequery.h>
-#include <mdeobject.h>
-
-#include "thumbagaudioobserver.h"
-#include "thumbnaillog.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanagerprivatecrkeys.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbagaudioobserverTraces.h"
-#endif
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CThumbAGAudioObserver* CThumbAGAudioObserver::NewLC(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGAudioObserver::NewLC() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_NEWLC, "CThumbAGAudioObserver::NewLC" );
-
- CThumbAGAudioObserver* self = new (ELeave) CThumbAGAudioObserver(aProcessor);
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CThumbAGAudioObserver* CThumbAGAudioObserver::NewL(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGAudioObserver::NewL() - begin" );
-
- CThumbAGAudioObserver* self = CThumbAGAudioObserver::NewLC(aProcessor);
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGAudioObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGAudioObserver::CThumbAGAudioObserver(CThumbAGProcessor* aProcessor)
- : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
- {
- // No implementation required
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGAudioObserver::ConstructL()
- {
- TN_DEBUG1( "CThumbAGAudioObserver::ConstructL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_CONSTRUCTL, "CThumbAGAudioObserver::ConstructL - begin" );
-
-#ifdef _DEBUG
- iAddCounter = 0;
- iModCounter = 0;
-#endif
-
- InitializeL();
-
- TN_DEBUG1( "CThumbAGAudioObserver::ConstructL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_CONSTRUCTL, "CThumbAGAudioObserver::ConstructL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGAudioObserver
-// ---------------------------------------------------------------------------
-//
-void CThumbAGAudioObserver::InitializeL()
- {
- TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_INITIALIZEL, "CThumbAGAudioObserver::InitializeL - begin" );
-
- TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - create observers" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_INITIALIZEL, "CThumbAGAudioObserver::InitializeL - create observers" );
-
- // create shutdown observer
- if(iMDSShutdownObserver)
- {
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
- }
- iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
-
- if(iShutdownObserver)
- {
- delete iShutdownObserver;
- iShutdownObserver = NULL;
- }
- iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
- iShutdown = EFalse;
-
- // MDS session reconnect timer
- if (!iReconnect)
- {
- iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
- }
-
- TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - connect to MDS" );
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGAUDIOOBSERVER_INITIALIZEL, "CThumbAGAudioObserver::InitializeL - connect to MDS" );
-
- if(iMdESession)
- {
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- // connect to MDS
- delete iMdESession;
- iMdESession = NULL;
- }
-
- iMdESession = CMdESession::NewL( *this );
- iSessionError = EFalse;
-
- TN_DEBUG1( "CThumbAGAudioObserver::InitializeL() - end" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGAUDIOOBSERVER_INITIALIZEL, "CThumbAGAudioObserver::InitializeL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGAudioObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGAudioObserver::~CThumbAGAudioObserver()
- {
- TN_DEBUG1( "CThumbAGAudioObserver::~CThumbAGAudioObserver() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_CTHUMBAGAUDIOOBSERVER, "CThumbAGAudioObserver::~CThumbAGAudioObserver - begin" );
-
- iShutdown = ETrue;
-
- Shutdown();
-
- TN_DEBUG1( "CThumbAGAudioObserver::~CThumbAGAudioObserver() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_CTHUMBAGAUDIOOBSERVER, "CThumbAGAudioObserver::~CThumbAGAudioObserver - end" );
- }
-
-void CThumbAGAudioObserver::Shutdown()
- {
- TN_DEBUG1( "CThumbAGAudioObserver::Shutdown()" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_SHUTDOWN, "CThumbAGAudioObserver::Shutdown" );
-
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
- delete iShutdownObserver;
- iShutdownObserver = NULL;
-
- if(iReconnect)
- {
- iReconnect->Cancel();
- delete iReconnect;
- iReconnect = NULL;
- }
-
- if (iMdESession)
- {
- // 2 observers
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- delete iMdESession;
- iMdESession = NULL;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGAudioObserver::HandleSessionOpened
-// -----------------------------------------------------------------------------
-//
-void CThumbAGAudioObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
- {
- TN_DEBUG1( "CThumbAGAudioObserver::HandleSessionOpened");
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_HANDLESESSIONOPENED, "CThumbAGAudioObserver::HandleSessionOpened" );
-
- if (aError == KErrNone)
- {
- TRAPD( err, AddObserversL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionOpened, AddObserversL error == %d", err );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_HANDLESESSIONOPENED, "CThumbAGAudioObserver::HandleSessionOpened;err=%d", err );
- }
- }
- else
- {
- TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionOpened error == %d", aError );
- OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGAUDIOOBSERVER_HANDLESESSIONOPENED, "CThumbAGAudioObserver::HandleSessionOpened;aError=%d", aError );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGAudioObserver::HandleSessionError
-// -----------------------------------------------------------------------------
-//
-void CThumbAGAudioObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
- {
- TN_DEBUG2( "CThumbAGAudioObserver::HandleSessionError == %d", aError );
- OstTrace1( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_HANDLESESSIONERROR, "CThumbAGAudioObserver::HandleSessionError;aError=%d", aError );
- if (aError != KErrNone && !iSessionError)
- {
- iSessionError = ETrue;
-
- if (!iShutdown)
- {
- if (!iReconnect->IsActive())
- {
- iReconnect->Start( KMdEReconnect, KMdEReconnect,
- TCallBack(ReconnectCallBack, this));
-
- TN_DEBUG1( "CThumbAGAudioObserver::HandleSessionError() - reconnect timer started" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_HANDLESESSIONERROR, "CThumbAGAudioObserver::HandleSessionError - reconnect timer started" );
- }
- }
-
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGAudioObserver::HandleObjectNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGAudioObserver::HandleObjectNotification( CMdESession& /*aSession*/,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray )
- {
- TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification - begin" );
-
- // no processor or shutting down
- if ( iShutdown || !iProcessor)
- {
- return;
- }
-
-#ifdef _DEBUG
- if (aType == ENotifyAdd)
- {
- TN_DEBUG2( "CThumbAGAudioObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification - ENotifyAdd;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iAddCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyModify)
- {
- TN_DEBUG2( "CThumbAGAudioObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification - ENotifyModify;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iModCounter = aObjectIdArray.Count();
- }
-#endif
-
- if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
- {
- TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - AddToQueueL" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification - AddToQueueL" );
-
- // Add event to processing queue by type and enable force run
- RPointerArray<HBufC> dummyArray;
- TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAudio, aObjectIdArray, dummyArray, EFalse));
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - error adding to queue" );
- OstTrace0( TRACE_FATAL, DUP4_CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification - error adding to queue" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - bad notification" );
- OstTrace0( TRACE_FATAL, DUP5_CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification - bad notification" );
- }
-
-#ifdef _DEBUG
- TN_DEBUG3( "CThumbAGAudioObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
- OstTraceExt2( TRACE_FATAL, DUP6_CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification;iAddCounter=%u;iModCounter=%u", iAddCounter, iModCounter );
- iModCounter = 0;
- iAddCounter = 0;
-#endif
-
- TN_DEBUG1( "CThumbAGAudioObserver::HandleObjectNotification() - end" );
- OstTrace0( TRACE_FATAL, DUP7_CTHUMBAGAUDIOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGAudioObserver::HandleObjectNotification - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGAudioObserver::ShutdownNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGAudioObserver::ShutdownNotification()
- {
- TN_DEBUG1( "CThumbAGAudioObserver::ShutdownNotification()" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGAudioObserver::ShutdownNotification" );
-
- if (!iShutdown)
- {
- TN_DEBUG1( "CThumbAGAudioObserver::ShutdownNotification() shutdown" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGAudioObserver::ShutdownNotification - shutdown" );
- iShutdown = ETrue;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGAudioObserver::AddObserversL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGAudioObserver::AddObserversL()
- {
- TN_DEBUG1( "CThumbAGAudioObserver::AddObserversL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_ADDOBSERVERSL, "CThumbAGAudioObserver::AddObserversL - begin" );
-
- CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
- CMdEObjectDef& audioDef = defaultNamespace.GetObjectDefL( MdeConstants::Audio::KAudioObject );
-
- // set observing conditions
- CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- addCondition->AddObjectConditionL( audioDef );
-
- CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- modifyCondition->AddObjectConditionL( audioDef );
-
- // add observer
- iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
-
- // modify observer
- iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
-
- CleanupStack::Pop( 2, addCondition );
-
- TN_DEBUG1( "CThumbAGAudioObserver::AddObserversL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_ADDOBSERVERSL, "CThumbAGAudioObserver::AddObserversL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGAudioObserver::ReconnectCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbAGAudioObserver::ReconnectCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbAGAudioObserver::ReconnectCallBack() - reinitialize");
- OstTrace0( TRACE_FATAL, CTHUMBAGAUDIOOBSERVER_RECONNECTCALLBACK, "CThumbAGAudioObserver::ReconnectCallBack - reinitialize" );
-
- CThumbAGAudioObserver* self = static_cast<CThumbAGAudioObserver*>( aAny );
-
- self->iReconnect->Cancel();
-
- // reconnect to MDS
- TRAP_IGNORE( self->InitializeL() );
-
- TN_DEBUG1( "CThumbAGAudioObserver::ReconnectCallBack() - done");
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGAUDIOOBSERVER_RECONNECTCALLBACK, "CThumbAGAudioObserver::ReconnectCallBack - done" );
-
- return KErrNone;
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagcameraobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,376 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
-*
-*/
-
-
-#include <e32svr.h>
-#include <centralrepository.h>
-
-#include <mdesession.h>
-#include <mdeconstants.h>
-#include <mdequery.h>
-#include <mdeobject.h>
-
-#include "thumbagcameraobserver.h"
-#include "thumbnaillog.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanagerprivatecrkeys.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbagcameraobserverTraces.h"
-#endif
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CThumbAGCameraObserver* CThumbAGCameraObserver::NewLC(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGCameraObserver::NewLC() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_NEWLC, "CThumbAGCameraObserver::NewLC - begin" );
-
- CThumbAGCameraObserver* self = new (ELeave) CThumbAGCameraObserver(aProcessor);
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CThumbAGCameraObserver* CThumbAGCameraObserver::NewL(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGCameraObserver::NewL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_NEWL, "CThumbAGCameraObserver::NewL - begin" );
-
- CThumbAGCameraObserver* self = CThumbAGCameraObserver::NewLC(aProcessor);
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGCameraObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGCameraObserver::CThumbAGCameraObserver(CThumbAGProcessor* aProcessor)
- : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
- {
- // No implementation required
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGCameraObserver::ConstructL()
- {
- TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_CONSTRUCTL, "CThumbAGCameraObserver::ConstructL - begin" );
-
-#ifdef _DEBUG
- iAddCounter = 0;
- iModCounter = 0;
-#endif
-
- InitializeL();
-
- TN_DEBUG1( "CThumbAGCameraObserver::ConstructL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_CONSTRUCTL, "CThumbAGCameraObserver::ConstructL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGCameraObserver
-// ---------------------------------------------------------------------------
-//
-void CThumbAGCameraObserver::InitializeL()
- {
- TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_INITIALIZEL, "CThumbAGCameraObserver::InitializeL - begin" );
-
-
- TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - create observers" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_INITIALIZEL, "CThumbAGCameraObserver::InitializeL - create observers" );
-
- // create shutdown observer
- if(iMDSShutdownObserver)
- {
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
- }
- iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
-
- if(iShutdownObserver)
- {
- delete iShutdownObserver;
- iShutdownObserver = NULL;
- }
- iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
- iShutdown = EFalse;
-
- // MDS session reconnect timer
- if (!iReconnect)
- {
- iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
- }
-
- TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - connect to MDS" );
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGCAMERAOBSERVER_INITIALIZEL, "CThumbAGCameraObserver::InitializeL - connect to MDS" );
-
- if(iMdESession)
- {
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- // connect to MDS
- delete iMdESession;
- iMdESession = NULL;
- }
-
- iMdESession = CMdESession::NewL( *this );
- iSessionError = EFalse;
-
- TN_DEBUG1( "CThumbAGCameraObserver::InitializeL() - end" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGCAMERAOBSERVER_INITIALIZEL, "CThumbAGCameraObserver::InitializeL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGCameraObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGCameraObserver::~CThumbAGCameraObserver()
- {
- TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_CTHUMBAGCAMERAOBSERVER, "CThumbAGCameraObserver::~CThumbAGCameraObserver - begin" );
-
- iShutdown = ETrue;
-
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
-
- delete iShutdownObserver;
- iShutdownObserver = NULL;
-
- if(iReconnect)
- {
- iReconnect->Cancel();
- delete iReconnect;
- iReconnect = NULL;
- }
-
- if (iMdESession)
- {
- // 2 observers
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- delete iMdESession;
- iMdESession = NULL;
- }
-
- TN_DEBUG1( "CThumbAGCameraObserver::~CThumbAGCameraObserver() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_CTHUMBAGCAMERAOBSERVER, "CThumbAGCameraObserver::~CThumbAGCameraObserver - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGCameraObserver::HandleSessionOpened
-// -----------------------------------------------------------------------------
-//
-void CThumbAGCameraObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
- {
- TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionOpened");
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_HANDLESESSIONOPENED, "CThumbAGCameraObserver::HandleSessionOpened" );
-
- if (aError == KErrNone)
- {
- TRAPD( err, AddObserversL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened, AddObserversL error == %d", err );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_HANDLESESSIONOPENED, "CThumbAGCameraObserver::HandleSessionOpened - AddObserversL error;err=%d", err );
- }
- }
- else
- {
- TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionOpened error == %d", aError );
- OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGCAMERAOBSERVER_HANDLESESSIONOPENED, "CThumbAGCameraObserver::HandleSessionOpened;aError=%d", aError );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGCameraObserver::HandleSessionError
-// -----------------------------------------------------------------------------
-//
-void CThumbAGCameraObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
- {
- TN_DEBUG2( "CThumbAGCameraObserver::HandleSessionError == %d", aError );
- OstTrace1( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_HANDLESESSIONERROR, "CThumbAGCameraObserver::HandleSessionError;aError=%d", aError );
- if (aError != KErrNone && !iSessionError)
- {
- iSessionError = ETrue;
-
- if (!iShutdown)
- {
- if (!iReconnect->IsActive())
- {
- iReconnect->Start( KMdEReconnect, KMdEReconnect,
- TCallBack(ReconnectCallBack, this));
-
- TN_DEBUG1( "CThumbAGCameraObserver::HandleSessionError() - reconnect timer started" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_HANDLESESSIONERROR, "CThumbAGCameraObserver::HandleSessionError - reconnect timer started" );
- }
- }
-
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGCameraObserver::HandleObjectNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGCameraObserver::HandleObjectNotification( CMdESession& /*aSession*/,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray )
- {
- TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - begin" );
-
- // no processor or shutting down
- if ( iShutdown || !iProcessor)
- {
- return;
- }
-
-#ifdef _DEBUG
- if (aType == ENotifyAdd)
- {
- TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - ENotifyAdd;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iAddCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyModify)
- {
- TN_DEBUG2( "CThumbAGCameraObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - ENotifyModify;aObjectIdArray.Count=%d", aObjectIdArray.Count() );
- iModCounter = aObjectIdArray.Count();
- }
-#endif
-
- if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
- {
- TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - AddToQueueL" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - AddToQueueL" );
-
- // Add event to processing queue by type and enable force run
- RPointerArray<HBufC> dummyArray;
- TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeCamera, aObjectIdArray, dummyArray, EFalse));
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - error adding to queue" );
- OstTrace0( TRACE_FATAL, DUP4_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - error adding to queue" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - bad notification" );
- OstTrace0( TRACE_FATAL, DUP5_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - bad notification" );
- }
-
-#ifdef _DEBUG
- TN_DEBUG3( "CThumbAGCameraObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
- OstTraceExt2( TRACE_FATAL, DUP6_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification;iAddCounter=%u;iModCounter=%u", iAddCounter, iModCounter );
- iModCounter = 0;
- iAddCounter = 0;
-#endif
-
- TN_DEBUG1( "CThumbAGCameraObserver::HandleObjectNotification() - end" );
- OstTrace0( TRACE_FATAL, DUP7_CTHUMBAGCAMERAOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGCameraObserver::HandleObjectNotification - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGCameraObserver::ShutdownNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGCameraObserver::ShutdownNotification()
- {
- TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification()" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGCameraObserver::ShutdownNotification" );
-
- if (!iShutdown)
- {
- TN_DEBUG1( "CThumbAGCameraObserver::ShutdownNotification() shutdown" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGCameraObserver::ShutdownNotification - shutdown" );
- iShutdown = ETrue;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGCameraObserver::AddObserversL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGCameraObserver::AddObserversL()
- {
- TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_ADDOBSERVERSL, "CThumbAGCameraObserver::AddObserversL - begin" );
-
- CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
- CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
- CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
-
- // set observing conditions
- CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- addCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
-
- CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintEqual(MdeConstants::Object::ECamera));
-
- // add observer
- iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
-
- // modify observer
- iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
-
- CleanupStack::Pop( 2, addCondition );
-
- TN_DEBUG1( "CThumbAGCameraObserver::AddObserversL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_ADDOBSERVERSL, "CThumbAGCameraObserver::AddObserversL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGCameraObserver::ReconnectCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbAGCameraObserver::ReconnectCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - reinitialize");
- OstTrace0( TRACE_FATAL, CTHUMBAGCAMERAOBSERVER_RECONNECTCALLBACK, "CThumbAGCameraObserver::ReconnectCallBack - reinitialize" );
-
- CThumbAGCameraObserver* self = static_cast<CThumbAGCameraObserver*>( aAny );
-
- self->iReconnect->Cancel();
-
- // reconnect to MDS
- TRAP_IGNORE( self->InitializeL() );
-
- TN_DEBUG1( "CThumbAGCameraObserver::ReconnectCallBack() - done");
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGCAMERAOBSERVER_RECONNECTCALLBACK, "CThumbAGCameraObserver::ReconnectCallBack - done" );
-
- return KErrNone;
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,651 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
-*
-*/
-
-
-#include <e32svr.h>
-#include <centralrepository.h>
-
-#include <mdesession.h>
-#include <mdeconstants.h>
-#include <mdequery.h>
-#include <mdeobject.h>
-
-#include "thumbagdaemon.h"
-#include "thumbnaillog.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanagerprivatecrkeys.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbagdaemonTraces.h"
-#endif
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CThumbAGDaemon* CThumbAGDaemon::NewLC()
- {
- TN_DEBUG1( "CThumbAGDaemon::NewLC() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_NEWLC, "CThumbAGDaemon::NewLC - begin" );
-
- CThumbAGDaemon* self = new (ELeave) CThumbAGDaemon();
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CThumbAGDaemon* CThumbAGDaemon::NewL()
- {
- TN_DEBUG1( "CThumbAGDaemon::NewL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGDAEMON_NEWL, "CThumbAGDaemon::NewL" );
-
- CThumbAGDaemon* self = CThumbAGDaemon::NewLC();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGDaemon
-// ---------------------------------------------------------------------------
-//
-CThumbAGDaemon::CThumbAGDaemon()
- : CServer2( CActive::EPriorityStandard, CServer2::EUnsharableSessions ), iShutdownObserver(NULL),
- iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(NULL)
- {
- // No implementation required
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGDaemon::ConstructL()
- {
- TN_DEBUG1( "CThumbAGDaemon::ConstructL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_CONSTRUCTL, "CThumbAGDaemon::ConstructL - begin" );
-
- StartL( KTAGDaemonName );
-
-#ifdef _DEBUG
- iAddCounter = 0;
- iDelCounter = 0;
-#endif
-
- InitializeL();
-
- TN_DEBUG1( "CThumbAGDaemon::ConstructL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_CONSTRUCTL, "CThumbAGDaemon::ConstructL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGDaemon
-// ---------------------------------------------------------------------------
-//
-void CThumbAGDaemon::InitializeL()
- {
- TN_DEBUG1( "CThumbAGDaemon::InitializeL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_INITIALIZEL, "CThumbAGDaemon::InitializeL - begin" );
-
- if (DaemonEnabledL())
- {
- TN_DEBUG1( "CThumbAGDaemon::InitializeL() - create observers" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_INITIALIZEL, "CThumbAGDaemon::InitializeL - create observers" );
-
- // create shutdown observer
- if(iMDSShutdownObserver)
- {
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
- }
- iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
-
- if(iShutdownObserver)
- {
- delete iShutdownObserver;
- iShutdownObserver = NULL;
- }
- iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
- iShutdown = EFalse;
-
- // create processor
- if(iProcessor)
- {
- iProcessor->Shutdown();
- delete iProcessor;
- iProcessor = NULL;
- }
-
- iProcessor = CThumbAGProcessor::NewL();
-
- // MDS session reconnect timer
- if (!iReconnect)
- {
- iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
- }
-
- TN_DEBUG1( "CThumbAGDaemon::InitializeL() - connect to MDS" );
-
- if(iMdESession)
- {
- TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectPresentObserverL( * this ));
-
- // connect to MDS
- delete iMdESession;
- iMdESession = NULL;
- }
-
- iMdESession = CMdESession::NewL( *this );
- iSessionError = EFalse;
-
- delete iImageObserver;
- iImageObserver = NULL;
- iImageObserver = CThumbAGImageObserver::NewL(iProcessor);
-
- delete iCameraObserver;
- iCameraObserver = NULL;
- iCameraObserver = CThumbAGCameraObserver::NewL(iProcessor);
-
- delete iAudioObserver;
- iAudioObserver = NULL;
- iAudioObserver = CThumbAGAudioObserver::NewL(iProcessor);
-
- delete iVideoObserver;
- iVideoObserver = NULL;
- iVideoObserver = CThumbAGVideoObserver::NewL(iProcessor);
- }
- else
- {
- // no error here, but need to shutdown daemon neatly
- User::Leave(KErrNone);
- }
- TN_DEBUG1( "CThumbAGDaemon::InitializeL() - end" );
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_INITIALIZEL, "CThumbAGDaemon::InitializeL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGDaemon
-// ---------------------------------------------------------------------------
-//
-CThumbAGDaemon::~CThumbAGDaemon()
- {
- TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_CTHUMBAGDAEMON, "CThumbAGDaemon::~CThumbAGDaemon - begin" );
-
- iShutdown = ETrue;
-
- delete iImageObserver;
- iImageObserver = NULL;
-
- delete iCameraObserver;
- iCameraObserver = NULL;
-
- delete iVideoObserver;
- iVideoObserver = NULL;
-
- delete iAudioObserver;
- iAudioObserver = NULL;
-
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
-
- delete iShutdownObserver;
- iShutdownObserver = NULL;
-
- if(iReconnect)
- {
- iReconnect->Cancel();
- delete iReconnect;
- iReconnect = NULL;
- }
-
- if (iProcessor)
- {
- iProcessor->Shutdown();
- delete iProcessor;
- iProcessor = NULL;
- }
-
- if (iMdESession)
- {
-#ifdef MDS_URI_OBSERVER
- // remove observer with uri
- TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) );
-#endif
-
- //present observer
- TRAP_IGNORE( iMdESession->RemoveObjectPresentObserverL( *this ) );
-
- delete iMdESession;
- iMdESession = NULL;
- }
-
- TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_CTHUMBAGDAEMON, "CThumbAGDaemon::~CThumbAGDaemon - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::NewSessionL()
-// -----------------------------------------------------------------------------
-//
-CSession2* CThumbAGDaemon::NewSessionL( const TVersion& /*aVersion*/,
- const RMessage2& /*aMessage*/ )const
- {
- // no services, no clients, no sessions
- User::Leave(KErrNotSupported);
-
- //just for getting rid of compiler warning about missing return value
- return NULL;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGDaemon::ThreadFunctionL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGDaemon::ThreadFunctionL()
- {
- TN_DEBUG1( "CThumbAGDaemon::ThreadFunctionL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_THREADFUNCTIONL, "CThumbAGDaemon::ThreadFunctionL - begin" );
-
- User::LeaveIfError( User::RenameThread( KTAGDaemonName ) );
-
- CThumbAGDaemon* server = NULL;
- CActiveScheduler* scheduler = new( ELeave )CActiveScheduler();
-
- if ( scheduler )
- {
- CActiveScheduler::Install( scheduler );
-
- CleanupStack::PushL( scheduler );
- server = CThumbAGDaemon::NewL(); // Adds server in scheduler
-
- RProcess::Rendezvous( KErrNone );
-
- CActiveScheduler::Start();
-
- // comes here if server gets shut down
- delete server;
- server = NULL;
-
- CleanupStack::PopAndDestroy( scheduler );
- }
-
- TN_DEBUG1( "CThumbAGDaemon::ThreadFunctionL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_THREADFUNCTIONL, "CThumbAGDaemon::ThreadFunctionL - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGDaemon::HandleSessionOpened
-// -----------------------------------------------------------------------------
-//
-void CThumbAGDaemon::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleSessionOpened");
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_HANDLESESSIONOPENED, "CThumbAGDaemon::HandleSessionOpened" );
-
- if (aError == KErrNone)
- {
- TRAPD(err, iProcessor->SetMdESessionL(iMdESession));
-
- TRAP( err, AddObserversL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened, AddObserversL error == %d", err );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLESESSIONOPENED, "CThumbAGDaemon::HandleSessionOpened;err=%d", err );
- }
- }
- else
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened error == %d", aError );
- OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLESESSIONOPENED, "CThumbAGDaemon::HandleSessionOpened;aError=%d", aError );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGDaemon::HandleSessionError
-// -----------------------------------------------------------------------------
-//
-void CThumbAGDaemon::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleSessionError == %d", aError );
- OstTrace1( TRACE_FATAL, CTHUMBAGDAEMON_HANDLESESSIONERROR, "CThumbAGDaemon::HandleSessionError;aError=%d", aError );
- if (aError != KErrNone && !iShutdown && !iSessionError)
- {
- iSessionError = ETrue;
-
- delete iImageObserver;
- iImageObserver = NULL;
-
- delete iCameraObserver;
- iCameraObserver = NULL;
-
- delete iVideoObserver;
- iVideoObserver = NULL;
-
- delete iAudioObserver;
- iAudioObserver = NULL;
-
- // kill processor right away, because it also has MdESession
- if(iProcessor)
- {
- iProcessor->Shutdown();
- delete iProcessor;
- iProcessor = NULL;
- }
-
- if (!iReconnect->IsActive())
- {
- iReconnect->Start( KMdEReconnect, KMdEReconnect,
- TCallBack(ReconnectCallBack, this));
-
- TN_DEBUG1( "CThumbAGDaemon::HandleSessionError() - reconnect timer started" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLESESSIONERROR, "CThumbAGDaemon::HandleSessionError - reconnect timer started" );
- }
-
- }
- }
-
-#ifdef MDS_URI_OBSERVER
-// -----------------------------------------------------------------------------
-// CThumbAGDaemon::HandleObjectNotification
-// -----------------------------------------------------------------------------
-//
-
-void CThumbAGDaemon::HandleUriObjectNotification(CMdESession& /*aSession*/,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray,
- const RPointerArray<HBufC>& aObjectUriArray)
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_HANDLEURIOBJECTNOTIFICATION, "CThumbAGDaemon::HandleUriObjectNotification - begin" );
-
- if(!iProcessor || iShutdown)
- {
- return;
- }
-
- if(aType == ENotifyRemove)
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed");
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLEURIOBJECTNOTIFICATION, "CThumbAGDaemon::HandleUriObjectNotification - removed" );
- TInt err(0);
- TRAP(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, aObjectUriArray, EFalse));
- __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGDaemon::HandleUriObjectNotification()"), err));
-
- err = KErrNone;
- }
- TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - end" );
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLEURIOBJECTNOTIFICATION, "CThumbAGDaemon::HandleUriObjectNotification - end" );
- }
-#endif
-
-// -----------------------------------------------------------------------------
-// CThumbAGDaemon::HandleObjectNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGDaemon::HandleObjectNotification( CMdESession& /*aSession*/,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray )
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - begin" );
-
- // no processor or shutting down
- if (!iProcessor || iShutdown)
- {
- return;
- }
-
-#ifdef _DEBUG
- if (aType == ENotifyRemove)
- {
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyRemove %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - ENotifyRemove;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iDelCounter = aObjectIdArray.Count();
- }
-#endif
-
- if ( aType == ENotifyRemove && aObjectIdArray.Count() > 0 )
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - AddToQueueL" );
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - AddToQueueL" );
-
- // If delete event, remove IDs from Modify and Add queues
- iProcessor->RemoveFromQueues( aObjectIdArray, EFalse);
-
- // Add event to processing queue by type and enable force run
- RPointerArray<HBufC> dummyArray;
- TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, dummyArray, EFalse));
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - error adding to queue" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - error adding to queue" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - bad notification" );
- OstTrace0( TRACE_FATAL, DUP4_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - bad notification" );
- }
-
-#ifdef _DEBUG
- TN_DEBUG2( "CThumbAGDaemon::IN-COUNTERS---------- Delete = %d", iDelCounter );
- OstTrace1( TRACE_FATAL, DUP5_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::IN-COUNTERS---------- Delete;iDelCounter=%u", iDelCounter );
- iDelCounter = 0;
-#endif
-
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - end" );
- OstTrace0( TRACE_FATAL, DUP6_CTHUMBAGDAEMON_HANDLEOBJECTNOTIFICATION, "CThumbAGDaemon::HandleObjectNotification - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGDaemon::HandleObjectPresentNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGDaemon::HandleObjectPresentNotification(CMdESession& /*aSession*/,
- TBool aPresent, const RArray<TItemId>& aObjectIdArray)
- {
- TN_DEBUG3( "CThumbAGDaemon::HandleObjectPresentNotification() - aPresent == %d count == %d", aPresent, aObjectIdArray.Count() );
- OstTraceExt2( TRACE_FATAL, CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification;aPresent=%d;aObjectIdArray.Count()=%d", aPresent, aObjectIdArray.Count() );
-
- // no processor or shutting down
- if (!iProcessor || iShutdown)
- {
- return;
- }
-
- TInt err = 0;
-
- //tread present objects as added
- if(aPresent)
- {
- if ( aObjectIdArray.Count() > 0)
- {
- // do not force run of these items
- RPointerArray<HBufC> dummyArray;
- TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, EGenerationItemTypeUnknown, aObjectIdArray, dummyArray, ETrue));
-
- TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd unknown items %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - ENotifyAdd unknown items;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- #ifdef _DEBUG
- iAddCounter = aObjectIdArray.Count();
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - error adding to queue" );
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - error adding to queue" );
- }
- #endif
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - handle not present" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - handle not present" );
-
- #ifdef _DEBUG
- if( iAddCounter < aObjectIdArray.Count() )
- {
- iAddCounter = 0;
- }
- else
- {
- iDelCounter = aObjectIdArray.Count();
- }
- #endif
-
- if ( aObjectIdArray.Count() > 0)
- {
- iProcessor->RemoveFromQueues( aObjectIdArray, ETrue );
- }
- }
-
- #ifdef _DEBUG
- TN_DEBUG3( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Delete = %d", iAddCounter, iDelCounter );
- OstTraceExt2( TRACE_FATAL, DUP4_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::::IN-COUNTERS---------- Add, Delete;iAddCounter=%u;iDelCounter=%u", iAddCounter, iDelCounter );
- iDelCounter = 0;
- iAddCounter = 0;
- #endif
-
- TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - end" );
- OstTrace0( TRACE_FATAL, DUP5_CTHUMBAGDAEMON_HANDLEOBJECTPRESENTNOTIFICATION, "CThumbAGDaemon::HandleObjectPresentNotification - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGDaemon::ShutdownNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGDaemon::ShutdownNotification()
- {
- TN_DEBUG1( "CThumbAGDaemon::ShutdownNotification()" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_SHUTDOWNNOTIFICATION, "CThumbAGDaemon::ShutdownNotification" );
-
- if (!iShutdown)
- {
- CActiveScheduler::Stop();
- iShutdown = ETrue;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGDaemon::AddObserversL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGDaemon::AddObserversL()
- {
- TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_ADDOBSERVERSL, "CThumbAGDaemon::AddObserversL - begin" );
-
-#ifdef MDS_URI_OBSERVER
- // remove observer with uri
- iMdESession->AddObjectObserverWithUriL( *this, NULL, ENotifyRemove );
-#endif
-
- // object present observer
- iMdESession->AddObjectPresentObserverL( *this );
-
- TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_ADDOBSERVERSL, "CThumbAGDaemon::AddObserversL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGDaemon::DaemonEnabledL
-// ---------------------------------------------------------------------------
-//
-TBool CThumbAGDaemon::DaemonEnabledL()
- {
- TN_DEBUG1( "CThumbAGDaemon::DaemonEnabledL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_DAEMONENABLEDL, "CThumbAGDaemon::DaemonEnabledL - begin" );
- CRepository* rep = CRepository::NewL( TUid::Uid( THUMBNAIL_CENREP_UID ));
-
- // get value
- TBool val( EFalse );
- TInt ret = rep->Get( KEnableDaemon, val );
-
- delete rep;
- rep = NULL;
-
- TN_DEBUG3( "CThumbAGDaemon::DaemonEnabledL() - val == %d, ret == %d", val, ret );
- OstTraceExt2( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_DAEMONENABLEDL, "CThumbAGDaemon::DaemonEnabledL;val=%u;ret=%d", val, ret );
- return val;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGDaemon::ReconnectCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbAGDaemon::ReconnectCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - reinitialize");
- OstTrace0( TRACE_FATAL, CTHUMBAGDAEMON_RECONNECTCALLBACK, "CThumbAGDaemon::ReconnectCallBack - reinitialize" );
-
- CThumbAGDaemon* self = static_cast<CThumbAGDaemon*>( aAny );
-
- self->iReconnect->Cancel();
-
- // reconnect to MDS
- TRAP_IGNORE( self->InitializeL() );
-
- TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done");
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGDAEMON_RECONNECTCALLBACK, "CThumbAGDaemon::ReconnectCallBack - done" );
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// E32Main
-// ---------------------------------------------------------------------------
-//
-TInt E32Main()
- {
- TN_DEBUG1( "CThumbAGDaemon::E32Main() - begin" );
- OstTrace0( TRACE_FATAL, _E32MAIN, "::E32Main - begin" );
-
- __UHEAP_MARK;
-
- CTrapCleanup* cleanup = CTrapCleanup::New();
- TInt result = KErrNoMemory;
-
- if ( cleanup )
- {
- TRAP( result, CThumbAGDaemon::ThreadFunctionL());
- delete cleanup;
- cleanup = NULL;
- }
-
- if ( result != KErrNone )
- {
- TN_DEBUG1( "CThumbAGDaemon::E32Main() - error" );
- OstTrace0( TRACE_FATAL, DUP1__E32MAIN, "::E32Main - error" );
-
- // Signal the client that server creation failed
- RProcess::Rendezvous( result );
- }
-
- __UHEAP_MARKEND;
-
- TN_DEBUG1( "CThumbAGDaemon::E32Main() - end" );
- OstTrace0( TRACE_FATAL, DUP2__E32MAIN, "::E32Main - end" );
-
- return result;
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagimageobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,382 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
-*
-*/
-
-
-#include <e32svr.h>
-#include <centralrepository.h>
-
-#include <mdesession.h>
-#include <mdeconstants.h>
-#include <mdequery.h>
-#include <mdeobject.h>
-
-#include "thumbagimageobserver.h"
-#include "thumbnaillog.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanagerprivatecrkeys.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbagimageobserverTraces.h"
-#endif
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CThumbAGImageObserver* CThumbAGImageObserver::NewLC(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGImageObserver::NewLC() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_NEWLC, "CThumbAGImageObserver::NewLC - begin" );
-
- CThumbAGImageObserver* self = new (ELeave) CThumbAGImageObserver(aProcessor);
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CThumbAGImageObserver* CThumbAGImageObserver::NewL(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGImageObserver::NewL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_NEWL, "CThumbAGImageObserver::NewL - begin" );
-
- CThumbAGImageObserver* self = CThumbAGImageObserver::NewLC(aProcessor);
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGImageObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGImageObserver::CThumbAGImageObserver(CThumbAGProcessor* aProcessor)
- : iShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
- {
- // No implementation required
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGImageObserver::ConstructL()
- {
- TN_DEBUG1( "CThumbAGImageObserver::ConstructL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_CONSTRUCTL, "CThumbAGImageObserver::ConstructL - begin" );
-
-#ifdef _DEBUG
- iAddCounter = 0;
- iModCounter = 0;
-#endif
-
- InitializeL();
-
- TN_DEBUG1( "CThumbAGImageObserver::ConstructL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_CONSTRUCTL, "CThumbAGImageObserver::ConstructL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGImageObserver
-// ---------------------------------------------------------------------------
-//
-void CThumbAGImageObserver::InitializeL()
- {
- TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_INITIALIZEL, "CThumbAGImageObserver::InitializeL - begin" );
-
- TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - create observers" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_INITIALIZEL, "CThumbAGImageObserver::InitializeL - create observers" );
-
- // create shutdown observer
- if(iMDSShutdownObserver)
- {
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
- }
- iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
-
- if(iShutdownObserver)
- {
- delete iShutdownObserver;
- iShutdownObserver = NULL;
- }
- iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
- iShutdown = EFalse;
-
- // MDS session reconnect timer
- if (!iReconnect)
- {
- iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
- }
-
- TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - connect to MDS" );
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBAGIMAGEOBSERVER_INITIALIZEL, "CThumbAGImageObserver::InitializeL - connect to MDS" );
-
- if(iMdESession)
- {
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- // connect to MDS
- delete iMdESession;
- iMdESession = NULL;
- }
-
- iMdESession = CMdESession::NewL( *this );
- iSessionError = EFalse;
-
- TN_DEBUG1( "CThumbAGImageObserver::InitializeL() - end" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGIMAGEOBSERVER_INITIALIZEL, "CThumbAGImageObserver::InitializeL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGImageObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGImageObserver::~CThumbAGImageObserver()
- {
- TN_DEBUG1( "CThumbAGImageObserver::~CThumbAGImageObserver() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_CTHUMBAGIMAGEOBSERVER, "CThumbAGImageObserver::~CThumbAGImageObserver - begin" );
-
- iShutdown = ETrue;
-
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
-
- delete iShutdownObserver;
- iShutdownObserver = NULL;
-
- if(iReconnect)
- {
- iReconnect->Cancel();
- delete iReconnect;
- iReconnect = NULL;
- }
-
- if (iMdESession)
- {
- // 2 observers
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- delete iMdESession;
- iMdESession = NULL;
- }
-
- TN_DEBUG1( "CThumbAGImageObserver::~CThumbAGImageObserver() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_CTHUMBAGIMAGEOBSERVER, "CThumbAGImageObserver::~CThumbAGImageObserver - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGImageObserver::HandleSessionOpened
-// -----------------------------------------------------------------------------
-//
-void CThumbAGImageObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
- {
- TN_DEBUG1( "CThumbAGImageObserver::HandleSessionOpened");
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_HANDLESESSIONOPENED, "CThumbAGImageObserver::HandleSessionOpened" );
-
- if (aError == KErrNone)
- {
- TRAPD( err, AddObserversL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbAGImageObserver::HandleSessionOpened, AddObserversL error == %d", err );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_HANDLESESSIONOPENED, "CThumbAGImageObserver::HandleSessionOpened, AddObserversL error;err=%d", err );
- }
- }
- else
- {
- TN_DEBUG2( "CThumbAGImageObserver::HandleSessionOpened error == %d", aError );
- OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGIMAGEOBSERVER_HANDLESESSIONOPENED, "CThumbAGImageObserver::HandleSessionOpened;aError=%d", aError );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGImageObserver::HandleSessionError
-// -----------------------------------------------------------------------------
-//
-void CThumbAGImageObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
- {
- TN_DEBUG2( "CThumbAGImageObserver::HandleSessionError == %d", aError );
- OstTrace1( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_HANDLESESSIONERROR, "CThumbAGImageObserver::HandleSessionError;aError=%d", aError );
- if (aError != KErrNone && !iSessionError)
- {
- iSessionError = ETrue;
-
- if (!iShutdown)
- {
- if (!iReconnect->IsActive())
- {
- iReconnect->Start( KMdEReconnect, KMdEReconnect,
- TCallBack(ReconnectCallBack, this));
-
- TN_DEBUG1( "CThumbAGImageObserver::HandleSessionError() - reconnect timer started" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_HANDLESESSIONERROR, "CThumbAGImageObserver::HandleSessionError - reconnect timer started" );
- }
- }
-
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGImageObserver::HandleObjectNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGImageObserver::HandleObjectNotification( CMdESession& /*aSession*/,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray )
- {
- TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HandleObjectNotification - begin" );
-
- // no processor or shutting down
- if (iShutdown || !iProcessor)
- {
- return;
- }
-
-#ifdef _DEBUG
- if (aType == ENotifyAdd)
- {
- TN_DEBUG2( "CThumbAGImageObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HandleObjectNotification - ENotifyAdd;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iAddCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyModify)
- {
- TN_DEBUG2( "CThumbAGImageObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_FATAL, DUP2_CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HandleObjectNotification - ENotifyModify;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iModCounter = aObjectIdArray.Count();
- }
-#endif
-
- if ( (aType == ENotifyAdd || aType == ENotifyModify) && aObjectIdArray.Count() > 0 )
- {
- TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - AddToQueueL" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HandleObjectNotification - AddToQueueL" );
-
- // Add event to processing queue by type and enable force run
- RPointerArray<HBufC> dummyArray;
- TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeImage, aObjectIdArray, dummyArray, EFalse));
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - error adding to queue" );
- OstTrace0( TRACE_FATAL, DUP4_CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HandleObjectNotification - error adding to queue" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - bad notification" );
- OstTrace0( TRACE_FATAL, DUP5_CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HandleObjectNotification - bad notification" );
- }
-
-#ifdef _DEBUG
- TN_DEBUG3( "CThumbAGImageObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
- OstTraceExt2( TRACE_FATAL, DUP6_CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HIN-COUNTERS---------- Add, Modify;iAddCounter=%u;iModCounter=%u", iAddCounter, iModCounter );
- iModCounter = 0;
- iAddCounter = 0;
-
-#endif
-
- TN_DEBUG1( "CThumbAGImageObserver::HandleObjectNotification() - end" );
- OstTrace0( TRACE_FATAL, DUP7_CTHUMBAGIMAGEOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGImageObserver::HandleObjectNotification - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGImageObserver::AddObserversL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGImageObserver::AddObserversL()
- {
- TN_DEBUG1( "CThumbAGImageObserver::AddObserversL() - begin" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_ADDOBSERVERSL, "CThumbAGImageObserver::AddObserversL - begin" );
-
- CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
- CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
- CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
- CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
-
- // set observing conditions
- CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- addCondition->AddObjectConditionL( imageDef );
-
- addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-
- CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- modifyCondition->AddObjectConditionL( imageDef );
-
- modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-
- // add observers
- iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
-
- // modify observer
- iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
-
- CleanupStack::Pop( 2, addCondition );
-
- TN_DEBUG1( "CThumbAGImageObserver::AddObserversL() - end" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_ADDOBSERVERSL, "CThumbAGImageObserver::AddObserversL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbAGCameraObserver::ShutdownNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGImageObserver::ShutdownNotification()
- {
- TN_DEBUG1( "CThumbAGImageObserver::ShutdownNotification()" );
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGImageObserver::ShutdownNotification" );
-
- if (!iShutdown)
- {
- TN_DEBUG1( "CThumbAGImageObserver::ShutdownNotification() shutdown" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGImageObserver::ShutdownNotification - shutdown" );
- iShutdown = ETrue;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGImageObserver::ReconnectCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbAGImageObserver::ReconnectCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbAGImageObserver::ReconnectCallBack() - reinitialize");
- OstTrace0( TRACE_FATAL, CTHUMBAGIMAGEOBSERVER_RECONNECTCALLBACK, "CThumbAGImageObserver::ReconnectCallBack - reinitialize" );
-
- CThumbAGImageObserver* self = static_cast<CThumbAGImageObserver*>( aAny );
-
- self->iReconnect->Cancel();
-
- // reconnect to MDS
- TRAP_IGNORE( self->InitializeL() );
-
- TN_DEBUG1( "CThumbAGImageObserver::ReconnectCallBack() - done");
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBAGIMAGEOBSERVER_RECONNECTCALLBACK, "CThumbAGImageObserver::ReconnectCallBack - done" );
-
- return KErrNone;
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2560 +0,0 @@
-/*
-* 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: Processor
-*
-*/
-
-
-#include <e32base.h>
-
-#include <mdeconstants.h>
-#include <centralrepository.h>
-
-#include <mpxcollectionutility.h>
-#include <mpxmessagegeneraldefs.h>
-#include <mpxcollectionmessage.h>
-#include <coreapplicationuisdomainpskeys.h>
-
-#include "thumbagprocessor.h"
-#include "thumbnaillog.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanagerprivatecrkeys.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbagprocessorTraces.h"
-#endif
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::NewL()
-// ---------------------------------------------------------------------------
-//
-CThumbAGProcessor* CThumbAGProcessor::NewL()
- {
- TN_DEBUG1( "CThumbAGProcessor::NewL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_NEWL, "CThumbAGProcessor::NewL - begin" );
-
- CThumbAGProcessor* self = new( ELeave )CThumbAGProcessor();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::CThumbAGProcessor()
-// ---------------------------------------------------------------------------
-//
-CThumbAGProcessor::CThumbAGProcessor(): CActive( CActive::EPriorityStandard ), iMMCHarvestingItemsLeftTemp(0),
- iPHHarvestingItemsLeftTemp(0)
- {
- TN_DEBUG1( "CThumbAGProcessor::CThumbAGProcessor() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_CTHUMBAGPROCESSOR, "CThumbAGProcessor::CThumbAGProcessor- begin" );
-
- CActiveScheduler::Add( this );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::ConstructL()
- {
- TN_DEBUG1( "CThumbAGProcessor::ConstructL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_CONSTRUCTL, "CThumbAGProcessor::ConstructL - begin" );
-
- iShutdown = EFalse;
-
- iTMSession = CThumbnailManager::NewL( *this );
- iTMSession->SetRequestObserver(*this);
-
- iQueryAllItems = NULL;
- iQueryPlaceholders = NULL;
- iQuery = NULL;
- iQueryActive = EFalse;
- iModify = EFalse;
- iProcessingCount = 0;
-
- iActiveCount = 0;
-
- // set auto create values from cenrep
- CheckAutoCreateValuesL();
-
- iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard);
-
- iMountTimer = CPeriodic::NewL(CActive::EPriorityUserInput);
-
- SetForceRun( EFalse );
-
- iFormatObserver = CTMFormatObserver::NewL( *this );
-
- iFormatting = EFalse;
- iSessionDied = EFalse;
-
- iCollectionUtility = NULL;
-
- iActivityManager = CTMActivityManager::NewL( this, KBackgroundGenerationIdle);
-
- UpdatePSValues(ETrue, ETrue);
-
- RProperty::Define(KTAGDPSNotification, KMPXHarvesting, RProperty::EInt);
-
- //start foreground generation observer
- iForegroundGenerationObserver = CTMRPropertyObserver::NewL( *this, KTAGDPSNotification, KForceBackgroundGeneration, ETrue );
-
- TN_DEBUG1( "CThumbAGProcessor::ConstructL() - end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_CONSTRUCTL, "CThumbAGProcessor::ConstructL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::~CThumbAGProcessor()
-// ---------------------------------------------------------------------------
-//
-CThumbAGProcessor::~CThumbAGProcessor()
- {
- TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_CTHUMBAGPROCESSOR, "CThumbAGProcessor::~CThumbAGProcessor - begin" );
-
- Shutdown();
-
- Cancel();
-
- if (iTMSession)
- {
- iTMSession->RemoveRequestObserver();
- delete iTMSession;
- iTMSession = NULL;
- }
-
- if(iMountTimer)
- {
- iMountTimer->Cancel();
- delete iMountTimer;
- iMountTimer = NULL;
- }
-
- if(iPeriodicTimer)
- {
- iPeriodicTimer->Cancel();
- delete iPeriodicTimer;
- iPeriodicTimer = NULL;
- }
-
- if(iActivityManager)
- {
- delete iActivityManager;
- iActivityManager = NULL;
- }
-
- if (iQuery)
- {
- iQuery->Cancel();
- delete iQuery;
- iQuery = NULL;
- }
-
- if(iQueryPlaceholders)
- {
- iQueryPlaceholders->Cancel();
- delete iQueryPlaceholders;
- iQueryPlaceholders = NULL;
- }
-
- if (iQueryAllItems)
- {
- iQueryAllItems->Cancel();
- delete iQueryAllItems;
- iQueryAllItems = NULL;
- }
-
- if (!iInit)
- {
-#ifdef MDS_MODIFY_OBSERVER
- iHarvesterClient.RemoveHarvesterEventObserver(*this);
- iHarvesterClient.Close();
-#endif
- }
-
- if(iForegroundGenerationObserver)
- {
- delete iForegroundGenerationObserver;
- iForegroundGenerationObserver = NULL;
- }
-
- if(iFormatObserver)
- {
- delete iFormatObserver;
- iFormatObserver = NULL;
- }
-
- if ( iCollectionUtility )
- {
- iCollectionUtility->Close();
- iCollectionUtility = NULL;
- }
-
- for(TInt i=0;i<iGenerationQueue.Count();i++)
- {
- delete iGenerationQueue[i].iUri;
- iGenerationQueue[i].iUri = NULL;
- }
-
- iGenerationQueue.Reset();
- iGenerationQueue.Close();
-
- iQueryQueue.Close();
-
- TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - end" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_CTHUMBAGPROCESSOR, "CThumbAGProcessor::~CThumbAGProcessor - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::Shutdown()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::Shutdown()
- {
- TN_DEBUG1( "CThumbAGProcessor::Shutdown()" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_SHUTDOWN, "CThumbAGProcessor::Shutdown" );
- iShutdown = ETrue;
- UpdatePSValues(EFalse, EFalse);
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::HandleQueryNewResults()
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::HandleQueryNewResults( CMdEQuery& aQuery,
- const TInt aFirstNewItemIndex,
- const TInt aNewItemCount )
- {
- // PH & AllItems query results are handled here
-
- if(iShutdown)
- {
- return;
- }
-
- if (aNewItemCount > 0)
- {
- if(&aQuery == iQueryPlaceholders)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults - iQueryPlaceholders, %d new", aNewItemCount);
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_HANDLEQUERYNEWRESULTS, "CThumbAGProcessor::HandleQueryNewResults - iQueryPlaceholders;aNewItemCount=%d", aNewItemCount );
-
- for(TInt i = aFirstNewItemIndex; i < iQueryPlaceholders->Count(); i++)
- {
- const CMdEObject* object = &iQueryPlaceholders->Result(i);
-
- if(!object)
- {
- continue;
- }
-
- if(!object->Placeholder())
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults %d not placeholder", object->Id());
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_HANDLEQUERYNEWRESULTS, "CThumbAGProcessor::HandleQueryNewResults - not placeholder;object->Id()=%u", object->Id() );
- continue;
- }
-
- // ignore if fails
- TThumbnailGenerationItem item;
- item.iItemId = object->Id();
- item.iPlaceholder = ETrue;
-
- SetGenerationItemType( item, object->Def().Id());
-
- AppendProcessingQueue( item );
- }
- }
- else if(&aQuery == iQueryAllItems)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryNewResults - QueryAllItems, %d new", aNewItemCount);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_HANDLEQUERYNEWRESULTS, "CThumbAGProcessor::HandleQueryNewResults - QueryAllItems;aNewItemCount=%d", aNewItemCount );
-
- for(TInt i = aFirstNewItemIndex; i < iQueryAllItems->Count(); i++)
- {
- const CMdEObject* object = &iQueryAllItems->Result(i);
-
- if(!object)
- {
- continue;
- }
-
- TThumbnailGenerationItem item;
- item.iItemId = object->Id();
-
- SetGenerationItemType(item, object->Def().Id());
-
- TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- item.iPlaceholder = object->Placeholder();
-
- AppendProcessingQueue( item );
- }
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryNewResults - error, no new items");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_HANDLEQUERYNEWRESULTS, "CThumbAGProcessor::HandleQueryNewResults - error, no new items" );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::HandleQueryCompleted()
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::HandleQueryCompleted( CMdEQuery& aQuery, const TInt aError )
- {
- TN_DEBUG3( "CThumbAGProcessor::HandleQueryCompleted, aError == %d Count== %d", aError, aQuery.Count());
- OstTraceExt2( TRACE_NORMAL, CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted;aError=%d;aQuery.Count()=%d", aError, aQuery.Count() );
-
- if(iShutdown)
- {
- return;
- }
-
- if(&aQuery == iQueryPlaceholders)
- {
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - iQueryPlaceholders completed" );
-
- //free query
- delete iQueryPlaceholders;
- iQueryPlaceholders = NULL;
-
- if(iDoQueryAllItems)
- {
- iDoQueryAllItems = EFalse;
- TRAP_IGNORE(QueryAllItemsL());
- }
- }
- else if(&aQuery == iQueryAllItems)
- {
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - QueryAllItems completed");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - QueryAllItems completed" );
-
-#ifdef _DEBUG
-TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted IN-COUNTERS---------- Amount: %d, Add",iQueryAllItems->Count());
-OstTrace1( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted IN-COUNTERS---------- Amount;iQueryAllItems->Count()=%d", iQueryAllItems->Count() );
-#endif
-
- //free query
- delete iQueryAllItems;
- iQueryAllItems = NULL;
- }
- else if(&aQuery == iQuery )
- {
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted - Query completed");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - Query completed" );
-
- if(iQueryActive)
- {
- iQueryReady = ETrue;
- iQueryActive = EFalse;
- }
-
- // if no errors in query
- if (aError == KErrNone && iQuery)
- {
- iProcessingCount = iQuery->Count();
-
- if(iProcessingCount != iQueryQueue.Count() )
- {
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() some result items missing");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - some result items missing" );
-
- RArray<TItemId> queryQueueDelta;
-
- //search delta items which were queried, but not found
- for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
- {
- TBool found(EFalse);
- for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
- {
- const CMdEObject* object = &iQuery->Result(queryResult);
-
- if( iQueryQueue[queryItem] == object->Id())
- {
- found = ETrue;
- break;
- }
- }
-
- if(!found)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() %d missing from query results", iQueryQueue[queryItem] );
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted;iQueryQueue[queryItem]=%d", iQueryQueue[queryItem] );
-
- // ignore if fails
- queryQueueDelta.InsertInOrder(iQueryQueue[queryItem], CompareId);
- }
- }
-
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items found %d", queryQueueDelta.Count());
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - missing items found;queryQueueDelta.Count()=%d", queryQueueDelta.Count() );
- //cleanup from previous queue it item is not found from MDS
- while(queryQueueDelta.Count())
- {
- TThumbnailGenerationItem item;
- item.iItemId = queryQueueDelta[0];
- TInt itemIndex = iQueryQueue.FindInOrder(item.iItemId, CompareId);
-
- if(itemIndex >= 0)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove %d from iQueryQueue", queryQueueDelta[0]);
- OstTrace1( TRACE_NORMAL, DUP8_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - remove from iQueryQueue;queryQueueDelta[0]=%d", queryQueueDelta[0] );
- iQueryQueue.Remove( itemIndex );
-
- //remove from procesing queue
- itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- if(itemIndex >= 0)
- {
-
- if( iUnknown )
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() mark %d as EGenerationItemTypeNotFound in iGenerationQueue", queryQueueDelta[0]);
- OstTrace1( TRACE_NORMAL, DUP9_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - mark as EGenerationItemTypeNotFound in iGenerationQueue;queryQueueDelta[0]=%d", queryQueueDelta[0] );
- //mark to be removed, cleanup is done below
- iGenerationQueue[itemIndex].iItemType = EGenerationItemTypeNotFound;
- }
- else
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove %d from iGenerationQueue", queryQueueDelta[0]);
- OstTrace1( TRACE_NORMAL, DUP10_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - remove from iGenerationQueue;queryQueueDelta[0]=%d", queryQueueDelta[0] );
- iGenerationQueue.Remove( itemIndex );
- }
- }
- }
- queryQueueDelta.Remove(0);
- }
- queryQueueDelta.Close();
- }
-
- if(iUnknown)
- {
- for(TInt i = 0; i < iQuery->Count(); i++)
- {
- const CMdEObject* object = &iQuery->Result(i);
-
- if(!object)
- {
- continue;
- }
-
- TThumbnailGenerationItem tempItem;
- tempItem.iItemId = object->Id();
- TInt itemIndex = iGenerationQueue.FindInOrder(tempItem, Compare);
-
- if(itemIndex >= 0)
- {
- TThumbnailGenerationItem& item = iGenerationQueue[itemIndex];
-
- if(iGenerationQueue[itemIndex].iItemType == EGenerationItemTypeNotFound)
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove EGenerationItemTypeNotFound %d item from iGenerationQueue", item.iItemId);
- OstTrace1( TRACE_NORMAL, DUP11_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - remove EGenerationItemTypeNotFound item from iGenerationQueue;item.iItemId=%u", item.iItemId );
- iGenerationQueue.Remove(itemIndex);
- continue;
- }
-
- SetGenerationItemType(item, object->Def().Id());
-
- if(item.iItemType == EGenerationItemTypeUnknown )
- {
- TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove unknown item %d", item.iItemId);
- OstTrace1( TRACE_NORMAL, DUP12_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - remove unknown item;item.iItemId=%u", item.iItemId );
- iGenerationQueue.Remove(itemIndex);
- continue;
- }
-
- item.iPlaceholder = object->Placeholder();
-
- }
- }
-
- iQueryQueue.Reset();
- iProcessingCount = 0;
- iUnknown = EFalse;
- }
-
- // no results, reset query
- if( !iProcessingCount )
- {
- delete iQuery;
- iQuery = NULL;
- iModify = EFalse;
- }
- }
- else
- {
- //Delete and cancel query, do not return items back to original queue
- DeleteAndCancelQuery( EFalse );
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() Query FAILED!");
- OstTrace0( TRACE_NORMAL, DUP13_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - Query FAILED!" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() - NO QUERY ACTIVE");
- OstTrace0( TRACE_NORMAL, DUP14_CTHUMBAGPROCESSOR_HANDLEQUERYCOMPLETED, "CThumbAGProcessor::HandleQueryCompleted - NO QUERY ACTIVE" );
- __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::HandleQueryCompleted()"), -1));
- }
-
- ActivateAO();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::ThumbnailPreviewReady()
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/,
- TThumbnailRequestId /*aId*/)
- {
- TN_DEBUG1( "CThumbAGProcessor::ThumbnailPreviewReady()");
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_THUMBNAILPREVIEWREADY, "CThumbAGProcessor::ThumbnailPreviewReady" );
- // No implementation required
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::ThumbnailReady()d
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::ThumbnailReady( TInt aError, MThumbnailData& /*aThumbnail*/,
- TThumbnailRequestId /*aId*/ )
- {
- TN_DEBUG2( "CThumbAGProcessor::ThumbnailReady() aError == %d", aError );
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_THUMBNAILREADY, "CThumbAGProcessor::ThumbnailReady;aError=%d", aError );
-
- iActiveCount--;
-
- // TNM server died, delete session
- if( aError == KErrServerTerminated )
- {
- TN_DEBUG1( "CThumbAGProcessor::ThumbnailReady() - **** THUMBNAIL SERVER DIED ****" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_THUMBNAILREADY, "CThumbAGProcessor::ThumbnailReady - **** THUMBNAIL SERVER DIED ****" );
-
- iSessionDied = ETrue;
-
- if( !iPeriodicTimer->IsActive())
- {
- StartTimeout();
- }
-
- //reset PS idle so that RunL() can startup reopen TNM session and proceed
- TInt ret = RProperty::Set(KServerIdle, KIdle, ETrue);
- TN_DEBUG2( "CThumbAGProcessor::ThumbnailReady() set Idle ret = %d", ret );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_THUMBNAILREADY, "CThumbAGProcessor::ThumbnailReady - set Idle ret;ret=%d", ret );
- return;
- }
-
- ActivateAO();
-
- TN_DEBUG1( "CThumbAGProcessor::ThumbnailReady() - end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_THUMBNAILREADY, "CThumbAGProcessor::ThumbnailReady - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::ThumbnailRequestReady()
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::ThumbnailRequestReady( TInt /*aError*/, TThumbnailRequestType aRequestType,
- TThumbnailRequestId /*aId*/ )
- {
- if (aRequestType == ERequestDeleteThumbnails)
- {
- TN_DEBUG1( "CThumbAGProcessor::ThumbnailRequestReady() - delete" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_THUMBNAILREQUESTREADY, "CThumbAGProcessor::ThumbnailRequestReady - delete" );
-
- iActiveCount--;
-
- ActivateAO();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::SetMdESession()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::SetMdESessionL( CMdESession* aMdESession )
- {
- TN_DEBUG1( "CThumbAGProcessor::SetMdESession() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_SETMDESESSIONL, "CThumbAGProcessor::SetMdESessionL - begin" );
-
- iMdESession = aMdESession;
-
- __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iMdESession "), KErrBadHandle));
-
- TRAPD( err, iDefNamespace = &iMdESession->GetDefaultNamespaceDefL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbAGProcessor::SetMdESession() GetDefaultNamespaceDefL() err = %d", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_SETMDESESSIONL, "CThumbAGProcessor::SetMdESessionL;err=%d", err );
- __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
- }
- else
- {
- iImageObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
- __ASSERT_DEBUG((iImageObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iDefNamespace "), KErrBadHandle));
- iVideoObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
- __ASSERT_DEBUG((iVideoObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iVideoObjectDef "), KErrBadHandle));
- iAudioObjectDef = &iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
- __ASSERT_DEBUG((iAudioObjectDef), User::Panic(_L("CThumbAGProcessor::SetMdESession() !iAudioObjectDef "), KErrBadHandle));
-
- //do async init
- iInit = ETrue;
-
- ActivateAO();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::AddToQueue()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::AddToQueueL( TObserverNotificationType aType,
- TThumbnailGenerationItemType aItemType,
- const RArray<TItemId>& aIDArray,
- const RPointerArray<HBufC>& aObjectUriArray,
- TBool /*aPresent*/ )
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - begin" );
-
- // update queues
- if (aType == ENotifyAdd)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyAdd" );
-
- for (int i=0; i<aIDArray.Count(); i++)
- {
- TThumbnailGenerationItem item;
- item.iItemId = aIDArray[i];
- item.iItemType = aItemType;
-
- SetGenerationItemAction(item, aItemType);
-
- if(iPHHarvesting)
- {
- item.iPlaceholder = ETrue;
- }
-
- AppendProcessingQueue( item );
- }
- }
- else if (aType == ENotifyModify)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyModify" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - ENotifyModify" );
-
- if(iPHHarvesting)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting active, treat like add" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - PH harvesting active, treat like add" );
- for (int i=0; i<aIDArray.Count(); i++)
- {
- TThumbnailGenerationItem item;
- item.iItemId = aIDArray[i];
- item.iItemType = aItemType;
-
- TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- if (itemIndex >= 0)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - set as non-placeholder");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - set as non-placeholder" );
- iGenerationQueue[itemIndex].iPlaceholder = EFalse;
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - append" );
- item.iPlaceholder = EFalse;
- SetGenerationItemAction( item, aItemType );
- AppendProcessingQueue( item );
- }
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - PH harvesting finished, check is real modify!" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - PH harvesting finished, check is real modify!" );
-
- TInt itemIndex(KErrNotFound);
-
- for (int i=0; i<aIDArray.Count(); i++)
- {
- TThumbnailGenerationItem item;
- item.iItemId = aIDArray[i];
- item.iItemType = aItemType;
-
- itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- if (itemIndex >= 0)
- {
- if( iGenerationQueue[itemIndex].iPlaceholder )
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - placeholder modify");
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - placeholder modify" );
- iGenerationQueue[itemIndex].iPlaceholder = EFalse;
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - real modify");
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - real modify" );
- iGenerationQueue[itemIndex].iItemAction = EGenerationItemActionModify;
- SetForceRun( ETrue );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - append" );
- SetGenerationItemAction( item, aItemType);
- item.iPlaceholder = EFalse;
- AppendProcessingQueue( item );
- }
- }
- }
- }
- else if (aType == ENotifyRemove && aItemType == EGenerationItemTypeAny)
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - ENotifyRemove, remove IDs from all queues");
- OstTrace0( TRACE_NORMAL, DUP9_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - ENotifyRemove, remove IDs from all queues" );
-
- for (int i=0; i<aIDArray.Count(); i++)
- {
- TThumbnailGenerationItem item;
- item.iItemId = aIDArray[i];
- item.iItemType = aItemType;
-
- TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- if(itemIndex >= 0)
- {
- iGenerationQueue[itemIndex].iItemAction = EGenerationItemActionDelete;
- delete iGenerationQueue[itemIndex].iUri;
- iGenerationQueue[itemIndex].iUri = NULL;
-
- if( aObjectUriArray[i])
- {
- iGenerationQueue[itemIndex].iUri = aObjectUriArray[i]->AllocL();
- }
- else
- {
- //invalid URI remove from processing queue
- iGenerationQueue.Remove(itemIndex);
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - append");
- OstTrace0( TRACE_NORMAL, DUP10_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - append" );
- item.iItemAction = EGenerationItemActionDelete;
- delete item.iUri;
- item.iUri = NULL;
-
- if( aObjectUriArray[i])
- {
- item.iUri = aObjectUriArray[i]->AllocL();
- CleanupStack::PushL( item.iUri );
- User::LeaveIfError( iGenerationQueue.InsertInOrder(item, Compare) );
- CleanupStack::Pop();
- }
-
- //owned by item
- item.iUri = NULL;
- }
-
- TN_DEBUG2( "CThumbAGProcessor::AddToQueueL() - %S", aObjectUriArray[i]);
- OstTraceExt1( TRACE_NORMAL, DUP11_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL;aObjectUriArray[i]=%S", *aObjectUriArray[i] );
- }
- }
-#ifdef _DEBUG
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - should not come here" );
- OstTrace0( TRACE_NORMAL, DUP12_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - should not come here" );
- __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbAGProcessor::AddToQueueL()"), KErrArgument));
- User::Leave( KErrArgument );
- }
-#endif
-
- ActivateAO();
-
- TN_DEBUG1( "CThumbAGProcessor::AddToQueueL() - end" );
- OstTrace0( TRACE_NORMAL, DUP13_CTHUMBAGPROCESSOR_ADDTOQUEUEL, "CThumbAGProcessor::AddToQueueL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::CreateThumbnailsL()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::CreateThumbnailsL( const CMdEObject* aObject )
- {
- TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_CREATETHUMBNAILSL, "CThumbAGProcessor::CreateThumbnailsL - begin" );
-
- __ASSERT_DEBUG((iTMSession), User::Panic(_L("CThumbAGProcessor::CreateThumbnailsL() !iTMSession "), KErrBadHandle));
- __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::CreateThumbnailsL() !iDefNamespace "), KErrBadHandle));
-
- if(!iTMSession || !iDefNamespace)
- {
- return;
- }
-
- TInt orientationVal = 0;
- TInt64 modifiedVal = 0;
-
- CMdEProperty* orientation = NULL;
-
- TInt orientErr = aObject->Property( iImageObjectDef->GetPropertyDefL( MdeConstants::Image::KOrientationProperty ), orientation, 0 );
-
- if (orientErr == KErrNone)
- {
- orientationVal = orientation->Uint16ValueL();
- }
-
- CMdEProperty* modified = NULL;
- CMdEObjectDef& baseObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
- TInt modifyErr = aObject->Property( baseObjDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ), modified, 0 );
-
- if (modifyErr >= 0)
- {
- modifiedVal = modified->TimeValueL().Int64();
- }
-
- // update thumbs
- if (iTMSession)
- {
- // 2nd round and modify updates both sizes if needed
- if( i2ndRound )
- {
- //generate both if needed
- TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() EOptimizeForQuality ");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_CREATETHUMBNAILSL, "CThumbAGProcessor::CreateThumbnailsL - EOptimizeForQuality" );
- iTMSession->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality );
-
- TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 2nd round add remove from queue", aObject->Id() );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_CREATETHUMBNAILSL, "CThumbAGProcessor::CreateThumbnailsL - 2nd round add remove from queue;aObject->Id()=%u", aObject->Id() );
-
- TThumbnailGenerationItem item;
- item.iItemId = aObject->Id();
- TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- if(itemIndex >=0 )
- {
- if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemAction2ndAdd)
- {
- iGenerationQueue.Remove(itemIndex);
- }
- }
- }
- // 1st roung generation
- else
- {
- //1st round
- TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() EOptimizeForQualityWithPreview");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_CREATETHUMBNAILSL, "CThumbAGProcessor::CreateThumbnailsL - EOptimizeForQualityWithPreview" );
- iTMSession->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQualityWithPreview );
-
- // add item to 2nd round queue
- TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL() - 1st round add/modify, append to 2nd round queue", aObject->Id() );
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_CREATETHUMBNAILSL, "CThumbAGProcessor::CreateThumbnailsL - 1st round add/modify, append to 2nd round queue;aObject->Id()=%u", aObject->Id() );
-
- TThumbnailGenerationItem item;
- item.iItemId = aObject->Id();
- TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- if(itemIndex >=0 )
- {
- if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemActionModify)
- {
- iGenerationQueue.Remove(itemIndex);
- }
- //change 1st round item for 2nd round processing
- //2nd round item can be deleted
- else if(iGenerationQueue[itemIndex].iItemAction == EGenerationItemActionAdd)
- {
- iGenerationQueue[itemIndex].iItemAction = EGenerationItemAction2ndAdd;
- }
- else
- {
- iGenerationQueue.Remove(itemIndex);
- }
- }
- }
-
- // run as lower priority than getting but higher that creating thumbnails
- TRAPD(err, iTMSession->UpdateThumbnailsL(KNoId, aObject->Uri(), orientationVal, modifiedVal, CActive::EPriorityIdle ));
-
- if ( err != KErrNone )
- {
- TN_DEBUG2( "CThumbAGProcessor::CreateThumbnailsL, iTMSession error == %d", err );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_CREATETHUMBNAILSL, "CThumbAGProcessor::CreateThumbnailsL" );
-
- iSessionDied = ETrue;
- ActivateAO();
- }
- else
- {
- iActiveCount++;
- }
- }
- else
- {
- ActivateAO();
- }
-
- TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() - end" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_CREATETHUMBNAILSL, "CThumbAGProcessor::CreateThumbnailsL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::QueryL()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::QueryL(/*RArray<TItemId>& aIDArray*/TThumbnailGenerationItemAction aAction )
- {
- TN_DEBUG1( "CThumbAGProcessor::QueryL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_QUERYL, "CThumbAGProcessor::QueryL - begin" );
-
- __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryL() !iMdeSession "), KErrBadHandle));
- __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::QueryL() !iDefNamespace "), KErrBadHandle));
-
- if(!iMdESession || !iDefNamespace || iShutdown)
- {
- return;
- }
-
- //reset query queue
- iQueryQueue.Reset();
- //set reference to current pprocessing queue
-
- iQueryReady = EFalse;
-
- // delete old query
- if (iQuery)
- {
- delete iQuery;
- iQuery = NULL;
- }
-
- //move ID from source queue to Query queue
- TInt maxCount = iGenerationQueue.Count();
-
- TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill begin iGenerationQueue == %d, iQueryQueue == %d", iGenerationQueue.Count(), iQueryQueue.Count() );
- OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_QUERYL, "CThumbAGProcessor::QueryL - - fill begin iGenerationQueue, iQueryQueue;iGenerationQueue.Count()=%d;iQueryQueue.Count()=%d", iGenerationQueue.Count(), iQueryQueue.Count() );
-
- TInt itemCount(0);
- for(TInt i=0; itemCount < KMaxQueryItems && i < maxCount; i++)
- {
- TInt itemIndex(KErrNotFound);
- switch(aAction)
- {
- //1st round items
- case EGenerationItemActionAdd:
- if(iGenerationQueue[i].iItemAction == aAction )
- {
- itemIndex = i;
- }
- break;
- case EGenerationItemActionModify:
- if( iGenerationQueue[i].iItemAction == aAction )
- {
- itemIndex = i;
- }
- break;
- case EGenerationItemAction2ndAdd:
- if( iGenerationQueue[i].iItemAction == aAction )
- {
- itemIndex = i;
- }
- break;
- //unknown stuff
- case EGenerationItemActionResolveType:
- if( iGenerationQueue[i].iItemType == EGenerationItemTypeUnknown )
- {
- itemIndex = i;
- }
- break;
- default:
- break;
- };
-
- if( itemIndex >= 0 )
- {
- TN_DEBUG2( "CThumbAGProcessor::QueryL() - fill %d", iGenerationQueue[itemIndex].iItemId );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_QUERYL, "CThumbAGProcessor::QueryL - fill;iGenerationQueue[itemIndex].iItemId=%u", iGenerationQueue[itemIndex].iItemId );
- iQueryQueue.InsertInOrder(iGenerationQueue[itemIndex].iItemId, CompareId);
- itemCount++;
- }
- }
-
- if(!itemCount)
- {
- TN_DEBUG1( "CThumbAGProcessor::QueryL() - empty query, cancel?!");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_QUERYL, "CThumbAGProcessor::QueryL - empty query, cancel?!" );
- iQueryActive = EFalse;
- __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryL() empty! "), KErrNotFound));
- return;
- }
-
- TN_DEBUG3( "CThumbAGProcessor::QueryL() - fill end iGenerationQueue == %d, iQueryQueue == %d", iGenerationQueue.Count(), iQueryQueue.Count() );
- OstTraceExt2( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_QUERYL, "CThumbAGProcessor::QueryL;iGenerationQueue.Count()=%d;iQueryQueue.Count()=%d", iGenerationQueue.Count(), iQueryQueue.Count() );
-
- CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
- iQuery = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
-
- if(iQuery)
- {
- iQuery->SetResultMode( EQueryResultModeItem );
-
- CMdELogicCondition& rootCondition = iQuery->Conditions();
- rootCondition.SetOperator( ELogicConditionOperatorAnd );
-
- // add IDs
- CleanupClosePushL( iQueryQueue );
- rootCondition.AddObjectConditionL( iQueryQueue );
- CleanupStack::Pop( &iQueryQueue );
-
- // add object type conditions
- if (!(iModify || iUnknown))
- {
- CMdELogicCondition& objDefCondition = rootCondition.AddLogicConditionL( ELogicConditionOperatorOr );
-
- if (iAutoImage)
- {
- CMdEObjectDef& imageDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
- objDefCondition.AddObjectConditionL( imageDef );
- }
- if (iAutoVideo)
- {
- CMdEObjectDef& videoDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
- objDefCondition.AddObjectConditionL( videoDef );
- }
- if (iAutoAudio)
- {
- CMdEObjectDef& audioDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
- objDefCondition.AddObjectConditionL( audioDef );
- }
- }
-
- iQuery->FindL();
- }
- else
- {
- iQueryActive = EFalse;
- }
-
- TN_DEBUG1( "CThumbAGProcessor::QueryL() - end" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_QUERYL, "CThumbAGProcessor::QueryL - end" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::QueryForPlaceholders()
-// ---------------------------------------------------------------------------
-//
-
-void CThumbAGProcessor::QueryPlaceholdersL(TBool aPresent)
- {
- TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_QUERYPLACEHOLDERSL, "CThumbAGProcessor::QueryPlaceholdersL" );
-
- __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryPlaceholdersL() !iMdeSession "), KErrBadHandle));
- __ASSERT_DEBUG((iDefNamespace), User::Panic(_L("CThumbAGProcessor::QueryPlaceholdersL() !iDefNamespace "), KErrBadHandle));
-
- if(!iMdESession || !iDefNamespace || iShutdown)
- {
- return;
- }
-
- if( iQueryPlaceholders )
- {
- if( !iQueryPlaceholders->IsComplete() )
- {
- TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL active- skip" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_QUERYPLACEHOLDERSL, "CThumbAGProcessor::QueryPlaceholdersL - skip" );
- return;
- }
-
- // delete old query
- iQueryPlaceholders->Cancel();
- delete iQueryPlaceholders;
- iQueryPlaceholders = NULL;
- }
-
- TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - start" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_QUERYPLACEHOLDERSL, "CThumbAGProcessor::QueryPlaceholdersL - start" );
-
- CMdEObjectDef& imageObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
- CMdEObjectDef& videoObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
- CMdEObjectDef& audioObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
-
- CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject);
- iQueryPlaceholders = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
-
- if(iQueryPlaceholders)
- {
- iQueryPlaceholders->SetResultMode( EQueryResultModeItem );
-
- CMdELogicCondition& rootCondition = iQueryPlaceholders->Conditions();
- rootCondition.SetOperator( ELogicConditionOperatorOr );
-
- CMdEObjectCondition& imagePHObjectCondition = rootCondition.AddObjectConditionL(imageObjDef);
- CleanupStack::PushL( &imagePHObjectCondition );
- imagePHObjectCondition.SetPlaceholderOnly( ETrue );
- imagePHObjectCondition.SetNotPresent( aPresent );
-
- CMdEObjectCondition& videoPHObjectCondition = rootCondition.AddObjectConditionL(videoObjDef);
- CleanupStack::PushL( &videoPHObjectCondition );
- videoPHObjectCondition.SetPlaceholderOnly( ETrue );
- videoPHObjectCondition.SetNotPresent( aPresent );
-
- CMdEObjectCondition& audioPHObjectCondition = rootCondition.AddObjectConditionL(audioObjDef);
- CleanupStack::PushL( &audioPHObjectCondition );
- audioPHObjectCondition.SetPlaceholderOnly( ETrue );
- audioPHObjectCondition.SetNotPresent( aPresent );
-
- iQueryPlaceholders->FindL(KMdEQueryDefaultMaxCount, KMaxQueryBatchSize);
-
- CleanupStack::Pop(3, &imagePHObjectCondition );
- }
-
- TN_DEBUG1( "CThumbAGProcessor::QueryPlaceholdersL - end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_QUERYPLACEHOLDERSL, "CThumbAGProcessor::QueryPlaceholdersL - end" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::RunL()
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - begin" );
-
- if(iShutdown)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - shutdown" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - shutdown" );
- return;
- }
-
- if (iSessionDied)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - iSessionDied" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - iSessionDied" );
- delete iTMSession;
- iTMSession = NULL;
- }
-
- if (iInit)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - Do Initialisation 1" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - Do Initialisation 1" );
-
- iInit = EFalse;
- iInit2 = ETrue;
-
- iGenerationQueue.Reset();
- iQueryQueue.Reset();
-
- //query all not present placeholders
- TRAP_IGNORE(QueryPlaceholdersL( ETrue ));
- //query all items after PH query
- iDoQueryAllItems = ETrue;
- TN_DEBUG1( "CThumbAGProcessor::RunL() - Initialisation 1 done" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - Initialisation 1 done" );
- ActivateAO();
- return;
- }
-
- if(iInit2)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - Do Initialisation 2" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - Do Initialisation 2" );
-
- iInit2 = EFalse;
- TInt err(KErrNone);
-
-#ifdef MDS_MODIFY_OBSERVER
- TN_DEBUG1( "CThumbAGProcessor::RunL() do iHarvesterClient connect");
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - do iHarvesterClient connect" );
- err = iHarvesterClient.Connect();
- TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient connect err = %d", err);
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - iHarvesterClient connect;err=%d", err );
-
- __ASSERT_DEBUG((err == KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
-
- if( err == KErrNone )
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer");
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - add iHarvesterClient observer" );
- err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypeMMC | EHEObserverTypePlaceholder, 20 );
- TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient observer err = %d", err);
- OstTrace1( TRACE_NORMAL, DUP9_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - iHarvesterClient observer;err=%d", err );
-
- if( err != KErrNone )
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() add iHarvesterClient observer failed");
- OstTrace0( TRACE_NORMAL, DUP10_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - add iHarvesterClient observer failed" );
- // if we fail observer harvester, fake it
- iHarvesterActivated = ETrue;
- }
- __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
- }
-#endif
-
- TN_DEBUG1( "CThumbAGProcessor::RunL() MMPXCollectionUtility");
- OstTrace0( TRACE_NORMAL, DUP11_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - MMPXCollectionUtility");
- TRAP( err, iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeIsolated ));
- TN_DEBUG2( "CThumbAGProcessor::RunL() create MMPXCollectionUtility err = %d", err);
- OstTrace1( TRACE_NORMAL, DUP12_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - create MMPXCollectionUtility err;err=%d", err );
- __ASSERT_DEBUG((iCollectionUtility), User::Panic(_L("CThumbAGProcessor::RunL(), !iCollectionUtility "), err));
-
- __ASSERT_DEBUG((iActivityManager), User::Panic(_L("CThumbAGProcessor::RunL(), !iActivityManager "), KErrBadHandle));
- if(iActivityManager)
- {
- iActivityManager->Start();
- }
-
- TN_DEBUG1( "CThumbAGProcessor::RunL() - Initialisation 2 done" );
- OstTrace0( TRACE_NORMAL, DUP13_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - Initialisation 2 done" );
- return;
- }
-
- // restart session if died
- if (!iTMSession)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - open TNM session");
- OstTrace0( TRACE_NORMAL, DUP14_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL" );
- TRAPD( err, iTMSession = CThumbnailManager::NewL( *this ) );
-
- if (err != KErrNone)
- {
- iTMSession = NULL;
- ActivateAO();
- TN_DEBUG2( "CThumbAGProcessor::RunL() - Session restart failed, error == %d", err );
- OstTrace1( TRACE_NORMAL, DUP15_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - Session restart failed, error;err=%d", err );
- }
- else
- {
- iTMSession->SetRequestObserver(*this);
- iSessionDied = EFalse;
- }
- }
-
- // do not run if request is already issued to TNM server even if forced
- if(iActiveCount >= KMaxDaemonRequests)
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for previous to complete, abort..." );
- OstTrace0( TRACE_NORMAL, DUP16_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - waiting for previous to complete, abort..." );
- return;
- }
-
- //force run can proceed from this point
-#ifdef _DEBUG
- if( iForegroundRun )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() KForceBackgroundGeneration enabled");
- OstTrace0( TRACE_NORMAL, DUP17_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - KForceBackgroundGeneration enabled" );
- }
-
- if( iForceRun )
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - *** FORCED RUN ***");
- OstTrace0( TRACE_NORMAL, DUP18_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - *** FORCED RUN ***" );
- }
-#endif
-
- if( (iForceRun || iForegroundRun ) && !iMountTimer->IsActive() )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() skip idle detection!");
- OstTrace0( TRACE_NORMAL, DUP19_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - skip idle detection!" );
- CancelTimeout();
- }
- else
- {
- if( !iIdle || iHarvesting || iMPXHarvesting || iPeriodicTimer->IsActive() )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() device not idle");
- OstTrace0( TRACE_NORMAL, DUP20_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - device not idle" );
- return;
- }
- else
- {
- //check is server idle
- TInt serveIdle(KErrNotFound);
- TInt ret = RProperty::Get(KServerIdle, KIdle, serveIdle);
-
- if(ret != KErrNone || !serveIdle )
- {
- //start inactivity timer and retry on after callback
- TN_DEBUG1( "void CThumbAGProcessor::RunL() server not idle");
- OstTrace0( TRACE_NORMAL, DUP21_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - server not idle" );
- StartTimeout();
- return;
- }
- TN_DEBUG1( "void CThumbAGProcessor::RunL() device and server idle, process");
- OstTrace0( TRACE_NORMAL, DUP22_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - device and server idle, process" );
- }
- }
-
- //Handle completed MDS Query
- if( iQueryReady && iProcessingCount)
- {
- TInt err(KErrNone);
- //if force or non forced
- //if unknown items or mount timer is active, abort processing
-
- if(((iForceRun && iModify ) || (!iForceRun && !iModify )) && !iUnknownItemCount && !iMountTimer->IsActive())
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady START" );
- OstTrace0( TRACE_NORMAL, DUP23_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - iQueryReady START" );
-
- const CMdEObject* object = &iQuery->Result( iProcessingCount-1 );
- iProcessingCount--;
-
- if ( object )
- {
- //process one item at once
- //remove item from queryQueue when request is issued
-
- TInt itemIndex = iQueryQueue.FindInOrder(object->Id(), CompareId);
- if(itemIndex >= 0)
- {
- iQueryQueue.Remove(itemIndex);
- }
-
- TRAP( err, CreateThumbnailsL( object ) );
- TN_DEBUG2( "CThumbAGProcessor::RunL(), CreateThumbnailsL error == %d", err );
- OstTrace1( TRACE_NORMAL, DUP24_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - CreateThumbnailsL error;err=%d", err );
- __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), CreateThumbnailsL() "), err));
- }
- }
- //force is coming, but executing non-forced query complete-> cancel old
- else
- {
- //cancel query
- TN_DEBUG1( "CThumbAGProcessor::RunL() - cancel processing query" );
- OstTrace0( TRACE_NORMAL, DUP25_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - cancel processing query" );
- DeleteAndCancelQuery( ETrue );
- ActivateAO();
- return;
- }
-
- //is last query item
- if( iProcessingCount <= 0 )
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady FINISH" );
- OstTrace0( TRACE_NORMAL, DUP26_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - iQueryReady FINISH" );
- iQueryReady = EFalse;
- iQueryActive = EFalse;
- }
-
- ActivateAO();
- }
- //waiting for MDS query to complete
- else if( iQueryActive )
- {
- //state mismatch
- if(iForceRun && !(iModify || iUnknown))
- {
- //cancel query and move items back to original processing queue
- DeleteAndCancelQuery(ETrue);
- ActivateAO();
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::RunL() - waiting for query to complete, abort..." );
- OstTrace0( TRACE_NORMAL, DUP27_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - waiting for query to complete, abort..." );
- }
- }
- else if ( iUnknownItemCount > 0 )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() unknown items in queue");
- OstTrace0( TRACE_NORMAL, DUP28_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - unknown items in queue" );
-
- i2ndRound = EFalse;
- iModify = EFalse;
- iUnknown = ETrue;
- iQueryActive = ETrue;
-
- QueryL( EGenerationItemActionResolveType );
- }
- else if ( iDeleteItemCount > 0 )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() delete thumbnails");
- OstTrace0( TRACE_NORMAL, DUP29_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - delete thumbnails" );
- // delete thumbs by URI
- __ASSERT_DEBUG((iTMSession), User::Panic(_L("CThumbAGProcessor::RunL() !iTMSession "), KErrBadHandle));
- if(iTMSession)
- {
- TInt itemIndex(KErrNotFound);
-
- for(TInt i=0;i<iGenerationQueue.Count() || itemIndex == KErrNotFound;i++)
- {
- if(iGenerationQueue[i].iItemAction == EGenerationItemActionDelete)
- {
- itemIndex = i;
- }
- }
-
- if(itemIndex >= 0)
- {
- if(!iGenerationQueue[itemIndex].iUri)
- {
- //URI is invalid
- TN_DEBUG1( "void CThumbAGProcessor::RunL() unable to delete URI inbalid");
- OstTrace0( TRACE_NORMAL, DUP30_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - unable to delete URI inbalid" );
- iGenerationQueue.Remove( itemIndex );
- ActivateAO();
- return;
- }
-
- TN_DEBUG2( "void CThumbAGProcessor::RunL() delete %S", iGenerationQueue[itemIndex].iUri);
- OstTraceExt1( TRACE_NORMAL, DUP31_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL;iGenerationQueue[itemIndex].iUri=%S", *iGenerationQueue[itemIndex].iUri );
- CThumbnailObjectSource* source = NULL;
- TRAPD(err, source = CThumbnailObjectSource::NewL( *iGenerationQueue[itemIndex].iUri, KNullDesC));
-
- if(err == KErrNone)
- {
- iTMSession->DeleteThumbnails( *source );
- }
- delete source;
-
- delete iGenerationQueue[itemIndex].iUri;
- iGenerationQueue[itemIndex].iUri = NULL;
- iGenerationQueue.Remove( itemIndex );
-
- iActiveCount++;
- }
- }
- }
- // no items in query queue, start new
- // select queue to process, priority by type
- else if ( iModifyItemCount > 0 )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() update thumbnails");
- OstTrace0( TRACE_NORMAL, DUP32_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - update thumbnails" );
-
- i2ndRound = EFalse;
-
- // query for object info
- iQueryActive = ETrue;
- iModify = ETrue;
- iUnknown = EFalse;
- QueryL( EGenerationItemActionModify );
- }
- else if ( iAddItemCount > 0 )
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() update 1st round thumbnails");
- OstTrace0( TRACE_NORMAL, DUP33_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - update 1st round thumbnails" );
-
- i2ndRound = EFalse;
- iUnknown = EFalse;
- // query for object info
- iQueryActive = ETrue;
-
- QueryL( EGenerationItemActionAdd );
- }
- else if( i2ndAddItemCount > 0)
- {
- TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
- OstTrace0( TRACE_NORMAL, DUP34_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - update 2nd round thumbnails" );
-
- // query for object info
- iQueryActive = ETrue;
- i2ndRound = ETrue;
- iUnknown = EFalse;
- QueryL( EGenerationItemAction2ndAdd );
- }
-
- TN_DEBUG1( "CThumbAGProcessor::RunL() - end" );
- OstTrace0( TRACE_NORMAL, DUP35_CTHUMBAGPROCESSOR_RUNL, "CThumbAGProcessor::RunL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::DeleteAndCancelQuery()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
- {
- TN_DEBUG2( "CThumbAGProcessor::DeleteAndCancelQuery(aRestoreItems = %d) in", aRestoreItems );
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_DELETEANDCANCELQUERY, "CThumbAGProcessor::DeleteAndCancelQuery;aRestoreItems=%d", aRestoreItems );
-
- if(iQuery)
- {
- TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() - deleting query" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_DELETEANDCANCELQUERY, "CThumbAGProcessor::DeleteAndCancelQuery - deleting query" );
- iQuery->Cancel();
- delete iQuery;
- iQuery = NULL;
- }
-
- iQueryReady = EFalse;
- iQueryActive = EFalse;
- iProcessingCount = 0;
-
- //move remainig IDs in query queue back to original queue
- while(iQueryQueue.Count())
- {
- if(!aRestoreItems )
- {
- TThumbnailGenerationItem item;
- item.iItemId = iQueryQueue[0];
- TInt itemIndex = iGenerationQueue.FindInOrder(item, Compare);
-
- if(itemIndex >= 0)
- {
- delete iGenerationQueue[itemIndex].iUri;
- iGenerationQueue[itemIndex].iUri = NULL;
- iGenerationQueue.Remove(itemIndex);
- }
- }
- iQueryQueue.Remove(0);
- }
-
- TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() out" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_DELETEANDCANCELQUERY, "CThumbAGProcessor::DeleteAndCancelQuery - out" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::DoCancel()
- {
- // No implementation required
- }
-
-void CThumbAGProcessor::HarvestingUpdated(
- HarvesterEventObserverType aHEObserverType,
- HarvesterEventState aHarvesterEventState,
- TInt aItemsLeft )
- {
- TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- start() aHEObserverType = %d, aHarvesterEventState = %d, aItemsLeft = %d", aHEObserverType, aHarvesterEventState, aItemsLeft );
- OstTraceExt3( TRACE_NORMAL, CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated;aHEObserverType=%u;aHarvesterEventState=%u;aItemsLeft=%d", aHEObserverType, aHarvesterEventState, aItemsLeft );
-
- if(iShutdown)
- {
- return;
- }
-
- if(!iHarvesterActivated)
- {
- iHarvesterActivated = ETrue;
- }
-
- #ifdef _DEBUG
- if( aHEObserverType == EHEObserverTypePlaceholder)
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypePlaceholder");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypePlaceholder" );
- }
- else if( aHEObserverType == EHEObserverTypeOverall)
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeOverall");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeOverall" );
- }
- else if( aHEObserverType == EHEObserverTypeMMC)
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeMMC");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- type EHEObserverTypeMMC" );
- }
- #endif
-
- //placeholder harvesting
- if( aHEObserverType == EHEObserverTypePlaceholder)
- {
- switch(aHarvesterEventState)
- {
- case EHEStateStarted:
- case EHEStateHarvesting:
- case EHEStateResumed:
- {
- iPHHarvestingTemp = ETrue;
- break;
- }
- case EHEStatePaused:
- case EHEStateFinished:
- case EHEStateUninitialized:
- {
- iPHHarvestingTemp = EFalse;
- break;
- }
- };
-
- if(iPHHarvestingTemp != iPHHarvesting)
- {
- iPHHarvesting = iPHHarvestingTemp;
-
- if( iPHHarvesting )
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesterin started");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesterin starteds" );
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesting finished");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- MDS placeholder harvesting finished" );
- //query present placeholders
- TRAP_IGNORE(QueryPlaceholdersL( EFalse ));
- iDoQueryAllItems = EFalse;
- iPHHarvestingItemsLeftTemp = 0;
- }
- }
-
- //restart mount timout if PH item count is increasing durin MMC harvesting
- if(iMMCHarvesting && iPHHarvesting && aItemsLeft > iPHHarvestingItemsLeftTemp)
- {
- //if items count increasing, restart mount timeout
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- PH count increasing, restart mount timeout");
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- PH count increasing, restart mount timeout" );
-
- if(iMountTimer->IsActive())
- {
- iMountTimer->Cancel();
- }
-
- iMountTimer->Start( KMountTimeout, KMountTimeout, TCallBack(MountTimerCallBack, this));
- }
-
- //we are interestead of only PHs during MMC harvesting
- if( iMMCHarvesting )
- {
- iPHHarvestingItemsLeftTemp = aItemsLeft;
- }
- }
- //overall harvesting
- else if ( aHEObserverType == EHEObserverTypeOverall)
- {
- switch(aHarvesterEventState)
- {
- case EHEStateStarted:
- case EHEStateHarvesting:
- case EHEStatePaused:
- case EHEStateResumed:
- {
- iHarvestingTemp = ETrue;
- break;
- }
- case EHEStateFinished:
- case EHEStateUninitialized:
- {
- iHarvestingTemp = EFalse;
- break;
- }
- };
-
- if(iHarvestingTemp != iHarvesting)
- {
- iHarvesting = iHarvestingTemp;
-
- if( iHarvesting )
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting started");
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting started" );
- CancelTimeout();
- }
- else
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished ");
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- MDS harvesting finished" );
- // continue processing if needed
- StartTimeout();
-
- if(iMountTimer->IsActive())
- {
- iMountTimer->Cancel();
- }
- }
- }
- }
- //MMC harvesting
- else if( aHEObserverType == EHEObserverTypeMMC)
- {
- switch(aHarvesterEventState)
- {
- case EHEStateStarted:
- case EHEStateHarvesting:
- case EHEStatePaused:
- case EHEStateResumed:
- {
- iMMCHarvestingTemp = ETrue;
- break;
- }
- case EHEStateFinished:
- case EHEStateUninitialized:
- {
- iMMCHarvestingTemp = EFalse;
- break;
- }
- };
-
- if(iMMCHarvestingTemp != iMMCHarvesting)
- {
- iMMCHarvesting = iMMCHarvestingTemp;
-
- if( iMMCHarvesting )
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesterin started");
- OstTrace0( TRACE_NORMAL, DUP9_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesterin started" );
- UpdatePSValues(EFalse, ETrue);
- iMMCHarvestingItemsLeftTemp = 0;
- }
- else
- {
- //activate timeout if overall harvesting is not active
- if(!iHarvesting)
- {
- StartTimeout();
- }
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesting finished ");
- OstTrace0( TRACE_NORMAL, DUP10_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- MDS MMC harvesting finished" );
- }
- }
-
- //restart mount timout if MMC item count is still increasing
- if(iMMCHarvesting && aItemsLeft > iMMCHarvestingItemsLeftTemp)
- {
- TN_DEBUG1( "CThumbAGProcessor::HarvestingUpdated -- MMC count increasing, restart mount timeout");
- OstTrace0( TRACE_NORMAL, DUP11_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated -- MMC count increasing, restart mount timeout" );
-
- if(iMountTimer->IsActive())
- {
- iMountTimer->Cancel();
- }
-
- iMountTimer->Start( KMountTimeout, KMountTimeout, TCallBack(MountTimerCallBack, this));
- }
-
- iMMCHarvestingItemsLeftTemp = aItemsLeft;
- }
-
- TN_DEBUG4( "CThumbAGProcessor::HarvestingUpdated -- end() iHarvesting == %d, iPHHarvesting == %d iMMCHarvesting == %d ", iHarvesting, iPHHarvesting, iMMCHarvesting);
- OstTraceExt3( TRACE_NORMAL, DUP12_CTHUMBAGPROCESSOR_HARVESTINGUPDATED, "CThumbAGProcessor::HarvestingUpdated;iHarvesting=%u;iPHHarvesting=%u;iMMCHarvesting=%u", iHarvesting, iPHHarvesting, iMMCHarvesting );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::StartTimeout()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::StartTimeout()
- {
- TN_DEBUG1( "CThumbAGProcessor::StartTimeout()");
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_STARTTIMEOUT, "CThumbAGProcessor::StartTimeout" );
- CancelTimeout();
-
- if(!iHarvesting && !iMPXHarvesting && !iPeriodicTimer->IsActive() && !iShutdown)
- {
- iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout,
- TCallBack(PeriodicTimerCallBack, this));
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::StopTimeout()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::CancelTimeout()
- {
- TN_DEBUG1( "CThumbAGProcessor::CancelTimeout()");
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_CANCELTIMEOUT, "CThumbAGProcessor::CancelTimeout" );
- if(iPeriodicTimer->IsActive())
- {
- iPeriodicTimer->Cancel();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::RunError()
-// ---------------------------------------------------------------------------
-//
-#ifdef _DEBUG
-TInt CThumbAGProcessor::RunError(TInt aError)
-#else
-TInt CThumbAGProcessor::RunError(TInt /*aError*/)
-#endif
- {
- TN_DEBUG2( "CThumbAGrocessor::RunError() %d", aError);
-#ifdef _DEBUG
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_RUNERROR, "CThumbAGProcessor::RunError;aError=%d", aError );
-#else
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_RUNERROR, "CThumbAGProcessor::RunError");
-#endif
- UpdatePSValues(EFalse, EFalse);
-
- iActiveCount--;
-
- ActivateAO();
-
- // nothing to do
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::ActivateAO()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::ActivateAO()
- {
- UpdateItemCounts();
-
- if(iFormatting)
- {
- TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - FORMATTING - DAEMON ON PAUSE");
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_ACTIVATEAO, "CThumbAGProcessor::ActivateAO - FORMATTING - DAEMON ON PAUSE" );
- return;
- }
-
- //check if forced run needs to continue
- if ( (iModifyItemCount > 0 || iDeleteItemCount > 0 || iUnknownItemCount > 0) && !iMountTimer->IsActive())
- {
- TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - forced run");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_ACTIVATEAO, "CThumbAGProcessor::ActivateAO - iModifyItemCount > 0 || iUnknownItemCount > 0 || iDeleteItemCount > 0" );
- SetForceRun( ETrue );
- }
- else
- {
- iModify = EFalse;
- SetForceRun( EFalse );
- }
-
- if( !IsActive() && !iShutdown && ((iActiveCount < KMaxDaemonRequests && !iQueryActive) || iForceRun ))
- {
- TN_DEBUG1( "CThumbAGProcessor::ActivateAO() - Activated");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_ACTIVATEAO, "CThumbAGProcessor::ActivateAO - Activated" );
- SetActive();
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete( statusPtr, KErrNone );
- }
-
- UpdatePSValues(EFalse, EFalse);
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::PeriodicTimerCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbAGProcessor::PeriodicTimerCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbAGProcessor::PeriodicTimerCallBack()");
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_PERIODICTIMERCALLBACK, "CThumbAGProcessor::PeriodicTimerCallBack" );
- CThumbAGProcessor* self = static_cast<CThumbAGProcessor*>( aAny );
-
- self->CancelTimeout();
- self->ActivateAO();
-
- return KErrNone; // Return value ignored by CPeriodic
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::CheckAutoCreateValuesL()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::CheckAutoCreateValuesL()
- {
- CRepository* rep = CRepository::NewL( TUid::Uid( THUMBNAIL_CENREP_UID ));
-
- TBool imageGrid( EFalse );
- TBool imageList( EFalse );
- TBool imageFull( EFalse );
- TBool videoGrid( EFalse );
- TBool videoList( EFalse );
- TBool videoFull( EFalse );
- TBool audioGrid( EFalse );
- TBool audioList( EFalse );
- TBool audioFull( EFalse );
-
- // get cenrep values
- TInt ret = rep->Get( KAutoCreateImageGrid, imageGrid );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageGrid %d", ret);
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateImageGrid;ret=%d", ret );
- ret = rep->Get( KAutoCreateImageList, imageList );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageList %d", ret);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateImageList;ret=%d", ret );
- ret = rep->Get( KAutoCreateImageFullscreen, imageFull );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateImageFullscreen %d", ret);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL;ret=%d", ret );
- ret = rep->Get( KAutoCreateVideoGrid, videoGrid );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoGrid %d", ret);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateVideoGrid;ret=%d", ret );
- ret = rep->Get( KAutoCreateVideoList, videoList );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoList %d", ret);
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateVideoList;ret=%d", ret );
- ret = rep->Get( KAutoCreateVideoFullscreen, videoFull );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateVideoFullscreen %d", ret);
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateVideoFullscreen;ret=%d", ret );
- ret = rep->Get( KAutoCreateAudioGrid, audioGrid );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioGrid %d", ret);
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateAudioGrid;ret=%d", ret );
- ret = rep->Get( KAutoCreateAudioList, audioList );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioList %d", ret);
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateAudioList;ret=%d", ret );
- ret = rep->Get( KAutoCreateAudioFullscreen, audioFull );
- TN_DEBUG2( "CThumbAGProcessor::CheckAutoCreateValuesL() KAutoCreateAudioFullscreen %d", ret);
- OstTrace1( TRACE_NORMAL, DUP8_CTHUMBAGPROCESSOR_CHECKAUTOCREATEVALUESL, "CThumbAGProcessor::CheckAutoCreateValuesL - KAutoCreateAudioFullscreen;ret=%d", ret );
-
- iAutoImage = EFalse;
- iAutoVideo = EFalse;
- iAutoAudio = EFalse;
-
- // set processing values
- if (imageGrid || imageList || imageFull)
- {
- iAutoImage = ETrue;
- }
- if (videoGrid || videoList || videoFull)
- {
- iAutoVideo = ETrue;
- }
- if (audioGrid || audioList || audioFull)
- {
- iAutoAudio = ETrue;
- }
-
- delete rep;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::RemoveFromQueues()
-// ---------------------------------------------------------------------------
-//
-#ifdef _DEBUG
-void CThumbAGProcessor::RemoveFromQueues( const RArray<TItemId>& aIDArray, const TBool aRemoveFromDelete )
-#else
-void CThumbAGProcessor::RemoveFromQueues( const RArray<TItemId>& aIDArray, const TBool /*aRemoveFromDelete*/ )
-#endif
- {
- TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() aRemoveFromDelete == %d - begin", aRemoveFromDelete );
-#ifdef _DEBUG
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_REMOVEFROMQUEUES, "CThumbAGProcessor::RemoveFromQueues - aRemoveFromDelete;aRemoveFromDelete=%d", aRemoveFromDelete );
-#else
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_REMOVEFROMQUEUES, "CThumbAGProcessor::RemoveFromQueues - aRemoveFromDelete" );
-#endif
-
- TInt itemIndex(KErrNotFound);
-
- for (int i=0; i< aIDArray.Count(); i++)
- {
- TThumbnailGenerationItem item;
- item.iItemId = aIDArray[i];
- TN_DEBUG2( "CThumbAGProcessor::RemoveFromQueues() - %d", aIDArray[i]);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_REMOVEFROMQUEUES, "CThumbAGProcessor::RemoveFromQueues;aIDArray[i]=%u", aIDArray[i] );
-
- itemIndex = iGenerationQueue.FindInOrder(item, Compare);
- if(itemIndex >= 0)
- {
- delete iGenerationQueue[itemIndex].iUri;
- iGenerationQueue[itemIndex].iUri = NULL;
- iGenerationQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iGenerationQueue" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_REMOVEFROMQUEUES, "CThumbAGProcessor::RemoveFromQueues - iGenerationQueue" );
- }
-
- itemIndex = iQueryQueue.FindInOrder(aIDArray[i], CompareId);
- if(itemIndex >= 0)
- {
- iQueryQueue.Remove(itemIndex);
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - iQueryQueue" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_REMOVEFROMQUEUES, "CThumbAGProcessor::RemoveFromQueues - iQueryQueue" );
- }
- }
-
- ActivateAO();
-
- TN_DEBUG1( "CThumbAGProcessor::RemoveFromQueues() - end" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_REMOVEFROMQUEUES, "CThumbAGProcessor::RemoveFromQueues - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::SetForceRun()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::SetForceRun( const TBool aForceRun)
- {
- TN_DEBUG2( "CThumbAGProcessor::SetForceRun(%d) - end", aForceRun );
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_SETFORCERUN, "CThumbAGProcessor::SetForceRun - end;aForceRun=%u", aForceRun );
-
- // enable forced run
- iForceRun = aForceRun;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::QueryForPlaceholders()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::QueryAllItemsL()
- {
- TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_QUERYALLITEMSL, "CThumbAGProcessor::QueryAllItemsL" );
-
- __ASSERT_DEBUG((iMdESession), User::Panic(_L("CThumbAGProcessor::QueryAllItemsL() !iMdeSession "), KErrBadHandle));
-
- if(!iMdESession)
- {
- return;
- }
-
- if( iQueryAllItems )
- {
- if( !iQueryAllItems->IsComplete() )
- {
- TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL active- skip" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_QUERYALLITEMSL, "CThumbAGProcessor::QueryAllItemsL - active- skip" );
- return;
- }
-
- // delete old query
- iQueryAllItems->Cancel();
- delete iQueryAllItems;
- iQueryAllItems = NULL;
- }
-
- TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - start" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_QUERYALLITEMSL, "CThumbAGProcessor::QueryAllItemsL -start" );
-
- CMdEObjectDef& imageObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Image::KImageObject );
- CMdEObjectDef& videoObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Video::KVideoObject );
- CMdEObjectDef& audioObjDef = iDefNamespace->GetObjectDefL( MdeConstants::Audio::KAudioObject );
-
- CMdEObjectDef& objDef = iDefNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject);
- iQueryAllItems = iMdESession->NewObjectQueryL( *iDefNamespace, objDef, this );
-
- iQueryAllItems->SetResultMode( EQueryResultModeItem );
-
- CMdELogicCondition& rootCondition = iQueryAllItems->Conditions();
- rootCondition.SetOperator( ELogicConditionOperatorOr );
-
- rootCondition.AddObjectConditionL(imageObjDef);
- rootCondition.AddObjectConditionL(videoObjDef);
- rootCondition.AddObjectConditionL(audioObjDef);
-
- iQueryAllItems->FindL(KMdEQueryDefaultMaxCount, KMaxQueryBatchSize);
-
- TN_DEBUG1( "CThumbAGProcessor::QueryAllItemsL - end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_QUERYALLITEMSL, "CThumbAGProcessor::QueryAllItemsL" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::HandleCollectionMessage
-// From MMPXCollectionObserver
-// Handle collection message.
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
- {
- if ( aError != KErrNone || !aMessage || iShutdown )
- {
- return;
- }
-
- TMPXMessageId generalId( *aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ) );
-
- TN_DEBUG2( "CThumbAGProcessor::HandleCollectionMessage KMPXMessageGeneralId=%d", generalId);
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_HANDLECOLLECTIONMESSAGE, "CThumbAGProcessor::HandleCollectionMessage - KMPXMessageGeneralId;generalId=%u", generalId );
-
- //we are interestead of only general system events
- if ( generalId == KMPXMessageGeneral )
- {
- TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
- TInt op( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
- TN_DEBUG3( "CThumbAGProcessor::HandleCollectionMessage KMPXMessageGeneralEvent=%d", event, op);
- OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_HANDLECOLLECTIONMESSAGE, "CThumbAGProcessor::HandleCollectionMessage - KMPXMessageGeneralEvent;event=%d;op=%d", event, op );
- if ( event == TMPXCollectionMessage::EBroadcastEvent )
- {
- switch( op )
- {
- //when MTP sync or music collection is started then pause processing
- case EMcMsgRefreshStart:
- case EMcMsgUSBMTPStart:
- TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh started" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_HANDLECOLLECTIONMESSAGE, "CThumbAGProcessor::HandleCollectionMessage - MPX refresh started" );
- iMPXHarvesting = ETrue;
- CancelTimeout();
- break;
- //when MTP sync or music collection refresh is complete then resume processing
- case EMcMsgRefreshEnd:
- case EMcMsgUSBMTPEnd:
- case EMcMsgUSBMTPNotActive:
- TN_DEBUG1("CThumbAGProcessor::HandleCollectionMessage MPX refresh finished/not active" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_HANDLECOLLECTIONMESSAGE, "CThumbAGProcessor::HandleCollectionMessage - MPX refresh finished/not active" );
- iMPXHarvesting = EFalse;
- StartTimeout();
- break;
- default:
- break;
- }
-
- //signal Server's stores about MPX harvesting state
- if( iMPXHarvesting )
- {
- RProperty::Set(KTAGDPSNotification, KMPXHarvesting, ETrue);
- }
- else
- {
- RProperty::Set(KTAGDPSNotification, KMPXHarvesting, EFalse);
- }
-
- TN_DEBUG3( "CThumbAGProcessor::HandleCollectionMessage -- end() iHarvesting == %d, iMPXHarvesting == %d", iHarvesting, iMPXHarvesting);
- OstTraceExt2( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_HANDLECOLLECTIONMESSAGE, "CThumbAGProcessor::HandleCollectionMessage - end;iHarvesting=%u;iMPXHarvesting=%u", iHarvesting, iMPXHarvesting );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::HandleOpenL
-// From MMPXCollectionObserver
-// Handles the collection entries being opened.
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::HandleOpenL( const CMPXMedia& /*aEntries*/, TInt /*aIndex*/,
- TBool /*aComplete*/, TInt /*aError*/ )
- {
- // not needed here
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::HandleOpenL
-// From MMPXCollectionObserver
-// Handles an item being opened.
-// -----------------------------------------------------------------------------
-void CThumbAGProcessor::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ )
- {
- // not needed here
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::HandleCollectionMediaL
-// From MMPXCollectionObserver
-// Handle media properties.
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/,
- TInt /*aError*/ )
- {
- // not needed here
- }
-
-// -----------------------------------------------------------------------------
-// ActivityChanged()
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::ActivityChanged(const TBool aActive)
- {
- TN_DEBUG2( "void CThumbAGProcessor::ActivityChanged() aActive == %d", aActive);
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_ACTIVITYCHANGED, "CThumbAGProcessor::ActivityChanged" );
- if(aActive)
- {
- iIdle = EFalse;
- }
- else
- {
- iIdle = ETrue;
-
- if(iGenerationQueue.Count() > 0 )
- {
- ActivateAO();
- }
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::FormatNotification
-// Handles a format operation
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::FormatNotification( TBool aFormat )
- {
- TN_DEBUG2( "CThumbAGProcessor::FormatNotification(%d)", aFormat );
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_FORMATNOTIFICATION, "CThumbAGProcessor::FormatNotification;aFormat=%u", aFormat );
-
- iFormatting = aFormat;
-
- if(!aFormat)
- {
- //force update
- UpdatePSValues(EFalse, ETrue);
- ActivateAO();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::RPropertyNotification
-// Handles a RProperty changed operation
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::RPropertyNotification(const TInt aError, const TUid aKeyCategory, const TUint aPropertyKey, const TInt aValue)
- {
- TN_DEBUG5( "CThumbAGProcessor::RPropertyNotification() aError = %d, aPropertyKey = %d, aKeyCategory = %d, aValue = %d", aError, aPropertyKey, aKeyCategory, aValue );
- OstTraceExt2( TRACE_NORMAL, CTHUMBAGPROCESSOR_RPROPERTYNOTIFICATION, "CThumbAGProcessor::RPropertyNotification;aPropertyKey=%u;aValue=%d", aPropertyKey, aValue );
-
- if(aPropertyKey == KForceBackgroundGeneration && aKeyCategory == KTAGDPSNotification )
- {
- if( aValue == 1 && aError == KErrNone )
- {
- iForegroundRun = ETrue;
- ActivateAO();
- }
- else
- {
- iForegroundRun = EFalse;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::UpdateItemsLeft
-// Update KItemsleft PS value if changed
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::UpdatePSValues(const TBool aDefine, const TBool aForce)
- {
- TInt itemsLeft(KErrNotReady);
- TBool daemonProcessing = ETrue;
-
- if(iShutdown)
- {
- RProperty::Set(KTAGDPSNotification, KDaemonProcessing, EFalse);
- RProperty::Set(KTAGDPSNotification, KItemsleft, 0 );
- return;
- }
-
- if(aDefine)
- {
- TInt ret = RProperty::Define(KTAGDPSNotification, KDaemonProcessing, RProperty::EInt);
-
- if( ret != KErrNone )
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() define KDaemonProcessing ret = %d", ret);
- OstTrace1( TRACE_NORMAL, CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues - define KDaemonProcessing;ret=%d", ret );
- }
-
- ret = RProperty::Define(KTAGDPSNotification, KItemsleft, RProperty::EInt);
-
- if( ret != KErrNone )
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() define KItemsleft ret = %d", ret);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues - define KItemsleft;ret=%d", ret );
- }
- }
-
- // set itemsleft = KErrNotReady (-18) and daemonProcessing = ETrue if
- // - key is initalized
- // - mount timer is pending
- // - harvester observer is not yet activated
- // - single unknown item exists in processing queue
- // - forced
- if( iMountTimer->IsActive() || aForce || aDefine || iUnknownItemCount
- || !iHarvesterActivated )
- {
- daemonProcessing = ETrue;
- itemsLeft = KErrNotReady;
- }
- else
- {
- itemsLeft = iAddItemCount + iModifyItemCount;
- }
-
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() KItemsleft == %d", itemsLeft);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues;itemsLeft=%d", itemsLeft );
-
- //cancel 2nd round generarion when there is items in 1st round queues
- if(iAddItemCount && i2ndRound)
- {
- DeleteAndCancelQuery(ETrue);
- i2ndRound = EFalse;
- }
-
- if( iGenerationQueue.Count() )
- {
- daemonProcessing = ETrue;
- }
- else
- {
- daemonProcessing = EFalse;
- }
-
- if( daemonProcessing != iPreviousDaemonProcessing)
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() update KDaemonProcessing == %d", daemonProcessing);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues - update KDaemonProcessing;daemonProcessing=%u", daemonProcessing );
- iPreviousDaemonProcessing = daemonProcessing;
- TInt ret = RProperty::Set(KTAGDPSNotification, KDaemonProcessing, daemonProcessing);
-
- if(ret != KErrNone )
- {
- TN_DEBUG3( "CThumbAGProcessor::UpdatePSValues() set KDaemonProcessing %d failed %d", daemonProcessing, ret);
- OstTraceExt2( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues - set KDaemonProcessing;daemonProcessing=%u;ret=%d", daemonProcessing, ret );
- }
- }
-
- TInt ret = RProperty::Get(KTAGDPSNotification, KItemsleft, iPreviousItemsLeft );
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() iPreviousItemsLeft == %d", iPreviousItemsLeft);
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues;iPreviousItemsLeft=%d", iPreviousItemsLeft );
-
- if( itemsLeft != iPreviousItemsLeft)
- {
- TN_DEBUG2( "CThumbAGProcessor::UpdatePSValues() Set KItemsleft == %d", itemsLeft);
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues - Set KItemsleft;itemsLeft=%d", itemsLeft );
- iPreviousItemsLeft = itemsLeft;
- TInt ret = RProperty::Set(KTAGDPSNotification, KItemsleft, itemsLeft );
-
- if(ret != KErrNone )
- {
- TN_DEBUG3( "CThumbAGProcessor::UpdatePSValues() set KItemsleft %d failed %d", itemsLeft, ret);
- OstTraceExt2( TRACE_NORMAL, DUP7_CTHUMBAGPROCESSOR_UPDATEPSVALUES, "CThumbAGProcessor::UpdatePSValues - set KItemsleft failed;itemsLeft=%d;ret=%d", itemsLeft, ret );
- }
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::Compare
-// Comparison function for logaritmic use of queue arrays
-// ---------------------------------------------------------------------------
-//
-
-TInt CThumbAGProcessor::Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight)
- {
- return (aLeft.iItemId - aRight.iItemId);
- }
-
-TInt CThumbAGProcessor::CompareId(const TItemId& aLeft, const TItemId& aRight)
- {
- return (aLeft - aRight);
- }
-
-void CThumbAGProcessor::UpdateItemCounts()
- {
- TN_DEBUG1( "CThumbAGProcessor::UpdateItemCounts()");
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts" );
- iModifyItemCount = 0;
- iDeleteItemCount = 0;
- iAddItemCount = 0;
- iUnknownItemCount = 0;
- i2ndAddItemCount = 0;
- iPlaceholderItemCount=0;
- iCameraItemCount =0;
- iImageItemCount=0;
- iVideoItemCount=0;
- iAudioItemCount=0;
-
- for(TInt i=0; i < iGenerationQueue.Count(); i++)
- {
- TThumbnailGenerationItem& item = iGenerationQueue[i];
-
- if(item.iItemAction == EGenerationItemActionModify)
- {
- iModifyItemCount++;
- }
-
- if(item.iItemAction == EGenerationItemActionDelete)
- {
- iDeleteItemCount++;
- }
-
- if(item.iItemType == EGenerationItemTypeUnknown)
- {
- iUnknownItemCount++;
- }
- if(item.iItemAction == EGenerationItemAction2ndAdd)
- {
- i2ndAddItemCount++;
- }
- if(item.iPlaceholder)
- {
- iPlaceholderItemCount++;
- }
- if(item.iItemType == EGenerationItemTypeCamera)
- {
- iCameraItemCount++;
- }
- if(item.iItemAction == EGenerationItemActionAdd )
- {
- iAddItemCount++;
- }
- if(item.iItemType == EGenerationItemTypeAudio)
- {
- iAudioItemCount++;
- }
- if(item.iItemType == EGenerationItemTypeVideo)
- {
- iVideoItemCount++;
- }
- if(item.iItemType == EGenerationItemTypeImage)
- {
- iImageItemCount++;
- }
- }
-
- TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iActiveCount = %d",
- iActiveCount);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts - iActiveCount;iActiveCount=%u", iActiveCount );
- TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iPreviousItemsLeft = %d",
- iPreviousItemsLeft);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iPreviousItemsLeft=%d", iPreviousItemsLeft );
- TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iHarvesting == %d, iMMCHarvesting == %d, iPHHarvesting == %d, iMPXHarvesting == %d",
- iHarvesting, iMMCHarvesting, iPHHarvesting, iMPXHarvesting);
- OstTraceExt4( TRACE_NORMAL, DUP3_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iHarvesting=%d;iMMCHarvesting=%d;iPHHarvesting=%d;iMPXHarvesting=%d",
- iHarvesting, iMMCHarvesting, iPHHarvesting, iMPXHarvesting );
-
- TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iIdle = %d, iForegroundRun = %d, timer = %d, iForceRun = %d",
- iIdle, iForegroundRun, iPeriodicTimer->IsActive(), iForceRun);
- OstTraceExt4( TRACE_NORMAL, DUP4_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iIdle=%d;iForegroundRun=%d;iPeriodicTimer->IsActive()=%d;iForceRun=%d",
- iIdle, iForegroundRun, iPeriodicTimer->IsActive(), iForceRun );
-
- TN_DEBUG4( "CThumbAGProcessor::UpdateItemCounts() iModify = %d, iQueryReady = %d, iProcessingCount = %d",
- iModify, iQueryReady, iProcessingCount);
- OstTraceExt2( TRACE_NORMAL, DUP5_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iModify=%u;iQueryReady=%u",
- iModify, iQueryReady );
- OstTrace1( TRACE_NORMAL, DUP12_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iProcessingCount=%u", iProcessingCount );
- TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iMountTimer = %d", iMountTimer->IsActive());
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iMountTimer->IsActive()=%u", iMountTimer->IsActive() );
- TN_DEBUG3( "CThumbAGProcessor::UpdateItemCounts() iGenerationQueue = %d, iQueryQueue = %d",
- iGenerationQueue.Count(), iQueryQueue.Count());
- OstTraceExt2( TRACE_NORMAL, DUP7_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iGenerationQueue.Count()=%d;iQueryQueue.Count()=%d", iGenerationQueue.Count(), iQueryQueue.Count() );
- TN_DEBUG5( "CThumbAGProcessor::UpdateItemCounts() iAddItemCount=%d, i2ndAddItemCount=%d, iModifyItemCount=%d, iDeleteItemCount=%d",
- iAddItemCount, i2ndAddItemCount, iModifyItemCount, iDeleteItemCount );
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts" );
- TN_DEBUG3( "CThumbAGProcessor::UpdateItemCounts() iUnknownItemCount=%d, iPlaceholderItemCount=%d",
- iUnknownItemCount, iPlaceholderItemCount);
- OstTraceExt2( TRACE_NORMAL, DUP9_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iUnknownItemCount=%d;iPlaceholderItemCount=%d", iUnknownItemCount, iPlaceholderItemCount );
- TN_DEBUG4( "CThumbAGProcessor::UpdateItemCounts() iAudioItemCount=%d, iVideoItemCount=%d, iImageItemCount=%d",
- iAudioItemCount, iVideoItemCount, iImageItemCount);
- OstTraceExt3( TRACE_NORMAL, DUP10_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iAudioItemCount=%u;iVideoItemCount=%d;iImageItemCount=%d",
- iAudioItemCount, iVideoItemCount, iImageItemCount );
-
- TN_DEBUG2( "CThumbAGProcessor::UpdateItemCounts() iCameraItemCount=%d", iCameraItemCount);
- OstTrace1( TRACE_NORMAL, DUP11_CTHUMBAGPROCESSOR_UPDATEITEMCOUNTS, "CThumbAGProcessor::UpdateItemCounts;iCameraItemCount=%d", iCameraItemCount );
-
- //compress queues when empty
- if(!iGenerationQueue.Count())
- {
- iGenerationQueue.Compress();
- }
-
- if(!iQueryQueue.Count())
- {
- iQueryQueue.Compress();
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::MountTimerCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbAGProcessor::MountTimerCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbAGProcessor::MountTimerCallBack()");
- OstTrace0( TRACE_NORMAL, CTHUMBAGPROCESSOR_MOUNTTIMERCALLBACK, "CThumbAGProcessor::MountTimerCallBack" );
- CThumbAGProcessor* self = static_cast<CThumbAGProcessor*>( aAny );
-
- self->iMountTimer->Cancel();
-
- //activate timeout if overall or mmc harvestig is not active
- if(!self->iHarvesting && !self->iMMCHarvesting )
- {
- self->ActivateAO();
- }
-
- return KErrNone; // Return value ignored by CPeriodic
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::SetGenerationItemAction()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, TThumbnailGenerationItemType aItemType )
- {
- switch( aItemType )
- {
- case EGenerationItemTypeAudio:
- aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
- break;
- case EGenerationItemTypeCamera:
- aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
- aGenerationItem.iPlaceholder = ETrue;
- break;
- case EGenerationItemTypeImage:
- aGenerationItem.iItemAction = EGenerationItemActionAdd;
- break;
- case EGenerationItemTypeVideo:
- //S^3 EGenerationItemActionAdd
- //S^4 EGenerationItemAction2ndAdd
- aGenerationItem.iItemAction = EGenerationItemAction2ndAdd;
- break;
- default:
- aGenerationItem.iItemAction = EGenerationItemActionResolveType;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGProcessor::SetGenerationItemType()
-// ---------------------------------------------------------------------------
-//
-void CThumbAGProcessor::SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId )
- {
- if(aDefId == iImageObjectDef->Id())
- {
- aGenerationItem.iItemType = EGenerationItemTypeImage;
- }
- else if(aDefId == iAudioObjectDef->Id())
- {
- aGenerationItem.iItemType = EGenerationItemTypeAudio;
- }
- else if(aDefId == iVideoObjectDef->Id())
- {
- aGenerationItem.iItemType = EGenerationItemTypeVideo;
- }
- else
- {
- aGenerationItem.iItemType = EGenerationItemTypeUnknown;
- }
-
- SetGenerationItemAction( aGenerationItem, aGenerationItem.iItemType );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbAGProcessor::AppendProcessingQueue()
-// -----------------------------------------------------------------------------
-//
-void CThumbAGProcessor::AppendProcessingQueue( TThumbnailGenerationItem& item )
- {
-
- TInt itemIndex = iGenerationQueue.FindInOrder( item, Compare );
-
- if(itemIndex >= 0)
- {
- iGenerationQueue[itemIndex].iPlaceholder = item.iPlaceholder;
- iGenerationQueue[itemIndex].iItemType = item.iItemType;
- iGenerationQueue[itemIndex].iItemAction = item.iItemAction;
- }
- else
- {
- iGenerationQueue.InsertInOrder(item, Compare);
- }
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagvideoobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-/*
-* 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: Thumbnail Auto Generate Daemon
-*
-*/
-
-
-#include <e32svr.h>
-#include <centralrepository.h>
-
-#include <mdesession.h>
-#include <mdeconstants.h>
-#include <mdequery.h>
-#include <mdeobject.h>
-
-#include "thumbagvideoobserver.h"
-#include "thumbnaillog.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanagerprivatecrkeys.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbagvideoobserverTraces.h"
-#endif
-
-
-
-// ---------------------------------------------------------------------------
-// NewLC
-// ---------------------------------------------------------------------------
-//
-CThumbAGVideoObserver* CThumbAGVideoObserver::NewLC(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGVideoObserver::NewLC() - begin" );
-
- CThumbAGVideoObserver* self = new (ELeave) CThumbAGVideoObserver(aProcessor);
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// NewL
-// ---------------------------------------------------------------------------
-//
-CThumbAGVideoObserver* CThumbAGVideoObserver::NewL(CThumbAGProcessor* aProcessor)
- {
- TN_DEBUG1( "CThumbAGVideoObserver::NewL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_NEWL, "CThumbAGVideoObserver::NewL" );
-
- CThumbAGVideoObserver* self = CThumbAGVideoObserver::NewLC(aProcessor);
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGVideoObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGVideoObserver::CThumbAGVideoObserver(CThumbAGProcessor* aProcessor)
- : iShutdownObserver(NULL), iMDSShutdownObserver(NULL), iMdESession(NULL), iProcessor(aProcessor)
- {
- // No implementation required
- }
-
-// ---------------------------------------------------------------------------
-// ConstructL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGVideoObserver::ConstructL()
- {
- TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_CONSTRUCTL, "CThumbAGVideoObserver::ConstructL - begin" );
-
-#ifdef _DEBUG
- iAddCounter = 0;
- iModCounter = 0;
-#endif
-
- InitializeL();
-
- TN_DEBUG1( "CThumbAGVideoObserver::ConstructL() - end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_CONSTRUCTL, "CThumbAGVideoObserver::ConstructL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGVideoObserver
-// ---------------------------------------------------------------------------
-//
-void CThumbAGVideoObserver::InitializeL()
- {
- TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_INITIALIZEL, "CThumbAGVideoObserver::InitializeL - begin" );
-
-
- TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - create observers" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_INITIALIZEL, "CThumbAGVideoObserver::InitializeL - create observers" );
-
- // create shutdown observer
- if(iMDSShutdownObserver)
- {
- delete iMDSShutdownObserver;
- iMDSShutdownObserver = NULL;
- }
- iMDSShutdownObserver = CTMShutdownObserver::NewL( *this, KMdSPSShutdown, KMdSShutdown, EFalse );
-
- if(iShutdownObserver)
- {
- delete iShutdownObserver;
- iShutdownObserver = NULL;
- }
- iShutdownObserver = CTMShutdownObserver::NewL( *this, KTAGDPSNotification, KShutdown, ETrue );
- iShutdown = EFalse;
-
- // MDS session reconnect timer
- if (!iReconnect)
- {
- iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
- }
-
- TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - connect to MDS" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBAGVIDEOOBSERVER_INITIALIZEL, "CThumbAGVideoObserver::InitializeL - connect to MDS" );
-
- if(iMdESession)
- {
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- // connect to MDS
- delete iMdESession;
- iMdESession = NULL;
- }
-
- iMdESession = CMdESession::NewL( *this );
- iSessionError = EFalse;
-
- TN_DEBUG1( "CThumbAGVideoObserver::InitializeL() - end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGVIDEOOBSERVER_INITIALIZEL, "CThumbAGVideoObserver::InitializeL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// ~CThumbAGVideoObserver
-// ---------------------------------------------------------------------------
-//
-CThumbAGVideoObserver::~CThumbAGVideoObserver()
- {
- TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_CTHUMBAGVIDEOOBSERVER, "CThumbAGVideoObserver::~CThumbAGVideoObserver - begin" );
-
- iShutdown = ETrue;
-
- delete iMDSShutdownObserver;
- delete iShutdownObserver;
-
- if(iReconnect)
- {
- iReconnect->Cancel();
- delete iReconnect;
- iReconnect = NULL;
- }
-
- if (iMdESession)
- {
- // 2 observers
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
- TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) );
-
- delete iMdESession;
- iMdESession = NULL;
- }
-
- TN_DEBUG1( "CThumbAGVideoObserver::~CThumbAGVideoObserver() - end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_CTHUMBAGVIDEOOBSERVER, "CThumbAGVideoObserver::~CThumbAGVideoObserver - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGVideoObserver::HandleSessionOpened
-// -----------------------------------------------------------------------------
-//
-void CThumbAGVideoObserver::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
- {
- TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionOpened");
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_HANDLESESSIONOPENED, "CThumbAGVideoObserver::HandleSessionOpened" );
-
- if (aError == KErrNone)
- {
- TRAPD( err, AddObserversL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened, AddObserversL error == %d", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_HANDLESESSIONOPENED, "CThumbAGVideoObserver::HandleSessionOpened - AddObserversL;err=%d", err );
- }
- }
- else
- {
- TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionOpened error == %d", aError );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGVIDEOOBSERVER_HANDLESESSIONOPENED, "CThumbAGVideoObserver::HandleSessionOpened;aError=%d", aError );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGVideoObserver::HandleSessionError
-// -----------------------------------------------------------------------------
-//
-void CThumbAGVideoObserver::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
- {
- TN_DEBUG2( "CThumbAGVideoObserver::HandleSessionError == %d", aError );
- OstTrace1( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_HANDLESESSIONERROR, "CThumbAGVideoObserver::HandleSessionError;aError=%d", aError );
- if (aError != KErrNone && !iSessionError)
- {
- iSessionError = ETrue;
-
- if (!iShutdown)
- {
- if (!iReconnect->IsActive())
- {
- iReconnect->Start( KMdEReconnect, KMdEReconnect,
- TCallBack(ReconnectCallBack, this));
-
- TN_DEBUG1( "CThumbAGVideoObserver::HandleSessionError() - reconnect timer started" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_HANDLESESSIONERROR, "CThumbAGVideoObserver::HandleSessionError - reconnect timer started" );
- }
- }
-
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGVideoObserver::HandleObjectNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGVideoObserver::HandleObjectNotification( CMdESession& /*aSession*/,
- TObserverNotificationType aType,
- const RArray<TItemId>& aObjectIdArray )
- {
- TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - begin" );
-
- // no processor or shutting down
- if ( iShutdown || !iProcessor)
- {
- return;
- }
-
-#ifdef _DEBUG
- if (aType == ENotifyAdd)
- {
- TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - ENotifyAdd;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iAddCounter = aObjectIdArray.Count();
- }
- else if (aType == ENotifyModify)
- {
- TN_DEBUG2( "CThumbAGVideoObserver::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - ENotifyModify;aObjectIdArray.Count()=%d", aObjectIdArray.Count() );
- iModCounter = aObjectIdArray.Count();
- }
-#endif
-
- if ( (aType == ENotifyAdd || aType == ENotifyModify ) && (aObjectIdArray.Count() > 0) )
- {
- TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - AddToQueueL" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - AddToQueueL" );
-
- // Add event to processing queue by type and enable force run
- RPointerArray<HBufC> dummyArray;
- TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeVideo, aObjectIdArray, dummyArray, EFalse));
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - error adding to queue" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - error adding to queue" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - bad notification" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - bad notification" );
- }
-
-#ifdef _DEBUG
- TN_DEBUG3( "CThumbAGVideoObserver::IN-COUNTERS---------- Add = %d Modify = %d", iAddCounter, iModCounter );
- OstTraceExt2( TRACE_NORMAL, DUP6_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::IN-COUNTERS---------- Add = %u Modify = %u", iAddCounter, iModCounter );
- iModCounter = 0;
- iAddCounter = 0;
-#endif
-
- TN_DEBUG1( "CThumbAGVideoObserver::HandleObjectNotification() - end" );
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBAGVIDEOOBSERVER_HANDLEOBJECTNOTIFICATION, "CThumbAGVideoObserver::HandleObjectNotification - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbAGVideoObserver::ShutdownNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbAGVideoObserver::ShutdownNotification()
- {
- TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification()" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGVideoObserver::ShutdownNotification" );
-
- if (!iShutdown)
- {
- TN_DEBUG1( "CThumbAGVideoObserver::ShutdownNotification() shutdown" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_SHUTDOWNNOTIFICATION, "CThumbAGVideoObserver::ShutdownNotification - shutdown" );
- iShutdown = ETrue;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGVideoObserver::AddObserversL
-// ---------------------------------------------------------------------------
-//
-void CThumbAGVideoObserver::AddObserversL()
- {
- TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_ADDOBSERVERSL, "CThumbAGVideoObserver::AddObserversL - begin" );
-
- CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL();
- CMdEObjectDef& objectDef = defaultNamespace.GetObjectDefL( MdeConstants::Object::KBaseObject );
- CMdEPropertyDef& originPropDef = objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
- CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject );
-
- // set observing conditions
- CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- addCondition->AddObjectConditionL( videoDef );
-
- addCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-
- CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorAnd );
- modifyCondition->AddObjectConditionL( videoDef );
-
- modifyCondition->AddPropertyConditionL( originPropDef, TMdEUintNotEqual(MdeConstants::Object::ECamera));
-
- // add observer
- iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd );
-
- // modify observer
- iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify );
-
- CleanupStack::Pop( 2, addCondition );
-
- TN_DEBUG1( "CThumbAGVideoObserver::AddObserversL() - end" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_ADDOBSERVERSL, "CThumbAGVideoObserver::AddObserversL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbAGVideoObserver::ReconnectCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbAGVideoObserver::ReconnectCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - reinitialize");
- OstTrace0( TRACE_NORMAL, CTHUMBAGVIDEOOBSERVER_RECONNECTCALLBACK, "CThumbAGVideoObserver::ReconnectCallBack - reinitialize" );
-
- CThumbAGVideoObserver* self = static_cast<CThumbAGVideoObserver*>( aAny );
-
- self->iReconnect->Cancel();
-
- // reconnect to MDS
- TRAP_IGNORE( self->InitializeL() );
-
- TN_DEBUG1( "CThumbAGVideoObserver::ReconnectCallBack() - done");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBAGVIDEOOBSERVER_RECONNECTCALLBACK, "CThumbAGVideoObserver::ReconnectCallBack - done" );
-
- return KErrNone;
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/bwins/thumbnailmanageru.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-EXPORTS
- ?NewLC@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@0@Z @ 1 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class TDesC16 const &, class TDesC16 const &)
- ?NewL@CThumbnailObjectSource@@SAPAV1@ABVRFile64@@ABVTDesC16@@@Z @ 2 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class RFile64 const &, class TDesC16 const &)
- ?NewL@CThumbnailManager@@SAPAV1@AAVMThumbnailManagerObserver@@@Z @ 3 NONAME ; class CThumbnailManager * CThumbnailManager::NewL(class MThumbnailManagerObserver &)
- ?NewLC@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@K0@Z @ 4 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class TDesC16 const &, unsigned long, class TDesC16 const &)
- ?NewLC@CThumbnailObjectSource@@SAPAV1@ABVRFile64@@ABVTDesC16@@@Z @ 5 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class RFile64 const &, class TDesC16 const &)
- ?NewL@CThumbnailObjectSource@@SAPAV1@PAVTDesC8@@AAVTDesC16@@ABV3@@Z @ 6 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class TDesC8 *, class TDesC16 &, class TDesC16 const &)
- ?NewL@CThumbnailObjectSource@@SAPAV1@PAVCFbsBitmap@@ABVTDesC16@@@Z @ 7 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class CFbsBitmap *, class TDesC16 const &)
- ?NewLC@CThumbnailObjectSource@@SAPAV1@PAVCFbsBitmap@@ABVTDesC16@@@Z @ 8 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class CFbsBitmap *, class TDesC16 const &)
- ?NewL@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@0@Z @ 9 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class TDesC16 const &, class TDesC16 const &)
- ?NewLC@CThumbnailObjectSource@@SAPAV1@PAVTDesC8@@AAVTDesC16@@ABV3@@Z @ 10 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class TDesC8 *, class TDesC16 &, class TDesC16 const &)
- ?NewL@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@K0@Z @ 11 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class TDesC16 const &, unsigned long, class TDesC16 const &)
- ?NewLC@CThumbnailManager@@SAPAV1@AAVMThumbnailManagerObserver@@@Z @ 12 NONAME ; class CThumbnailManager * CThumbnailManager::NewLC(class MThumbnailManagerObserver &)
- ?Buffer@CThumbnailObjectSource@@QAEPAVTDesC8@@XZ @ 13 NONAME ; class TDesC8 * CThumbnailObjectSource::Buffer(void)
- ?FileHandle@CThumbnailObjectSource@@QAEAAVRFile64@@XZ @ 14 NONAME ; class RFile64 & CThumbnailObjectSource::FileHandle(void)
- ?GetBufferOwnership@CThumbnailObjectSource@@QAEPAVTDesC8@@XZ @ 15 NONAME ; class TDesC8 * CThumbnailObjectSource::GetBufferOwnership(void)
- ?Id@CThumbnailObjectSource@@QAEKXZ @ 16 NONAME ; unsigned long CThumbnailObjectSource::Id(void)
- ?MimeType@CThumbnailObjectSource@@QAEABVTDesC8@@XZ @ 17 NONAME ; class TDesC8 const & CThumbnailObjectSource::MimeType(void)
- ?Uri@CThumbnailObjectSource@@QAEABVTDesC16@@XZ @ 18 NONAME ; class TDesC16 const & CThumbnailObjectSource::Uri(void)
- ?Bitmap@CThumbnailObjectSource@@QAEPAVCFbsBitmap@@XZ @ 19 NONAME ; class CFbsBitmap * CThumbnailObjectSource::Bitmap(void)
- ?GetBitmapOwnership@CThumbnailObjectSource@@QAEPAVCFbsBitmap@@XZ @ 20 NONAME ; class CFbsBitmap * CThumbnailObjectSource::GetBitmapOwnership(void)
- ?NewLC@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@00@Z @ 21 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewLC(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
- ?TargetUri@CThumbnailObjectSource@@QAEABVTDesC16@@XZ @ 22 NONAME ; class TDesC16 const & CThumbnailObjectSource::TargetUri(void)
- ?NewL@CThumbnailObjectSource@@SAPAV1@ABVTDesC16@@00@Z @ 23 NONAME ; class CThumbnailObjectSource * CThumbnailObjectSource::NewL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/eabi/thumbnailmanageru.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-EXPORTS
- _ZN17CThumbnailManager4NewLER25MThumbnailManagerObserver @ 1 NONAME
- _ZN17CThumbnailManager5NewLCER25MThumbnailManagerObserver @ 2 NONAME
- _ZN22CThumbnailObjectSource4NewLERK7RFile64RK7TDesC16 @ 3 NONAME
- _ZN22CThumbnailObjectSource4NewLERK7TDesC16S2_ @ 4 NONAME
- _ZN22CThumbnailObjectSource5NewLCERK7RFile64RK7TDesC16 @ 5 NONAME
- _ZN22CThumbnailObjectSource5NewLCERK7TDesC16S2_ @ 6 NONAME
- _ZN22CThumbnailObjectSource10FileHandleEv @ 7 NONAME
- _ZN22CThumbnailObjectSource3UriEv @ 8 NONAME
- _ZN22CThumbnailObjectSource4NewLEP10CFbsBitmapRK7TDesC16 @ 9 NONAME
- _ZN22CThumbnailObjectSource4NewLEP6TDesC8R7TDesC16RKS2_ @ 10 NONAME
- _ZN22CThumbnailObjectSource5NewLCEP10CFbsBitmapRK7TDesC16 @ 11 NONAME
- _ZN22CThumbnailObjectSource5NewLCEP6TDesC8R7TDesC16RKS2_ @ 12 NONAME
- _ZN22CThumbnailObjectSource6BufferEv @ 13 NONAME
- _ZN22CThumbnailObjectSource8MimeTypeEv @ 14 NONAME
- _ZN22CThumbnailObjectSource18GetBufferOwnershipEv @ 15 NONAME
- _ZN22CThumbnailObjectSource5NewLCERK7TDesC16mS2_ @ 16 NONAME
- _ZN22CThumbnailObjectSource2IdEv @ 17 NONAME
- _ZN22CThumbnailObjectSource4NewLERK7TDesC16mS2_ @ 18 NONAME
- _ZN22CThumbnailObjectSource18GetBitmapOwnershipEv @ 19 NONAME
- _ZN22CThumbnailObjectSource6BitmapEv @ 20 NONAME
- _ZTI22CThumbnailRequestQueue @ 21 NONAME
- _ZTV22CThumbnailRequestQueue @ 22 NONAME
- _ZN22CThumbnailObjectSource4NewLERK7TDesC16S2_S2_ @ 23 NONAME
- _ZN22CThumbnailObjectSource5NewLCERK7TDesC16S2_S2_ @ 24 NONAME
- _ZN22CThumbnailObjectSource9TargetUriEv @ 25 NONAME
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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 ?myapp
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-thumbnailmanager.mmp
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/group/thumbnailmanager.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* 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: Thumbnail manager client project definition file
-*
-*/
-
-
-// To get the MW_LAYER_SYSTEMINCLUDE-definition
-#include <platform_paths.hrh>
-
-#include <data_caging_paths.hrh>
-#include "../../inc/thumbnailmanageruids.hrh"
-
-VERSION 10.0
-TARGET thumbnailmanager.dll
-TARGETTYPE DLL
-UID 0x0 THUMBNAIL_MANAGER_CLIENT_DLL_UID
-
-CAPABILITY CAP_CLIENT_DLL
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE thumbnailmanager.cpp
-SOURCE thumbnailmanagerimpl.cpp
-SOURCE thumbnailobjectsource.cpp
-SOURCE thumbnailrequestactive.cpp
-SOURCE thumbnailsession.cpp
-SOURCE thumbnaildataimpl.cpp thumbnailrequestqueue.cpp
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../inc ../traces
-
-LIBRARY fbscli.lib
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY efsrv.lib
-LIBRARY bafl.lib
-LIBRARY centralrepository.lib apmime.lib
-LIBRARY hal.lib
-
-DEBUGLIBRARY flogger.lib
-
-OPTION ARMCC -O3 -OTime
-
-PAGED
-BYTEPAIRCOMPRESSTARGET
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnaildataimpl.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
-* 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: Thumbnail object implementation.
- *
-*/
-
-
-#ifndef THUMBNAILDATAIMPL_H
-#define THUMBNAILDATAIMPL_H
-
-#include "thumbnaildata.h"
-
-/**
- * Thumbnail object implementation.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbnailDataImpl ): public CBase, public MThumbnailData
- {
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New thumbnail instance.
- */
- CThumbnailDataImpl();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailDataImpl();
-
-public:
-
- /**
- * Get a pointer to a CFbsBitmap containing the thumbnail image. Ownership
- * of the object is not transferred (i.e. client must not delete the
- * pointer).
- * @since S60 v5.0
- * @return Pointer to a bitmap representing the thumbnail or NULL if
- * thumbnail pointer is not available or it has been detached.
- */
- CFbsBitmap* Bitmap();
-
- /**
- * Get a pointer to a CFbsBitmap containing the thumbnail image. Ownership
- * of the object is transferred to the caller. Client must delete the
- * bitmap after it is done processing it.
- * @since S60 v5.0
- * @return Pointer to a bitmap representing the thumbnail or NULL if
- * thumbnail pointer is not available or it has been detached.
- * Caller assumes ownership of the bitmap.
- */
- CFbsBitmap* DetachBitmap();
-
- /**
- * Get client data structure.
- *
- * @since S60 v5.0
- * @return A pointer for client data specified as a parameter for
- * GetThumbnailL() or NULL if not specified.
- */
- TAny* ClientData();
-
- /**
- * Sets the thumbnail object data.
- *
- * @since S60 v5.0
- * @param aBitmap Bitmab for the object.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- */
- void Set( CFbsBitmap* aBitmap, TAny* aClientData );
-
-private:
- // data
-
- /**
- * Bitmap.
- */
- CFbsBitmap* iBitmap;
-
- /**
- * Arbitrary client data.
- */
- TAny* iClientData;
-};
-
-#endif // THUMBNAILDATAIMPL_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailmanagerimpl.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,485 +0,0 @@
-/*
-* 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: Implementation class of Thumbnail Manager
- *
-*/
-
-
-#ifndef THUMBNAILMANAGERIMPL_H
-#define THUMBNAILMANAGERIMPL_H
-
-#include <fbs.h>
-
-#include "thumbnailmanager.h"
-#include "thumbnailsession.h"
-#include "thumbnailrequestqueue.h"
-#include "thumbnaildata.h"
-
-
-class CThumbnailRequestActive;
-
-/**
- * Implementation class of thumbnail engine.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbnailManagerImpl ): public CThumbnailManager
- {
-public:
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailManagerImpl();
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @param aObserver Observer to receive notifications about completed
- * operations.
- * @return New CThumbnailManagerImpl instance.
- */
- static CThumbnailManagerImpl* NewLC( MThumbnailManagerObserver& aObserver );
-
- /**
- * Get a thumbnail for an object file. If a thumbnail already exists, it
- * is loaded and if a thumbnail does not exist, it is created
- * transparently. ThumbnailReady() callback will be called when the
- * operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID
- */
- TThumbnailRequestId GetThumbnailL( CThumbnailObjectSource& aObjectSource,
- TAny* aClientData = NULL, const TInt aPriority = CActive::EPriorityIdle );
-
- /**
- * Get a thumbnail for an object file. If a thumbnail already exists, it
- * is loaded and if a thumbnail does not exist, it is created
- * transparently. ThumbnailReady() callback will be called when the
- * operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @param aGeneratePersistentSizesOnly Only persitent sizes generated
- * @return Thumbnail request ID
- */
- TThumbnailRequestId GetThumbnailL( CThumbnailObjectSource& aObjectSource,
- TAny* aClientData, const TInt aPriority, TBool aGeneratePersistentSizesOnly );
-
- /**
- * Get a persistent thumbnail for an object file. If a thumbnail already
- * exists, it is loaded and if a thumbnail does not exist, it is created
- * transparently. ThumbnailReady() callback will be called when the
- * operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aThumbnailId Thumbnail ID
- * @param aThumbnailSizeType Thumbnail size enumeration
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- TThumbnailRequestId GetThumbnailL( const TThumbnailId,
- TAny* aClientData = NULL, TInt aPriority = CActive::EPriorityIdle );
-
- /**
- * Import an image to be used as thumbnail for an object. If a
- * thumbnail already exists, it is loaded and if a thumbnail does not
- * exist, it is created transparently. ThumbnailReady() callback will be
- * called when the operation is complete. In addition, ThumbnailPreviewReady()
- * callback may be called if EOptimizeForQualityWithPreview mode was
- * defined.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID
- */
- TThumbnailRequestId ImportThumbnailL( CThumbnailObjectSource& aObjectSource,
- const TDesC& aTargetUri, TAny* aClientData = NULL,
- const TInt aPriority = CActive::EPriorityIdle );
-
- /**
- * Set persistent size scaled thumbnails for an object. If a
- * thumbnail already exists, it is replaced and if a thumbnail does not
- * exist, it is created transparently.
- *
- * Current values for display mode, thumbnail size, flags and performance
- * preference are used.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- TThumbnailRequestId SetThumbnailL( CThumbnailObjectSource& source,
- TAny* aClientData = NULL,
- TInt aPriority = CActive::EPriorityIdle );
-
- /**
- * Get the current display mode for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @return Default display mode for the thumbnail bitmaps.
- */
- TDisplayMode DisplayMode()const;
-
- /**
- * Set the current display mode for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @param aDisplayMode New display mode value for the thumbnail bitmaps.
- */
- void SetDisplayModeL( const TDisplayMode aDisplayMode );
-
- /**
- * Get the current quality versus performance preference.
- *
- * @since S60 v5.0
- * @return Current quality versus performance preference.
- */
- TThumbnailQualityPreference QualityPreference()const;
-
- /**
- * Set quality versus performance preference.
- *
- * @since S60 v5.0
- * @param aQualityPreference New quality versus performance preference
- * value.
- */
- void SetQualityPreferenceL( const TThumbnailQualityPreference
- aQualityPreference );
-
- /**
- * Get the current desired size for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @return Current desired size for thumbnail bitmaps (in pixels).
- */
- const TSize& ThumbnailSize()const;
-
- /**
- * Set desired size for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @param aThumbnailSize New quality for the desired thumbnail size.
- */
- void SetThumbnailSizeL( const TSize& aThumbnailSize );
-
- /**
- * Set desired size for thumbnail bitmaps.
- *
- * @since S60 v5.0
- * @param aThumbnailSize New quality for the desired thumbnail size.
- */
- void SetThumbnailSizeL( const TThumbnailSize aThumbnailSize );
-
- /**
- * Get current flags for thumbnail generation.
- *
- * @since S60 v5.0
- * @return Current flags.
- */
- TThumbnailFlags Flags()const;
-
- /**
- * Set flags for thumbnail generation. Several flags may be enabled
- * by combining the values using bitwise or.
- *
- * @since S60 v5.0
- * @param aFlags New flags.
- */
- void SetFlagsL( const TThumbnailFlags aFlags );
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- */
- void DeleteThumbnails( CThumbnailObjectSource& aObjectSource );
-
- /**
- * Delete thumbnails by TThumbnailId. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aItemId TThumbnailId
- */
- void DeleteThumbnails( const TThumbnailId aItemId );
-
- /**
- * Create thumbnail for a given object. This is an asynchronous
- * operation, which always returns immediately. No callbacks are
- * emitted.
- *
- * @since S60 v5.0
- * @param aObjectSource Source object or file
- * @param aPriority Priority for this operation
- * @return Thumbnail creation request ID
- */
- TThumbnailRequestId CreateThumbnails( CThumbnailObjectSource& aObjectSource,
- TInt aPriority = CActive::EPriorityIdle );
-
- /**
- * Cancel a thumbnail operation.
- *
- * @since S60 v5.0
- * @param aId Request ID for the operation to be cancelled.
- * @return Symbian OS error code or KErrNone if cancelling was
- * successful.
- */
- TInt CancelRequest( const TThumbnailRequestId aId );
-
- /**
- * Change the priority of a queued thumbnail operation.
- *
- * @since S60 v5.0
- * @param aId Request ID for the request which to assign a new
- * priority.
- * @param aNewPriority New priority value
- * @return Symbian OS error code or KErrNone if change was
- * successful.
- */
- TInt ChangePriority( const TThumbnailRequestId aId, const TInt aNewPriority );
-
- /**
- * Get a list of supported file formats for object files.
- *
- * The return value is a reference to a list that contains each
- * supported MIME type. There may also be wildcards, such as "image/ *".
- *
- * The returned reference is valid until CThumbnailManager is
- * destroyed or GetSupportedMimeTypesL() is called again.
- *
- * @since S60 v5.0
- * @return A list of supported MIME types. May contain wildcards.
- * Ownership not transferred.
- */
- const CDesCArray& GetSupportedMimeTypesL();
-
- /**
- * Update Thumbnails by TThumbnailId. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aItemId TThumbnailId
- * @param aPath (New) path for the Thumbnail
- * @param aOrientation Thumbnail orientation
- * @param aModified Last modified
- * @param aPriority Priority for this operation
- */
- void UpdateThumbnailsL( const TThumbnailId aItemId, const TDesC& aPath,
- const TInt aOrientation, const TInt64 aModified, TInt aPriority );
-
- /**
- * Rename Thumbnails. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @since S60 v5.0
- * @param aCurrentPath Current path of the Thumbnail
- * @param aNewPath New path for the Thumbnail
- * @param aPriority Priority for this operation
- * @return Thumbnail request ID. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this CThumbnailManager
- * instance and may not be shared with other
- * instances.
- */
- TThumbnailRequestId RenameThumbnailsL( const TDesC& aCurrentPath,
- const TDesC& aNewPath, TInt aPriority = CActive::EPriorityIdle );
-
- /**
- * Set optional request observer for getting information about completed
- * requests that don't include a thumbnail.
- *
- * @since Symbian^3
- * @param aObserver Observer to receive notifications.
- */
- void SetRequestObserver( MThumbnailManagerRequestObserver& aObserver );
-
- /**
- * Remove optional request observer.
- *
- * @since Symbian^3
- */
- void RemoveRequestObserver();
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aObserver Observer to receive notifications about completed
- * operations.
- * @return New CThumbnailManagerImpl instance.
- */
- CThumbnailManagerImpl( MThumbnailManagerObserver& aObserver );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Check that given priority is in range of CActive::TPriority
- *
- * @since S60 v5.0
- * @param aPriority Priority
- * @return Valid priority.
- */
- TInt ValidatePriority( const TInt aPriority );
-
-
-private:
- // data
-
- /**
- * Default width of thumbnail.
- */
- TInt iDefaultWidth;
-
- /**
- * Default height of thumbnail
- */
- TInt iDefaultHeight;
-
- /**
- * Observer to receive notifications about completed operations.
- */
- MThumbnailManagerObserver& iObserver;
-
- /**
- * Observer to receive notifications about completed requests.
- */
- MThumbnailManagerRequestObserver* iRequestObserver;
-
- /**
- * Session.
- */
- RThumbnailSession iSession;
-
- /**
- * Fileserver.
- */
- RFs iFs;
-
- /**
- * Request queue processor.
- */
- CThumbnailRequestQueue* iRequestQueue;
-
- /**
- * Display mode.
- */
- TDisplayMode iDisplayMode;
-
- /**
- * Flags.
- */
- TThumbnailFlags iFlags;
-
- /**
- * Quality preference.
- */
- TThumbnailQualityPreference iQualityPreference;
-
- /**
- * Requested size of thumbnail.
- */
- TSize iSize;
-
- TThumbnailSize iThumbnailSize;
-
- /**
- * Request ID for this thumbnail request, session specific.
- */
- TThumbnailRequestId iRequestId;
-
- /**
- * Font and Bitmap Server session. Only used unless the client
- * does not already have an open session.
- */
- RFbsSession iFbsSession;
-
- /**
- * Temporary buffer for filename handling
- */
- TFileName iFileNameBuf;
-
- /**
- * List of supported MIME-types.
- * Own.
- */
- CDesCArraySeg* iMimeTypeList;
-};
-
-#endif
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestactive.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,541 +0,0 @@
-/*
-* 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: Active object for an asynchronous thumbnail request
- *
-*/
-
-
-#ifndef THUMBNAILREQUESTACTIVE_H
-#define THUMBNAILREQUESTACTIVE_H
-
-#include <e32base.h>
-
-#include "thumbnailpanic.h"
-#include "thumbnailmanager.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-
-class RFs;
-class CFbsBitmap;
-class RThumbnailSession;
-class CThumbnailDataImpl;
-class CThumbnailRequestQueue;
-
-enum TThumbnailReqType
- {
- EReqGetThumbnailHandle = 0,
- EReqGetThumbnailPath = 1,
- EReqSetThumbnailBuffer = 2,
- EReqSetThumbnailBitmap = 3,
- EReqUpdateThumbnails = 4,
- EReqGetThumbnailHandleLater = 5,
- EReqDeleteThumbnails = 6,
- EReqRenameThumbnails = 7,
- EReqSetThumbnailPath = 8
-};
-
-/**
- * Active object for an asynchronous thumbnail request.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbnailRequestActive ): public CActive
- {
-public:
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailRequestActive();
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @param aFs Fileserver used.
- * @param aThumbnailSession Session used.
- * @param aObserver Observer to receive notifications about completed operations.
- * @param aRequestObserver Observer to receive notifications about completed requests.
- * @param aId Assigned ID of the request, session specific.
- * @param aPriority assigned processing priority
- * @param aQueue request processor
- * @return New CThumbnailRequestActive object.
- */
- static CThumbnailRequestActive* NewL( RFs& aFs, RThumbnailSession&
- aThumbnailSession, MThumbnailManagerObserver& aObserver,
- MThumbnailManagerRequestObserver* aRequestObserver, TThumbnailRequestId aId,
- TInt aPriority, CThumbnailRequestQueue* aQueue );
-
- /**
- * Get a thumbnail created from file object.
- *
- * @since S60 v5.0
- * @param aFile File from which the thumbnail is to be created.
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aQualityPreference Quality preference value
- * @param aSize Requested size of the thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- */
- void GetThumbnailL( const RFile64& aFile, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
- CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager::TThumbnailQualityPreference
- aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode,
- const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri = KNullDesC,
- TThumbnailSize aThumbnailSize = EUnknownThumbnailSize );
-
- /**
- * Get a thumbnail opening file object later.
- *
- * @since S60 v5.0
- * @param aPath Path to file from which the thumbnail is to be created.
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aQualityPreference Quality preference value
- * @param aSize Requested size of the thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- */
- void GetThumbnailL( TThumbnailId aThumbnailId, const TDesC& aPath, const TDesC8& aMimeType,
- CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager::TThumbnailQualityPreference
- aQualityPreference, const TSize& aSize, const TDisplayMode aDisplayMode,
- const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri = KNullDesC,
- TThumbnailSize aThumbnailSize = EUnknownThumbnailSize );
-
- /**
- * Get a thumbnail created from file path.
- *
- * @since S60 v5.0
- * @param aPath Path to file from which the thumbnail is to be created.
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aQualityPreference Quality preference value
- * @param aSize Requested size of the thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aGeneratePersistentSizesOnly
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aThumbnailSize Relative thumbnail size
- */
- void GetThumbnailL( const TDesC& aPath, TThumbnailId aThumbnailId,
- const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
- CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
- const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority,
- TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri = KNullDesC, TThumbnailSize aThumbnailSize = EUnknownThumbnailSize );
-
- /**
- * Set a thumbnail
- *
- * @since S60 v5.0
- * @param aBuffer Buffer containing image where the thumbnail is to be created.
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aQualityPreference Quality preference value
- * @param aSize Requested size of the thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aGeneratePersistentSizesOnly
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aThumbnailSize Requested thumbnail size
- * @param aOverwrite Overwrite old existing thumbs
- */
- void SetThumbnailL( TDesC8* aBuffer, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
- CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
- ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
- TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite);
-
- /**
- * Set a thumbnail
- *
- * @since S60 v5.0
- * @param aBitmap Bitmap
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aQualityPreference Quality preference value
- * @param aSize Requested size of the thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aGeneratePersistentSizesOnly
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aThumbnailSize Requested thumbnail size
- * @param aOverwrite Overwrite old existing thumbs
- */
- void SetThumbnailL( CFbsBitmap* aBitmap, TThumbnailId aThumbnailId, const TDesC8& aMimeType,
- CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
- ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
- TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize, TBool aOverwrite);
-
- /**
- * Update thumbnails by Id.
- *
- * @since S60 v5.0
- * @param aPath Path to file from which the thumbnail is to be created.
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aQualityPreference Quality preference value
- * @param aSize Requested size of the thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aOrientation Thumbnail orientation
- * @param aModified Last modified
- */
- void UpdateThumbnailsL( const TDesC& aPath, const TThumbnailId aThumbnailId,
- CThumbnailManager::TThumbnailFlags aFlags,
- CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
- const TDisplayMode aDisplayMode, const TInt aPriority, const TInt aOrientation,
- const TInt64 aModified );
-
- /**
- * Delete thumbnails.
- *
- * @since S60 v5.0
- * @param aPath Path to file from which the thumbnail is to be created.
- * @param aPriority Priority of the request.
- */
- void DeleteThumbnails( const TDesC& aPath, const TThumbnailId aThumbnailId,
- const TInt aPriority );
-
- /**
- * Rename thumbnails.
- *
- * @since S60 v5.0
- * @param aCurrentPath Current path of the Thumbnail
- * @param aNewPath New path for the Thumbnail
- * @param aPriority Priority for this operation
- */
- void RenameThumbnails( const TDesC& aCurrentPath, const TDesC& aNewPath,
- const TInt aPriority );
-
- /**
- * Set thumbnail from file path.
- *
- * @param aPath Path to file from which the thumbnail is to be created.
- * @param aFile File from which the thumbnail is to be created.
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aQualityPreference Quality preference value
- * @param aSize Requested size of the thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aClientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param aGeneratePersistentSizesOnly
- * @param aOverwrite Overwrite old existing thumbs
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aThumbnailSize Relative thumbnail size
- */
- void SetThumbnailL( const TDesC& aPath, const TDesC8& aMimeType,
- CThumbnailManager::TThumbnailFlags aFlags,
- CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
- const TSize& aSize, const TDisplayMode aDisplayMode, const TInt aPriority,
- TAny* aClientData, TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri,
- TThumbnailSize aThumbnailSize, TBool aOverwrite);
-
- /**
- * Start active request.
- *
- * @since S60 v5.0
- */
- void StartL();
-
- /**
- * Change priority of a request.
- *
- * @since S60 v5.0
- * @param aNewPriority New priority.
- * @return Error code.
- */
- void ChangePriority( const TInt aNewPriority );
-
- /**
- * Returns ID of thumbnail request.
- *
- * @since S60 v5.0
- * @return Request ID
- */
- TThumbnailRequestId RequestId()const;
-
- /**
- * Is thumbnail request completed
- *
- * @since S60 v5.0
- */
- TBool RequestCompleted()const;
-
- /**
- * Is thumbnail request active
- *
- * @since S60 v5.0
- */
- TBool IsRequestActive()const;
-
- /**
- * Error handling function.
- *
- * @since S60 v5.0
- */
- void StartError( const TInt aErr );
-
- /**
- * Async cancel
- *
- * @since S60 v5.0
- */
- void AsyncCancel();
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aFs Fileserver used.
- * @param aThumbnailSession Session used.
- * @param aObserver Observer to receive notifications about completed operations.
- * @param aRequestObserver Observer to receive notifications about completed requests.
- * @param aId Assigned ID of the request, session specific.
- * @param aPriority assigned processing priority
- * @param aQueue request processor
- * @return New CThumbnailRequestActive object.
- */
- CThumbnailRequestActive( RFs& aFs, RThumbnailSession& aThumbnailSession,
- MThumbnailManagerObserver& aObserver, MThumbnailManagerRequestObserver* aRequestObserver,
- TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Handles an active object's request completion event.
- *
- * @since S60 v5.0
- */
- void RunL();
-
- /**
- * Handles a leave occurring in the request completion event handler
- * RunL().
- *
- * @since S60 v5.0
- * @param aError The leave code.
- * @return Error code.
- */
- TInt RunError( TInt aError );
-
- /**
- * Implements cancellation of an outstanding request.
- *
- * @since S60 v5.0
- */
- void DoCancel();
-
- /**
- * Release bitmap instance kept by server process.
- *
- * @since S60 v5.0
- */
- void ReleaseServerBitmap();
-
- /**
- * Error handling function.
- *
- * @since S60 v5.0
- */
- void HandleError();
-
- /**
- * Request 2nd phase thumbnail
- *
- * @since S60 v5.0
- */
- void Get2ndPhaseThumbnailL();
-
- /**
- * Callback for timeout timer
- *
- * @since S60 v5.0
- */
- static TInt TimerCallBack(TAny* aAny);
-
- /**
- * Checks if URI is virtual.
- */
- TBool IsVirtualUri( const TDesC& aPath );
-
-private:
- // data
-
- /**
- * Session.
- */
- RThumbnailSession& iSession;
-
- /**
- * Request parameters.
- */
- TThumbnailRequestParams iParams;
-
- /**
- * Package for request parameters.
- */
- TThumbnailRequestParamsPckg iParamsPckg;
-
- /**
- * Observer to receive notifications about completed operations.
- */
- MThumbnailManagerObserver& iObserver;
-
- /**
- * Observer to receive notifications about completed requests.
- */
- MThumbnailManagerRequestObserver* iRequestObserver;
-
- /**
- * Fileserver, not own
- */
- RFs& iFs;
-
- /**
- * Client data.
- */
- TAny* iClientData;
-
- /**
- * Callback, own.
- */
- CThumbnailDataImpl* iCallbackThumbnail;
-
- /**
- * Handle to bitmap, own.
- */
- TInt iBitmapHandle;
-
- /**
- * Error code.
- */
- TInt iError;
-
- /**
- * Request id of thumbnail request, session specific.
- */
- TThumbnailRequestId iRequestId;
-
- /**
- * Duplicated file handle for two phase operation
- */
- RFile64 iMyFileHandle;
-
- /**
- * If set, we are currently processing the preview thumbnail
- * of a two phase operation. If an error occurs, we can skip
- * directly to 2nd phase.
- */
- TBool iProcessingPreview;
-
- /**
- * If set, this request object can be deleted.
- */
- TBool iRequestCompleted;
-
- /**
- * If set, this request object is under processing
- */
- TBool iRequestActive;
-
- /**
- * Bitmap that is passed to server
- */
- CFbsBitmap* iBitmap;
-
- // for activating requests
- RFile64 iFile;
- TFileName iPath;
- TFileName iTargetUri;
- TInt iOrientation;
- TInt64 iModified;
-
- // not own
- CThumbnailRequestQueue* iRequestQueue;
-
- TThumbnailReqType iRequestType;
-
- // request timeout timer
- CPeriodic* iTimer;
- TInt iStartError;
-
- // request already canceled by client
- TBool iCanceled;
-
-#ifdef __RETRY_ON_SERVERCRASH
- //request retry count
- TUint iRetry;
-#endif
-
-#ifdef _DEBUG
- TTime iStartExecTime;
-#endif
-};
-
-#endif // THUMBNAILREQUESTACTIVE_H
-
-
-
-// INLINE FUNCTIONS
-
-inline TBool CThumbnailRequestActive::RequestCompleted()const
- {
- return iRequestCompleted;
- }
-
-inline TBool CThumbnailRequestActive::IsRequestActive()const
- {
- if(IsActive())
- {
- return ETrue;
- }
- return iRequestActive;
- }
-
-inline TThumbnailRequestId CThumbnailRequestActive::RequestId()const
- {
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- return iRequestId;
- }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailrequestqueue.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-* 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: Processor object for running thumbnail requests
-*
-*/
-
-
-#ifndef THUMBNAILREQUESTQUEUE_H
-#define THUMBNAILREQUESTQUEUE_H
-
-#include <e32base.h>
-
-#include "thumbnailmanager.h"
-
-class CThumbnailRequestActive;
-
-/**
- * Processor object for running queued tasks.
- *
- * @since S60 v5.0
- */
-class CThumbnailRequestQueue: public CBase
- {
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return Instance of CThumbnailRequestQueue.
- */
- static CThumbnailRequestQueue* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailRequestQueue();
-
- /**
- * Activates next request if possible.
- *
- * @since S60 v5.0
- */
- void Process();
-
- /**
- * Adds new request to the queue.
- *
- * @since S60 v5.0
- * @param aRequest Request to be added to the queue.
- */
- void AddRequestL( CThumbnailRequestActive* aRequest );
-
- /**
- * Cancels request in the queue.
- *
- * @since S60 v5.0
- * @param aId Request to be canceled.
- * @return Error code.
- */
- TInt CancelRequest( const TThumbnailRequestId aId );
-
- /**
- * Change priority of a request.
- *
- * @since S60 v5.0
- * @param aId Request to be canceled.
- * @param aNewPriority New priority.
- * @return Error code.
- */
- TInt ChangePriority( const TThumbnailRequestId aId, const TInt aNewPriority );
-
- /**
- * Marks request complete.
- *
- * @since S60 v5.0
- */
- void RequestComplete(CThumbnailRequestActive* aRequestAO = NULL);
-
- /**
- * Removes completed requests.
- *
- * @since S60 v5.0
- */
- void RemoveCompleted(CThumbnailRequestActive* aRequestAO);
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return Instance of CThumbnailRequestQueue.
- */
- CThumbnailRequestQueue();
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
-
- /**
- * Array of active objects for each pending thumbnail request.
- */
- RPointerArray <CThumbnailRequestActive> iRequests;
-
- // number of currently active requests
- TInt iActiveRequests;
-
-};
-
-#endif // THUMBNAILREQUESTQUEUE_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/inc/thumbnailsession.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
-* 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: Thumbnail server client-side session
- *
-*/
-
-
-#ifndef THUMBNAILSESSION_H
-#define THUMBNAILSESSION_H
-
-#include <e32base.h>
-
-#include "thumbnailmanagerconstants.h"
-
-/**
- * Thumbnail server client-side session
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( RThumbnailSession ): public RSessionBase
- {
-public:
-
- /**
- * C++ default constructor.
- *
- * @since S60 v5.0
- * @return New RThumbnailSession session.
- */
- RThumbnailSession();
-
- /**
- * Connect to server process.
- *
- * @since S60 v5.0
- * @return Error code.
- */
- TInt Connect();
-
- /**
- * Close session.
- *
- * @since S60 v5.0
- */
- void Close();
-
- /**
- * Version info.
- *
- * @since S60 v5.0
- * @return Version of client.
- */
- TVersion Version();
-
- /**
- * Request a thumbnail for an object file.
- *
- * @since S60 v5.0
- * @param aFile File from which the thumbnail is to be created.
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aParams Package for request parameters.
- * @param aStatus Status of the request.
- */
- void RequestThumbnailL( const RFile64& aFile, const TDesC& aTargetUri, TThumbnailRequestParamsPckg&
- aParams, TRequestStatus& aStatus );
-
- /**
- * Request a thumbnail for an object file.
- *
- * @since S60 v5.0
- * @param aPath Path of image from which the thumbnail is to be created.
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aParams Package for request parameters.
- * @param aStatus Status of the request.
- */
- void RequestThumbnailL( const TDesC& aPath, const TDesC& aTargetUri, const TThumbnailId aThumbnailId, TThumbnailRequestParamsPckg&
- aParams, TRequestStatus& aStatus );
-
- /**
- * Request a thumbnail for an object file.
- *
- * @since S60 v5.0
- * @param aThumbnailId Thumbnail ID
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aParams Package for request parameters.
- * @param aStatus Status of the request.
- */
- void RequestThumbnailL( const TThumbnailId aThumbnailId, const TDesC& aTargetUri,
- TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus );
-
- /**
- * Request set thumbnail for an object file.
- *
- * @since S60 v5.0
- * @param aBuffer buffer from which the thumbnail is to be created.
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aParams Package for request parameters.
- * @param aStatus Status of the request.
- */
- void RequestSetThumbnailL(
- TDesC8* aBuffer, const TDesC& aTargetUri,
- TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus );
-
- /**
- * Request set thumbnail for an object file.
- *
- * @since S60 v5.0
- * @param aBitmapHandle Bitmap handle
- * @param aTargetUri Target URI to which the imported thumbnail is linked.
- * @param aParams Package for request parameters.
- * @param aStatus Status of the request.
- */
- void RequestSetThumbnailL(
- TInt aBitmapHandle, const TDesC& aTargetUri,
- TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus );
-
- /**
- * Release bitmap instance kept by server process.
- *
- * @since S60 v5.0
- * @param aBitmapHandle Handle to bitmap.
- */
- void ReleaseBitmap( TInt aBitmapHandle );
-
- /**
- * Cancel pending thumbnail request.
- *
- * @since S60 v5.0
- * @param aRequestId Session specific thumbnail request ID.
- * @return Error code.
- */
- TInt CancelRequest( TThumbnailRequestId aRequestId );
-
- /**
- * Change priority of pending thumbnail request.
- *
- * @since S60 v5.0
- * @param aRequestId Session specific thumbnail request ID.
- * @param aNewPriority New priority to be set for the request.
- * @return Error code.
- */
- TInt ChangePriority( TThumbnailRequestId aRequestId, TInt aNewPriority );
-
- /**
- * Delete thumbnails.
- *
- * @since S60 v5.0
- * @param aPath Path to media object whose thumbnails should be deleted.
- */
- void DeleteThumbnails( const TDesC& aPath, TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus );
-
- /**
- * Delete thumbnails.
- *
- * @since S60 v5.0
- * @param aItemId Id of item whose thumbnails should be deleted.
- */
- void DeleteThumbnails( const TThumbnailId aItemId, TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus );
-
- /**
- * Get a list of supported MIME types in a HBufC. The list is space
- * delimited.
- *
- * @since S60 v5.0
- * @return MIME type list. Ownership transferred to called.
- */
- HBufC* GetMimeTypeListL();
-
- /**
- * Update thumbnails.
- *
- * @since S60 v5.0
- * @param aPath (New) path for the Thumbnail
- * @param aOrientation Thumbnail orientation
- * @param aModified Last modified
- */
- void UpdateThumbnails( const TDesC& aPath, const TInt aOrientation, const TInt64 aModified,
- TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus);
-
- /**
- * Rename thumbnails.
- *
- * @since S60 v5.0
- */
- void RenameThumbnails( TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus );
-
-private:
-
- /**
- * Launch server process.
- *
- * @since S60 v5.0
- * @return Error code.
- */
- TInt StartServer();
-
-};
-
-#endif // THUMBNAILSESSION_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnaildataimpl.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
-* 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: Thumbnail object implementation.
- *
-*/
-
-
-#include <fbs.h>
-
-#include "thumbnaildataimpl.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnaildataimplTraces.h"
-#endif
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailDataImpl::CThumbnailDataImpl()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailDataImpl::CThumbnailDataImpl()
- {
- OstTrace0( TRACE_NORMAL, CTHUMBNAILDATAIMPL_CTHUMBNAILDATAIMPL, "CThumbnailDataImpl::CThumbnailDataImpl" );
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDataImpl::~CThumbnailDataImpl()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailDataImpl::~CThumbnailDataImpl()
- {
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILDATAIMPL_CTHUMBNAILDATAIMPL, "CThumbnailDataImpl::~CThumbnailDataImpl" );
- delete iBitmap;
- iBitmap = NULL;
- iClientData = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDataImpl::Bitmap()
-// Get a pointer to a CFbsBitmap containing the thumbnail image.
-// ---------------------------------------------------------------------------
-//
-CFbsBitmap* CThumbnailDataImpl::Bitmap()
- {
- OstTrace0( TRACE_NORMAL, CTHUMBNAILDATAIMPL_BITMAP, "CThumbnailDataImpl::Bitmap" );
- return iBitmap;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDataImpl::DetachBitmap()
-// Get a pointer to a CFbsBitmap containing the thumbnail image.
-// ---------------------------------------------------------------------------
-//
-CFbsBitmap* CThumbnailDataImpl::DetachBitmap()
- {
- OstTrace0( TRACE_NORMAL, CTHUMBNAILDATAIMPL_DETACHBITMAP, "CThumbnailDataImpl::DetachBitmap" );
- CFbsBitmap* ret = iBitmap;
- iBitmap = NULL; // client owns it now
- return ret;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDataImpl::ClientData()
-// Get client data structure.
-// ---------------------------------------------------------------------------
-//
-TAny* CThumbnailDataImpl::ClientData()
- {
- OstTrace0( TRACE_NORMAL, CTHUMBNAILDATAIMPL_CLIENTDATA, "CThumbnailDataImpl::ClientData" );
- return iClientData;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDataImpl::Set
-// Sets the thumbnail object.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDataImpl::Set( CFbsBitmap* aBitmap, TAny* aClientData )
- {
- OstTrace0( TRACE_NORMAL, CTHUMBNAILDATAIMPL_SET, "CThumbnailDataImpl::Set" );
- delete iBitmap;
- iBitmap = aBitmap;
- iClientData = aClientData;
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanager.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* 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: Main interface class to Thumbnail Manager.
- *
-*/
-
-
-#include "thumbnailmanagerimpl.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailManager* CThumbnailManager::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CThumbnailManager* CThumbnailManager::NewL( MThumbnailManagerObserver&
- aObserver )
- {
- CThumbnailManager* self = CThumbnailManagerImpl::NewLC( aObserver );
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManager* CThumbnailManager::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CThumbnailManager* CThumbnailManager::NewLC(
- MThumbnailManagerObserver& aObserver )
- {
- return CThumbnailManagerImpl::NewLC( aObserver );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManager::~CThumbnailManager()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailManager::~CThumbnailManager()
- {
- // No implementation required
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailmanagerimpl.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,775 +0,0 @@
-/*
-* 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: Implementation class of Thumbnail Manager.
- *
-*/
-
-
-#include <e32base.h>
-#include <akniconconfig.h>
-#include <fbs.h>
-#include <badesca.h>
-#include <centralrepository.h>
-
-#include <thumbnailmanager.h>
-
-#include "thumbnailmanagerimpl.h"
-#include "thumbnailrequestactive.h"
-#include "thumbnailprovider.h"
-#include "thumbnailsession.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnailmanagerprivatecrkeys.h"
-#include "thumbnailpanic.h"
-
-#include "thumbnaildata.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailmanagerimplTraces.h"
-#endif
-
-
-const TInt KThumbnailMimeTypeListGranularity = 8;
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::~CThumbnailManagerImpl()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailManagerImpl::~CThumbnailManagerImpl()
- {
- TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - start" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_CTHUMBNAILMANAGERIMPL, "CThumbnailManagerImpl::~CThumbnailManagerImpl - start" );
-
- delete iRequestQueue;
- iRequestQueue = NULL;
-
- iSession.Close();
- iFs.Close();
-
- // Check if we need to disconnect Fbs
- TInt sessionCount = (TInt)Dll::Tls();
- if ( sessionCount > 0)
- {
- if( --sessionCount == 0 )
- {
- TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - Disconnect FBS" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILMANAGERIMPL_CTHUMBNAILMANAGERIMPL, "CThumbnailManagerImpl::~CThumbnailManagerImpl - Disconnect FBS" );
- iFbsSession.Disconnect();
- }
- TN_DEBUG2( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - update sessionCount == %d to TLS", sessionCount );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILMANAGERIMPL_CTHUMBNAILMANAGERIMPL, "CThumbnailManagerImpl::~CThumbnailManagerImpl - update sessionCount == %d to TLS", sessionCount );
- Dll::SetTls( (TAny*)sessionCount );
- }
-
- delete iMimeTypeList;
- iMimeTypeList = NULL;
-
- TN_DEBUG1( "CThumbnailManagerImpl::~CThumbnailManagerImpl() - end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILMANAGERIMPL_CTHUMBNAILMANAGERIMPL, "CThumbnailManagerImpl::~CThumbnailManagerImpl - end" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailManagerImpl* CThumbnailManagerImpl::NewLC( MThumbnailManagerObserver&
- aObserver )
- {
- CThumbnailManagerImpl* self = new( ELeave )CThumbnailManagerImpl( aObserver );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::CThumbnailManagerImpl()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailManagerImpl::CThumbnailManagerImpl( MThumbnailManagerObserver&
- aObserver ): iObserver( aObserver ), iRequestObserver( NULL ), iDisplayMode(
- KThumbnailDefaultDisplayMode ), iFlags( EDefaultFlags ), iQualityPreference
- ( EOptimizeForQuality ), iRequestId( 0 )
- {
- // No implementation required
- TN_DEBUG1( "CThumbnailManagerImpl::CThumbnailManagerImpl()" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILMANAGERIMPL_CTHUMBNAILMANAGERIMPL, "CThumbnailManagerImpl::CThumbnailManagerImpl" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::ConstructL()
- {
- TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - start");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_CONSTRUCTL, "CThumbnailManagerImpl::ConstructL - start" );
-
- User::LeaveIfError( iSession.Connect());
- User::LeaveIfError( iFs.Connect());
- User::LeaveIfError( iFs.ShareProtected());
-
- if ( !RFbsSession::GetSession() )
- {
- // We need to connect to Fbs (first user in this thread)
- // Maintain a reference count in TLS
- User::LeaveIfError( iFbsSession.Connect());
- Dll::SetTls( (TAny*)1 );
- TN_DEBUG2( "CThumbnailManagerImpl::ConstructL() - update sessionCount == %d to TLS", 1 );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMANAGERIMPL_CONSTRUCTL, "CThumbnailManagerImpl::ConstructL - update sessionCount == %d to TLS", 1 );
- }
- else
- {
- TInt sessionCount = (TInt)Dll::Tls();
- if( sessionCount++ > 0 )
- {
- // Increase the reference count in TLS
- Dll::SetTls( (TAny*)sessionCount );
- TN_DEBUG2( "CThumbnailManagerImpl::ConstructL() - update sessionCount == %d to TLS", sessionCount );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILMANAGERIMPL_CONSTRUCTL, "CThumbnailManagerImpl::ConstructL - update sessionCount == %d to TLS", sessionCount );
- }
- else
- {
- // Fbs connection was available in the beginning, no need to
- // increase the reference count
- TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - no need to update sessionCount");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILMANAGERIMPL_CONSTRUCTL, "CThumbnailManagerImpl::ConstructL - no need to update sessionCount" );
- }
- }
-
- // request processor
- iRequestQueue = CThumbnailRequestQueue::NewL();
-
- TN_DEBUG1( "CThumbnailManagerImpl::ConstructL - end");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILMANAGERIMPL_CONSTRUCTL, "CThumbnailManagerImpl::ConstructL - end" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::GetThumbnailL
-// Get a thumbnail for an object file.
-// ---------------------------------------------------------------------------
-//
-TThumbnailRequestId CThumbnailManagerImpl::GetThumbnailL(
- CThumbnailObjectSource& aObjectSource, TAny* aClientData /*= NULL*/, const
- TInt aPriority, TBool aGeneratePersistentSizesOnly)
- {
- iRequestId++;
- TN_DEBUG4( "CThumbnailManagerImpl::GetThumbnailL() URI==%S, iThumbnailSize==%d, req %d", &aObjectSource.Uri(), iThumbnailSize, iRequestId );
- OstTraceExt3( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_GETTHUMBNAILL, "CThumbnailManagerImpl::GetThumbnailL;aObjectSource.Uri()=%S;iThumbnailSize=%d;iRequestId=%d", aObjectSource.Uri(), iThumbnailSize, iRequestId );
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aPriority);
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
- CleanupStack::PushL( getThumbnailActive );
-
- if(aObjectSource.Id() > 0)
- {
- getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(),
- aObjectSource.MimeType(),iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, aGeneratePersistentSizesOnly, KNullDesC, iThumbnailSize);
- }
- else if ( aObjectSource.Uri().Length())
- {
- getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(),
- aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, aGeneratePersistentSizesOnly, KNullDesC, iThumbnailSize );
- }
- else
- {
- getThumbnailActive->GetThumbnailL( aObjectSource.FileHandle(), aObjectSource.Id(),
- aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, aGeneratePersistentSizesOnly, KNullDesC, iThumbnailSize );
- }
-
- iRequestQueue->AddRequestL( getThumbnailActive );
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
-
- TN_DEBUG2( "CThumbnailManagerImpl::GetThumbnailL() - request ID: %d", iRequestId );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMANAGERIMPL_GETTHUMBNAILL, "CThumbnailManagerImpl::GetThumbnailL;iRequestId=%u", iRequestId );
-
- return iRequestId;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::GetThumbnailL
-// Get a thumbnail for an object file.
-// ---------------------------------------------------------------------------
-//
-TThumbnailRequestId CThumbnailManagerImpl::GetThumbnailL(
- CThumbnailObjectSource& aObjectSource, TAny* aClientData /*= NULL*/, const
- TInt aPriority )
- {
- return GetThumbnailL( aObjectSource, aClientData, aPriority, EFalse );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::GetThumbnailL
-// Get a thumbnail for an object file.
-// ---------------------------------------------------------------------------
-//
-TThumbnailRequestId CThumbnailManagerImpl::GetThumbnailL( const TThumbnailId
- aThumbnailId, TAny* aClientData /*= NULL*/, TInt aPriority)
- {
- iRequestId++;
- TN_DEBUG4( "CThumbnailManagerImpl::GetThumbnailL() aThumbnailId==%d, iThumbnailSize==%d, req %d", aThumbnailId, iThumbnailSize, iRequestId );
- OstTraceExt3( TRACE_NORMAL, DUP2_CTHUMBNAILMANAGERIMPL_GETTHUMBNAILL, "CThumbnailManagerImpl::GetThumbnailL;aThumbnailId=%u;iThumbnailSize=%u;iRequestId=%u", aThumbnailId, iThumbnailSize, iRequestId );
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aPriority);
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
- CleanupStack::PushL( getThumbnailActive );
-
- getThumbnailActive->GetThumbnailL( KNullDesC, aThumbnailId, KNullDesC8,
- iFlags, iQualityPreference, iSize, iDisplayMode, priority, aClientData,
- EFalse, KNullDesC, iThumbnailSize );
-
- iRequestQueue->AddRequestL( getThumbnailActive );
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
-
- TN_DEBUG2( "CThumbnailManagerImpl::GetThumbnailL() - request ID: %d", iRequestId );
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILMANAGERIMPL_GETTHUMBNAILL, "CThumbnailManagerImpl::GetThumbnailL;iRequestId=%u", iRequestId );
-
- return iRequestId;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::ImportThumbnailL
-// Import an image to be used as thumbnail for an object.
-// ---------------------------------------------------------------------------
-//
-TThumbnailRequestId CThumbnailManagerImpl::ImportThumbnailL(
- CThumbnailObjectSource& aObjectSource, const TDesC& aTargetUri,
- TAny* aClientData /*= NULL*/, const TInt aPriority)
- {
- iRequestId++;
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aPriority);
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
- CleanupStack::PushL( getThumbnailActive );
-
- if ( aObjectSource.Uri().Length())
- {
- getThumbnailActive->GetThumbnailL( aObjectSource.Uri(), aObjectSource.Id(),
- aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, EFalse, aTargetUri, iThumbnailSize );
- }
- else
- {
- getThumbnailActive->GetThumbnailL( aObjectSource.FileHandle(), aObjectSource.Id(),
- aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, EFalse, aTargetUri, iThumbnailSize );
- }
-
- iRequestQueue->AddRequestL( getThumbnailActive );
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
-
- TN_DEBUG2( "CThumbnailManagerImpl::ImportThumbnailL() - request ID: %d", iRequestId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_IMPORTTHUMBNAILL, "CThumbnailManagerImpl::ImportThumbnailL;iRequestId=%u", iRequestId );
-
- return iRequestId;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::SetThumbnailL
-// Import an image to be used as thumbnail for an object.
-// ---------------------------------------------------------------------------
-//
-TThumbnailRequestId CThumbnailManagerImpl::SetThumbnailL( CThumbnailObjectSource& aObjectSource,
- TAny* aClientData, TInt aPriority )
- {
- iRequestId++;
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aPriority);
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
- CleanupStack::PushL( getThumbnailActive );
-
- if (aObjectSource.Uri().Length() &&
- aObjectSource.TargetUri().Length())
- {
- // from path
- getThumbnailActive->SetThumbnailL( aObjectSource.Uri(),
- aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, ETrue, aObjectSource.TargetUri(), iThumbnailSize, ETrue);
- }
- else if (aObjectSource.Uri().Length() &&
- aObjectSource.Bitmap() != NULL)
- {
- // from bitmap
- getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(),
- aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, ETrue, aObjectSource.Uri(), iThumbnailSize, ETrue);
- }
- else if (aObjectSource.Uri().Length() &&
- aObjectSource.Buffer() != NULL &&
- aObjectSource.MimeType() != KNullDesC8)
- {
- // from buffer
- getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(), aObjectSource.Id(),
- aObjectSource.MimeType(), iFlags, iQualityPreference, iSize, iDisplayMode,
- priority, aClientData, ETrue, aObjectSource.Uri(), iThumbnailSize, ETrue);
- }
-
- iRequestQueue->AddRequestL( getThumbnailActive );
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
-
- TN_DEBUG2( "CThumbnailManagerImpl::SetThumbnailL() - request ID: %d", iRequestId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_SETTHUMBNAILL, "CThumbnailManagerImpl::SetThumbnailL;iRequestId=%u", iRequestId );
-
- return iRequestId;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::CreateThumbnails
-// Create persistent size thumbnails for an object.
-// ---------------------------------------------------------------------------
-//
-TThumbnailRequestId CThumbnailManagerImpl::CreateThumbnails(
- CThumbnailObjectSource& aObjectSource, TInt aPriority )
- {
- TRAPD(err,
- TN_DEBUG2( "CThumbnailManagerImpl::CreateThumbnails() aObjectSource==%S ", &aObjectSource.Uri() );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_CREATETHUMBNAILS, "CThumbnailManagerImpl::CreateThumbnails;aObjectSource.Uri()=%S", aObjectSource.Uri() );
- iRequestId++;
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aPriority);
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
-
- CleanupStack::PushL( getThumbnailActive );
-
- if (aObjectSource.Bitmap())
- {
- // from bitmap
- getThumbnailActive->SetThumbnailL( aObjectSource.GetBitmapOwnership(),
- aObjectSource.Id(), KBmpMime, iFlags, iQualityPreference,
- iSize, iDisplayMode, priority, NULL, ETrue,
- aObjectSource.Uri(), EUnknownThumbnailSize, EFalse);
- }
- else if( !aObjectSource.Buffer() )
- {
- getThumbnailActive->GetThumbnailL( aObjectSource.Id(),
- aObjectSource.Uri(), aObjectSource.MimeType(), iFlags,
- iQualityPreference, iSize, iDisplayMode, priority, NULL,
- ETrue, aObjectSource.Uri(), EUnknownThumbnailSize);
- }
- else
- {
- // from buffer
- getThumbnailActive->SetThumbnailL( aObjectSource.GetBufferOwnership(),
- aObjectSource.Id(), aObjectSource.MimeType(), iFlags,
- iQualityPreference, iSize, iDisplayMode, priority, NULL,
- ETrue, aObjectSource.Uri(), EUnknownThumbnailSize, EFalse);
- }
-
- iRequestQueue->AddRequestL( getThumbnailActive );
-
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
-
- TN_DEBUG2( "CThumbnailManagerImpl::CreateThumbnails() - request ID: %d", iRequestId );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMANAGERIMPL_CREATETHUMBNAILS, "CThumbnailManagerImpl::CreateThumbnails;iRequestId=%u", iRequestId );
- );
-
- if( err != KErrNone)
- {
- return err;
- }
-
- return iRequestId;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::DisplayMode()
-// Get the current display mode for thumbnail bitmaps.
-// ---------------------------------------------------------------------------
-//
-TDisplayMode CThumbnailManagerImpl::DisplayMode()const
- {
- return iDisplayMode;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::SetDisplayModeL()
-// Set the current display mode for thumbnail bitmaps.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::SetDisplayModeL( const TDisplayMode aDisplayMode )
- {
- iDisplayMode = aDisplayMode;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::QualityPreference()
-// Get the current quality versus performance preference.
-// ---------------------------------------------------------------------------
-//
-CThumbnailManager::TThumbnailQualityPreference CThumbnailManagerImpl
- ::QualityPreference()const
- {
- return iQualityPreference;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::SetQualityPreferenceL()
-// Set quality versus performance preference.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::SetQualityPreferenceL( const
- TThumbnailQualityPreference aQualityPreference )
- {
- iQualityPreference = aQualityPreference;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::ThumbnailSize()
-// Get the current desired size for thumbnail bitmaps.
-// ---------------------------------------------------------------------------
-//
-const TSize& CThumbnailManagerImpl::ThumbnailSize()const
- {
- return iSize;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::SetThumbnailSizeL()
-// Set desired size for thumbnail bitmaps.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::SetThumbnailSizeL( const TSize& aThumbnailSize )
- {
- iSize = aThumbnailSize;
- iThumbnailSize = ECustomThumbnailSize;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::SetThumbnailSizeL()
-// Set desired size for thumbnail bitmaps.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::SetThumbnailSizeL( const TThumbnailSize aThumbnailSize )
- {
- iThumbnailSize = aThumbnailSize;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::Flags()
-// Get current flags for thumbnail generation.
-// ---------------------------------------------------------------------------
-//
-CThumbnailManager::TThumbnailFlags CThumbnailManagerImpl::Flags()const
- {
- return iFlags;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::SetFlagsL()
-// Set flags for thumbnail generation. Several flags may be enabled
-// by combining the values using bitwise or.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::SetFlagsL( const TThumbnailFlags aFlags )
- {
- iFlags = aFlags;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::DeleteThumbnails()
-// Delete all thumbnails for a given object.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::DeleteThumbnails( CThumbnailObjectSource&
- aObjectSource )
- {
- TRAP_IGNORE(
- iRequestId++;
- TN_DEBUG2( "CThumbnailManagerImpl::DeleteThumbnails() URI==%S ", &aObjectSource.Uri() );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_DELETETHUMBNAILS, "CThumbnailManagerImpl::DeleteThumbnails;aObjectSource.Uri()=%S", aObjectSource.Uri() );
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle,
- iRequestQueue );
-
- CleanupStack::PushL( getThumbnailActive );
-
- const TDesC& uri = aObjectSource.Uri();
-
- if ( uri.Length())
- {
- getThumbnailActive->DeleteThumbnails( uri, 0, CActive::EPriorityIdle );
- }
- else
- {
- TInt err = aObjectSource.FileHandle().FullName( iFileNameBuf );
- if ( !err )
- {
- getThumbnailActive->DeleteThumbnails( iFileNameBuf, 0, CActive::EPriorityIdle );
- }
- }
-
- iRequestQueue->AddRequestL( getThumbnailActive );
-
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
- );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::DeleteThumbnailsL()
-// Delete thumbnails by TThumbnailId.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::DeleteThumbnails( const TThumbnailId aItemId )
- {
- TRAP_IGNORE(
- iRequestId++;
- TN_DEBUG2( "CThumbnailManagerImpl::DeleteThumbnails() aItemId==%d ", aItemId );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMANAGERIMPL_DELETETHUMBNAILS, "CThumbnailManagerImpl::DeleteThumbnails;aItemId=%u", aItemId );
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, CActive::EPriorityIdle,
- iRequestQueue );
-
- CleanupStack::PushL( getThumbnailActive );
-
- getThumbnailActive->DeleteThumbnails( KNullDesC, aItemId, CActive::EPriorityIdle );
-
- iRequestQueue->AddRequestL( getThumbnailActive );
-
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
- );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::CancelRequest()
-// Cancel a thumbnail operation.
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailManagerImpl::CancelRequest( const TThumbnailRequestId aId )
- {
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TN_DEBUG2( "CThumbnailManagerImpl::CancelRequest() - request ID: %d", aId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_CANCELREQUEST, "CThumbnailManagerImpl::CancelRequest;aId=%u", aId );
-
- return iRequestQueue->CancelRequest(aId);
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::ChangePriority()
-// Change the priority of a queued thumbnail operation.
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailManagerImpl::ChangePriority( const TThumbnailRequestId aId,
- const TInt aNewPriority )
- {
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aNewPriority);
-
- TN_DEBUG2( "CThumbnailManagerImpl::ChangePriority() - request ID: %d", aId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_CHANGEPRIORITY, "CThumbnailManagerImpl::ChangePriority;aId=%u", aId );
-
- return iRequestQueue->ChangePriority(aId, priority);
- }
-
-// ---------------------------------------------------------------------------
-// Get the list of supported file systems from server
-// ---------------------------------------------------------------------------
-//
-const CDesCArray& CThumbnailManagerImpl::GetSupportedMimeTypesL()
- {
- if ( !iMimeTypeList )
- {
- iMimeTypeList = new( ELeave )CDesCArraySeg(
- KThumbnailMimeTypeListGranularity );
- HBufC* buf = iSession.GetMimeTypeListL();
- CleanupStack::PushL( buf );
- TLex lex( *buf );
- while ( !lex.Eos())
- {
- iMimeTypeList->AppendL( lex.NextToken());
- }
- CleanupStack::PopAndDestroy( buf );
- }
- return * iMimeTypeList;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::UpdateThumbnails()
-// Update thumbnails by given ID
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::UpdateThumbnailsL( const TThumbnailId aItemId, const TDesC& aPath,
- const TInt aOrientation, const TInt64 aModified,
- TInt aPriority )
- {
- iRequestId++;
- TN_DEBUG4( "CThumbnailManagerImpl::UpdateThumbnailsL() URI==%S, aItemId==%d, req %d", &aPath, aItemId, iRequestId);
- OstTraceExt3( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_UPDATETHUMBNAILSL, "CThumbnailManagerImpl::UpdateThumbnailsL;aPath=%S;aItemId=%d;iRequestId=%d", aPath, aItemId, iRequestId );
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aPriority);
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
- CleanupStack::PushL( getThumbnailActive );
-
- getThumbnailActive->UpdateThumbnailsL( aPath, aItemId, iFlags, iQualityPreference,
- iDisplayMode, priority, aOrientation, aModified );
-
- iRequestQueue->AddRequestL( getThumbnailActive );
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::RenameThumbnailsL()
-// Renames thumbnails by given path
-// ---------------------------------------------------------------------------
-//
-TThumbnailRequestId CThumbnailManagerImpl::RenameThumbnailsL( const TDesC& aCurrentPath,
- const TDesC& aNewPath, TInt aPriority )
- {
- iRequestId++;
- TN_DEBUG3( "CThumbnailManagerImpl::RenameThumbnailsL() URI==%S, req %d", &aCurrentPath, iRequestId);
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_RENAMETHUMBNAILSL, "CThumbnailManagerImpl::RenameThumbnailsL;aCurrentPath=%S", aCurrentPath );
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- TInt priority = ValidatePriority(aPriority);
-
- CThumbnailRequestActive* getThumbnailActive = CThumbnailRequestActive::NewL
- ( iFs, iSession, iObserver, iRequestObserver, iRequestId, priority, iRequestQueue );
- CleanupStack::PushL( getThumbnailActive );
-
- getThumbnailActive->RenameThumbnails( aCurrentPath, aNewPath, priority );
-
- iRequestQueue->AddRequestL( getThumbnailActive );
- CleanupStack::Pop( getThumbnailActive );
-
- iRequestQueue->Process();
-
- return iRequestId;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::SetRequestObserver()
-// Adds optional request observer
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::SetRequestObserver( MThumbnailManagerRequestObserver& aObserver )
- {
- iRequestObserver = NULL;
- iRequestObserver = &aObserver;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::RemoveRequestObserver()
-// Removes optional request observer
-// ---------------------------------------------------------------------------
-//
-void CThumbnailManagerImpl::RemoveRequestObserver()
- {
- if (iRequestObserver)
- {
- iRequestObserver = NULL;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailManagerImpl::ValidatePriority()
-// Check that given priority is in range of CActive::TPriority
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailManagerImpl::ValidatePriority( const TInt aPriority )
- {
- if (aPriority < CActive::EPriorityIdle)
- {
- TN_DEBUG2( "CThumbnailManagerImpl::ValidatePriority() - priority %d too low for CActive", aPriority );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMANAGERIMPL_VALIDATEPRIORITY, "CThumbnailManagerImpl::ValidatePriority - priority too low for CActive;aPriority=%d", aPriority );
- return CActive::EPriorityIdle;
- }
- else if (aPriority > CActive::EPriorityHigh)
- {
- TN_DEBUG2( "CThumbnailManagerImpl::ValidatePriority() - priority %d too high for CActive", aPriority );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMANAGERIMPL_VALIDATEPRIORITY, "CThumbnailManagerImpl::ValidatePriority - priority too high for CActive;aPriority=%d", aPriority );
- return CActive::EPriorityHigh;
- }
- else
- {
- return aPriority;
- }
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailobjectsource.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-/*
-* 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: Class for encapsulating the data source for objects.
- *
-*/
-
-#include <fbs.h>
-
-#include "thumbnailobjectsource.h"
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::NewL()
-// CThumbnailObjectSource::NewLC()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC&
- aUri, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri,
- aMimeType );
- CleanupStack::Pop( self );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC&
- aUri, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
- CleanupStack::PushL( self );
- self->ConstructL( aUri, aMimeType );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const RFile64&
- aFile, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aFile,
- aMimeType );
- CleanupStack::Pop( self );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const RFile64&
- aFile, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
- CleanupStack::PushL( self );
- self->ConstructL( aFile, aMimeType );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( CFbsBitmap* aBitmap,
- const TDesC& aUri )
- {
- CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBitmap, aUri );
- CleanupStack::Pop( self );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( CFbsBitmap* aBitmap,
- const TDesC& aUri )
- {
- CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
- CleanupStack::PushL( self );
- self->ConstructL( aBitmap, aUri );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( TDesC8* aBuffer,
- TDesC& aMimeType, const TDesC& aUri)
- {
- CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aBuffer,
- aMimeType, aUri );
- CleanupStack::Pop( self );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( TDesC8* aBuffer,
- TDesC& aMimeType, const TDesC& aUri)
- {
- CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
- CleanupStack::PushL( self );
- self->ConstructL( aBuffer, aMimeType, aUri );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC&
- aUri, const TThumbnailId aThumbnailId, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri,
- aThumbnailId, aMimeType );
- CleanupStack::Pop( self );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri,
- const TThumbnailId aThumbnailId, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
- CleanupStack::PushL( self );
- self->ConstructL( aUri, aMimeType, aThumbnailId );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewL( const TDesC& aUri,
- const TDesC& aTargetUri, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = CThumbnailObjectSource::NewLC( aUri, aTargetUri,
- aMimeType );
- CleanupStack::Pop( self );
- return self;
- }
-
-EXPORT_C CThumbnailObjectSource* CThumbnailObjectSource::NewLC( const TDesC& aUri,
- const TDesC& aTargetUri, const TDesC& aMimeType )
- {
- CThumbnailObjectSource* self = new( ELeave )CThumbnailObjectSource();
- CleanupStack::PushL( self );
- self->ConstructL( aUri, aTargetUri, aMimeType );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::CThumbnailObjectSource()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailObjectSource::CThumbnailObjectSource()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailObjectSource::ConstructL( const TDesC& aUri, const TDesC&
- aMimeType)
- {
- iUri = aUri.AllocL();
- iMimeType = HBufC8::NewL( aMimeType.Length() );
- iMimeType->Des().Copy( aMimeType );
- iThumbnailId = 0;
- iBitmap = NULL;
- iTargetUri = NULL;
- }
-
-void CThumbnailObjectSource::ConstructL( const RFile64& aFile, const TDesC&
- aMimeType )
- {
- iFile = aFile;
- iMimeType = HBufC8::NewL( aMimeType.Length() );
- iMimeType->Des().Copy( aMimeType );
- iThumbnailId = 0;
- iBitmap = NULL;
- iTargetUri = NULL;
- }
-
-void CThumbnailObjectSource::ConstructL( CFbsBitmap* aBitmap, const TDesC&
- aUri )
- {
- iBitmap = aBitmap;
- iUri = aUri.AllocL();
- iThumbnailId = 0;
- iTargetUri = NULL;
- }
-
-void CThumbnailObjectSource::ConstructL( TDesC8* aBuffer, const TDesC&
- aMimeType, const TDesC& aUri )
- {
- iBuffer = aBuffer;
- iMimeType = HBufC8::NewL( aMimeType.Length() );
- iMimeType->Des().Copy( aMimeType );
- iUri = aUri.AllocL();
- iThumbnailId = 0;
- iBitmap = NULL;
- iTargetUri = NULL;
- }
-
-void CThumbnailObjectSource::ConstructL( const TDesC& aUri, const TDesC&
- aMimeType, TThumbnailId aThumbnailId )
- {
- iUri = aUri.AllocL();
- iMimeType = HBufC8::NewL( aMimeType.Length() );
- iMimeType->Des().Copy( aMimeType );
- iThumbnailId = aThumbnailId;
- iTargetUri = NULL;
- }
-
-void CThumbnailObjectSource::ConstructL( const TDesC& aUri, const TDesC&
- aTargetUri, const TDesC& aMimeType )
- {
- iUri = aUri.AllocL();
- iTargetUri = aTargetUri.AllocL();
- iMimeType = HBufC8::NewL( aMimeType.Length() );
- iMimeType->Des().Copy( aMimeType );
- iThumbnailId = 0;
- iBitmap = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSource::~CThumbnailObjectSource()()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailObjectSource::~CThumbnailObjectSource()
- {
- delete iUri;
- iUri = NULL;
- delete iMimeType;
- iMimeType = NULL;
- delete iBuffer;
- iBuffer = NULL;
- delete iBitmap;
- iBitmap = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::FileHandle()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C RFile64& CThumbnailObjectSource::FileHandle()
- {
- return iFile;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::Uri()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CThumbnailObjectSource::Uri()
- {
- if ( iUri )
- {
- return * iUri;
- }
- return KNullDesC;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::Buffer()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TDesC8* CThumbnailObjectSource::Buffer()
- {
- return iBuffer;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::GetBufferOwnership()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TDesC8* CThumbnailObjectSource::GetBufferOwnership()
- {
- TDesC8* temp = iBuffer;
- iBuffer = NULL;
- return temp;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::aMimeType()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC8& CThumbnailObjectSource::MimeType()
- {
- if ( iMimeType )
- {
- return *iMimeType;
- }
- return KNullDesC8;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::Id()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TThumbnailId CThumbnailObjectSource::Id()
- {
- return iThumbnailId;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::Bitmap()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CFbsBitmap* CThumbnailObjectSource::Bitmap()
- {
- return iBitmap;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::GetBitmapOwnership()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C CFbsBitmap* CThumbnailObjectSource::GetBitmapOwnership()
- {
- CFbsBitmap* temp = iBitmap;
- iBitmap = NULL;
- return temp;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailObjectSourceImpl::TargetUri()
-// ---------------------------------------------------------------------------
-//
-EXPORT_C const TDesC& CThumbnailObjectSource::TargetUri()
- {
- if ( iTargetUri )
- {
- return * iTargetUri;
- }
- return KNullDesC;
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1192 +0,0 @@
-/*
-* 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: Active object for an asynchronous thumbnail request
- *
-*/
-
-
-#include <e32base.h>
-#include <hal.h>
-#include <hal_data.h>
-#include <apmstd.h>
-
-#include "thumbnailrequestactive.h"
-#include "thumbnailrequestqueue.h"
-#include "thumbnailsession.h"
-#include "thumbnailmanagerobserver.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaildataimpl.h"
-#include "thumbnailpanic.h"
-#include "thumbnaillog.h"
-
-#include "thumbnailmanagerimpl.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailrequestactiveTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::~CThumbnailRequestActive()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailRequestActive::~CThumbnailRequestActive()
- {
- Cancel();
-
- if(iTimer)
- {
- iTimer->Cancel();
- }
-
- delete iTimer;
- iTimer = NULL;
-
- ReleaseServerBitmap();
- delete iCallbackThumbnail;
- iCallbackThumbnail = NULL;
- delete iParams.iBuffer;
- iParams.iBuffer = NULL;
- delete iBitmap;
- iBitmap = NULL;
- iFile.Close();
- iMyFileHandle.Close();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::NewL
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailRequestActive* CThumbnailRequestActive::NewL( RFs& aFs,
- RThumbnailSession& aThumbnailSession, MThumbnailManagerObserver& aObserver,
- MThumbnailManagerRequestObserver* aRequestObserver,
- TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue )
- {
- CThumbnailRequestActive* self = new( ELeave )CThumbnailRequestActive( aFs,
- aThumbnailSession, aObserver, aRequestObserver, aId, aPriority, aQueue );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::CThumbnailRequestActive()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailRequestActive::CThumbnailRequestActive( RFs& aFs, RThumbnailSession&
- aThumbnailSession, MThumbnailManagerObserver& aObserver,
- MThumbnailManagerRequestObserver* aRequestObserver,
- TThumbnailRequestId aId, TInt aPriority, CThumbnailRequestQueue* aQueue ):
- CActive( aPriority ), iSession( aThumbnailSession ), iParamsPckg( iParams ),
- iObserver( aObserver ), iRequestObserver( aRequestObserver ), iFs( aFs ), iBitmapHandle( 0 ),
- iRequestId( aId ), iRequestQueue( aQueue ), iCanceled( EFalse )
-#ifdef __RETRY_ON_SERVERCRASH
- ,iRetry(0)
-#endif
- {
- CActiveScheduler::Add( this );
- TN_DEBUG2( "CThumbnaiRequestActive::CThumbnailRequestActive() AO's priority = %d", Priority());
- OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_CTHUMBNAILREQUESTACTIVE, "CThumbnailRequestActive::CThumbnailRequestActive - AO's priority;Priority()=%d", Priority() );
-
- iBitmap = NULL;
- iRequestCompleted = EFalse;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::ConstructL()
- {
- iCallbackThumbnail = new( ELeave )CThumbnailDataImpl();
-
- iTimer = CPeriodic::NewL(CActive::EPriorityIdle);
- iStartError = KErrNone;
-
-#ifdef _DEBUG
- iStartExecTime.UniversalTime();
-#endif
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::StartL()
-// Start active request.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::StartL()
- {
- TN_DEBUG3( "CThumbnailRequestActive::StartL(0x%08x) reqid = %d", this, iRequestId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL;iRequestId=%u", iRequestId );
-
- iRequestActive = ETrue;
-
-#ifdef _DEBUG
- TTime stop;
- stop.UniversalTime();
- TN_DEBUG3( "CThumbnailRequestActive::StartL() req id = %d, queuing time %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
- OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL - req id = %d, queuing time %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
-#endif
-
- switch (iRequestType)
- {
- case EReqGetThumbnailHandle:
- {
- iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
- break;
- }
- case EReqGetThumbnailPath:
- {
- // for custom size requests file handle can be opened here already, because
- // custom thumbnails are never stored in db
- if (iParams.iThumbnailSize == ECustomThumbnailSize &&
- iParams.iOriginalControlFlags != EThumbnailGeneratePersistentSizesOnly)
- {
- TN_DEBUG1( "CThumbnaiRequestActive::StartL()- custom size request" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL - custom size request" );
-
- iFile.Close();
- User::LeaveIfError( iFile.Open( iFs, iPath, EFileShareReadersOrWriters ) );
-
- TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iPath );
- OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL;iPath=%S", iPath );
-
- CleanupClosePushL( iFile );
-
- if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
- {
- // We may need the file handle later for the 2nd phase thumbnail
- iMyFileHandle.Close();
- User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
- }
-
- iSession.RequestThumbnailL( iFile, iPath, iParamsPckg, iStatus );
- CleanupStack::PopAndDestroy( &iFile );
- }
- else
- {
- iSession.RequestThumbnailL( iPath, iTargetUri, iParams.iThumbnailId,
- iParamsPckg, iStatus );
- }
- break;
- }
- case EReqSetThumbnailBuffer:
- {
- iSession.RequestSetThumbnailL( iParams.iBuffer, iTargetUri, iParamsPckg, iStatus );
- break;
- }
- case EReqSetThumbnailBitmap:
- {
- iSession.RequestSetThumbnailL( iBitmap->Handle(), iTargetUri, iParamsPckg, iStatus );
- break;
- }
- case EReqUpdateThumbnails:
- {
- iSession.UpdateThumbnails( iPath, iOrientation, iModified, iParamsPckg, iStatus );
- break;
- }
- case EReqGetThumbnailHandleLater:
- {
- // open file handle
- iFile.Close();
- User::LeaveIfError( iFile.Open( iFs, iTargetUri, EFileShareReadersOrWriters ) );
-
- TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri );
- OstTraceExt1( TRACE_NORMAL, DUP4_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL - file handle opened;iTargetUri=%S", iTargetUri );
-
- CleanupClosePushL( iFile );
-
- if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
- {
- // We may need the file handle later for the 2nd phase thumbnail
- iMyFileHandle.Close();
- User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
- }
-
- iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
- CleanupStack::PopAndDestroy( &iFile );
- break;
- }
- case EReqDeleteThumbnails:
- {
- // by path
- if (iPath != KNullDesC)
- {
- iSession.DeleteThumbnails( iPath, iParamsPckg, iStatus );
- }
- // by id
- else
- {
- iSession.DeleteThumbnails( iParams.iThumbnailId, iParamsPckg, iStatus );
- }
- break;
- }
- case EReqRenameThumbnails:
- {
- iSession.RenameThumbnails( iParamsPckg, iStatus );
- break;
- }
- case EReqSetThumbnailPath:
- {
- // open file handle
- iFile.Close();
- User::LeaveIfError( iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters ) );
-
- TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iParams.iFileName );
- OstTraceExt1( TRACE_NORMAL, DUP5_CTHUMBNAILREQUESTACTIVE_STARTL, "CThumbnailRequestActive::StartL;iParams.iFileName=%S", iParams.iFileName );
-
- CleanupClosePushL( iFile );
-
- if ( iParams.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
- {
- // We may need the file handle later for the 2nd phase thumbnail
- iMyFileHandle.Close();
- User::LeaveIfError( iMyFileHandle.Duplicate( iFile ));
- }
-
- iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
- CleanupStack::PopAndDestroy( &iFile );
-
- break;
- }
-
- default:
- {
- break;
- }
- }
-
- iTimer->Cancel();
- iTimer->Start( KClientRequestTimeout, KClientRequestTimeout,
- TCallBack(TimerCallBack, this));
- SetActive();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::RunL()
- {
- TN_DEBUG2( "CThumbnailRequestActive::RunL() - request ID: %d", iParams.iRequestId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId );
-
- if ( iParams.iControlFlags == EThumbnailPreviewThumbnail )
- {
- iRequestCompleted = EFalse;
- iProcessingPreview = ETrue;
- }
- else
- {
- iRequestCompleted = ETrue;
- }
-
- iTimer->Cancel();
-
- if (iRequestType == EReqDeleteThumbnails)
- {
- TN_DEBUG1( "CThumbnailRequestActive::RunL() - delete" );
-
- if (iRequestObserver)
- {
- iRequestObserver->ThumbnailRequestReady(iStatus.Int(), ERequestDeleteThumbnails ,iParams.iRequestId);
- }
-
- iFile.Close();
- iMyFileHandle.Close();
-
- // no action for delete/rename or canceled request
- iRequestQueue->RequestComplete(this);
-
-#ifdef _DEBUG
- TTime stop;
- stop.UniversalTime();
- TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
- OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - total execution time of req %d is %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
-#endif
- }
- else if (iCanceled || iRequestType == EReqRenameThumbnails)
- {
- if (iCanceled)
- {
- TN_DEBUG1( "CThumbnailRequestActive::RunL() - canceled" );
- }
- else if (iRequestType == EReqRenameThumbnails)
- {
- TN_DEBUG1( "CThumbnailRequestActive::RunL() - rename" );
- }
-
- iFile.Close();
- iMyFileHandle.Close();
-
- // no action for delete/rename or canceled request
- iRequestQueue->RequestComplete(this);
-
-#ifdef _DEBUG
- TTime stop;
- stop.UniversalTime();
- TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time of req %d is %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
- OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - total execution time of req %d is %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
-#endif
- }
- else if ( iStatus.Int() == KThumbnailErrThumbnailNotFound && iParams.iFileName.Length() &&
- !( iParams.iFlags& CThumbnailManager::EDoNotCreate ))
- {
- TN_DEBUG2( "CThumbnaiRequestActive::RunL() - no thumbnail found - lets try with file handle %S", &iParams.iFileName );
- OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - no thumbnail found - lets try with file handle;iParams.iFileName=%S", iParams.iFileName );
- iRequestCompleted = EFalse;
-
- // We tried to get thumbnail using file path, but it was not found in
- // the database. We need to open the file now (on the client side) and
- // use file handle.
- iFile.Close();
- TInt err = iFile.Open( iFs, iParams.iFileName, EFileShareReadersOrWriters );
- TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle open err = %d", err );
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - file handle open err;err=%d", err );
- User::LeaveIfError( err );
-
- CleanupClosePushL( iFile );
-
- TN_DEBUG2( "CThumbnaiRequestActive::RunL() - file handle opened for %S", &iParams.iFileName );
- OstTraceExt1( TRACE_NORMAL, DUP5_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iFileName=%S", iParams.iFileName );
-
- iSession.RequestThumbnailL( iFile, iParams.iFileName, iParamsPckg, iStatus );
- CleanupStack::PopAndDestroy( &iFile );
-
- iTimer->Start( KClientRequestTimeout, KClientRequestTimeout,
- TCallBack(TimerCallBack, this));
- SetActive();
- }
- else if ( iStatus.Int() )
- {
- TN_DEBUG2( "CThumbnailRequestActive::RunL() - error (%d) occured", iStatus.Int() );
- // An error occurred
- iError = iStatus.Int();
- HandleError();
- }
- //1st round thumb ready from exif (stored)
- else if (iParams.iOriginalControlFlags == EThumbnailGeneratePersistentSizesOnly && !iProcessingPreview)
- {
- TN_DEBUG1( "CThumbnaiRequestActive::RunL()- generate persistent sizes thumbnailready" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - generate persistent sizes thumbnailready" );
- iBitmapHandle = iParams.iBitmapHandle;
-
- TN_DEBUG2( "CThumbnaiRequestActive::RunL() - iObserver.ThumbnailReady %d", iParams.iRequestId );
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId );
- iObserver.ThumbnailReady( iStatus.Int(), *iCallbackThumbnail, iParams.iRequestId );
-
- ReleaseServerBitmap();
-
- iFile.Close();
- iMyFileHandle.Close();
-
- iRequestQueue->RequestComplete(this);
-
- #ifdef _DEBUG
- TTime stop;
- stop.UniversalTime();
- TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time %d, %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
- OstTraceExt2( TRACE_NORMAL, DUP8_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - total execution time %d, %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
-
- #endif
- }
- //1st round preview ready from too low quality exif/exif not found (not-stored)
- //relauch using normal decoding
- else if (iParams.iOriginalControlFlags == EThumbnailGeneratePersistentSizesOnly && iProcessingPreview)
- {
- TN_DEBUG1( "CThumbnaiRequestActive::RunL()- generate persistent sizes thumbnailpreviewready" );
- OstTrace0( TRACE_NORMAL, DUP9_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - generate persistent sizes thumbnailpreviewready" );
- iBitmapHandle = iParams.iBitmapHandle;
-
- TN_DEBUG2( "CThumbnaiRequestActive::RunL() - iObserver.ThumbnailPreviewReady %d", iParams.iRequestId );
- OstTrace1( TRACE_NORMAL, DUP10_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId );
- iObserver.ThumbnailPreviewReady( *iCallbackThumbnail, iParams.iRequestId );
-
- iProcessingPreview = EFalse;
-
- ReleaseServerBitmap();
-
- iFile.Close();
-
- //set flags so that EThumbnailGeneratePersistentSizesOnly is done aka check all missing sizes
- iParams.iQualityPreference = CThumbnailManager::EOptimizeForQuality;
- iParams.iControlFlags = EThumbnailGeneratePersistentSizesOnly;
- iRequestType = EReqUpdateThumbnails;
-
- //increase priority
- this->SetPriority(this->Priority() + 1);
- iParams.iPriority++;
-
- iSession.UpdateThumbnails( iPath, iOrientation, iModified, iParamsPckg, iStatus );
-
- SetActive();
-
- #ifdef _DEBUG
- TTime stop;
- stop.UniversalTime();
- TN_DEBUG3( "CThumbnailRequestActive::RunL() total execution time %d, %d ms",
- iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
- #endif
- }
- else
- {
- TN_DEBUG1( "CThumbnailRequestActive::RunL() - succesful" );
- OstTrace0( TRACE_NORMAL, DUP11_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - succesful" );
-
- // Success
- iBitmapHandle = iParams.iBitmapHandle;
-
- if( iBitmapHandle )
- {
- CFbsBitmap* bitmap = new( ELeave )CFbsBitmap();
- CleanupStack::PushL( bitmap );
- User::LeaveIfError( bitmap->Duplicate( iBitmapHandle ));
- CleanupStack::Pop( bitmap );
-
- // reduce bpp value (displaymode to match reqested bits per pixel)
- #ifdef _DEBUG
- TN_DEBUG2( "CThumbnailRequestActive::RunL() - displaymode is %d", bitmap->DisplayMode());
- OstTrace1( TRACE_NORMAL, DUP12_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;bitmap->DisplayMode()=%u", bitmap->DisplayMode() );
- #endif
-
- if( bitmap->DisplayMode() > iParams.iDisplayMode )
- {
- bitmap->SetDisplayMode( iParams.iDisplayMode );
- #ifdef _DEBUG
- TN_DEBUG2( "CThumbnailRequestActive::RunL() - displaymode is now %d", bitmap->DisplayMode());
- OstTrace1( TRACE_NORMAL, DUP13_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;bitmap->DisplayMode()=%u", bitmap->DisplayMode() );
- #endif
- }
-
- iCallbackThumbnail->Set( bitmap, iClientData );
- bitmap = NULL; // Owned by iCallbackThumbnail or client now
- }
-
- if ( iProcessingPreview )
- {
- TN_DEBUG2( "CThumbnailRequestActive::RunL() - iObserver.ThumbnailPreviewReady %d", iParams.iRequestId );
- OstTrace1( TRACE_NORMAL, DUP14_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL - iObserver.ThumbnailPreviewReady;iParams.iRequestId=%u", iParams.iRequestId );
-
- //increase priority of 2nd round (both, AO and request itself)
- this->SetPriority(this->Priority() + 1);
- iParams.iPriority++;
- iObserver.ThumbnailPreviewReady( *iCallbackThumbnail, iParams.iRequestId );
- iProcessingPreview = EFalse;
-
- ReleaseServerBitmap();
-
- iFile.Close();
-
- Get2ndPhaseThumbnailL();
- }
- else
- {
- TN_DEBUG2( "CThumbnailRequestActive::RunL() - iObserver.ThumbnailReady %d", iParams.iRequestId );
- OstTrace1( TRACE_NORMAL, DUP15_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u", iParams.iRequestId );
-
- iObserver.ThumbnailReady( iStatus.Int(), * iCallbackThumbnail, iParams.iRequestId );
- ReleaseServerBitmap();
-
- iFile.Close();
- iMyFileHandle.Close();
-
- iRequestQueue->RequestComplete(this);
-
-#ifdef _DEBUG
- TTime stop;
- stop.UniversalTime();
- TInt tookTime = (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000;
- TN_DEBUG4( "CThumbnailRequestActive::RunL(0x%08x) total execution time of req %d is %d ms",
- this, iParams.iRequestId, (TInt)stop.MicroSecondsFrom(iStartExecTime).Int64()/1000 );
- OstTrace1( TRACE_NORMAL, DUP16_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;this=%o", this );
- OstTraceExt2( TRACE_NORMAL, DUP17_CTHUMBNAILREQUESTACTIVE_RUNL, "CThumbnailRequestActive::RunL;iParams.iRequestId=%u;tookTime=%d", iParams.iRequestId, tookTime );
-#endif
- }
- }
-
- delete iBitmap;
- iBitmap = NULL;
-
- //if request is complete set it also not active -> really finished
- if(iRequestCompleted)
- {
- iRequestActive = EFalse;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::RunError()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailRequestActive::RunError( TInt aError )
- {
- TN_DEBUG1( "CThumbnailRequestActive::RunError");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_RUNERROR, "CThumbnailRequestActive::RunError" );
-
- iTimer->Cancel();
-
- // If RunL() left, the client did not get any callbacks yet.
- // We need to notify it of the error now.
- iError = aError;
- HandleError();
-
- return KErrNone;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::DoCancel()
- {
- TN_DEBUG1( "CThumbnailRequestActive::DoCancel");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_DOCANCEL, "CThumbnailRequestActive::DoCancel" );
- iTimer->Cancel();
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- iCanceled = ETrue;
- iSession.CancelRequest( iRequestId );
- ReleaseServerBitmap();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::AsyncCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::AsyncCancel()
- {
- TN_DEBUG1( "CThumbnailRequestActive::AsyncCancel");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_ASYNCCANCEL, "CThumbnailRequestActive::AsyncCancel" );
-
- __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
-
- iCanceled = ETrue;
- iSession.CancelRequest( iRequestId );
- ReleaseServerBitmap();
-
- // AO stays active until request is complete or timeout is reached
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::ReleaseServerBitmap()
-// Releases reserved bitmap.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::ReleaseServerBitmap()
- {
- if ( iBitmapHandle && iSession.Handle())
- {
- TN_DEBUG1( "CThumbnailRequestActive::ReleaseServerBitmap");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_RELEASESERVERBITMAP, "CThumbnailRequestActive::ReleaseServerBitmap" );
-
- iSession.ReleaseBitmap( iBitmapHandle );
- iBitmapHandle = 0;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::HandleError()
-// Error handling function.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::HandleError()
- {
- TN_DEBUG1( "CThumbnailRequestActive::HandleError");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError" );
-
- if ( iError )
- {
- if( iError == KErrServerTerminated)
- {
- iSession.Close();
- TInt connErr = iSession.Connect();
- if (connErr != KErrNone)
- {
- TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - session reconnect err %d", connErr );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError;err=%d", connErr );
- }
- else
- {
- TN_DEBUG1( "CThumbnailRequestActive::HandleError() - session reconnected");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError - session reconnected" );
- }
- }
-
- if (iRequestObserver && iRequestType == EReqDeleteThumbnails)
- {
- TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iRequestObserver->ThumbnailRequestReady %d", iParams.iRequestId );
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError;iParams.iRequestId=%u", iParams.iRequestId );
- iRequestObserver->ThumbnailRequestReady(iError, ERequestDeleteThumbnails ,iParams.iRequestId);
- }
- else
- {
- iCallbackThumbnail->Set( NULL, iClientData );
-
- // don't leak internal TNM codes
- if (iError == KThumbnailErrThumbnailNotFound)
- {
- iError = KErrNotFound;
- }
-
-#ifdef __RETRY_ON_SERVERCRASH
- if(iError == KErrServerTerminated )
- {
-
- if(iRetry < KMaxRequestRetryCount )
- {
- iRetry++;
- TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - KErrServerTerminated, retry %d", iRetry);
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError - KErrServerTerminated;iRetry=%d", iRetry );
- iError = KErrNone;
- TRAPD(err, StartL());
- return;
- }
- }
-#endif
- TN_DEBUG3( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady req=%d err=%d", iParams.iRequestId, iError );
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILREQUESTACTIVE_HANDLEERROR, "CThumbnailRequestActive::HandleError - iObserver.ThumbnailReady %u", iParams.iRequestId );
- iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId );
-
- }
-
- iError = KErrNone;
- }
-
- ReleaseServerBitmap();
-
- iFile.Close();
- iMyFileHandle.Close();
-
- iRequestCompleted = ETrue;
- iRequestQueue->RequestComplete(this);
- iRequestActive = EFalse;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::GetThumbnailL()
-// Get a thumbnail for an object file.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::GetThumbnailL( const RFile64& aFile, TThumbnailId aThumbnailId,
- const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
- ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
- TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize)
- {
- iRequestType = EReqGetThumbnailHandle;
-
- if ( aQualityPreference == CThumbnailManager
- ::EOptimizeForQualityWithPreview )
- {
- // We may need the file handle later for the 2nd phase
- // thumbnail
- iMyFileHandle.Close();
- User::LeaveIfError( iMyFileHandle.Duplicate( aFile ));
- }
-
- iClientData = aClientData;
- iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
- EThumbnailGeneratePersistentSizesOnly :
- EThumbnailNoControlFlags);
- iParams.iOriginalControlFlags = iParams.iControlFlags;
- iParams.iMimeType = TDataType( aMimeType );
- iParams.iBitmapHandle = 0;
- iParams.iSize = aSize;
- iParams.iDisplayMode = aDisplayMode;
- User::LeaveIfError( aFile.FullName( iParams.iFileName ));
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFlags = aFlags;
- iParams.iQualityPreference = aQualityPreference;
- iParams.iThumbnailSize = aThumbnailSize;
- iParams.iThumbnailId = aThumbnailId;
- iParams.iOverwrite = EFalse;
- iParams.iImport = EFalse;
-
- User::LeaveIfError( iFile.Duplicate( aFile ));
-
- iTargetUri = aTargetUri;
-
- if (iParams.iFileName.Length() && IsVirtualUri(iParams.iFileName))
- {
- iParams.iVirtualUri = ETrue;
- }
- else
- {
- iParams.iVirtualUri = EFalse;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::GetThumbnailL()
-// Get a thumbnail opening an object file later.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::GetThumbnailL( TThumbnailId aThumbnailId,
- const TDesC& aPath, const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
- CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
- TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize)
- {
- iRequestType = EReqGetThumbnailHandleLater;
-
- iClientData = aClientData;
- iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
- EThumbnailGeneratePersistentSizesOnly :
- EThumbnailNoControlFlags);
- iParams.iOriginalControlFlags = iParams.iControlFlags;
- iParams.iMimeType = TDataType( aMimeType );
- iParams.iBitmapHandle = 0;
- iParams.iSize = aSize;
- iParams.iDisplayMode = aDisplayMode;
- iParams.iFileName = aPath;
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFlags = aFlags;
- iParams.iQualityPreference = aQualityPreference;
- iParams.iThumbnailSize = aThumbnailSize;
- iParams.iThumbnailId = aThumbnailId;
- iParams.iOverwrite = EFalse;
- iParams.iImport = EFalse;
-
- iTargetUri = aTargetUri;
-
- if (iPath.Length() && IsVirtualUri(iPath))
- {
- iParams.iVirtualUri = ETrue;
- }
- else
- {
- iParams.iVirtualUri = EFalse;
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::GetThumbnailL()
-// Get a thumbnail for an object file.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::GetThumbnailL( const TDesC& aPath, TThumbnailId aThumbnailId,
- const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
- ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
- TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData, TBool aGeneratePersistentSizesOnly,
- const TDesC& aTargetUri, TThumbnailSize aThumbnailSize)
- {
- iRequestType = EReqGetThumbnailPath;
-
- iClientData = aClientData;
- iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
- EThumbnailGeneratePersistentSizesOnly :
- EThumbnailNoControlFlags);
- iParams.iOriginalControlFlags = iParams.iControlFlags;
- iParams.iMimeType = TDataType( aMimeType );
- iParams.iBitmapHandle = 0;
- iParams.iSize = aSize;
- iParams.iDisplayMode = aDisplayMode;
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFlags = aFlags;
- iParams.iQualityPreference = aQualityPreference;
- iParams.iThumbnailSize = aThumbnailSize;
- iParams.iThumbnailId = aThumbnailId;
- iParams.iFileName = aPath;
- iParams.iOverwrite = EFalse;
- iParams.iImport = EFalse;
-
- iPath = aPath;
- iTargetUri = aTargetUri;
-
- if (iPath.Length() && IsVirtualUri(iPath))
- {
- iParams.iVirtualUri = ETrue;
- }
- else
- {
- iParams.iVirtualUri = EFalse;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::SetThumbnailL()
-// Get a thumbnail for an object file.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::SetThumbnailL( TDesC8* aBuffer, TThumbnailId aThumbnailId,
- const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
- CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize,
- const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
- TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize,
- TBool aOverwrite)
- {
- iRequestType = EReqSetThumbnailBuffer;
-
- iClientData = aClientData;
- iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
- EThumbnailGeneratePersistentSizesOnly :
- EThumbnailNoControlFlags);
- iParams.iOriginalControlFlags = iParams.iControlFlags;
- iParams.iMimeType = TDataType( aMimeType );
- iParams.iBitmapHandle = 0;
- iParams.iSize = aSize;
- iParams.iBuffer = aBuffer; // save pointer for deletion (~CThumbnailRequestActive())
- iParams.iThumbnailSize = aThumbnailSize;
- iParams.iDisplayMode = aDisplayMode;
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFlags = aFlags;
- iParams.iQualityPreference = aQualityPreference;
- iParams.iThumbnailId = aThumbnailId;
- iParams.iOverwrite = aOverwrite;
- iParams.iImport = EFalse;
-
- iTargetUri = aTargetUri;
-
- if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
- {
- iParams.iVirtualUri = ETrue;
- }
- else
- {
- iParams.iVirtualUri = EFalse;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::SetThumbnailL()
-// Get a thumbnail for an object file.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::SetThumbnailL( CFbsBitmap* aBitmap, TThumbnailId aThumbnailId,
- const TDesC8& aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
- CThumbnailManager::TThumbnailQualityPreference aQualityPreference, const TSize& aSize,
- const TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
- TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri, TThumbnailSize aThumbnailSize,
- TBool aOverwrite)
- {
- iClientData = aClientData;
- iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
- EThumbnailGeneratePersistentSizesOnly :
- EThumbnailNoControlFlags);
- iParams.iOriginalControlFlags = iParams.iControlFlags;
- iParams.iBitmapHandle = 0;
- iParams.iSize = aSize;
- iParams.iThumbnailSize = aThumbnailSize;
- iParams.iDisplayMode = aDisplayMode;
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFlags = aFlags;
- iParams.iQualityPreference = aQualityPreference;
- iParams.iThumbnailId = aThumbnailId;
- iParams.iFileName = aTargetUri;
- iParams.iOverwrite = aOverwrite;
- iParams.iImport = EFalse;
-
- iTargetUri = aTargetUri;
-
- if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
- {
- iParams.iVirtualUri = ETrue;
- }
- else
- {
- iParams.iVirtualUri = EFalse;
- }
-
- TInt memoryFree( 0 );
- HAL::Get( HALData::EMemoryRAMFree, memoryFree );
-
- TN_DEBUG2( "CThumbnaiRequestActive::SetThumbnailbyBitmap() - memoryFree %d", memoryFree );
-
- if(memoryFree > KMemoryNeed)
- {
- // save parameter bitmap, it will be deleted when request is complete
- iBitmap = aBitmap;
- iParams.iMimeType = TDataType( aMimeType );
- iRequestType = EReqSetThumbnailBitmap;
- }
- else if (!iParams.iVirtualUri)
- {
- // memory low, create thumbs using filehandle
- TN_DEBUG1( "CThumbnaiRequestActive::SetThumbnailbyBitmap() - memory low, create thumbs using filehandle!" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_SETTHUMBNAILL, "CThumbnailRequestActive::SetThumbnailL - memory low, create thumbs using filehandle!" );
- delete aBitmap;
- aBitmap = NULL;
- iParams.iPriority = aPriority - 1;
- iRequestType = EReqGetThumbnailHandleLater;
- }
- else
- {
- User::Leave(KErrNoMemory);
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::UpdateThumbnailsL()
-// Update thumbnails by Id.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::UpdateThumbnailsL( const TDesC& aPath,
- const TThumbnailId aThumbnailId, CThumbnailManager::TThumbnailFlags aFlags,
- CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
- const TDisplayMode aDisplayMode, const TInt aPriority, const TInt aOrientation,
- const TInt64 aModified )
- {
- iRequestType = EReqUpdateThumbnails;
-
- iParams.iControlFlags = EThumbnailGeneratePersistentSizesOnly;
- iParams.iOriginalControlFlags = iParams.iControlFlags;
- iParams.iBitmapHandle = 0;
- iParams.iDisplayMode = aDisplayMode;
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFlags = aFlags;
- iParams.iQualityPreference = aQualityPreference;
- iParams.iThumbnailId = aThumbnailId;
- iParams.iOverwrite = EFalse;
- iParams.iVirtualUri = EFalse;
- iParams.iImport = EFalse;
-
- iPath = aPath;
- iOrientation = aOrientation;
- iModified = aModified;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::DeleteThumbnails()
-// Delete thumbnails.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::DeleteThumbnails( const TDesC& aPath,
- const TThumbnailId aThumbnailId, const TInt aPriority )
- {
- iRequestType = EReqDeleteThumbnails;
-
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iThumbnailId = aThumbnailId;
-
- iPath = aPath;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::RenameThumbnails()
-// Rename thumbnails.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::RenameThumbnails( const TDesC& aCurrentPath,
- const TDesC& aNewPath, const TInt aPriority )
- {
- iRequestType = EReqRenameThumbnails;
-
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFileName = aCurrentPath;
- iParams.iTargetUri = aNewPath;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::SetThumbnailL()
-// Set thumbnail from file path.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::SetThumbnailL( const TDesC& aPath, const TDesC8& aMimeType,
- CThumbnailManager::TThumbnailFlags aFlags, CThumbnailManager
- ::TThumbnailQualityPreference aQualityPreference, const TSize& aSize, const
- TDisplayMode aDisplayMode, const TInt aPriority, TAny* aClientData,
- TBool aGeneratePersistentSizesOnly, const TDesC& aTargetUri,
- TThumbnailSize aThumbnailSize, TBool aOverwrite)
- {
- iRequestType = EReqSetThumbnailPath;
-
- iClientData = aClientData;
- iParams.iControlFlags = (aGeneratePersistentSizesOnly ?
- EThumbnailGeneratePersistentSizesOnly :
- EThumbnailNoControlFlags);
- iParams.iOriginalControlFlags = iParams.iControlFlags;
- iParams.iMimeType = TDataType( aMimeType );
- iParams.iBitmapHandle = 0;
- iParams.iSize = aSize;
- iParams.iDisplayMode = aDisplayMode;
- iParams.iFileName = aPath;
- iParams.iRequestId = iRequestId;
- iParams.iPriority = aPriority;
- iParams.iFlags = aFlags;
- iParams.iQualityPreference = aQualityPreference;
- iParams.iThumbnailSize = aThumbnailSize;
- iParams.iOverwrite = aOverwrite;
-
- iTargetUri = aTargetUri;
-
- if (iTargetUri.Length() && IsVirtualUri(iTargetUri))
- {
- iParams.iVirtualUri = ETrue;
- }
- else
- {
- iParams.iVirtualUri = EFalse;
- }
-
- iParams.iImport = ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// Request 2nd phase thumbnail
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::Get2ndPhaseThumbnailL()
- {
- TN_DEBUG2( "CThumbnailRequestActive::Get2ndPhaseThumbnailL() %d", iParams.iRequestId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_GET2NDPHASETHUMBNAILL, "CThumbnailRequestActive::Get2ndPhaseThumbnailL;iParams.iRequestId=%u", iParams.iRequestId );
-
- iParams.iQualityPreference = CThumbnailManager::EOptimizeForQuality;
- iParams.iControlFlags = EThumbnailNoControlFlags;
-
- if ( iMyFileHandle.SubSessionHandle())
- {
- User::LeaveIfError( iMyFileHandle.FullName( iParams.iFileName ));
- iSession.RequestThumbnailL( iMyFileHandle, iParams.iTargetUri, iParamsPckg, iStatus );
- SetActive();
- }
- else
- {
- iSession.RequestThumbnailL( iParams.iFileName, iParams.iTargetUri, iParams.iThumbnailId, iParamsPckg, iStatus );
- SetActive();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::ChangePriority()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::ChangePriority( const TInt aNewPriority )
- {
- TN_DEBUG1( "CThumbnailRequestActive::ChangePriority");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_CHANGEPRIORITY, "CThumbnailRequestActive::ChangePriority" );
-
- iParams.iPriority = aNewPriority;
-
- if (!IsActive())
- {
- this->SetPriority(aNewPriority);
- }
- else
- {
- iSession.ChangePriority(iRequestId, aNewPriority);
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::StartError()
-// Error handling function.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestActive::StartError( const TInt aErr )
- {
- TN_DEBUG1( "CThumbnailRequestActive::StartError");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_STARTERROR, "CThumbnailRequestActive::StartError" );
-
- iStartError = aErr;
- iRequestActive = ETrue;
-
- if (!iTimer->IsActive())
- {
- iTimer->Start( KClientRequestStartErrorTimeout, KClientRequestStartErrorTimeout,
- TCallBack(TimerCallBack, this));
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::TimerCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailRequestActive::TimerCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - request timeout");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_TIMERCALLBACK, "CThumbnailRequestActive::TimerCallBack" );
-
- CThumbnailRequestActive* self = static_cast<CThumbnailRequestActive*>( aAny );
-
- self->iTimer->Cancel();
-
- self->Cancel();
-
- if (self->iStartError != KErrNone)
- {
- self->iError = self->iStartError;
- }
- else
- {
- self->iError = KErrTimedOut;
- }
-
- self->HandleError();
-
- TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - end");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTACTIVE_TIMERCALLBACK, "CThumbnailRequestActive::TimerCallBack - end" );
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestActive::IsVirtualUri()
-// Checks if URI is virtual.
-// ---------------------------------------------------------------------------
-//
-TBool CThumbnailRequestActive::IsVirtualUri( const TDesC& aPath )
- {
- TInt pos = aPath.Find(KBackSlash);
-
- // normal URI
- if ( pos == 2 )
- {
- return EFalse;
- }
- // virtual URI
- else
- {
- TN_DEBUG1( "CThumbnailRequestActive::IsVirtualUri() - yes");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTACTIVE_ISVIRTUALURI, "CThumbnailRequestActive::IsVirtualUri - yes" );
- return ETrue;
- }
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestqueue.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
-* 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: Processor object for running thumbnail requests
-*
-*/
-
-
-#include "thumbnailrequestqueue.h"
-#include "thumbnailrequestactive.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailrequestqueueTraces.h"
-#endif
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailRequestQueue* CThumbnailRequestQueue::NewL()
- {
- CThumbnailRequestQueue* self = new( ELeave )CThumbnailRequestQueue();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::CThumbnailRequestQueue()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailRequestQueue::CThumbnailRequestQueue()
- {
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestQueue::ConstructL()
- {
- iActiveRequests = 0;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::~CThumbnailRequestQueue()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailRequestQueue::~CThumbnailRequestQueue()
- {
- TN_DEBUG1( "CThumbnailRequestQueue::~CThumbnailRequestQueue()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTQUEUE_CTHUMBNAILREQUESTQUEUE, "CThumbnailRequestQueue::~CThumbnailRequestQueue" );
-
- iRequests.ResetAndDestroy();
-
- TN_DEBUG1( "CThumbnailRequestQueue::~CThumbnailRequestQueue() - All requests deleted");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTQUEUE_CTHUMBNAILREQUESTQUEUE, "CThumbnailRequestQueue::~CThumbnailRequestQueue - All requests deleted" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::Process()
-// Activates next request if possible.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestQueue::Process()
- {
- TN_DEBUG1( "CThumbnailRequestQueue::Process()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTQUEUE_PROCESS, "CThumbnailRequestQueue::Process" );
-
- while ( (iActiveRequests < KMaxClientRequests) &&
- (iRequests.Count() > iActiveRequests) )
- {
- CThumbnailRequestActive* selectedRequest = NULL;
- TInt priority( KMinTInt );
- TInt reqPriority;
- CThumbnailRequestActive* request = NULL;
-
- for ( TInt i = 0; i < iRequests.Count(); i++ )
- {
- request = iRequests[i];
-
- // this task is not yet activated or processed
- if( request && !request->RequestCompleted() && !request->IsRequestActive() )
- {
- TN_DEBUG4( "CThumbnailRequestQueue::Process() - candidate at %d, id = %d, (0x%08x)", i,
- request->RequestId(),
- request);
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILREQUESTQUEUE_PROCESS, "CThumbnailRequestQueue::Process;request->RequestId()=%u", request->RequestId() );
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILREQUESTQUEUE_PROCESS, "CThumbnailRequestQueue::Process;request=%o", request );
-
- reqPriority = request->Priority();
- if ( reqPriority > priority )
- {
- priority = reqPriority;
- selectedRequest = request;
- }
- }
- }
-
- // activate selected
- if ( selectedRequest )
- {
- TN_DEBUG1( "CThumbnailRequestQueue::Process() - starting next request");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTQUEUE_PROCESS, "CThumbnailRequestQueue::Process - starting next request" );
-
- iActiveRequests++;
-
- TRAPD(err, selectedRequest->StartL());
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbnailRequestQueue::Process() - starting request failed");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTQUEUE_PROCESS, "CThumbnailRequestQueue::Process - starting request failed" );
-
- selectedRequest->StartError(err);
- }
- }
- else
- {
- break;
- }
- }
-
- TN_DEBUG3( "CThumbnailRequestQueue::Process() end - requests: %d, active requests: %d",
- iRequests.Count(), iActiveRequests );
- OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTQUEUE_PROCESS, "CThumbnailRequestQueue::Process;iRequests.Count()=%d;iActiveRequests=%d", iRequests.Count(), iActiveRequests );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::AddRequestL()
-// Adds new request to the queue.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestQueue::AddRequestL( CThumbnailRequestActive* aRequest )
- {
- RemoveCompleted(NULL);
- iRequests.AppendL( aRequest );
-
- TN_DEBUG3( "CThumbnailRequestQueue::AddRequestL() end - requests: %d, active requests: %d",
- iRequests.Count(), iActiveRequests );
- OstTraceExt2( TRACE_NORMAL, CTHUMBNAILREQUESTQUEUE_ADDREQUESTL, "CThumbnailRequestQueue::AddRequestL;iRequests.Count()=%d;iActiveRequests=%d", iRequests.Count(), iActiveRequests );
- }
-
-void CThumbnailRequestQueue::RemoveCompleted( CThumbnailRequestActive* aRequestAO)
- {
- //process completed queue and remove finished tasks
- for ( TInt i = iRequests.Count() -1; i >= 0 && iRequests.Count(); i-- )
- {
- CThumbnailRequestActive* request = iRequests[i];
-
- // remove completed task if it's not active anymore and not this
- if ( request->RequestCompleted() && !request->IsRequestActive() && aRequestAO != request)
- {
- // delete completed task
- TN_DEBUG3( "CThumbnailRequestQueue::RemoveCompleted() - deleted id = %d (0x%08x)", request->RequestId(), request);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTQUEUE_REMOVECOMPLETED, "CThumbnailRequestQueue::RemoveCompleted;request=%o", request );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTQUEUE_REMOVECOMPLETED, "CThumbnailRequestQueue::RemoveCompleted;request->RequestId()=%u", request->RequestId() );
-
- delete request;
- request = NULL;
- iRequests.Remove( i );
- }
- }
-
- if(!iRequests.Count())
- {
- iRequests.Compress();
- }
-
- TN_DEBUG3( "CThumbnailRequestQueue::RemoveCompleted() end - requests: %d, active requests: %d",
- iRequests.Count(), iActiveRequests );
- OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILREQUESTQUEUE_REMOVECOMPLETED, "CThumbnailRequestQueue::RemoveCompleted;iRequests.Count()=%d;iActiveRequests=%d", iRequests.Count(), iActiveRequests );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::CancelRequest()
-// Removes specific request from the queue.
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailRequestQueue::CancelRequest( const TThumbnailRequestId aRequestId )
- {
- TN_DEBUG2( "CThumbnailRequestQueue::CancelRequest() - request ID: %d", aRequestId);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTQUEUE_CANCELREQUEST, "CThumbnailRequestQueue::CancelRequest;aRequestId=%u", aRequestId );
-
- TInt res = KErrNotFound;
-
- for ( TInt i = iRequests.Count(); --i >= 0; )
- {
- CThumbnailRequestActive* request = iRequests[i];
- if ( request->RequestId() == aRequestId )
- {
- if (iRequests[i]->IsActive())
- {
- // this doesn't yet actually cancel/complete the AO
- iRequests[i]->AsyncCancel();
-
- TN_DEBUG2( "CThumbnailRequestQueue::CancelRequest() - canceled request ID: %d", aRequestId);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILREQUESTQUEUE_CANCELREQUEST, "CThumbnailRequestQueue::CancelRequest;aRequestId=%u", aRequestId );
- }
- else
- {
- delete request;
- request = NULL;
- iRequests.Remove( i );
-
- TN_DEBUG2( "CThumbnailRequestQueue::CancelRequest() - removed request ID: %d", aRequestId);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILREQUESTQUEUE_CANCELREQUEST, "CThumbnailRequestQueue::CancelRequest;aRequestId=%u", aRequestId );
- }
-
- res = KErrNone;
- break;
- }
- }
-
- RemoveCompleted(NULL);
-
- Process();
-
- return res;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::ChangeReqPriority()
-// Changes priority of a request.
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailRequestQueue::ChangePriority( const TThumbnailRequestId aRequestId,
- const TInt aNewPriority )
- {
- TN_DEBUG1( "CThumbnailRequestQueue::ChangePriority()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILREQUESTQUEUE_CHANGEPRIORITY, "CThumbnailRequestQueue::ChangePriority" );
-
- TInt err = KErrNotFound;
- const TInt count = iRequests.Count();
-
- for ( TInt i( 0 ); i < count; i++ )
- {
- if ( iRequests[i]->RequestId() == aRequestId )
- {
- iRequests[i]->ChangePriority( aNewPriority );
-
- err = KErrNone;
- break;
- }
- }
-
- return err;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailRequestQueue::RequestComplete()
-// Completes the request
-// ---------------------------------------------------------------------------
-//
-void CThumbnailRequestQueue::RequestComplete(CThumbnailRequestActive* aRequestAO)
- {
- TN_DEBUG2( "CThumbnailRequestQueue::RequestComplete(0x%08x)", aRequestAO);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILREQUESTQUEUE_REQUESTCOMPLETE, "CThumbnailRequestQueue::RequestComplete;aRequestAO=%o", aRequestAO );
-
- iActiveRequests--;
- if(iActiveRequests <= -1)
- {
- iActiveRequests = 0;
- }
-
- RemoveCompleted( aRequestAO );
-
- Process();
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailsession.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,395 +0,0 @@
-/*
-* 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: Thumbnail server client-side session
- *
-*/
-
-
-// INCLUDE FILES
-#include "thumbnailsession.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailsessionTraces.h"
-#endif
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// RThumbnailSession::RThumbnailSession()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-RThumbnailSession::RThumbnailSession(): RSessionBase()
- {
- // No implementation required
- TN_DEBUG1( "RThumbnailSession::RThumbnailSession");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_RTHUMBNAILSESSION, "RThumbnailSession::RThumbnailSession" );
- }
-
-
-// ---------------------------------------------------------------------------
-// RThumbnailSession::Connect()
-// ---------------------------------------------------------------------------
-//
-TInt RThumbnailSession::Connect()
- {
- TN_DEBUG1( "RThumbnailSession::Connect - start");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_CONNECT, "RThumbnailSession::Connect - start" );
-
- StartServer();
-
- // special case
- // wait possibly needed here to give an old server process
- // time to enter shutdown state
- User::After(1000);
-
- TInt err = CreateSession( KThumbnailServerName, Version(), KMessageSlots );
- TInt retry = 1;
-
- // special case
- // old server still alive, wait and try again
- while (retry <= 10 && err != KErrNone)
- {
- TN_DEBUG1( "RThumbnailSession::Connect - retry");
- OstTrace0( TRACE_NORMAL, DUP1_RTHUMBNAILSESSION_CONNECT, "RThumbnailSession::Connect - retry" );
-
- User::After(retry * 50000);
- StartServer();
- err = CreateSession( KThumbnailServerName, Version(), KMessageSlots );
- retry++;
- }
-
- TN_DEBUG1( "RThumbnailSession::Connect - end");
- OstTrace0( TRACE_NORMAL, DUP2_RTHUMBNAILSESSION_CONNECT, "RThumbnailSession::Connect - end" );
-
- return err;
- }
-
-
-// ---------------------------------------------------------------------------
-// RThumbnailSession::Close()
-// Closes session
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::Close()
- {
- TN_DEBUG1( "RThumbnailSession::Close");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_CLOSE, "RThumbnailSession::Close" );
-
- RSessionBase::Close();
- }
-
-
-// ---------------------------------------------------------------------------
-// RThumbnailSession::Version()
-// Closes session
-// ---------------------------------------------------------------------------
-//
-TVersion RThumbnailSession::Version()
- {
- return TVersion( KThumbnailServerMajorVersionNumber,
- KThumbnailServerMinorVersionNumber, KThumbnailServerBuildVersionNumber )
- ;
- }
-
-
-// ---------------------------------------------------------------------------
-// RThumbnailSession::StartServer()
-// ---------------------------------------------------------------------------
-//
-TInt RThumbnailSession::StartServer()
- {
- TN_DEBUG1( "RThumbnailSession::StartServer - start");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_STARTSERVER, "RThumbnailSession::StartServer - start" );
-
- TInt res( KErrNone );
- // create server - if one of this name does not already exist
-
- TFindServer findServer( KThumbnailServerName );
- TFullName name;
- if ( findServer.Next( name ) != KErrNone )
- // we don't exist already
- {
- TN_DEBUG1( "RThumbnailSession::StartServer - server process doesn't exist yet");
- OstTrace0( TRACE_NORMAL, DUP1_RTHUMBNAILSESSION_STARTSERVER, "RThumbnailSession::StartServer - server process doesn't exist yet" );
-
- RProcess server;
- // Create the server process
- // KNullDesC param causes server's E32Main() to be run
- res = server.Create( KThumbnailServerExe, KNullDesC );
- if ( res != KErrNone )
- {
- TN_DEBUG2( "RThumbnailSession::StartServer - error creating process: %d", res);
- OstTrace1( TRACE_NORMAL, DUP2_RTHUMBNAILSESSION_STARTSERVER, "RThumbnailSession::StartServer;res=%d", res );
- return res;
- }
-
- TN_DEBUG1( "RThumbnailSession::StartServer - process created");
- OstTrace0( TRACE_NORMAL, DUP3_RTHUMBNAILSESSION_STARTSERVER, "RThumbnailSession::StartServer - process created" );
-
- // Process created successfully
- TRequestStatus status;
- server.Rendezvous( status );
- server.Resume(); // start it going
-
- // Wait until the completion of the server creation
- User::WaitForRequest( status );
-
- if ( status != KErrNone )
- {
- TN_DEBUG2( "RThumbnailSession::StartServer - status: %d, closing", status.Int() );
- OstTrace1( TRACE_NORMAL, DUP4_RTHUMBNAILSESSION_STARTSERVER, "RThumbnailSession::StartServer;status.Int()=%d", status.Int() );
-
- server.Close();
- return status.Int();
- }
-
- // Server created successfully
- server.Close(); // we're no longer interested in the other process
- }
-
- TN_DEBUG1( "RThumbnailSession::StartServer - end");
- OstTrace0( TRACE_NORMAL, DUP5_RTHUMBNAILSESSION_STARTSERVER, "RThumbnailSession::StartServer - end" );
-
- return res;
- }
-
-
-// ---------------------------------------------------------------------------
-// Request a thumbnail for an object file using file handle
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::RequestThumbnailL( const RFile64& aFile, const TDesC& aTargetUri,
- TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus )
- {
- TIpcArgs args( &aParams, KCheckValue ); // 1st and 2nd argument
- User::LeaveIfError( aFile.TransferToServer( args, 2, 3 )); // 3th and 4th argument
- aParams().iTargetUri = aTargetUri;
- SendReceive( ERequestThumbByFileHandleAsync, args, aStatus );
- }
-
-
-// ---------------------------------------------------------------------------
-// Request a thumbnail for an object file using file path
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::RequestThumbnailL( const TDesC& aPath, const TDesC& aTargetUri, const TThumbnailId /*aThumbnailId*/,
- TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus )
- {
- TIpcArgs args( &aParams, KCheckValue);
- aParams().iFileName = aPath;
- aParams().iTargetUri = aTargetUri;
-
- if(aPath.Length()== 0)
- {
- SendReceive( ERequestThumbByIdAsync, args, aStatus );
- }
- else
- {
- SendReceive( ERequestThumbByPathAsync, args, aStatus );
- }
- }
-
-// ---------------------------------------------------------------------------
-// Request a thumbnail for an object file using file path
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::RequestThumbnailL( const TThumbnailId aThumbnailId,
- const TDesC& /*aTargetUri*/,
- TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus )
- {
- TIpcArgs args( &aParams, KCheckValue );
- aParams().iThumbnailId = aThumbnailId;
- SendReceive( ERequestThumbByIdAsync, args, aStatus );
- }
-
-#if 0
-// ---------------------------------------------------------------------------
-// Request a thumbnail for an object file using file path
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::RequestThumbnailL( const TDesC& aPath, const TDesC& aTargetUri,
- TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus )
- {
- TIpcArgs args( &aParams );
- aParams().iFileName = aPath;
- aParams().iTargetUri = aTargetUri;
- SendReceive( ERequestThumbByPathAsync, args, aStatus );
- }
-#endif
-
-void RThumbnailSession::RequestSetThumbnailL(
- TDesC8* aBuffer, const TDesC& aTargetUri,
- TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus )
- {
- if( !aBuffer )
- {
- TN_DEBUG1( "RThumbnailSession::RequestSetThumbnailL() - !aBuffer KErrArgument");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_REQUESTSETTHUMBNAILL, "RThumbnailSession::RequestSetThumbnailL - !aBuffer KErrArgument" );
- User::Leave( KErrArgument );
- }
-
- TIpcArgs args( &aParams, aBuffer, aBuffer->Length(), KCheckValue );
- aParams().iTargetUri = aTargetUri;
- SendReceive( ERequestSetThumbnailByBuffer, args, aStatus );
- }
-
-void RThumbnailSession::RequestSetThumbnailL(
- TInt aBitmapHandle, const TDesC& aTargetUri,
- TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus )
- {
- if( !aBitmapHandle )
- {
- TN_DEBUG1( "RThumbnailSession::RequestSetThumbnailL() - !aBitmapHandle KErrArgument");
- OstTrace0( TRACE_NORMAL, DUP1_RTHUMBNAILSESSION_REQUESTSETTHUMBNAILL, "RThumbnailSession::RequestSetThumbnailL - !aBitmapHandle KErrArgument" );
- User::Leave( KErrArgument );
- }
-
- TIpcArgs args( &aParams, aBitmapHandle, KCheckValue );
- aParams().iTargetUri = aTargetUri;
- SendReceive( ERequestSetThumbnailByBitmap, args, aStatus );
- }
-
-// ---------------------------------------------------------------------------
-// Release bitmap instance kept by server process
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::ReleaseBitmap( TInt aBitmapHandle )
- {
- TInt err = Send( EReleaseBitmap, TIpcArgs( aBitmapHandle ));
- while ( err == KErrServerBusy )
- {
- TN_DEBUG1( "RThumbnailSession::ReleaseBitmap() - server slots full");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_RELEASEBITMAP, "RThumbnailSession::ReleaseBitmap - server slots full" );
-
- err = Send( EReleaseBitmap, TIpcArgs( aBitmapHandle ));
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// Cancel pending thumbnail request
-// ---------------------------------------------------------------------------
-//
-TInt RThumbnailSession::CancelRequest( TThumbnailRequestId aRequestId )
- {
- TInt err = Send( ECancelRequest, TIpcArgs( aRequestId ));
- while ( err == KErrServerBusy )
- {
- TN_DEBUG1( "RThumbnailSession::CancelRequest() - server slots full");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_CANCELREQUEST, "RThumbnailSession::CancelRequest - server slots full" );
-
- err = Send( ECancelRequest, TIpcArgs( aRequestId ));
- }
- return err;
- }
-
-
-// ---------------------------------------------------------------------------
-// Change priority of pending thumbnail request
-// ---------------------------------------------------------------------------
-//
-TInt RThumbnailSession::ChangePriority( TThumbnailRequestId aRequestId, TInt
- aNewPriority )
- {
- TInt err = Send( EChangePriority, TIpcArgs( aRequestId, aNewPriority ));
- while ( err == KErrServerBusy )
- {
- TN_DEBUG1( "RThumbnailSession::ChangePriority() - server slots full");
- OstTrace0( TRACE_NORMAL, RTHUMBNAILSESSION_CHANGEPRIORITY, "RThumbnailSession::ChangePriority - server slots full" );
-
- err = Send( EChangePriority, TIpcArgs( aRequestId, aNewPriority ));
- }
- return err;
- }
-
-// ---------------------------------------------------------------------------
-// Delete thumbnails for given object file
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::DeleteThumbnails( const TDesC& aPath,
- TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus )
- {
- TIpcArgs args( &aParams, &aPath, KCheckValue);
-
- SendReceive( EDeleteThumbnails, args, aStatus );
- }
-
-
-// ---------------------------------------------------------------------------
-// Delete thumbnails by TThumbnailId.
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::DeleteThumbnails( const TThumbnailId aItemId,
- TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus )
- {
- TIpcArgs args( &aParams, aItemId, KCheckValue);
-
- SendReceive( EDeleteThumbnailsById, args, aStatus );
- }
-
-
-// ---------------------------------------------------------------------------
-// Get a list of supported MIME types in a HBufC
-// ---------------------------------------------------------------------------
-//
-HBufC* RThumbnailSession::GetMimeTypeListL()
- {
- TInt size = 0;
- TPckg < TInt > pckg( size );
- User::LeaveIfError( SendReceive( EGetMimeTypeBufferSize, TIpcArgs( &pckg )));
- HBufC* res = HBufC::NewLC( size );
- TPtr ptr = res->Des();
- User::LeaveIfError( SendReceive( EGetMimeTypeList, TIpcArgs( &ptr )));
- CleanupStack::Pop( res );
- return res;
- }
-
-
-// ---------------------------------------------------------------------------
-// Update thumbnails.
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::UpdateThumbnails( const TDesC& aPath, const TInt aOrientation,
- const TInt64 aModified, TThumbnailRequestParamsPckg& aParams, TRequestStatus& aStatus )
- {
- aParams().iFileName = aPath;
- aParams().iTargetUri = KNullDesC;
- aParams().iOrientation = aOrientation;
- aParams().iModified = aModified;
-
- TIpcArgs args( &aParams, KCheckValue);
-
- SendReceive( EUpdateThumbnails, args, aStatus );
- }
-
-// ---------------------------------------------------------------------------
-// Rename thumbnails.
-// ---------------------------------------------------------------------------
-//
-void RThumbnailSession::RenameThumbnails( TThumbnailRequestParamsPckg& aParams,
- TRequestStatus& aStatus )
- {
- TIpcArgs args( &aParams, KCheckValue);
-
- SendReceive( ERenameThumbnails, args, aStatus );
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/bwins/thumbnailmanagerqt.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-EXPORTS
- ?getThumbnail@ThumbnailManager@@QAEHABVQString@@PAXH@Z @ 1 NONAME ; int ThumbnailManager::getThumbnail(class QString const &, void *, int)
- ?qualityPreference@ThumbnailManager@@QBE?AW4QualityPreference@1@XZ @ 2 NONAME ; enum ThumbnailManager::QualityPreference ThumbnailManager::qualityPreference(void) const
- ?cancelRequest@ThumbnailManager@@QAE_NH@Z @ 3 NONAME ; bool ThumbnailManager::cancelRequest(int)
- ?setMode@ThumbnailManager@@QAE_NW4ThumbnailMode@1@@Z @ 4 NONAME ; bool ThumbnailManager::setMode(enum ThumbnailManager::ThumbnailMode)
- ?setQualityPreference@ThumbnailManager@@QAE_NW4QualityPreference@1@@Z @ 5 NONAME ; bool ThumbnailManager::setQualityPreference(enum ThumbnailManager::QualityPreference)
- ?setThumbnail@ThumbnailManager@@QAEHABVQPixmap@@ABVQString@@PAXH@Z @ 6 NONAME ; int ThumbnailManager::setThumbnail(class QPixmap const &, class QString const &, void *, int)
- ?thumbnailSize@ThumbnailManager@@QBE?AVQSize@@XZ @ 7 NONAME ; class QSize ThumbnailManager::thumbnailSize(void) const
- ??1ThumbnailManager@@UAE@XZ @ 8 NONAME ; ThumbnailManager::~ThumbnailManager(void)
- ??0ThumbnailManager@@QAE@PAVQObject@@@Z @ 9 NONAME ; ThumbnailManager::ThumbnailManager(class QObject *)
- ?setThumbnailSize@ThumbnailManager@@QAE_NW4ThumbnailSize@1@@Z @ 10 NONAME ; bool ThumbnailManager::setThumbnailSize(enum ThumbnailManager::ThumbnailSize)
- ?deleteThumbnails@ThumbnailManager@@QAEXABVQString@@@Z @ 11 NONAME ; void ThumbnailManager::deleteThumbnails(class QString const &)
- ?setThumbnailSize@ThumbnailManager@@QAE_NABVQSize@@@Z @ 12 NONAME ; bool ThumbnailManager::setThumbnailSize(class QSize const &)
- ?deleteThumbnails@ThumbnailManager@@QAEXK@Z @ 13 NONAME ; void ThumbnailManager::deleteThumbnails(unsigned long)
- ?changePriority@ThumbnailManager@@QAE_NHH@Z @ 14 NONAME ; bool ThumbnailManager::changePriority(int, int)
- ?getThumbnail@ThumbnailManager@@QAEHKPAXH@Z @ 15 NONAME ; int ThumbnailManager::getThumbnail(unsigned long, void *, int)
- ?mode@ThumbnailManager@@QBE?AW4ThumbnailMode@1@XZ @ 16 NONAME ; enum ThumbnailManager::ThumbnailMode ThumbnailManager::mode(void) const
- ?setThumbnail@ThumbnailManager@@QAEHABVQImage@@ABVQString@@PAXH@Z @ 17 NONAME ; int ThumbnailManager::setThumbnail(class QImage const &, class QString const &, void *, int)
- ?thumbnailReady@ThumbnailManager@@IAEXVQImage@@PAXHH@Z @ 18 NONAME ; void ThumbnailManager::thumbnailReady(class QImage, void *, int, int)
- ?thumbnailReady@ThumbnailManager@@IAEXVQPixmap@@PAXHH@Z @ 19 NONAME ; void ThumbnailManager::thumbnailReady(class QPixmap, void *, int, int)
- ?setThumbnail@ThumbnailManager@@QAEHABVQString@@00PAXH@Z @ 20 NONAME ; int ThumbnailManager::setThumbnail(class QString const &, class QString const &, class QString const &, void *, int)
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/eabi/thumbnailmanagerqt.def Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-EXPORTS
- _ZN16ThumbnailManager12getThumbnailERK7QStringPvi @ 1 NONAME
- _ZN16ThumbnailManager12getThumbnailEmPvi @ 2 NONAME
- _ZN16ThumbnailManager12setThumbnailERK7QPixmapRK7QStringPvi @ 3 NONAME
- _ZN16ThumbnailManager13cancelRequestEi @ 4 NONAME
- _ZN16ThumbnailManager14changePriorityEii @ 5 NONAME
- _ZN16ThumbnailManager16deleteThumbnailsERK7QString @ 6 NONAME
- _ZN16ThumbnailManager16deleteThumbnailsEm @ 7 NONAME
- _ZN16ThumbnailManager16setThumbnailSizeENS_13ThumbnailSizeE @ 8 NONAME
- _ZN16ThumbnailManager16setThumbnailSizeERK5QSize @ 9 NONAME
- _ZN16ThumbnailManager20setQualityPreferenceENS_17QualityPreferenceE @ 10 NONAME
- _ZN16ThumbnailManager7setModeENS_13ThumbnailModeE @ 11 NONAME
- _ZN16ThumbnailManagerC1EP7QObject @ 12 NONAME
- _ZN16ThumbnailManagerC2EP7QObject @ 13 NONAME
- _ZN16ThumbnailManagerD0Ev @ 14 NONAME
- _ZN16ThumbnailManagerD1Ev @ 15 NONAME
- _ZN16ThumbnailManagerD2Ev @ 16 NONAME
- _ZNK16ThumbnailManager13thumbnailSizeEv @ 17 NONAME
- _ZNK16ThumbnailManager17qualityPreferenceEv @ 18 NONAME
- _ZNK16ThumbnailManager4modeEv @ 19 NONAME
- _ZN16ThumbnailManager12setThumbnailERK6QImageRK7QStringPvi @ 20 NONAME
- _ZN16ThumbnailManager14thumbnailReadyE6QImagePvii @ 21 NONAME
- _ZN16ThumbnailManager14thumbnailReadyE7QPixmapPvii @ 22 NONAME
- _ZN16ThumbnailManager12setThumbnailERK7QStringS2_S2_Pvi @ 23 NONAME
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef THUMBNAILMANAGER_P_QT_H
-#define THUMBNAILMANAGER_P_QT_H
-
-#include <QObject>
-#include <QPixmap>
-
-#include <thumbnailmanager.h>
-#include <thumbnailmanager_qt.h>
-#include <thumbnailmanagerobserver.h>
-
-
-class QString;
-class QSize;
-class CThumbnailManager;
-class MThumbnailData;
-class CFbsBitmap;
-class QByteArray;
-
-class TestThumbnailManager;
-
-class ThumbnailManagerPrivate :
-public QObject,
-public MThumbnailManagerObserver
- {
- Q_OBJECT
-public:
-
- /**
- * Constructor
- */
-
- ThumbnailManagerPrivate();
-
- /**
- * Destructor
- */
- virtual ~ThumbnailManagerPrivate();
-
- /**
- * Get quality versus performance preference.
- */
- ThumbnailManager::QualityPreference qualityPreference() const;
-
- /**
- * Set quality versus performance preference.
- */
- bool setQualityPreference( ThumbnailManager::QualityPreference qualityPreference );
-
- /**
- * Get the current desired size for thumbnail bitmaps.
- */
- QSize thumbnailSize() const;
-
- /**
- * Set desired size for thumbnail bitmaps.
- */
- bool setThumbnailSize( const QSize& aThumbnailSize );
-
- /**
- * Set desired size for thumbnail bitmaps.
- */
- bool setThumbnailSize( ThumbnailManager::ThumbnailSize thumbnailSize );
-
- /**
- * Get current mode for thumbnail generation.
- */
- ThumbnailManager::ThumbnailMode mode() const;
-
- /**
- * Set mode for thumbnail generation.
- */
- bool setMode( ThumbnailManager::ThumbnailMode mode );
-
- /**
- * Get a thumbnail for an object file. If a thumbnail already exists, it
- * is loaded and if a thumbnail does not exist, it is created
- * transparently.
- */
- int getThumbnail( const QString& fileName, void * clientData,
- int priority );
-
- /**
- * Get a persistent thumbnail for an object file. If a thumbnail already
- * exists, it is loaded and if a thumbnail does not exist, it is created
- * transparently.
- */
- int getThumbnail( unsigned long int aThumbnailId, void * clientData,
- int priority );
-
- /**
- * Set a thumbnail for an object file generated from pixmap delivered.
- * thumbnailReady() signal will be emited when the operation is complete.
- */
- int setThumbnail( const QPixmap& source, const QString& fileName,
- void * clientData, int priority );
-
- /**
- * Set a thumbnail for an object file generated from pixmap delivered.
- * thumbnailReady() signal will be emited when the operation is complete.
- */
- int setThumbnail( const QImage& source, const QString& fileName,
- void * clientData, int priority );
-
- /**
- * Set a thumbnail for an object file generated from source file.
- * thumbnailReady() signal will be emited when the operation is complete.
- */
- int setThumbnail( const QString& sourceFileName, const QString& targetFileName,
- const QString& mimeType, void * clientData, int priority );
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- */
- void deleteThumbnails( const QString& fileName );
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- */
- void deleteThumbnails( unsigned long int thumbnailId );
-
- /**
- * Cancel a thumbnail operation.
- */
- bool cancelRequest( int id );
-
- /**
- * Change the priority of a queued thumbnail operation.
- */
- bool changePriority( int id, int newPriority );
-
- //FROM MThumbnailManagerObserver
- /**
- * Preview thumbnail generation or loading is complete.
- *
- * This callback is not called unless EOptimizeForQualityWithPreview flag
- * was specified.
- *
- * This callback is not called if any of the following is true:
- * - an error occurred while processing the preview thumbnail
- * - a suitable existing thumbnail was not found
- * - a high quality thumbnail is already available
- *
- * The MThumbnailData instance is only valid for the duration of
- * this call. It may not be stored for later use. If the client should
- * want to use the bitmap data later, it can claim ownership of the
- * CFbsBitmap object by calling DetachBitmap().
- *
- * @since S60 v5.0
- * @param aThumbnail An object representing the resulting thumbnail.
- * @param aId Request ID for the operation
- */
- void ThumbnailPreviewReady( MThumbnailData& aThumbnail,
- TThumbnailRequestId aId );
-
- /**
- * Final thumbnail bitmap generation or loading is complete.
- *
- * The MThumbnailData instance is only valid for the duration of
- * this call. It may not be stored for later use. If the client should
- * want to use the bitmap data later, it can claim ownership of the
- * CFbsBitmap object by calling DetachBitmap().
- *
- * @since S60 v5.0
- * @param aError Error code.
- * @param aThumbnail An object representing the resulting thumbnail.
- * @param aId Request ID for the operation.
- */
- void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail,
- TThumbnailRequestId aId );
-
-
-signals:
-
- /**
- * Final thumbnail bitmap generation or loading is complete.
- */
- void thumbnailReady( QPixmap , void * , int , int );
-
- void thumbnailReady( QImage , void * , int , int );
-
-private:
- /**
- * Limit priority to presumed range.
- */
- int convertPriority(int basePriority);
-
-
-public:
-
- int connectionCounterImage;
-
- int connectionCounterPixmap;
-
-private:
-
- ThumbnailManager *q_ptr;
-
- CThumbnailManager* iThumbnailManager;
-
- QByteArray* byteArray;
-
- friend class ThumbnailManager;
- friend class TestThumbnailManager;
-
-};
-
-#endif // ThumbnailManager_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_p_qt.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <fbs.h>
-#include <QtCore>
-#include <qpixmap.h>
-#include <thumbnailmanager.h>
-#include <thumbnaildata.h>
-
-#include "thumbnailmanager_qt.h"
-#include "thumbnailmanager_p_qt.h"
-
-#include <e32base.h>
-
-const int ThumbnailMangerPriorityLowest = CActive::EPriorityIdle;
-const int ThumbnailMangerPriorityHighest = CActive::EPriorityHigh;
-
-ThumbnailManagerPrivate::ThumbnailManagerPrivate() :
- connectionCounterImage( 0 ),
- connectionCounterPixmap( 0 ),
- iThumbnailManager( NULL ),
- byteArray( NULL )
-{
- TRAP_IGNORE(
- iThumbnailManager = CThumbnailManager::NewL( *this );
- iThumbnailManager->SetDisplayModeL( EColor64K );
- );
-}
-
-ThumbnailManagerPrivate::~ThumbnailManagerPrivate()
-{
- if( iThumbnailManager ){
- delete iThumbnailManager;
- }
- if( byteArray ){
- delete byteArray;
- }
-}
-
-ThumbnailManager::QualityPreference ThumbnailManagerPrivate::qualityPreference() const
-{
- return static_cast<ThumbnailManager::QualityPreference>( iThumbnailManager->QualityPreference() );
-}
-
-bool ThumbnailManagerPrivate::setQualityPreference( ThumbnailManager::QualityPreference qualityPreference )
-{
- TRAPD( err, iThumbnailManager->SetQualityPreferenceL( static_cast<CThumbnailManager::TThumbnailQualityPreference>(qualityPreference) ));
- return ( err == KErrNone );
-}
-
-QSize ThumbnailManagerPrivate::thumbnailSize() const
-{
- TSize tsize( iThumbnailManager->ThumbnailSize() );
- QSize qsize( tsize.iWidth, tsize.iHeight);
- return qsize;
-}
-
-bool ThumbnailManagerPrivate::setThumbnailSize( const QSize& thumbnailSize )
-{
- TRAPD( err, iThumbnailManager->SetThumbnailSizeL( TSize( thumbnailSize.width(), thumbnailSize.height() ) ) );
- return ( err == KErrNone );
-}
-
-bool ThumbnailManagerPrivate::setThumbnailSize( ThumbnailManager::ThumbnailSize thumbnailSize )
-{
- TThumbnailSize size(EUnknownThumbnailSize);
- switch( thumbnailSize ){
- case ThumbnailManager::ThumbnailSmall:
- size = EListThumbnailSize;
- break;
- case ThumbnailManager::ThumbnailMedium:
- size = EGridThumbnailSize;
- break;
- case ThumbnailManager::ThumbnailLarge:
- size = EFullScreenThumbnailSize;
- break;
- default:
- break;
- }
-
- TRAPD( err, iThumbnailManager->SetThumbnailSizeL( size ) );
- return ( err == KErrNone );
-}
-
-ThumbnailManager::ThumbnailMode ThumbnailManagerPrivate::mode() const
-{
- return static_cast<ThumbnailManager::ThumbnailMode>( iThumbnailManager->Flags() );
-}
-
-bool ThumbnailManagerPrivate::setMode( ThumbnailManager::ThumbnailMode mode )
-{
- TRAPD( err, iThumbnailManager->SetFlagsL( static_cast<CThumbnailManager::TThumbnailFlags>( mode ) ) );
- return ( err == KErrNone );
-}
-
-int ThumbnailManagerPrivate::getThumbnail( const QString& fileName, void* clientData,
- int priority )
-{
- int result( -1 );
- QString symbFileName( fileName );
-
- priority = convertPriority(priority);
-
- if( symbFileName.contains( "/" ) )
- symbFileName.replace( "/", "\\", Qt::CaseSensitive );
-
- RBuf buf;
- TRAP_IGNORE(
- CleanupClosePushL( buf );
- buf.CreateL( symbFileName.length() );
- buf.Copy( symbFileName.utf16(), symbFileName.length() );
-
- CThumbnailObjectSource* objSrc = CThumbnailObjectSource::NewLC( buf, KNullDesC );
- result = iThumbnailManager->GetThumbnailL( *objSrc, clientData, priority );
- CleanupStack::PopAndDestroy( 2, &buf );
- );
- return result;
-}
-
-int ThumbnailManagerPrivate::getThumbnail( unsigned long int aThumbnailId, void* clientData,
- int priority )
-{
- int result( -1 );
-
- priority = convertPriority(priority);
-
- TRAP_IGNORE( result = iThumbnailManager->GetThumbnailL( aThumbnailId, clientData, priority ));
- return result;
-}
-
-int ThumbnailManagerPrivate::setThumbnail( const QPixmap& source, const QString& fileName,
- void * clientData, int priority )
-{
- int result( -1 );
- RBuf file;
- _LIT( mime, "image/png" );
-
- priority = convertPriority(priority);
-
- if( !byteArray ){
- byteArray = new QByteArray();
- }
- QBuffer buffer( byteArray );
- buffer.open( QBuffer::ReadWrite );
- QDataStream dataStream( &buffer );
-
- dataStream << source;
-
- int offset = ( dataStream.version() >= 5 ? 4 : 0 );
-
- TRAP_IGNORE(
- CleanupClosePushL( file );
- file.CreateL( fileName.length() );
- file.Copy( fileName.utf16(), fileName.length() );
-
- HBufC* mimetype = HBufC::NewLC( 9 );
- mimetype->Des() = mime();
-
- TPtrC8* ptr = new TPtrC8( reinterpret_cast<const TUint8*>( byteArray->data() + offset ), byteArray->count() - offset );
-
- CThumbnailObjectSource* objSrc = CThumbnailObjectSource::NewLC( ptr, *mimetype, file );
- result = iThumbnailManager->SetThumbnailL( *objSrc, clientData, priority );
- CleanupStack::PopAndDestroy( 3, &file );
- );
- return result;
-}
-
-int ThumbnailManagerPrivate::setThumbnail( const QImage& source, const QString& fileName,
- void * clientData, int priority )
-{
- int result( -1 );
- RBuf file;
- _LIT( mime, "image/png" );
-
- priority = convertPriority(priority);
-
- if( !byteArray ){
- byteArray = new QByteArray();
- }
- QBuffer buffer( byteArray );
- buffer.open( QBuffer::ReadWrite );
- QDataStream dataStream( &buffer );
-
- dataStream << source;
-
- int offset = ( dataStream.version() >= 5 ? 4 : 0 );
-
- TRAP_IGNORE(
- CleanupClosePushL( file );
- file.CreateL( fileName.length() );
- file.Copy( fileName.utf16(), fileName.length() );
-
- HBufC* mimetype = HBufC::NewLC( 9 );
- mimetype->Des() = mime();
-
- TPtrC8* ptr = new TPtrC8( reinterpret_cast<const TUint8*>( byteArray->data() + offset ), byteArray->count() - offset );
-
- CThumbnailObjectSource* objSrc = CThumbnailObjectSource::NewLC( ptr, *mimetype, file );
- result = iThumbnailManager->SetThumbnailL( *objSrc, clientData, priority );
- CleanupStack::PopAndDestroy( 3, &file );
- );
-
- return result;
-}
-
-int ThumbnailManagerPrivate::setThumbnail( const QString& sourceFileName, const QString& targetFileName,
- const QString& mimeType, void * clientData, int priority )
-{
- int result( -1 );
- QString symbSourceFile( sourceFileName );
- QString symbTargetFile( targetFileName );
- RBuf sourceFile;
- RBuf targetFile;
- RBuf mime;
-
- priority = convertPriority(priority);
-
- if( symbSourceFile.contains( "/" ) )
- symbSourceFile.replace( "/", "\\", Qt::CaseSensitive );
-
- if( symbTargetFile.contains( "/" ) )
- symbTargetFile.replace( "/", "\\", Qt::CaseSensitive );
-
- TRAP_IGNORE(
- CleanupClosePushL( sourceFile );
- sourceFile.CreateL( symbSourceFile.length() );
- sourceFile.Copy( symbSourceFile.utf16(), symbSourceFile.length() );
-
- CleanupClosePushL( targetFile );
- targetFile.CreateL( symbTargetFile.length() );
- targetFile.Copy( symbTargetFile.utf16(), symbTargetFile.length() );
-
- CleanupClosePushL( mime );
-
- if (mimeType.length())
- {
- mime.CreateL( mimeType.length() );
- mime.Copy( mimeType.utf16(), mimeType.length() );
- }
- else
- {
- mime.Assign(KNullDesC().AllocL());
- }
-
- CThumbnailObjectSource* objSrc = CThumbnailObjectSource::NewLC( sourceFile, targetFile, mime );
- result = iThumbnailManager->SetThumbnailL( *objSrc, clientData, priority );
- CleanupStack::PopAndDestroy( 4, &sourceFile );
- );
-
- return result;
-}
-
-void ThumbnailManagerPrivate::deleteThumbnails( const QString& fileName )
-{
- QString symbFileName( fileName );
-
- if( symbFileName.contains( "/" ) )
- symbFileName.replace( "/", "\\", Qt::CaseSensitive );
-
- RBuf buf;
- TRAP_IGNORE( CleanupClosePushL( buf );
- buf.CreateL( symbFileName.length() );
- buf.Copy( symbFileName.utf16(), symbFileName.length() );
- CThumbnailObjectSource* objSrc = CThumbnailObjectSource::NewL( buf, KNullDesC );
- iThumbnailManager->DeleteThumbnails( *objSrc );
- CleanupStack::PopAndDestroy( &buf );
- delete objSrc;
- );
-}
-
-void ThumbnailManagerPrivate::deleteThumbnails( unsigned long int thumbnailId )
-{
- iThumbnailManager->DeleteThumbnails( thumbnailId );
-}
-
-bool ThumbnailManagerPrivate::cancelRequest( int id )
-{
- return ( iThumbnailManager->CancelRequest( id ) == KErrNone );
-}
-
-bool ThumbnailManagerPrivate::changePriority( int id, int newPriority )
-{
- newPriority = convertPriority(newPriority);
-
- return ( iThumbnailManager->ChangePriority( id, newPriority ) == KErrNone );
-}
-
-int ThumbnailManagerPrivate::convertPriority(int basePriority)
-{
- return qBound(ThumbnailMangerPriorityLowest, basePriority, ThumbnailMangerPriorityHighest);
-}
-
-void ThumbnailManagerPrivate::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/,
- TThumbnailRequestId /*aId*/ )
-{
-}
-
-void ThumbnailManagerPrivate::ThumbnailReady( TInt aError, MThumbnailData& aThumbnail,
- TThumbnailRequestId aId )
-{
- if( byteArray ){
- delete byteArray;
- byteArray = NULL;
- }
-
- if (connectionCounterImage || connectionCounterPixmap) {
- QPixmap pixmap;
-
- if (aError == KErrNone) {
- pixmap = QPixmap::fromSymbianCFbsBitmap(aThumbnail.Bitmap());
- } else {
- pixmap = QPixmap();
- }
-
- if (connectionCounterImage) {
- emit q_ptr->thumbnailReady(pixmap.toImage(), aThumbnail.ClientData(), aId, aError);
- }
-
- if (connectionCounterPixmap) {
- emit q_ptr->thumbnailReady(pixmap, aThumbnail.ClientData(), aId, aError);
- }
- }
-}
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/src/thumbnailmanager_qt.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QSize>
-#include "thumbnailmanager_qt.h"
-#include "thumbnailmanager_p_qt.h"
-
-Q_DECL_EXPORT ThumbnailManager::ThumbnailManager( QObject* parentPtr ) :
-QObject( parentPtr ),
-d( new ThumbnailManagerPrivate() )
-{
- d->q_ptr = this;
-}
-
-
-Q_DECL_EXPORT ThumbnailManager::~ThumbnailManager()
-{
- if( NULL != d ){
- delete d;
- }
-}
-
-Q_DECL_EXPORT ThumbnailManager::QualityPreference ThumbnailManager::qualityPreference() const
-{
- return d->qualityPreference();
-}
-
-Q_DECL_EXPORT bool ThumbnailManager::setQualityPreference( QualityPreference
- qualityPreference )
-{
- return d->setQualityPreference( qualityPreference );
-}
-
-Q_DECL_EXPORT QSize ThumbnailManager::thumbnailSize() const
-{
- return d->thumbnailSize();
-}
-
-Q_DECL_EXPORT bool ThumbnailManager::setThumbnailSize( const QSize& thumbnailSize )
-{
- return d->setThumbnailSize( thumbnailSize );
-}
-
-Q_DECL_EXPORT bool ThumbnailManager::setThumbnailSize( ThumbnailSize thumbnailSize )
-{
- return d->setThumbnailSize( thumbnailSize );
-}
-
-Q_DECL_EXPORT ThumbnailManager::ThumbnailMode ThumbnailManager::mode() const
-{
- return d->mode();
-}
-
-Q_DECL_EXPORT bool ThumbnailManager::setMode( ThumbnailMode mode )
-{
- return d->setMode( mode );
-}
-
-Q_DECL_EXPORT int ThumbnailManager::getThumbnail( const QString& fileName, void * clientData,
- int priority )
-{
- return d->getThumbnail( fileName, clientData, priority );
-}
-
-Q_DECL_EXPORT int ThumbnailManager::getThumbnail( unsigned long int thumbnailId, void * clientData,
- int priority )
-{
- return d->getThumbnail( thumbnailId, clientData, priority );
-}
-
-Q_DECL_EXPORT int ThumbnailManager::setThumbnail( const QPixmap& source, const QString& filename,
- void * clientData , int priority )
-{
- return d->setThumbnail( source, filename, clientData, priority );
-}
-
-Q_DECL_EXPORT int ThumbnailManager::setThumbnail( const QImage& source, const QString& filename,
- void * clientData , int priority )
-{
- return d->setThumbnail( source, filename, clientData, priority );
-}
-
-Q_DECL_EXPORT int ThumbnailManager::setThumbnail( const QString& sourceFileName, const QString& targetFileName,
- const QString& mimeType, void * clientData , int priority )
-{
- return d->setThumbnail( sourceFileName, targetFileName, mimeType, clientData, priority );
-}
-
-Q_DECL_EXPORT void ThumbnailManager::deleteThumbnails( const QString& fileName )
-{
- d->deleteThumbnails( fileName );
-}
-
-Q_DECL_EXPORT void ThumbnailManager::deleteThumbnails( unsigned long int thumbnailId )
-{
- d->deleteThumbnails( thumbnailId );
-}
-
-Q_DECL_EXPORT bool ThumbnailManager::cancelRequest( int id )
-{
- return d->cancelRequest( id );
-}
-
-Q_DECL_EXPORT bool ThumbnailManager::changePriority( int id, int newPriority )
-{
- return d->changePriority( id, newPriority );
-}
-
-void ThumbnailManager::connectNotify(const char *signal)
-{
- if (QLatin1String(signal) == SIGNAL(thumbnailReady(QPixmap,void*,int,int))) {
- d->connectionCounterPixmap++;
- } else if (QLatin1String(signal) == SIGNAL(thumbnailReady(QImage,void*,int,int))) {
- d->connectionCounterImage++;
- }
-}
-
-void ThumbnailManager::disconnectNotify(const char *signal)
-{
- if (QLatin1String(signal) == SIGNAL(thumbnailReady(QPixmap,void*,int,int))) {
- d->connectionCounterPixmap--;
- } else if (QLatin1String(signal) == SIGNAL(thumbnailReady(QImage,void*,int,int))) {
- d->connectionCounterImage--;
- }
-}
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/thumbnailmanagerqt.iby Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#ifndef __THUMBNAILMANAGER_QT_IBY__
-#define __THUMBNAILMANAGER_QT_IBY__
-
-#include <bldvariant.hrh>
-
-file=ABI_DIR\BUILD_DIR\thumbnailmanagerqt.dll SHARED_LIB_DIR\thumbnailmanagerqt.dll
-
-#endif
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/thumbnailmanagerqt.pro Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = lib
-TARGET = thumbnailmanagerqt
-
-symbian:TARGET.UID3=0x20029F65
-
-DEFINES+=TNMQT_DLL
-
-INCLUDEPATH += .
-INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
-
-TARGET.CAPABILITY = CAP_GENERAL_DLL
-
-symbian:TARGET.EPOCALLOWDLLDATA = 1
-
-# Input
-LIBS += -lthumbnailmanager.dll \
- -lfbscli.dll
-
-
-SOURCES += src/thumbnailmanager_qt.cpp \
- src/thumbnailmanager_p_qt.cpp
-
-HEADERS += ../../../imagehandling_plat/thumbnailmanager_api/inc/thumbnailmanager_qt.h \
- inc/thumbnailmanager_p_qt.h
-
-BLD_INF_RULES.prj_exports += "thumbnailmanagerqt.iby /epoc32/rom/include/core/mw/"
-
-myDefInclude = "NOSTRICTDEF" \
-"$${LITERAL_HASH}if defined(WINS)"\
-"DEFFILE bwins/thumbnailmanagerqt.def "\
-"$${LITERAL_HASH}else "\
-"DEFFILE eabi/thumbnailmanagerqt.def "\
-"$${LITERAL_HASH}endif"
-MMP_RULES += myDefInclude
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/moc_thumbnailmanager_p_qt.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/****************************************************************************
-** Meta object code from reading C++ file 'thumbnailmanager_p_qt.h'
-**
-** Created: Fri 30. Apr 11:26:04 2010
-** by: The Qt Meta Object Compiler version 62 (Qt 4.6.3)
-**
-** WARNING! All changes made in this file will be lost!
-*****************************************************************************/
-
-#include "../inc/thumbnailmanager_p_qt.h"
-#if !defined(Q_MOC_OUTPUT_REVISION)
-#error "The header file 'thumbnailmanager_p_qt.h' doesn't include <QObject>."
-#elif Q_MOC_OUTPUT_REVISION != 62
-#error "This file was generated using the moc from 4.6.3. It"
-#error "cannot be used with the include files from this version of Qt."
-#error "(The moc has changed too much.)"
-#endif
-
-QT_BEGIN_MOC_NAMESPACE
-static const uint qt_meta_data_ThumbnailManagerPrivate[] = {
-
- // content:
- 4, // revision
- 0, // classname
- 0, 0, // classinfo
- 2, 14, // methods
- 0, 0, // properties
- 0, 0, // enums/sets
- 0, 0, // constructors
- 0, // flags
- 2, // signalCount
-
- // signals: signature, parameters, type, tag, flags
- 29, 25, 24, 24, 0x05,
- 67, 25, 24, 24, 0x05,
-
- 0 // eod
-};
-
-static const char qt_meta_stringdata_ThumbnailManagerPrivate[] = {
- "ThumbnailManagerPrivate\0\0,,,\0"
- "thumbnailReady(QPixmap,void*,int,int)\0"
- "thumbnailReady(QImage,void*,int,int)\0"
-};
-
-const QMetaObject ThumbnailManagerPrivate::staticMetaObject = {
- { &QObject::staticMetaObject, qt_meta_stringdata_ThumbnailManagerPrivate,
- qt_meta_data_ThumbnailManagerPrivate, 0 }
-};
-
-#ifdef Q_NO_DATA_RELOCATION
-const QMetaObject &ThumbnailManagerPrivate::getStaticMetaObject() { return staticMetaObject; }
-#endif //Q_NO_DATA_RELOCATION
-
-const QMetaObject *ThumbnailManagerPrivate::metaObject() const
-{
- return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
-}
-
-void *ThumbnailManagerPrivate::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_ThumbnailManagerPrivate))
- return static_cast<void*>(const_cast< ThumbnailManagerPrivate*>(this));
- if (!strcmp(_clname, "MThumbnailManagerObserver"))
- return static_cast< MThumbnailManagerObserver*>(const_cast< ThumbnailManagerPrivate*>(this));
- return QObject::qt_metacast(_clname);
-}
-
-int ThumbnailManagerPrivate::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
-{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- switch (_id) {
- case 0: thumbnailReady((*reinterpret_cast< QPixmap(*)>(_a[1])),(*reinterpret_cast< void*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break;
- case 1: thumbnailReady((*reinterpret_cast< QImage(*)>(_a[1])),(*reinterpret_cast< void*(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break;
- default: ;
- }
- _id -= 2;
- }
- return _id;
-}
-
-// SIGNAL 0
-void ThumbnailManagerPrivate::thumbnailReady(QPixmap _t1, void * _t2, int _t3, int _t4)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) };
- QMetaObject::activate(this, &staticMetaObject, 0, _a);
-}
-
-// SIGNAL 1
-void ThumbnailManagerPrivate::thumbnailReady(QImage _t1, void * _t2, int _t3, int _t4)
-{
- void *_a[] = { 0, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)), const_cast<void*>(reinterpret_cast<const void*>(&_t3)), const_cast<void*>(reinterpret_cast<const void*>(&_t4)) };
- QMetaObject::activate(this, &staticMetaObject, 1, _a);
-}
-QT_END_MOC_NAMESPACE
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,495 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-#include <QtGui>
-#include <QtTest/QtTest>
-#include <QEventLoop>
-#include <QDebug>
-#include <QImage>
-#include <fbs.h>
-
-#include <thumbnaildata.h>
-
-#include <thumbnailmanager_qt.h>
-#include "thumbnailmanager_p_qt.h"
-
-class TestThumbnailManager : public QObject
-{
- Q_OBJECT
-
-public:
- TestThumbnailManager(): QObject(), wrapper( NULL ), ipixmap( NULL ) {};
-
-public slots:
- void thumbnailReady( QPixmap , void * , int , int );
-
- void thumbnailReady_p( QPixmap , void * , int , int );
-
- void thumbnailReadyPixmap( QPixmap , void * , int , int );
-
- void thumbnailReadyImage( QImage , void * , int , int );
-
-private slots:
- void init();
- void cleanup();
-
- void testThumbnailReadyError();
- void testThumbnailReadyValid();
-
- void testThumbnailReadyImage();
- void testThumbnailReadyPixmap();
- void testThumbnailReadyImageAndPixmap();
-
- void createAndDestroy();
- void qualityPreference();
- void thumbnailSize();
- void thumbnailMode();
-
- void getThumbnailByName();
- void getThumbnailById();
- void setThumbnail();
- void setThumbnailFromPath();
- void cancelRequest();
- void changePriority();
- void deleteThumbnailsByName();
- void deleteThumbnailsById();
-
- void testPriorities_data();
- void testPriorities();
-
-
-public:
- ThumbnailManager *wrapper;
- ThumbnailManagerPrivate *wrapper_p;
-
- QPixmap* ipixmap;
-
- int aid;
- int aerrorCode;
- bool pixmapNull;
-
- //pixmap
- int pixmapId;
- int pixmapErr;
- void *pixmapDataPtr;
-
- //image
- int imageId;
- int imageErr;
- void *imageDataPtr;
-
-};
-
-enum testDataType{
- AllNull,
- BitmapValid
-};
-
-class TestThumbnailData : public MThumbnailData
-{
-public:
- static const int BITMAP_WIDTH = 26;
- static const int BITMAP_HEIGHT = 15;
-
-public:
- TestThumbnailData( testDataType type, void* clientData_ = 0) : bitmap(0), clientData(clientData_)
- {
- switch( type ){
- case AllNull:
- break;
-
- case BitmapValid:
- bitmap = new CFbsBitmap();
- QVERIFY( !bitmap->Create(TSize(BITMAP_WIDTH, BITMAP_HEIGHT),EColor64K) );
- QVERIFY( !bitmap->Load( _L("c:\\tnmwrapper_tsrc.mbm") ) );
- break;
- };
-
- };
-
- ~TestThumbnailData() {
- if( bitmap ) {
- delete bitmap;
- }
- };
-
- CFbsBitmap* Bitmap() {return bitmap;};
-
- CFbsBitmap* DetachBitmap() {return bitmap;};
-
- TAny* ClientData(){ return clientData; };
-
-public:
- CFbsBitmap* bitmap;
- TAny* clientData;
-
-};
-
-// --- test initialization ---
-
-void TestThumbnailManager::init()
-{
- wrapper = new ThumbnailManager();
- connect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReady( QPixmap , void* , int , int )));
-
- wrapper_p = wrapper->d; //new ThumbnailManagerPrivate();
-}
-
-void TestThumbnailManager::cleanup()
-{
- disconnect( wrapper, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReady( QPixmap , void* , int , int )));
- delete wrapper;
- wrapper = NULL;
-
- if( ipixmap ) {
- delete ipixmap;
- ipixmap = NULL;
- }
-
- // delete wrapper_p;
-}
-
-// --- test ---
-
-/**
- * Simple create and destroy.
- */
-void TestThumbnailManager::createAndDestroy()
-{
- //empty
-}
-
-/**
- * Checking quality preference flag.
- */
-void TestThumbnailManager::qualityPreference()
-{
- QVERIFY( wrapper->setQualityPreference( ThumbnailManager::OptimizeForQuality ) );
- QVERIFY( wrapper->setQualityPreference( ThumbnailManager::OptimizeForPerformance ) );
- QVERIFY( wrapper->qualityPreference() == ThumbnailManager::OptimizeForPerformance );
-}
-
-/**
- * Checking thumbnail size flag.
- */
-void TestThumbnailManager::thumbnailSize()
-{
- QVERIFY( wrapper->setThumbnailSize( ThumbnailManager::ThumbnailSmall ) );
- QVERIFY( wrapper->setThumbnailSize( ThumbnailManager::ThumbnailMedium ) );
- QVERIFY( wrapper->setThumbnailSize( ThumbnailManager::ThumbnailLarge ) );
- QVERIFY( wrapper->setThumbnailSize( QSize( 100, 100 ) ) );
- QVERIFY( wrapper->thumbnailSize() == QSize( 100, 100 ) );
-}
-
-/**
- * Checking thumbnail mode flag.
- */
-void TestThumbnailManager::thumbnailMode()
-{
- QVERIFY( wrapper->setMode( ThumbnailManager::Default ) );
- QVERIFY( wrapper->setMode( ThumbnailManager::AllowAnySize ) );
- QVERIFY( wrapper->setMode( ThumbnailManager::DoNotCreate ) );
-
- QVERIFY( wrapper->setMode( ThumbnailManager::CropToAspectRatio ) );
- QVERIFY( wrapper->mode() == ThumbnailManager::CropToAspectRatio );
-}
-
-/**
- * Checking thumbnail mode flag.
- */
-void TestThumbnailManager::getThumbnailByName()
-{
- wrapper->setMode( ThumbnailManager::CropToAspectRatio );
- wrapper->setThumbnailSize( QSize( 200, 50 ));
- QVERIFY( wrapper->getThumbnail( "c:\\tnmwrapper_tsrc.png", NULL, -99 ) != -1 );
- QVERIFY( wrapper->getThumbnail( "c:/tnmwrapper_tsrc.png", NULL, -99 ) != -1 );
-}
-
-void TestThumbnailManager::getThumbnailById()
-{
- wrapper->setMode( ThumbnailManager::CropToAspectRatio );
- wrapper->setThumbnailSize( QSize( 200, 50 ));
- QVERIFY( wrapper->getThumbnail( 2, NULL, -99 ) != -1 );
-}
-
-void TestThumbnailManager::setThumbnail()
-{
- ipixmap = new QPixmap();
- ipixmap->load( "c:\\tnmwrapper.bmp" );
- wrapper->setMode( ThumbnailManager::CropToAspectRatio );
- wrapper->setThumbnailSize(ThumbnailManager::ThumbnailMedium);
- QVERIFY( wrapper->setThumbnail( *ipixmap, "c:\\tnmwrapper_tsrc.png" ) != -1 );
- ipixmap->fill();
- QVERIFY( wrapper->setThumbnail( *ipixmap, "c:\\tnmwrapper_tsrc.png" ) != -1 );
-
- //QI,mage
- QImage *img = new QImage("c:\\tnmwrapper.bmp");
- QVERIFY( wrapper->setThumbnail( *img, "c:\\tnmwrapper_tsrc.png" ) != -1 );
- img->fill(0);
- QVERIFY( wrapper->setThumbnail( *img, "c:\\tnmwrapper_tsrc.png" ) != -1 );
- delete img;
-}
-
-void TestThumbnailManager::setThumbnailFromPath()
-{
- // normal URI
- QVERIFY( wrapper->setThumbnail( "c:\\tnmwrapper_tsrc.png", "c:\\tnmwrapper_tsrc.vcf", "contact/x-vcard" ) != -1 );
-
- // virtual URI
- QVERIFY( wrapper->setThumbnail( "c:\\tnmwrapper_tsrc.png", "c:tnmwrapper_tsrc.vcf", "contact/x-vcard" ) != -1 );
-
- // no mime
- QVERIFY( wrapper->setThumbnail( "c:\\tnmwrapper_tsrc.png", "c:tnmwrapper_tsrc.vcf" ) != -1 );
-}
-
-void TestThumbnailManager::cancelRequest()
-{
- wrapper->setMode( ThumbnailManager::CropToAspectRatio );
- wrapper->setThumbnailSize( QSize( 200, 50 ));
- QVERIFY( wrapper->cancelRequest( wrapper->getThumbnail( "c:\\tnmwrapper_tsrc.png", NULL, -99 ) ) );
- QVERIFY( !wrapper->cancelRequest( 123 ) ); //test request not found
-}
-
-void TestThumbnailManager::changePriority()
-{
- wrapper->setMode( ThumbnailManager::CropToAspectRatio );
- wrapper->setThumbnailSize( QSize( 200, 50 ));
- QVERIFY( wrapper->changePriority( wrapper->getThumbnail( "c:\\tnmwrapper_tsrc.png", NULL, -99 ), -80 ) );
-}
-
-void TestThumbnailManager::deleteThumbnailsByName()
-{
- wrapper->deleteThumbnails( "c:/tnmwrapper_tsrc.png" );
- wrapper->deleteThumbnails( "c:\\tnmwrapper_tsrc.png" );
-}
-
-void TestThumbnailManager::deleteThumbnailsById()
-{
- wrapper->deleteThumbnails( 2 );
-}
-
-void TestThumbnailManager::testThumbnailReadyError()
-{
- int a=0;
-
- QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReady_p( QPixmap , void* , int , int )), Qt::DirectConnection ) );
-
- //test bytearray not null and thumbnail error
- TestThumbnailData tdata1(AllNull);
- aid = 12;
- aerrorCode = -1;
- pixmapNull = true;
- wrapper_p->ThumbnailReady( aerrorCode, tdata1, aid );
-
- disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReady_p( QPixmap , void* , int , int )));
-}
-
-void TestThumbnailManager::testThumbnailReadyValid()
-{
- QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReady_p( QPixmap , void* , int , int )), Qt::DirectConnection ) );
-
- TestThumbnailData tdata3( BitmapValid );
- aid = 10;
- aerrorCode = 0;
- pixmapNull = false;
- wrapper_p->ThumbnailReady( aerrorCode, tdata3, aid );
-
- disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReady_p( QPixmap , void* , int , int )));
-}
-
-void TestThumbnailManager::testThumbnailReadyImage()
-{
- QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
- this, SLOT( thumbnailReadyImage( QImage , void* , int , int )), Qt::DirectConnection ) );
-
- pixmapId = 0;
- pixmapErr = 0;
- pixmapDataPtr = 0;
-
- imageId = 432;
- imageErr = KErrNone;
- imageDataPtr = reinterpret_cast<void*>(0x1234);
-
- TestThumbnailData td = TestThumbnailData(BitmapValid);
- td.clientData = imageDataPtr;
-
- wrapper_p->ThumbnailReady(imageErr, td, imageId);
-
- QVERIFY(td.bitmap!=0);
- QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH);
- QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
-
- disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
- this, SLOT( thumbnailReadyImage(QImage, void* , int , int )));
-}
-
-void TestThumbnailManager::testThumbnailReadyPixmap()
-{
- QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )), Qt::DirectConnection ) );
-
- pixmapId = 432;
- pixmapErr = -7;
- pixmapDataPtr = reinterpret_cast<void*>(0x1234);
-
- imageId = 0;
- imageErr = 0;
- imageDataPtr = 0;
-
- TestThumbnailData td = TestThumbnailData(BitmapValid);
- td.clientData = pixmapDataPtr;
-
- wrapper_p->ThumbnailReady(pixmapErr, td, pixmapId);
-
- QVERIFY(td.bitmap!=0);
- QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH);
- QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
-
- disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
-}
-
-void TestThumbnailManager::testThumbnailReadyImageAndPixmap()
-{
- QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )), Qt::DirectConnection ) );
-
- QVERIFY( connect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
- this, SLOT( thumbnailReadyImage( QImage , void* , int , int )), Qt::DirectConnection ) );
-
- pixmapId = 432;
- pixmapErr = KErrNone;
- pixmapDataPtr = reinterpret_cast<void*>(0x1234);
-
- imageId = pixmapId;
- imageErr = pixmapErr;
- imageDataPtr = pixmapDataPtr;
-
- TestThumbnailData td = TestThumbnailData(BitmapValid);
- td.clientData = pixmapDataPtr;
-
- wrapper_p->ThumbnailReady(pixmapErr, td, pixmapId);
-
- QVERIFY(td.bitmap!=0);
- QVERIFY(td.bitmap->SizeInPixels().iWidth == TestThumbnailData::BITMAP_WIDTH);
- QVERIFY(td.bitmap->SizeInPixels().iHeight == TestThumbnailData::BITMAP_HEIGHT);
-
- disconnect( wrapper_p, SIGNAL(thumbnailReady( QImage , void* , int, int ) ),
- this, SLOT( thumbnailReadyImage( QImage , void* , int , int )));
-
- disconnect( wrapper_p, SIGNAL(thumbnailReady( QPixmap , void* , int, int ) ),
- this, SLOT( thumbnailReadyPixmap( QPixmap , void* , int , int )));
-}
-
-void TestThumbnailManager::testPriorities_data()
-{
- // note: current bounds for priorites are [-100:20] (from: CActive::TPriority)
-
- QTest::addColumn<int>("priority");
- QTest::addColumn<int>("expectedPriority");
- QTest::newRow("priority 0") << 0 << 0;
- QTest::newRow("priority 10") << 10 << 10;
- QTest::newRow("priority 20") << 20 << 20;
- QTest::newRow("priority 100") << 100 << 20;
- QTest::newRow("priority 200") << 200 << 20;
- QTest::newRow("priority -10") << -10 << -10;
- QTest::newRow("priority -100") << -100 << -100;
- QTest::newRow("priority -200") << -200 << -100;
-}
-
-void TestThumbnailManager::testPriorities()
-{
- QFETCH(int, priority);
- QFETCH(int, expectedPriority);
- QCOMPARE(wrapper_p->convertPriority(priority), expectedPriority);
-}
-
-
-// --- private slots - callback ---
-
-void TestThumbnailManager::thumbnailReady( QPixmap pixmap, void *clientData, int id, int errorCode )
-{
- //do nothing, we dont test Thumbnail Manager's functionality, we just use it
- Q_UNUSED( pixmap );
- Q_UNUSED( clientData );
- Q_UNUSED( id );
- Q_UNUSED( errorCode );
-}
-
-void TestThumbnailManager::thumbnailReady_p( QPixmap pixmap, void * clientData, int id, int errorCode )
-{
- Q_UNUSED( clientData );
- QVERIFY( pixmap.isNull() == pixmapNull );
- QVERIFY( errorCode == aerrorCode );
- QVERIFY( id == aid );
-}
-
-void TestThumbnailManager::thumbnailReadyPixmap( QPixmap pixmap, void *clientData, int id, int errorCode )
-{
- Q_UNUSED( pixmap );
- QVERIFY( errorCode == pixmapErr );
- QVERIFY( id == pixmapId );
- QVERIFY( clientData = pixmapDataPtr );
-}
-
-void TestThumbnailManager::thumbnailReadyImage( QImage image, void *clientData, int id, int errorCode )
-{
- Q_UNUSED( image );
- QVERIFY( errorCode == imageErr );
- QVERIFY( id == imageId );
- QVERIFY( clientData = imageDataPtr );
-}
-
-#ifdef _LOG_TO_C_
- int main (int argc, char* argv[])
- {
- QApplication app(argc, argv);
- TestThumbnailManager tc;
- int c = 3;
- char* v[] = {argv[0], "-o", "c:/test.txt"};
- return QTest::qExec(&tc, c, v);
- }
-#else
- int main (int argc, char* argv[])
- {
- for ( int i=0;i<argc; i++){
- if (strcmp(argv[i], "-o")==0 && i+1 <argc ){
- //let's make sure that folder specified after -o exists
- QDir file( QString::fromLatin1( argv[i+1] ));
- QString s = file.absolutePath ();
- s = s.left( s.lastIndexOf(file.dirName()) );
- if ( !file.exists(s) ){
- file.mkpath(s);
- }
- }
- }
-
- QApplication app(argc, argv);
- QTEST_DISABLE_KEYPAD_NAVIGATION
- TestThumbnailManager tc;
- return QTest::qExec(&tc, argc, argv);
- }
-#endif
-
-#include "test_qtnmwrapper.moc"
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.pkg Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-; test_qtnmwrapper_template.pkg generated by qmake at 2010-03-02T10:38:07
-; This file is generated by qmake and should not be modified by the user
-;
-
-; Language
-&EN
-
-; SIS header: name, uid, version
-#{"test_qtnmwrapper"},(0xE33f73a5),1,0,0
-
-; Localised Vendor name
-%{"Vendor"}
-
-; Unique Vendor name
-:"Vendor"
-
-; Manual PKG pre-rules from PRO files
-; Default HW/platform dependencies
-[0x101F7961],0,0,0,{"S60ProductID"}
-[0x102032BE],0,0,0,{"S60ProductID"}
-[0x102752AE],0,0,0,{"S60ProductID"}
-[0x1028315F],0,0,0,{"S60ProductID"}
-
-; Executable and default resource files
-"/epoc32/release/armv5/urel/test_qtnmwrapper.exe" - "!:\sys\bin\test_qtnmwrapper.exe"
-"/epoc32/data/z/resource/apps/test_qtnmwrapper.rsc" - "!:\resource\apps\test_qtnmwrapper.rsc"
-"/epoc32/data/z/private/10003a3f/import/apps/test_qtnmwrapper_reg.rsc" - "!:\private\10003a3f\import\apps\test_qtnmwrapper_reg.rsc"
-; DEPLOYMENT
-"/sf/mw/imghandling/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/tnmwrapper_tsrc.png" - "C:\tnmwrapper_tsrc.png"
-"/sf/mw/imghandling/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/tnmwrapper_tsrc.mbm" - "C:\tnmwrapper_tsrc.mbm"
-
-; Manual PKG post-rules from PRO files
--- a/imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/test_qtnmwrapper.pro Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-#
-
-TEMPLATE = app
-TARGET = test_qtnmwrapper
-CONFIG += symbian_test
-
-INCLUDEPATH += .
-INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \
- /epoc32/include/mw/qt \
- /epoc32/include/mw/qttest \
- ../inc
-
-TARGET.CAPABILITY = ALL -TCB
-#DEFINES += _LOG_TO_C_
-
-# Input
-LIBS += -lthumbnailmanager \
- -lfbscli \
- -lthumbnailmanagerqt
-
-SOURCES += test_qtnmwrapper.cpp \
- ../src/thumbnailmanager_p_qt.cpp
-
-HEADERS += ../inc/thumbnailmanager_p_qt.h
-
-CONFIG += qtestlib console
-
-icons.sources += tnmwrapper_tsrc.png
-icons.sources += tnmwrapper_tsrc.mbm
-icons.path = /
-DEPLOYMENT += icons
Binary file imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/tnmwrapper_tsrc.mbm has changed
Binary file imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/tsrc/tnmwrapper_tsrc.png has changed
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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 ?myapp
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-thumbnailserver.mmp
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/group/thumbnailserver.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
-* 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: Project definition file for project ?myapp
-*
-*/
-
-
-// To get the MW_LAYER_SYSTEMINCLUDE-definition
-#include <platform_paths.hrh>
-
-#include <data_caging_paths.hrh>
-#include "../../inc/thumbnailmanageruids.hrh"
-
-VERSION 10.0
-TARGET thumbnailserver.exe
-TARGETTYPE EXE
-UID 0x0 THUMBNAIL_MANAGER_SERVER_UID
-
-#ifdef WINSCW
-EPOCHEAPSIZE 4096 0x800000 // heap 8MB
-#else
-EPOCHEAPSIZE 4096 0x3000000 // max heap 48MB
-#endif
-
-CAPABILITY ALL -TCB -DRM
-VENDORID VID_DEFAULT
-
-EPOCPROCESSPRIORITY background
-
-SOURCEPATH ../src
-SOURCE thumbnailserver.cpp
-SOURCE thumbnailserversession.cpp
-SOURCE thumbnailtaskprocessor.cpp
-SOURCE thumbnailtask.cpp
-SOURCE thumbnailgeneratetask.cpp
-SOURCE thumbnailscaletask.cpp
-SOURCE thumbnailstore.cpp
-SOURCE thumbnailprovider.cpp
-SOURCE thumbnaildiskunmountobserver.cpp
-SOURCE thumbnailcenrep.cpp
-SOURCE thumbnailmemorycardobserver.cpp
-SOURCE thumbnaildecodetask.cpp
-SOURCE thumbnailfetchedchecker.cpp
-#ifdef RD_MDS_2_5
-SOURCE thumbnailmdsquerytask.cpp
-#endif // RD_MDS_2_5
-SOURCE tmgetimei.cpp
-
-SOURCEPATH ../../tmcommon/src
-SOURCE tmshutdownobserver.cpp
-SOURCE tmformatobserver.cpp
-SOURCE tmactivitymanager.cpp
-
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../inc
-USERINCLUDE ../../tmcommon/inc ../traces
-
-LIBRARY fbscli.lib
-LIBRARY euser.lib
-LIBRARY ecom.lib
-LIBRARY efsrv.lib
-LIBRARY apmime.lib
-LIBRARY sqldb.lib
-LIBRARY apgrfx.lib
-LIBRARY estor.lib
-LIBRARY ihl.lib
-LIBRARY centralrepository.lib
-LIBRARY platformenv.lib
-LIBRARY imageconversion.lib
-LIBRARY iclextjpegapi.lib
-LIBRARY caf.lib
-LIBRARY cafutils.lib
-LIBRARY mdeclient.lib
-LIBRARY etel3rdparty.lib
-LIBRARY bafl.lib
-LIBRARY bitgdi.lib
-LIBRARY hwrmlightclient.lib
-
-DEBUGLIBRARY flogger.lib
-
-OPTION ARMCC -O3 -OTime
-
-UNPAGED
-BYTEPAIRCOMPRESSTARGET
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailcenrep.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
-* 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: Class for handling central repositoty data
- *
-*/
-
-
-#ifndef THUMBNAILCENREP_H
-#define THUMBNAILCENREP_H
-
-#include <gdi.h>
-
-#include <thumbnailmanager.h> // TThumbnailSize
-
-class CRepository;
-class TThumbnailPersistentSize;
-class TThumbnailAutoCreate;
-
-/**
- * Class for handling central repositoty data.
- *
- * @since S60 v5.0
- */
-class CThumbnailCenRep: public CBase
- {
-
-public:
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailCenRep();
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailCenRep instance.
- */
- static CThumbnailCenRep* NewL();
-
- /**
- * GetPersistentSizes
- *
- * @since S60 v5.0
- * @return Reference to array of central repository settings
- */
- RArray < TThumbnailPersistentSize > & GetPersistentSizes();
-
- /**
- * GetAutoCreateParams
- *
- * @since S60 v5.0
- * @return Reference to auto creation settings
- */
- TThumbnailAutoCreate & GetAutoCreateParams();
-
- /**
- * Get concrete persistent size associated to relative size
- *
- * @since S60 v5.0
- * @param aThumbnailSize Relative size
- * @return Persistent size object
- */
- TThumbnailPersistentSize & PersistentSizeL( TThumbnailSize
- aThumbnailSize );
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailCenRep instance.
- */
- CThumbnailCenRep();
-
- /**
- * ConstructL
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
- // data
-
- /**
- * Central Repository
- * Own.
- */
- CRepository* iRepository;
-
- /**
- * Persistent sizes.
- */
- RArray < TThumbnailPersistentSize > iPersistentSizes;
-
- /**
- * Auto creation parameters.
- */
- TThumbnailAutoCreate * iAutoCreate;
-
-};
-
-/**
- * Class for representing persistent thumbnail sizes and related
- * parameters.
- *
- * @since S60 v5.0
- */
-class TThumbnailPersistentSize
- {
- /**
- * Format used for storing bitmaps.
- * @since S60 v5.0
- */
- enum TThumbnailImageFormat
- {
- /**
- * Use JPEG compression for stored bitmaps.
- */
- EJpeg,
-
- /**
- * Use native Symbian bitmap format for stored bitmaps.
- */
- EBmp
- };
-
-public:
- enum TThumbnailSourceType { EUnknownSourceType, EImage, EVideo, EAudio, EContact };
- enum TThumbnailSizeType { EUnknownSizeType, EGrid, EList, EFullscreen };
-
-public:
-
- /**
- * C++ constructor.
- *
- * @since S60 v5.0
- * @param aSize Thumbnail size (in pixels) which will be stored.
- * @param aCrop If true, stored thumbnails are cropped to aspect ratio.
- * @param aMode Display mode used for stored bitmaps
- * @param aFormat Format used when storing thumbnails
- */
- TThumbnailPersistentSize( const TSize& aSize, TBool aCrop, TDisplayMode
- aMode, TInt aFormat );
-
- TThumbnailPersistentSize( TThumbnailSize aType, const TSize& aSize, TBool aCrop, TDisplayMode
- aMode, TInt aFormat, TBool aAutoCreate, TThumbnailSizeType aSizeType );
-
-public:
-
- // data
- TThumbnailSize iType;
- TThumbnailSourceType iSourceType;
- TSize iSize;
- TBool iCrop;
- TDisplayMode iMode;
- TInt iFormat;
- TBool iAutoCreate;
- TThumbnailSizeType iSizeType;
-};
-
-/**
- * Class for representing thumbnail auto creation parameters.
- *
- * @since S60 v5.0
- */
-class TThumbnailAutoCreate
- {
-
-public:
-
- /**
- * C++ constructor.
- *
- * @since S60 v5.0
- */
- TThumbnailAutoCreate();
-
-public:
-
- // data
- TBool iImageGrid;
- TBool iImageList;
- TBool iImageFullscreen;
- TBool iVideoGrid;
- TBool iVideoList;
- TBool iVideoFullscreen;
- TBool iAudioGrid;
- TBool iAudioList;
- TBool iAudioFullscreen;
- TBool iContactGrid;
- TBool iContactList;
- TBool iContactFullscreen;
-};
-
-#endif // THUMBNAILCENREP_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnaildecodetask.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
-* 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: Task for decoding a thumbnail
- *
-*/
-
-
-#ifndef THUMBNAILDECODETASK_H
-#define THUMBNAILDECODETASK_H
-
-#include <apmstd.h>
-
-#include "thumbnailtask.h"
-#include "thumbnailprovider.h"
-
-
-class CThumbnailServer;
-
-/**
- * Task for decoding a thumbnail.
- *
- * @since S60 v5.0
- */
-class CThumbnailDecodeTask: public CThumbnailTask,
- public MThumbnailProviderObserver
- {
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aProcessor Processor object for running tasks.
- * @param aServer Thumbnail server in use.
- * @param aBuffer Image in JPEG mode.
- * @param aPriority Priority of the request.
- * @return New CThumbnailDecodeTask object.
- */
- CThumbnailDecodeTask( CThumbnailTaskProcessor& aProcessor, CThumbnailServer& aServer, TDesC8* aBuffer,
- TInt aPriority, TDisplayMode aDisplayMode);
-
- /**
- * Destructor.
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailDecodeTask();
-
- /**
- * StartL
- *
- * @since S60 v5.0
- */
- void StartL();
-
- /**
- * 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:
-
- /**
- * For notifying when task has been finished.
- *
- * @since S60 v5.0
- * @param aError Error code.
- * @param aBitmap Thumbnail image.
- * @param aOriginalSize Original image size.
- */
- void ThumbnailProviderReady( const TInt aError, CFbsBitmap* aBitmap, const
- TSize& aOriginalSize, const TBool aEXIF, const TBool aPortait );
-
-
-private:
- // Data
-
- /**
- * Server.
- */
- CThumbnailServer& iServer;
-
- /**
- * Image buffer
- */
- TDesC8* iBuffer;
-
- /**
- * Size of the original image.
- */
- TSize iOriginalSize;
-
- /**
- * Thumbnail provider implementation.
- * Not own.
- */
- CThumbnailProvider* iProvider;
-
- /**
- * Temporary buffer for client/server parameters
- */
- TThumbnailRequestParamsPckgBuf iParamsBuf;
-
- /*
- * Displaymode of requested TN
- */
- TDisplayMode iDisplayMode;
-
-};
-
-#endif // THUMBNAILGENERATETASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnaildiskunmountobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Class to monitor when volumes are unmounted
- *
-*/
-
-
-#ifndef THUMBNAILDISKUNMOUNTOBSERVER_H
-#define THUMBNAILDISKUNMOUNTOBSERVER_H
-
-#include "f32file.h"
-
-class CThumbnailServer;
-
-/**
- * Class to monitor when volumes are unmounted
- *
- * @since S60 v5.0
- */
-class CThumbnailDiskUnmountObserver: public CActive
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailDiskUnmountObserver object.
- */
- static CThumbnailDiskUnmountObserver* NewL( RFs& aFs, TInt aDrive, CThumbnailServer* aServer );
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailDiskUnmountObserver();
-
- void StartNotify();
-
-private:
- void RunL();
- void DoCancel();
-
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailDiskUnmountObserver object.
- */
- CThumbnailDiskUnmountObserver( RFs& aFs, TInt aDrive, CThumbnailServer* aServer );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
- // Data
- RFs& iFs;
- TInt iDrive;
- CThumbnailServer* iServer;
-};
-
-#endif // THUMBNAILDISKUNMOUNTOBSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailfetchedchecker.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* 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:
- *
-*/
-#ifndef THUMBNAILFETCHEDCHECKER_H
-#define THUMBNAILFETCHEDCHECKER_H
-
-#include <e32base.h>
-#include <thumbnailmanager.h>
-
-NONSHARABLE_CLASS( CThumbnailFetchedChecker ): public CBase
- {
-public:
- static CThumbnailFetchedChecker* NewL();
- virtual ~CThumbnailFetchedChecker();
-public:
- TInt LastFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize );
- void SetFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError );
- void DeleteFetchResult( const TDesC& aUri );
- void RenameFetchResultL( const TDesC& aNewUri, const TDesC& aOldUri );
- void Reset();
-private:
- CThumbnailFetchedChecker();
-
- NONSHARABLE_CLASS( CEntry ) : public CBase
- {
- public:
- static CEntry* NewL( const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError );
- static TInt FindCB( const CEntry& aEntry1, const CEntry& aEntry );
- static TInt FindCBUri( const TDesC* aUri, const CEntry& aEntry );
- static TInt InsertCB( const CEntry& aEntry1, const CEntry& aEntry2 );
- CEntry();
- virtual ~CEntry();
- public:
- HBufC* iUri;
- TInt32 iSize;
- TInt iError;
- };
-
-private:
- RPointerArray< CEntry > iNotFetched;
-};
-
-#endif // THUMBNAILFETCHEDCHECKER_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailgeneratetask.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,242 +0,0 @@
-/*
-* 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: Task for generating new thumbnails
-*
-*/
-
-
-#ifndef THUMBNAILGENERATETASK_H
-#define THUMBNAILGENERATETASK_H
-
-#include <apmstd.h>
-
-#include "thumbnailtask.h"
-#include "thumbnailprovider.h"
-#include "thumbnailstore.h" // TThumbnailPersistentSize
-
-class CThumbnailServer;
-
-/**
- * Task for generating new thumbnails.
- *
- * @since S60 v5.0
- */
-class CThumbnailGenerateTask: public CThumbnailTask,
- public MThumbnailProviderObserver
- {
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aProcessor Processor object for running tasks.
- * @param aServer Thumbnail server in use.
- * @param aFile File from which the thumbnail is to be created.
- * @param aFlags Flags that control the creation of thumbnail.
- * @param aSize Requested size of thumbnail.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @return New CThumbnailGenerateTask object.
- */
- CThumbnailGenerateTask( CThumbnailTaskProcessor& aProcessor, CThumbnailServer& aServer,
- RFile64* aFile, TDesC8* aBuffer, const TDataType* aMimeType,
- CThumbnailManager::TThumbnailFlags aFlags, const TSize& aSize,
- TDisplayMode aDisplayMode, TInt aPriority,
- RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri,
- TThumbnailSize aThumbnailSize, const TInt64 aModified,
- const CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
- TBool aImportVirtual );
-
- /**
- * Destructor.
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailGenerateTask();
-
- /**
- * StartL
- *
- * @since S60 v5.0
- */
- void StartL();
-
- /**
- * 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();
-
- /**
- * Defines if scaled bitmaps needs to be added to pool.
- *
- * @since S60 v5.0
- * @param aBool boolean
- */
- void ScaledBitmapToPool(TBool aBool);
-
-private:
-
- /**
- * Calculate the largest non-cropped size and largest cropped size and
- * let the provider know.
- *
- * @since S60 v5.0
- * @param aEffectiveTargetSize Effective target size.
- * @param aCroppedTargetSize Cropped target size.
- */
- void CalculateTargetSizesL( TSize& aEffectiveTargetSize, TSize&
- aCroppedTargetSize );
-
- /**
- * For notifying when task has been finished.
- *
- * @since S60 v5.0
- * @param aError Error code.
- * @param aBitmap Thumbnail image.
- * @param aOriginalSize Original image size.
- * @param aEXIF is origin EXIF.
- */
- void ThumbnailProviderReady( const TInt aError, CFbsBitmap* aBitmap, const
- TSize& aOriginalSize, const TBool aEXIF, const TBool aPortrait );
-
- /**
- * For creating scaling task.
- *
- * @since S60 v5.0
- * @param aBitmap Bitmap image.
- * @param aEXIF is origin EXIF.
- */
- void CreateScaleTasksL( CFbsBitmap* aBitmap );
-
- /**
- * For creating blacklisted thumbnail.
- *
- * @param aOriginalSize Original size of bitmap.
- */
- void CreateBlackListedL( const TSize& aOriginalSize );
-
-
- /**
- * Check is blacklisting needed
- *
- * @param aErrorCode verdict is based on this error code
- * @param aOriginalSize Original size of bitmap.
- */
- void DoBlacklisting( const TInt aError, const TSize& aOriginalSize );
-
-private:
- // Data
-
- /**
- * Server.
- */
- CThumbnailServer& iServer;
-
- /**
- * Imagefile from which the thumbnail is to be created.
- */
- RFile64 iFile;
-
- /**
- * Image buffer
- */
- TDesC8* iBuffer;
-
- /**
- * Mime type of the original image.
- */
- TDataType iMimeType;
-
- /**
- * Filename of the image from which the thumbnail is to be created.
- */
- TFileName iFilename;
-
- /**
- * Flags
- */
- CThumbnailManager::TThumbnailFlags iFlags;
- /**
- * Requested size of thumbnail.
- */
- TSize iSize;
-
- /**
- * Display mode.
- */
- TDisplayMode iDisplayMode;
-
- /**
- * Only missing persistent sized thumbnails will be created
- */
- RArray < TThumbnailPersistentSize >* iMissingSizes;
-
- /**
- * Uri of the target object
- */
- TFileName iTargetUri;
-
- /**
- * Relative thumbnail size
- */
- TThumbnailSize iThumbnailSize;
-
- /**
- * timestamp
- */
- TInt64 iModified;
-
- /**
- * Size of the original image.
- */
- TSize iOriginalSize;
-
- /**
- * Thumbnail provider implementation.
- * Not own.
- */
- CThumbnailProvider* iProvider;
-
- TBool iScaledBitmapToPool;
-
-#ifdef _DEBUG
- TTime aStart, aStop;
-#endif
-
- CThumbnailManager::TThumbnailQualityPreference iQualityPreference;
-
- TBool iEXIF;
-
- /**
- * Target rect rotated (portrait image)
- */
- TBool iPortrait;
-
- TInt iBitmapHandle;
-
- // virtual uri
- TBool iVirtualUri;
-};
-
-#endif // THUMBNAILGENERATETASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailmdsquerytask.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,135 +0,0 @@
-/*
-* 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: Task for making MDS querys
-*
-*/
-
-
-#ifndef THUMBNAILMDSQUERYTASK_H
-#define THUMBNAILMDSQUERYTASK_H
-
-#include <mdesession.h>
-#include <mdccommon.h>
-#include <mdeobjectquery.h>
-
-#include "thumbnailtask.h"
-
-class CThumbnailServer;
-
-/**
- * Task for making MDS querys
- *
- * @since S60 v5.0
- */
-class CThumbnailMDSQueryTask: public CThumbnailTask,
- public MMdEQueryObserver
- {
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aProcessor Processor object for running tasks.
- * @param aPriority Priority of the request.
- * @return New CThumbnailMDSQueryTask object.
- */
- CThumbnailMDSQueryTask( CThumbnailTaskProcessor& aProcessor, TInt aPriority,
- CMdESession* aMdESession, CThumbnailServer& aServer);
-
- /**
- * Destructor.
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailMDSQueryTask();
-
- /**
- * StartL
- *
- * @since S60 v5.0
- */
- void StartL();
-
- /**
- * 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();
-
- /**
- * Query path by id
- *
- * @since S60 v5.0
- * @param aId ID
- */
- void QueryPathByIdL(TThumbnailId aId, TBool aDelete);
-
- /**
- * Sets are values updated to db automatically
- *
- * @since S60 v5.0
- * @param aComplete message, default is ETrue
- */
- void SetUpdateToDb(const TBool& aUpdateToDb );
-
-public:
-
- // From MMdEQueryObserver
- void HandleQueryNewResults( CMdEQuery& aQuery, TInt aFirstNewItemIndex, TInt aNewItemCount );
- void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError );
-
-protected:
-
- void ReturnPath(const TDesC& aUri);
-
-private:
-
- // not own
- CMdESession* iMdESession;
-
- // own
- CMdEObjectQuery* iQuery;
-
- TThumbnailRequestParamsPckgBuf iRequestParams;
-
- /**
- * Server.
- */
- CThumbnailServer& iServer;
-
- /**
- * Query type used when filling missing information from MDS
- */
- TMDSQueryType iQueryType;
-
- /**
- * Does task update db
- */
- TBool iUpdateToDb;
-
- TFileName iUri;
-
- TBool iDelete;
-};
-
-#endif // THUMBNAILMDSQUERYTASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailmemorycardobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Class to monitor when volumes are unmounted
- *
-*/
-
-
-#ifndef THUMBNAILMEMORYCARDOBSERVER_H
-#define THUMBNAILMEMORYCARDOBSERVER_H
-
-#include "f32file.h"
-#include "thumbnailserver.h"
-
-/**
- * Class to monitor when memory card status changes
- *
- * @since S60 v5.0
- */
-class CThumbnailMemoryCardObserver: public CActive
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailMemoryCardObserver object.
- */
- static CThumbnailMemoryCardObserver* NewL( CThumbnailServer* aServer, RFs& aFs );
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailMemoryCardObserver();
-
-private:
- void RunL();
- void DoCancel();
-
- void StartNotify();
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailMemoryCardObserver object.
- */
- CThumbnailMemoryCardObserver( CThumbnailServer* aServer, RFs& aFs );
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
- // Data
- CThumbnailServer* iServer;
- RFs& iFs;
-};
-
-#endif // THUMBNAILMEMORYCARDOBSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailscaletask.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-/*
-* 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: Task for scaling thumbnails
- *
-*/
-
-
-#ifndef THUMBNAILSCALETASK_H
-#define THUMBNAILSCALETASK_H
-
-#include "thumbnailtask.h"
-#include "thumbnailprovider.h"
-#include "thumbnailstore.h" // TThumbnailPersistentSize
-
-class CThumbnailServer;
-
-/**
- * Task for scaling thumbnails.
- *
- * @since S60 v5.0
- */
-class CThumbnailScaleTask: public CThumbnailTask
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @param aProcessor Processor object for running tasks.
- * @param aServer Server to use.
- * @param aFilename Filename of file from which the thumbnail is to be
- * created.
- * @param aBitmap Bitmap image. Scale task assumes ownership.
- * @param aOriginalSize Original size of the image.
- * @param aTargetSize Target size of thumbnail image.
- * @param aCrop Enable or disable cropping.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aThumbnailSize Prededined size of thumbnail.
- * @return New CThumbnailScaleTask object.
- * @param aEXIF is origin EXIF.
- * @param aRequestId Request ID.
- */
- static CThumbnailScaleTask* NewL( CThumbnailTaskProcessor& aProcessor,
- CThumbnailServer& aServer, const TDesC& aFilename, CFbsBitmap* aBitmap,
- const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
- TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
- const TThumbnailSize aThumbnailSize, const TInt64 aModified,
- const TBool aBitmapToPool, const TBool aEXIF,
- const TThumbnailServerRequestId aRequestId, const TBool aImportVirtual);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailScaleTask();
-
- /**
- * StartL
- *
- * @since S60 v5.0
- */
- void StartL();
-
- /**
- * 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();
-
- /**
- * Changes priority of the task.
- *
- * @since S60 v5.0
- */
- void ChangeTaskPriority( TInt aNewPriority );
-
- /**
- * Set whether the scaled image is to be stored or not.
- *
- * @since S60 v5.0
- * @param aDoStore Boolean value stating should the image be stored.
- */
- void SetDoStore( TBool aDoStore );
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aProcessor Processor object for running tasks.
- * @param aServer Server to use.
- * @param aFilename Filename of file from which the thumbnail is to be
- * created.
- * @param aBitmap Bitmap image. Scale task assumes ownership.
- * @param aOriginalSize Original size of the image.
- * @param aTargetSize Target size of thumbnail image.
- * @param aCrop Enable or disable cropping.
- * @param aDisplayMode Display mode.
- * @param aPriority Priority of the request.
- * @param aThumbnailSize Prededined size of thumbnail.
- * @return New CThumbnailScaleTask object.
- * @param aEXIF is origin EXIF.
- * @param aRequestId Request ID.
- */
- CThumbnailScaleTask( CThumbnailTaskProcessor& aProcessor, CThumbnailServer&
- aServer, const TDesC& aFilename, CFbsBitmap* aBitmap, const TSize&
- aOriginalSize, const TSize& aTargetSize, TBool aCrop, TDisplayMode
- aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
- const TThumbnailSize aThumbnailSize, const TInt64 aModified,
- const TBool aBitmapToPool, const TBool aEXIF,
- const TThumbnailServerRequestId aRequestId, const TBool aImportVirtual);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Calculates target size to be used for the thumbnail when cropping is
- * disabled. The target size may be smaller than requested if aspect
- * ratios do not match. Updates iTargetSize.
- *
- * @since S60 v5.0
- */
- void CalculateTargetSize();
-
- /**
- * Calculates cropping rectangle to be used for the thumbnail when
- * cropping is enabled. Target size will always be the same as requested
- * size and the cropping rectangle defines which area of the image will
- * be visible. Updates iCropRectangle.
- *
- * @since S60 v5.0
- */
- void CalculateCropRectangle();
-
- /**
- * StoreAndCompleteL
- *
- * @since S60 v5.0
- */
- void StoreAndCompleteL();
-
-private:
- // Data
-
- /**
- * Server.
- */
- CThumbnailServer& iServer;
-
- /**
- * Resides in bitmap pool.
- * Not own. But we do are responsible for decreasing the reference count
- * if iBitmapInPool is set.
- */
- CFbsBitmap* iBitmap;
-
- /**
- * Temporary place to store the original bitmap. This is set to NULL
- * after the bitmap has been successfully added to the bitmap pool.
- * Own.
- */
- CFbsBitmap* iOwnBitmap;
-
- /**
- * Bitmap pool.
- */
- TBool iBitmapInPool;
-
- /**
- * Original size of media object.
- */
- TSize iOriginalSize;
-
- /**
- * Target size of scaled thubnail (not real of preview)
- */
- TSize iTargetSize;
-
- /**
- * Target size of the thumbnail.
- */
- TSize iTargetSizeTN;
-
- /**
- * Incidates if cropping is enabled.
- */
- TBool iCrop;
-
- /**
- * Defines the visible area of iBitmap which is to be included
- * in the thumbnail if cropping is enabled. Not used if cropping
- * is disabled.
- */
- TRect iCropRectangle;
-
- /**
- * Display mode.
- */
- TDisplayMode iDisplayMode;
-
- /**
- * Filename of the image to be used.
- */
- TFileName iFilename;
-
- /**
- * Uri of the target object
- */
- TFileName iTargetUri;
-
- /**
- * Scaled image.
- */
- CFbsBitmap* iScaledBitmap; // own
-
- /**
- * If set, scaled bitmap must be released from pool.
- */
- TInt iScaledBitmapHandle;
-
- /**
- * If set, thumbnail will be stored for later use.
- */
- TBool iDoStore;
-
- /**
- * Temporary buffer for client/server parameters
- */
- TThumbnailRequestParamsPckgBuf iParamsBuf;
-
- /**
- * Size of requested Thumbnail
- */
- TThumbnailSize iThumbnailSize;
-
- /**
- * timestamp
- */
- TInt64 iModified;
-
- /**
- * Add bitmap to server's pool.
- */
- TBool iBitmapToPool;
-
-#ifdef _DEBUG
- TTime aStart, aStop;
-#endif
-
- /**
- * Is origin EXIF.
- */
- TBool iEXIF;
-
- // virtual uri
- TBool iVirtualUri;
-};
-
-#endif // THUMBNAILSCALETASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,734 +0,0 @@
-/*
-* 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: Thumbnail server
- *
-*/
-
-
-#ifndef THUMBNAILSERVER_H
-#define THUMBNAILSERVER_H
-
-#include <e32base.h>
-#include <fbs.h>
-#include <w32std.h>
-#include <apmrec.h>
-#include <apgcli.h>
-#include <e32hashtab.h>
-
-#include <mdesession.h>
-
-#include "thumbnailmanager.h"
-#include "thumbnailmanagerconstants.h" // TThumbnailServerRequestId
-#include "thumbnailstore.h" // TThumbnailPersistentSize
-#include "tmshutdownobserver.h"
-#include "tmformatobserver.h"
-
-// Needed for creating server thread.
-const TUint KDefaultHeapSize = 160 * 1024;
-
-class CThumbnailTaskProcessor;
-class CThumbnailProvider;
-class CThumbnailTask;
-class CThumbnailStore;
-class MIHLScaler;
-class CThumbnailServerSession;
-class CThumbnailDiskUnmountObserver;
-class CThumbnailMemoryCardObserver;
-class CThumbnailFetchedChecker;
-
-/**
- * Helper function to destroy all objects which are referred to
- * by pointers in a hash table.
- * @since S60 v5.0
- * @param aHashMap Reference to hash map
- */
-template <class K, class V> void ResetAndDestroyHashMap( RHashMap<K, V* > &
- aHashMap )
- {
- THashMapIter<K, V* > iter( aHashMap );
-
- // const pointer to a non-const object
- V* const * item = iter.NextValue();
-
- while ( item )
- {
- delete *item;
- item = iter.NextValue();
- }
- aHashMap.Close();
- }
-
-/**
- * Thumbnail server.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbnailServer ): public CPolicyServer,
- public MMdESessionObserver,
- public MTMShutdownObserver,
- public MTMFormatObserver
- {
-public:
-
- /**
- * Two-phased constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailServer server.
- */
- static CThumbnailServer* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailServer();
-
-public:
-
- /**
- * Creates new server session.
- *
- * @since S60 v5.0
- * @param aVersion Version info.
- * @param aMessage Message to be passed.
- * @return New session.
- */
- CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage
- )const;
-
- /**
- * ThreadFunctionL
- *
- * @since S60 v5.0
- */
- static void ThreadFunctionL();
-
- /**
- * AddSession
- *
- * @since S60 v5.0
- */
- void AddSession();
-
- /**
- * DropSession
- *
- * @since S60 v5.0
- */
- void DropSession(CThumbnailServerSession* aSession);
-
- // from MMdESessionObserver
- void HandleSessionOpened( CMdESession& aSession, TInt aError );
- void HandleSessionError( CMdESession& aSession, TInt aError );
-
- // from MTMShutdownObserver
- void ShutdownNotification();
-
- //From MTMFormatObserver
- void FormatNotification(TBool aFormat);
-
- /**
- * Adds bitmap to bitmap pool. Server assumes ownership of the bitmap and
- * implements reference counting to know when it is safe to delete
- * the object. Reference count is increased if the bitmap already
- * exists in the pool.
- *
- * @since S60 v5.0
- * @param aSession Server side session which owns the bitmap.
- * @param aBitmap Bitmap to be added to pool.
- * @param aRequestId Session specific thumbnail request ID.
- */
- void AddBitmapToPoolL( CThumbnailServerSession* aSession, CFbsBitmap*
- aBitmap, TThumbnailServerRequestId aRequestId );
-
- /**
- * Store thumbnail.
- *
- * @since S60 v5.0
- * @param aPath Image path.
- * @param aBitmap Thumbnail image.
- * @param aOriginalSize Original size of image.
- * @param aCropped Enabled if the thumbnail was cropped.
- * @param aThumbnailSize Prededined size of requested thumbnail.
- * @param aThumbFromPath Thumbnail created from associated path.
- * @param aThumbFromPath Check first if source uri exists.
- */
- void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aBitmap, const TSize&
- aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize,
- const TInt64 aModified, const TBool aThumbFromPath,
- const TBool aCheckExist);
-
- /**
- * Fetch thumbnail image.
- *
- * @since S60 v5.0
- * @param aPath Path of the media object whose thumbnail is to be
- * retrieved.
- * @param aThumbnail Pointer to get the fetched thumbnail bitmap.
- * Caller assumes ownership.
- * @param aMinimumSize Minimum size of the thumbnail.
- * @param aOriginalSize Original size of the object file in pixels
- * @param aCropped If true, match cropped images only.
- * @param aAllowUpscaling If enabled, allow fetching thumbnails that
- * are smaller than requested.
- * @param aThumbnailSize Prededined size of requested thumbnail.
- */
- void FetchThumbnailL( const TDesC& aPath, CFbsBitmap* & aThumbnail,
- TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize );
-
- /**
- * Delete thumbnails.
- *
- * @since S60 v5.0
- * @param aPath Path of the media object whose thumbnail is
- * to be deleted.
- */
- void DeleteThumbnailsL( const TDesC& aPath );
-
- /**
- * Delete thumbnails by Id.
- *
- * @since S60 v5.0
- * @param aItemId Id of item whose thumbnails are to be deleted.
- */
- void DeleteThumbnailsByIdL( TThumbnailId aItemId );
-
- /**
- * Resolve the MIME-type of given file using recognizer framework.
- *
- * @since S60 v5.0
- * @param aFile File to be recognized.
- * @return MIME-type
- */
- TDataType ResolveMimeTypeL( RFile64& aFile );
-
- /**
- * Removes bitmap from bitmap pool. Reference count is decremented
- * and if it reaches zero, the bitmap object is deleted.
- *
- * @since S60 v5.0
- * @param aHandle Bitmap handle.
- */
- void DeleteBitmapFromPool( TInt aHandle );
-
- /**
- * Resolve plugin to be used in thumbnail creation by mime type.
- *
- * @since S60 v5.0
- * @param aMimeType Mime type of the file from which a thumbnail is to be
- * created.
- * @return Thumbnail provider.
- */
- CThumbnailProvider* ResolveProviderL( const TDesC8& aMimeType );
-
- /**
- * Preload provider plugins
- *
- * @since S^3
- */
- void PreLoadProviders();
-
-
- /**
- * Add thumbnailtask to processor queue.
- *
- * @since S60 v5.0
- * @param aTask Task to be added to queue.
- */
- void QueueTaskL( CThumbnailTask* aTask );
-
- /**
- * Remove thumbnailtask from processor queue.
- *
- * @since S60 v5.0
- * @param aRequestId ID of the task to be removed from queue.
- * @return Error code.
- */
- TInt DequeTask( const TThumbnailServerRequestId& aRequestId );
-
- /**
- * Change priority of specific task.
- *
- * @since S60 v5.0
- * @param aRequestId ID of the task to be assigned new priority.
- * @param aNewPriority New priority for the task.
- * @return Error code.
- */
- TInt ChangeTaskPriority( const TThumbnailServerRequestId& aRequestId, TInt
- aNewPriority );
-
- /**
- * Scale bitmap
- *
- * @since S60 v5.0
- * @param aStatus Request status.
- * @param aSource Source bitmap.
- * @param aDest Destination bitmap.
- * @param aSourceRect Source rectangle for cropping.
- */
- void ScaleBitmapL( TRequestStatus& aStatus, const CFbsBitmap& aSource,
- CFbsBitmap& aDest, const TRect& aSourceRect );
-
- /**
- * Cancel scaling operation
- *
- * @since S60 v5.0
- */
- void CancelScale();
-
- /**
- * Returns processor.
- *
- * @since S60 v5.0
- * @return Reference to processor instance.
- */
- CThumbnailTaskProcessor& Processor();
-
- /**
- * Get persistent size.
- *
- * @since S60 v5.0
- * @param aThumbnailSize Relative thumbnail size
- * @return Persistent size object
- */
- TThumbnailPersistentSize & PersistentSizeL( TThumbnailSize
- aThumbnailSize );
-
- /**
- * Persistent sizes.
- *
- * @since S60 v5.0
- * @return List of thumbnail sizes (including othe parameters) which
- * are stored for later access.
- */
- RArray < TThumbnailPersistentSize > PersistentSizesL();
-
- /**
- * Get missing thumbnail sizes.
- *
- * @since S60 v5.0
- * @param aPath Path associated to missing thumbnails
- * @param aMissingSizes Returns a list of thumbnail sizes not yet create related to the path
- * @param aCheckGridSizeOnly check only is Grid size missing
- */
- void GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
- TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly);
-
- /**
- * Fileserver
- *
- * @since S60 v5.0
- * @return File server
- */
- RFs& Fs();
-
- /**
- * Get the required size (in characters) for a buffer that contains the
- * list of supported MIME types
- *
- * @since S60 v5.0
- */
- TInt GetMimeTypeBufferSize()const;
-
- /**
- * Get the list of supported MIME types and store them in the buffer.
- *
- * @since S60 v5.0
- * @param aBuffer A buffer to receive the space delimited list of MIME
- * types. Must be as least as large as the size returned
- * by GetMimeTypeBufferSizeL()
- */
- void GetMimeTypeList( TDes& aBuffer )const;
-
- /**
- * Close store instance for given drive.
- *
- * @since S60 v5.0
- * @param aDrive Drive for which the store is used, such as EDriveC,
- * EDriveE, etc.
- */
- void CloseStoreForDriveL( const TInt aDrive );
-
- /**
- * React to change in memory card status.
- *
- * @since S60 v5.0
- */
- void MemoryCardStatusChangedL();
-
- /**
- * Update thumbnails in database
- *
- * @since S60 v5.0
- * @param aPath (New) path for the Thumbnail
- * @param aOrientation Thumbnail orientation
- * @param aModified Last modified
- * @param TBool EFalse, if new thumbs need to be created
- */
- TBool UpdateThumbnailsL( const TDesC& aPath,
- const TInt aOrientation, const TInt64 aModified );
-
- /**
- * Rename thumbnails.
- *
- * @since S60 v5.0
- * @param aCurrentPath Current path of the Thumbnail
- * @param aNewPath New path for the Thumbnail
- */
- void RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath );
-
- /**
- * Resolve mime type from file extension
- *
- * @since S60 v5.0
- * @param aFileName Image file
- * @param aMimeType Mime type
- * @return TInt KErrNone/KErrNotFound
- */
- TInt MimeTypeFromFileExt( const TDesC& aFileName, TDataType& aMimeType );
-
- /**
- * Resolve source type from mime type
- *
- * @since S60 v5.0
- * @param aMimeType Mime type
- * @return TInt TThumbnailPersistentSize enum
- */
- TInt SourceTypeFromMimeType( const TDataType& aMimeType );
-
- /**
- * Resolve source type from size type
- *
- * @since S60 v5.0
- * @param aSizeType size type enum
- * @return TInt TThumbnailPersistentSize enum
- */
- TInt SourceTypeFromSizeType( const TInt aSizeType );
-
- /**
- * Is mime type supported
- *
- * @since S60 v5.0
- * @param aMimeType Mime type
- * @return TBool supported
- */
- TBool SupportedMimeType( const TDataType& aMimeType );
-
- /**
- * Get MDS session
- *
- * @since S60 v5.0
- * @return CMdESession
- */
- CMdESession* GetMdESession();
-
- /**
- * Get store instance for given path.
- *
- * @since S60 v5.0
- * @param aPath Path to a file
- * @return CThumbnailStore object
- */
- CThumbnailStore* StoreForPathL( const TDesC& aPath );
-
- /**
- * Close Removable Stores
- *
- * @since S60 v5.0
- */
-
- void CloseRemovableDrivesL();
-
- /**
- * Open Removable Stores
- *
- * @since S60 v5.o
- */
-
- void OpenRemovableDrivesL();
-
- /**
- * Checks if formatting is ongoing
- *
- * @since S60 v5.o
- */
-
- TBool IsFormatting();
-
- inline CThumbnailFetchedChecker& FetchedChecker() const { return *iFetchedChecker; }
-
- /**
- * Check is path in public folder
- *
- * @param aPath
- * @ret
- */
- TBool IsPublicPath( const TDesC& aPath );
-
-protected: // Functions from base classes
-
- /**
- * From CPolicyServer.
- * Handles capability checking for certain server requests.
- * @param aMsg Message which was received from the client side
- * @param aAction
- * @param aMissing
- * @result return one of TCustomResult set {EPass, EFail, EAsync}.
- */
- CPolicyServer::TCustomResult CustomSecurityCheckL(
- const RMessage2 &aMsg, TInt &aAction, TSecurityInfo &aMissing );
-
- /**
- * From CPolicyServer.
- * Handles failure
- * @param aMsg Message which was received from the client side
- * @param aAction
- * @param aMissing
- * @result return one of TCustomResult set {EPass, EFail, EAsync}.
- */
- CPolicyServer::TCustomResult CustomFailureActionL(
- const RMessage2 &aMsg, TInt aAction, const TSecurityInfo &aMissing );
-
-private:
-
- /**
- * Get a provider plug-in by the given UID
- *
- * @since S60 v5.0
- * @param aImplUid UID of the provider plug-in.
- * @return Provider instance.
- */
- CThumbnailProvider* GetProviderL( const TUid& aImplUid );
-
- /**
- * Get store instance for given drive.
- *
- * @since S60 v5.0
- * @param aDrive Drive for which the store is used, such as EDriveC,
- * EDriveE, etc.
- * @return CThumbnailStore object
- */
- CThumbnailStore* StoreForDriveL( const TInt aDrive );
-
-
- /**
- * Add unmount observer for each unmountable drive.
- *
- * @since S60 v5.0
- */
- void AddUnmountObserversL();
-
- /**
- * Open store for each mounted drive.
- *
- * @since S60 v5.0
- */
- void OpenStoresL();
-
- /**
- * Callback for reconnect timer
- *
- * @since S60 v5.0
- */
- static TInt ReconnectCallBack(TAny* aAny);
-
- /**
- * Start unmount timer
- *
- * @since S60 S^3
- */
- void StartUnmountTimeout( const TInt aDrive);
-
- /**
- * Callback for unmount timer
- *
- * @since S60 S^3
- */
- static TInt UnmountCallBack(TAny* aAny);
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return New CThumbnailServer instance.
- */
- CThumbnailServer();
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
- /**
- * Reference counted pointer to a CFbsBitmap object used for the bitmap
- * pool.
- */
- struct TThumbnailBitmapRef
- {
-public:
- /**
- * CThumbnailServerSession can be used to identify which client
- * session is responsible for calling ReleaseBitmap() for this
- * bitmap. Not own.
- */
- CThumbnailServerSession* iSession;
-
- /**
- * Reference count for this bitmap. If reference count reaches zero,
- * the bitmap is deleted by the server.
- */
- TInt iRefCount;
-
- /**
- * Bitmap object. Not owned directly by TThumbnailBitmapRef, but by
- * the server.
- * Not own.
- */
- CFbsBitmap* iBitmap;
-
- /**
- * Request Id
- */
- TThumbnailRequestId iRequestId;
-
- };
-
-private:
- // data
-
- TBool iShutdown;
- CTMShutdownObserver* iShutdownObserver;
-
- /**
- * Fileserver, own.
- */
- RFs iFs;
-
- /**
- * Sessioncount.
- */
- TInt iSessionCount;
-
- /**
- * FbsSession.
- */
- RFbsSession iFbsSession;
-
- /**
- * Bitmap pool. Reference counted pointers to CFbsBitmaps stored
- * in a hash table with bitmap handle as the key.
- * Own.
- */
- RHashMap < TInt, TThumbnailBitmapRef > iBitmapPool;
-
- /**
- * Processor for running tasks.
- * Own.
- */
- CThumbnailTaskProcessor* iProcessor;
-
- /**
- * Central repository data handler
- * Own.
- */
- CThumbnailCenRep* iCenrep;
-
- /**
- * Recognizer.
- * Own.
- */
- RApaLsSession iRecognizer;
-
- /**
- * Result of recognition.
- */
- TDataRecognitionResult iResult;
-
- /**
- * Plug-in info.
- */
- RImplInfoPtrArray iPluginInfoArray;
-
- /**
- * Thumbnail providers. Stored in a hash table with the implementation
- * UID as the key.
- * Own.
- */
- RHashMap < TInt32, CThumbnailProvider* > iProviders;
-
- /**
- * Scaler.
- * Own.
- */
- MIHLScaler* iScaler;
-
- /**
- * Array of unmount observers.
- */
- RPointerArray<CThumbnailDiskUnmountObserver> iUnmountObservers;
-
- CThumbnailMemoryCardObserver* iMMCObserver;
-
- CTMFormatObserver* iFormatObserver;
-
- /**
- * Databases for each drive, identified by drive (EDriveC, etc).
- * New databases and created on-the-fly as new requests are received.
- * Databases are closed when drives are dismounted.
- * Own.
- */
- RHashMap < TInt, CThumbnailStore* > iStores;
-
- // own
- CMdESession* iMdESession;
-
- TBuf<KImeiBufferSize> iImei;
-
- /**
- * Persistent sizes.
- */
- RArray < TThumbnailPersistentSize > iPersistentSizes;
-
- TBool iFormatting;
-
- // reconnect timer
- CPeriodic* iReconnect;
-
- // unmount timer
- CPeriodic* iUnmount;
-
- // array of unmounte
- RArray < TInt > iUnmountedDrives;
-
-#ifdef _DEBUG
- TUint32 iPlaceholderCounter;
-#endif
-
- /**
- * Fetched checker.
- * Own.
- */
- CThumbnailFetchedChecker* iFetchedChecker;
-
- TBool iSessionError;
-};
-
-#endif // THUMBNAILSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailserversession.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
-* 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: Server side session for thumbnail engine
- *
-*/
-
-
-#ifndef THUMBNAILSERVERSESSION_H
-#define THUMBNAILSERVERSESSION_H
-
-#include <e32base.h>
-#include <e32capability.h>
-
-#include "thumbnailmanagerconstants.h"
-
-// FORWARD DECLARATIONS
-class CThumbnailServer;
-
-/**
- * Server side session for thumbnail engine.
- *
- * @since S60 v5.0
- */
-NONSHARABLE_CLASS( CThumbnailServerSession ): public CSession2
- {
-public:
-
- /**
- * Constructor.
- *
- * @since S60 v5.0
- * @return New CThumbnailServerSession session.
- */
- CThumbnailServerSession();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailServerSession();
-
-public:
-
- /**
- * Message dispatcher.
- *
- * @since S60 v5.0
- * @param aMessage Message to be passed.
- * @return Error code.
- */
- TInt DispatchMessageL( const RMessage2& aMessage );
-
-public:
- // Functions from base classes
-
- /**
- * CreateL
- *
- * @since S60 v5.0
- */
- void CreateL();
-
- /**
- * From CSharableSession (pure virtual).
- * Handles service request messages from clients.
- *
- * @since S60 v5.0
- * @param aMessage message from client.
- */
- void ServiceL( const RMessage2& aMessage );
-
-public:
- // New functions
-
- /**
- * Returns the server pointer.
- *
- * @since S60 v5.0
- * @return Server pointer.
- */
- CThumbnailServer* Server();
-
- /**
- * Cancellation method.
- *
- * @since S60 v5.0
- */
- void Cancel();
-
- /**
- * Converts SQL error to E32 error.
- *
- * @since S60 v5.0
- * @param aReason Request message complete value which may be SQL error
- * @return Request message complete value but not SQL error
- */
- static TInt ConvertSqlErrToE32Err( TInt aReason );
-
- void ResolveMimeTypeL( RFile64* aFile );
-
- void ModifyThumbnailSize( TInt aSourceType );
-
-private:
-
- /**
- * RequestThumbByFileHandleAsyncL
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void RequestThumbByFileHandleAsyncL( const RMessage2& aMessage );
-
- /**
- * RequestThumbByPathAsyncL
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void RequestThumbByPathAsyncL( const RMessage2& aMessage );
-
- /**
- * RequestThumbByIdAsyncL
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void RequestThumbByIdAsyncL( const RMessage2& aMessage );
-
- /**
- * RequestSetThumbnailByBufferL
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void RequestSetThumbnailByBufferL( const RMessage2& aMessage );
-
- /**
- * RequestSetThumbnailByBitmapL
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void RequestSetThumbnailByBitmapL( const RMessage2& aMessage );
-
- /**
- * Fetch thumbnail data from database.
- *
- * @since S60 v5.0
- */
- void FetchThumbnailL();
-
- /**
- * Create a task to generate a new thumbnail
- *
- * @since S60 v5.0
- * @param aFile File handle
- */
- void CreateGenerateTaskFromFileHandleL( RFile64* aFile);
-
- /**
- * Create a task to generate a new thumbnail
- *
- * @since S60 v5.0
- * @param aBuffer Source image buffer to be set
- */
- void CreateGenerateTaskFromBufferL( TDesC8* aBuffer );
-
- /**
- * Process a fetched bitmap by creating scale tasks
- * or by returning the bitmap as such.
- *
- * @since S60 v5.0
- */
- void ProcessBitmapL();
-
- /**
- * ReleaseBitmap()
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void ReleaseBitmap( const RMessage2& aMessage );
-
- /**
- * Cancels pending request.
- *
- * @since S60 v5.0
- * @param aMessage Message.
- * @return Error code.
- */
- TInt CancelRequest( const RMessage2& aMessage );
-
- /**
- * Changes priority of pending request.
- *
- * @since S60 v5.0
- * @param aMessage Message.
- * @return Error code.
- */
- TInt ChangePriority( const RMessage2& aMessage );
-
- /**
- * Delete thumbnails.
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void DeleteThumbnailsL( const RMessage2& aMessage );
-
- /**
- * Delete thumbnails by Id.
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void DeleteThumbnailsByIdL( const RMessage2& aMessage );
-
- /**
- * Get the required size (in characters) for a buffer that contains the
- * list of supported MIME types
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void GetMimeTypeBufferSizeL( const RMessage2& aMessage );
-
- /**
- * Get the list of supported MIME types and store them in the buffer
- * allocated by the client.
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void GetMimeTypeListL( const RMessage2& aMessage );
-
- /**
- * Update thumbnails by Thumbnail ID.
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void UpdateThumbnailsL( const RMessage2& aMessage );
-
- /**
- * Rename thumbnails.
- *
- * @since S60 v5.0
- * @param aMessage Message.
- */
- void RenameThumbnailsL( const RMessage2& aMessage );
-
- /**
- * Checks if client thread is still alive and RMessage2 handle valid.
- *
- * @since S60 v5.0
- */
- TBool ClientThreadAlive();
-
-private:
- // data
- /**
- * Temporary store for any bitmaps fetched from the store.
- * Own.
- */
- CFbsBitmap* iBitmap;
-
- /**
- * Temporary store for thumbnail request parameters as received
- * from the client.
- */
- TThumbnailRequestParamsPckgBuf iRequestParams;
-
- /**
- * Message from client. This is kept in a member variable to make
- * sure the message is completed if a leave occurs while handling
- * the request.
- */
- RMessage2 iMessage;
-
- /**
- * Size of the original object. Only valid if a stored thumbnail
- * was found when processing a request.
- */
- TSize iOriginalSize;
-
- /**
- * Temporary store for any jpegs fetched from the store.
- * Own.
- */
- TDesC8* iBuffer;
-
- TInt iBitmapHandle;
-
- // client thread from RMessage2
- RThread iClientThread;
-};
-
-#endif // THUMBNAILSERVERSESSION_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailsql.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*
-* 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: SQL statements
- *
-*/
-
-
-#ifndef THUMBNAILSQL_H
-#define THUMBNAILSQL_H
-
-// main table
-_LIT8( KThumbnailCreateInfoTable, "CREATE TABLE ThumbnailInfo ("
- // Assosiacted object in file system
- "Path TEXT COLLATE NOCASE,"
- // Associated (MDS) Id
- "TNId INTEGER,"
- // Combined (enumerated) size and classification
- "Size INTEGER,"
- // Format of thumbnail (CFBsbitmap, JPeg...)
- "Format INTEGER,"
- // If thumbnail is in the filesystem then this is NOT NULL and points to such file
- "TNPath TEXT COLLATE NOCASE,"
- // Width of thumbnail
- "Width INTEGER,"
- // Height of thumbnail
- "Height INTEGER,"
- // Width of source
- "OrigWidth INTEGER,"
- // Height of source
- "OrigHeight INTEGER,"
- // Control flags, cropped etc.
- "Flags INTEGER,"
- // Frame number of video TN when user defined
- "VideoPosition INTEGER,"
- // Thumbnail orientation
- "Orientation INTEGER,"
- // Set if thumbnail is actually created from the associated object path
- "ThumbFromPath INTEGER,"
- // Last modified timestamp
- "Modified LARGEINT);");
-
-_LIT8( KThumbnailCreateInfoDataTable, "CREATE TABLE ThumbnailInfoData ("
- // If Thumbnail is stored in SQL then Data is NOT NULL
- "Data BLOB);");
-
-// temp table is identical to actual main table except it's not persistent
-_LIT8( KThumbnailCreateTempInfoTable, "CREATE TEMP TABLE TempThumbnailInfo ("
- "Path TEXT COLLATE NOCASE,"
- "TNId INTEGER,"
- "Size INTEGER,"
- "Format INTEGER,"
- "TNPath TEXT COLLATE NOCASE,"
- "Width INTEGER,"
- "Height INTEGER,"
- "OrigWidth INTEGER,"
- "OrigHeight INTEGER,"
- "Flags INTEGER,"
- "VideoPosition INTEGER,"
- "Orientation INTEGER,"
- "ThumbFromPath INTEGER,"
- "Modified LARGEINT);");
-
-_LIT8( KThumbnailCreateTempInfoDataTable, "CREATE TEMP TABLE TempThumbnailInfoData ("
- // If Thumbnail is stored in SQL then Data is NOT NULL
- "Data BLOB);");
-
-// version table
-_LIT8( KThumbnailVersionTable, "CREATE TABLE ThumbnailVersion ("
- "Major INTEGER,"
- "Minor INTEGER,"
- "IMEI TEXT COLLATE NOCASE);");
-
-// deleted thumbs table
-_LIT8( KThumbnailDeletedTable, "CREATE TABLE ThumbnailDeleted ("
- // Assosiacted object in file system
- "Path TEXT UNIQUE COLLATE NOCASE);");
-
-// indexes
-_LIT8( KThumbnailCreateInfoTableIndex1, "CREATE INDEX idx1 ON ThumbnailInfo(Path, Size);");
-
-// parameters
-_LIT( KThumbnailSqlParamData, ":Data" );
-_LIT( KThumbnailSqlParamFlags, ":Flags" );
-_LIT( KThumbnailSqlParamPath, ":Path" );
-_LIT( KThumbnailSqlParamNewPath, ":NewPath" );
-_LIT( KThumbnailSqlParamWidth, ":Width" );
-_LIT( KThumbnailSqlParamHeight, ":Height" );
-_LIT( KThumbnailSqlParamOriginalWidth, ":OrigWidth" );
-_LIT( KThumbnailSqlParamOriginalHeight, ":OrigHeight" );
-_LIT( KThumbnailSqlParamFormat, ":Format" );
-_LIT( KThumbnailSqlParamSize, ":Size" );
-_LIT( KThumbnailSqlParamTNPath, ":TNPath" );
-_LIT( KThumbnailSqlParamMajor, ":Major" );
-_LIT( KThumbnailSqlParamMinor, ":Minor" );
-_LIT( KThumbnailSqlParamImei, ":IMEI" );
-_LIT( KThumbnailSqlParamSizeImage, ":SizeImage" );
-_LIT( KThumbnailSqlParamSizeVideo, ":SizeVideo" );
-_LIT( KThumbnailSqlParamSizeAudio, ":SizeAudio" );
-_LIT( KThumbnailSqlParamRowID, ":RowID" );
-_LIT( KThumbnailSqlParamOrientation, ":Orient" );
-_LIT( KThumbnailSqlParamThumbFromPath, ":ThumbFromPath" );
-_LIT( KThumbnailSqlParamModified, ":Modified" );
-_LIT( KThumbnailSqlParamFlag, ":Flag" );
-_LIT( KThumbnailSqlParamLimit, ":Limit" );
-
-// transaction
-_LIT8( KThumbnailBeginTransaction, "BEGIN TRANSACTION;" );
-_LIT8( KThumbnailCommitTransaction, "COMMIT;" );
-_LIT8( KThumbnailRollbackTransaction, "ROLLBACK;" );
-
-// version
-_LIT8( KThumbnailInsertToVersion, "INSERT INTO ThumbnailVersion (IMEI, Minor, Major) VALUES (:IMEI, :Minor,:Major);" );
-_LIT8( KThumbnailSelectFromVersion, "SELECT * FROM ThumbnailVersion LIMIT 1" );
-
-// IMEI
-_LIT8( KThumbnailUpdateIMEI, "UPDATE ThumbnailVersion SET IMEI = :IMEI" );
-
-// rowIDs
-_LIT8 ( KGetInfoRowID, "SELECT MAX (ThumbnailInfo.rowID) FROM ThumbnailInfo" );
-_LIT8 ( KGetDataRowID, "SELECT MAX (ThumbnailInfoData.rowID) FROM ThumbnailInfoData" );
-
-// flush
-_LIT8( KThumbnailMoveFromTempInfoToMainTable, "INSERT INTO ThumbnailInfo SELECT * FROM TempThumbnailInfo;");
-_LIT8( KThumbnailMoveFromTempDataToMainTable, "INSERT INTO ThumbnailInfoData SELECT * FROM TempThumbnailInfoData;");
-_LIT8( KThumbnailDeleteFromTempInfoTable, "DELETE FROM TempThumbnailInfo;");
-_LIT8( KThumbnailDeleteFromTempDataTable, "DELETE FROM TempThumbnailInfoData;");
-
-// store thumb
-_LIT8( KThumbnailInsertTempThumbnailInfo, "INSERT INTO TempThumbnailInfo "
- "(Path,Size,Format,Width,Height,OrigWidth,OrigHeight,Flags,Orientation,ThumbFromPath,Modified) "
- "VALUES "
- "(:Path,:Size,:Format,:Width,:Height,:OrigWidth,:OrigHeight,:Flags,:Orient,:ThumbFromPath,:Modified);" );
-
-_LIT8( KThumbnailInsertTempThumbnailInfoData, "INSERT INTO TempThumbnailInfoData (Data) VALUES (:Data);" );
-
-// duplicate check
-_LIT8 ( KThumbnailTempFindDuplicate, "SELECT Path FROM TempThumbnailInfo WHERE Path = :Path AND Size = :Size;" );
-_LIT8 ( KThumbnailFindDuplicate, "SELECT Path FROM ThumbnailInfo WHERE Path = :Path AND Size = :Size;" );
-
-// select size
-_LIT8( KThumbnailSelectSizeByPath, "SELECT Size FROM ThumbnailInfo "
- "WHERE NOT EXISTS (SELECT Path FROM ThumbnailDeleted "
- "WHERE ThumbnailInfo.Path = ThumbnailDeleted.Path) "
- "AND Path = :Path ORDER BY Size DESC;" );
-
-_LIT8( KThumbnailSelectTempSizeByPath, "SELECT Size FROM TempThumbnailInfo WHERE Path = :Path ORDER BY Size DESC;" );
-
-// select timestamp
-_LIT8( KThumbnailSelectModifiedByPath, "SELECT Modified FROM ThumbnailInfo WHERE Path = :Path" );
-_LIT8( KThumbnailSelectTempModifiedByPath, "SELECT Modified FROM TempThumbnailInfo WHERE Path = :Path");
-
-// select thumb
-_LIT8( KThumbnailSelectInfoByPath, "SELECT ThumbnailInfo.Format, ThumbnailInfoData.Data, ThumbnailInfo.Width, ThumbnailInfo.Height, ThumbnailInfo.Flags "
- "FROM ThumbnailInfo "
- "JOIN ThumbnailInfoData "
- "ON ThumbnailInfo.RowID = ThumbnailInfoData.RowID "
- "WHERE NOT EXISTS (SELECT Path FROM ThumbnailDeleted "
- "WHERE ThumbnailInfo.Path = ThumbnailDeleted.Path) "
- "AND ThumbnailInfo.Path = :Path AND ThumbnailInfo.Size = :Size;");
-
-_LIT8( KThumbnailSelectTempInfoByPath, "SELECT TempThumbnailInfo.Format, TempThumbnailInfoData.Data, TempThumbnailInfo.Width, TempThumbnailInfo.Height, TempThumbnailInfo.Flags "
- "FROM TempThumbnailInfo "
- "JOIN TempThumbnailInfoData "
- "ON TempThumbnailInfo.RowID = TempThumbnailInfoData.RowID "
- "WHERE TempThumbnailInfo.Path = :Path AND TempThumbnailInfo.Size = :Size;");
-
-// delete thumb
-_LIT8( KThumbnailSqlSelectRowIDInfoByPath, "SELECT ThumbnailInfo.RowID FROM ThumbnailInfo WHERE Path = :Path;" );
-_LIT8( KThumbnailSqlDeleteInfoByPath, "DELETE FROM ThumbnailInfo WHERE ThumbnailInfo.RowID = :RowID;" );
-_LIT8( KThumbnailSqlDeleteInfoDataByPath, "DELETE FROM ThumbnailInfoData WHERE ThumbnailInfoData.RowID = :RowID;" );
-_LIT8( KTempThumbnailSqlSelectRowIDInfoByPath, "SELECT TempThumbnailInfo.RowID FROM TempThumbnailInfo WHERE Path = :Path LIMIT 1;" );
-_LIT8( KTempThumbnailSqlDeleteInfoByPath, "DELETE FROM TempThumbnailInfo WHERE TempThumbnailInfo.RowID = :RowID;" );
-_LIT8( KTempThumbnailSqlDeleteInfoDataByPath, "DELETE FROM TempThumbnailInfoData WHERE TempThumbnailInfoData.RowID = :RowID;" );
-
-// mark deleted
-_LIT8( KThumbnailSqlInsertDeleted, "INSERT INTO ThumbnailDeleted (Path) VALUES (:Path);" );
-_LIT8( KThumbnailSqlFindDeleted, "SELECT * FROM ThumbnailDeleted WHERE Path = :Path;" );
-
-// delete marked
-_LIT8( KThumbnailSqlSelectMarked, "SELECT ThumbnailInfo.RowID FROM ThumbnailInfo "
- "WHERE EXISTS (SELECT Path FROM ThumbnailDeleted "
- "WHERE ThumbnailInfo.Path = ThumbnailDeleted.Path) LIMIT :Limit;" );
-
-_LIT8( KThumbnailSqlDeleteInfoByRowID, "DELETE FROM ThumbnailInfo WHERE ThumbnailInfo.RowID = :RowID;" );
-_LIT8( KThumbnailSqlDeleteInfoDataByRowID, "DELETE FROM ThumbnailInfoData WHERE ThumbnailInfoData.RowID = :RowID;" );
-
-_LIT8( KThumbnailSqlDeleteFromDeleted, "DELETE FROM ThumbnailDeleted "
- "WHERE NOT EXISTS (SELECT Path FROM ThumbnailInfo "
- "WHERE ThumbnailDeleted.Path = ThumbnailInfo.Path);" );
-
-// rename thumb
-_LIT8( KThumbnailRename, "UPDATE ThumbnailInfo SET Path = :NewPath WHERE Path = :Path;" );
-_LIT8( KThumbnailTempRename, "UPDATE TempThumbnailInfo SET Path = :NewPath WHERE Path = :Path;" );
-
-// reset blacklisted
-_LIT8( KThumbnailTouchBlacklistedRows, "UPDATE ThumbnailInfo SET Flags = 4, Modified = 0 WHERE Flags & :Flag" );
-
-// existence check
-_LIT8( KThumbnailSelectAllPaths, "SELECT ThumbnailInfo.RowID,Path FROM ThumbnailInfo "
- "WHERE NOT EXISTS (SELECT Path FROM ThumbnailDeleted "
- "WHERE ThumbnailInfo.Path = ThumbnailDeleted.Path) "
- "AND ThumbFromPath = 1 AND ThumbnailInfo.RowID > :RowID ORDER BY ThumbnailInfo.RowID ASC LIMIT :Limit;" );
-
-#endif // THUMBNAILSQL_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailstore.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,668 +0,0 @@
-/*
-* 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: Store for thumbnails.
- *
-*/
-
-
-#ifndef THUMBNAILSTORE_H
-#define THUMBNAILSTORE_H
-
-#include <sqldb.h>
-#include <e32base.h>
-#include <f32file.h>
-#include "thumbnailcenrep.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "tmactivitymanager.h"
-
-class RFs;
-class CFbsBitmap;
-class CThumbnailServer;
-
-/**
- * Database transaction
- *
- * @since S60 v5.0
- */
-class RThumbnailTransaction
- {
- enum TState
- {
- EOpen, EOldOpen, EError, EClosed
- };
-public:
- RThumbnailTransaction( RSqlDatabase& aDatabase );
-
- void BeginL();
- void Close();
- void CommitL();
- TInt Rollback();
-
-private:
- RSqlDatabase& iDatabase;
- TState iState;
-};
-
-
-/**
-* MThumbnailStoreDiskSpaceNotifierObserver
-* Observer interface for a disk space notifier.
-*/
-class MThumbnailStoreDiskSpaceNotifierObserver
- {
- public :
- /**
- * Called to notify the observer that disk space has crossed the specified threshold value.
- *
- * @param aDiskFull is disk full (freespace under specified threshold level)
- */
- virtual void HandleDiskSpaceNotificationL(TBool aDiskFull) = 0;
-
- /**
- * Called to if disk space notifier has an error situation.
- *
- * @param aError error code
- */
- virtual void HandleDiskSpaceError(TInt aError) = 0;
-
- };
-
-/**
-* CThumbnailStoreDiskSpaceNotifierAO.
-* A disk space notifier class
-*/
-class CThumbnailStoreDiskSpaceNotifierAO : public CActive
- {
- public:
- enum TDiskSpaceNotifierState
- {
- ENormal,
- EIterate
- };
-
- public : // Constructors and destructors
- /**
- * Constructs a disk space notifier implementation.
- *
- * @param aThreshold minimum free disk space threshold level in bytes
- * @param aFilename filename which defines monitored drive's number
- * @return implementation
- */
- static CThumbnailStoreDiskSpaceNotifierAO* NewL(
- MThumbnailStoreDiskSpaceNotifierObserver& aObserver,
- TInt64 aThreshold, const TDesC& aFilename);
-
- /**
- * Constructs a disk space notifier implementation and leaves it
- * in the cleanup stack.
- *
- * @param aThreshold minimum free disk space threshold level in bytes
- * @return implementation
- */
- static CThumbnailStoreDiskSpaceNotifierAO* NewLC(
- MThumbnailStoreDiskSpaceNotifierObserver& aObserver,
- TInt64 aThreshold, const TDesC& aFilename );
-
- /**
- * Destructor.
- */
- virtual ~CThumbnailStoreDiskSpaceNotifierAO();
-
- TBool DiskFull() const;
-
- protected: // Functions from base classes
- /**
- * From CActive
- * Callback function.
- * Invoked to handle responses from the server.
- */
- void RunL();
-
- /**
- * From CActive
- * Handles errors that occur during notifying the observer.
- */
- TInt RunError(TInt aError);
-
- /**
- * From CActive
- * Cancels any outstanding operation.
- */
- void DoCancel();
-
- private: // Constructors and destructors
-
- /**
- * constructor
- */
- CThumbnailStoreDiskSpaceNotifierAO(
- MThumbnailStoreDiskSpaceNotifierObserver& aObserver,
- TInt64 aThreshold, TDriveNumber aDrive );
-
- /**
- * 2nd phase constructor
- * @param aThreshold minimum free disk space threshold level in bytes
- * @param aDrive monitored drive's number
- */
- void ConstructL();
-
- private: // New methods
-
- void StartNotifier();
-
- static TDriveNumber GetDriveNumberL( const TDesC& aFilename );
-
- private: // Data
-
- MThumbnailStoreDiskSpaceNotifierObserver& iObserver;
-
- RFs iFileServerSession;
-
- const TInt64 iThreshold;
-
- const TDriveNumber iDrive;
-
- TDiskSpaceNotifierState iState;
-
- TInt iIterationCount;
-
- TBool iDiskFull;
- };
-
-
-/**
- * Store for thumbnails.
- *
- * @since S60 v5.0
- */
-class CThumbnailStore: public CBase,
- public MThumbnailStoreDiskSpaceNotifierObserver,
- public MTMActivityManagerObserver
- {
- // Bitmasked Flags
- typedef enum
- {
- KThumbnailDbFlagCropped = 1,
- KThumbnailDbFlagBlacklisted = 2,
- KThumbnailDbFlagDeleted = 4
- }TThumbnailDbFlags;
-
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @param aFs File server.
- * @param aDrive Drive the store used for
- * @param aCenter Pointer to cenrep data handler
- * @param aReadOnly flag is store write protected
- * @return New CThumbnailStore instance.
- */
- static CThumbnailStore* NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly );
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailStore();
-
- /**
- * Stores thumbnail image.
- *
- * @since S60 v5.0
- * @param aPath Path of the image from which thumbnail was created.
- * @param aThumbnail Thumbnail bitmap.
- * @param aOriginalSize Original size of image.
- * @param aCropped Enabled if image is cropped.
- * @param aThumbnailSize Prededined size of requested thumbnail.
- * @param aThumbFromPath Thumbnail created from associated path.
- */
- void StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aThumbnail, const
- TSize& aOriginalSize, TBool aCropped, const TThumbnailSize aThumbnailSize,
- const TInt64 aModified, const TBool aThumbFromPath, TBool aBlackListed);
-
- /**
- * Fetches thumbnail image.
- *
- * @since S60 v5.0
- * @param aPath Path of the media object whose thumbnail is
- * to be retrieved.
- * @param aThumbnail Pointer to get the fetched thumbnail bitmap.
- * Caller assumes ownership.
- * @param aData Pointer to get the fetched thumbnail JPEG.
- * Caller assumes ownership.
-
- * @param aAllowUpscaling If enabled, allow fetching thumbnails that
- * are smaller than requested.
- * @param aThumbnailSize Prededined size of requested thumbnail.
- *
- * @param aThumbnailSize Reference to real size of TN.
- */
- void FetchThumbnailL( const TDesC& aPath,
- CFbsBitmap* & aThumbnail,
- TDesC8* & aData,
- const TThumbnailSize aThumbnailSize,
- TSize &aThumbnailRealSize
- );
-
- /**
- * Delete thumbnails.
- *
- * @since S60 v5.0
- * @param aPath Path of the media object whose thumbnail is
- * to be deleted.
- * @param aForce Force to delete instantly
- * @param aTransaction Create a transaction
- */
- void DeleteThumbnailsL( const TDesC& aPath, TBool aForce = EFalse,
- TBool aTransaction = ETrue);
-
- /**
- * Rename thumbnails.
- *
- * @since S60 v5.0
- * @param aCurrentPath Current path of the Thumbnail
- * @param aNewPath New path for the Thumbnail
- */
- void RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath );
-
- /**
- * Persistent sizes.
- *
- * @since S60 v5.0
- * @return List of thumbnail sizes (including othe parameters) which
- * are stored for later access.
- */
- void SetPersistentSizes(const RArray < TThumbnailPersistentSize > &aSizes);
-
- /**
- * Get persistent sizes not yet in database
- *
- * @since S60 v5.0
- * @param aPath Path where missing sizes are associated
- * @param aMissingSizes List of missing thumbnail sizes
- * @param aCheckGridSizeOnly check only is grid size missing
- */
- void GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
- TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly );
-
- /**
- * Check IMEI (owner) of db
- *
- * @since S60 v5.0
- */
- TInt CheckImei();
-
- /**
- * Check version of db
- *
- * @since S60 v5.0
- */
- TInt CheckVersion();
-
- /**
- * Check mediaid of store
- *
- * @since S60 v5.0
- */
- TInt CheckMediaIDL();
-
- /**
- * Add version and IMEI to db
- *
- * @since S60 v5.0
- */
- void AddVersionAndImeiL();
-
- /**
- * Update IMEI to db
- *
- * @since S60 v5.0
- */
- void UpdateImeiL();
-
- /**
- * Checks that database rowids match.
- *
- * @since S60 v5.0
- */
-
- TInt CheckRowIDs();
-
- /**
- * Check is disk full
- *
- * @since S60 v5.0
- */
- TBool IsDiskFull();
-
- /**
- * Checks timestamp of blacklisted entry to timestamp of file, from
- * which thumbnail entry was created, in filesystem
- *
- * @param aPath Path from which thumbnail created
- * @param aModified current timestampt
- * @contains indication whether file modified
- */
- TBool CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged);
-
- /**
- * @return TBool is store write protected
- */
- TBool IsReadOnly();
-
-private:
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aFs File server.
- * @param aDrive Drive the store used for
- * @param aReadOnly set flag if store is write protected
- * @return New CThumbnailStore instance.
- */
- CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Starts constructing database
- *
- * @since S60 v5.0
- */
- void PrepareDbL();
-
- /**
- * Open database
- *
- * @since S60 v5.0
- * @param aNewDatabase Delete existing before creating new
- */
- TInt OpenDatabaseL( TBool aNewDatabase = EFalse);
-
- /**
- * Open database
- *
- * @since S60 v5.0
- */
- TInt OpenDatabaseFileL();
-
- /**
- * Construct database tables
- *
- * @since S60 v5.0
- */
- void CreateTablesL();
- void CreateTempTablesL();
-
- /**
- * Delete and create database
- *
- * @since S60 v5.0
- * @param aDelete Delete old db
- */
- void RecreateDatabaseL( const TBool aDelete );
-
- /**
- * Prepare, reset & close statements
- *
- * @since S60 v5.0
- */
- void PrepareStatementsL();
- static void ResetStatement( TAny* aStmt );
- void CloseStatements();
-
- /**
- * Stores thumbnail image.
- *
- * @since S60 v5.0
- * @param aPath Path of the image from which thumbnail was created.
- * @param aData Data.
- * @param aSize Size of thumbnail.
- * @param aOriginalSize Original size of image.
- * @param aFormat Format of the image.
- * @param aFlags Flags.
- * @param aThumbnailSize Associated size of the thumbnail to be deleted
- * @param aThumbFromPath Thumbnail created from associated path.
- */
- void StoreThumbnailL( const TDesC& aPath, const TDes8& aData, const TSize&
- aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags,
- const TThumbnailSize& aThumbnailSize, const TInt64 aModified,
- const TBool aThumbFromPath);
-
- /**
- * Finds possible existing duplicate thumbnail.
- *
- * @since S60 v5.0
- * @param aPath Path of the image from which thumbnail was created.
- * @param aThumbnailId ID of the thumbnail
- * @param aThumbnailSize Associated size of the thumbnail to be deleted
- */
- TBool FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize );
-
- /**
- * Flush RAM cache containing generated TNs to persistent storage.
- *
- * @since S60 TB9.1
- * @param aForce which forces logic to flush cache table.
- */
- void FlushCacheTable( TBool aForce = EFalse );
-
- /**
- * Start db auto flush timer
- *
- * @since S60 TB9.1
- */
- void StartAutoFlush();
-
- /**
- * Stop db auto flush timer
- *
- * @since S60 TB9.1
- */
- void StopAutoFlush();
-
- void StartMaintenance();
-
- /**
- * Callback for harvesting complete timer
- *
- * @since S60 v5.0
- */
- static TInt AutoFlushTimerCallBack(TAny* aAny);
-
- /**
- * Callback for maintenance timer
- *
- * @since S60 v5.0
- */
- static TInt MaintenanceTimerCallBack(TAny* aAny);
-
- /**
- * Touches blacklisted items
- *
- */
- void PrepareBlacklistedItemsForRetryL();
-
- /**
- * Deletes thumbs added to Deleted table
- *
- */
- TInt DeleteMarkedL();
-
- /**
- * Checks if thumbnail source files are still in the file system.
- * If not, delete corresponding thumbs.
- *
- * @return ETrue, if finished.
- */
- TBool FileExistenceCheckL();
-
- /**
- * Checks if thumbnail database is usable
- *
- * @return KErrNone, if no problems
- */
- TInt CheckDbState();
-
- /**
- * Strips drive letter from URI.
- *
- * @since S60 v5.0
- * @param aPath Path.
- */
- void StripDriveLetterL( TDes& aPath );
-
-public : // From MThumbnailStoreDiskSpaceNotifierObserver
- void HandleDiskSpaceNotificationL(TBool aDiskFull);
-
- void HandleDiskSpaceError(TInt aError);
-
-private: //From MTMActivityManagerObserver
- void ActivityChanged(const TBool aActive);
-
-private:
- // data
-
- /**
- * Fileserver.
- */
- RFs& iFs;
-
- /**
- * Drive number & char
- */
- TInt iDrive;
- TChar iDriveChar;
-
- /**
- * Thumbnail database.
- */
- RSqlDatabase iDatabase;
-
- /**
- * Persistent sizes.
- */
- RArray < TThumbnailPersistentSize > iPersistentSizes;
-
- /**
- * Count of cached TNs not yet committed to db
- */
- TInt iBatchItemCount;
-
- /**
- * Phones IMEI code
- */
- TDesC& iImei;
-
- /**
- * ThumbnailServer
- */
-
- CThumbnailServer* iServer;
-
-#ifdef _DEBUG
- TUint32 iThumbCounter;
-#endif
-
- /**
- * Periodic timer handling automatic flushing of db cache
- */
- CPeriodic* iAutoFlushTimer;
-
- /**
- * Periodic timer handling db maintenance
- */
- CPeriodic* iMaintenanceTimer;
-
- /**
- * Notifier for situations where free disk space runs out.
- */
- CThumbnailStoreDiskSpaceNotifierAO* iDiskFullNotifier;
-
- TBool iDiskFull;
-
- CTMActivityManager* iActivityManager;
-
- // device idle
- TBool iIdle;
-
- // delete thumbs
- TBool iDeleteThumbs;
-
- // check if thumb source files still exist
- TBool iCheckFilesExist;
- TInt64 iLastCheckedRowID;
-
- // store is in a state in which db can't be used
- TBool iUnrecoverable;
-
- // prepared statements
- RSqlStatement iStmt_KThumbnailSelectInfoByPath;
- RSqlStatement iStmt_KThumbnailSelectTempInfoByPath;
- RSqlStatement iStmt_KThumbnailInsertTempThumbnailInfo;
- RSqlStatement iStmt_KThumbnailInsertTempThumbnailInfoData;
- RSqlStatement iStmt_KThumbnailSelectModifiedByPath;
- RSqlStatement iStmt_KThumbnailSelectTempModifiedByPath;
- RSqlStatement iStmt_KThumbnailFindDuplicate;
- RSqlStatement iStmt_KThumbnailTempFindDuplicate;
- RSqlStatement iStmt_KThumbnailSqlFindDeleted;
- RSqlStatement iStmt_KThumbnailSelectSizeByPath;
- RSqlStatement iStmt_KThumbnailSelectTempSizeByPath;
- RSqlStatement iStmt_KThumbnailSqlSelectRowIDInfoByPath;
- RSqlStatement iStmt_KThumbnailSqlDeleteInfoByPath;
- RSqlStatement iStmt_KThumbnailSqlDeleteInfoDataByPath;
- RSqlStatement iStmt_KTempThumbnailSqlSelectRowIDInfoByPath;
- RSqlStatement iStmt_KTempThumbnailSqlDeleteInfoByPath;
- RSqlStatement iStmt_KTempThumbnailSqlDeleteInfoDataByPath;
- RSqlStatement iStmt_KThumbnailSqlInsertDeleted;
- RSqlStatement iStmt_KThumbnailSqlSelectMarked;
- RSqlStatement iStmt_KThumbnailSqlDeleteInfoByRowID;
- RSqlStatement iStmt_KThumbnailSqlDeleteInfoDataByRowID;
- RSqlStatement iStmt_KThumbnailSelectAllPaths;
- RSqlStatement iStmt_KThumbnailRename;
- RSqlStatement iStmt_KThumbnailTempRename;
-
- /**
- * Dynamic batch size
- */
- TInt iBatchFlushItemCount;
-
- /**
- * Measure time spend in flush
- */
- TTime iStartFlush, iStopFlush;
- /**
- * How long previous flush took ms
- */
- TInt iPreviousFlushDelay;
-
- /**
- * is store write protected
- */
- TBool iReadOnly;
-
-};
-// End of File
-
-
-#endif // THUMBNAILSTORE_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailtask.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,227 +0,0 @@
-/*
-* 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 thumbnail server tasks
- *
-*/
-
-
-#ifndef THUMBNAILTASK_H
-#define THUMBNAILTASK_H
-
-#include "thumbnailmanager.h" // TThumbnailRequestId
-#include "thumbnailmanagerconstants.h" // TThumbnailServerRequestId
-
-
-class CThumbnailTaskProcessor;
-class CThumbnailServerSession;
-
-/**
- * Base class for thumbnail server tasks.
- *
- * @since S60 v5.0
- */
-class CThumbnailTask: public CActive
- {
-public:
- /**
- * Task state.
- * @since S60 v5.0
- */
- enum TTaskState
- {
- /**
- * This task is waiting to be run.
- */
- EIdle,
-
- /**
- * This task is currently running.
- */
- ERunning,
-
- /**
- * This task has completed and can be destroyed.
- */
- EComplete
- };
-
-public:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @param aProcessor Processor object for running tasks.
- * @param aPriority Priority of the task.
- * @return New CThumbnailTask instance.
- */
- CThumbnailTask( CThumbnailTaskProcessor& aProcessor, TInt aPriority );
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailTask();
-
-public:
-
- /**
- * Returns priority of task.
- *
- * @since S60 v5.0
- * @return Priority of the task.
- */
- TInt Priority()const;
-
- /**
- * Returns state of task.
- *
- * @since S60 v5.0
- * @return State.
- */
- TTaskState State()const;
-
- /**
- * SetMessageData
- *
- * @since S60 v5.0
- * @param aRequestId Request ID.
- * @param aMessage Message.
- * @param aClientThread Client thread.
- */
- virtual void SetMessageData( const TThumbnailServerRequestId& aRequestId,
- const RMessage2& aMessage, const RThread& aClientThread );
-
- /**
- * SetMessageData if message is not needed to complete
- *
- * @since S60 v5.0
- * @param aRequestId Request ID.
- */
- virtual void SetMessageData( const TThumbnailServerRequestId& aRequestId );
-
- /**
- * Resets message data.
- *
- * @since S60 v5.0
- */
- virtual void ResetMessageData();
-
- /**
- * Cancels message.
- *
- * @since S60 v5.0
- */
- virtual void CancelMessage();
-
- /**
- * Returns ID of specific task.
- *
- * @since S60 v5.0
- * @return Request ID.
- */
- virtual TThumbnailServerRequestId RequestId()const;
-
- /**
- * Changes priority of the task.
- *
- * @since S60 v5.0
- * @param aNewPriority New priority.
- */
- virtual void ChangeTaskPriority( TInt aNewPriority );
-
- /**
- * StartL
- *
- * @since S60 v5.0
- */
- virtual void StartL();
-
- /**
- * Implements cancellation of an outstanding request.
- *
- * @since S60 v5.0
- */
- virtual void DoCancel();
-
- /**
- * StartError
- *
- * @since S60 v5.0
- * @param aError Error code.
- */
- virtual void StartError( TInt aError );
-
- /**
- * Complete
- *
- * @since S60 v5.0
- * @param aReason Status code.
- */
- virtual void Complete( TInt aReason );
-
- /**
- * Continue without deleting task
- *
- * @since S60 v5.0
- */
- virtual void Continue();
-
- /**
- * Checks if client thread is still alive and RMessage2 handle valid.
- *
- * @since S60 v5.0
- * @param aGetThread Need to get thread first.
- */
- TBool ClientThreadAlive(const TBool aGetThread = EFalse);
-
- inline RMessage2& GetMessageData()
- {
- return iMessage;
- }
-
-protected:
- // data
-
- /**
- * Processor.
- */
- CThumbnailTaskProcessor& iProcessor;
-
- /**
- * Priority of the task.
- */
- TInt iPriority;
-
- /**
- * State of the task.
- */
- TTaskState iState;
-
- /**
- * Id of the request.
- */
- TThumbnailServerRequestId iRequestId;
-
- /**
- * Message.
- */
- RMessage2 iMessage;
-
- // client thread from RMessage2
- RThread iClientThread;
-};
-
-#endif // THUMBNAILTASK_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/thumbnailtaskprocessor.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
-* 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: Processor object for running queued tasks
- *
-*/
-
-
-#ifndef THUMBNAILTASKPROCESSOR_H
-#define THUMBNAILTASKPROCESSOR_H
-
-#include "thumbnailmanager.h" // TThumbnailFlags
-#include "thumbnailmanagerconstants.h" // TThumbnailServerRequestId
-#include "thumbnailprovider.h"
-#include <e32property.h>
-
-
-class CThumbnailTask;
-
-/**
- * Processor object for running queued tasks.
- *
- * @since S60 v5.0
- */
-class CThumbnailTaskProcessor: public CActive
- {
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return Instance of CThumbnailTaskProcessor.
- */
- static CThumbnailTaskProcessor* NewL();
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CThumbnailTaskProcessor();
-
- /**
- * Adds new task to the task queue.
- *
- * @since S60 v5.0
- * @param aTask Task to be added to the queue.
- */
- void AddTaskL( CThumbnailTask* aTask );
-
- /**
- * Removes specific task from the queue.
- *
- * @since S60 v5.0
- * @param aRequestId ID of the task to be removed.
- */
- TInt RemoveTask( const TThumbnailServerRequestId& aRequestId );
-
- /**
- * Removes specific task from the queue.
- *
- * @since S60 v5.0
- * @param aSession Identifier for task to be removed.
- */
- void RemoveTasks( CThumbnailServerSession* aSession );
-
- /**
- * Removes all tasks from the queue.
- *
- * @since S60 v5.0
- */
-
- void RemoveAllTasks();
-
- /**
- * Changes priority of a task.
- *
- * @since S60 v5.0
- * @param aRequestId ID of the task.
- * @param aNewPriority New priority to be assigned to the task.
- */
- TInt ChangeTaskPriority( const TThumbnailServerRequestId& aRequestId, const
- TInt aNewPriority );
-
- /**
- * Marks task to completed.
- *
- * @since S60 v5.0
- * @param aTask Completed task.
- */
- void TaskComplete( CThumbnailTask* aTask );
-
- void SetDaemonAsProcess(TBool aValue);
-
-protected:
- // from base class CActive
-
- /**
- * 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();
-
- /**
- * Handles a leave occurring in the request completion event handler
- * RunL().
- *
- * @since S60 v5.0
- * @return Error code.
- */
- TInt RunError( TInt aError );
-
-private:
-
- /**
- * C++ default constructor
- *
- * @since S60 v5.0
- * @return Instance of CThumbnailTaskProcessor.
- */
- CThumbnailTaskProcessor();
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
- /**
- * Callback for harvesting complete timer
- *
- * @since S60 v5.0
- */
- static TInt PeriodicTimerCallBack(TAny* aAny);
-
-private:
- // data
-
- /**
- * Task queue. Task objects are own by this class.
- * Own.
- */
- RPointerArray < CThumbnailTask > iTasks;
-
- /**
- * Current active task. Not own.
- */
- CThumbnailTask* iActiveTask;
-
- /**
- * PS used to notify Daemon when server is idle
- */
- RProperty iProperty;
- /**
- * Holds current idle value
- */
- TBool iIdle;
-
- CPeriodic* iPeriodicTimer;
-
- TBool iTimerActive;
-
- TBool iIsDaemonAsProcess;
-};
-
-#endif // THUMBNAILTASKPROCESSOR_H
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/inc/tmgetimei.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Helper class to get IMEI number.
-*
-*/
-
-#ifndef TMGETIMEI_H
-#define TMGETIMEI_H
-
-#include <e32base.h>
-#include <etel3rdparty.h>
-
-#include "thumbnailmanagerconstants.h"
-
-class CTMGetImei: public CActive
- {
- private:
- CTelephony *iTelephony;
- CTelephony::TPhoneIdV1 iV1;
- TBuf<KImeiBufferSize> iImei;
- CActiveSchedulerWait iAsw;
- public:
- virtual ~CTMGetImei();
- static CTMGetImei* NewL();
- static CTMGetImei* NewLC();
- TBuf<KImeiBufferSize> GetIMEI();
-
- void DoCancel();
-
- void RunL();
-
- private:
- CTMGetImei(): CActive(EPriorityStandard), iTelephony(NULL)
- {}
- void ConstructL();
- };
-
-#endif //TNMGETIMEI_H
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailcenrep.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,331 +0,0 @@
-/*
-* 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: Class for handling central repositoty data
- *
-*/
-
-
-#include <centralrepository.h>
-
-#include <thumbnailmanager.h>
-
-#include "thumbnailcenrep.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnailstore.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanagerprivatecrkeys.h"
-
-// ---------------------------------------------------------------------------
-// TThumbnailPersistentSize::TThumbnailPersistentSize
-// ---------------------------------------------------------------------------
-//
-TThumbnailPersistentSize::TThumbnailPersistentSize( const TSize& aSize, TBool
- aCrop, TDisplayMode aMode, TInt aFormat ) : iSize( aSize ), iCrop( aCrop ),
- iMode( aMode ), iFormat( aFormat )
- {
- iType = EUnknownThumbnailSize;
- iSourceType = EUnknownSourceType;
- iAutoCreate = ETrue;
- iSizeType = EUnknownSizeType;
- }
-
-// ---------------------------------------------------------------------------
-// TThumbnailPersistentSize::TThumbnailPersistentSize
-// ---------------------------------------------------------------------------
-//
-TThumbnailPersistentSize::TThumbnailPersistentSize( TThumbnailSize aType,
- const TSize& aSize, TBool aCrop, TDisplayMode aMode, TInt aFormat,
- TBool aAutoCreate, TThumbnailSizeType aSizeType )
- : iType( aType ), iSize( aSize ), iCrop( aCrop ), iMode( aMode ),
- iFormat( aFormat ), iAutoCreate( aAutoCreate ), iSizeType( aSizeType )
- {
- switch ( aType )
- {
- case EImageGridThumbnailSize:
- case EImageListThumbnailSize:
- case EImageFullScreenThumbnailSize:
- iSourceType = EImage;
- break;
- case EVideoGridThumbnailSize:
- case EVideoListThumbnailSize:
- case EVideoFullScreenThumbnailSize:
- iSourceType = EVideo;
- break;
- case EAudioGridThumbnailSize:
- case EAudioListThumbnailSize:
- case EAudioFullScreenThumbnailSize:
- iSourceType = EAudio;
- break;
- case EContactGridThumbnailSize:
- case EContactListThumbnailSize:
- case EContactFullScreenThumbnailSize:
- iSourceType = EContact;
- break;
- default:
- iSourceType = EUnknownSourceType;
- }
-
- }
-
-// ---------------------------------------------------------------------------
-// TThumbnailAutoCreate::TThumbnailAutoCreate
-// ---------------------------------------------------------------------------
-//
-TThumbnailAutoCreate::TThumbnailAutoCreate()
- : iImageGrid(EFalse), iImageList(EFalse), iImageFullscreen(EFalse),
- iVideoGrid(EFalse), iVideoList(EFalse), iVideoFullscreen(EFalse),
- iAudioGrid(EFalse), iAudioList(EFalse), iAudioFullscreen(EFalse),
- iContactGrid(EFalse), iContactList(EFalse), iContactFullscreen(EFalse)
- {
- // No implementation required
- }
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::CThumbnailCenRep()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailCenRep::CThumbnailCenRep()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::~CThumbnailCenRep()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailCenRep::~CThumbnailCenRep()
- {
- iPersistentSizes.Close();
- delete iAutoCreate;
- iAutoCreate = NULL;
- delete iRepository;
- iRepository = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailCenRep* CThumbnailCenRep::NewL()
- {
- CThumbnailCenRep* self = new( ELeave )CThumbnailCenRep();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::ConstructL()
-// Returns id of specific task.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailCenRep::ConstructL()
- {
- iRepository = CRepository::NewL( TUid::Uid( THUMBNAIL_CENREP_UID ));
-
- TInt xSize( 0 );
- TInt ySize( 0 );
- TBool flags( EFalse );
- const TBool KGridAndListThumbnailCropped = ETrue;
- TInt raw_mode( KThumbnailDefaultDisplayMode );
- TInt format( 0 );
- TBool autoCreate( EFalse );
-
- User::LeaveIfError( iRepository->Get( KSizeImageGridWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeImageGridHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageGrid, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EImageGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EGrid ));
-
- User::LeaveIfError( iRepository->Get( KSizeImageListWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeImageListHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageList, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EImageListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EList ));
-
- User::LeaveIfError( iRepository->Get( KSizeImageFullscreenWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeImageFullscreenHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageFullscreen, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EImageFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));
-
- User::LeaveIfError( iRepository->Get( KSizeVideoGridWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeVideoGridHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoGrid, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EVideoGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EGrid ));
-
- User::LeaveIfError( iRepository->Get( KSizeVideoListWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeVideoListHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoList, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EVideoListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EList ));
-
- User::LeaveIfError( iRepository->Get( KSizeVideoFullscreenWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeVideoFullscreenHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoFullscreen, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EVideoFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));
-
- User::LeaveIfError( iRepository->Get( KSizeAudioGridWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeAudioGridHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EGrid ));
-
- User::LeaveIfError( iRepository->Get( KSizeAudioListWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeAudioListHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EList ));
-
- User::LeaveIfError( iRepository->Get( KSizeAudioFullscreenWidth, xSize ));
- User::LeaveIfError( iRepository->Get( KSizeAudioFullscreenHeight, ySize ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, autoCreate ));
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EAudioFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));
-
-// Contact TN, set default values if not found
- if(iRepository->Get( KSizeContactGridWidth, xSize ) != KErrNone)
- {
- xSize = 54;
- }
- if( iRepository->Get( KSizeContactGridHeight, ySize ) != KErrNone)
- {
- ySize = 54;
- }
-
- if( iRepository->Get( KAutoCreateContactGrid, autoCreate ) != KErrNone)
- {
- autoCreate = 1;
- }
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactGridThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EGrid ));
-
- if( iRepository->Get( KSizeContactListWidth, xSize ) != KErrNone)
- {
- xSize = 64;
- }
- if( iRepository->Get( KSizeContactListHeight, ySize ) != KErrNone)
- {
- ySize = 64;
- }
- if( iRepository->Get( KAutoCreateContactList, autoCreate ) != KErrNone)
- {
- autoCreate = 1;
- }
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactListThumbnailSize, TSize( xSize, ySize ),
- KGridAndListThumbnailCropped, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EList ));
-
- if( iRepository->Get( KSizeContactFullscreenWidth, xSize ) != KErrNone)
- {
- xSize = 250;
- }
- if( iRepository->Get( KSizeContactFullscreenHeight, ySize ) != KErrNone)
- {
- ySize = 250;
- }
- if( iRepository->Get( KAutoCreateContactFullscreen, autoCreate) != KErrNone)
- {
- autoCreate = 1;
- }
-
- iPersistentSizes.AppendL( TThumbnailPersistentSize( EContactFullScreenThumbnailSize, TSize( xSize, ySize ),
- flags, static_cast <TDisplayMode> (raw_mode), format, autoCreate, TThumbnailPersistentSize::EFullscreen ));
-
-
- iAutoCreate = new (ELeave) TThumbnailAutoCreate();
-
- User::LeaveIfError( iRepository->Get( KAutoCreateImageGrid, iAutoCreate->iImageGrid ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageList, iAutoCreate->iImageList ));
- User::LeaveIfError( iRepository->Get( KAutoCreateImageFullscreen, iAutoCreate->iImageFullscreen ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoGrid, iAutoCreate->iVideoGrid ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoList, iAutoCreate->iVideoList ));
- User::LeaveIfError( iRepository->Get( KAutoCreateVideoFullscreen, iAutoCreate->iVideoFullscreen ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioGrid, iAutoCreate->iAudioGrid ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioList, iAutoCreate->iAudioList ));
- User::LeaveIfError( iRepository->Get( KAutoCreateAudioFullscreen, iAutoCreate->iAudioFullscreen ));
-
- if( iRepository->Get( KAutoCreateContactGrid, iAutoCreate->iContactGrid ) != KErrNone )
- {
- iAutoCreate->iContactGrid = 1;
- }
- if( iRepository->Get( KAutoCreateContactList, iAutoCreate->iContactList ) != KErrNone )
- {
- iAutoCreate->iContactList = 1;
- }
- if( iRepository->Get( KAutoCreateContactFullscreen, iAutoCreate->iContactFullscreen ) != KErrNone )
- {
- iAutoCreate->iContactFullscreen = 1;
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::GetPersistentSizes()
-// ---------------------------------------------------------------------------
-//
-RArray < TThumbnailPersistentSize > & CThumbnailCenRep::GetPersistentSizes()
- {
- return iPersistentSizes;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailCenRep::GetAutoCreateParams()
-// ---------------------------------------------------------------------------
-//
-TThumbnailAutoCreate & CThumbnailCenRep::GetAutoCreateParams()
- {
- return *iAutoCreate;
- }
-
-TThumbnailPersistentSize & CThumbnailCenRep::PersistentSizeL( TThumbnailSize
- aThumbnailSize )
- {
- TThumbnailPersistentSize* persistentSize = NULL;
- TInt i = iPersistentSizes.Count();
- for ( ; --i >= 0; )
- {
- persistentSize = &iPersistentSizes[i];
- if ( persistentSize->iType == aThumbnailSize )
- {
- break;
- }
- }
- if ( i < 0 )
- { // size not found
- User::Leave( KErrNotFound );
- }
-
- return *persistentSize;
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildecodetask.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
-* 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: Task for generating new thumbnails
- *
-*/
-
-
-#include <e32base.h>
-#include <fbs.h>
-
-#include <thumbnailmanager.h>
-
-#include "thumbnaildecodetask.h"
-#include "thumbnailprovider.h"
-#include "thumbnailserver.h"
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnaildecodetaskTraces.h"
-#endif
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailDecodeTask::CThumbnailDecodeTask()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailDecodeTask::CThumbnailDecodeTask( CThumbnailTaskProcessor& aProcessor,
- CThumbnailServer& aServer, TDesC8* aBuffer, TInt aPriority, TDisplayMode aDisplayMode): CThumbnailTask( aProcessor,
- aPriority ), iServer( aServer ), iBuffer(aBuffer), iDisplayMode(aDisplayMode)
- {
- TN_DEBUG3( "CThumbnailDecodeTask(0x%08x)::CThumbnailDecodeTask() aDisplayMode = %d", this
- , iDisplayMode);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILDECODETASK_CTHUMBNAILDECODETASK, "CThumbnailDecodeTask::CThumbnailDecodeTask;iDisplayMode=%u", iDisplayMode );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILDECODETASK_CTHUMBNAILDECODETASK, "CThumbnailDecodeTask::CThumbnailDecodeTask;this=%o", this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDecodeTask::~CThumbnailDecodeTask()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailDecodeTask::~CThumbnailDecodeTask()
- {
- TN_DEBUG2( "CThumbnailDecodeTask(0x%08x)::~CThumbnailDecodeTask()", this );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILDECODETASK_CTHUMBNAILDECODETASK, "CThumbnailDecodeTask::~CThumbnailDecodeTask" );
-
- if ( iProvider )
- {
- iProvider->CancelGetThumbnail();
- }
-
- iProvider = NULL;
- delete iBuffer;
- iBuffer = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDecodeTask::StartL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDecodeTask::StartL()
- {
- TN_DEBUG2( "CThumbnailDecodeTask(0x%08x)::StartL()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILDECODETASK_STARTL, "CThumbnailDecodeTask::StartL;this=%o", this );
-
- CThumbnailTask::StartL();
-
- const TPtrC8 mimeType = KJpegMime();
-
- iProvider = iServer.ResolveProviderL( mimeType );
- TN_DEBUG3( "CThumbnailDecodeTask(0x%08x) -- provider UID 0x%08x", this,
- iProvider->Uid());
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILDECODETASK_STARTL, "CThumbnailDecodeTask::StartL;this=%o", this );
-
- __ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer ));
-
- iProvider->CancelGetThumbnail();
- iProvider->Reset();
- iProvider->SetObserver( *this );
-
- iProvider->GetThumbnailL( iServer.Fs(), *iBuffer );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDecodeTask::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDecodeTask::RunL()
- {
- // No implementation required
- TN_DEBUG2( "CThumbnailDecodeTask(0x%08x)::RunL()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILDECODETASK_RUNL, "CThumbnailDecodeTask::RunL;this=%o", this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailDecodeTask::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDecodeTask::DoCancel()
- {
- TN_DEBUG2( "CThumbnailDecodeTask(0x%08x)::DoCancel()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILDECODETASK_DOCANCEL, "CThumbnailDecodeTask::DoCancel;this=%o", this );
- if ( iProvider )
- {
- iProvider->CancelGetThumbnail();
- }
- }
-
-
-//
-// ---------------------------------------------------------------------------
-// Thumbnail provider observer callback to notify the server when
-// thumbnail has been generated.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDecodeTask::ThumbnailProviderReady( const TInt aError,
- CFbsBitmap* aBitmap, const TSize& aOriginalSize, const TBool /*aEXIF*/, const TBool /*aPortrait*/ )
- {
- TN_DEBUG4( "CThumbnailDecodeTask(0x%08x)::ThumbnailProviderReady(aError=%d, aBitmap=0x%08x)",
- this, aError, aBitmap );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILDECODETASK_THUMBNAILPROVIDERREADY, "CThumbnailDecodeTask::ThumbnailProviderReady;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILDECODETASK_THUMBNAILPROVIDERREADY, "CThumbnailDecodeTask::ThumbnailProviderReady;aError=%d", aError );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILDECODETASK_THUMBNAILPROVIDERREADY, "CThumbnailDecodeTask::ThumbnailProviderReady;aBitmap=%o", aBitmap );
-
- iOriginalSize = aOriginalSize;
-
- if ( aError )
- {
- delete aBitmap;
- aBitmap = NULL;
- Complete( aError );
- return;
- }
-
- if( !aBitmap )
- {
- Complete( KErrGeneral );
- return;
- }
-
- if ( ClientThreadAlive() )
- {
- // pass bitmap handle to client
- TThumbnailRequestParams& params = iParamsBuf();
- TInt ret = iMessage.Read( 0, iParamsBuf );
-
- if(ret == KErrNone )
- {
- params.iBitmapHandle = aBitmap->Handle();
- ret = iMessage.Write( 0, iParamsBuf );
- }
-
- // add bitmap to pool
- TRAPD(err, iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId ) );
- if (err != KErrNone)
- {
- Complete( err );
- delete aBitmap;
- aBitmap = NULL;
- }
- else
- {
- aBitmap = NULL; // Server owns the bitmap now
-
- // Complete message
- Complete( ret );
- ResetMessageData();
- }
- }
- else
- {
- delete aBitmap;
- aBitmap = NULL;
- }
- }
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnaildiskunmountobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Class to monitor when volumes are unmounted
- *
-*/
-
-
-#include "thumbnaildiskunmountobserver.h"
-#include "thumbnaillog.h"
-#include "thumbnailserver.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnaildiskunmountobserverTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailDiskUnmountObserver* CThumbnailDiskUnmountObserver::NewL( RFs& aFs,
- TInt aDrive, CThumbnailServer* aServer )
- {
- CThumbnailDiskUnmountObserver* self = new( ELeave )
- CThumbnailDiskUnmountObserver( aFs, aDrive, aServer );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::CThumbnailTaskProcessor()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailDiskUnmountObserver::CThumbnailDiskUnmountObserver( RFs& aFs,
- TInt aDrive, CThumbnailServer* aServer )
- : CActive( CActive::EPriorityStandard ), iFs( aFs ), iDrive( aDrive), iServer( aServer )
- {
- TN_DEBUG1( "CThumbnailDiskUnmountObserver::CThumbnailDiskUnmountObserver()"
- );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILDISKUNMOUNTOBSERVER_CTHUMBNAILDISKUNMOUNTOBSERVER, "CThumbnailDiskUnmountObserver::CThumbnailDiskUnmountObserver" );
- CActiveScheduler::Add( this );
- StartNotify();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDiskUnmountObserver::ConstructL()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::~CThumbnailTaskProcessor()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailDiskUnmountObserver::~CThumbnailDiskUnmountObserver()
- {
- TN_DEBUG1(
- "CThumbnailDiskUnmountObserver::~CThumbnailDiskUnmountObserver()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILDISKUNMOUNTOBSERVER_CTHUMBNAILDISKUNMOUNTOBSERVER, "CThumbnailDiskUnmountObserver::~CThumbnailDiskUnmountObserver" );
- Cancel();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDiskUnmountObserver::RunL()
- {
- TN_DEBUG2( "CThumbnailDiskUnmountObserver::RunL() iStatus = %d",
- iStatus.Int());
- OstTrace1( TRACE_NORMAL, CTHUMBNAILDISKUNMOUNTOBSERVER_RUNL, "CThumbnailDiskUnmountObserver::RunL - iStatus =;iStatus.Int()=%d", iStatus.Int() );
-
- if( !iStatus.Int() )
- {
- // close store before allowing unmount
- // trap because nothing could be done in RunError anyway
- TRAP_IGNORE( iServer->CloseStoreForDriveL( iDrive ) );
- iFs.AllowDismount( iDrive );
- }
- if ( iStatus.Int() != KErrNotReady)
- {
- StartNotify();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailDiskUnmountObserver::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDiskUnmountObserver::DoCancel()
- {
- iFs.NotifyDismountCancel( iStatus );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailDiskUnmountObserver::StartNotify()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailDiskUnmountObserver::StartNotify()
- {
- TN_DEBUG1( "CThumbnailDiskUnmountObserver::StartNotify()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILDISKUNMOUNTOBSERVER_STARTNOTIFY, "CThumbnailDiskUnmountObserver::StartNotify" );
- if(!IsActive())
- {
- iFs.NotifyDismount( iDrive, iStatus, EFsDismountRegisterClient );
- SetActive();
- }
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailfetchedchecker.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-/*
-* 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:
- *
-*/
-
-#include "thumbnailfetchedchecker.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailfetchedcheckerTraces.h"
-#endif
-
-
-const int KMaxStoredEntries = 100;
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CThumbnailFetchedChecker()
-// -----------------------------------------------------------------------------
-//
-CThumbnailFetchedChecker* CThumbnailFetchedChecker::NewL()
- {
- return new (ELeave) CThumbnailFetchedChecker();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CThumbnailFetchedChecker()
-// -----------------------------------------------------------------------------
-//
-CThumbnailFetchedChecker::CThumbnailFetchedChecker()
- {
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::~CThumbnailFetchedChecker()
-// -----------------------------------------------------------------------------
-//
-CThumbnailFetchedChecker::~CThumbnailFetchedChecker()
- {
- iNotFetched.ResetAndDestroy();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::LastFetchResult()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailFetchedChecker::LastFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize )
- {
- TN_DEBUG3( "CThumbnailFetchedChecker::LastFetchResult(aUri=%S aThumbnailSize=%d)", &aUri, aThumbnailSize);
- OstTraceExt2( TRACE_NORMAL, CTHUMBNAILFETCHEDCHECKER_LASTFETCHRESULT, "CThumbnailFetchedChecker::LastFetchResult;aUri=%S;aThumbnailSize=%hu", aUri, aThumbnailSize );
-
- CEntry* entry = NULL;
- TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, KErrNone ) );
- if ( !err && entry )
- {
- TInt ret = iNotFetched.FindInOrder( entry, CEntry::FindCB );
- if ( ret != KErrNotFound )
- {
- TN_DEBUG1( "CThumbnailFetchedChecker::LastFetchResult() -> error found");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILFETCHEDCHECKER_LASTFETCHRESULT, "CThumbnailFetchedChecker::LastFetchResult - error found" );
- delete entry;
- entry = NULL;
- return iNotFetched[ ret ]->iError;
- }
- }
-
- delete entry;
- entry = NULL;
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::SetFetchResult()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailFetchedChecker::SetFetchResult( const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError )
- {
- TN_DEBUG4( "CThumbnailFetchedChecker::SetFetchResult(aUri=%S aThumbnailSize=%d aError=%d)", &aUri, aThumbnailSize, aError);
- OstTraceExt3( TRACE_NORMAL, CTHUMBNAILFETCHEDCHECKER_SETFETCHRESULT, "CThumbnailFetchedChecker::SetFetchResult;aUri=%S;aThumbnailSize=%u;aError=%d", aUri, aThumbnailSize, aError );
- if ( aError == KErrNone )
- {
- // Remove successful results from store
- CEntry* entry = NULL;
- TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, aError ) );
- if ( !err && entry )
- {
- TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB );
- if ( i >= 0 )
- {
- TN_DEBUG2( "CThumbnailFetchedChecker::LastFetchResult() -> Remove successful results from store %d", iNotFetched.Count() );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILFETCHEDCHECKER_SETFETCHRESULT, "CThumbnailFetchedChecker::SetFetchResult;iNotFetched.Count()=%d", iNotFetched.Count() );
- delete iNotFetched[ i ];
- iNotFetched[ i ] = NULL;
- iNotFetched.Remove( i );
- }
- }
- entry = NULL;
- delete entry;
- }
- else
- {
-
- // Add or update
- CEntry* entry = NULL;
- TRAPD( err, entry = CEntry::NewL( aUri, aThumbnailSize, aError ) );
- OstTraceExt3( TRACE_NORMAL, DUP4_CTHUMBNAILFETCHEDCHECKER_SETFETCHRESULT, "CThumbnailFetchedChecker::SetFetchResult;aUri=%S;aThumbnailSize=%u;aError=%d", aUri, aThumbnailSize, aError );
- if ( !err && entry )
- {
- err = iNotFetched.Find( entry );
- if ( err != KErrNotFound )
- {
- // update existing fetch result
- TInt i = iNotFetched.FindInOrder( entry, CEntry::FindCB );
- if ( i >= 0 )
- {
- TN_DEBUG1( "CThumbnailFetchedChecker::LastFetchResult() -> Update fetched tn error" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILFETCHEDCHECKER_SETFETCHRESULT, "CThumbnailFetchedChecker::SetFetchResult - Update fetched tn error" );
- iNotFetched[ i ]->iError = aError;
- }
- }
- else
- {
- if( iNotFetched.Count() < KMaxStoredEntries )
- {
- // insert new fetch result
- TInt err = iNotFetched.InsertInOrder( entry, CEntry::InsertCB );
- if ( err == KErrNone )
- {
- TN_DEBUG2( "CThumbnailFetchedChecker::LastFetchResult() -> Inserted new fetched tn error %d", iNotFetched.Count());
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILFETCHEDCHECKER_SETFETCHRESULT, "CThumbnailFetchedChecker::SetFetchResult;iNotFetched.Count()=%d", iNotFetched.Count() );
- entry = NULL; // owned by array now
- }
- }
- }
-
- delete entry;
- entry = NULL;
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::DeleteFetchResult()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailFetchedChecker::DeleteFetchResult( const TDesC& aUri )
- {
- TN_DEBUG2( "CThumbnailFetchedChecker::DeleteFetchResult(%S)", &aUri);
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILFETCHEDCHECKER_DELETEFETCHRESULT, "CThumbnailFetchedChecker::DeleteFetchResult;aUri=%S", aUri );
- // delete all entries of passed uri
- TInt ret;
- do
- {
- ret = iNotFetched.FindInOrder( aUri, CEntry::FindCBUri );
- if ( ret >= 0 )
- {
- TN_DEBUG1( "CThumbnailFetchedChecker::DeleteFetchResult() -> Deteled URI from fetched list" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILFETCHEDCHECKER_DELETEFETCHRESULT, "CThumbnailFetchedChecker::DeleteFetchResult - Deteled URI from fetched list" );
- delete iNotFetched[ ret ];
- iNotFetched[ ret ] = NULL;
- iNotFetched.Remove( ret );
- }
- }
- while(ret != KErrNotFound );
-
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::LastFetchResult()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailFetchedChecker::RenameFetchResultL( const TDesC& aNewUri, const TDesC& aOldUri )
- {
- TN_DEBUG3( "CThumbnailFetchedChecker::RenameFetchResult(aNewUri=%S aOldUri=%S)", &aNewUri, &aOldUri);
- OstTraceExt2( TRACE_NORMAL, CTHUMBNAILFETCHEDCHECKER_RENAMEFETCHRESULTL, "CThumbnailFetchedChecker::RenameFetchResultL;aNewUri=%S;aOldUri=%S", aNewUri, aOldUri );
- // change every occurence of passed uri
- TInt ret;
- do
- {
- ret = iNotFetched.FindInOrder( aOldUri, CEntry::FindCBUri );
- if ( ret >= 0 )
- {
- delete iNotFetched[ ret ]->iUri;
- iNotFetched[ ret ]->iUri = NULL;
-
- iNotFetched[ ret ]->iUri = aNewUri.AllocL();
- TN_DEBUG1( "CThumbnailFetchedChecker::RenameeFetchResult() -> Renamed URI in fetched list" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILFETCHEDCHECKER_RENAMEFETCHRESULTL, "CThumbnailFetchedChecker::RenameFetchResultL - Renamed URI in fetched list" );
- }
- }
- while(ret != KErrNotFound );
-
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::Reset()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailFetchedChecker::Reset()
- {
- TN_DEBUG1( "CThumbnailFetchedChecker::Reset()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILFETCHEDCHECKER_RESET, "CThumbnailFetchedChecker::Reset" );
- iNotFetched.ResetAndDestroy();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CEntry::NewL()
-// -----------------------------------------------------------------------------
-//
-CThumbnailFetchedChecker::CEntry* CThumbnailFetchedChecker::CEntry::NewL(
- const TDesC& aUri, const TThumbnailSize aThumbnailSize, TInt aError )
- {
- TN_DEBUG4( "CThumbnailFetchedChecker::CEntry::NewL(aUri=%S aThumbnailSize=%d aError=%d)", &aUri, aThumbnailSize, aError);
- OstTraceExt3( TRACE_NORMAL, CENTRY_NEWL, "CEntry::NewL;aUri=%S;aThumbnailSize=%u;aError=%d", aUri, aThumbnailSize, aError );
- CEntry* self = new (ELeave) CEntry();
- if ( self )
- {
- self->iUri = aUri.AllocL();
- self->iSize = aThumbnailSize;
- self->iError = aError;
- if ( !self->iUri )
- {
- delete self;
- self = NULL;
- }
- }
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CEntry::FindCB()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailFetchedChecker::CEntry::FindCB(
- const CThumbnailFetchedChecker::CEntry& aEntry, const CThumbnailFetchedChecker::CEntry& aEntry1 )
- {
- TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::FindCB");
- OstTrace0( TRACE_NORMAL, CENTRY_FINDCB, "CEntry::FindCB" );
- if( aEntry1.iSize == aEntry.iSize)
- {
- // return index if size and uri matches
- return aEntry.iUri->CompareF( *( aEntry1.iUri ) );
- }
- else
- {
- return KErrNotFound;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CEntry::FindCBUri()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailFetchedChecker::CEntry::FindCBUri(
- const TDesC* aUri, const CThumbnailFetchedChecker::CEntry& aEntry )
- {
- TN_DEBUG2( "CThumbnailFetchedChecker::CEntry::FindCBUri(aUri=%S", &aUri);
- OstTrace0( TRACE_NORMAL, CENTRY_FINDCBURI, "CEntry::FindCBUri" );
- return aUri->CompareF( *( aEntry.iUri ) );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CEntry::InsertCB()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailFetchedChecker::CEntry::InsertCB(
- const CThumbnailFetchedChecker::CEntry& aEntry1,
- const CThumbnailFetchedChecker::CEntry& aEntry2 )
- {
- TN_DEBUG1( "CThumbnailFetchedChecker::CEntry::InsertCB");
- OstTrace0( TRACE_NORMAL, CENTRY_INSERTCB, "CEntry::InsertCB" );
- if( aEntry1.iSize == aEntry2.iSize)
- {
- // return index if size and uri matches
- return aEntry1.iUri->CompareF( *( aEntry2.iUri ) );
- }
- else
- {
- return KErrNotFound;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CEntry::CEntry()
-// -----------------------------------------------------------------------------
-//
-CThumbnailFetchedChecker::CEntry::CEntry()
- {
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailFetchedChecker::CEntry::~CEntry()
-// -----------------------------------------------------------------------------
-//
-CThumbnailFetchedChecker::CEntry::~CEntry()
- {
- delete iUri;
- iUri = NULL;
- }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailgeneratetask.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,601 +0,0 @@
-/*
-* 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: Task for generating new thumbnails
- *
-*/
-
-
-#include <e32base.h>
-#include <fbs.h>
-
-#include <thumbnailmanager.h>
-#include "thumbnailgeneratetask.h"
-#include "thumbnailscaletask.h"
-#include "thumbnailprovider.h"
-#include "thumbnailserver.h"
-#include "thumbnailtaskprocessor.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-#include "thumbnailfetchedchecker.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailgeneratetaskTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailGenerateTask::CThumbnailGenerateTask()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailGenerateTask::CThumbnailGenerateTask( CThumbnailTaskProcessor&
- aProcessor, CThumbnailServer& aServer, RFile64* aFile, TDesC8* aBuffer,
- const TDataType* aMimeType, CThumbnailManager::TThumbnailFlags aFlags,
- const TSize& aSize, TDisplayMode aDisplayMode, TInt aPriority,
- RArray < TThumbnailPersistentSize >* aMissingSizes, const TDesC& aTargetUri,
- TThumbnailSize aThumbnailSize, const TInt64 aModified,
- const CThumbnailManager::TThumbnailQualityPreference aQualityPreference,
- TBool aVirtualUri ):
- CThumbnailTask( aProcessor, aPriority ), iServer( aServer ),
- iFlags( aFlags ), iSize( aSize ), iDisplayMode( aDisplayMode ),
- iMissingSizes( aMissingSizes ), iTargetUri( aTargetUri ),
- iThumbnailSize( aThumbnailSize ), iModified(aModified),
- iQualityPreference( aQualityPreference ), iVirtualUri( aVirtualUri )
- {
- TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CThumbnailGenerateTask()", this);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_CTHUMBNAILGENERATETASK, "CThumbnailGenerateTask::CThumbnailGenerateTask;this=%o", this );
-
- if ( !aBuffer && aFile)
- {
- iFile = *aFile;
- iFile.FullName( iFilename );
- }
- else if( aBuffer )
- {
- iBuffer = aBuffer;
- }
- if ( aMimeType )
- {
- iMimeType = *aMimeType;
- }
- else
- {
- iMimeType = TDataType(KNullDesC8);
- }
-
- // scaled bitmaps to pool by default
- iScaledBitmapToPool = ETrue;
- iBitmapHandle = 0;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailGenerateTask::~CThumbnailGenerateTask()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailGenerateTask::~CThumbnailGenerateTask()
- {
- TN_DEBUG2("CThumbnailGenerateTask(0x%08x)::~CThumbnailGenerateTask()", this);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_CTHUMBNAILGENERATETASK, "CThumbnailGenerateTask::~CThumbnailGenerateTask;this=%o", this );
-
- if ( iProvider )
- {
- iProvider->CancelGetThumbnail();
- }
-
- if ( iMissingSizes )
- {
- iMissingSizes->Reset();
- delete iMissingSizes;
- iMissingSizes = NULL;
- }
-
- if ( iBitmapHandle )
- {
- iServer.DeleteBitmapFromPool( iBitmapHandle );
- iBitmapHandle = 0;
- }
-
- iProvider = NULL;
- delete iBuffer;
- iBuffer = NULL;
-
- iFile.Close();
- TN_DEBUG1("CThumbnailGenerateTask::~CThumbnailGenerateTask() - file handle closed");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_CTHUMBNAILGENERATETASK, "CThumbnailGenerateTask::~CThumbnailGenerateTask - file handle closed" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailGenerateTask::StartL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::StartL()
- {
- TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::StartL()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_STARTL, "CThumbnailGenerateTask::StartL;this=%o", this );
-
- CThumbnailTask::StartL();
-
-#ifdef _DEBUG
- aStart.UniversalTime();
-#endif
-
- TBuf8< KMaxDataTypeLength > mimeType;
-
- if ( (!iVirtualUri && iFilename.Right(KExtLength).CompareF(KNonEmbeddedArtExt) == 0) ||
- (iVirtualUri && iTargetUri.Right(KExtLength).CompareF(KContactExt) == 0) ) // tparse panics with virtual URI
- {
- mimeType.Copy( KImageMime );
- }
- else
- {
- mimeType = iMimeType.Des8();
- }
- iProvider = iServer.ResolveProviderL(mimeType);
-
- TN_DEBUG3( "CThumbnailGenerateTask(0x%08x) -- provider UID 0x%08x", this, iProvider->Uid());
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_STARTL, "CThumbnailGenerateTask::StartL;this=%o", this );
-
- __ASSERT_DEBUG(( iProvider ), ThumbnailPanic( EThumbnailNullPointer ));
-
- iProvider->CancelGetThumbnail();
- iProvider->Reset();
- iProvider->SetObserver( *this );
-
- TSize effectiveTargetSize;
- TSize croppedTargetSize;
-
- CalculateTargetSizesL( effectiveTargetSize, croppedTargetSize );
-
- iProvider->SetTargetSize( effectiveTargetSize );
-
- if(effectiveTargetSize == TSize())
- {
- iProvider->SetTargetSize( croppedTargetSize );
- }
-
- TInt providerErr;
-
- if ( !iBuffer )
- {
- TRAP(providerErr, iProvider->GetThumbnailL( iServer.Fs(), iFile, iMimeType, iFlags,
- iDisplayMode, iQualityPreference ) );
- }
- else
- {
- TRAP( providerErr, iProvider->GetThumbnailL( iServer.Fs(), iBuffer, iMimeType, iFlags,
- iDisplayMode, iQualityPreference ));
- }
-
- DoBlacklisting( providerErr, TSize(0,0) );
-
- User::LeaveIfError( providerErr );
-
- TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::StartL() end", this );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_STARTL, "CThumbnailGenerateTask::StartL -end;this=%o", this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailGenerateTask::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::RunL()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailGenerateTask::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::DoCancel()
- {
- TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::DoCancel()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_DOCANCEL, "CThumbnailGenerateTask::DoCancel;this=%o", this );
-
- if ( iProvider )
- {
- iProvider->CancelGetThumbnail();
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// Calculate the largest non-cropped size and largest cropped size and
-// let the provider plug-in know the values
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::CalculateTargetSizesL( TSize& aEffectiveTargetSize,
- TSize& aCroppedTargetSize )
- {
- if ( iThumbnailSize == ECustomThumbnailSize )
- {
- if ( iFlags& CThumbnailManager::ECropToAspectRatio )
- {
- aCroppedTargetSize = iSize;
- }
- else
- {
- aEffectiveTargetSize = iSize;
- }
- }
-
- if ( iThumbnailSize != ECustomThumbnailSize )
- {
- RArray < TThumbnailPersistentSize > sizes = iServer.PersistentSizesL();
- const TInt count = sizes.Count();
- for ( TInt i = 0; i < count; i++ )
- {
- TThumbnailPersistentSize size( sizes[i] );
-
- iSize = size.iSize;
- if ( size.iCrop )
- {
- aCroppedTargetSize.iWidth = Max( aCroppedTargetSize.iWidth,
- size.iSize.iWidth );
- aCroppedTargetSize.iHeight = Max( aCroppedTargetSize.iHeight,
- size.iSize.iHeight );
-
- if(iBuffer)
- {
- iFlags = ( CThumbnailManager::TThumbnailFlags ) (iFlags | CThumbnailManager::ECropToAspectRatio);
- aEffectiveTargetSize = aCroppedTargetSize;
- }
- }
- else
- {
- aEffectiveTargetSize.iWidth = Max( aEffectiveTargetSize.iWidth,
- size.iSize.iWidth );
- aEffectiveTargetSize.iHeight = Max( aEffectiveTargetSize.iHeight,
- size.iSize.iHeight );
- }
-
- if(size.iType == iThumbnailSize)
- {
- break;
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Thumbnail provider observer callback to notify the server when
-// thumbnail has been generated.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::ThumbnailProviderReady( const TInt aError,
- CFbsBitmap* aBitmap, const TSize& aOriginalSize, const TBool aEXIF, const TBool aPortrait )
- {
- TN_DEBUG4(
- "CThumbnailGenerateTask(0x%08x)::ThumbnailProviderReady(aError=%d, aBitmap=0x%08x)", this, aError, aBitmap );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;aError=%d", aError );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;aBitmap=%o", aBitmap );
-
- #ifdef _DEBUG
- aStop.UniversalTime();
- TN_DEBUG2( "CThumbnailGenerateTask::ThumbnailProviderReady() generate took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
- #endif
-
- iPortrait = aPortrait;
- iEXIF = aEXIF;
- iOriginalSize = aOriginalSize;
-
- if ( aError )
- {
- delete aBitmap;
- aBitmap = NULL;
-
- DoBlacklisting( aError, aOriginalSize );
-
- Complete( aError );
- }
- else
- {
- // CreateScaleTasksL will take ownership of bitmap
-
-#ifdef _DEBUG
- TN_DEBUG2( "CThumbnailGenerateTask::ThumbnailProviderReady() - displaymode is %d", aBitmap->DisplayMode());
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILGENERATETASK_THUMBNAILPROVIDERREADY, "CThumbnailGenerateTask::ThumbnailProviderReady;aBitmap->DisplayMode()=%u", aBitmap->DisplayMode() );
-#endif
-
- TRAPD( err, CreateScaleTasksL( aBitmap ));
- aBitmap = NULL;
- // If CreateScaleTasksL left, we are responsible for completing
- // the RMessage. If there was no leave, then this call will not
- // complete actual the message, just the mark the task as completed.
- Complete( err );
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// Create tasks to scale the thumbnail to each persistent thumbnail size
-// and also to the size the client requested
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::CreateScaleTasksL( CFbsBitmap* aBitmap )
- {
- __ASSERT_DEBUG(( aBitmap ), ThumbnailPanic( EThumbnailNullPointer ));
-
- CleanupStack::PushL( aBitmap );
- iServer.AddBitmapToPoolL( iRequestId.iSession, aBitmap, iRequestId );
-
- // Keep handle so we can delete bitmap from pool
- iBitmapHandle = aBitmap->Handle();
- CleanupStack::Pop( aBitmap );
-
- // compTask is the scale task which returns the bitmap to the client
- CThumbnailScaleTask* complTask = NULL;
-
- TInt err1 = KErrNone;
- TInt err2 = KErrNone;
- TBool isPublic = ETrue;
- TBool isPublic2 = ETrue;
-
- if(iFilename != KNullDesC)
- {
- TRAP(err1, iServer.StoreForPathL(iFilename));
-
- isPublic = iServer.IsPublicPath( iFilename );
- }
- if(iTargetUri != KNullDesC )
- {
- TRAP(err2, iServer.StoreForPathL(iTargetUri));
-
- isPublic2 = iServer.IsPublicPath( iTargetUri );
- }
-
- // check if need to create more than one scale task
- if ( iMissingSizes )
- {
- const TInt count = iMissingSizes->Count();
-
- // scale small thumbs first, because fullscreen encoding takes longer
- for ( TInt i( count-1 ); i >= 0; i-- )
- {
- TThumbnailSize size = (*iMissingSizes)[ i ].iType;
-#ifdef _DEBUG
- TN_DEBUG3( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() *iMissingSizes)[ i ].iType == %d", this, size );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;size=%d", size );
-#endif
-
- if ( iPortrait )
- {
- if ( size == EFullScreenThumbnailSize ||
- size == EVideoFullScreenThumbnailSize ||
- size == EAudioFullScreenThumbnailSize ||
- size == EImageFullScreenThumbnailSize ||
- size == EContactFullScreenThumbnailSize )
- {
- TInt mis_width = (*iMissingSizes)[ i ].iSize.iWidth;
- TN_DEBUG2( "*iMissingSizes)[ i ].iWidth == %d", (*iMissingSizes)[ i ].iSize.iWidth );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;width=%d", mis_width );
-
- TInt mis_height = (*iMissingSizes)[ i ].iSize.iHeight;
- TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight );
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;mis_height=%d", mis_height );
- TInt width = (*iMissingSizes)[ i ].iSize.iWidth;
- (*iMissingSizes)[ i ].iSize.iWidth = (*iMissingSizes)[ i ].iSize.iHeight;
- (*iMissingSizes)[ i ].iSize.iHeight = width;
- TN_DEBUG2( "*iMissingSizes)[ i ].iWidth == %d", (*iMissingSizes)[ i ].iSize.iWidth );
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;width=%d", width );
- mis_height = (*iMissingSizes)[ i ].iSize.iHeight;
- TN_DEBUG2( "*iMissingSizes)[ i ].iHeight == %d", (*iMissingSizes)[ i ].iSize.iHeight );
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL;mis_height=%d", mis_height );
- }
- }
-
- CThumbnailScaleTask* complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
- aBitmap, iOriginalSize, (*iMissingSizes)[ i ].iSize, (*iMissingSizes)[ i ].iCrop, iDisplayMode,
- KMaxPriority, iTargetUri, (*iMissingSizes)[ i ].iType, iModified, iScaledBitmapToPool, iEXIF,
- iRequestId, iVirtualUri);
- CleanupStack::PushL( complTask );
-
- // if trying to access Z drive, don't try to store
- // don't want to store custom sizes
- // don't store if from private directory
- if( !isPublic || !isPublic2 ||
- err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
- (*iMissingSizes)[ i ].iType == ECustomThumbnailSize ||
- (*iMissingSizes)[ i ].iType == EUnknownThumbnailSize )
- {
- complTask->SetDoStore( EFalse );
- TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this );
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL - do not store;this=%o", this );
- }
- else
- {
- complTask->SetDoStore( ETrue );
- }
-
- iProcessor.AddTaskL( complTask );
- CleanupStack::Pop( complTask );
-
- // completion to first task, because task processor works like stack
- if( i == 0 )
- {
- // compTask is now responsible for completing the RMessage
- complTask->SetMessageData( iRequestId, iMessage, iClientThread );
- ResetMessageData();
- }
- }
- }
- else
- {
- if( iPortrait )
- {
- if ( iThumbnailSize == EFullScreenThumbnailSize ||
- iThumbnailSize == EVideoFullScreenThumbnailSize ||
- iThumbnailSize == EAudioFullScreenThumbnailSize ||
- iThumbnailSize == EImageFullScreenThumbnailSize ||
- iThumbnailSize == EContactFullScreenThumbnailSize)
- {
- TInt width = iSize.iWidth;
- iSize.iWidth = iSize.iHeight;
- iSize.iHeight = width;
- }
- }
-
- complTask = CThumbnailScaleTask::NewL( iProcessor, iServer, iFilename,
- aBitmap, iOriginalSize, iSize, iFlags& CThumbnailManager
- ::ECropToAspectRatio, iDisplayMode, KMaxPriority, iTargetUri,
- iThumbnailSize, iModified, iScaledBitmapToPool, iEXIF, iRequestId,
- iVirtualUri);
- CleanupStack::PushL( complTask );
-
- // if trying to access Z drive, don't try to store
- // don't want to store custom sizes
- if( !isPublic || !isPublic2 ||
- err1 == KErrAccessDenied || err2 == KErrAccessDenied ||
- iThumbnailSize == ECustomThumbnailSize ||
- iThumbnailSize == EUnknownThumbnailSize )
- {
- complTask->SetDoStore( EFalse );
- TN_DEBUG2( "CThumbnailGenerateTask(0x%08x)::CreateScaleTasksL() - do not store", this );
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILGENERATETASK_CREATESCALETASKSL, "CThumbnailGenerateTask::CreateScaleTasksL - do not store;this=%o", this );
- }
- else
- {
- complTask->SetDoStore( ETrue );
- }
-
- iProcessor.AddTaskL( complTask );
- CleanupStack::Pop( complTask );
-
- // compTask is now responsible for completing the RMessage and
- // returning the bitmap to the client
- complTask->SetMessageData( iRequestId, iMessage, iClientThread );
- ResetMessageData();
- }
-
- // Scale tasks now reference the bitmap in the pool
- iServer.DeleteBitmapFromPool( iBitmapHandle );
- iBitmapHandle = 0;
- aBitmap = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// Defines if scaled bitmaps need to be added to pool
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::ScaledBitmapToPool( TBool aBool )
- {
- iScaledBitmapToPool = aBool;
- }
-
-// ---------------------------------------------------------------------------
-// Stores a blacklisted thumbnail
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::CreateBlackListedL( const TSize& aOriginalSize )
- {
- TN_DEBUG1( "CThumbnailGenerateTask::CreateBlackListedL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILGENERATETASK_CREATEBLACKLISTEDL, "CThumbnailGenerateTask::CreateBlackListedL" );
- CFbsBitmap* tempBitmap = 0;
- tempBitmap = new (ELeave) CFbsBitmap();
- CleanupStack::PushL( tempBitmap );
- TSize tempSize( 1, 1 );
- User::LeaveIfError( tempBitmap->Create( tempSize, iDisplayMode ) );
-
- // Instead of creating a blacklisted entry of requested size (iThumbnailSize) in thumbnail db,
- // consider blacklisting all sizes (hence the changes are needed in thumbnail fetching logic too).
- // However, decoding of source to thumnail could succeed in other sizes, which makes blacklisting
- // of requested size only meaningful.
-
- if(iFilename != KNullDesC)
- {
- iServer.StoreForPathL( iFilename )->StoreThumbnailL(
- iFilename, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue );
- //remove result from fetched checker
- iServer.FetchedChecker().SetFetchResult( iFilename, iThumbnailSize, KErrNone );
- }
- else if(iTargetUri != KNullDesC)
- {
- iServer.StoreForPathL( iTargetUri )->StoreThumbnailL(
- iTargetUri, tempBitmap, aOriginalSize, EFalse, iThumbnailSize, iModified, !iVirtualUri, ETrue );
- //remove result from fetched checker
- iServer.FetchedChecker().SetFetchResult( iTargetUri, iThumbnailSize, KErrNone );
- }
-
- CleanupStack::PopAndDestroy( tempBitmap );
- }
-
-// ---------------------------------------------------------------------------
-// Checks is blacklisting needed
-// ---------------------------------------------------------------------------
-//
-void CThumbnailGenerateTask::DoBlacklisting( const TInt aError, const TSize& aOriginalSize )
- {
- TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting" );
- // Create a temporary bitmap of size 1 for storing blacklisted thumbnail
- // Because no actual bitmap data is generated, there is no reason to
- // add bitmap to server bitmap pool. Completion of client request with
- // error code just results in applications showing their default bitmap.
- if( aError != KErrNone && (iFilename != KNullDesC || iTargetUri != KNullDesC ))
- {
- if (aError == KErrNotFound ||
- aError == KErrNotSupported ||
- aError == KErrCorrupt ||
- aError == KErrCompletion ||
- aError == KErrUnderflow ||
- aError == KErrNotReady ||
- aError == KErrGeneral )
- {
-
- if(iMissingSizes)
- {
- TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklist missing sizes count = %d", iMissingSizes->Count() );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - blacklist missing sizes count;iMissingSizes->Count()=%d", iMissingSizes->Count() );
-
- for ( TInt i( 0 ); i < iMissingSizes->Count(); i++ )
- {
- iThumbnailSize = (*iMissingSizes)[ i ].iType;
- TRAPD( err, CreateBlackListedL( aOriginalSize ) );
- if (err != KErrNone)
- {
- TN_DEBUG3( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting missing size %d failed with code %d", iThumbnailSize, err );
- OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - - blacklisting missing size failed with error;iThumbnailSize=%u;err=%d", iThumbnailSize, err );
- }
- }
- return;
- }
- else
- {
- TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - blacklist single size" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - blacklist single size" );
- TRAPD( err, CreateBlackListedL( aOriginalSize ) );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbnailGenerateTask::DoBlacklisting() - blacklisting failed with code %d", err );
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - blacklisting failed with code;err=%d", err );
- }
- return;
- }
- }
- TN_DEBUG1( "CThumbnailGenerateTask::DoBlacklisting() - not blacklisted " );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILGENERATETASK_DOBLACKLISTING, "CThumbnailGenerateTask::DoBlacklisting - not blacklisted" );
- }
-}
-
-
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-/*
-* 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: Task for making MDS querys
-*
-*/
-
-
-#include <e32base.h>
-
-#include <mdeconstants.h>
-#include <thumbnailmanager.h>
-
-#include "thumbnailmdsquerytask.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "thumbnailserver.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailmdsquerytaskTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::CThumbnailMDSQueryTask()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailMDSQueryTask::CThumbnailMDSQueryTask(
- CThumbnailTaskProcessor& aProcessor, TInt aPriority, CMdESession* aMdESession, CThumbnailServer& aServer):
- CThumbnailTask( aProcessor, aPriority ), iMdESession( aMdESession ), iQuery(NULL),
- iServer(aServer), iUpdateToDb(ETrue)
- {
- TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::CThumbnailMDSQueryTask()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_CTHUMBNAILMDSQUERYTASK, "CThumbnailMDSQueryTask::CThumbnailMDSQueryTask;this=%o", this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask()
- {
- TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::~CThumbnailMDSQueryTask()", this);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMDSQUERYTASK_CTHUMBNAILMDSQUERYTASK, "CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask;this=%o", this );
-
- if (iQuery)
- {
- iQuery->Cancel();
- delete iQuery;
- iQuery = NULL;
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::HandleQueryNewResults()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::HandleQueryNewResults( CMdEQuery& /*aQuery*/,
- const TInt /*aFirstNewItemIndex*/,
- const TInt /*aNewItemCount*/ )
- {
- // No implementation required
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::HandleQueryCompleted()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::HandleQueryCompleted( CMdEQuery& /*aQuery*/, const TInt aError )
- {
- TN_DEBUG3( "CThumbnailMDSQueryTask::HandleQueryCompleted(0x%08x), aError == %d", this, aError );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted;aError=%d", aError );
-
-
- // if no errors in query
- if (aError == KErrNone && iQuery && iQuery->Count() > 0)
- {
- if( iQueryType == EURI )
- {
- const CMdEObject* object = &iQuery->Result(0);
-
- TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() - URI = %S", &object->Uri() );
- OstTraceExt1( TRACE_NORMAL, DUP2_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted;object->Uri()=%S", object->Uri() );
-
- // return path to client side
- if( iDelete )
- {
- TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() delete %S", &iUri );
- OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted - delete;iUri()=%S", iUri );
- TRAP_IGNORE( iServer.DeleteThumbnailsL( iUri ) );
- }
- else
- {
- ReturnPath(object->Uri());
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - Don't ever come here!" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted - Don't ever come here!" );
- if (ClientThreadAlive())
- {
- Complete( KErrNotFound );
- ResetMessageData();
- }
- __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbnailMDSQueryTask::HandleQueryCompleted()"), KErrNotSupported));
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - No results." );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted - No results." );
- if(!iDelete)
- {
- if (ClientThreadAlive())
- {
- Complete( KErrNotFound );
- ResetMessageData();
- }
- }
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::StartL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::StartL()
- {
- TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::StartL()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_STARTL, "CThumbnailMDSQueryTask::StartL;this=%o", this );
-
- CThumbnailTask::StartL();
-
- if (iMessage.Handle())
- {
- // start query
- iQuery->FindL();
- }
- else
- {
- // no point to continue
- Complete( KErrCancel );
- ResetMessageData();
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::RunL()
- {
- // No implementation required
- TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::RunL()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_RUNL, "CThumbnailMDSQueryTask::RunL;this=%o", this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::DoCancel()
- {
- TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::DoCancel()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_DOCANCEL, "CThumbnailMDSQueryTask::DoCancel;this=%o", this );
-
- iQuery->Cancel();
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::QueryPathByIdL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::QueryPathByIdL(TThumbnailId aId, TBool aDelete)
- {
- TN_DEBUG1( "CThumbnailMDSQueryTask()::QueryPathByIdL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_QUERYPATHBYIDL, "CThumbnailMDSQueryTask::QueryPathByIdL" );
- iQueryType = EURI;
- iDelete = aDelete;
- CMdENamespaceDef* defNamespace = &iMdESession->GetDefaultNamespaceDefL();
- CMdEObjectDef& objDef = defNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
-
- delete iQuery;
- iQuery = NULL;
-
- iQuery = iMdESession->NewObjectQueryL( *defNamespace, objDef, this );
-
- if(iQuery)
- {
- iQuery->SetResultMode( EQueryResultModeItem );
-
- CMdELogicCondition& rootCondition = iQuery->Conditions();
- rootCondition.SetOperator( ELogicConditionOperatorOr );
-
- // add ID condition
- rootCondition.AddObjectConditionL( aId );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::ReturnPath()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::ReturnPath(const TDesC& aUri)
- {
- if ( ClientThreadAlive() )
- {
- // add path to message
- TInt ret = iMessage.Read( 0, iRequestParams );
- if(ret == KErrNone)
- {
- TThumbnailRequestParams& params = iRequestParams();
- params.iFileName = aUri;
- ret = iMessage.Write( 0, iRequestParams );
- }
-
- // complete the message with a code from which client side
- // knows to make a new request using the path
- Complete( KThumbnailErrThumbnailNotFound );
- ResetMessageData();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::SetUpdateToDb()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::SetUpdateToDb(const TBool& aUpdateToDb )
- {
- TN_DEBUG2( "CThumbnailMDSQueryTask()::SetCompleteTask() aUpdateToDb == %d", aUpdateToDb);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_SETUPDATETODB, "CThumbnailMDSQueryTask::SetUpdateToDb;aUpdateToDb=%u", aUpdateToDb );
- iUpdateToDb = aUpdateToDb;
- }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmemorycardobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Class to monitor when memory card status is changed
- *
-*/
-
-
-#include "thumbnailmemorycardobserver.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailmemorycardobserverTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailMemoryCardObserver::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailMemoryCardObserver* CThumbnailMemoryCardObserver::NewL( CThumbnailServer* aServer, RFs& aFs )
- {
- CThumbnailMemoryCardObserver* self = new( ELeave )
- CThumbnailMemoryCardObserver( aServer, aFs );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailMemoryCardObserver::CThumbnailMemoryCardObserver()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailMemoryCardObserver::CThumbnailMemoryCardObserver( CThumbnailServer* aServer, RFs& aFs ):
- CActive( CActive::EPriorityStandard ), iServer( aServer ), iFs( aFs )
- {
- TN_DEBUG1( "CThumbnailMemoryCardObserver::CThumbnailMemoryCardObserver()"
- );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILMEMORYCARDOBSERVER_CTHUMBNAILMEMORYCARDOBSERVER, "CThumbnailMemoryCardObserver::CThumbnailMemoryCardObserver" );
- CActiveScheduler::Add( this );
- StartNotify();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailMemoryCardObserver::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMemoryCardObserver::ConstructL()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::~CThumbnailTaskProcessor()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailMemoryCardObserver::~CThumbnailMemoryCardObserver()
- {
- TN_DEBUG1(
- "CThumbnailMemoryCardObserver::~CThumbnailMemoryCardObserver()" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILMEMORYCARDOBSERVER_CTHUMBNAILMEMORYCARDOBSERVER, "CThumbnailMemoryCardObserver::~CThumbnailMemoryCardObserver" );
- Cancel();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailMemoryCardObserver::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMemoryCardObserver::RunL()
- {
- TN_DEBUG2( "CThumbnailMemoryCardObserver::RunL() iStatus = %d", iStatus.Int());
- OstTrace1( TRACE_NORMAL, CTHUMBNAILMEMORYCARDOBSERVER_RUNL, "CThumbnailMemoryCardObserver::RunL;iStatus.Int()=%d", iStatus.Int() );
- if ( !iStatus.Int() )
- {
- // trap because nothing could be done in RunError
- TRAP_IGNORE( iServer->MemoryCardStatusChangedL() );
- StartNotify();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailMemoryCardObserver::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMemoryCardObserver::DoCancel()
- {
- iFs.NotifyChangeCancel();
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailMemoryCardObserver::StartNotify()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMemoryCardObserver::StartNotify()
- {
- TN_DEBUG1( "CThumbnailMemoryCardObserver::StartNotify()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILMEMORYCARDOBSERVER_STARTNOTIFY, "CThumbnailMemoryCardObserver::StartNotify" );
-
- if (IsActive())
- {
- Cancel();
- }
-
- iFs.NotifyChange(ENotifyDisk, iStatus);
- SetActive();
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailprovider.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
-* 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 thumbnail provider plug-ins
- *
-*/
-
-
-#include "thumbnailprovider.h"
-#include "thumbnaillog.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// Construct new CThumbnailProvider implementation instance via ECom
-// ---------------------------------------------------------------------------
-//
-CThumbnailProvider* CThumbnailProvider::NewL( TUid aUid )
- {
- TAny* interface = REComSession::CreateImplementationL( aUid, _FOFF(
- CThumbnailProvider, iDtor_ID_Key ));
- CThumbnailProvider* ret = reinterpret_cast < CThumbnailProvider* > (
- interface );
- ret->iUid = aUid;
- return ret;
- }
-
-
-// ---------------------------------------------------------------------------
-// Get the UID of the provider
-// ---------------------------------------------------------------------------
-//
-TUid CThumbnailProvider::Uid()
- {
- return iUid;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailProvider::SetObserver()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailProvider::SetObserver( MThumbnailProviderObserver& aObserver )
- {
- iObserver = &aObserver;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailProvider::Reset()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailProvider::Reset()
- {
- iTargetSize = TSize();
- iCroppedTargetSize = TSize();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailProvider::SetTargetSize()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailProvider::SetTargetSize( const TSize& aSize )
- {
- iTargetSize = aSize;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailProvider::SetCroppedTargetSize()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailProvider::SetCroppedTargetSize( const TSize& aCroppedSize )
- {
- iCroppedTargetSize = aCroppedSize;
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailscaletask.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*
-* 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: Task for scaling thumbnails.
- *
-*/
-
-
-#include <e32base.h>
-#include <fbs.h>
-#include <e32math.h>
-#include <bitdev.h>
-#include <bitstd.h>
-
-#include "thumbnailscaletask.h"
-#include "thumbnailprovider.h"
-#include "thumbnailserver.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailscaletaskTraces.h"
-#endif
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailScaleTask* CThumbnailScaleTask::NewL( CThumbnailTaskProcessor&
- aProcessor, CThumbnailServer& aServer, const TDesC& aFilename, CFbsBitmap*
- aBitmap, const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
- TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
- const TThumbnailSize aThumbnailSize, const TInt64 aModified,
- TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
- const TBool aImportVirtual)
- {
- // We take ownership of aBitmap
- CleanupStack::PushL( aBitmap );
- CThumbnailScaleTask* self = new( ELeave )CThumbnailScaleTask( aProcessor,
- aServer, aFilename, aBitmap, aOriginalSize, aTargetSize, aCrop,
- aDisplayMode, aPriority, aTargetUri, aThumbnailSize, aModified,
- aBitmapToPool, aEXIF, aRequestId, aImportVirtual);
- CleanupStack::Pop( aBitmap );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::CThumbnailScaleTask()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailScaleTask::CThumbnailScaleTask( CThumbnailTaskProcessor& aProcessor,
- CThumbnailServer& aServer, const TDesC& aFilename, CFbsBitmap* aBitmap,
- const TSize& aOriginalSize, const TSize& aTargetSize, TBool aCrop,
- TDisplayMode aDisplayMode, TInt aPriority, const TDesC& aTargetUri,
- const TThumbnailSize aThumbnailSize, const TInt64 aModified,
- TBool aBitmapToPool, const TBool aEXIF, const TThumbnailServerRequestId aRequestId,
- const TBool aVirtualUri):
- CThumbnailTask( aProcessor, aPriority ), iServer( aServer ), iOwnBitmap( aBitmap ),
- iOriginalSize( aOriginalSize ), iTargetSize(aTargetSize), iTargetSizeTN( aTargetSize ), iCrop( aCrop ),
- iDisplayMode( aDisplayMode ), iFilename( aFilename ), iTargetUri( aTargetUri ),
- iThumbnailSize(aThumbnailSize), iModified(aModified),
- iBitmapToPool(aBitmapToPool), iEXIF(aEXIF), iVirtualUri( aVirtualUri )
- {
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::CThumbnailScaleTask()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_CTHUMBNAILSCALETASK, "CThumbnailScaleTask::CThumbnailScaleTask;this=%o", this );
-
- iRequestId = aRequestId;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::ConstructL()
- {
- iServer.AddBitmapToPoolL( iRequestId.iSession, iOwnBitmap, iRequestId );
-
- // Successfully added bitmap to pool, we are no longer responsible for
- // deleting it directly.
- iBitmap = iOwnBitmap;
- iOwnBitmap = NULL;
- iBitmapInPool = ETrue;
-
- iScaledBitmap = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::~CThumbnailScaleTask()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailScaleTask::~CThumbnailScaleTask()
- {
- iServer.CancelScale();
-
- if ( iBitmapInPool && iBitmap )
- {
- TN_DEBUG1("CThumbnailScaleTask()::~CThumbnailScaleTask() delete original bitmap from pool");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_CTHUMBNAILSCALETASK, "CThumbnailScaleTask::~CThumbnailScaleTask - delete original bitmap from pool" );
-
- // Original bitmap is owned by server, decrease reference count
- iServer.DeleteBitmapFromPool( iBitmap->Handle());
- }
-
- // Scaled bitmap is owned by us, delete now
- delete iScaledBitmap;
- iScaledBitmap = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::StartL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::StartL()
- {
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL;this=%o", this );
-
- CThumbnailTask::StartL();
-
- if ( !iCrop )
- {
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping OFF", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - cropping OFF;this=%o", this );
-
- // target size at max, keep aspect ratio
- CalculateTargetSize();
- }
- else
- {
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - cropping ON", this );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - cropping ON;this=%o", this );
-
- // exact target size, crop excess
- CalculateCropRectangle();
- }
-
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - sizes calculated", this );
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - sizes calculated;this=%o", this );
-
-#ifdef _DEBUG
- aStart.UniversalTime();
-#endif
-
- delete iScaledBitmap;
- iScaledBitmap = NULL;
- iScaledBitmap = new( ELeave )CFbsBitmap();
-
- TSize bitmapSize = iBitmap->SizeInPixels();
-
- if(bitmapSize.iHeight == iTargetSize.iHeight && bitmapSize.iWidth == iTargetSize.iWidth)
- {
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - no need for scaling", this);
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - no need for scaling;this=%o", this );
-
- // copy bitmap 1:1
- User::LeaveIfError( iScaledBitmap->Create( bitmapSize, iBitmap->DisplayMode() ));
- CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iScaledBitmap);
- CleanupStack::PushL(device);
- CFbsBitGc* gc = NULL;
- User::LeaveIfError(device->CreateContext(gc));
- CleanupStack::PushL(gc);
- gc->BitBlt(TPoint(0, 0), iBitmap);
- CleanupStack::PopAndDestroy(2, device); // gc
-
- TRAPD( err, StoreAndCompleteL());
- Complete( err );
- ResetMessageData();
- }
- else
- {
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() - scaling", this);
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - scaling;this=%o", this );
-
- User::LeaveIfError( iScaledBitmap->Create( iTargetSize, iBitmap->DisplayMode() ));
- iServer.ScaleBitmapL( iStatus, * iBitmap, * iScaledBitmap, iCropRectangle );
- SetActive();
- }
-
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::StartL() end", this );
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILSCALETASK_STARTL, "CThumbnailScaleTask::StartL - end;this=%o", this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::RunL()
- {
- TInt err = iStatus.Int();
-
- TN_DEBUG3( "CThumbnailScaleTask(0x%08x)::RunL() err=%d)", this, err );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_RUNL, "CThumbnailScaleTask::RunL;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_RUNL, "CThumbnailScaleTask::RunL;err=%d", err );
-
- #ifdef _DEBUG
- aStop.UniversalTime();
- TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailScaleTask::RunL() scale took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSCALETASK_RUNL, "CThumbnailScaleTask::RunL - scale took ms;tookTime=%d", tookTime );
- #endif
-
- if ( !err )
- {
- TRAP( err, StoreAndCompleteL());
- }
-
- Complete( err );
- ResetMessageData();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::DoCancel()
- {
- TN_DEBUG2( "CThumbnailScaleTask(0x%08x)::DoCancel()", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_DOCANCEL, "CThumbnailScaleTask::DoCancel;this=%o", this );
- iServer.CancelScale();
- }
-
-
-// ---------------------------------------------------------------------------
-// Calculates target size to be used for the thumbnail
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::CalculateTargetSize()
- {
- __ASSERT_DEBUG( iOriginalSize.iHeight && iTargetSize.iHeight,
- ThumbnailPanic( EThumbnailBadSize ));
-
- if ( (iThumbnailSize == EFullScreenThumbnailSize ||
- iThumbnailSize == EImageFullScreenThumbnailSize ||
- iThumbnailSize == EVideoFullScreenThumbnailSize ||
- iThumbnailSize == EAudioFullScreenThumbnailSize ||
- iThumbnailSize == EContactFullScreenThumbnailSize) &&
- iOriginalSize.iHeight < iTargetSize.iHeight &&
- iOriginalSize.iWidth < iTargetSize.iWidth )
- {
- // do not upscale fullscreen thumbs
- iTargetSize = iOriginalSize;
- }
- else if ( iOriginalSize.iHeight && iTargetSize.iHeight )
- {
- const TReal32 srcAspect = static_cast < TReal32 > (
- iOriginalSize.iWidth ) / iOriginalSize.iHeight;
-
- // scale to maximum size within target size
- if ( (iTargetSize.iHeight * srcAspect) <= iTargetSize.iWidth )
- {
- TReal trg = 0;
- TReal src( iTargetSize.iHeight * srcAspect );
- Math::Round( trg, src, 0 );
- iTargetSize.SetSize( trg, iTargetSize.iHeight );
- }
- else
- {
- TReal trg;
- TReal src( iTargetSize.iWidth / srcAspect );
- Math::Round( trg, src, 0 );
- iTargetSize.SetSize( iTargetSize.iWidth, trg );
- }
- }
- else
- {
- iTargetSize.SetSize( 0, 0 );
- }
- iCropRectangle.SetRect( TPoint(), iBitmap->SizeInPixels());
- }
-
-
-// ---------------------------------------------------------------------------
-// Calculates target size to be used for the thumbnail
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::CalculateCropRectangle()
- {
- const TSize srcSize = iBitmap->SizeInPixels();
-
- __ASSERT_DEBUG( srcSize.iHeight && iTargetSize.iHeight, ThumbnailPanic(
- EThumbnailBadSize ));
-
- if ( srcSize.iHeight && iTargetSize.iHeight )
- {
- const TReal32 srcAspect = static_cast < TReal32 > ( srcSize.iWidth ) /
- srcSize.iHeight;
- const TReal32 reqAspect = static_cast < TReal32 > ( iTargetSize.iWidth )
- / iTargetSize.iHeight;
-
- if ( (iTargetSize.iHeight * srcAspect) > iTargetSize.iWidth )
- {
- // Thumbnail is wider than requested and we crop
- // some of the right and left parts.
- TReal trg;
- TReal src( srcSize.iHeight* reqAspect );
- Math::Round( trg, src, 0 );
- const TSize cropSize( trg, srcSize.iHeight );
- iCropRectangle.iTl.SetXY(( srcSize.iWidth - cropSize.iWidth ) / 2, 0 );
- iCropRectangle.SetSize( cropSize );
- }
- else
- {
- // Thumbnail is taller than requested and we crop
- // some of the top and bottom parts.
- TReal trg;
- TReal src( srcSize.iWidth / reqAspect );
- Math::Round( trg, src, 0 );
- const TSize cropSize( srcSize.iWidth, trg );
- iCropRectangle.iTl.SetXY(0, ( srcSize.iHeight - cropSize.iHeight ) / 2 );
- iCropRectangle.SetSize( cropSize );
- }
-
- }
- else
- {
- iTargetSize.SetSize( 0, 0 );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::StoreAndCompleteL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::StoreAndCompleteL()
- {
- TN_DEBUG6( "CThumbnailScaleTask(0x%08x)::StoreAndCompleteL() iFilename=%S, iThumbnailSize=%d, iBitmap=0x%08x, iScaledBitmap=0x%08x)",
- this, &iFilename, iThumbnailSize, iBitmap, iScaledBitmap );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;this=%o", this );
- OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;iFilename=%S", iFilename );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;iBitmap=%o", iBitmap );
-
-
- // do not store TN if quality is too low eg. orignal size of image is smaller than requested size
- // (do not store upscaled images)
- if ( (iTargetSizeTN.iWidth > iOriginalSize.iWidth || iTargetSizeTN.iHeight > iOriginalSize.iHeight) && iEXIF)
- {
- TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() too low quality");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - too low quality" );
- iDoStore = EFalse;
- }
-
- TN_DEBUG3("CThumbnailScaleTask(0x%08x)::StoreAndCompleteL() iDoStore = %d", this, iDoStore);
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL;this=%o", this );
-
- if ( iDoStore )
- {
- if (iTargetUri != KNullDesC)
- {
- if (iFilename != KNullDesC && iFilename.CompareF(iTargetUri) == 0)
- {
- // filename and target URI match, so thumb created from associated path
- iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop,
- iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
- }
- else
- {
- // thumb not created from associated path
- iServer.StoreThumbnailL( iTargetUri, iScaledBitmap, iOriginalSize, iCrop,
- iThumbnailSize, iModified, !iVirtualUri, EFalse );
- }
- }
- else if (iFilename != KNullDesC)
- {
- iServer.StoreThumbnailL( iFilename, iScaledBitmap, iOriginalSize, iCrop,
- iThumbnailSize, iModified, !iVirtualUri, !iVirtualUri );
- }
- }
-
- if ( ClientThreadAlive() )
- {
- TThumbnailRequestParams& params = iParamsBuf();
- iMessage.ReadL( 0, iParamsBuf );
-
- // if need to add scaled bitmap to pool
- if (iBitmapToPool)
- {
- TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() scaled bitmap handle to params");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL" );
-
- params.iBitmapHandle = iScaledBitmap->Handle();
- }
-
- if( params.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview
- && iEXIF && !iDoStore)
- {
- TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() EThumbnailPreviewThumbnail");
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - EThumbnailPreviewThumbnail" );
-
- // this is upscaled preview image
- params.iControlFlags = EThumbnailPreviewThumbnail;
- }
-
- TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() write params to message");
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - write params to message" );
-
- // pass bitmap handle to client
- iMessage.WriteL( 0, iParamsBuf );
-
- if (iBitmapToPool)
- {
- TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() scaled bitmap to pool");
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - scaled bitmap to pool" );
-
- iServer.AddBitmapToPoolL( iRequestId.iSession, iScaledBitmap, iRequestId );
- iScaledBitmap = NULL; // Server owns the bitmap now
- }
- }
-
- TN_DEBUG1("CThumbnailScaleTask()::StoreAndCompleteL() - end");
- OstTrace0( TRACE_NORMAL, DUP9_CTHUMBNAILSCALETASK_STOREANDCOMPLETEL, "CThumbnailScaleTask::StoreAndCompleteL - end" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::StoreAndCompleteL()
-// Changes priority of the task.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::ChangeTaskPriority( TInt /*aNewPriority*/ )
- {
- // The priority of scale tasks is fixed. Do nothing.
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailScaleTask::SetDoStore()
-// Changes the store flag
-// ---------------------------------------------------------------------------
-//
-void CThumbnailScaleTask::SetDoStore( TBool aDoStore )
- {
- iDoStore = aDoStore;
- }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1914 +0,0 @@
-/*
-* 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: Thumbnail server
- *
-*/
-
-
-#include <e32svr.h>
-#include <MIHLScaler.h>
-#include <driveinfo.h>
-#include <caf/data.h>
-#include <Oma2Agent.h>
-#include <bautils.h>
-#include <mdesession.h>
-
-#include "thumbnailserver.h"
-#include "thumbnailtaskprocessor.h"
-#include "thumbnailserversession.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnaillog.h"
-#include "thumbnailstore.h"
-#include "thumbnaildiskunmountobserver.h"
-#include "thumbnailpanic.h"
-#include "thumbnailcenrep.h"
-#include "thumbnailmemorycardobserver.h"
-#include "tmgetimei.h"
-#include "thumbnailfetchedchecker.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailserverTraces.h"
-#endif
-
-
-
-_LIT8( KThumbnailMimeWildCard, "*" );
-_LIT8( KThumbnailMimeImage, "image" );
-_LIT8( KThumbnailMimeVideo, "video" );
-_LIT8( KThumbnailMimeAudio, "audio" );
-_LIT8( KThumbnailMimeContact, "contact" );
-
-const TChar KThumbnailMimeSeparatorChar = '/';
-const TChar KThumbnailMimeWildCardChar = '*';
-const TChar KThumbnailMimeTypeSeparatorChar = ' ';
-
-// ----------------------------------------------------------------------------------------
-// Server's policy here
-// ----------------------------------------------------------------------------------------
-
-// ----------------------------------------------------------------------------------------
-// Total number of ranges
-// ----------------------------------------------------------------------------------------
-const TUint KThumbnailServerRangeCount = 16;
-
-// ----------------------------------------------------------------------------------------
-// Definition of the ranges
-// ----------------------------------------------------------------------------------------
-const TInt KThumbnailServerRanges[KThumbnailServerRangeCount] =
-{
- ERequestThumbByPathAsync,
- ERequestThumbByFileHandleAsync,
- EReleaseBitmap,
- ECancelRequest,
- EChangePriority,
- EDeleteThumbnails,
- EGetMimeTypeBufferSize,
- EGetMimeTypeList,
- ERequestThumbByIdAsync,
- ERequestThumbByBufferAsync,
- ERequestSetThumbnailByBuffer,
- EDeleteThumbnailsById,
- ERenameThumbnails,
- EUpdateThumbnails,
- ERequestSetThumbnailByBitmap,
- EThumbnailServerRequestCount,
-};
-
-// ----------------------------------------------------------------------------------------
-// Policy to implement for each of the above ranges
-// ----------------------------------------------------------------------------------------
-const TUint8 KThumbnailServerElementsIndex[KThumbnailServerRangeCount] =
- {
- CPolicyServer::ECustomCheck, // ERequestThumbByPathAsync
- CPolicyServer::ECustomCheck, // ERequestThumbByFileHandleAsync
- CPolicyServer::ECustomCheck, // EReleaseBitmap
- CPolicyServer::ECustomCheck, // ECancelRequest
- CPolicyServer::ECustomCheck, // EChangePriority
- CPolicyServer::ECustomCheck, // EDeleteThumbnails
- CPolicyServer::ECustomCheck, // EGetMimeTypeBufferSize
- CPolicyServer::ECustomCheck, // EGetMimeTypeList
- CPolicyServer::ECustomCheck, // ERequestThumbByIdAsync
- CPolicyServer::ECustomCheck, // ERequestThumbByBufferAsync
- CPolicyServer::ECustomCheck, // ERequestSetThumbnailByBuffer
- CPolicyServer::ECustomCheck, // EDeleteThumbnailsById
- CPolicyServer::ECustomCheck, // ERenameThumbnails
- CPolicyServer::ECustomCheck, // EUpdateThumbnails
- CPolicyServer::ECustomCheck, // ERequestSetThumbnailByBitmap
- CPolicyServer::ECustomCheck, // EThumbnailServerRequestCount
- };
-
-// ----------------------------------------------------------------------------------------
-// Package all the above together into a policy
-// ----------------------------------------------------------------------------------------
-const CPolicyServer::TPolicy KThumbnailServerPolicy =
- {
- CPolicyServer::EAlwaysPass,
- KThumbnailServerRangeCount, // number of ranges
- KThumbnailServerRanges, // ranges array
- KThumbnailServerElementsIndex, // elements<->ranges index
- NULL
- // array of elements
- };
-
-// ---------------------------------------------------------------------------
-// CustomSecurityCheckL
-// ---------------------------------------------------------------------------
-//
-CPolicyServer::TCustomResult CThumbnailServer::CustomSecurityCheckL(
- const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/ )
- {
- CPolicyServer::TCustomResult securityCheckResult = EFail;
-
- switch ( aMsg.Function() )
- {
- case ERequestThumbByPathAsync:
- case ERequestThumbByFileHandleAsync:
- case ERequestThumbByIdAsync:
- case ERequestThumbByBufferAsync:
- {
- securityCheckResult = EPass;
- break;
- }
- case EReleaseBitmap:
- case ECancelRequest:
- case EChangePriority:
- case EDeleteThumbnails:
- case EGetMimeTypeBufferSize:
- case EGetMimeTypeList:
- case ERequestSetThumbnailByBuffer:
- case EDeleteThumbnailsById:
- case EUpdateThumbnails:
- case ERenameThumbnails:
- case ERequestSetThumbnailByBitmap:
- {
- if( aMsg.HasCapability( ECapabilityReadDeviceData ) &&
- aMsg.HasCapability( ECapabilityWriteDeviceData ) )
- {
- securityCheckResult = EPass;
- }
- break;
- }
- case EThumbnailServerRequestCount:
- default:
- {
- securityCheckResult = EFail;
- }
- }
-
- return securityCheckResult;
- }
-// ---------------------------------------------------------------------------
-// CustomFailureActionL
-// ---------------------------------------------------------------------------
-//
-CPolicyServer::TCustomResult CThumbnailServer::CustomFailureActionL(
- const RMessage2& /*aMsg*/, TInt /*aAction*/, const TSecurityInfo& /*aMissing*/ )
- {
- // Not used
- return EFail;
- }
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::CThumbnailServer()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailServer::CThumbnailServer(): CPolicyServer( CActive::EPriorityStandard,
- KThumbnailServerPolicy, EUnsharableSessions )
- {
- // No implementation required
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailServer* CThumbnailServer::NewL()
- {
- CThumbnailServer* self = new( ELeave )CThumbnailServer();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServer::ConstructL()
- {
- TN_DEBUG1( "CThumbnailServer::ConstructL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_CONSTRUCTL, "CThumbnailServer::ConstructL" );
-
-#ifdef _DEBUG
- iPlaceholderCounter = 0;
-#endif
-
- // create shutdown observer
- iShutdownObserver = CTMShutdownObserver::NewL( *this, KTMPSNotification, KShutdown, ETrue );
- iShutdown = EFalse;
-
- // MDS session reconnect timer
- iReconnect = CPeriodic::NewL(CActive::EPriorityIdle);
-
- // connect to MDS
- iMdESession = CMdESession::NewL( *this );
- iSessionError = EFalse;
-
- User::LeaveIfError( iFbsSession.Connect());
- User::LeaveIfError( Start( KThumbnailServerName ));
- User::LeaveIfError( iFs.Connect());
- iProcessor = CThumbnailTaskProcessor::NewL();
- REComSession::FinalClose();
- REComSession::ListImplementationsL( TUid::Uid( THUMBNAIL_PROVIDER_IF_UID ),
- iPluginInfoArray );
-
- //preload provide plugins
- PreLoadProviders();
-
- CTMGetImei * imeiGetter = CTMGetImei::NewLC();
-
- iImei = imeiGetter->GetIMEI();
- CleanupStack::PopAndDestroy(imeiGetter);
-
- iFs.CreatePrivatePath(EDriveC);
- iFs.SetSessionToPrivate(EDriveC);
-
- iCenrep = CThumbnailCenRep::NewL();
-
- iPersistentSizes = iCenrep->GetPersistentSizes();
-
- iMMCObserver = CThumbnailMemoryCardObserver::NewL( this, iFs );
-
- iFormatObserver = CTMFormatObserver::NewL( *this );
-
- iFormatting = EFalse;
-
- OpenStoresL();
-
- AddUnmountObserversL();
- iFetchedChecker = CThumbnailFetchedChecker::NewL();
-
- // Unmount timeout timer
- iUnmount = CPeriodic::NewL(CActive::EPriorityIdle);
- }
-
-
-// ---------------------------------------------------------------------------
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailServer::~CThumbnailServer()
- {
- TN_DEBUG1( "CThumbnailServer::~CThumbnailServer()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_CTHUMBNAILSERVER, "CThumbnailServer::~CThumbnailServer" );
-
- iShutdown = ETrue;
-
- if(iUnmount)
- {
- iUnmount->Cancel();
- delete iUnmount;
- iUnmount = NULL;
- }
-
- iUnmountedDrives.Close();
-
- delete iFetchedChecker;
- iFetchedChecker = NULL;
- delete iShutdownObserver;
- iShutdownObserver = NULL;
- delete iProcessor;
- iProcessor = NULL;
-
- if(iReconnect)
- {
- iReconnect->Cancel();
- delete iReconnect;
- iReconnect = NULL;
- }
-
- if (iMdESession)
- {
- delete iMdESession;
- iMdESession = NULL;
- }
-
- ResetAndDestroyHashMap < TInt, CThumbnailStore > ( iStores );
- ResetAndDestroyHashMap < TInt32, CThumbnailProvider > ( iProviders );
-
- iUnmountObservers.ResetAndDestroy();
- delete iMMCObserver;
- iMMCObserver = NULL;
- delete iFormatObserver;
- iFormatObserver = NULL;
-
- THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
-
- // const pointer to a non-const object
- const TThumbnailBitmapRef* ref = bpiter.NextValue();
-
- while ( ref )
- {
- delete ref->iBitmap;
- ref = bpiter.NextValue();
- }
-
- delete iScaler;
- iScaler = NULL;
- iBitmapPool.Close();
- iFbsSession.Disconnect();
- iRecognizer.Close();
- iPluginInfoArray.ResetAndDestroy();
- delete iCenrep;
- iCenrep = NULL;
- iFs.Close();
- REComSession::FinalClose();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::HandleSessionOpened
-// -----------------------------------------------------------------------------
-//
-#ifdef _DEBUG
-void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt aError )
-#else
-void CThumbnailServer::HandleSessionOpened( CMdESession& /* aSession */, TInt /*aError*/ )
-#endif
- {
-#ifdef _DEBUG
- TN_DEBUG2( "CThumbnailServer::HandleSessionOpened error == %d", aError );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_HANDLESESSIONOPENED, "CThumbnailServer::HandleSessionOpened;aError=%d", aError );
-#endif
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::HandleSessionError
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::HandleSessionError( CMdESession& /*aSession*/, TInt aError )
- {
- TN_DEBUG2( "CThumbnailServer::HandleSessionError == %d", aError );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_HANDLESESSIONERROR, "CThumbnailServer::HandleSessionError;aError=%d", aError );
- if (aError != KErrNone && !iShutdown && !iSessionError)
- {
- iSessionError = ETrue;
-
- if (!iReconnect->IsActive())
- {
- iReconnect->Start( KMdEReconnect, KMdEReconnect,
- TCallBack(ReconnectCallBack, this));
-
- TN_DEBUG1( "CThumbnailServer::HandleSessionError() - reconnect timer started" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_HANDLESESSIONERROR, "CThumbnailServer::HandleSessionError - reconnect timer started" );
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::NewSessionL()
-// Creates new server session.
-// -----------------------------------------------------------------------------
-//
-CSession2* CThumbnailServer::NewSessionL( const TVersion& aVersion, const
- RMessage2& /*aMessage*/ )const
- {
- const TVersion v( KThumbnailServerMajorVersionNumber,
- KThumbnailServerMinorVersionNumber, KThumbnailServerBuildVersionNumber )
- ;
- if ( !User::QueryVersionSupported( v, aVersion ))
- {
- User::Leave( KErrNotSupported );
- }
- return new( ELeave )CThumbnailServerSession();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::ThreadFunctionL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::ThreadFunctionL()
- {
- // Rename own thread
- User::LeaveIfError( User::RenameThread( KThumbnailServerName ));
-
- CThumbnailServer* server = NULL;
- CActiveScheduler* scheduler = new( ELeave )CActiveScheduler();
-
- if ( scheduler )
- {
- CActiveScheduler::Install( scheduler );
- CleanupStack::PushL( scheduler );
- server = CThumbnailServer::NewL(); // Adds server in scheduler
- // No need to CleanupStack::PushL(server) since no leaves can happen
- RProcess::Rendezvous( KErrNone );
- TN_DEBUG1(
- "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() in" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_THREADFUNCTIONL, "CThumbnailServer::ThreadFunctionL -- CActiveScheduler::Start() in" );
- CActiveScheduler::Start();
- TN_DEBUG1(
- "CThumbnailServer::ThreadFunctionL() -- CActiveScheduler::Start() out" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_THREADFUNCTIONL, "CThumbnailServer::ThreadFunctionL - out" );
- // Comes here if server gets shut down
- delete server;
- server = NULL;
- CleanupStack::PopAndDestroy( scheduler );
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::AddSession()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::AddSession()
- {
- TN_DEBUG2( "CThumbnailServer::AddSession() iSessionCount was %d",
- iSessionCount );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_ADDSESSION, "CThumbnailServer::AddSession;iSessionCount=%d", iSessionCount );
- iSessionCount++;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::DropSession()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::DropSession(CThumbnailServerSession* aSession)
- {
- TN_DEBUG2( "CThumbnailServer::DropSession() iSessionCount was %d",
- iSessionCount );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;iSessionCount=%d", iSessionCount );
- iSessionCount--;
-
- if(iProcessor)
- {
- iProcessor->RemoveTasks(aSession);
- }
-
- TN_DEBUG2( "CThumbnailServer::DropSession() aSession = 0x%08x", aSession );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;aSession=%o", aSession );
-
- // clean-up bitmap pool
- THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
-
- // const pointer to a non-const object
- const TThumbnailBitmapRef* ref = bpiter.NextValue();
-
- while ( ref )
- {
- if ( ref->iSession == aSession )
- {
- TN_DEBUG2( "CThumbnailServer::DropSession() - ref->iSession = 0x%08x", ref->iSession );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;ref->iSession=%o", ref->iSession );
-
- delete ref->iBitmap;
- bpiter.RemoveCurrent();
-
- TN_DEBUG2( "CThumbnailServer::DropSession() - deleted bitmap, left=%d", iBitmapPool.Count());
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_DROPSESSION, "CThumbnailServer::DropSession;iBitmapPool.Count()=%d", iBitmapPool.Count() );
- }
-
- ref = bpiter.NextValue();
- }
-
- if ( iSessionCount <= 0 )
- {
- // server shutdown
- if (!iShutdown)
- {
- // rename thread
- User::RenameThread( KThumbnailServerShutdown );
-
- CActiveScheduler::Stop();
- iShutdown = ETrue;
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::ShutdownNotification
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::ShutdownNotification()
- {
- TN_DEBUG1( "CThumbnailServer::ShutdownNotification()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_SHUTDOWNNOTIFICATION, "CThumbnailServer::ShutdownNotification" );
- if (!iShutdown)
- {
- TN_DEBUG1( "CThumbnailServer::ShutdownNotification() shutdown");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_SHUTDOWNNOTIFICATION, "CThumbnailServer::ShutdownNotification - shutdown" );
- CActiveScheduler::Stop();
- iShutdown = ETrue;
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::AddBitmapToPoolL()
-// Add bitmap to bitmap pool.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::AddBitmapToPoolL( CThumbnailServerSession* aSession,
- CFbsBitmap* aBitmap, TThumbnailServerRequestId aRequestId )
- {
- if( !aBitmap )
- {
- TN_DEBUG1( "CThumbnailServer::AddBitmapToPoolL() - KErrArgument");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL - KErrArgument" );
- User::Leave( KErrArgument );
- }
- TN_DEBUG4(
- "CThumbnailServer::AddBitmapToPoolL(aSession=0x%08x, aBitmap=0x%08x), handle=%d", aSession, aBitmap, aBitmap->Handle());
-
- TThumbnailBitmapRef* ptr = iBitmapPool.Find( aBitmap->Handle());
-
- TN_DEBUG2( "CThumbnailServer::AddBitmapToPoolL() - req id = %d", aRequestId.iRequestId );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL;aRequestId.iRequestId=%u", aRequestId.iRequestId );
-
- if ( ptr )
- {
- ptr->iRefCount++;
- }
- else
- {
- TThumbnailBitmapRef ref;
- ref.iBitmap = aBitmap;
- ref.iSession = aSession;
- ref.iRefCount = 1; // magic: first reference
- ref.iRequestId = aRequestId.iRequestId;
-
- iBitmapPool.InsertL( aBitmap->Handle(), ref );
- }
-
-#ifdef _DEBUG
- TN_DEBUG2( "CThumbnailServer::BITMAP-POOL-COUNTER----------, Bitmaps = %d", iBitmapPool.Count() );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_ADDBITMAPTOPOOLL, "CThumbnailServer::AddBitmapToPoolL;iBitmapPool.Count()=%d", iBitmapPool.Count() );
-#endif
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::StoreThumbnailL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::StoreThumbnailL( const TDesC& aPath, CFbsBitmap* aBitmap,
- const TSize& aOriginalSize, const TBool aCropped, const TThumbnailSize aThumbnailSize,
- const TInt64 aModified, const TBool aThumbFromPath, const TBool aCheckExist )
- {
- TN_DEBUG6(
- "CThumbnailServer::StoreBitmapL(aPath=%S, aBitmap=0x%08x, aOriginalSize=%dx%d, aCropped=%d)", &aPath, aBitmap, aOriginalSize.iWidth, aOriginalSize.iHeight, aCropped );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aBitmap=%o", aBitmap );
- OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aPath=%S", aPath );
- OstTraceExt3( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aOriginalSize.iWidth=%d;aOriginalSize.iHeight=%d;aCropped=%u", aOriginalSize.iWidth, aOriginalSize.iHeight, aCropped );
-
-#ifdef _DEBUG
- TN_DEBUG2( "CThumbnailServer::StoreThumbnailL() - iScaledBitmap displaymode is %d", aBitmap->DisplayMode());
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL;aBitmap->DisplayMode()=%u", aBitmap->DisplayMode() );
-#endif
-
- if (!aCheckExist)
- {
- StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
- aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
- }
- else if(BaflUtils::FileExists( iFs, aPath))
- {
- StoreForPathL( aPath )->StoreThumbnailL( aPath, aBitmap, aOriginalSize,
- aCropped, aThumbnailSize, aModified, aThumbFromPath, EFalse );
- }
- else
- {
- TN_DEBUG1( "CThumbnailServer::StoreThumbnailL() - file doesn't exists anymore, skip store!");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_STORETHUMBNAILL, "CThumbnailServer::StoreThumbnailL - file doesn't exists anymore, skip store!" );
- }
-
- if( iFetchedChecker )
- {
- iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, KErrNone );
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::FetchThumbnailL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* &
- aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aOriginalSize )
- {
- TN_DEBUG3( "CThumbnailServer::FetchThumbnailL(aPath=%S aThumbnailSize=%d)", &aPath, aThumbnailSize );
- OstTraceExt2( TRACE_NORMAL, CTHUMBNAILSERVER_FETCHTHUMBNAILL, "CThumbnailServer::FetchThumbnailL;aPath=%S;aThumbnailSize=%hu", aPath, aThumbnailSize );
- if( iFetchedChecker )
- {
- TInt err( iFetchedChecker->LastFetchResult( aPath, aThumbnailSize ) );
- if ( err == KErrNone ) // To avoid useless sql gets that fails for sure
- {
- // custom sizes are not stored to db, skip fetching
- if ( aThumbnailSize == ECustomThumbnailSize )
- {
- User::Leave( KErrNotFound );
- }
-
- TRAP( err, StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize) );
- if ( err != KErrNone )
- {
- iFetchedChecker->SetFetchResult( aPath, aThumbnailSize, err );
- }
- }
- User::LeaveIfError( err );
- }
- else
- {
- // custom sizes are not stored to db, skip fetching
- if ( aThumbnailSize == ECustomThumbnailSize )
- {
- User::Leave( KErrNotFound );
- }
-
- StoreForPathL( aPath )->FetchThumbnailL( aPath, aThumbnail, aData, aThumbnailSize, aOriginalSize);
- }
- }
-
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::DeleteBitmapFromPool()
-// Removes bitmap from bitmap pool
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::DeleteBitmapFromPool( TInt aHandle )
- {
- TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d)", aHandle );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool;aHandle=%d", aHandle );
-
- TThumbnailBitmapRef* ptr = iBitmapPool.Find( aHandle );
- if ( ptr )
- {
- ptr->iRefCount--;
- if ( !ptr->iRefCount )
- {
- TN_DEBUG3(
- "CThumbnailServer::DeleteBitmapFromPool(%d) -- deleting 0x%08x)", aHandle, ptr );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool -- deleting;ptr=%o", ptr );
- delete ptr->iBitmap;
- ptr->iBitmap = NULL;
- iBitmapPool.Remove( aHandle );
- TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool -- items left %d", iBitmapPool.Count() );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool -- items left;iBitmapPool.Count()=%d", iBitmapPool.Count() );
- }
- else
- {
- TN_DEBUG3(
- "CThumbnailServer::DeleteBitmapFromPool(%d) -- refcount now %d",
- aHandle, ptr->iRefCount );
- OstTraceExt2( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool) -- refcount now;aHandle=%d;ptr->iRefCount=%d", aHandle, ptr->iRefCount );
- }
- }
- else
- {
- //__ASSERT_DEBUG(( EFalse ), ThumbnailPanic( EThumbnailBitmapNotReleased ));
- TN_DEBUG2( "CThumbnailServer::DeleteBitmapFromPool(%d) -- not found!",
- aHandle );
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_DELETEBITMAPFROMPOOL, "CThumbnailServer::DeleteBitmapFromPool -- not found!;aHandle=%d", aHandle );
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// Delete thumbnails for given object file
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::DeleteThumbnailsL( const TDesC& aPath )
- {
- TN_DEBUG2( "CThumbnailServer::DeleteThumbnailsL(%S)", &aPath);
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_DELETETHUMBNAILSL, "CThumbnailServer::DeleteThumbnailsL;aPath=%S", aPath );
-
- StoreForPathL( aPath )->DeleteThumbnailsL( aPath );
-
- if( iFetchedChecker )
- {
- iFetchedChecker->DeleteFetchResult( aPath );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::ResolveMimeTypeL()
-// -----------------------------------------------------------------------------
-//
-TDataType CThumbnailServer::ResolveMimeTypeL( RFile64& aFile )
- {
- TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()");
- RFile64 tmp = aFile;
-
- // check if DRM
- ContentAccess::CData* data = ContentAccess::CData::NewLC(
- tmp, ContentAccess::KDefaultContentObject, ContentAccess::EPeek );
-
- TInt filetype( 0 );
- TInt drm( 0 );
- User::LeaveIfError( data->GetAttribute( ContentAccess::EIsProtected, drm ) );
- data->GetAttribute( ContentAccess::EFileType, filetype );
- CleanupStack::PopAndDestroy();
-
- //close aFile on leave
- CleanupClosePushL( aFile );
-
- if ( drm && filetype != ContentAccess::EOma1Dcf )
- {
- // cannot handle other than Oma DRM 1.x files
- TN_DEBUG1( "CThumbnailStore::ResolveMimeTypeL()- only OMA DRM 1.0 supported");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_RESOLVEMIMETYPEL, "CThumbnailServer::ResolveMimeTypeL - only OMA DRM 1.0 supported" );
- User::Leave(KErrNotSupported);
- }
-
- TDataRecognitionResult res;
- if ( iRecognizer.Handle() == KNullHandle )
- {
- // error using recognizer, (re)connect
- User::LeaveIfError( iRecognizer.Connect());
- }
-
- User::LeaveIfError( iRecognizer.RecognizeData( aFile, res ));
-
- if ( res.iConfidence == CApaDataRecognizerType::ENotRecognized )
- {
- // file type not supported
- User::Leave( KErrNotSupported );
- }
-
- CleanupStack::Pop( &aFile );
- return res.iDataType;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::ResolveProviderL()
-// Resolves plugin to be used in thumbnail creation.
-// -----------------------------------------------------------------------------
-//
-CThumbnailProvider* CThumbnailServer::ResolveProviderL( const TDesC8& aMimeType
- )
- {
-#ifdef _DEBUG
- TBuf < KMaxDataTypeLength > buf; // 16-bit descriptor for debug prints
- buf.Copy( aMimeType );
- TN_DEBUG2( "CThumbnailServer::ResolveProviderL(%S)", &buf );
- OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RESOLVEMIMETYPEL, "CThumbnailServer::ResolveMimeTypeL;buf=%S", buf );
-#endif
-
- CThumbnailProvider* ret = NULL;
-
- TInt separatorPos = aMimeType.Locate( KThumbnailMimeSeparatorChar );
- TPtrC8 mediaType( aMimeType.Left( separatorPos ));
- TPtrC8 subType( aMimeType.Mid( separatorPos + 1 )); // skip slash
-
- const TInt count = iPluginInfoArray.Count();
- for ( TInt i( 0 ); i < count && !ret; i++ )
- {
- const TDesC8& opaqueData = iPluginInfoArray[i]->OpaqueData();
- TInt pSeparatorPos = opaqueData.Locate( KThumbnailMimeSeparatorChar );
- TPtrC8 pMediaType( opaqueData.Left( pSeparatorPos ));
- TPtrC8 pSubType( opaqueData.Mid( pSeparatorPos + 1 )); // skip slash
-
- if ( !pMediaType.CompareF( mediaType ))
- {
- if ( !pSubType.CompareF( KThumbnailMimeWildCard ) ||
- !pSubType.CompareF( subType ))
- {
-#ifdef _DEBUG
- TN_DEBUG3(
- "CThumbnailServer::ResolveProviderL(%S) -- using provider 0x%08x", &buf, iPluginInfoArray[i]->ImplementationUid().iUid );
- OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;buf=%S", buf );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;iPluginInfoArray[i]->ImplementationUid().iUid=%o", iPluginInfoArray[i]->ImplementationUid().iUid );
-#endif
- ret = GetProviderL( iPluginInfoArray[i]->ImplementationUid());
- }
- }
- }
- if ( !ret )
- {
-#ifdef _DEBUG
- TN_DEBUG2(
- "CThumbnailServer::ResolveProviderL(%S) -- provider not found",
- &buf );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_RESOLVEPROVIDERL, "CThumbnailServer::ResolveProviderL;buf=%S", buf );
-#endif
- User::Leave( KErrNotSupported );
- }
- return ret;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::GetProviderL()
-// -----------------------------------------------------------------------------
-//
-CThumbnailProvider* CThumbnailServer::GetProviderL( const TUid& aImplUid )
- {
- CThumbnailProvider** resPtr = iProviders.Find( aImplUid.iUid );
- CThumbnailProvider* res = NULL;
- if ( resPtr )
- {
- // Use existing instance
- res = * resPtr;
- }
- else
- {
- // Plug-in needs to be loaded
- TN_DEBUG2(
- "CThumbnailServer::GetProviderL() -- loading plug-in, UID 0x%08x",
- aImplUid );
- res = CThumbnailProvider::NewL( aImplUid );
- TN_DEBUG1( "CThumbnailServer::GetProviderL() -- loading complete" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_GETPROVIDERL, "CThumbnailServer::GetProviderL -- loading complete" );
- CleanupStack::PushL( res );
- iProviders.InsertL( aImplUid.iUid, res );
- CleanupStack::Pop( res );
- }
-
- return res;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::PreLoadProviders()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::PreLoadProviders( )
- {
- TN_DEBUG1( "CThumbnailServer::PreLoadProvidersL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_PRELOADPROVIDERS, "CThumbnailServer::PreLoadProviders" );
- TInt err(KErrNone);
-
- for(TInt i=0; i< iPluginInfoArray.Count(); i++)
- {
- TRAP(err, GetProviderL( iPluginInfoArray[i]->ImplementationUid()));
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::QueueTaskL()
-// Adds thumbnailtask to processor queue.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::QueueTaskL( CThumbnailTask* aTask )
- {
- __ASSERT_DEBUG(( aTask ), ThumbnailPanic( EThumbnailNullPointer ));
- iProcessor->AddTaskL( aTask );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::DequeTask()
-// Removes thumbnailtask from processor queue.
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServer::DequeTask( const TThumbnailServerRequestId& aRequestId )
- {
- TInt error = iProcessor->RemoveTask( aRequestId );
-
- // clean-up bitmap pool
- THashMapIter < TInt, TThumbnailBitmapRef > bpiter( iBitmapPool );
-
- // const pointer to a non-const object
- const TThumbnailBitmapRef* ref = bpiter.NextValue();
-
- while ( ref )
- {
- TN_DEBUG2( "CThumbnailServer::DequeTask() - ref->iRequestId = %d", ref->iRequestId );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_DEQUETASK, "CThumbnailServer::DequeTask;ref->iRequestId=%u", ref->iRequestId );
-
- if ( ref->iSession == aRequestId.iSession &&
- ref->iRequestId == aRequestId.iRequestId )
- {
- delete ref->iBitmap;
- bpiter.RemoveCurrent();
-
- TN_DEBUG2( "CThumbnailServer::DequeTask() - deleted bitmap, left=%d",
- iBitmapPool.Count());
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_DEQUETASK, "CThumbnailServer::DequeTask;iBitmapPool.Count()=%d", iBitmapPool.Count() );
- }
-
- ref = bpiter.NextValue();
- }
-
- return error;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::ChangeTaskPriority()
-// Changes priority of specific task.
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServer::ChangeTaskPriority( const TThumbnailServerRequestId&
- aRequestId, TInt aNewPriority )
- {
- return iProcessor->ChangeTaskPriority( aRequestId, aNewPriority );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::ScaleBitmapL()
-// Used to scale image.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::ScaleBitmapL( TRequestStatus& aStatus, const CFbsBitmap&
- aSource, CFbsBitmap& aDest, const TRect& aSourceRect )
- {
- if ( !iScaler )
- {
- iScaler = IHLScaler::CreateL();
- }
- TRect destRect( TPoint(), aDest.SizeInPixels());
- User::LeaveIfError( iScaler->Scale( aStatus, aSource, aSourceRect, aDest,
- destRect ));
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::CancelScale()
-// Cancels scaling task.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::CancelScale()
- {
- if ( iScaler )
- {
- iScaler->CancelProcess();
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::Processor()
-// Returns processor.
-// -----------------------------------------------------------------------------
-//
-CThumbnailTaskProcessor& CThumbnailServer::Processor()
- {
- __ASSERT_DEBUG(( iProcessor ), ThumbnailPanic( EThumbnailNullPointer ));
- return * iProcessor;
- }
-
-// -----------------------------------------------------------------------------
-// Get the thumbnail store instance, which is responsible for this drive
-// -----------------------------------------------------------------------------
-//
-CThumbnailStore* CThumbnailServer::StoreForDriveL( const TInt aDrive )
- {
- TN_DEBUG2( "CThumbnailServer::StoreForDriveL() drive=%d", aDrive );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL;aDrive=%d", aDrive );
-
- if(iUnmountedDrives.Find( aDrive ) >= KErrNone)
- {
- TN_DEBUG1( "CThumbnailServer::StoreForDriveL() unmount in progress, skip!");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - unmount in progress, skip!" );
- User::Leave( KErrDisMounted );
- }
-
- CThumbnailStore** resPtr = iStores.Find( aDrive );
- CThumbnailStore* res = NULL;
-
- if ( resPtr )
- {
- res = * resPtr;
- }
- else
- {
- if( iFormatting )
- {
- TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - FORMATTING! - ABORT");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - FORMATTING! - ABORT" );
- User::Leave( KErrNotSupported );
- }
-
- TVolumeInfo volumeInfo;
- TInt err = iFs.Volume( volumeInfo, aDrive );
-
- if ( err )
- {
- // Locked
- TN_DEBUG2( "CThumbnailServer::StoreForDriveL() - err %d", err);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL;err=%d", err );
- User::Leave( err);
- }
- else if( volumeInfo.iDrive.iMediaAtt& KMediaAttLocked )
- {
- TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - locked");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - locked" );
- User::Leave( KErrAccessDenied );
- }
- else if ( volumeInfo.iDrive.iDriveAtt& KDriveAttRom ||
- volumeInfo.iDrive.iDriveAtt& KDriveAttRemote ||
- volumeInfo.iDrive.iMediaAtt& KMediaAttWriteProtected )
- {
- // We support ROM disks and remote disks in read only mode.
- TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - rom/remote/write protected");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - rom/remote/write protected" );
- res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, ETrue );
- }
- else
- {
- TN_DEBUG1( "CThumbnailServer::StoreForDriveL() - normal");
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_STOREFORDRIVEL, "CThumbnailServer::StoreForDriveL - normal" );
- res = CThumbnailStore::NewL( iFs, aDrive, iImei, this, EFalse );
- }
-
- CleanupStack::PushL( res );
- iStores.InsertL( aDrive, res );
- res->SetPersistentSizes(iPersistentSizes);
- CleanupStack::Pop( res );
-
- for(TInt i = 0; i < iUnmountObservers.Count(); i++)
- {
- iUnmountObservers[i]->StartNotify();
- }
- }
-
- return res;
- }
-
-// -----------------------------------------------------------------------------
-// Get the thumbnail store instance, which is responsible for the drive
-// identified by given path
-// -----------------------------------------------------------------------------
-//
-CThumbnailStore* CThumbnailServer::StoreForPathL( const TDesC& aPath )
- {
- if(aPath.Length() < 3 || aPath.Length() > KMaxPath)
- {
- TN_DEBUG1( "CThumbnailServer::StoreForPathL() - KErrArgument");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_STOREFORPATHL, "CThumbnailServer::StoreForPathL - KErrArgument" );
- User::Leave(KErrArgument);
- }
- TInt drive = 0;
- User::LeaveIfError( RFs::CharToDrive( aPath[0], drive ));
- return StoreForDriveL( drive );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::PersistentSizeL()
-// ---------------------------------------------------------------------------
-//
-TThumbnailPersistentSize & CThumbnailServer::PersistentSizeL( TThumbnailSize aThumbnailSize )
- {
- if ( !iCenrep )
- {
- iCenrep = CThumbnailCenRep::NewL();
- }
-
- return iCenrep->PersistentSizeL( aThumbnailSize );
- }
-
-// -----------------------------------------------------------------------------
-// Open store for each mounted drive
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::OpenStoresL()
- {
- // get list of mounted drives and open stores
- TDriveList driveListInt;
- TInt driveCountInt(0);
- User::LeaveIfError(DriveInfo::GetUserVisibleDrives(
- iFs, driveListInt, driveCountInt, KDriveAttInternal | KDriveAttRemovable ));
-
- for( TInt i = EDriveA; i <= EDriveZ && driveCountInt; i++ )
- {
- if (driveListInt[i])
- {
- TVolumeInfo volumeInfo;
- TInt err = iFs.Volume( volumeInfo, i );
-
- if (!err)
- {
- TN_DEBUG2( "CThumbnailServer::OpenStoresL() StoreForDriveL %d", i);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_OPENSTORESL, "CThumbnailServer::OpenStoresL;i=%d", i );
-
- // ignore errors
- TRAP_IGNORE( StoreForDriveL( i ));
-
- driveCountInt--;
- }
- }
- }
-
- }
-
-// -----------------------------------------------------------------------------
-// Close the thumbnail store instance, which is responsible for this drive
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::CloseStoreForDriveL( const TInt aDrive )
- {
- TN_DEBUG2( "CThumbnailServer::CloseStoreForDriveL drive=%d", aDrive);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_CLOSESTOREFORDRIVEL, "CThumbnailServer::CloseStoreForDriveL;aDrive=%d", aDrive );
- CThumbnailStore** store = iStores.Find( aDrive );
-
- StartUnmountTimeout( aDrive);
-
- if (store)
- {
- delete *store;
- *store = NULL;
- iStores.Remove( aDrive );
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::PersistentSizes()
-// ---------------------------------------------------------------------------
-//
-RArray < TThumbnailPersistentSize > CThumbnailServer::PersistentSizesL()
- {
- return iPersistentSizes;
- }
-
-void CThumbnailServer::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
- TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly )
- {
- StoreForPathL( aPath )->GetMissingSizesL( aPath, aSourceType, aMissingSizes, aCheckGridSizeOnly );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::Fs()
-// ---------------------------------------------------------------------------
-//
-RFs& CThumbnailServer::Fs()
- {
- return iFs;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::AddUnmountObserversL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServer::AddUnmountObserversL()
- {
- TDriveList driveList;
- TInt drive;
- TDriveInfo driveInfo;
-
- iUnmountObservers.ResetAndDestroy();
-
- User::LeaveIfError( iFs.DriveList(driveList) );
-
- // search all drives
- for( drive = EDriveA; drive <= EDriveZ; drive++ )
- {
- if( !driveList[drive] )
- {
- // If drive-list entry is zero, drive is not available
- continue;
- }
-
- TInt err = iFs.Drive(driveInfo, drive);
-
- // if removable drive, add observer
- if (!err && driveInfo.iDriveAtt& KDriveAttRemovable)
- {
- TN_DEBUG2( "CThumbnailServer::AddOnMountObserver drive=%d", drive);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_ADDUNMOUNTOBSERVERSL, "CThumbnailServer::AddUnmountObserversL;drive=%d", drive );
- CThumbnailDiskUnmountObserver* obs = CThumbnailDiskUnmountObserver::NewL( iFs, drive, this );
- CleanupStack::PushL( obs );
- iUnmountObservers.AppendL( obs );
- CleanupStack::Pop( obs );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::MemoryCardStatusChangedL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServer::MemoryCardStatusChangedL()
- {
- TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL in()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - in" );
- TDriveList driveList;
- TInt drive;
- TVolumeInfo volumeInfo;
- TDriveInfo driveInfo;
-
- User::LeaveIfError( iFs.DriveList(driveList) );
-
- // search all drives
- for( drive = EDriveA; drive <= EDriveZ; drive++ )
- {
- if( !driveList[drive] )
- {
- // If drive-list entry is zero, drive is not available
- continue;
- }
-
- TInt err = iFs.Volume(volumeInfo, drive);
- TInt err_drive = iFs.Drive(driveInfo, drive);
-
- // mount -- if removable drive, add new store
- if (!err && !err_drive
- && driveInfo.iType != EMediaNotPresent
- && driveInfo.iDriveAtt& KDriveAttRemovable )
- {
- TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL mount drive==%d", drive);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;drive=%d", drive );
-
- CThumbnailStore** resPtr = iStores.Find( drive );
-
- if ( resPtr )
- {
- TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() already mounted, skip %d", drive);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;drive=%d", drive );
- continue;
- }
-
- // ignore errors
- TRAP_IGNORE( StoreForDriveL( drive ));
-
- TUint driveStatus(0);
- DriveInfo::GetDriveStatus(iFs, drive, driveStatus);
- TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() driveStatus = %d", driveStatus);
- if (!(driveStatus & DriveInfo::EDriveUsbMemory) &&
- !(driveStatus & DriveInfo::EDriveRemote))
- {
- TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() update KItemsleft = %d", KErrNotReady);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL;KErrNotReady=%d - update KItemsleft", KErrNotReady );
- RProperty::Set(KTAGDPSNotification, KItemsleft, KErrNotReady );
- }
-
- TInt index = iUnmountedDrives.Find( drive );
-
- if(index >= KErrNone)
- {
- iUnmountedDrives.Remove( index );
- }
-
- if(!iUnmountedDrives.Count()&& iUnmount && iUnmount->IsActive())
- {
- TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL() cancel unmount timer");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - cancel unmount timer" );
- iUnmount->Cancel();
- }
- }
-
- //dismount -- if removable drive, close store
- else if(err && !err_drive && driveInfo.iDriveAtt& KDriveAttRemovable )
- {
- TN_DEBUG2( "CThumbnailServer::MemoryCardStatusChangedL() unmount drive==%d", drive);
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - unmount drive;drive=%d", drive );
- CloseStoreForDriveL( drive);
- }
- }
-
- TN_DEBUG1( "CThumbnailServer::MemoryCardStatusChangedL out()" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_MEMORYCARDSTATUSCHANGEDL, "CThumbnailServer::MemoryCardStatusChangedL - out" );
- }
-
-
-// -----------------------------------------------------------------------------
-// Get the required size (in characters) for a buffer that contains the
-// list of supported MIME types
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServer::GetMimeTypeBufferSize()const
- {
- TInt size = 0;
- for ( TInt i = iPluginInfoArray.Count(); --i >= 0; )
- {
- const TDesC8& opaqueData = iPluginInfoArray[i]->OpaqueData();
- size += opaqueData.Length();
- size++; // space for separator character
- }
- if ( size )
- {
- size--; // no need for a separator character at the end
- }
-
- return size;
- }
-
-// -----------------------------------------------------------------------------
-// Get the list of supported MIME types and store them in the buffer
-// allocated by the client.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::GetMimeTypeList( TDes& aBuffer )const
- {
- TBuf < KMaxDataTypeLength > buf; // needed for convert from TBuf8 to TBuf
- aBuffer.Zero();
- const TInt count = iPluginInfoArray.Count();
- for ( TInt i = 0; i < count; i++ )
- {
- const TDesC8& opaqueData = iPluginInfoArray[i]->OpaqueData();
- buf.Copy( opaqueData );
- aBuffer.Append( buf );
- aBuffer.Append( KThumbnailMimeTypeSeparatorChar );
- }
- if ( count )
- {
- // remove last separator char
- aBuffer.SetLength( aBuffer.Length() - 1 );
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// Updates thumbnails by given Id.
-// -----------------------------------------------------------------------------
-//
-TBool CThumbnailServer::UpdateThumbnailsL( const TDesC& aPath,
- const TInt /*aOrientation*/, const TInt64 aModified )
- {
- TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL" );
-
- // 1. check path change
- // 2. check timestamp change
- TBool modifiedChanged = EFalse;
-
- CThumbnailStore* store = StoreForPathL( aPath );
-
- TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exist");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - exist" );
-
- TBool exists = store->CheckModifiedByPathL(aPath, aModified, modifiedChanged);
-
- if(!exists)
- {
- TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - exists NO");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - exists NO" );
- //not found, needs to be generated
- return EFalse;
- }
-
- TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified ?");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified ?" );
-
- if (modifiedChanged)
- {
- TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified YES");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified YES" );
-
- // delete old thumbs
- store->DeleteThumbnailsL(aPath, ETrue);
-
- if( iFetchedChecker )
- {
- iFetchedChecker->DeleteFetchResult( aPath );
- }
-
- // need to create new thumbs
- }
- else
- {
- TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - modified NO");
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - modified NO" );
-
- // not modified
- return ETrue;
- }
-
- TN_DEBUG1( "CThumbnailServer::UpdateThumbnailsL() - no thumbs found, create new");
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSERVER_UPDATETHUMBNAILSL, "CThumbnailServer::UpdateThumbnailsL - no thumbs found, create new" );
-
- return EFalse;
- }
-
-// -----------------------------------------------------------------------------
-// Renames thumbnails.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath )
- {
- TN_DEBUG2( "CThumbnailServer::RenameThumbnailsL(%S)", &aCurrentPath);
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVER_RENAMETHUMBNAILSL, "CThumbnailServer::RenameThumbnailsL;aCurrentPath=%S", aCurrentPath );
-
- StoreForPathL( aCurrentPath )->RenameThumbnailsL( aCurrentPath, aNewPath );
-
- if( iFetchedChecker )
- {
- iFetchedChecker->RenameFetchResultL( aNewPath, aCurrentPath );
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::MimeTypeFromFileExt()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServer::MimeTypeFromFileExt( const TDesC& aFileName, TDataType& aMimeType )
- {
- TBool found = ETrue;
- TPtrC ext( aFileName.Right(KExtLength) ); // tparse panics with virtual URI
-
- if ( ext.CompareF( KJpegExt ) == 0 || ext.CompareF( KJpgExt ) == 0)
- {
- aMimeType = TDataType( KJpegMime );
- }
- else if ( ext.CompareF( KJpeg2000Ext ) == 0 )
- {
- aMimeType = TDataType( KJpeg2000Mime );
- }
- else if ( ext.CompareF( KSvgExt ) == 0 )
- {
- aMimeType = TDataType( KSvgMime );
- }
- else if ( ext.CompareF( KGifExt ) == 0 )
- {
- aMimeType = TDataType( KGifMime );
- }
- else if ( ext.CompareF( KPngExt ) == 0 )
- {
- aMimeType = TDataType( KPngMime );
- }
- else if ( ext.CompareF( KMpgExt1 ) == 0 )
- {
- aMimeType = TDataType( KMpgMime1 );
- }
- else if ( ext.CompareF( KMpeg4Ext ) == 0 )
- {
- aMimeType = TDataType( KMpeg4Mime );
- }
- else if ( ext.CompareF( KMp4Ext ) == 0 )
- {
- aMimeType = TDataType( KMp4Mime );
- }
- else if ( ext.CompareF( KAviExt ) == 0 )
- {
- aMimeType = TDataType( KAviMime );
- }
- else if ( ext.CompareF( KMp3Ext ) == 0 )
- {
- aMimeType = TDataType( KMp3Mime );
- }
- else if ( ext.CompareF( KNonEmbeddArtExt ) == 0 )
- {
- aMimeType = TDataType( KNonEmbeddArtMime );
- }
- else if ( ext.CompareF( KAacExt ) == 0 )
- {
- aMimeType = TDataType( KAacMime );
- }
- else if ( ext.CompareF( KWmaExt ) == 0 )
- {
- aMimeType = TDataType( KWmaMime );
- }
- else if ( ext.CompareF( KBmpExt ) == 0 )
- {
- aMimeType = TDataType( KBmpMime );
- }
- else if ( ext.CompareF( K3gpExt ) == 0 )
- {
- aMimeType = TDataType( KVideo3gppMime );
- return KErrNotFound;
- // 3gp can contain video or audio, should go to recognizer
- }
- else if ( ext.CompareF( K3gppExt ) == 0 )
- {
- aMimeType = TDataType( KVideo3gppMime );
- return KErrNotFound;
- // 3gp can contain video or audio, should go to recognizer
- }
- else if ( ext.CompareF( KAmrExt ) == 0 )
- {
- aMimeType = TDataType( KAudioAmrMime );
- }
- else if ( ext.CompareF( KWmvExt ) == 0 )
- {
- aMimeType = TDataType( KVideoWmvMime );
- }
- else if ( ext.CompareF( KRealAudioExt ) == 0 )
- {
- aMimeType = TDataType( KRealAudioMime );
- }
- else if ( ext.CompareF( KPmRealAudioPluginExt ) == 0 )
- {
- aMimeType = TDataType( KPmRealAudioPluginMime );
- }
- else if ( ext.CompareF( KRealVideoExt ) == 0 )
- {
- aMimeType = TDataType( KRealVideoMime );
- }
- else if ( ext.CompareF( KM4aExt ) == 0 )
- {
- aMimeType = TDataType( KM4aMime);
- }
- else if ( ext.CompareF( KM4vExt ) == 0 )
- {
- aMimeType = TDataType( KMp4Mime);
- }
- else if ( ext.CompareF( KPmRealVideoPluginExt ) == 0 )
- {
- aMimeType = TDataType( KPmRealVideoPluginMime );
- }
- else if ( ext.CompareF( KPmRealVbVideoPluginExt ) == 0 )
- {
- aMimeType = TDataType( KPmRealVbVideoPluginMime );
- }
- else if ( ext.CompareF( KFlashVideoExt ) == 0 )
- {
- aMimeType = TDataType( KFlashVideoMime );
- }
- else if ( ext.CompareF( KMatroskaVideoExt ) == 0 )
- {
- aMimeType = TDataType( KMatroskaVideoMime );
- }
- else if ( ext.CompareF( KContactExt ) == 0 )
- {
- aMimeType = TDataType( KContactMime );
- }
- else if ( ext.CompareF( KAlbumArtExt ) == 0 )
- {
- aMimeType = TDataType( KAlbumArtMime );
- }
- else
- {
- aMimeType = TDataType( KNullDesC8 );
- found = EFalse;
- }
-
- if (found)
- {
- return KErrNone;
- }
-
- return KErrNotFound;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::SourceTypeFromMimeType()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServer::SourceTypeFromMimeType( const TDataType& aMimeType )
- {
- const TPtrC8 mimeType = aMimeType.Des8();
-
- TInt separatorPos = mimeType.Locate( KThumbnailMimeSeparatorChar );
- TPtrC8 mediaType( mimeType.Left( separatorPos ));
-
- if (mediaType.Compare(KThumbnailMimeImage) == 0)
- {
- return TThumbnailPersistentSize::EImage;
- }
- else if (mediaType.Compare(KThumbnailMimeVideo) == 0)
- {
- return TThumbnailPersistentSize::EVideo;
- }
- else if (mediaType.Compare(KThumbnailMimeAudio) == 0)
- {
- return TThumbnailPersistentSize::EAudio;
- }
- else if (mediaType.Compare(KThumbnailMimeContact) == 0)
- {
- return TThumbnailPersistentSize::EContact;
- }
-
- return TThumbnailPersistentSize::EUnknownSourceType;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::SourceTypeFromSizeType()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServer::SourceTypeFromSizeType( const TInt aSizeType )
- {
- TInt sourceType = 0;
-
- switch (aSizeType)
- {
- case EImageGridThumbnailSize:
- case EImageListThumbnailSize:
- case EImageFullScreenThumbnailSize:
- sourceType = TThumbnailPersistentSize::EImage;
- break;
- case EVideoGridThumbnailSize:
- case EVideoListThumbnailSize:
- case EVideoFullScreenThumbnailSize:
- sourceType = TThumbnailPersistentSize::EVideo;
- break;
- case EAudioGridThumbnailSize:
- case EAudioListThumbnailSize:
- case EAudioFullScreenThumbnailSize:
- sourceType = TThumbnailPersistentSize::EAudio;
- break;
- case EContactListThumbnailSize:
- case EContactGridThumbnailSize:
- case EContactFullScreenThumbnailSize:
- sourceType = TThumbnailPersistentSize::EContact;
- break;
- default:
- sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- }
-
- return sourceType;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::SupportedMimeType()
-// -----------------------------------------------------------------------------
-//
-TBool CThumbnailServer::SupportedMimeType( const TDataType& aMimeType )
- {
- const TPtrC8 mimeType = aMimeType.Des8();
-
- if ( mimeType.CompareF( KJpegMime ) == 0 ||
- mimeType.CompareF( KJpeg2000Mime ) == 0 ||
- mimeType.CompareF( KGifMime ) == 0 ||
- mimeType.CompareF( KPngMime ) == 0 ||
- mimeType.CompareF( KSvgMime ) == 0 ||
- mimeType.CompareF( KMpgMime1 ) == 0 ||
- mimeType.CompareF( KMpeg4Mime ) == 0 ||
- mimeType.CompareF( KMp4Mime ) == 0 ||
- mimeType.CompareF( KAviMime ) == 0 ||
- mimeType.CompareF( KMp3Mime ) == 0 ||
- mimeType.CompareF( KNonEmbeddArtMime ) == 0 ||
- mimeType.CompareF( KM4aMime ) == 0 ||
- mimeType.CompareF( KAacMime ) == 0 ||
- mimeType.CompareF( KWmaMime ) == 0 ||
- mimeType.CompareF( KBmpMime ) == 0 ||
- mimeType.CompareF( KAudio3gppMime ) == 0 ||
- mimeType.CompareF( KVideo3gppMime ) == 0 ||
- mimeType.CompareF( KAudioAmrMime ) == 0 ||
- mimeType.CompareF( KVideoWmvMime ) == 0 ||
- mimeType.CompareF( KRealAudioMime ) == 0 ||
- mimeType.CompareF( KPmRealAudioPluginMime ) == 0 ||
- mimeType.CompareF( KPmRealVideoPluginMime ) == 0 ||
- mimeType.CompareF( KPmRealVbVideoPluginMime ) == 0 ||
- mimeType.CompareF( KRealVideoMime ) == 0 ||
- mimeType.CompareF( KFlashVideoMime ) == 0 ||
- mimeType.CompareF( KMatroskaVideoMime ) == 0 ||
- mimeType.CompareF( KContactMime ) == 0 ||
- mimeType.CompareF( KAlbumArtMime ) == 0 )
- {
- return ETrue;
- }
-
- return EFalse;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::GetMdESession()
-// -----------------------------------------------------------------------------
-//
-CMdESession* CThumbnailServer::GetMdESession()
- {
- return iMdESession;
- }
-
-
-// -----------------------------------------------------------------------------
-// E32Main()
-// -----------------------------------------------------------------------------
-//
-TInt E32Main()
- {
- __UHEAP_MARK;
- CTrapCleanup* cleanup = CTrapCleanup::New();
- TInt result = KErrNoMemory;
- if ( cleanup )
- {
- TRAP( result, CThumbnailServer::ThreadFunctionL());
- TN_DEBUG2(
- "CThumbnailServer::E32Main() -- thread function out, result=%d",
- result );
- OstTrace1( TRACE_NORMAL, _E32MAIN, "::E32Main;result=%d - thread function out", result );
- delete cleanup;
- cleanup = NULL;
- }
- if ( result != KErrNone )
- {
- // Signal the client that server creation failed
- TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() in" );
- OstTrace0( TRACE_NORMAL, DUP2__E32MAIN, "::E32Main - in" );
- RProcess::Rendezvous( result );
- TN_DEBUG1( "CThumbnailServer::E32Main() -- Rendezvous() out" );
- OstTrace0( TRACE_NORMAL, DUP1__E32MAIN, "::E32Main - out" );
- }
-
- __UHEAP_MARKEND;
- return result;
- }
-
-// -----------------------------------------------------------------------------
-// Closes stores for removable drives
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::CloseRemovableDrivesL()
- {
- TDriveList driveList;
- TInt drive;
- TDriveInfo driveInfo;
- iFormatting = ETrue;
-
- User::LeaveIfError( iFs.DriveList(driveList) );
-
- // search all drives
- for( drive = EDriveA; drive <= EDriveZ; drive++ )
- {
- if( !driveList[drive] )
- {
- // If drive-list entry is zero, drive is not available
- continue;
- }
-
- TInt err = iFs.Drive(driveInfo, drive);
-
- // if removable drive, close store
- if (!err && driveInfo.iDriveAtt& KDriveAttRemovable)
- {
- TN_DEBUG2( "CThumbnailServer::CloseRemovableDrive drive=%d", drive);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_CLOSEREMOVABLEDRIVESL, "CThumbnailServer::CloseRemovableDrivesL;drive=%d", drive );
- CloseStoreForDriveL(drive);
- }
- }
- iProcessor->RemoveAllTasks();
- }
-
-// -----------------------------------------------------------------------------
-// Open Stores for removable drives
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServer::OpenRemovableDrivesL()
- {
- TDriveList driveList;
- TInt drive;
- TDriveInfo driveInfo;
- iFormatting = EFalse;
-
- User::LeaveIfError( iFs.DriveList(driveList) );
-
- // search all drives
- for( drive = EDriveA; drive <= EDriveZ; drive++ )
- {
- if( !driveList[drive] )
- {
- // If drive-list entry is zero, drive is not available
- continue;
- }
-
- TInt err = iFs.Drive(driveInfo, drive);
-
- // if removable drive, open store
- if (!err && driveInfo.iDriveAtt& KDriveAttRemovable)
- {
- TN_DEBUG2( "CThumbnailServer::OpenRemovableDrive drive=%d", drive);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_OPENREMOVABLEDRIVESL, "CThumbnailServer::OpenRemovableDrivesL;drive=%d", drive );
- StoreForDriveL(drive);
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// Is formatting ongoing
-// -----------------------------------------------------------------------------
-//
-TBool CThumbnailServer::IsFormatting()
- {
- return iFormatting;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::FormatNotification
-// Handles a format operation
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServer::FormatNotification( TBool aFormat )
- {
- TN_DEBUG2( "CThumbnailServer::FormatNotification(%d)", aFormat );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_FORMATNOTIFICATION, "CThumbnailServer::FormatNotification;aFormat=%d", aFormat );
-
- if(aFormat)
- {
- TRAP_IGNORE( CloseRemovableDrivesL() );
- }
- else
- {
- TRAP_IGNORE( OpenRemovableDrivesL() );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::ReconnectCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailServer::ReconnectCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbnailServer::ReconnectCallBack() - reconnect");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_RECONNECTCALLBACK, "CThumbnailServer::ReconnectCallBack - reconnect" );
-
- CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny );
-
- self->iReconnect->Cancel();
-
- if (self->iMdESession)
- {
- delete self->iMdESession;
- self->iMdESession = NULL;
- }
-
- // reconnect to MDS
- TRAP_IGNORE( self->iMdESession = CMdESession::NewL( *self ) );
- self->iSessionError = EFalse;
-
- TN_DEBUG1( "CThumbAGDaemon::ReconnectCallBack() - done");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_RECONNECTCALLBACK, "CThumbnailServer::ReconnectCallBack - done" );
-
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServer::IsPublicPath
-// -----------------------------------------------------------------------------
-//
-
-TBool CThumbnailServer::IsPublicPath( const TDesC& aPath )
- {
- TInt pos = aPath.FindF(KPrivateFolder);
-
- if ( pos == 1 )
- {
- TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_ISPUBLICPATH, "CThumbnailServer::IsPublicPath - NO" );
- return EFalse;
- }
-
- pos = aPath.FindF(KSysFolder);
- if ( pos == 1 )
- {
- TN_DEBUG1( "CThumbnailServer::IsPublicPath() NO");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_ISPUBLICPATH, "CThumbnailServer::IsPublicPath - NO" );
- return EFalse;
- }
-
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::StartUnmount()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServer::StartUnmountTimeout( const TInt aDrive)
- {
- TN_DEBUG2( "CThumbnailServer::StartUnmountTimeout(%d)", aDrive);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVER_STARTUNMOUNTTIMEOUT, "CThumbnailServer::StartUnmountTimeout;aDrive=%d", aDrive );
-
- if(iUnmount )
- {
- if(iUnmountedDrives.Find( aDrive ) == KErrNotFound)
- {
- iUnmountedDrives.Append( aDrive );
- }
-
- if(iUnmount->IsActive())
- {
- iUnmount->Cancel();
- }
-
- TN_DEBUG1( "CThumbnailServer::StartUnmountTimeout() start unmount timer");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_STARTUNMOUNTTIMEOUT, "CThumbnailServer::StartUnmountTimeout - start unmount timer" );
- iUnmount->Start( KUnmountTimerTimeout, KUnmountTimerTimeout, TCallBack(UnmountCallBack, this));
- }
- __ASSERT_DEBUG(( iUnmount ), ThumbnailPanic( EThumbnailNullPointer ));
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailServer::UnmountCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailServer::UnmountCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbnailServer::UnmountCallBack() - unmount finished");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVER_UNMOUNTCALLBACK, "CThumbnailServer::UnmountCallBack - unmount finished" );
-
- CThumbnailServer* self = static_cast<CThumbnailServer*>( aAny );
-
- self->iUnmount->Cancel();
-
- self->iUnmountedDrives.Reset();
-
- TN_DEBUG1( "CThumbAGDaemon::UnmountCallBack() - done");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVER_UNMOUNTCALLBACK, "CThumbnailServer::UnmountCallBack - done" );
-
- return KErrNone;
- }
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1663 +0,0 @@
-/*
-* 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: Server side session for Thumbnail Manager Server
- *
-*/
-
-#include <imageconversion.h>
-
-#include "thumbnailserversession.h"
-#include "thumbnailserver.h"
-#include "thumbnailtaskprocessor.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailgeneratetask.h"
-#include "thumbnailscaletask.h"
-#include "thumbnaildecodetask.h"
-#ifdef RD_MDS_2_5
-#include "thumbnailmdsquerytask.h"
-#endif // RD_MDS_2_5
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-
-#include "thumbnailcenrep.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailserversessionTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailServerSession::CThumbnailServerSession()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailServerSession::CThumbnailServerSession(): CSession2()
- {
- iBitmapHandle = 0;
- iBitmap = NULL;
- iBuffer = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailServerSession::~CThumbnailServerSession()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailServerSession::~CThumbnailServerSession()
- {
- Server()->DropSession(this);
- delete iBitmap;
- iBitmap = NULL;
- delete iBuffer;
- iBuffer = NULL;
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::DispatchMessageL()
-// Message dispatcher.
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServerSession::DispatchMessageL( const RMessage2& aMessage )
- {
- TInt err( KErrNone );
-
- switch ( aMessage.Function())
- {
- case ERequestThumbByFileHandleAsync:
- {
- RequestThumbByFileHandleAsyncL( aMessage );
- break;
- }
- case ERequestThumbByPathAsync:
- {
- RequestThumbByPathAsyncL( aMessage );
- break;
- }
- case ERequestSetThumbnailByBuffer:
- {
- RequestSetThumbnailByBufferL( aMessage );
- break;
- }
- case ERequestSetThumbnailByBitmap:
- {
- RequestSetThumbnailByBitmapL( aMessage );
- break;
- }
- case EReleaseBitmap:
- {
- ReleaseBitmap( aMessage );
- break;
- }
- case ECancelRequest:
- {
- err = CancelRequest( aMessage );
- break;
- }
- case EChangePriority:
- {
- err = ChangePriority( aMessage );
- break;
- }
- case EDeleteThumbnails:
- {
- DeleteThumbnailsL( aMessage );
- break;
- }
- case EDeleteThumbnailsById:
- {
- DeleteThumbnailsByIdL( aMessage );
- break;
- }
- case EGetMimeTypeBufferSize:
- {
- GetMimeTypeBufferSizeL( aMessage );
- break;
- }
- case EGetMimeTypeList:
- {
- GetMimeTypeListL( aMessage );
- break;
- }
- case ERequestThumbByIdAsync:
- {
- RequestThumbByIdAsyncL( aMessage );
- break;
- }
- case EUpdateThumbnails:
- {
- UpdateThumbnailsL( aMessage );
- break;
- }
- case ERenameThumbnails:
- {
- RenameThumbnailsL( aMessage );
- break;
- }
- default:
- {
- err = KErrUnknown;
- break;
- }
- }
-
- return err;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailServerSession::CreateL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServerSession::CreateL()
- {
- TN_DEBUG2( "CThumbnailServerSession::AddSession() = 0x%08x", this );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CREATEL, "CThumbnailServerSession::CreateL;this=%o", this );
-
- Server()->AddSession();
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::ServiceL()
-// Handles service request messages from clients.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::ServiceL( const RMessage2& aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::ServiceL() - begin" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - begin" );
-
- __ASSERT_DEBUG( !iMessage.Handle(), ThumbnailPanic(EThumbnailMessageNotCompleted));
- if ( iMessage.Handle())
- {
- iMessage.Complete( KErrUnknown );
- iMessage = RMessage2();
- }
-
- iMessage = aMessage;
-
- if ( iMessage.Handle())
- {
- // get client thread
- TInt err = iMessage.Client( iClientThread );
- if (err != KErrNone)
- {
- TN_DEBUG1( "CThumbnailServerSession::ServiceL() - client thread not found");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - client thread not found" );
-
- iMessage = RMessage2();
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailServerSession::ServiceL() - message null");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - message null" );
- }
-
- // clean up possible trash
- if (iBitmapHandle)
- {
- Server()->DeleteBitmapFromPool( iBitmapHandle );
- iBitmapHandle = 0;
- }
- delete iBitmap;
- iBitmap = NULL;
- delete iBuffer;
- iBuffer = NULL;
- iOriginalSize = TSize();
-
- TInt ret = KErrNone;
-
- TRAPD( err, ret = DispatchMessageL( aMessage ) );
-
- // if message was not completed, or Leave occurred
- if ( iMessage.Handle())
- {
- if ( ClientThreadAlive() )
- {
- iMessage.Complete( ConvertSqlErrToE32Err( err != KErrNone ? err : ret ));
- }
-
- iMessage = RMessage2();
- }
-
- // close thread handle
- iClientThread.Close();
-
- TN_DEBUG1( "CThumbnailServerSession::ServiceL() - end" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_SERVICEL, "CThumbnailServerSession::ServiceL - end" );
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::Server()
-// Returns the server pointer.
-// -----------------------------------------------------------------------------
-//
-CThumbnailServer* CThumbnailServerSession::Server()
- {
- return ( CThumbnailServer* )( CSession2::Server());
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::Cancel()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::Cancel()
- {
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::UpdateThumbnailsL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::UpdateThumbnailsL( const RMessage2& aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL" );
-
- if(aMessage.Int1() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- // read message params
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
- TBool finished = Server()->UpdateThumbnailsL( params.iFileName, params.iOrientation, params.iModified );
-
- RArray < TThumbnailPersistentSize >* missingSizes = NULL;
-
- TBool gridSizeOnly(EFalse);
-
- if ( params.iQualityPreference == CThumbnailManager
- ::EOptimizeForQualityWithPreview )
- {
- gridSizeOnly = ETrue;
- }
-
- if (finished)
- {
- // source type
- TDataType mimeType;
- TInt sourceType = 0;
- TInt err = Server()->MimeTypeFromFileExt( params.iFileName, mimeType );
-
- // need to use recognizer
- if (err == KErrNotFound)
- {
- Server()->Fs().ShareProtected();
- RFile64 file;
- CleanupClosePushL( file );
-
- User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters ));
- TN_DEBUG2( "CThumbnailServerSession::UpdateThumbnailsL - file handle opened for %S", ¶ms.iFileName );
-
- mimeType = Server()->ResolveMimeTypeL(file);
-
- file.Close();
- TN_DEBUG1("CThumbnailServerSession::UpdateThumbnailsL - file handle closed");
-
- CleanupStack::Pop( &file );
- }
-
- // get missing sizes
- if ( ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
- {
- sourceType = Server()->SourceTypeFromMimeType( mimeType );
-
- missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
- CleanupClosePushL( *missingSizes );
-
- Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly );
-
- if ( missingSizes->Count() == 0)
- {
- // all thumbs already exist
- CleanupStack::PopAndDestroy( missingSizes );
- delete missingSizes;
- missingSizes = NULL;
- }
- }
-
- if(!missingSizes)
- {
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 1" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL - finished part 1" );
- aMessage.Complete( KErrNone );
- }
- else
- {
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL - some sizes missing..." );
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - some sizes missing..." );
- }
- }
-
- if (missingSizes || !finished)
- {
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - need to create (some) thumbs" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL - need to create (some) thumbs" );
-
- if(missingSizes)
- {
- CleanupStack::PopAndDestroy( missingSizes );
- delete missingSizes;
- missingSizes = NULL;
- }
-
- if(Server()->StoreForPathL(params.iFileName)->IsDiskFull())
- {
- User::Leave( KErrDiskFull );
- }
-
- // need to create new thumbs
- aMessage.Complete( KThumbnailErrThumbnailNotFound );
- }
- else
- {
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 2" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVERSESSION_UPDATETHUMBNAILSL, "CThumbnailServerSession::UpdateThumbnailsL - finished part 2" );
- }
-
- iMessage = RMessage2();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::RenameThumbnailsL()
-// Rename thumbnails.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::RenameThumbnailsL( const RMessage2& aMessage )
- {
- if(aMessage.Int1() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::RenameThumbnailsL() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_RENAMETHUMBNAILSL, "CThumbnailServerSession::RenameThumbnailsL - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- // read message params
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
- // renaming only inside one store
- if (params.iFileName.Left(1).CompareF( params.iTargetUri.Left(1) ) == 0)
- {
- Server()->RenameThumbnailsL( params.iFileName, params.iTargetUri );
-
- aMessage.Complete( KErrNone );
- }
- else
- {
- aMessage.Complete( KErrNotSupported );
- }
-
- iMessage = RMessage2();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::RequestThumbByIdAsyncL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::RequestThumbByIdAsyncL( const RMessage2&
- aMessage )
- {
-#ifdef _DEBUG
- TTime aStart, aStop;
- aStart.UniversalTime();
-#endif
-
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByIdAsyncL() - begin" );
-
- if(aMessage.Int1() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByIdAsync() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYIDASYNCL, "CThumbnailServerSession::RequestThumbByIdAsyncL - leaving" );
- User::Leave(KErrArgument);
- }
-
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
-#ifdef RD_MDS_2_5
- // try to query path from MDS
- CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
- Server()->Processor(), params.iPriority + 1, Server()->GetMdESession(), *Server());
-
- CleanupStack::PushL( task );
- task->QueryPathByIdL(params.iThumbnailId, EFalse);
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ), iMessage, iClientThread );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-
- // query task is now responsible for completing the message
- iMessage = RMessage2();
-#else
- User::Leave(KErrNotSupported);
-#endif // RD_MDS_2_5
-
-
-#ifdef _DEBUG
- aStop.UniversalTime();
- TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailServerSession::RequestThumbByIdAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYIDASYNCL, "CThumbnailServerSession::RequestThumbByIdAsyncL;tookTime=%d", tookTime );
-#endif
-
- TN_DEBUG1("CThumbnailServerSession::RequestThumbByIdAsyncL() - end" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYIDASYNCL, "CThumbnailServerSession::RequestThumbByIdAsyncL - end" );
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::RequestThumbByFileHandleAsync()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::RequestThumbByFileHandleAsyncL( const RMessage2&
- aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL" );
-
- if(aMessage.Int1() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsync() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
- RFile64 file;
- CleanupClosePushL(file);
- User::LeaveIfError( file.AdoptFromClient( aMessage, 2, 3 ));
-
- ResolveMimeTypeL(&file);
-
- if(params.iThumbnailSize == EFullScreenThumbnailSize ||
- params.iThumbnailSize == EGridThumbnailSize ||
- params.iThumbnailSize == EListThumbnailSize )
- {
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- sourceType = Server()->SourceTypeFromMimeType( params.iMimeType );
- ModifyThumbnailSize(sourceType);
- }
-
- // delete existing
- if(params.iImport && params.iOverwrite)
- {
- Server()->DeleteThumbnailsL( params.iTargetUri);
- }
-
- // CreateThumbnails
- if (params.iControlFlags == EThumbnailGeneratePersistentSizesOnly)
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - EThumbnailGeneratePersistentSizesOnly" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - EThumbnailGeneratePersistentSizesOnly" );
- CreateGenerateTaskFromFileHandleL( &file );
-
- // ownership of the file transferred
- CleanupStack::Pop(&file);
- }
- // single thumbnail request
- else
- {
- TRAPD( err, FetchThumbnailL());
-
- if( err == KErrCompletion )
- {
- // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail blacklisted" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - thumbnail blacklisted" );
-
- aMessage.Complete( err );
- iMessage = RMessage2();
-
- // close file
- CleanupStack::PopAndDestroy(&file);
- }
- else if ( !err && iBitmap )
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - bitmap " );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - found existing thumbnail - bitmap " );
-
- // Thumbnail already stored
- CleanupStack::PopAndDestroy(&file);
- TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed" );
-
- ProcessBitmapL();
- }
- else if ( (err == KErrNotFound || err == KErrAccessDenied) &&
- !(params.iFlags& CThumbnailManager::EDoNotCreate) )
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - KErrNotFound & !EDoNotCreate" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - KErrNotFound & !EDoNotCreate" );
- CreateGenerateTaskFromFileHandleL( &file);
-
- // ownership of the file transferred
- CleanupStack::Pop(&file);
- }
- else if (!err && iBuffer)
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - found existing thumbnail - jpeg " );
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - found existing thumbnail - jpeg" );
-
- CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
- ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
-
- CleanupStack::PushL( task );
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ), iMessage, iClientThread );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-
- // Decode task is now responsible for completing the message
- iMessage = RMessage2();
-
- //CThumbnailDecodeTask is responsible freeing
- iBuffer = NULL;
-
- // close file
- CleanupStack::PopAndDestroy(&file);
- TN_DEBUG1("CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed");
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - file handle closed" );
- }
- else
- {
- TN_DEBUG2( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - thumbnail not found, err=%d", err );
- OstTrace1( TRACE_NORMAL, DUP9_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYFILEHANDLEASYNCL, "CThumbnailServerSession::RequestThumbByFileHandleAsyncL - thumbnail not found;err=%d", err );
-
- aMessage.Complete( ConvertSqlErrToE32Err( err ));
- iMessage = RMessage2();
-
- // close file
- CleanupStack::PopAndDestroy(&file);
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::RequestThumbByPathAsync()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::RequestThumbByPathAsyncL( const RMessage2&
- aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL" );
-
-#ifdef _DEBUG
- TTime aStart, aStop;
- aStart.UniversalTime();
-#endif
-
- if(aMessage.Int1() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsync() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
- ResolveMimeTypeL(NULL);
-
- if(params.iThumbnailSize == EFullScreenThumbnailSize ||
- params.iThumbnailSize == EGridThumbnailSize ||
- params.iThumbnailSize == EListThumbnailSize )
- {
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- sourceType = Server()->SourceTypeFromMimeType( params.iMimeType );
- ModifyThumbnailSize(sourceType);
- }
-
- // should always be true
- if (params.iControlFlags != EThumbnailGeneratePersistentSizesOnly)
- {
- TRAPD( err, FetchThumbnailL());
-
- if ( !err && iBitmap )
- {
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByPathAsyncL() - found existing thumbnail- bitmap" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - found existing thumbnail- bitmap" );
-
- ProcessBitmapL();
- }
- else if ( !err && iBuffer)
- {
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByPathAsyncL() - found existing thumbnail- jpeg" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - found existing thumbnail- jpeg" );
-
- CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
- ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
-
- CleanupStack::PushL( task );
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ), iMessage, iClientThread );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-
- // Decode task is now responsible for completing the message
- iMessage = RMessage2();
-
- //CThumbnailDecodeTask is responsible freeing
- iBuffer = NULL;
- }
- else if( err == KErrCompletion )
- {
- // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
- TN_DEBUG1( "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - thumbnail blacklisted" );
-
- aMessage.Complete( err );
- iMessage = RMessage2();
- }
- else
- {
- TN_DEBUG2(
- "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail not found, err = %d", err );
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL - thumbnail not found;err=%d", err );
-
- // don't try to create from virtual URI
- if ( params.iVirtualUri )
- {
- User::Leave(err);
- }
-
- // disk space check only for stored sizes
- if ( params.iThumbnailSize != ECustomThumbnailSize &&
- Server()->StoreForPathL(params.iFileName)->IsDiskFull() )
- {
- User::Leave( KErrDiskFull );
- }
-
- if ( (err == KErrNotFound || err == KErrAccessDenied) &&
- !(params.iFlags& CThumbnailManager::EDoNotCreate) )
- {
- // Special error code so that the client side can open the file
- // and retry the request using file handle
- err = KThumbnailErrThumbnailNotFound;
- }
-
- User::Leave(err);
- }
- }
-
-#ifdef _DEBUG
- aStop.UniversalTime();
- TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailStore::RequestThumbByPathAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILSERVERSESSION_REQUESTTHUMBBYPATHASYNCL, "CThumbnailServerSession::RequestThumbByPathAsyncL;tookTime=%d", tookTime );
-#endif
- }
-
-void CThumbnailServerSession::RequestSetThumbnailByBufferL( const RMessage2& aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBufferL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBUFFERL, "CThumbnailServerSession::RequestSetThumbnailByBufferL" );
-
- if(aMessage.Int3() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBufferL() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBUFFERL, "CThumbnailServerSession::RequestSetThumbnailByBufferL - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
- // delete existing
- if(params.iOverwrite)
- {
- Server()->DeleteThumbnailsL( params.iTargetUri);
- }
-
- // if only one size
- if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0)
- {
- if(params.iThumbnailSize == EFullScreenThumbnailSize ||
- params.iThumbnailSize == EGridThumbnailSize ||
- params.iThumbnailSize == EListThumbnailSize )
- {
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- TDataType mimetype;
- TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
-
- if( ret == KErrNone )
- {
- sourceType = Server()->SourceTypeFromMimeType( mimetype );
- ModifyThumbnailSize(sourceType);
- }
- User::LeaveIfError( ret );
- }
- }
-
- TInt bufferSize = aMessage.Int2();
- HBufC8* buffer = HBufC8::NewMaxLC( bufferSize );
- TPtr8 ptr = buffer->Des();
- aMessage.ReadL( 1 /* buffer pointer */, ptr );
-
- CreateGenerateTaskFromBufferL( buffer );
- CleanupStack::Pop( buffer );
- }
-
-void CThumbnailServerSession::RequestSetThumbnailByBitmapL( const RMessage2& aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBITMAPL, "CThumbnailServerSession::RequestSetThumbnailByBitmapL" );
-
- if(aMessage.Int2() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBITMAPL, "CThumbnailServerSession::RequestSetThumbnailByBitmapL - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
- const TThumbnailServerRequestId reqId( this, params.iRequestId );
-
- // delete existing
- if(params.iOverwrite)
- {
- Server()->DeleteThumbnailsL( params.iTargetUri);
- }
-
- // if only one size
- if ((params.iControlFlags & EThumbnailGeneratePersistentSizesOnly) == 0)
- {
- if(params.iThumbnailSize == EFullScreenThumbnailSize ||
- params.iThumbnailSize == EGridThumbnailSize ||
- params.iThumbnailSize == EListThumbnailSize )
- {
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- TDataType mimetype;
- TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
-
- if( ret == KErrNone )
- {
- sourceType = Server()->SourceTypeFromMimeType( mimetype );
- ModifyThumbnailSize(sourceType);
- }
- User::LeaveIfError( ret );
- }
- }
-
- TInt bitmapHandle = aMessage.Int1();
-
- // get bitmap
- CFbsBitmap* bitmap = new( ELeave )CFbsBitmap();
- CleanupStack::PushL( bitmap );
- User::LeaveIfError( bitmap->Duplicate( bitmapHandle ) );
-
- // use pool to prevent bitmap leak
- // this bitmap is shared to several scale tasks, one of which can Leave
- Server()->AddBitmapToPoolL( this, bitmap, reqId );
-
- CleanupStack::Pop( bitmap );
- iBitmapHandle = bitmap->Handle();
-
- RArray < TThumbnailPersistentSize >* missingSizes = NULL;
-
- // source type
- TDataType mimeType;
- TInt sourceType = 0;
- TInt err = Server()->MimeTypeFromFileExt( params.iTargetUri, mimeType );
-
- // get missing sizes
- if ( err == KErrNone && ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
- {
- sourceType = Server()->SourceTypeFromMimeType( mimeType );
-
- missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
- CleanupClosePushL( *missingSizes );
-
- Server()->GetMissingSizesL( params.iTargetUri, sourceType, *missingSizes, EFalse);
-
- if ( missingSizes->Count() == 0)
- {
- // all thumbs already exist
- CleanupStack::PopAndDestroy( missingSizes );
- delete missingSizes;
- missingSizes = NULL;
- }
- }
-
- // if missing sizes, create scale tasks
- if ( missingSizes )
- {
- const TInt count = missingSizes->Count();
-
- TSize bitmapSize = bitmap->SizeInPixels();
-
- // scale small thumbs first, because fullscreen encoding takes longer
- for ( TInt i( count-1 ); i >= 0; i-- )
- {
- if( bitmapSize.iWidth < bitmapSize.iHeight )
- {
- TThumbnailSize size = (*missingSizes)[ i ].iType;
-
- if ( size == EFullScreenThumbnailSize ||
- size == EVideoFullScreenThumbnailSize ||
- size == EAudioFullScreenThumbnailSize ||
- size == EImageFullScreenThumbnailSize ||
- size == EContactFullScreenThumbnailSize )
- {
- TInt height = (*missingSizes)[i].iSize.iHeight;
- (*missingSizes)[i].iSize.iHeight = (*missingSizes)[i].iSize.iWidth;
- (*missingSizes)[i].iSize.iWidth = height;
-
- TN_DEBUG1( "CThumbnailServerSession::RequestSetThumbnailByBitmapL() - portrait");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_REQUESTSETTHUMBNAILBYBITMAPL, "CThumbnailServerSession::RequestSetThumbnailByBitmapL - portrait" );
- }
- }
-
- CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( Server()->Processor(),
- *Server(), params.iTargetUri, bitmap, bitmapSize,
- (*missingSizes)[i].iSize, (*missingSizes)[i].iCrop, params.iDisplayMode,
- KMaxPriority, KNullDesC, (*missingSizes)[i].iType, params.iModified, EFalse, EFalse,
- reqId, params.iVirtualUri);
-
- CleanupStack::PushL( scaleTask );
- scaleTask->SetDoStore( ETrue );
- Server()->Processor().AddTaskL( scaleTask );
- CleanupStack::Pop( scaleTask );
-
- // completion to first task, because task processor works like stack
- if( i == 0 )
- {
- // scaleTask is now responsible for completing the RMessage
- scaleTask->SetMessageData( reqId, iMessage, iClientThread );
- iMessage = RMessage2();
- }
- }
- }
- else
- {
- // complete message
- aMessage.Complete( KErrNone );
- iMessage = RMessage2();
- }
-
- if ( missingSizes )
- {
- CleanupStack::PopAndDestroy( missingSizes );
- delete missingSizes;
- missingSizes = NULL;
- }
-
- // Scale tasks now reference the bitmap in the pool
- Server()->DeleteBitmapFromPool( iBitmapHandle );
- iBitmapHandle = 0;
- bitmap = NULL;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::CreateGenerateTaskL()
-// Create a task to generate a new thumbnail
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::CreateGenerateTaskFromFileHandleL( RFile64* aFile)
- {
- TThumbnailRequestParams& params = iRequestParams();
-
- TN_DEBUG2(
- "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() -- create thumbnail generation task for %S", ¶ms.iFileName );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMFILEHANDLEL, "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL -- create thumbnail generation task for;params.iFileName=%S", params.iFileName );
-
- // disk space check only for stored sizes
- if ( params.iImport &&
- Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
- {
- User::Leave( KErrDiskFull );
- }
- else if ( params.iThumbnailSize != ECustomThumbnailSize &&
- Server()->StoreForPathL(params.iFileName)->IsDiskFull() )
- {
- User::Leave( KErrDiskFull );
- }
-
- RArray < TThumbnailPersistentSize >* missingSizes = NULL;
-
- // get missing sizes
- if ( ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
- {
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
- sourceType = Server()->SourceTypeFromMimeType( params.iMimeType );
- missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
- CleanupClosePushL( *missingSizes );
-
- TBool gridSizeOnly(EFalse);
-
- if ( params.iQualityPreference == CThumbnailManager::EOptimizeForQualityWithPreview )
- {
- gridSizeOnly = ETrue;
- }
-
- // import vs. normal
- if(params.iImport)
- {
- Server()->GetMissingSizesL( params.iTargetUri, sourceType, *missingSizes, gridSizeOnly);
- }
- else
- {
- Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly);
- }
-
- if ( missingSizes->Count() == 0)
- {
- // all thumbs already exist
- CleanupStack::PopAndDestroy( missingSizes );
- delete missingSizes;
- missingSizes = NULL;
-
- if( aFile )
- {
- aFile->Close();
- }
- return;
- }
- }
- // creating single TN on demand
- else if( params.iThumbnailSize > ECustomThumbnailSize && params.iThumbnailSize < EThumbnailSizeCount)
- {
- TThumbnailPersistentSize persistentSize = Server()->PersistentSizeL(params.iThumbnailSize);
-
- if(persistentSize.iCrop)
- {
- params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags | CThumbnailManager::ECropToAspectRatio);
- }
- else
- {
- params.iFlags = ( CThumbnailManager::TThumbnailFlags ) (params.iFlags & CThumbnailManager::ECropToAspectRatio);
- }
-
- if( ClientThreadAlive() )
- {
- iMessage.Write( 0, iRequestParams );
- }
- }
-
- // priority
- TInt priority = params.iPriority;
- if ( priority > KMaxGeneratePriority )
- {
- priority = KMaxGeneratePriority;
- }
-
- // create new task
- if( !aFile)
- {
- TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() - KErrArgument");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMFILEHANDLEL, "CThumbnailServerSession::CreateGenerateTaskFromFileHandleL - KErrArgument" );
- User::Leave( KErrArgument );
- }
- CleanupClosePushL( *aFile );
- CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
- ->Processor(), * Server(), aFile, NULL, ¶ms.iMimeType, params.iFlags,
- params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
- params.iThumbnailSize, params.iModified, params.iQualityPreference,
- params.iVirtualUri);
-
- // do not store bitmaps to server pool when generating only
- if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
- {
- task->ScaledBitmapToPool( EFalse );
- }
-
- CleanupStack::Pop( aFile );
-
- CleanupStack::PushL( task );
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ),iMessage, iClientThread );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-
- if ( missingSizes )
- {
- CleanupStack::Pop( missingSizes );
- }
-
- // Generate task is now responsible for completing the message
- iMessage = RMessage2();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::CreateGenerateTaskL()
-// Create a task to generate a new thumbnail
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::CreateGenerateTaskFromBufferL( TDesC8* aBuffer )
- {
- const TThumbnailRequestParams& params = iRequestParams();
-
- TN_DEBUG2(
- "CThumbnailServerSession::CreateGenerateTaskFromBufferL() -- create thumbnail generation task for %S", ¶ms.iTargetUri );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL - -- create thumbnail generation task for;params.iTargetUri=%S", params.iTargetUri );
-
- // disk space check only for stored sizes
- if ( params.iThumbnailSize != ECustomThumbnailSize &&
- Server()->StoreForPathL(params.iTargetUri)->IsDiskFull() )
- {
- User::Leave( KErrDiskFull );
- }
-
- if(aBuffer && params.iMimeType.Des().Match( KVideoMime ) == 0 )
- {
- User::Leave( KErrNotSupported );
- }
-
- TInt sourceType = TThumbnailPersistentSize::EUnknownSourceType;
-
- TDataType mimetype;
- TInt ret = Server()->MimeTypeFromFileExt( params.iTargetUri, mimetype );
- if(ret == KErrNotFound)
- {
- Server()->Fs().ShareProtected();
- RFile64 file;
- CleanupClosePushL( file );
-
- User::LeaveIfError( file.Open( Server()->Fs(), params.iTargetUri, EFileShareReadersOrWriters ));
- TN_DEBUG2( "CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle opened for %S", ¶ms.iFileName );
- OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL;params.iFileName=%S", params.iFileName );
-
- mimetype = Server()->ResolveMimeTypeL(file);
-
- file.Close();
- TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle closed");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL - file handle closed" );
-
- CleanupStack::Pop( &file );
- }
-
- sourceType = Server()->SourceTypeFromMimeType( mimetype );
-
- RArray < TThumbnailPersistentSize >* missingSizes = NULL;
-
- // get missing sizes
- if ( ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
- {
- missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
- CleanupClosePushL( *missingSizes );
-
- Server()->GetMissingSizesL( params.iTargetUri, sourceType, *missingSizes, EFalse );
-
- if ( missingSizes->Count() == 0)
- {
- // all thumbs already exist
- CleanupStack::PopAndDestroy( missingSizes );
- delete missingSizes;
- missingSizes = NULL;
-
- if ( aBuffer)
- {
- delete aBuffer;
- aBuffer = NULL;
- }
- return;
- }
- }
-
- // priority
- TInt priority = params.iPriority;
- if ( priority > KMaxGeneratePriority )
- {
- priority = KMaxGeneratePriority;
- }
-
- // create new task
- if( !aBuffer)
- {
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - KErrArgument" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSERVERSESSION_CREATEGENERATETASKFROMBUFFERL, "CThumbnailServerSession::CreateGenerateTaskFromBufferL - KErrArgument" );
- User::Leave( KErrArgument );
- }
-
- CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
- ->Processor(), * Server(), NULL, aBuffer, ¶ms.iMimeType, params.iFlags,
- params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
- params.iThumbnailSize, params.iModified, params.iQualityPreference,
- params.iVirtualUri);
-
- // do not store bitmaps to server pool when generating only
- if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
- {
- task->ScaledBitmapToPool( EFalse );
- }
-
- CleanupStack::PushL( task );
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ),iMessage, iClientThread );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-
- if ( missingSizes )
- {
- CleanupStack::Pop( missingSizes );
- }
-
- // Generate task is now responsible for completing the message
- iMessage = RMessage2();
- }
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::FetchThumbnailL()
-// Fetch thumbnail data from database
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::FetchThumbnailL()
- {
- TN_DEBUG1("CThumbnailServerSession::FetchThumbnailL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_FETCHTHUMBNAILL, "CThumbnailServerSession::FetchThumbnailL" );
- __ASSERT_DEBUG( !iBitmap, ThumbnailPanic( EThumbnailBitmapNotReleased ));
- __ASSERT_DEBUG( !iBuffer, ThumbnailPanic( EThumbnailBitmapNotReleased ));
-
- delete iBitmap;
- iBitmap = NULL;
- delete iBuffer;
- iBuffer = NULL;
-
- TThumbnailRequestParams& params = iRequestParams();
-
- if ( params.iThumbnailSize != EUnknownThumbnailSize &&
- params.iThumbnailSize != ECustomThumbnailSize )
- {
- TThumbnailPersistentSize & persistentSize = Server()->PersistentSizeL( params.iThumbnailSize );
- params.iSize = persistentSize.iSize;
- }
-
- if( params.iFileName != KNullDesC )
- {
- TN_DEBUG3( "CThumbnailServerSession::FetchThumbnailL( ThumbnailSize=%d ( Path=%S ))",
- params.iThumbnailSize, ¶ms.iFileName );
- OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_FETCHTHUMBNAILL, "CThumbnailServerSession::FetchThumbnailL;params.iFileName=%S", params.iFileName );
- Server()->FetchThumbnailL( params.iFileName, iBitmap, iBuffer, params.iThumbnailSize, iOriginalSize);
- }
- else
- {
- User::Leave( KErrNotSupported );
- }
-#ifdef _DEBUG
- if( iBitmap)
- {
- TN_DEBUG4( "CThumbnailServerSession::FetchThumbnailL() size %d x %d displaymode %d", iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight, iBitmap->DisplayMode());
- OstTraceExt3( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_FETCHTHUMBNAILL, "CThumbnailServerSession::FetchThumbnailL;iBitmap->SizeInPixels().iWidth=%d;iBitmap->SizeInPixels().iHeight=%d;iBitmap->DisplayMode()=%u", iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight, iBitmap->DisplayMode() );
- }
-#endif
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::ProcessBitmapL()
-// Process a fetched bitmap by creating scale tasks or by returning the
-// bitmap as such.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::ProcessBitmapL()
- {
- TThumbnailRequestParams& params = iRequestParams();
-
- if ( ClientThreadAlive() )
- {
- TN_DEBUG2("CThumbnailServerSession::ProcessBitmapL(), iBitmap handle= 0x%08x", iBitmap->Handle());
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_PROCESSBITMAPL, "CThumbnailServerSession::ProcessBitmapL;iBitmap->Handle()=%o", iBitmap->Handle() );
-
- params.iBitmapHandle = iBitmap->Handle();
- const TSize bitmapSize = iBitmap->SizeInPixels();
-
- if ( params.iQualityPreference == CThumbnailManager
- ::EOptimizeForQualityWithPreview && bitmapSize.iWidth <
- params.iSize.iWidth && bitmapSize.iHeight < params.iSize.iHeight &&
- bitmapSize.iWidth < iOriginalSize.iWidth && bitmapSize.iHeight <
- iOriginalSize.iHeight )
- {
- // This is a non-scaled preview bitmap
- params.iControlFlags = EThumbnailPreviewThumbnail;
- }
-
- iMessage.WriteL( 0, iRequestParams );
-
- TN_DEBUG1("CThumbnailServerSession()::ProcessBitmapL() bitmap to pool");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_PROCESSBITMAPL, "CThumbnailServerSession::ProcessBitmapL - bitmap to pool" );
-
- Server()->AddBitmapToPoolL( this, iBitmap, TThumbnailServerRequestId( this, params.iRequestId ) );
-
- iMessage.Complete( KErrNone );
- iMessage = RMessage2();
-
- iBitmap = NULL; // owned by server now
- }
- else
- {
- delete iBitmap;
- iBitmap = NULL;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::ReleaseBitmap()
-// Release bitmap from bitmap pool
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::ReleaseBitmap( const RMessage2& aMessage )
- {
- TN_DEBUG2( "CThumbnailServerSession::ReleaseBitmap(%d)", aMessage.Int0());
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_RELEASEBITMAP, "CThumbnailServerSession::ReleaseBitmap;aMessage.Int0()=%d", aMessage.Int0() );
- Server()->DeleteBitmapFromPool( aMessage.Int0());
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::CancelRequest()
-// Cancel pending request.
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServerSession::CancelRequest( const RMessage2& aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::CancelRequest()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CANCELREQUEST, "CThumbnailServerSession::CancelRequest" );
-
- const TThumbnailServerRequestId requestId( this, aMessage.Int0());
- const TInt err = Server()->DequeTask( requestId );
- TN_DEBUG4(
- "CThumbnailServerSession::CancelRequest(0x%08x/%d) - returning %d",
- requestId.iSession, requestId.iRequestId, err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CANCELREQUEST, "CThumbnailServerSession::CancelRequest;requestId.iSession=%o", requestId.iSession );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CANCELREQUEST, "CThumbnailServerSession::CancelRequest;err=%d", err );
-
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::ChangePriority()
-// Change priority of pending request.
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailServerSession::ChangePriority( const RMessage2& aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::ChangePriority()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CHANGEPRIORITY, "CThumbnailServerSession::ChangePriority" );
-
- const TThumbnailServerRequestId requestId( this, aMessage.Int0());
- const TInt newPriority = aMessage.Int1();
-
- const TInt err = Server()->ChangeTaskPriority( requestId, newPriority );
- TN_DEBUG5(
- "CThumbnailServerSession::ChangePriority(0x%08x/%d, %d) - returning %d",
- requestId.iSession, requestId.iRequestId, newPriority, err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CHANGEPRIORITY, "CThumbnailServerSession::ChangePriority;requestId.iSession=%o", requestId.iSession );
- OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CHANGEPRIORITY, "CThumbnailServerSession::ChangePriority;requestId.iRequestId=%u;err=%d", requestId.iRequestId, err );
-
- return err;
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::DeleteThumbnailsL()
-// Delete thumbnails for given object file
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::DeleteThumbnailsL( const RMessage2& aMessage )
- {
- if(aMessage.Int2() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::DeleteThumbnailsL() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_DELETETHUMBNAILSL, "CThumbnailServerSession::DeleteThumbnailsL - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- HBufC* fileName = HBufC::NewLC( KMaxFileName );
- TPtr ptr = fileName->Des();
- aMessage.ReadL( 1, ptr );
- Server()->DeleteThumbnailsL( ptr );
- CleanupStack::PopAndDestroy( fileName );
-
- aMessage.Complete( KErrNone );
- iMessage = RMessage2();
- }
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::DeleteThumbnailsByIdL()
-// Delete thumbnails by TThumbnailId.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::DeleteThumbnailsByIdL( const RMessage2& aMessage )
- {
- if(aMessage.Int2() != KCheckValue)
- {
- TN_DEBUG1( "CThumbnailServerSession::DeleteThumbnailsByIdL() - error in aMessage - leaving" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_DELETETHUMBNAILSBYIDL, "CThumbnailServerSession::DeleteThumbnailsByIdL - error in aMessage - leaving" );
- User::Leave(KErrArgument);
- }
-
- // read message params
- aMessage.ReadL( 0, iRequestParams );
- const TThumbnailRequestParams& params = iRequestParams();
-
-#ifdef RD_MDS_2_5
- // try to query path from MDS
- CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
- Server()->Processor(), params.iPriority + 1, Server()->GetMdESession(), *Server());
-
- CleanupStack::PushL( task );
- task->QueryPathByIdL(params.iThumbnailId, ETrue);
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ) );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-#endif // RD_MDS_2_5
-
- aMessage.Complete( KErrNone );
- iMessage = RMessage2();
- }
-
-// -----------------------------------------------------------------------------
-// Get the required size (in characters) for a buffer that contains the
-// list of supported MIME types
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::GetMimeTypeBufferSizeL( const RMessage2& aMessage )
- {
- TPckgBuf < TInt > buf;
- buf() = Server()->GetMimeTypeBufferSize();
- aMessage.WriteL( 0, buf );
- }
-
-// -----------------------------------------------------------------------------
-// Get the list of supported MIME types and store them in the buffer
-// allocated by the client.
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::GetMimeTypeListL( const RMessage2& aMessage )
- {
- TN_DEBUG1( "CThumbnailServerSession::GetMimeTypeListL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_GETMIMETYPELISTL, "CThumbnailServerSession::GetMimeTypeListL" );
-
- TInt len = aMessage.GetDesMaxLengthL( 0 );
- HBufC* buf = HBufC::NewLC( len );
- TPtr ptr = buf->Des();
- Server()->GetMimeTypeList( ptr );
- aMessage.WriteL( 0, * buf );
- CleanupStack::PopAndDestroy( buf );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServerSession::ModifyThumbnailSize
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServerSession::ModifyThumbnailSize( TInt aSourceType )
- {
- TThumbnailRequestParams& params = iRequestParams();
- if(aSourceType == TThumbnailPersistentSize::EImage)
- {
- if(params.iThumbnailSize == EFullScreenThumbnailSize)
- {
- params.iThumbnailSize = EImageFullScreenThumbnailSize;
- }
- else if(params.iThumbnailSize == EGridThumbnailSize)
- {
- params.iThumbnailSize = EImageGridThumbnailSize;
- }
- else if(params.iThumbnailSize == EListThumbnailSize)
- {
- params.iThumbnailSize = EImageListThumbnailSize;
- }
- }
- else if(aSourceType == TThumbnailPersistentSize::EVideo)
- {
- if(params.iThumbnailSize == EFullScreenThumbnailSize)
- {
- params.iThumbnailSize = EVideoFullScreenThumbnailSize;
- }
- else if(params.iThumbnailSize == EGridThumbnailSize)
- {
- params.iThumbnailSize = EVideoGridThumbnailSize;
- }
- else if(params.iThumbnailSize == EListThumbnailSize)
- {
- params.iThumbnailSize = EVideoListThumbnailSize;
- }
- }
- else if(aSourceType == TThumbnailPersistentSize::EAudio)
- {
- if(params.iThumbnailSize == EFullScreenThumbnailSize)
- {
- params.iThumbnailSize = EAudioFullScreenThumbnailSize;
- }
- else if(params.iThumbnailSize == EGridThumbnailSize)
- {
- params.iThumbnailSize = EAudioGridThumbnailSize;
- }
- else if(params.iThumbnailSize == EListThumbnailSize)
- {
- params.iThumbnailSize = EAudioListThumbnailSize;
- }
- }
- else if(aSourceType == TThumbnailPersistentSize::EContact)
- {
- if(params.iThumbnailSize == EFullScreenThumbnailSize)
- {
- params.iThumbnailSize = EContactFullScreenThumbnailSize;
- }
- else if(params.iThumbnailSize == EGridThumbnailSize)
- {
- params.iThumbnailSize = EContactGridThumbnailSize;
- }
- else if(params.iThumbnailSize == EListThumbnailSize)
- {
- params.iThumbnailSize = EContactListThumbnailSize;
- }
- }
- }
-
-//------------------------------------------------------------------------
-// CThumbnailServerSession::ModifyThumbnailSize
-// ---------------------------------------------------------------------------
-//
-void CThumbnailServerSession::ResolveMimeTypeL( RFile64* aFile )
- {
- TThumbnailRequestParams& params = iRequestParams();
- TInt res = 0;
-
- // mime type
- if ( params.iMimeType.Des8() == KNullDesC8 && !Server()->SupportedMimeType(params.iMimeType) )
- {
- // try parsing from file extension
- if (params.iImport)
- {
- res = Server()->MimeTypeFromFileExt( params.iTargetUri, params.iMimeType );
- }
- else
- {
- res = Server()->MimeTypeFromFileExt( params.iFileName, params.iMimeType );
- }
-
- if ( res == KErrNotFound )
- {
- if( aFile )
- {
- // parsed type not in the list, resolve from file
- params.iMimeType = Server()->ResolveMimeTypeL(*aFile);
- }
- else
- {
- Server()->Fs().ShareProtected();
- RFile64 file;
- CleanupClosePushL( file );
-
- User::LeaveIfError( file.Open( Server()->Fs(), params.iFileName, EFileShareReadersOrWriters ));
- TN_DEBUG2( "CThumbnailServerSession::ResolveMimeType - file handle opened for %S", ¶ms.iFileName );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_RESOLVEMIMETYPEL, "CThumbnailServerSession::ResolveMimeTypeL - file handle opened;params.iFileName=%S", params.iFileName );
-
- params.iMimeType = Server()->ResolveMimeTypeL(file);
-
- file.Close();
- TN_DEBUG1("CThumbnailServerSession::ResolveMimeType - file handle closed");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_RESOLVEMIMETYPEL, "CThumbnailServerSession::ResolveMimeTypeL - file handle closed" );
-
- CleanupStack::Pop( &file );
- }
- }
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// RThumbnailMessage::FilterSqlErr
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailServerSession::ConvertSqlErrToE32Err( TInt aReason )
- {
- TN_DEBUG2("CThumbnailServerSession::ConvertSqlErrToE32Err(%d)", aReason);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CONVERTSQLERRTOE32ERR, "CThumbnailServerSession::ConvertSqlErrToE32Err;aReason=%d", aReason );
- TInt e32Err(aReason);
-
- if ( aReason >= - 144 )
- // magic: [-1..-144] is E32 error range
- {
- // E32 error value or non-negative value
- switch ( aReason )
- {
- case KErrServerTerminated:
- e32Err = KErrCorrupt;
- break;
- default:
- e32Err = aReason;
- }
- }
- else
- {
- switch ( aReason )
- {
- case KSqlErrGeneral:
- e32Err = KErrGeneral;
- break;
- case KSqlErrInternal:
- e32Err = KErrGeneral;
- break;
- case KSqlErrPermission:
- e32Err = KErrPermissionDenied;
- break;
- case KSqlErrAbort:
- e32Err = KErrAbort;
- break;
- case KSqlErrBusy:
- e32Err = KErrServerBusy;
- break;
- case KSqlErrLocked:
- e32Err = KErrLocked;
- break;
- case KSqlErrReadOnly:
- e32Err = KErrAccessDenied;
- break;
- case KSqlErrInterrupt:
- e32Err = KErrAbort;
- break;
- case KSqlErrIO:
- e32Err = KErrGeneral;
- break;
- case KSqlErrCorrupt:
- e32Err = KErrCorrupt;
- break;
- case KSqlErrNotFound:
- e32Err = KErrNotFound;
- break;
- case KSqlErrFull:
- e32Err = KErrOverflow;
- break;
- case KSqlErrCantOpen:
- e32Err = KErrCouldNotConnect;
- break;
- case KSqlErrProtocol:
- e32Err = KErrLocked;
- break;
- case KSqlErrEmpty:
- e32Err = KErrNotFound;
- break;
- case KSqlErrSchema:
- e32Err = KErrAbort;
- break;
- case KSqlErrTooBig:
- e32Err = KErrTooBig;
- break;
- case KSqlErrConstraint:
- e32Err = KErrGeneral;
- break;
- case KSqlErrMismatch:
- e32Err = KErrGeneral;
- break;
- case KSqlErrMisuse:
- e32Err = KErrGeneral;
- break;
- case KSqlErrRange:
- e32Err = KErrOverflow;
- break;
- case KSqlErrNotDb:
- e32Err = KErrCorrupt;
- break;
- case KSqlErrStmtExpired:
- e32Err = KErrAbort;
- break;
- default:
- e32Err = aReason;
- }
- }
- return e32Err;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailServerSession::ClientThreadAlive()
-// Checks if client thread is still alive and RMessage2 handle valid.
-// ---------------------------------------------------------------------------
-//
-TBool CThumbnailServerSession::ClientThreadAlive()
- {
- TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSERVERSESSION_CLIENTTHREADALIVE, "CThumbnailServerSession::ClientThreadAlive" );
-
- if ( iMessage.Handle())
- {
- // check if client thread alive
- TExitType exitType = iClientThread.ExitType();
-
- if( exitType != EExitPending )
- {
- TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - client thread died");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSERVERSESSION_CLIENTTHREADALIVE, "CThumbnailServerSession::ClientThreadAlive - client thread died" );
-
- iMessage = RMessage2();
-
- return EFalse;
- }
- else
- {
- // all OK
- return ETrue;
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailServerSession::ClientThreadAlive() - message null");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSERVERSESSION_CLIENTTHREADALIVE, "CThumbnailServerSession::ClientThreadAlive - message null" );
- return EFalse;
- }
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3258 +0,0 @@
-/*
-* 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: Store for thumbnails.
- *
-*/
-
-
-#include <s32mem.h>
-#include <e32cmn.h>
-#include <fbs.h>
-#include <imageconversion.h>
-#include <e32base.h>
-#include <ExifRead.h>
-#include <bautils.h>
-#include <IclExtJpegApi.h>
-
-#include "thumbnailstore.h"
-#include "thumbnailsql.h"
-#include "thumbnaillog.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnailcenrep.h"
-#include "thumbnailpanic.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailserver.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailstoreTraces.h"
-#endif
-
-
-
-_LIT8( KThumbnailSqlConfig, "page_size=32768; cache_size=64;" );
-
-const TInt KStreamBufferSize = 1024 * 8;
-const TInt KMajor = 3;
-const TInt KMinor = 2;
-
-const TInt KStoreUnrecoverableErr = KErrCorrupt;
-
-// Database path without drive letter
-//Symbian^4 v5
-_LIT( KThumbnailDatabaseName, ":[102830AB]thumbnail_v5.db" );
-
-
-// Allow access to database only for the server process
-const TSecurityPolicy KThumbnailDatabaseSecurityPolicy( TSecureId(
- THUMBNAIL_MANAGER_SERVER_UID ));
-
-
-// ---------------------------------------------------------------------------
-// RThumbnailTransaction::RThumbnailTransaction::TThumbnailPersistentSize
-// ---------------------------------------------------------------------------
-//
-RThumbnailTransaction::RThumbnailTransaction( RSqlDatabase& aDatabase ):
- iDatabase( aDatabase ), iState( EClosed )
- {
- // No implementation required
- }
-
-// ---------------------------------------------------------------------------
-// RThumbnailTransaction::BeginL()
-// ---------------------------------------------------------------------------
-//
-void RThumbnailTransaction::BeginL()
- {
- if (iDatabase.InTransaction())
- {
- TN_DEBUG1( "RThumbnailTransaction::BeginL() - error: old transaction open!" );
- OstTrace0( TRACE_NORMAL, RTHUMBNAILTRANSACTION_BEGINL, "RThumbnailTransaction::BeginL - error: old transaction open!" );
- __ASSERT_DEBUG(( !iDatabase.InTransaction() ), ThumbnailPanic( EThumbnailSQLTransaction ));
-
- // old transaction already open, don't open another
- iState = EOldOpen;
-
- return;
- }
-
- const TInt err = iDatabase.Exec( KThumbnailBeginTransaction );
- if ( err >= 0 )
- {
- iState = EOpen;
- }
- else
- {
- iState = EError;
-#ifdef _DEBUG
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG3( "RThumbnailTransaction::BeginL() lastError %S, ret = %d" , &errorMsg, err);
- OstTraceExt2( TRACE_NORMAL, DUP1_RTHUMBNAILTRANSACTION_BEGINL, "RThumbnailTransaction::BeginL - lastError;errorMsg=%S;err=%d", errorMsg, err );
-#endif
- User::Leave( err );
- }
- }
-
-// ---------------------------------------------------------------------------
-// RThumbnailTransaction::Close()
-// ---------------------------------------------------------------------------
-//
-void RThumbnailTransaction::Close()
- {
- if ( iState != EClosed && iState != EOldOpen )
- {
- Rollback();
- }
- }
-
-// ---------------------------------------------------------------------------
-// RThumbnailTransaction::CommitL()
-// ---------------------------------------------------------------------------
-//
-void RThumbnailTransaction::CommitL()
- {
- if ( iState != EOldOpen )
- {
- TInt ret = iDatabase.Exec( KThumbnailCommitTransaction );
-
-#ifdef _DEBUG
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG3( "RThumbnailTransaction::CommitL() lastError %S, ret = %d" , &errorMsg, ret);
- OstTraceExt2( TRACE_NORMAL, DUP2_RTHUMBNAILTRANSACTION_BEGINL, "RThumbnailTransaction::BeginL - lastError;errorMsg=%S;ret=%d", errorMsg, ret );
-#endif
- User::LeaveIfError( ret );
- }
-
- iState = EClosed;
- }
-
-// ---------------------------------------------------------------------------
-// RThumbnailTransaction::Rollback()
-// ---------------------------------------------------------------------------
-//
-TInt RThumbnailTransaction::Rollback()
- {
- if ( iState != EOldOpen )
- {
- // in some cases there could have been automatic rollback
- if (iDatabase.InTransaction())
- {
- const TInt err = iDatabase.Exec( KThumbnailRollbackTransaction );
- if ( err >= 0 )
- {
- iState = EClosed;
- }
-
- return err;
- }
- else
- {
- TN_DEBUG1( "RThumbnailTransaction::Rollback() - automatic rollback already done!" );
- OstTrace0( TRACE_NORMAL, RTHUMBNAILTRANSACTION_ROLLBACK, "RThumbnailTransaction::Rollback - automatic rollback already done!" );
- }
- }
-
- iState = EClosed;
-
- return KErrNone;
- }
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailStore* CThumbnailStore::NewL( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly )
- {
- CThumbnailStore* self = new( ELeave )CThumbnailStore( aFs, aDrive, aImei, aServer, aReadOnly );
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::~CThumbnailStore()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailStore::~CThumbnailStore()
- {
- TN_DEBUG2( "CThumbnailStore::~CThumbnailStore() drive: %d", iDrive );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTORE_CTHUMBNAILSTORE, "CThumbnailStore::~CThumbnailStore;iDrive=%d", iDrive );
-
- if(iActivityManager)
- {
- delete iActivityManager;
- iActivityManager = NULL;
- }
-
- if(iDiskFullNotifier)
- {
- delete iDiskFullNotifier;
- iDiskFullNotifier = NULL;
- }
-
- if( iAutoFlushTimer )
- {
- iAutoFlushTimer->Cancel();
- delete iAutoFlushTimer;
- iAutoFlushTimer = NULL;
- }
-
- if( iMaintenanceTimer )
- {
- iMaintenanceTimer->Cancel();
- delete iMaintenanceTimer;
- iMaintenanceTimer = NULL;
- }
-
- CloseStatements();
- iDatabase.Close();
-
- TN_DEBUG1( "CThumbnailStore::~CThumbnailStore() - database closed" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_CTHUMBNAILSTORE, "CThumbnailStore::~CThumbnailStore - database closed" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::CThumbnailStore()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailStore::CThumbnailStore( RFs& aFs, TInt aDrive, TDesC& aImei, CThumbnailServer* aServer, const TBool aReadOnly ):
- iFs( aFs ), iDrive( aDrive ), iDriveChar( 0 ), iBatchItemCount(0), iImei(aImei), iServer(aServer), iDiskFullNotifier(NULL),
- iDiskFull(EFalse), iActivityManager(NULL), iUnrecoverable(ETrue), iBatchFlushItemCount(KMInBatchItems), iReadOnly(aReadOnly)
- {
- // no implementation required
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::ConstructL()
- {
- TN_DEBUG1( "CThumbnailStore::ConstructL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_CONSTRUCTL, "CThumbnailStore::ConstructL" );
-
-#ifdef _DEBUG
- iThumbCounter = 0;
-#endif
- if(!iReadOnly)
- {
- HBufC* databasePath = HBufC::NewLC( KMaxFileName );
- TPtr pathPtr = databasePath->Des();
- User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar ));
- pathPtr.Append( iDriveChar );
- pathPtr.Append( KThumbnailDatabaseName );
-
- //start disk space monitor
- iDiskFullNotifier = CThumbnailStoreDiskSpaceNotifierAO::NewL( *this,
- KDiskFullThreshold,
- pathPtr );
-
- CleanupStack::PopAndDestroy( databasePath );
-
- TN_DEBUG2( "CThumbnailStore::ConstructL() drive: %d", iDrive );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_CONSTRUCTL, "CThumbnailStore::ConstructL;iDrive=%d", iDrive );
-
- OpenDatabaseL();
-
- // to monitor device activity
- iActivityManager = CTMActivityManager::NewL( this, KStoreMaintenanceIdle);
- iActivityManager->Start();
-
- iDeleteThumbs = ETrue;
- iCheckFilesExist = ETrue;
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::ConstructL() - read only, dymmy mode..." );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_CONSTRUCTL, "CThumbnailStore::ConstructL - read only, dymmy mode..." );
- iDeleteThumbs = EFalse;
- iCheckFilesExist = EFalse;
- iLastCheckedRowID = -1;
- }
- }
-
-// ---------------------------------------------------------------------------
-// OpenDatabaseL database file
-// ---------------------------------------------------------------------------
-TInt CThumbnailStore::OpenDatabaseFileL()
- {
- TN_DEBUG1( "CThumbnailStore::OpenDatabaseFile()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_OPENDATABASEFILEL, "CThumbnailStore::OpenDatabaseFileL" );
-
- HBufC* databasePath = HBufC::NewLC( KMaxFileName );
- TPtr pathPtr = databasePath->Des();
- TChar driveChar = 0;
- User::LeaveIfError( RFs::DriveToChar( iDrive, driveChar ));
- pathPtr.Append( driveChar );
- pathPtr.Append( KThumbnailDatabaseName );
-
- TInt ret = iDatabase.Open( pathPtr );
- CleanupStack::PopAndDestroy( databasePath );
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-// OpenDatabaseL database
-// ---------------------------------------------------------------------------
-TInt CThumbnailStore::OpenDatabaseL( TBool aNewDatabase )
- {
- TN_DEBUG2( "CThumbnailStore::OpenDatabaseL() drive: %d", iDrive );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTORE_OPENDATABASEL, "CThumbnailStore::OpenDatabaseL;iDrive=%d", iDrive );
-
- CloseStatements();
- iDatabase.Close();
- iUnrecoverable = ETrue;
-
- TInt checkError = KErrNone;
- TInt blistError = KErrNone;
- TInt blistError2 = KErrNone;
- TInt imeiError = KErrNone;
- TInt err = KErrNone;
-
- if (aNewDatabase)
- {
- // delete existing and create new
- CleanupClosePushL(iDatabase);
- RecreateDatabaseL(ETrue);
- CleanupStack::Pop(&iDatabase);
- }
- else
- {
- // just open old
- err = OpenDatabaseFileL();
-
- TN_DEBUG2( "CThumbnailStore::OpenDatabaseL() -- err = %d", err);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_OPENDATABASEL, "CThumbnailStore::OpenDatabaseL;err=%d", err );
-
- if ( err == KErrNone)
- {
- // db found, check version and rowids
- checkError = CheckVersion();
- if(checkError == KErrNone)
- {
- checkError = CheckRowIDs();
- }
- }
-
- // if db file not found, wrong version, corrupted database or other error opening db
- if ( err != KErrNone || checkError == KErrNotSupported )
- {
- CleanupClosePushL(iDatabase);
- RecreateDatabaseL(ETrue);
- CleanupStack::Pop(&iDatabase);
-
- aNewDatabase = ETrue;
- }
- }
-
- // opened existing database file
- if(!aNewDatabase)
- {
- // add temp tables
- CreateTempTablesL();
-
- //check ownership
- imeiError = CheckImei();
-
- if(imeiError != KErrNone)
- {
- //take ownership
- TRAP(imeiError, UpdateImeiL() );
-
- //Touch blacklisted items
- TRAP(blistError, PrepareBlacklistedItemsForRetryL() );
- }
-
- //check if MMC is known
- if(CheckMediaIDL() != KErrNone)
- {
- //Touch blacklisted items
- TRAP(blistError2, PrepareBlacklistedItemsForRetryL() );
- }
-
- if(imeiError != KErrNone || blistError != KErrNone || blistError2 != KErrNone )
- {
- CleanupClosePushL(iDatabase);
- RecreateDatabaseL(ETrue);
- CleanupStack::Pop(&iDatabase);
- }
- }
-
- PrepareStatementsL();
-
- // database now usable
- iUnrecoverable = EFalse;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// PrepareDbL database tables
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::PrepareDbL()
- {
- TN_DEBUG1( "CThumbnailStore::PrepareDbL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_PREPAREDBL, "CThumbnailStore::PrepareDbL" );
-
- // add persistent tables
- CreateTablesL();
-
- AddVersionAndImeiL();
-
- // add temp tables
- CreateTempTablesL();
- }
-
-// ---------------------------------------------------------------------------
-// Create database tables
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::CreateTablesL()
- {
- TN_DEBUG1( "CThumbnailStore::CreateTablesL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_CREATETABLESL, "CThumbnailStore::CreateTablesL" );
-
- TInt err = KErrNone;
- err = iDatabase.Exec( KThumbnailCreateInfoTable );
- TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoTable err=%d", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_CREATETABLESL, "CThumbnailStore::CreateTablesL - KThumbnailCreateInfoTable;err=%d", err );
- User::LeaveIfError( err );
-
- err = iDatabase.Exec( KThumbnailCreateInfoDataTable );
- TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoDataTable err=%d", err );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_CREATETABLESL, "CThumbnailStore::CreateTablesL - KThumbnailCreateInfoDataTable;err=%d", err );
- User::LeaveIfError( err );
-
- err = iDatabase.Exec(KThumbnailDeletedTable);
- TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailDeletedTable err=%d", err );
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_CREATETABLESL, "CThumbnailStore::CreateTablesL - KThumbnailDeletedTable;err=%d", err );
- User::LeaveIfError( err );
-
- err = iDatabase.Exec( KThumbnailCreateInfoTableIndex1 );
- TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailCreateInfoTableIndex1 err=%d", err );
- User::LeaveIfError( err );
-
- err = iDatabase.Exec(KThumbnailVersionTable);
- TN_DEBUG2( "CThumbnailStore::CreateTablesL() KThumbnailVersionTable err=%d", err );
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_CREATETABLESL, "CThumbnailStore::CreateTablesL;err=%d", err );
- User::LeaveIfError( err );
- }
-
-// ---------------------------------------------------------------------------
-// Create temp tables
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::CreateTempTablesL()
- {
- TN_DEBUG1( "CThumbnailStore::CreateTempTablesL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_CREATETEMPTABLESL, "CThumbnailStore::CreateTempTablesL" );
-
- TInt err = iDatabase.Exec( KThumbnailCreateTempInfoTable );
-
-#ifdef _DEBUG
- if(err < 0)
- {
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG2( "CThumbnailStore::PrepareDbL() KThumbnailCreateTempInfoTable %S" , &errorMsg);
- OstTraceExt1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_CREATETEMPTABLESL, "CThumbnailStore::CreateTempTablesL - KThumbnailCreateTempInfoTable;errorMsg=%S", errorMsg );
- }
-#endif
-
- User::LeaveIfError( err );
-
- err = iDatabase.Exec( KThumbnailCreateTempInfoDataTable );
-
-#ifdef _DEBUG
- if(err < 0)
- {
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG2( "CThumbnailStore::PrepareDbL() KThumbnailCreateTempInfoDataTable %S" , &errorMsg);
- OstTraceExt1( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_CREATETEMPTABLESL, "CThumbnailStore::CreateTempTablesL - KThumbnailCreateTempInfoDataTable;errorMsg=%S", errorMsg );
- }
-#endif
-
- User::LeaveIfError( err );
- }
-
-void CThumbnailStore::RecreateDatabaseL(const TBool aDelete)
- {
- TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() drive: %d", iDrive );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL;iDrive=%d", iDrive );
-
- TVolumeInfo volumeinfo;
- User::LeaveIfError( iFs.Volume(volumeinfo, iDrive) );
- TUint id = volumeinfo.iUniqueID;
- TBuf<50> mediaid;
- mediaid.Num(id);
-
- CloseStatements();
- iDatabase.Close();
- iUnrecoverable = ETrue;
-
- TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL() database closed" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL - database closed" );
-
- HBufC* databasePath = HBufC::NewLC( KMaxFileName );
- TPtr pathPtr = databasePath->Des();
- User::LeaveIfError( RFs::DriveToChar( iDrive, iDriveChar ));
- pathPtr.Append( iDriveChar );
- pathPtr.Append( KThumbnailDatabaseName );
-
- TInt err(KErrNone);
-
- // delete old if necessary
- if(aDelete)
- {
- TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL() delete database" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL - delete database" );
- TInt del = iDatabase.Delete(pathPtr);
- TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() deleted database, err: %d", del );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL" );
- }
-
- const TDesC8& config = KThumbnailSqlConfig;
-
- RSqlSecurityPolicy securityPolicy;
- CleanupClosePushL( securityPolicy );
- securityPolicy.CreateL( KThumbnailDatabaseSecurityPolicy );
-
- // create new
- TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL() create new" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL - create new" );
- TRAP(err, iDatabase.CreateL( pathPtr, securityPolicy, &config ));
- TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() -- database created, err = %d", err );
- OstTrace1( TRACE_FATAL, DUP5_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL;err=%d", err );
- User::LeaveIfError(err);
-
- CleanupStack::PopAndDestroy( &securityPolicy );
-
- // add tables
- TRAPD(prepareErr, PrepareDbL() );
-
- TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() -- prepare tables, err = %d", prepareErr );
- OstTrace1( TRACE_FATAL, DUP6_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL - prepare tables;prepareErr=%d", prepareErr );
-
- TInt mediaidErr(KErrNone);
-
- // write media id file if doesn't exist
- if(!BaflUtils::FileExists( iFs, mediaid ))
- {
- RFile64 file;
- mediaidErr = file.Create(iFs, mediaid, EFileShareReadersOrWriters );
- file.Close();
-
- TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() -- mediaID file created, err = %d", mediaidErr );
- OstTrace1( TRACE_FATAL, DUP7_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL;mediaidErr=%d", mediaidErr );
- }
-
- // delete db if not fully complete
- if (prepareErr < 0 || mediaidErr < 0)
- {
- CloseStatements();
- iDatabase.Close();
- TN_DEBUG1( "CThumbnailStore::RecreateDatabaseL() delete database" );
- OstTrace0( TRACE_FATAL, DUP8_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL - delete database" );
- TInt del = iDatabase.Delete(pathPtr);
- TN_DEBUG2( "CThumbnailStore::RecreateDatabaseL() deleted database, err: %d", del );
- OstTrace1( TRACE_FATAL, DUP9_CTHUMBNAILSTORE_RECREATEDATABASEL, "CThumbnailStore::RecreateDatabaseL - delete database;del=%d", del );
- }
-
- User::LeaveIfError( prepareErr );
- User::LeaveIfError( mediaidErr );
-
- CleanupStack::PopAndDestroy( databasePath );
- }
-
-TInt CThumbnailStore::CheckRowIDs()
- {
- TN_DEBUG1( "CThumbnailStore::CheckRowIDs()");
- OstTrace0( TRACE_FATAL, CTHUMBNAILSTORE_CHECKROWIDS, "CThumbnailStore::CheckRowIDs" );
-
- RSqlStatement stmt;
- TInt column = 0;
- TInt rowStatus = 0;
- TInt64 inforows = -1;
- TInt64 datarows = -1;
-
- TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID );
- if(ret < 0)
- {
- stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoRowID failed %d");
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBNAILSTORE_CHECKROWIDS, "CThumbnailStore::CheckRowIDs KGetInfoRowID failed;ret=%d", ret );
- return KErrNotSupported;
- }
- rowStatus = stmt.Next();
-
- if ( rowStatus == KSqlAtRow)
- {
- inforows = stmt.ColumnInt64( column );
- }
-
- stmt.Close();
-
- if(rowStatus < 0)
- {
-#ifdef _DEBUG
- TPtrC errorMsg2 = iDatabase.LastErrorMessage();
- TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
- OstTraceExt1( TRACE_FATAL, DUP2_CTHUMBNAILSTORE_CHECKROWIDS, "CThumbnailStore::CheckRowIDs - lastError;errorMsg2=%S", errorMsg2 );
-#endif
- return KErrNotSupported;
- }
-
- ret = stmt.Prepare( iDatabase, KGetDataRowID );
- if(ret < 0)
- {
- stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed");
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBNAILSTORE_CHECKROWIDS, "CThumbnailStore::CheckRowIDs - KGetDataRowID failed" );
- return KErrNotSupported;
- }
- rowStatus = stmt.Next();
-
- if ( rowStatus == KSqlAtRow)
- {
- datarows = stmt.ColumnInt64( column );
- }
-
- stmt.Close();
-
- if( rowStatus < 0)
- {
-#ifdef _DEBUG
- TPtrC errorMsg2 = iDatabase.LastErrorMessage();
- TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
- OstTraceExt1( TRACE_FATAL, DUP4_CTHUMBNAILSTORE_CHECKROWIDS, "CThumbnailStore::CheckRowIDs - lastError;errorMsg2=%S", errorMsg2 );
-#endif
- return KErrNotSupported;
- }
-
- TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows );
- OstTraceExt1( TRACE_FATAL, DUP5_CTHUMBNAILSTORE_CHECKROWIDS, "CThumbnailStore::CheckRowIDs;inforows=%g", inforows );
- TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows );
- OstTraceExt1( TRACE_FATAL, DUP6_CTHUMBNAILSTORE_CHECKROWIDS, "CThumbnailStore::CheckRowIDs;datarows=%Ld", datarows );
-
- if( inforows != datarows )
- {
- TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" );
- return KErrNotSupported;
- }
- else
- {
- return KErrNone;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CheckVersion()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailStore::CheckVersion()
- {
- TN_DEBUG1( "CThumbnailStore::CheckVersion()" );
- OstTrace0( TRACE_FATAL, CTHUMBNAILSTORE_CHECKVERSION, "CThumbnailStore::CheckVersion" );
- RSqlStatement stmt;
-
- TInt rowStatus = 0;
- TInt column = 0;
- TInt minor = 0;
- TInt major = 0;
-
- TInt ret = stmt.Prepare( iDatabase, KThumbnailSelectFromVersion );
- if(ret < 0 )
- {
- stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckVersion() unknown version" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBNAILSTORE_CHECKVERSION, "CThumbnailStore::CheckVersion - unknown version" );
- return KErrNotSupported;
- }
-
- rowStatus = stmt.Next();
-
- if ( rowStatus == KSqlAtRow)
- {
- major = stmt.ColumnInt( column++);
- minor = stmt.ColumnInt( column++);
- }
-
- stmt.Close();
-
- if( rowStatus < 0 )
- {
-#ifdef _DEBUG
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG2( "RThumbnailTransaction::CheckVersion() lastError %S, ret = %d" , &errorMsg);
- OstTrace0( TRACE_FATAL, DUP2_CTHUMBNAILSTORE_CHECKVERSION, "CThumbnailStore::CheckVersion" );
-#endif
- return ret;
- }
-
- if(major == KMajor && minor == KMinor )
- {
- return KErrNone;
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::CheckVersion() - wrong DB version" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBNAILSTORE_CHECKVERSION, "CThumbnailStore::CheckVersion" );
- return KErrNotSupported;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CheckImei()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailStore::CheckImei()
- {
- TN_DEBUG1( "CThumbnailStore::CheckImei()" );
- OstTrace0( TRACE_FATAL, CTHUMBNAILSTORE_CHECKIMEI, "CThumbnailStore::CheckImei" );
- RSqlStatement stmt;
-
- TInt rowStatus = 0;
- TInt column = 0;
- TBuf<KImeiBufferSize> imei;
-
- TInt ret = stmt.Prepare( iDatabase, KThumbnailSelectFromVersion );
- if(ret < 0 )
- {
- stmt.Close();
- TN_DEBUG1( "CThumbnailStore::CheckImei() failed" );
- OstTrace0( TRACE_FATAL, DUP1_CTHUMBNAILSTORE_CHECKIMEI, "CThumbnailStore::CheckImei - failed" );
- return KErrNotSupported;
- }
-
- rowStatus = stmt.Next();
-
- if ( rowStatus == KSqlAtRow)
- {
- column = 2; // imei column
- stmt.ColumnText( column, imei);
- }
-
- stmt.Close();
-
- if( rowStatus < 0 )
- {
-#ifdef _DEBUG
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG2( "RThumbnailTransaction::CheckImei() lastError %S, ret = %d" , &errorMsg);
- OstTraceExt1( TRACE_FATAL, DUP2_CTHUMBNAILSTORE_CHECKIMEI, "CThumbnailStore::CheckImei - lastError;errorMsg=%S", errorMsg );
-#endif
- return ret;
- }
-
- if( imei == iImei )
- {
- return KErrNone;
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::CheckImei() mismatch" );
- OstTrace0( TRACE_FATAL, DUP3_CTHUMBNAILSTORE_CHECKIMEI, "CThumbnailStore::CheckImei - mismatch" );
- return KErrNotSupported;
- }
- }
-
-// -----------------------------------------------------------------------------
-// CheckMediaID()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailStore::CheckMediaIDL()
- {
- TN_DEBUG1( "CThumbnailStore::CheckMediaIDL()" );
- OstTrace0( TRACE_FATAL, CTHUMBNAILSTORE_CHECKMEDIAIDL, "CThumbnailStore::CheckMediaIDL" );
-
- TVolumeInfo volumeinfo;
- User::LeaveIfError( iFs.Volume(volumeinfo, iDrive) );
- TUint id = volumeinfo.iUniqueID;
- TBuf<50> mediaid;
- mediaid.Num(id);
-
- if(!BaflUtils::FileExists( iFs, mediaid ))
- {
- RFile64 file;
- TInt err = file.Create(iFs, mediaid, EFileShareReadersOrWriters );
- file.Close();
- TN_DEBUG2( "CThumbnailStore::CheckMediaIDL() -- mediaID file created, err = %d", err );
- OstTrace1( TRACE_FATAL, DUP1_CTHUMBNAILSTORE_CHECKMEDIAIDL, "CThumbnailStore::CheckMediaIDL - mediaID file created;err=%d", err );
-
- return KErrNotSupported;
- }
-
- return KErrNone;
- }
-
-// ----------------------------------------------------------------------------
-// AddVersionAndImeiL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::AddVersionAndImeiL()
- {
- TN_DEBUG1( "CThumbnailStore::AddVersionAndImei()" );
- OstTrace0( TRACE_FATAL, CTHUMBNAILSTORE_ADDVERSIONANDIMEIL, "CThumbnailStore::AddVersionAndImeiL" );
- RSqlStatement stmt;
- CleanupClosePushL( stmt );
-
- TInt paramIndex = 0;
-
- User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailInsertToVersion ));
- paramIndex = stmt.ParameterIndex( KThumbnailSqlParamImei );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt.BindText( paramIndex, iImei ));
-
- paramIndex = stmt.ParameterIndex( KThumbnailSqlParamMinor );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt.BindInt( paramIndex, KMinor ));
-
- paramIndex = stmt.ParameterIndex( KThumbnailSqlParamMajor );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt.BindInt( paramIndex, KMajor ));
-
- User::LeaveIfError( stmt.Exec());
- CleanupStack::PopAndDestroy( &stmt );
- }
-
-// -----------------------------------------------------------------------------
-// UpdateImeiL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::UpdateImeiL()
- {
- TN_DEBUG1( "CThumbnailStore::UpdateImeiL()" );
- OstTrace0( TRACE_FATAL, CTHUMBNAILSTORE_UPDATEIMEIL, "CThumbnailStore::UpdateImeiL" );
- RSqlStatement stmt;
- CleanupClosePushL( stmt );
-
- User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailUpdateIMEI ) );
-
- TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamImei );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt.BindText( paramIndex, iImei ));
-
- TInt err = stmt.Exec();
-
- if(err < 0)
- {
-#ifdef _DEBUG
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG2( "RThumbnailTransaction::UpdateImeiL() lastError %S" , &errorMsg);
- OstTraceExt1( TRACE_FATAL, DUP1_CTHUMBNAILSTORE_UPDATEIMEIL, "CThumbnailStore::UpdateImeiL - lastError;errorMsg=%S", errorMsg );
-#endif
- User::Leave(err);
- }
-
- CleanupStack::PopAndDestroy( &stmt );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::PrepareStatementsL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::PrepareStatementsL()
- {
- TN_DEBUG1("CThumbnailStore::PrepareStatementsL()");
- OstTrace0( TRACE_FATAL, CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL" );
-
- TInt err = KErrNone;
-#ifdef _DEBUG
- TFileName msg;
-#endif
-
- err = iStmt_KThumbnailSelectInfoByPath.Prepare( iDatabase, KThumbnailSelectInfoByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSelectInfoByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP1_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSelectInfoByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSelectTempInfoByPath.Prepare( iDatabase, KThumbnailSelectTempInfoByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSelectTempInfoByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP2_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSelectTempInfoByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailInsertTempThumbnailInfo.Prepare( iDatabase, KThumbnailInsertTempThumbnailInfo );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailInsertTempThumbnailInfo %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP3_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailInsertTempThumbnailInfo ;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailInsertTempThumbnailInfoData.Prepare( iDatabase, KThumbnailInsertTempThumbnailInfoData );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailInsertTempThumbnailInfoData %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP4_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailInsertTempThumbnailInfoData;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSelectModifiedByPath.Prepare( iDatabase, KThumbnailSelectModifiedByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSelectModifiedByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP5_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSelectTempModifiedByPath.Prepare( iDatabase, KThumbnailSelectTempModifiedByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSelectTempModifiedByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP6_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSelectTempModifiedByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailFindDuplicate.Prepare( iDatabase, KThumbnailFindDuplicate );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailFindDuplicate %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP7_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailFindDuplicate;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailTempFindDuplicate.Prepare( iDatabase, KThumbnailTempFindDuplicate );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailTempFindDuplicate %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP8_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailTempFindDuplicate;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlFindDeleted.Prepare( iDatabase, KThumbnailSqlFindDeleted );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlFindDeleted %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP9_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlFindDeleted;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSelectSizeByPath.Prepare( iDatabase, KThumbnailSelectSizeByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSelectSizeByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP10_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSelectSizeByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSelectTempSizeByPath.Prepare( iDatabase, KThumbnailSelectTempSizeByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSelectTempSizeByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP11_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSelectTempSizeByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlSelectRowIDInfoByPath.Prepare( iDatabase, KThumbnailSqlSelectRowIDInfoByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlSelectRowIDInfoByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP12_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlSelectRowIDInfoByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlDeleteInfoByPath.Prepare( iDatabase, KThumbnailSqlDeleteInfoByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlDeleteInfoByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP13_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlDeleteInfoByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlDeleteInfoDataByPath.Prepare( iDatabase, KThumbnailSqlDeleteInfoDataByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlDeleteInfoDataByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP14_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlDeleteInfoDataByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KTempThumbnailSqlSelectRowIDInfoByPath.Prepare( iDatabase, KTempThumbnailSqlSelectRowIDInfoByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KTempThumbnailSqlSelectRowIDInfoByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP15_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KTempThumbnailSqlSelectRowIDInfoByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KTempThumbnailSqlDeleteInfoByPath.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KTempThumbnailSqlDeleteInfoByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP16_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KTempThumbnailSqlDeleteInfoByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KTempThumbnailSqlDeleteInfoDataByPath.Prepare( iDatabase, KTempThumbnailSqlDeleteInfoDataByPath );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KTempThumbnailSqlDeleteInfoDataByPath %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP17_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KTempThumbnailSqlDeleteInfoDataByPath;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlInsertDeleted.Prepare( iDatabase, KThumbnailSqlInsertDeleted );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlInsertDeleted %S" , &msg );
- OstTraceExt1( TRACE_FATAL, DUP18_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlInsertDeleted;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlSelectMarked.Prepare( iDatabase, KThumbnailSqlSelectMarked );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlSelectMarked %S" , &msg );
- OstTraceExt1( TRACE_NORMAL, DUP19_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlSelectMarked;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlDeleteInfoByRowID.Prepare( iDatabase, KThumbnailSqlDeleteInfoByRowID );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlDeleteInfoByRowID %S" , &msg );
- OstTraceExt1( TRACE_NORMAL, DUP20_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlDeleteInfoByRowID;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSqlDeleteInfoDataByRowID.Prepare( iDatabase, KThumbnailSqlDeleteInfoDataByRowID );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSqlDeleteInfoDataByRowID %S" , &msg );
- OstTraceExt1( TRACE_NORMAL, DUP21_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSqlDeleteInfoDataByRowID;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailSelectAllPaths.Prepare( iDatabase, KThumbnailSelectAllPaths );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailSelectAllPaths %S" , &msg );
- OstTraceExt1( TRACE_NORMAL, DUP22_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailSelectAllPaths;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailRename.Prepare( iDatabase, KThumbnailRename );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailRename %S" , &msg );
- OstTraceExt1( TRACE_NORMAL, DUP23_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailRename;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- err = iStmt_KThumbnailTempRename.Prepare( iDatabase, KThumbnailTempRename );
-#ifdef _DEBUG
- msg.Append( iDatabase.LastErrorMessage() );
- TN_DEBUG2( "CThumbnailStore::PrepareStatementsL() KThumbnailTempRename %S" , &msg );
- OstTraceExt1( TRACE_NORMAL, DUP24_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - KThumbnailTempRename;msg=%S", msg );
- msg.Zero();
-#endif
- User::LeaveIfError( err );
-
- TN_DEBUG1("CThumbnailStore::PrepareStatementsL() end");
- OstTrace0( TRACE_NORMAL, DUP25_CTHUMBNAILSTORE_PREPARESTATEMENTSL, "CThumbnailStore::PrepareStatementsL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::ResetStatement()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::ResetStatement( TAny* aStmt )
- {
- // called by CleanupStack::PopAndDestroy()
- // just reset so that there's no need to prepare again
- ((RSqlStatement*)aStmt)->Reset();
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::CloseStatements()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::CloseStatements()
- {
- TN_DEBUG1("CThumbnailStore::CloseStatements()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_CLOSESTATEMENTS, "CThumbnailStore::CloseStatements" );
-
- iStmt_KThumbnailSelectInfoByPath.Close();
- iStmt_KThumbnailSelectTempInfoByPath.Close();
- iStmt_KThumbnailInsertTempThumbnailInfo.Close();
- iStmt_KThumbnailInsertTempThumbnailInfoData.Close();
- iStmt_KThumbnailSelectModifiedByPath.Close();
- iStmt_KThumbnailSelectTempModifiedByPath.Close();
- iStmt_KThumbnailFindDuplicate.Close();
- iStmt_KThumbnailTempFindDuplicate.Close();
- iStmt_KThumbnailSqlFindDeleted.Close();
- iStmt_KThumbnailSelectSizeByPath.Close();
- iStmt_KThumbnailSelectTempSizeByPath.Close();
- iStmt_KThumbnailSqlSelectRowIDInfoByPath.Close();
- iStmt_KThumbnailSqlDeleteInfoByPath.Close();
- iStmt_KThumbnailSqlDeleteInfoDataByPath.Close();
- iStmt_KTempThumbnailSqlSelectRowIDInfoByPath.Close();
- iStmt_KTempThumbnailSqlDeleteInfoByPath.Close();
- iStmt_KTempThumbnailSqlDeleteInfoDataByPath.Close();
- iStmt_KThumbnailSqlInsertDeleted.Close();
- iStmt_KThumbnailSqlSelectMarked.Close();
- iStmt_KThumbnailSqlDeleteInfoByRowID.Close();
- iStmt_KThumbnailSqlDeleteInfoDataByRowID.Close();
- iStmt_KThumbnailSelectAllPaths.Close();
- iStmt_KThumbnailRename.Close();
- iStmt_KThumbnailTempRename.Close();
-
- TN_DEBUG1("CThumbnailStore::CloseStatements() end");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_CLOSESTATEMENTS, "CThumbnailStore::CloseStatements - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::StoreThumbnailL()
-// Stores thumbnail image.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, const TDes8& aData,
- const TSize& aSize, const TSize& aOriginalSize, const TThumbnailFormat& aFormat, TInt aFlags,
- const TThumbnailSize& aThumbnailSize, const TInt64 aModified, const TBool aThumbFromPath )
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) in" );
-
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." );
- return;
- }
-
-#ifdef _DEBUG
- TTime aStart, aStop;
- aStart.UniversalTime();
-#endif
-
- //Encapsulate insert to Transaction
- RThumbnailTransaction transaction( iDatabase );
- CleanupClosePushL( transaction );
- transaction.BeginL();
-
- // Insert into TempThumbnailInfo
- RSqlStatement* stmt = NULL;
- stmt = &iStmt_KThumbnailInsertTempThumbnailInfo;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- TInt paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, aPath ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamWidth );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aSize.iWidth ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamHeight );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aSize.iHeight ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamOriginalWidth );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aOriginalSize.iWidth ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamOriginalHeight );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aOriginalSize.iHeight ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamFormat );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aFormat ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamFlags );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aFlags ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamSize );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aThumbnailSize ));
-
- // orientation temporarily to 0
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamOrientation );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, 0 ));
-
- // thumb from associated path
- TInt fromPath = aThumbFromPath;
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamThumbFromPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, fromPath ));
-
- // try getting modification time from file
- TTime timeStamp;
-
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp aModified %Ld", aModified );
- OstTraceExt1( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - timeStamp aModified;aModified=%Ld", aModified );
-
- if( aModified )
- {
- timeStamp = aModified;
- }
- else
- {
- TInt timeErr = KErrNone;
-
- if (aPath.Length())
- {
- // need to add drive letter
- TFileName path;
- path.Append(iDriveChar);
- path.Append(KDrv);
- path.Append(aPath);
-
- timeErr = iFs.Modified(path, timeStamp);
-
- if (timeErr != KErrNone)
- {
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) error getting timeStamp: %d", timeErr );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - error getting timeStamp;timeErr=%d", timeErr );
- }
- else
- {
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp iFs %Ld", timeStamp.Int64() );
- OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - timeStamp;timeStamp.Int64()=%Ld", timeStamp.Int64() );
- }
- }
-
- if (!aPath.Length() || timeErr != KErrNone)
- {
- // otherwise current time
- timeStamp.UniversalTime();
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp current %Ld", timeStamp.Int64() );
- OstTraceExt1( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - timeStamp current;timeStamp.Int64()=%Ld", timeStamp.Int64() );
- }
- }
-
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) timeStamp set %Ld", timeStamp.Int64());
- OstTraceExt1( TRACE_NORMAL, DUP5_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - timeStamp set;timeStamp.Int64()=%Ld", timeStamp.Int64() );
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamModified );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt64( paramIndex, timeStamp.Int64() ));
-
- User::LeaveIfError( stmt->Exec());
- CleanupStack::PopAndDestroy( stmt );
-
- // Insert into TempThumbnailInfoData
- RSqlStatement* stmtData = NULL;
- stmtData = &iStmt_KThumbnailInsertTempThumbnailInfoData;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmtData));
-
- paramIndex = stmtData->ParameterIndex( KThumbnailSqlParamData );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmtData->BindBinary( paramIndex, aData ));
-
- User::LeaveIfError( stmtData->Exec());
- CleanupStack::PopAndDestroy( stmtData );
-
- // Commit transaction
- transaction.CommitL();
- CleanupStack::PopAndDestroy( &transaction );
-
- iBatchItemCount++;
-
- FlushCacheTable();
-
-#ifdef _DEBUG
- iThumbCounter++;
- TN_DEBUG2( "CThumbnailStore::THUMBSTORE-COUNTER----------, Thumbs = %d", iThumbCounter );
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::THUMBSTORE-COUNTER----------, Thumbs =;iThumbCounter=%d", iThumbCounter );
-
- aStop.UniversalTime();
- TInt tookTime = aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( private ) insert to table %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - insert to table;tookTime=%d", tookTime );
-#endif
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( private ) out" );
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - out" );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::StoreThumbnailL()
-// Stores thumbnail image.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::StoreThumbnailL( const TDesC& aPath, CFbsBitmap*
- aThumbnail, const TSize& aOriginalSize, TBool /*aCropped*/, const TThumbnailSize aThumbnailSize,
- const TInt64 aModified, TBool aThumbFromPath, TBool aBlackListed )
- {
- TSize thumbSize = aThumbnail->SizeInPixels();
- TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) aThumbnailSize = %d, aThumbnailSize(%d,%d) IN", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
- OstTraceExt3( TRACE_NORMAL, DUP9_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - IN;aThumbnailSize=%u;thumbSize.iWidth=%d;thumbSize.iHeight=%d", aThumbnailSize, thumbSize.iWidth, thumbSize.iHeight );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL() read only, skip..." );
- return;
- }
-
- __ASSERT_DEBUG(( aThumbnail ), ThumbnailPanic( EThumbnailNullPointer ));
-
- User::LeaveIfError( CheckDbState() );
-
- // don't store custom/unknown sizes or zero sizes
- if(aThumbnailSize == ECustomThumbnailSize || aThumbnailSize == EUnknownThumbnailSize
- || thumbSize.iWidth <= 0 || thumbSize.iHeight <= 0 )
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) not stored");
- OstTrace0( TRACE_NORMAL, DUP10_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - not stored" );
- return;
- }
-
- HBufC* path = aPath.AllocLC();
- TPtr ptr(path->Des());
- StripDriveLetterL( ptr );
-
- // check for duplicates
- TBool exists = FindDuplicateL(*path, aThumbnailSize);
-
- for ( TInt i = iPersistentSizes.Count(); --i >= 0; )
- {
- TThumbnailPersistentSize & persistentSize = iPersistentSizes[i];
-
- // don't store duplicates or zero sizes
- if ( !exists )
- {
- TInt flags = 0;
- if ( persistentSize.iCrop )
- {
- flags |= KThumbnailDbFlagCropped;
- }
-
- if( aBlackListed )
- {
- flags |= KThumbnailDbFlagBlacklisted;
- }
-
- if( (aThumbnailSize == EImageFullScreenThumbnailSize ||
- aThumbnailSize == EVideoFullScreenThumbnailSize ||
- aThumbnailSize == EAudioFullScreenThumbnailSize ||
- aThumbnailSize == EContactFullScreenThumbnailSize) && !aBlackListed )
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encode jpg" );
- OstTrace0( TRACE_NORMAL, DUP11_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - encode jpg" );
-
- HBufC8* data = NULL;
- CleanupStack::PushL( data );
-
- CImageEncoder* encoder = NULL;
-
- CImageEncoder::TOptions options = ( CImageEncoder::TOptions )( CImageEncoder::EOptionAlwaysThread );
-
- TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::EHwImplementation, data, options ) );
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP12_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - HW CExtJpegEncoder failed;decErr=%d", decErr );
-
- TRAPD( decErr, encoder = CExtJpegEncoder::DataNewL( CExtJpegEncoder::ESwImplementation, data, options ) );
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP13_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - SW CExtJpegEncoder failed;decErr=%d", decErr );
-
- TRAPD( decErr, encoder = CImageEncoder::DataNewL( data, KJpegMime(), options ) );
- if ( decErr != KErrNone )
- {
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder failed %d", decErr);
- OstTrace1( TRACE_NORMAL, DUP14_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - CImageEncoder failed;decErr=%d", decErr );
-
- User::Leave(decErr);
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - CImageEncoder created" );
- OstTrace0( TRACE_NORMAL, DUP15_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - CImageEncoder created" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - SW CExtJpegEncoder created" );
- OstTrace0( TRACE_NORMAL, DUP16_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - SW CExtJpegEncoder created" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - HW CExtJpegEncoder created" );
- OstTrace0( TRACE_NORMAL, DUP17_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - HW CExtJpegEncoder created" );
- }
-
- CleanupStack::Pop( data );
- CleanupStack::PushL( encoder );
-
- CFrameImageData* frameImageData = CFrameImageData::NewL();
- CleanupStack::PushL( frameImageData );
-
- TJpegImageData* imageData = new (ELeave) TJpegImageData();
- CleanupStack::PushL( imageData );
-
- // Set some format specific data
- imageData->iSampleScheme = TJpegImageData::EColor444;
- imageData->iQualityFactor = 80;
-
- // imageData - ownership passed to frameImageData after AppendImageData
- User::LeaveIfError(frameImageData->AppendImageData(imageData));
- CleanupStack::Pop( imageData );
-
-#ifdef _DEBUG
- TN_DEBUG4( "CThumbnailStore::StoreThumbnailL( public ) - size: %d x %d, displaymode: %d ",
- aThumbnail->SizeInPixels().iWidth,
- aThumbnail->SizeInPixels().iHeight,
- aThumbnail->DisplayMode());
-#endif
-
- TRequestStatus request;
- encoder->Convert( &request, *aThumbnail, frameImageData);
- User::WaitForRequest( request);
-
- CleanupStack::PopAndDestroy( frameImageData );
- CleanupStack::PopAndDestroy( encoder );
-
- if(request == KErrNone)
- {
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) - encoding ok" );
- OstTrace0( TRACE_NORMAL, DUP18_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - encoding ok" );
-
- CleanupStack::PushL( data );
- TPtr8 ptr = data->Des();
- StoreThumbnailL( *path, ptr, aThumbnail->SizeInPixels(),
- aOriginalSize, EThumbnailFormatJpeg, flags,
- aThumbnailSize, aModified, aThumbFromPath );
- CleanupStack::Pop( data );
- }
- else
- {
- TN_DEBUG2( "CThumbnailStore::StoreThumbnailL( public ) - encoding failed: %d", request.Int() );
- OstTrace1( TRACE_NORMAL, DUP19_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - encoding failed;request.Int()=%d", request.Int() );
- }
-
- delete data;
- data = NULL;
- }
- else
- {
- CBufFlat* buf = CBufFlat::NewL( KStreamBufferSize );
- CleanupStack::PushL( buf );
- RBufWriteStream stream;
- stream.Open( *buf );
- aThumbnail->ExternalizeL( stream );
-
- StoreThumbnailL( *path, buf->Ptr( 0 ), aThumbnail->SizeInPixels(),
- aOriginalSize, EThumbnailFormatFbsBitmap, flags,
- aThumbnailSize, aModified, aThumbFromPath);
-
- CleanupStack::PopAndDestroy( buf );
- }
-
- break;
- }
- }
-
- CleanupStack::PopAndDestroy( path );
-
- TN_DEBUG1( "CThumbnailStore::StoreThumbnailL( public ) out" );
- OstTrace0( TRACE_NORMAL, DUP20_CTHUMBNAILSTORE_STORETHUMBNAILL, "CThumbnailStore::StoreThumbnailL - out" );
- }
-
-// ---------------------------------------------------------------------------
-// Finds possible existing duplicate thumbnail.
-// ---------------------------------------------------------------------------
-//
-TBool CThumbnailStore::FindDuplicateL( const TDesC& aPath, const TThumbnailSize& aThumbnailSize )
- {
- TN_DEBUG1( "CThumbnailStore::FindDuplicateL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_FINDDUPLICATEL, "CThumbnailStore::FindDuplicateL" );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::FindDuplicateL() read only, skip..." );
- return EFalse;
- }
-
- User::LeaveIfError( CheckDbState() );
-
- TInt rowStatus = 0;
- TInt paramIndex = 0;
- TInt found = EFalse;
-
- RSqlStatement* stmt = NULL;
- stmt = &iStmt_KThumbnailTempFindDuplicate;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, aPath ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamSize );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aThumbnailSize ));
-
- rowStatus = stmt->Next();
-
- //if not found from temp table, look from real table
- if(rowStatus != KSqlAtRow)
- {
- CleanupStack::PopAndDestroy( stmt );
- stmt = &iStmt_KThumbnailFindDuplicate;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, aPath ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamSize );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aThumbnailSize ));
-
- rowStatus = stmt->Next();
-
- if(rowStatus == KSqlAtRow)
- {
- TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate in main table" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_FINDDUPLICATEL, "CThumbnailStore::FindDuplicateL - duplicate in main table" );
-
- found = ETrue;
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - no duplicate" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_FINDDUPLICATEL, "CThumbnailStore::FindDuplicateL - no duplicate" );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate in temp table" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_FINDDUPLICATEL, "CThumbnailStore::FindDuplicateL - duplicate in temp table" );
-
- found = ETrue;
- }
-
- CleanupStack::PopAndDestroy( stmt );
-
- // check if duplicate in Deleted
- if (found)
- {
- stmt = &iStmt_KThumbnailSqlFindDeleted;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, aPath ));
-
- rowStatus = stmt->Next();
-
- CleanupStack::PopAndDestroy( stmt );
-
- if(rowStatus == KSqlAtRow)
- {
- TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate marked deleted" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_FINDDUPLICATEL, "CThumbnailStore::FindDuplicateL - duplicate marked deleted" );
-
- DeleteThumbnailsL(aPath, ETrue);
-
- TN_DEBUG1( "CThumbnailStore::FindDuplicateL() - duplicate force-deleted" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSTORE_FINDDUPLICATEL, "CThumbnailStore::FindDuplicateL - duplicate force-deleted" );
-
- found = EFalse;
- }
- }
-
- return found;
- }
-
-// ---------------------------------------------------------------------------
-// Get missing sizes by Path
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::GetMissingSizesL( const TDesC& aPath, TInt aSourceType, RArray <
- TThumbnailPersistentSize > & aMissingSizes, TBool aCheckGridSizeOnly )
- {
- TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() aSourceType == %d", aSourceType );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTORE_GETMISSINGSIZESL, "CThumbnailStore::GetMissingSizesL;aSourceType=%d", aSourceType );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::GetMissingSizesL() read only, skip..." );
- return;
- }
-
- User::LeaveIfError( CheckDbState() );
-
- HBufC* path = aPath.AllocLC();
- TPtr ptr(path->Des());
- StripDriveLetterL( ptr );
-
- // define sizes to be checked
- const TInt count = iPersistentSizes.Count();
-
- for ( TInt i = 0 ; i < count; i++ )
- {
- if ( iPersistentSizes[ i ].iSourceType == aSourceType && iPersistentSizes[ i ].iAutoCreate)
- {
- //if generating only grid size for image or video, other sizes are not missing
- if( aCheckGridSizeOnly )
- {
- if( (iPersistentSizes[i].iSourceType == TThumbnailPersistentSize::EImage || iPersistentSizes[i].iSourceType == TThumbnailPersistentSize::EVideo )&&
- iPersistentSizes[i].iSizeType != TThumbnailPersistentSize::EGrid )
- {
- TN_DEBUG4( "CThumbnailStore::GetMissingSizesL() skip, aCheckGridSizeOnly = %d and iPersistentSizes[%d].iSizeType == %d",
- aCheckGridSizeOnly, i, iPersistentSizes[i].iSizeType );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_GETMISSINGSIZESL, "CThumbnailStore::GetMissingSizesL;aCheckGridSizeOnly=%u", aCheckGridSizeOnly );
- }
- else
- {
- aMissingSizes.AppendL( iPersistentSizes[ i ] );
- }
- }
- else
- {
- aMissingSizes.AppendL( iPersistentSizes[ i ] );
- }
- }
- }
-
- TInt missingSizeCount = aMissingSizes.Count();
-
- TN_DEBUG2( "CThumbnailStore::GetMissingSizesL() missingSizeCount == %d", missingSizeCount );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_GETMISSINGSIZESL, "CThumbnailStore::GetMissingSizesL;missingSizeCount=%d", missingSizeCount );
-
- // check temp table first
- RSqlStatement* stmt = NULL;
- stmt = &iStmt_KThumbnailSelectTempSizeByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- TInt paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- TInt rowStatus = stmt->Next();
-
- TInt round = 1;
- TInt size = 0;
-
- while (round <= 2)
- {
- while ( rowStatus == KSqlAtRow && missingSizeCount > 0 )
- {
- size = stmt->ColumnInt( 0 );
-
- missingSizeCount = aMissingSizes.Count();
- for ( TInt i = 0; i < missingSizeCount; i++ )
- {
- if ( aMissingSizes[ i ].iType == size )
- {
- TN_DEBUG1( "CThumbnailStore::GetMissingSizesL() -- thumbnail found" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_GETMISSINGSIZESL, "CThumbnailStore::GetMissingSizesL - thumbnail found" );
- aMissingSizes.Remove( i );
- missingSizeCount--;
- break;
- }
- }
-
- rowStatus = stmt->Next();
- }
-
- CleanupStack::PopAndDestroy( stmt );
-
- // all found
- if (missingSizeCount == 0)
- {
- CleanupStack::PopAndDestroy( path );
- return;
- }
- else if (round == 1)
- {
- // change to real table
- stmt = &iStmt_KThumbnailSelectSizeByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
- rowStatus = stmt->Next();
- }
-
- round++;
- }
-
- CleanupStack::PopAndDestroy( path );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::FetchThumbnailL()
-// Fetches thumbnail image.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::FetchThumbnailL( const TDesC& aPath, CFbsBitmap* &
- aThumbnail, TDesC8* & aData, const TThumbnailSize aThumbnailSize, TSize &aThumbnailRealSize )
- {
- TN_DEBUG3( "CThumbnailStore::FetchThumbnailL(%S) aThumbnailSize==%d", &aPath, aThumbnailSize );
- OstTraceExt2( TRACE_NORMAL, CTHUMBNAILSTORE_FETCHTHUMBNAILL, "CThumbnailStore::FetchThumbnailL;aPath=%S;aThumbnailSize=%u", aPath, aThumbnailSize );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() read only, skip..." );
- User::Leave( KErrNotFound );
- }
-
- User::LeaveIfError( CheckDbState() );
-
- HBufC* path = aPath.AllocLC();
- TPtr ptr(path->Des());
- StripDriveLetterL( ptr );
-
- TInt paramIndex = 0;
- TInt found = KErrNotFound;
- TInt rowStatus = 0;
- TInt column = 0;
-
- TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- TEMP TABLE lookup" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_FETCHTHUMBNAILL, "CThumbnailStore::FetchThumbnailL - TEMP TABLE lookup" );
-
- RSqlStatement* stmt = NULL;
- stmt = &iStmt_KThumbnailSelectTempInfoByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamSize );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aThumbnailSize ));
-
- rowStatus = stmt->Next();
-
- //if not found from temp table, look from real table
- if(rowStatus != KSqlAtRow)
- {
- TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- MAIN TABLE lookup" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_FETCHTHUMBNAILL, "CThumbnailStore::FetchThumbnailL - MAIN TABLE lookup" );
-
- CleanupStack::PopAndDestroy( stmt );
- stmt = &iStmt_KThumbnailSelectInfoByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamSize );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, aThumbnailSize ));
-
- rowStatus = stmt->Next();
- }
-
- if(rowStatus == KSqlAtRow)
- {
- TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- thumbnail found" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_FETCHTHUMBNAILL, "CThumbnailStore::FetchThumbnailL - thumbnail found" );
-
- // Check whether blacklisted thumbnail entry modified.
- // If thumbnail is marked as blacklisted and timestamp has
- // changed, delete thumbnails from tables and leave with
- // KErrNotFound to get thumbnail regenerated.
- column = 4;
- TInt flags = stmt->ColumnInt( column );
- if( flags & KThumbnailDbFlagDeleted )
- {
- CleanupStack::PopAndDestroy( stmt );
-
- // delete existing blacklisted thumbs
- DeleteThumbnailsL(*path, ETrue);
-
- CleanupStack::PopAndDestroy( path );
-
- User::Leave( KErrNotFound );
- }
- else if( flags & KThumbnailDbFlagBlacklisted )
- {
- CleanupStack::PopAndDestroy( stmt );
- CleanupStack::PopAndDestroy( path );
-
- User::Leave( KErrCompletion );
- }
- else if( !(flags & KThumbnailDbFlagBlacklisted) )
- {
- found = KErrNone;
- column = 0;
- TInt format = stmt->ColumnInt( column++ );
- if(format == 1 /*TThumbnailFormat::EThumbnailFormatJpeg */ )
- {
- TPtrC8 ptr = stmt->ColumnBinaryL( column++ );
- HBufC8* data = ptr.AllocL() ;
- aThumbnail = NULL;
- aData = data;
- }
- else
- {
- TPtrC8 ptr = stmt->ColumnBinaryL( column++ );
- RDesReadStream stream( ptr );
- aThumbnail = new( ELeave )CFbsBitmap();
- CleanupStack::PushL( aThumbnail );
- aThumbnail->InternalizeL( stream );
- CleanupStack::Pop( aThumbnail );
- aData = NULL;
- }
-
- //fetch real size of TN
- column = 2;
- aThumbnailRealSize.iWidth = stmt->ColumnInt( column++ );
- aThumbnailRealSize.iHeight = stmt->ColumnInt( column );
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::FetchThumbnailL() -- thumbnail NOT found" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_FETCHTHUMBNAILL, "CThumbnailStore::FetchThumbnailL - thumbnail NOT found" );
- }
-
- CleanupStack::PopAndDestroy( stmt );
- CleanupStack::PopAndDestroy( path );
-
- User::LeaveIfError( found );
- }
-
-// -----------------------------------------------------------------------------
-// Delete thumbnails for given object file by Path
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::DeleteThumbnailsL( const TDesC& aPath, TBool aForce,
- TBool aTransaction )
- {
- TN_DEBUG2( "CThumbnailStore::DeleteThumbnailsL(%S)", &aPath );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL;aPath=%S", aPath );
-
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsL() read only, skip..." );
- return;
- }
-
-#ifdef _DEBUG
- TTime aStart, aStop;
- aStart.UniversalTime();
-#endif
-
- User::LeaveIfError( CheckDbState() );
-
- TInt paramIndex = 0;
- TInt paramIndex1 = 0;
- TInt paramIndex2 = 0;
- TInt rowStatus = 0;
- TInt column = 0;
- TInt64 rowid = 0;
- TInt count = 0;
-
- HBufC* path = aPath.AllocLC();
- TPtr ptr(path->Des());
- StripDriveLetterL( ptr );
-
- RThumbnailTransaction transaction( iDatabase );
- if (aTransaction)
- {
- CleanupClosePushL( transaction );
- transaction.BeginL();
- }
-
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByPathL() -- TEMP TABLE lookup" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - TEMP TABLE lookup" );
-
- RSqlStatement* stmt = NULL;
- RSqlStatement* stmt_info = NULL;
- RSqlStatement* stmt_infodata = NULL;
-
- stmt = &iStmt_KTempThumbnailSqlSelectRowIDInfoByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
- stmt_info = &iStmt_KTempThumbnailSqlDeleteInfoByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt_info));
- stmt_infodata = &iStmt_KTempThumbnailSqlDeleteInfoDataByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt_infodata));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- rowStatus = stmt->Next();
-
- while(rowStatus == KSqlAtRow)
- {
- rowid = stmt->ColumnInt64( column );
- paramIndex1 = stmt_info->ParameterIndex( KThumbnailSqlParamRowID );
- User::LeaveIfError( paramIndex1 );
- User::LeaveIfError( stmt_info->BindInt64( paramIndex1, rowid ));
-
- TInt err = stmt_info->Exec();
- stmt_info->Reset();
- User::LeaveIfError( err );
-
- paramIndex2 = stmt_infodata->ParameterIndex( KThumbnailSqlParamRowID );
- User::LeaveIfError( paramIndex2 );
- User::LeaveIfError( stmt_infodata->BindInt64( paramIndex2, rowid ));
-
- err = stmt_infodata->Exec();
- stmt_infodata->Reset();
- User::LeaveIfError( err );
-
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailsByPathL() -- TEMP TABLE lookup - thumbnail deleted" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - TEMP TABLE lookup - thumbnail deleted" );
-
- // fetch another row (temp table rowIDs are updated immediately)
- stmt->Reset();
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- rowStatus = stmt->Next();
- }
-
- CleanupStack::PopAndDestroy( stmt_infodata );
- CleanupStack::PopAndDestroy( stmt_info );
- CleanupStack::PopAndDestroy( stmt );
-
- // if forcing instant delete
- if (aForce)
- {
- //look from real table
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup" );
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - MAIN TABLE lookup" );
-
- stmt = &iStmt_KThumbnailSqlSelectRowIDInfoByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
- stmt_info = &iStmt_KThumbnailSqlDeleteInfoByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt_info));
- stmt_infodata = &iStmt_KThumbnailSqlDeleteInfoDataByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt_infodata));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- rowStatus = stmt->Next();
-
- while(rowStatus == KSqlAtRow)
- {
- rowid = stmt->ColumnInt64( column );
- paramIndex1 = stmt_info->ParameterIndex( KThumbnailSqlParamRowID );
- User::LeaveIfError( paramIndex1 );
- User::LeaveIfError( stmt_info->BindInt64( paramIndex1, rowid ));
-
- TInt err = stmt_info->Exec();
- stmt_info->Reset();
- User::LeaveIfError( err );
-
- paramIndex2 = stmt_infodata->ParameterIndex( KThumbnailSqlParamRowID );
- User::LeaveIfError( paramIndex2 );
- User::LeaveIfError( stmt_infodata->BindInt64( paramIndex2, rowid ));
-
- err = stmt_infodata->Exec();
- stmt_infodata->Reset();
- User::LeaveIfError( err );
-
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup - thumbnail deleted" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - MAIN TABLE lookup - thumbnail deleted" );
-
- rowStatus = stmt->Next();
- }
-
- CleanupStack::PopAndDestroy( stmt_infodata );
- CleanupStack::PopAndDestroy( stmt_info );
- CleanupStack::PopAndDestroy( stmt );
-
- //remove delete mark
- User::LeaveIfError( iDatabase.Exec( KThumbnailSqlDeleteFromDeleted ) );
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - MAIN TABLE lookup" );
-
- stmt = &iStmt_KThumbnailSqlSelectRowIDInfoByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- rowStatus = stmt->Next();
-
- CleanupStack::PopAndDestroy( stmt );
-
- // there were matching rows in main table
- if (rowStatus == KSqlAtRow)
- {
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- add to Deleted" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - add to Deleted" );
-
- // only add path to deleted table
- stmt = &iStmt_KThumbnailSqlInsertDeleted;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- count = stmt->Exec();
-
- CleanupStack::PopAndDestroy( stmt );
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::DeleteThumbnailByPathL() -- no thumbs in MAIN" );
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - no thumbs in MAIN" );
- }
- }
-
- if (aTransaction)
- {
- transaction.CommitL();
- CleanupStack::PopAndDestroy( &transaction );
- }
-
-#ifdef _DEBUG
- aStop.UniversalTime();
- TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailStore::DeleteThumbnailByPathL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
- OstTrace1( TRACE_NORMAL, DUP8_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL - took;tookTime=%d", tookTime );
-#endif
-
- // start maintenance if rows in main table were marked
- if (!aForce && count > 0)
- {
- TN_DEBUG2( "CThumbnailStore::DeleteThumbnailByPathL() -- MAIN TABLE lookup - %d rows marked deleted", count);
- OstTrace1( TRACE_NORMAL, DUP9_CTHUMBNAILSTORE_DELETETHUMBNAILSL, "CThumbnailStore::DeleteThumbnailsL -- MAIN TABLE lookup - rows marked deleted;count=%d", count );
-
- iDeleteThumbs = ETrue;
- iActivityManager->Start();
- }
-
- CleanupStack::PopAndDestroy( path );
- }
-
-// -----------------------------------------------------------------------------
-// Rename thumbnails
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::RenameThumbnailsL( const TDesC& aCurrentPath, const TDesC& aNewPath )
- {
- TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL(%S)", &aCurrentPath );
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSTORE_RENAMETHUMBNAILSL, "CThumbnailStore::RenameThumbnailsL;aCurrentPath=%S", aCurrentPath );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() read only, skip..." );
- return;
- }
-
-#ifdef _DEBUG
- TTime aStart, aStop;
- aStart.UniversalTime();
-#endif
-
- User::LeaveIfError( CheckDbState() );
-
- TInt paramIndex = 0;
-
- HBufC* path = aCurrentPath.AllocLC();
- TPtr ptr(path->Des());
- StripDriveLetterL( ptr );
-
- HBufC* newPath = aNewPath.AllocLC();
- TPtr ptr2(newPath->Des());
- StripDriveLetterL( ptr2 );
-
- RThumbnailTransaction transaction( iDatabase );
- CleanupClosePushL( transaction );
- transaction.BeginL();
-
- TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() -- TEMP TABLE" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_RENAMETHUMBNAILSL, "CThumbnailStore::RenameThumbnailsL - TEMP TABLE" );
-
- RSqlStatement* stmt = NULL;
- stmt = &iStmt_KThumbnailTempRename;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamNewPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *newPath ));
-
- User::LeaveIfError( stmt->Exec() );
-
- TN_DEBUG1( "CThumbnailStore::RenameThumbnailsL() -- MAIN TABLE" );
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_RENAMETHUMBNAILSL, "CThumbnailStore::RenameThumbnailsL - MAIN TABLE" );
-
- CleanupStack::PopAndDestroy( stmt );
- stmt = &iStmt_KThumbnailRename;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamNewPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *newPath ));
-
- User::LeaveIfError( stmt->Exec() );
-
- CleanupStack::PopAndDestroy( stmt );
-
- // if thumb was for some reason already marked deleted, clean from deleted
- User::LeaveIfError( iDatabase.Exec( KThumbnailSqlDeleteFromDeleted ) );
-
- transaction.CommitL();
- CleanupStack::PopAndDestroy( &transaction );
-
- CleanupStack::PopAndDestroy( newPath );
- CleanupStack::PopAndDestroy( path );
-
-#ifdef _DEBUG
- aStop.UniversalTime();
- TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailStore::RenameThumbnailsL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_RENAMETHUMBNAILSL, "CThumbnailStore::RenameThumbnailsL;tookTime=%d", tookTime );
-#endif
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::PersistentSizes()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::SetPersistentSizes(const RArray < TThumbnailPersistentSize > &aSizes)
- {
- iPersistentSizes = aSizes;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::FlushCacheTable()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailStore::FlushCacheTable( TBool aForce )
- {
- TN_DEBUG1("CThumbnailStore::FlushCacheTable() in");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - in" );
-
- StopAutoFlush();
-
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::FlushCacheTable() read only, skip..." );
- return;
- }
-
- if(iBatchItemCount <= 0 || CheckDbState() != KErrNone)
- {
- // cache empty or db unusable
- TN_DEBUG1( "CThumbnailStore::FlushCacheTable() error ");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - error" );
- return;
- }
-
- // longer flush allowed if MTP sync on
- TInt MPXHarvesting(0);
- TInt ret = RProperty::Get(KTAGDPSNotification, KMPXHarvesting, MPXHarvesting);
- if(ret != KErrNone)
- {
- TN_DEBUG2( "CThumbnailStore::FlushCacheTable() error checking MTP sync: %d", ret);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - error checking MTP sync;ret=%d", ret );
- }
-
- //set init max flush delay
- TReal32 aMaxFlushDelay(KMaxFlushDelay);
- TReal32 aPreviousFlushDelay(iPreviousFlushDelay);
- TReal32 aBatchFlushItemCount(iBatchFlushItemCount);
-
- if(MPXHarvesting)
- {
- //MTP or MPX harvesting active, allow longer flush -> bigger batch size
- TN_DEBUG1("CThumbnailStore::FlushCacheTable() MTP sync, longer flush..");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - MTP sync, longer flush.." );
- aMaxFlushDelay = KMaxMTPFlushDelay;
- }
-
- //1st item in batch
- if( iBatchItemCount == 1)
- {
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() calculate new batch size iPreviousFlushDelay = %d", iPreviousFlushDelay);
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable;iPreviousFlushDelay=%d", iPreviousFlushDelay );
- //adjust batch size dynamically between min and max based on previous flush speed
- if( iPreviousFlushDelay > 0 )
- {
- TReal32 aNewBatchFlushItemCount = aMaxFlushDelay / aPreviousFlushDelay * aBatchFlushItemCount;
- iBatchFlushItemCount = (TInt)aNewBatchFlushItemCount;
-
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() aMaxFlushDelay %e", aMaxFlushDelay);
- OstTrace1( TRACE_NORMAL, DUP5_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable;aMaxFlushDelay=%d", aMaxFlushDelay );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() aPreviousFlushDelay %e", aPreviousFlushDelay);
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable;aPreviousFlushDelay=%d", aPreviousFlushDelay );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() aBatchFlushItemCount %e", aBatchFlushItemCount);
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable;aBatchFlushItemCount=%d", aBatchFlushItemCount );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() aNewBatchFlushItemCount %e", aNewBatchFlushItemCount);
- OstTrace1( TRACE_NORMAL, DUP8_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable;aNewBatchFlushItemCount=%d", aNewBatchFlushItemCount );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() iBatchFlushItemCount %d", iBatchFlushItemCount);
- OstTrace1( TRACE_NORMAL, DUP9_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable;iBatchFlushItemCount=%d", iBatchFlushItemCount );
-
- if( iBatchFlushItemCount < KMInBatchItems )
- {
- iBatchFlushItemCount = KMInBatchItems;
- }
- else if( iBatchFlushItemCount > KMaxBatchItems )
- {
- iBatchFlushItemCount = KMaxBatchItems;
- }
- }
- else
- {
- //cannot calculate, init values set to min
- iBatchFlushItemCount = KMInBatchItems;
- }
- }
-
- TN_DEBUG3("CThumbnailStore::FlushCacheTable() iBatchFlushItemCount = %d, iBatchItemCount = %d", iBatchFlushItemCount, iBatchItemCount);
- OstTrace0( TRACE_NORMAL, DUP10_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable" );
-
- if( iBatchItemCount < iBatchFlushItemCount && !aForce)
- {
- //some items in cache
- StartAutoFlush();
- return;
- }
-
- iStartFlush.UniversalTime();
-
- // Move data from temp table to main....
- TInt err_begin = iDatabase.Exec( KThumbnailBeginTransaction );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() KThumbnailBeginTransaction %d", err_begin);
- OstTrace1( TRACE_NORMAL, DUP11_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - KThumbnailBeginTransaction;err_begin=%d", err_begin );
-
- TInt err_tempinfo = iDatabase.Exec( KThumbnailMoveFromTempInfoToMainTable );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() KThumbnailMoveFromTempInfoToMainTable %d", err_tempinfo);
- OstTrace1( TRACE_NORMAL, DUP12_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - KThumbnailMoveFromTempInfoToMainTable;err_tempinfo=%d", err_tempinfo );
-
-#ifdef _DEBUG
- if(err_tempinfo < 0)
- {
- TPtrC errorMsg = iDatabase.LastErrorMessage();
- TN_DEBUG2( "CThumbnailStore::FlushCacheTable() lastError %S", &errorMsg);
- OstTraceExt1( TRACE_NORMAL, DUP13_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - lastError;errorMsg=%S", errorMsg );
- }
-#endif
-
- TInt err_tempdata = iDatabase.Exec( KThumbnailMoveFromTempDataToMainTable );
-
-#ifdef _DEBUG
- if(err_tempdata < 0)
- {
- TPtrC errorMsg2 = iDatabase.LastErrorMessage();
- TN_DEBUG2( "CThumbnailStore::FlushCacheTable() KThumbnailMoveFromTempDataToMainTable %S", &errorMsg2);
- OstTraceExt1( TRACE_NORMAL, DUP14_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - KThumbnailMoveFromTempDataToMainTable;errorMsg2=%S", errorMsg2 );
- }
-#endif
-
- TInt err_delinfo = iDatabase.Exec( KThumbnailDeleteFromTempInfoTable );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() KThumbnailDeleteFromTempInfoTable %d", err_delinfo);
- OstTrace1( TRACE_NORMAL, DUP15_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - KThumbnailDeleteFromTempInfoTable;err_delinfo=%d", err_delinfo );
-
- TInt err_deldata = iDatabase.Exec( KThumbnailDeleteFromTempDataTable );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() KThumbnailDeleteFromTempDataTable %d", err_deldata);
- OstTrace1( TRACE_NORMAL, DUP16_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable;err_deldata=%d", err_deldata );
-
- if( err_tempinfo < 0 || err_tempdata < 0 || err_delinfo < 0 || err_deldata < 0 )
- {
- TInt err = iDatabase.Exec( KThumbnailRollbackTransaction );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() KThumbnailRollbackTransaction %d", err);
- OstTrace1( TRACE_NORMAL, DUP17_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - KThumbnailRollbackTransaction;err=%d", err );
- }
- else
- {
- TInt err_commit = iDatabase.Exec( KThumbnailCommitTransaction );
- TN_DEBUG2("CThumbnailStore::FlushCacheTable() KThumbnailCommitTransaction %d", err_commit);
- OstTrace0( TRACE_NORMAL, DUP18_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable" );
- }
-
- // db got corrupted
- if(err_tempinfo == KSqlErrCorrupt || err_tempinfo == KErrCorrupt ||
- err_tempdata == KSqlErrCorrupt || err_tempdata == KErrCorrupt)
- {
- TN_DEBUG1("CThumbnailStore::FlushCacheTable() db corrupted");
- OstTrace0( TRACE_NORMAL, DUP19_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - db corrupted" );
-
- // open new
- TRAP_IGNORE(OpenDatabaseL(ETrue));
- }
-
- iStopFlush.UniversalTime();
- iPreviousFlushDelay = (TInt)iStopFlush.MicroSecondsFrom(iStartFlush).Int64()/1000;
-
- TN_DEBUG2( "CThumbnailStore::FlushCacheTable() took %d ms", iPreviousFlushDelay);
- OstTrace1( TRACE_NORMAL, DUP20_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - took ms ;iPreviousFlushDelay=%d", iPreviousFlushDelay );
-
- //cache flushed
- iBatchItemCount = 0;
-
- TN_DEBUG1("CThumbnailStore::FlushCacheTable() out");
- OstTrace0( TRACE_NORMAL, DUP21_CTHUMBNAILSTORE_FLUSHCACHETABLE, "CThumbnailStore::FlushCacheTable - out" );
- }
-
-// -----------------------------------------------------------------------------
-// StartAutoFlush()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::StartAutoFlush()
- {
- TN_DEBUG1( "CThumbnailStore::StartAutoFlush()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_STARTAUTOFLUSH, "CThumbnailStore::StartAutoFlush" );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::StartAutoFlush() read only, skip..." );
- return;
- }
-
- TInt err = KErrNone;
-
- if( iAutoFlushTimer )
- {
- iAutoFlushTimer->Cancel();
- }
- else
- {
- TRAP(err, iAutoFlushTimer = CPeriodic::NewL(CActive::EPriorityIdle) );
- }
-
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbnailStore::StartAutoFlush() - Error creating timer (%d)", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_STARTAUTOFLUSH, "CThumbnailStore::StartAutoFlush - - Error creating timer;err=%d", err );
- }
- else
- {
- iAutoFlushTimer->Start( KAutoFlushTimeout * 1000000, KAutoFlushTimeout * 1000000,
- TCallBack(AutoFlushTimerCallBack, this));
- }
- }
-
-// -----------------------------------------------------------------------------
-// StopAutoFlush()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::StopAutoFlush()
- {
- TN_DEBUG1( "CThumbnailStore::StopAutoFlush()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_STOPAUTOFLUSH, "CThumbnailStore::StopAutoFlush" );
- if( iAutoFlushTimer )
- {
- iAutoFlushTimer->Cancel();
- }
- }
-
-// -----------------------------------------------------------------------------
-// StartMaintenance()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::StartMaintenance()
- {
- TN_DEBUG1( "CThumbnailStore::StartMaintenance()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_STARTMAINTENANCE, "CThumbnailStore::StartMaintenance" );
- TInt err = KErrNone;
-
- if( iMaintenanceTimer && iMaintenanceTimer->IsActive() )
- {
- return;
- }
- else if (!iMaintenanceTimer)
- {
- TRAP(err, iMaintenanceTimer = CPeriodic::NewL(CActive::EPriorityIdle) );
- }
-
- if (err != KErrNone && !iMaintenanceTimer)
- {
- TN_DEBUG2( "CThumbnailStore::StartMaintenanceTimer() - Error creating timer (%d)", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_STARTMAINTENANCE, "CThumbnailStore::StartMaintenance - Error creating timer ;err=%d", err );
- }
- else
- {
- iMaintenanceTimer->Start( KStoreMaintenancePeriodic, KStoreMaintenancePeriodic,
- TCallBack(MaintenanceTimerCallBack, this));
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::AutoFlushTimerCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailStore::AutoFlushTimerCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbnailStore::AutoFlushTimerCallBack()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_AUTOFLUSHTIMERCALLBACK, "CThumbnailStore::AutoFlushTimerCallBack" );
- CThumbnailStore* self = static_cast<CThumbnailStore*>( aAny );
-
- self->FlushCacheTable(ETrue);
-
- return KErrNone; // Return value ignored by CPeriodic
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailStore::MaintenanceTimerCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailStore::MaintenanceTimerCallBack(TAny* aAny)
- {
- CThumbnailStore* self = static_cast<CThumbnailStore*>( aAny );
-
- self->iMaintenanceTimer->Cancel();
-
- TInt MPXHarvesting(0);
- TInt DaemonProcessing(0);
- TInt ret = RProperty::Get(KTAGDPSNotification, KMPXHarvesting, MPXHarvesting);
- if(ret != KErrNone || MPXHarvesting)
- {
- TN_DEBUG3( "CThumbnailStore::MaintenanceTimerCallBack() KMPXHarvesting err == %d, MPXHarvesting == %d", ret, MPXHarvesting);
- OstTraceExt2( TRACE_NORMAL, CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack;ret=%d;MPXHarvesting=%d", ret, MPXHarvesting );
- self->iIdle = EFalse;
- }
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() KMPXHarvesting == %d", MPXHarvesting);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack;MPXHarvesting=%d", MPXHarvesting );
-
- ret = RProperty::Get(KTAGDPSNotification, KDaemonProcessing, DaemonProcessing);
- if(ret != KErrNone || DaemonProcessing)
- {
- TN_DEBUG3( "CThumbnailStore::MaintenanceTimerCallBack() KDaemonProcessing err == %d, DaemonProcessing == %d", ret, DaemonProcessing);
- OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack;ret=%d;DaemonProcessing=%d", ret, DaemonProcessing );
- self->iIdle = EFalse;
- }
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() DaemonProcessing == %d", DaemonProcessing);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack;DaemonProcessing=%d", DaemonProcessing );
-
- if (self->iIdle)
- {
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - maintenance, store %d", self->iDrive);
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - maintenance, store;self->iDrive=%d", self->iDrive );
-
- // thumbmnail deletion
- if (self->iDeleteThumbs)
- {
- TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - cleanup" );
-
- TInt deleteCount = 0;
-
- // delete marked rows from database
- TRAPD( err, deleteCount = self->DeleteMarkedL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup failed, err %d", err);
- OstTrace1( TRACE_NORMAL, DUP6_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - cleanup failed;err=%d", err );
- return err;
- }
-
- // no more marked rows
- if (deleteCount < KStoreMaintenanceDeleteLimit || deleteCount == 0)
- {
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - cleanup finished, store %d", self->iDrive);
- OstTrace1( TRACE_NORMAL, DUP7_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - cleanup finished, store;self->iDrive=%d", self->iDrive );
- self->iDeleteThumbs = EFalse;
- }
- }
-
- // file existence check
- else if (self->iCheckFilesExist)
- {
- TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check");
- OstTrace0( TRACE_NORMAL, DUP8_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - file existence check" );
-
- TBool finished = EFalse;
-
- TRAPD( err, finished = self->FileExistenceCheckL() );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check failed, err %d", err);
- OstTrace1( TRACE_NORMAL, DUP9_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - file existence check failed;err=%d", err );
- return err;
- }
-
- // all files checked.
- if (finished)
- {
- TN_DEBUG2( "CThumbnailStore::MaintenanceTimerCallBack() - file existence check finished, store %d", self->iDrive);
- OstTrace1( TRACE_NORMAL, DUP10_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - file existence check finished, store;self->iDrive=%d", self->iDrive );
- self->iCheckFilesExist = EFalse;
- }
- }
-
- // next round
- if (self->iIdle && ( self->iDeleteThumbs || self->iCheckFilesExist) )
- {
- TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - continue maintenance");
- OstTrace0( TRACE_NORMAL, DUP11_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - continue maintenance" );
- self->StartMaintenance();
- }
- else if (!self->iDeleteThumbs && !self->iCheckFilesExist)
- {
- TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - no more maintenance");
- OstTrace0( TRACE_NORMAL, DUP12_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - no more maintenance" );
-
- // no need to monitor activity anymore
- self->iActivityManager->Cancel();
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailStore::MaintenanceTimerCallBack() - device not idle");
- OstTrace0( TRACE_NORMAL, DUP13_CTHUMBNAILSTORE_MAINTENANCETIMERCALLBACK, "CThumbnailStore::MaintenanceTimerCallBack - device not idle" );
- }
-
- return KErrNone; // Return value ignored by CPeriodic
- }
-
-TBool CThumbnailStore::CheckModifiedByPathL( const TDesC& aPath, const TInt64 aModified, TBool& modifiedChanged )
- {
- TN_DEBUG2( "CThumbnailStore::CheckModifiedByPathL() %S", &aPath);
- OstTraceExt1( TRACE_NORMAL, CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL;aPath=%S", aPath );
-
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedByPathL() read only, skip..." );
- modifiedChanged = EFalse;
- return ETrue;
- }
-
- User::LeaveIfError( CheckDbState() );
-
- HBufC* path = aPath.AllocLC();
- TPtr ptr(path->Des());
- StripDriveLetterL( ptr );
-
- TBool ret(EFalse);
-
- modifiedChanged = EFalse;
-
- TInt column = 0;
-
- RSqlStatement* stmt = NULL;
- stmt = &iStmt_KThumbnailSelectTempModifiedByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- TInt paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- TInt rowStatus = stmt->Next();
-
- TBool checkMain = EFalse;
-
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- temp" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL -- temp" );
-
- while(rowStatus == KSqlAtRow || !checkMain)
- {
- if(rowStatus == KSqlAtRow)
- {
- ret = ETrue;
- TInt64 oldModified = stmt->ColumnInt64( column );
-
- TN_DEBUG2( "CThumbnailStore::CheckModifiedL() -- timestamp old %Ld", oldModified);
- OstTraceExt1( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL -- timestamp old;oldModified=%Ld", oldModified );
- TN_DEBUG2( "CThumbnailStore::CheckModifiedL() -- timestamp mds %Ld", aModified);
- OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL -- timestamp mds;aModified=%Ld", aModified );
-
- if (oldModified < aModified)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is newer than original" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL -- timestamp is newer than original" );
- modifiedChanged = ETrue;
- break;
- }
- else if (oldModified > aModified)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is older than original" );
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL -- timestamp is older than original" );
- }
- else if (oldModified == aModified)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- timestamp is the same as original" );
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL -- timestamp is the same as original" );
- }
-
- rowStatus = stmt->Next();
- }
-
- //switch to main table if modified not found from temp
- if(rowStatus != KSqlAtRow && !checkMain && !modifiedChanged)
- {
- TN_DEBUG1( "CThumbnailStore::CheckModifiedL() -- main" );
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSTORE_CHECKMODIFIEDBYPATHL, "CThumbnailStore::CheckModifiedByPathL -- main" );
- //come here only once
- checkMain = ETrue;
-
- CleanupStack::PopAndDestroy( stmt );
- stmt = &iStmt_KThumbnailSelectModifiedByPath;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamPath );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindText( paramIndex, *path ));
-
- rowStatus = stmt->Next();
- }
- }
-
- CleanupStack::PopAndDestroy( stmt );
- CleanupStack::PopAndDestroy( path );
-
- return ret;
-}
-
-
-// -----------------------------------------------------------------------------
-// IsReadOnly()
-// -----------------------------------------------------------------------------
-//
-TBool CThumbnailStore::IsReadOnly()
- {
- return iReadOnly;
- }
-
-// -----------------------------------------------------------------------------
-// PrepareBlacklistedItemsForRetryL()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::PrepareBlacklistedItemsForRetryL()
- {
- TN_DEBUG1( "CThumbnailStore::PrepareBlacklistedItemsForRetry()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_PREPAREBLACKLISTEDITEMSFORRETRYL, "CThumbnailStore::PrepareBlacklistedItemsForRetryL" );
-
- RSqlStatement stmt;
- CleanupClosePushL( stmt );
-
- User::LeaveIfError( stmt.Prepare( iDatabase, KThumbnailTouchBlacklistedRows ));
-
- TInt paramIndex = stmt.ParameterIndex( KThumbnailSqlParamFlag );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt.BindInt( paramIndex, KThumbnailDbFlagBlacklisted ));
- TInt err = stmt.Exec();
-
- TN_DEBUG2( "CThumbnailStore::PrepareBlacklistedItemsForRetryL() - main table, err=%d", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_PREPAREBLACKLISTEDITEMSFORRETRYL, "CThumbnailStore::PrepareBlacklistedItemsForRetryL - main table;err=%d", err );
-
- CleanupStack::PopAndDestroy( &stmt );
- }
-
-// -----------------------------------------------------------------------------
-// DeleteMarkedL()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailStore::DeleteMarkedL()
- {
- TN_DEBUG1( "CThumbnailStore::DeleteMarkedL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_DELETEMARKEDL, "CThumbnailStore::DeleteMarkedL" );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::DeleteMarkedL() read only, skip..." );
- return KErrAccessDenied;
- }
-
-#ifdef _DEBUG
- TTime aStart, aStop;
- aStart.UniversalTime();
-#endif
-
- User::LeaveIfError( CheckDbState() );
-
- TInt paramIndex = 0;
- TInt paramIndex1 = 0;
- TInt paramIndex2 = 0;
- TInt rowStatus = 0;
- TInt column = 0;
- TInt64 rowid = 0;
- TInt deleteCount = 0;
-
- RThumbnailTransaction transaction( iDatabase );
- CleanupClosePushL( transaction );
- transaction.BeginL();
-
- RSqlStatement* stmt = NULL;
- RSqlStatement* stmt_info = NULL;
- RSqlStatement* stmt_infodata = NULL;
-
- stmt = &iStmt_KThumbnailSqlSelectMarked;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
- stmt_info = &iStmt_KThumbnailSqlDeleteInfoByRowID;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt_info));
- stmt_infodata = &iStmt_KThumbnailSqlDeleteInfoDataByRowID;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt_infodata));
-
- // select marked rows
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamLimit );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, KStoreMaintenanceDeleteLimit ));
-
- rowStatus = stmt->Next();
-
- while(rowStatus == KSqlAtRow)
- {
- rowid = stmt->ColumnInt64( column );
- paramIndex1 = stmt_info->ParameterIndex( KThumbnailSqlParamRowID );
- User::LeaveIfError( paramIndex1 );
- User::LeaveIfError( stmt_info->BindInt64( paramIndex1, rowid ));
-
- TInt err = stmt_info->Exec();
- stmt_info->Reset();
- User::LeaveIfError( err );
-
- paramIndex2 = stmt_infodata->ParameterIndex( KThumbnailSqlParamRowID );
- User::LeaveIfError( paramIndex2 );
- User::LeaveIfError( stmt_infodata->BindInt64( paramIndex2, rowid ));
-
- err = stmt_infodata->Exec();
- stmt_infodata->Reset();
- User::LeaveIfError( err );
- deleteCount++;
-
- TN_DEBUG1( "CThumbnailStore::DeleteMarkedL() - thumbnail deleted" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_DELETEMARKEDL, "CThumbnailStore::DeleteMarkedL - thumbnail deleted" );
-
- rowStatus = stmt->Next();
- }
-
- CleanupStack::PopAndDestroy( stmt_infodata );
- CleanupStack::PopAndDestroy( stmt_info );
- CleanupStack::PopAndDestroy( stmt );
-
- // remove successfully deleted paths from Deleted table
- if (deleteCount > 0)
- {
- User::LeaveIfError( iDatabase.Exec( KThumbnailSqlDeleteFromDeleted ) );
- }
-
- transaction.CommitL();
- CleanupStack::PopAndDestroy( &transaction );
-
-#ifdef _DEBUG
- aStop.UniversalTime();
- TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailStore::DeleteMarkedL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_DELETEMARKEDL, "CThumbnailStore::DeleteMarkedL - took ms;tookTime=%d", tookTime );
-#endif
-
- return deleteCount;
- }
-
-// -----------------------------------------------------------------------------
-// FileExistenceCheckL()
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailStore::FileExistenceCheckL()
- {
- TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL()" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_FILEEXISTENCECHECKL, "CThumbnailStore::FileExistenceCheckL" );
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::FileExistenceCheckL() read only, skip..." );
- return ETrue;
- }
-
-#ifdef _DEBUG
- TTime aStart, aStop;
- aStart.UniversalTime();
-#endif
-
- User::LeaveIfError( CheckDbState() );
-
- TInt paramIndex = 0;
- TInt rowStatus = 0;
- TInt column = 0;
- TInt64 rowid = 0;
- TFileName path;
- TFileName prevPath;
- TFileName full;
- TInt count = 0;
-
- TBool finished = EFalse;
-
- RThumbnailTransaction transaction( iDatabase );
- CleanupClosePushL( transaction );
- transaction.BeginL();
-
- // get rows
- RSqlStatement* stmt = NULL;
- stmt = &iStmt_KThumbnailSelectAllPaths;
- CleanupStack::PushL(TCleanupItem(ResetStatement, stmt));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamRowID );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt64( paramIndex, iLastCheckedRowID ));
-
- paramIndex = stmt->ParameterIndex( KThumbnailSqlParamLimit );
- User::LeaveIfError( paramIndex );
- User::LeaveIfError( stmt->BindInt( paramIndex, KStoreMaintenanceExistLimit ));
-
- rowStatus = stmt->Next();
-
- while(rowStatus == KSqlAtRow)
- {
- column = 0;
- path.Zero();
-
- rowid = stmt->ColumnInt64( column++ );
- stmt->ColumnText( column, path );
-
- full.Zero();
- full.Append(iDriveChar);
- full.Append(KDrv);
- full.Append(path);
-
- // if path matches previous one, skip
- if (path.CompareF(prevPath) != 0)
- {
- // file doesn't exist anymore, mark thumbs deleted
- if(!BaflUtils::FileExists( iFs, full ))
- {
- TN_DEBUG2( "CThumbnailStore::FileExistenceCheckL(%S) - not found", &full );
- DeleteThumbnailsL(path, EFalse, EFalse);
- }
-
- prevPath.Zero();
- prevPath.Append(path);
- }
-
- iLastCheckedRowID = rowid;
- count++;
-
- // get next
- rowStatus = stmt->Next();
- }
-
- if (count < KStoreMaintenanceExistLimit)
- {
- // all rows checked
- finished = ETrue;
- }
-
- CleanupStack::PopAndDestroy( stmt );
-
- transaction.CommitL();
- CleanupStack::PopAndDestroy( &transaction );
-
-#ifdef _DEBUG
- aStop.UniversalTime();
- TInt tookTime = (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000;
- TN_DEBUG2( "CThumbnailStore::FileExistenceCheckL() took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_FILEEXISTENCECHECKL, "CThumbnailStore::FileExistenceCheckL - took ms;tookTime=%d", tookTime );
-#endif
-
- return finished;
- }
-
-// -----------------------------------------------------------------------------
-// StripDriveLetter
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::StripDriveLetterL( TDes& aPath )
- {
- TInt pos = aPath.Find(KDrv);
- TInt pos2 = aPath.Find(KBackSlash);
-
- // if URI contains drive letter
- if ( pos == 1 )
- {
- // normal URI
- if ( pos2 == 2 )
- {
- aPath.Delete(0,pos+1);
- }
- // virtual URI
- else
- {
- aPath.Replace(0,2,KBackSlash);
- }
- }
- }
-
-// -----------------------------------------------------------------------------
-// CheckDbState
-// -----------------------------------------------------------------------------
-//
-TInt CThumbnailStore::CheckDbState()
- {
- if (iUnrecoverable && !iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::CheckDbState() - database in unrecoverable state" );
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTORE_CHECKDBSTATE, "CThumbnailStore::CheckDbState" );
- __ASSERT_DEBUG( !iUnrecoverable, ThumbnailPanic( EThumbnailDatabaseUnrecoverable ));
-
- return KStoreUnrecoverableErr;
- }
- else
- {
- return KErrNone;
- }
- }
-
-void CThumbnailStore::HandleDiskSpaceNotificationL( TBool aDiskFull )
- {
- TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceNotificationL() aDiskFull = %d", aDiskFull );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTORE_HANDLEDISKSPACENOTIFICATIONL, "CThumbnailStore::HandleDiskSpaceNotificationL;aDiskFull=%u", aDiskFull );
- iDiskFull = aDiskFull;
- }
-
-#ifdef _DEBUG
-void CThumbnailStore::HandleDiskSpaceError(TInt aError )
-#else
-void CThumbnailStore::HandleDiskSpaceError(TInt /*aError*/ )
-#endif
- {
- TN_DEBUG2( "CThumbnailStore::HandleDiskSpaceError() aError = %d", aError );
-#ifdef _DEBUG
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTORE_HANDLEDISKSPACEERROR, "CThumbnailStore::HandleDiskSpaceError;aError=%d", aError );
-#endif
- }
-
-TBool CThumbnailStore::IsDiskFull()
- {
- if(iReadOnly)
- {
- TN_DEBUG1( "CThumbnailStore::IsDiskFull() read only, skip..." );
- return EFalse;
- }
- return iDiskFull;
- }
-
-// -----------------------------------------------------------------------------
-// ActivityDetected()
-// -----------------------------------------------------------------------------
-//
-void CThumbnailStore::ActivityChanged(const TBool aActive)
- {
- TN_DEBUG2( "CThumbnailStore::ActivityChanged() aActive == %d", aActive);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTORE_ACTIVITYCHANGED, "CThumbnailStore::ActivityChanged;aActive=%u", aActive );
- if( iReadOnly )
- {
- TN_DEBUG1( "CThumbnailStore::ActivityChanged() read only, skip..." );
- return;
- }
-
- if( aActive )
- {
- iIdle = EFalse;
- }
- else
- {
- TInt MPXHarvesting(0);
- TInt DaemonProcessing(0);
-
- TInt ret = RProperty::Get(KTAGDPSNotification, KMPXHarvesting, MPXHarvesting);
- if(ret != KErrNone || MPXHarvesting)
- {
- TN_DEBUG3( "CThumbnailStore::ActivityChanged() KMPXHarvesting err == %d, MPXHarvesting == %d", ret, MPXHarvesting);
- OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILSTORE_ACTIVITYCHANGED, "CThumbnailStore::ActivityChanged;ret=%d;MPXHarvesting=%d", ret, MPXHarvesting );
- iIdle = EFalse;
- return;
- }
-
- ret = RProperty::Get(KTAGDPSNotification, KDaemonProcessing, DaemonProcessing);
- if(ret != KErrNone || DaemonProcessing)
- {
- TN_DEBUG3( "CThumbnailStore::ActivityChanged() KDaemonProcessing err == %d DaemonProcessing == %d", ret, DaemonProcessing );
- OstTraceExt2( TRACE_NORMAL, DUP2_CTHUMBNAILSTORE_ACTIVITYCHANGED, "CThumbnailStore::ActivityChanged - KDaemonProcessing;ret=%d;DaemonProcessing=%d", ret, DaemonProcessing );
- iIdle = EFalse;
- return;
- }
-
- TN_DEBUG1( "CThumbnailStore::ActivityChanged() - starting maintenance");
- OstTrace0( TRACE_NORMAL, DUP3_CTHUMBNAILSTORE_ACTIVITYCHANGED, "CThumbnailStore::ActivityChanged - starting maintenance" );
- iIdle = ETrue;
- StartMaintenance();
- }
- }
-
-
-// -----------------------------------------------------------------------------
-// CThumbnailStoreDiskSpaceNotifierAO class
-// -----------------------------------------------------------------------------
-//
-CThumbnailStoreDiskSpaceNotifierAO* CThumbnailStoreDiskSpaceNotifierAO::NewL(
- MThumbnailStoreDiskSpaceNotifierObserver& aObserver, TInt64 aThreshold, const TDesC& aFilename)
- {
- CThumbnailStoreDiskSpaceNotifierAO* self =
- CThumbnailStoreDiskSpaceNotifierAO::NewLC( aObserver, aThreshold, aFilename);
- CleanupStack::Pop( self );
- return self;
- }
-
-CThumbnailStoreDiskSpaceNotifierAO* CThumbnailStoreDiskSpaceNotifierAO::NewLC(
- MThumbnailStoreDiskSpaceNotifierObserver& aObserver, TInt64 aThreshold, const TDesC& aFilename)
- {
- TDriveNumber driveNumber = GetDriveNumberL( aFilename );
-
- CThumbnailStoreDiskSpaceNotifierAO* self =
- new ( ELeave ) CThumbnailStoreDiskSpaceNotifierAO( aObserver, aThreshold, driveNumber );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-TDriveNumber CThumbnailStoreDiskSpaceNotifierAO::GetDriveNumberL( const TDesC& aFilename )
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::GetDriveNumberL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTOREDISKSPACENOTIFIERAO_GETDRIVENUMBERL, "CThumbnailStoreDiskSpaceNotifierAO::GetDriveNumberL" );
- TLex driveParser( aFilename );
-
- TChar driveChar = driveParser.Get();
-
- if( 0 == driveChar || TChar( ':' ) != driveParser.Peek() )
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::GetDriveNumberL() KErrArgument");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_GETDRIVENUMBERL, "CThumbnailStoreDiskSpaceNotifierAO::GetDriveNumberL - KErrArgument" );
- User::Leave( KErrArgument );
- }
-
- TInt driveNumber;
-
- RFs::CharToDrive( driveChar, driveNumber );
-
- return (TDriveNumber)driveNumber;
- }
-
-CThumbnailStoreDiskSpaceNotifierAO::~CThumbnailStoreDiskSpaceNotifierAO()
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::~CThumbnailStoreDiskSpaceNotifierAO()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTOREDISKSPACENOTIFIERAO_CTHUMBNAILSTOREDISKSPACENOTIFIERAO, "CThumbnailStoreDiskSpaceNotifierAO::~CThumbnailStoreDiskSpaceNotifierAO" );
- Cancel();
-
- iFileServerSession.Close();
- }
-
-void CThumbnailStoreDiskSpaceNotifierAO::RunL()
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::RunL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL" );
- TVolumeInfo volumeInfo;
-
- if ( iState == CThumbnailStoreDiskSpaceNotifierAO::ENormal )
- {
- TInt status = iStatus.Int();
-
- TInt ret(KErrNone);
-
- switch( status )
- {
- case KErrNone:
- ret = iFileServerSession.Volume( volumeInfo, iDrive );
-
- if(!ret)
- {
- // Check if free space is less than threshold level
- if( volumeInfo.iFree < iThreshold )
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::RunL() FULL");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL - FULL" );
- iDiskFull = ETrue;
- iObserver.HandleDiskSpaceNotificationL( iDiskFull );
- iState = EIterate;
- iIterationCount = 0;
- SetActive();
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- return;
- }
- else
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::RunL() NOT FULL");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL - NOT FULL" );
- iDiskFull = EFalse;
- iObserver.HandleDiskSpaceNotificationL( iDiskFull );
- }
- }
- else
- {
- TN_DEBUG2( "CThumbnailStoreDiskSpaceNotifierAO::RunL() error %d NOT FULL", ret);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL - NOT FULL;ret=%d", ret );
- iDiskFull = EFalse;
- iObserver.HandleDiskSpaceNotificationL( iDiskFull );
- User::Leave( ret );
- }
-
- StartNotifier();
- break;
-
- case KErrArgument:
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::RunL() KErrArgument");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL - KErrArgument" );
- User::Leave( status );
- break;
- default:
- break;
- }
- }
- else if ( iState == CThumbnailStoreDiskSpaceNotifierAO::EIterate )
- {
- const TInt KMaxIterations = 10;
-
- User::LeaveIfError( iFileServerSession.Volume( volumeInfo, iDrive ) );
- if ( volumeInfo.iFree < iThreshold )
- {
- iObserver.HandleDiskSpaceNotificationL( iDiskFull );
- ++iIterationCount;
- if ( iIterationCount < KMaxIterations )
- {
- SetActive();
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- return;
- }
- else
- {
- User::LeaveIfError( iFileServerSession.Volume( volumeInfo, iDrive ) );
- if ( volumeInfo.iFree >= iThreshold )
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::RunL() NOT FULL");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL - NOT FULL" );
- iDiskFull = EFalse;
- }
- }
- }
- else
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::RunL() NOT FULL");
- OstTrace0( TRACE_NORMAL, DUP6_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL - NOT FULL" );
- iDiskFull = EFalse;
- }
- iState = ENormal;
- iIterationCount = 0;
- StartNotifier();
- }
- else
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::RunL() KErrGeneral");
- OstTrace0( TRACE_NORMAL, DUP7_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNL, "CThumbnailStoreDiskSpaceNotifierAO::RunL - KErrGeneral" );
- User::Leave( KErrGeneral );
- }
- }
-
-TInt CThumbnailStoreDiskSpaceNotifierAO::RunError(TInt aError)
- {
- TN_DEBUG2( "CThumbnailStoreDiskSpaceNotifierAO::RunError() %d", aError);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTOREDISKSPACENOTIFIERAO_RUNERROR, "CThumbnailStoreDiskSpaceNotifierAO::RunError;aError=%d", aError );
-
- iObserver.HandleDiskSpaceError( aError );
-
- return KErrNone;
- }
-
-void CThumbnailStoreDiskSpaceNotifierAO::DoCancel()
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::DoCancel()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTOREDISKSPACENOTIFIERAO_DOCANCEL, "CThumbnailStoreDiskSpaceNotifierAO::DoCancel" );
-
- if( IsActive() )
- {
- iFileServerSession.NotifyDiskSpaceCancel();
- }
- }
-
-CThumbnailStoreDiskSpaceNotifierAO::CThumbnailStoreDiskSpaceNotifierAO(
- MThumbnailStoreDiskSpaceNotifierObserver& aObserver, TInt64 aThreshold, const TDriveNumber aDrive)
- : CActive( CActive::EPriorityStandard ),
- iObserver( aObserver ), iThreshold( aThreshold ), iDrive( aDrive ), iState( CThumbnailStoreDiskSpaceNotifierAO::ENormal ), iDiskFull( EFalse )
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::CThumbnailStoreDiskSpaceNotifierAO()");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_CTHUMBNAILSTOREDISKSPACENOTIFIERAO, "CThumbnailStoreDiskSpaceNotifierAO::CThumbnailStoreDiskSpaceNotifierAO" );
- CActiveScheduler::Add( this );
- }
-
-void CThumbnailStoreDiskSpaceNotifierAO::ConstructL()
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::ConstructL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILSTOREDISKSPACENOTIFIERAO_CONSTRUCTL, "CThumbnailStoreDiskSpaceNotifierAO::ConstructL" );
- TInt KMessageSlotCount = 2; // slots for NotifyDiskSpace and NotifyDiskSpaceCancel
-
- User::LeaveIfError( iFileServerSession.Connect( KMessageSlotCount ) );
-
- TVolumeInfo volumeInfo;
- TInt ret = iFileServerSession.Volume( volumeInfo, iDrive );
-
- if( !ret )
- {
- if ( volumeInfo.iFree < iThreshold )
- {
- TN_DEBUG1( "CThumbnailStoreDiskSpaceNotifierAO::ConstructL() FULL");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_CONSTRUCTL, "CThumbnailStoreDiskSpaceNotifierAO::ConstructL - FULL" );
- iDiskFull = ETrue;
- }
- }
- else
- {
- TN_DEBUG2( "CThumbnailStoreDiskSpaceNotifierAO::ConstructL() error %d NOT FULL", ret);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILSTOREDISKSPACENOTIFIERAO_CONSTRUCTL, "CThumbnailStoreDiskSpaceNotifierAO::ConstructL - NOT FULL;ret=%d", ret );
- iDiskFull = EFalse;
- User::Leave( ret );
- }
-
- iObserver.HandleDiskSpaceNotificationL( iDiskFull );
-
- StartNotifier();
- }
-
-void CThumbnailStoreDiskSpaceNotifierAO::StartNotifier()
- {
- TN_DEBUG2( "CThumbnailStoreDiskSpaceNotifierAO::StartNotifier() iDrive == %d", iDrive);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILSTOREDISKSPACENOTIFIERAO_STARTNOTIFIER, "CThumbnailStoreDiskSpaceNotifierAO::StartNotifier;iDrive=%d", iDrive );
- iFileServerSession.NotifyDiskSpace( iThreshold, iDrive, iStatus );
-
- SetActive();
- }
-
-TBool CThumbnailStoreDiskSpaceNotifierAO::DiskFull() const
- {
- return iDiskFull;
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtask.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +0,0 @@
-/*
-* 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 thumbnail server tasks
- *
-*/
-
-
-#include <e32base.h>
-#include <fbs.h>
-#include "thumbnailtask.h"
-#include "thumbnailtaskprocessor.h"
-#include "thumbnailprovider.h"
-#include "thumbnaillog.h"
-#include "thumbnailpanic.h"
-#include "thumbnailserversession.h" // ConvertSqlErrToE32Err()
-#include "thumbnailmanagerconstants.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailtaskTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::CThumbnailTask()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailTask::CThumbnailTask( CThumbnailTaskProcessor& aProcessor, TInt
- aPriority ): CActive( EPriorityStandard ), iProcessor( aProcessor ),
- iPriority( aPriority ), iState( EIdle )
- {
- TN_DEBUG2( "CThumbnailTask(0x%08x)::CThumbnailTask()", this);
- CActiveScheduler::Add( this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::~CThumbnailTask()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailTask::~CThumbnailTask()
- {
- Cancel();
- CancelMessage();
-
- iClientThread.Close();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::Priority()
-// Returns priority of task.
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailTask::Priority()const
- {
- return iPriority;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::State()
-// Returns state of task.
-// ---------------------------------------------------------------------------
-//
-CThumbnailTask::TTaskState CThumbnailTask::State()const
- {
- return iState;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::StartL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::StartL()
- {
- TN_DEBUG3( "CThumbnailTask(0x%08x)::StartL() iState == %d ", this, iState );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_STARTL, "CThumbnailTask::StartL;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_STARTL, "CThumbnailTask::StartL;iState=%u", iState );
-
- __ASSERT_DEBUG(( iState != ERunning ), ThumbnailPanic( EThumbnailAlreadyRunning ));
- iState = ERunning;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::DoCancel()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::Complete()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::Complete( TInt aReason )
- {
- TN_DEBUG4( "CThumbnailTask(0x%08x)::Complete(aReason=%d) iState was %d",
- this, aReason, iState );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_COMPLETE, "CThumbnailTask::Complete;this=%o", this );
- OstTraceExt2( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_COMPLETE, "CThumbnailTask::Complete;aReason=%d;iState=%u", aReason, iState );
-
- if ( iState != EComplete )
- {
- iState = EComplete;
-
- if ( ClientThreadAlive() )
- {
- if( iMessage.Identity() == KDaemonUid )
- {
- iProcessor.SetDaemonAsProcess(ETrue);
- }
- else
- {
- iProcessor.SetDaemonAsProcess(EFalse);
- }
-
- iMessage.Complete( CThumbnailServerSession::ConvertSqlErrToE32Err( aReason ));
- }
-
- ResetMessageData();
-
- iProcessor.TaskComplete( this );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::Continue()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::Continue()
- {
- if ( iState != EComplete )
- {
- iState = EIdle;
- }
-
- iProcessor.TaskComplete( this );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::StartError()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::StartError( TInt aError )
- {
- // This is called if StartL() left. Complete this task with an error and
- // continue processing.
- TN_DEBUG3( "CThumbnailTask(0x%08x)::StartError(aError=%d)", this, aError );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_STARTERROR, "CThumbnailTask::StartError;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_STARTERROR, "CThumbnailTask::StartError;aError=%d", aError );
-
- Complete( aError );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::ChangeTaskPriority()
-// Changes priority of the task.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::ChangeTaskPriority( TInt aNewPriority )
- {
- iPriority = aNewPriority;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::SetMessageData()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::SetMessageData( const TThumbnailServerRequestId&
- aRequestId, const RMessage2& aMessage, const RThread& aClientThread )
- {
- iMessage = aMessage;
- iRequestId = aRequestId;
-
- if ( iMessage.Handle())
- {
- // copy client thread handle
- iClientThread.Duplicate(aClientThread);
- }
- else
- {
- TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - message null", this);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASK_SETMESSAGEDATA, "CThumbnailTask::SetMessageData - message null;this=%o", this );
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::SetMessageData()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::SetMessageData( const TThumbnailServerRequestId&
- aRequestId )
- {
- iMessage = RMessage2();
- iRequestId = aRequestId;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::ResetMessageData()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::ResetMessageData()
- {
- iMessage = RMessage2();
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::ResetMessageData()
-// Returns id of specific task.
-// ---------------------------------------------------------------------------
-//
-TThumbnailServerRequestId CThumbnailTask::RequestId()const
- {
- return iRequestId;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::CancelMessage()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTask::CancelMessage()
- {
- if ( ClientThreadAlive() )
- {
- iMessage.Complete( KErrCancel );
- }
-
- ResetMessageData();
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTask::ClientThreadAlive()
-// Checks if client thread is still alive and RMessage2 handle valid.
-// ---------------------------------------------------------------------------
-//
-TBool CThumbnailTask::ClientThreadAlive(const TBool aGetThread)
- {
- TN_DEBUG1( "CThumbnailTask::ClientThreadAlive()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILTASK_CLIENTTHREADALIVE, "CThumbnailTask::ClientThreadAlive" );
-
- if ( iMessage.Handle())
- {
- if (aGetThread)
- {
- // get client thread
- TInt err = iMessage.Client( iClientThread );
- if (err != KErrNone)
- {
- TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread not found", this);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASK_CLIENTTHREADALIVE, "CThumbnailTask::ClientThreadAlive - client thread not found;this=%o", this );
-
- ResetMessageData();
-
- return EFalse;
- }
- }
-
- // check if client thread alive
- TExitType exitType = iClientThread.ExitType();
- if( exitType != EExitPending )
- {
- TN_DEBUG2( "CThumbnailTask(0x%08x)::ClientThreadAlive() - client thread died", this);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASK_CLIENTTHREADALIVE, "CThumbnailTask::ClientThreadAlive - client thread died;this=%o", this );
-
- ResetMessageData();
-
- return EFalse;
- }
- else
- {
- // all OK
- return ETrue;
- }
- }
- else
- {
- return EFalse;
- }
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailtaskprocessor.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,566 +0,0 @@
-/*
-* 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: Processor object for running queued tasks
- *
-*/
-
-
-#include <e32base.h>
-#include <fbs.h>
-#include "thumbnailtaskprocessor.h"
-#include "thumbnailtask.h"
-#include "thumbnailprovider.h"
-#include "thumbnailmanageruids.hrh"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnailgeneratetask.h"
-#include "thumbnailpanic.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "thumbnailtaskprocessorTraces.h"
-#endif
-
-
-
-// ======== MEMBER FUNCTIONS ========
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::NewL()
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailTaskProcessor* CThumbnailTaskProcessor::NewL()
- {
- CThumbnailTaskProcessor* self = new( ELeave )CThumbnailTaskProcessor();
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::CThumbnailTaskProcessor()
-// C++ default constructor can NOT contain any code, that might leave.
-// ---------------------------------------------------------------------------
-//
-CThumbnailTaskProcessor::CThumbnailTaskProcessor(): CActive( CActive
- ::EPriorityStandard )
- {
- CActiveScheduler::Add( this );
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTaskProcessor::ConstructL()
- {
- // define PS property
- TInt ret = RProperty::Delete(KServerIdle, KIdle);
- TN_DEBUG2( "CThumbnailTaskProcessor::CThumbnailTaskProcessor() Delete KServerIdle %d", ret);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Delete KServerIdle;ret=%d", ret );
-
- ret=RProperty::Define(KServerIdle, KIdle, RProperty::EInt);
- TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL() Define KServerIdle %d", ret);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Define KServerIdle;ret=%d", ret );
-
- // attach to the property
- ret = iProperty.Attach(KServerIdle, KIdle, EOwnerThread);
- TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL()Attach %d", ret);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Attach;ret=%d", ret );
-
- // set initial PS value
- ret = iProperty.Set( ETrue );
- TN_DEBUG2( "CThumbnailTaskProcessor::ConstructL() Set IDLE ETrue %d", ret );
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_CONSTRUCTL, "CThumbnailTaskProcessor::ConstructL - Set IDLE ETrue;ret=%d", ret );
- iIdle = ETrue;
-
- iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle);
-
- iTimerActive = EFalse;
-
- iIsDaemonAsProcess = EFalse;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::~CThumbnailTaskProcessor()
-// Destructor.
-// ---------------------------------------------------------------------------
-//
-CThumbnailTaskProcessor::~CThumbnailTaskProcessor()
- {
- Cancel();
- iTasks.ResetAndDestroy();
- iProperty.Close();
- TInt ret = RProperty::Delete(KServerIdle, KIdle);
- TN_DEBUG2( "CThumbnailTaskProcessor::CThumbnailTaskProcessor() Delete KServerIdle %d", ret);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_CTHUMBNAILTASKPROCESSOR, "CThumbnailTaskProcessor::~CThumbnailTaskProcessor - Delete KServerIdle;ret=%d", ret );
-
- if(iPeriodicTimer)
- {
- iPeriodicTimer->Cancel();
- }
- delete iPeriodicTimer;
- iPeriodicTimer = NULL;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::AddTaskL()
-// Adds new task to the task queue.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTaskProcessor::AddTaskL( CThumbnailTask* aTask )
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::AddTaskL()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_ADDTASKL, "CThumbnailTaskProcessor::AddTaskL" );
- __ASSERT_DEBUG(( aTask ), ThumbnailPanic( EThumbnailNullPointer ));
- const TInt taskCount = iTasks.Count();
- iTasks.AppendL( aTask );
-
- if ( !IsActive() && !taskCount )
- {
- // this is the first task in queue, go active now
- iActiveTask = aTask;
-
- SetActive();
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete( statusPtr, KErrNone );
- }
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::RemoveTask()
-// Removes specific tasks from the queue.
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailTaskProcessor::RemoveTask( const TThumbnailServerRequestId&
- aRequestId )
- {
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - request ID: %d", aRequestId.iRequestId);
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask;aRequestId.iRequestId=%u", aRequestId.iRequestId );
-
- TBool cancel = EFalse;
- TInt res = KErrNotFound;
-
- for ( TInt i = iTasks.Count(); --i >= 0; )
- {
- CThumbnailTask* task = iTasks[i];
- if ( task->RequestId() == aRequestId )
- {
- if ( task->State() != CThumbnailTask::ERunning )
- {
- // Remove task from queue
- delete task;
- task = NULL;
- iTasks.Remove( i );
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - removed request ID: %d", aRequestId.iRequestId);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask - removed request ID:;aRequestId.iRequestId=%u", aRequestId.iRequestId );
- }
- else
- {
- // Task is already running, canceled first
- task->Cancel();
- delete task;
- task = NULL;
- iTasks.Remove( i );
- cancel = ETrue;
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - canceled & removed request ID: %d", aRequestId.iRequestId);
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask - canceled & removed request ID:;aRequestId.iRequestId=%u", aRequestId.iRequestId );
- }
-
- res = KErrNone;
-
- // don't break, because there could be many tasks related to the same request ID
- }
- }
-
- // no tasks active anymore
- if ( cancel )
- {
- Cancel();
- TaskComplete(NULL);
- }
-
- if(!iTasks.Count())
- {
- iTasks.Compress();
- }
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTask() - remaining task count: %d", iTasks.Count());
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_REMOVETASK, "CThumbnailTaskProcessor::RemoveTask - - remaining task count;iTasks.Count()=%d", iTasks.Count() );
- return res;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::RemoveTasks()
-// Removes specific task from the queue.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTaskProcessor::RemoveTasks( CThumbnailServerSession* aSession )
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks" );
-
- TBool cancel = EFalse;
-
- for ( TInt i = iTasks.Count(); --i >= 0; )
- {
- CThumbnailTask* task = iTasks[i];
-
- if ( task->RequestId().iSession == aSession)
- {
- if ( task->State() != CThumbnailTask::ERunning )
- {
- TThumbnailRequestId id = task->RequestId().iRequestId;
-
- // Remove task from queue
- delete task;
- task = NULL;
- iTasks.Remove( i );
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - removed request ID;id=%d", id );
- }
- else
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks() - task still running");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - task still running" );
-
- TThumbnailRequestId id = task->RequestId().iRequestId;
-
- // Task is already running, canceled first
- task->Cancel();
- delete task;
- task = NULL;
- iTasks.Remove( i );
- cancel = ETrue;
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - canceled & removed request ID: %d", id);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - canceled & removed request ID;id=%d", id );
- }
- }
- }
-
- // no tasks active anymore
- if ( cancel )
- {
- Cancel();
- TaskComplete(NULL);
- }
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - remaining task count: %d", iTasks.Count());
- OstTrace1( TRACE_NORMAL, DUP4_CTHUMBNAILTASKPROCESSOR_REMOVETASKS, "CThumbnailTaskProcessor::RemoveTasks - remaining task count;iTasks.Count()=%d", iTasks.Count() );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::RemoveAllTasks()
-// Removes specific task from the queue.
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTaskProcessor::RemoveAllTasks()
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RemoveAllTasks()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks" );
-
- TBool cancel = EFalse;
-
- for ( TInt i = iTasks.Count(); --i >= 0; )
- {
- CThumbnailTask* task = iTasks[i];
- if ( task->State() != CThumbnailTask::ERunning )
- {
- TThumbnailRequestId id = task->RequestId().iRequestId;
-
- // Remove task from queue
- delete task;
- task = NULL;
- iTasks.Remove( i );
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - removed request ID: %d", id);
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks - removed request ID;id=%d", id );
- }
- else
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RemoveTasks() - task still running");
- OstTrace0( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks - task still running" );
-
- TThumbnailRequestId id = task->RequestId().iRequestId;
-
- // Task is already running, canceled first
- task->Cancel();
- delete task;
- task = NULL;
- iTasks.Remove( i );
- cancel = ETrue;
-
- TN_DEBUG2( "CThumbnailTaskProcessor::RemoveTasks() - canceled & removed request ID: %d", id);
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks - canceled & removed request ID;id=%d", id );
- }
- }
-
- // no tasks active anymore
- if ( cancel )
- {
- Cancel();
- TaskComplete(NULL);
- }
-
- TN_DEBUG1( "CThumbnailTaskProcessor::RemoveAllTasks() - Task removed because of starting format" );
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILTASKPROCESSOR_REMOVEALLTASKS, "CThumbnailTaskProcessor::RemoveAllTasks - Task removed because of starting format" );
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::ChangeTaskPriority()
-// Changes priority of a task.
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailTaskProcessor::ChangeTaskPriority( const
- TThumbnailServerRequestId& aRequestId, const TInt aNewPriority )
- {
- TInt err = KErrNotFound;
- const TInt count = iTasks.Count();
- for ( TInt i( 0 ); i < count; i++ )
- {
- if ( iTasks[i]->RequestId() == aRequestId )
- {
- iTasks[i]->ChangeTaskPriority( aNewPriority );
- err = KErrNone;
- break;
- }
- }
- return err;
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::RunL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTaskProcessor::RunL()
- {
- iActiveTask = NULL;
- TInt priority( KMinTInt );
- TInt taskPriority;
- TBool processingDaemonTasksOnly(ETrue);
-
-#ifdef _DEBUG
- TN_DEBUG2( "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- in, Tasks = %d", iTasks.Count() );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- in, Tasks;iTasks.Count()=%d", iTasks.Count() );
-#endif
-
- // remove completed tasks and run priorised task
- for ( TInt i = iTasks.Count(); --i >= 0; )
- {
- CThumbnailTask* task = iTasks[i];
- if ( task->State() == CThumbnailTask::EComplete )
- {
- // Delete completed task
- delete task;
- task = NULL;
- iTasks.Remove( i );
- }
- else
- {
- if( task->State() == CThumbnailTask::EIdle )
- {
- taskPriority = task->Priority();
- if ( taskPriority > priority )
- {
- priority = taskPriority;
- iActiveTask = task;
- }
- }
-
- if ( processingDaemonTasksOnly && task->ClientThreadAlive() )
- {
- if(task->GetMessageData().Identity() != KDaemonUid )
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RunL() processingDaemonTasksOnly = EFalse" );
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL processingDaemonTasksOnly = EFalse" );
- processingDaemonTasksOnly = EFalse;
- }
- }
- }
- }
-
- if ( iActiveTask )
- {
- iActiveTask->StartL();
- }
-
-#ifdef _DEBUG
- TN_DEBUG2( "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- out, Tasks = %d", iTasks.Count() );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::TASKPROCESSOR-COUNTER---------- out, Tasks;iTasks.Count()=%d", iTasks.Count() );
-#endif
-
- //update PS value for Daemon
- if( iTasks.Count() > 0 && iIdle && !processingDaemonTasksOnly)
- {
- //set not idle
- if(iTimerActive)
- {
- iPeriodicTimer->Cancel();
- iTimerActive = EFalse;
- }
- TInt ret = iProperty.Set( EFalse );
- TN_DEBUG2( "CThumbnailTaskProcessor::RunL() iProperty Set EFalse %d", ret );
- OstTrace1( TRACE_NORMAL, DUP3_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL - iProperty Set EFalse;ret=%d", ret );
- iIdle = EFalse;
- }
- else
- {
- if(!iIdle)
- {
- //set idle
- if(iIsDaemonAsProcess)
- {
- if(iTimerActive)
- {
- iPeriodicTimer->Cancel();
- iTimerActive = EFalse;
- }
- TN_DEBUG1( "CThumbnailTaskProcessor::RunL() - daemon is the process");
- OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL - daemon is the process" );
- TInt ret = iProperty.Set( ETrue );
- TN_DEBUG2( "CThumbnailTaskProcessor::RunL() iProperty Set ETrue %d", ret );
- iIdle = ETrue;
- }
- else
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RunL() - daemon is not the process - start timer");
- OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILTASKPROCESSOR_RUNL, "CThumbnailTaskProcessor::RunL - daemon is not the process - start timer" );
- if(iTimerActive)
- {
- iPeriodicTimer->Cancel();
- iTimerActive = EFalse;
- }
- iPeriodicTimer->Start( KHarvestingCompleteTimeout, KHarvestingCompleteTimeout,
- TCallBack(PeriodicTimerCallBack, this));
- iTimerActive = ETrue;
- }
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// Handle any error from RunL
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailTaskProcessor::RunError( TInt aError )
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::RunError()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_RUNERROR, "CThumbnailTaskProcessor::RunError" );
- if ( iActiveTask )
- {
- // This will complete the task and continue processing from the
- // next task
- iActiveTask->StartError( aError );
- }
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTaskProcessor::DoCancel()
- {
- // No implementation required
- }
-
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::TaskComplete()
-// Marks task to completed
-// ---------------------------------------------------------------------------
-//
-void CThumbnailTaskProcessor::TaskComplete( CThumbnailTask* /*aTask*/ )
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::TaskComplete()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_TASKCOMPLETE, "CThumbnailTaskProcessor::TaskComplete" );
-
- if ( iTasks.Count() && !IsActive())
- {
- // More tasks yet to be run
- SetActive();
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete( statusPtr, KErrNone );
- }
- else if( iTasks.Count() == 0 && !iIdle)
- {
- if(iIsDaemonAsProcess)
- {
- if(iTimerActive)
- {
- iPeriodicTimer->Cancel();
- iTimerActive = EFalse;
- }
- TN_DEBUG1( "CThumbnailTaskProcessor::TaskComplete() - daemon is the process");
- OstTrace0( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_TASKCOMPLETE, "CThumbnailTaskProcessor::TaskComplete - daemon is the process" );
- TInt ret = iProperty.Set( ETrue );
- TN_DEBUG2( "CThumbnailTaskProcessor::TaskComplete() iProperty Set ETrue %d", ret );
- OstTrace1( TRACE_NORMAL, DUP2_CTHUMBNAILTASKPROCESSOR_TASKCOMPLETE, "CThumbnailTaskProcessor::TaskComplete - iProperty Set ETrue;ret=%d", ret );
- iIdle = ETrue;
- }
- else
- {
- if(iTimerActive)
- {
- iPeriodicTimer->Cancel();
- iTimerActive = EFalse;
- }
- iPeriodicTimer->Start( KPSKeyTimeout, KPSKeyTimeout,
- TCallBack(PeriodicTimerCallBack, this));
- iTimerActive = ETrue;
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailTaskProcessor::PeriodicTimerCallBack()
-// ---------------------------------------------------------------------------
-//
-TInt CThumbnailTaskProcessor::PeriodicTimerCallBack(TAny* aAny)
- {
- TN_DEBUG1( "CThumbnailTaskProcessor::PeriodicTimerCallBack()");
- OstTrace0( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_PERIODICTIMERCALLBACK, "CThumbnailTaskProcessor::PeriodicTimerCallBack" );
-
- CThumbnailTaskProcessor* self = static_cast<CThumbnailTaskProcessor*>( aAny );
-
- self->iTimerActive = EFalse;
- self->iPeriodicTimer->Cancel();
- TInt ret = self->iProperty.Set( ETrue );
- TN_DEBUG2( "CThumbnailTaskProcessor::PeriodicTimerCallBack() iProperty Set ETrue %d", ret );
- OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILTASKPROCESSOR_PERIODICTIMERCALLBACK, "CThumbnailTaskProcessor::PeriodicTimerCallBack - iProperty Set ETrue;ret=%d", ret );
- self->iIdle = ETrue;
-
- return KErrNone; // Return value ignored by CPeriodic
- }
-
-void CThumbnailTaskProcessor::SetDaemonAsProcess(TBool aValue)
- {
- TN_DEBUG2( "CThumbnailTaskProcessor::SetDaemonAsProcess() Daemon set %d", aValue );
- OstTrace1( TRACE_NORMAL, CTHUMBNAILTASKPROCESSOR_SETDAEMONASPROCESS, "CThumbnailTaskProcessor::SetDaemonAsProcess - Daemon set;aValue=%d", aValue );
- iIsDaemonAsProcess = aValue;
- }
-
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/tmgetimei.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Helper class to get IMEI number.
-*
-*/
-
-
-#include "tmgetimei.h"
-#include "thumbnailmanagerconstants.h"
-
-CTMGetImei* CTMGetImei::NewL()
- {
- CTMGetImei *self = CTMGetImei::NewLC();
- CleanupStack::Pop();
- return self;
- }
-
-CTMGetImei* CTMGetImei::NewLC()
- {
- CTMGetImei *self = new (ELeave) CTMGetImei();
- CleanupStack::PushL(self);
- self->ConstructL();
- return self;
- }
-
-void CTMGetImei::ConstructL()
- {
- iTelephony = CTelephony::NewL();
- CActiveScheduler::Add(this);
- }
-
-CTMGetImei::~CTMGetImei()
- {
- Cancel();
-
- delete iTelephony;
- iTelephony = NULL;
- }
-
-TBuf<KImeiBufferSize> CTMGetImei::GetIMEI()
- {
- CTelephony::TPhoneIdV1Pckg phoneIdPckg( iV1 );
-
- iTelephony->GetPhoneId( iStatus, phoneIdPckg );
- SetActive();
- iAsw.Start();
- Deque();
- return iImei;
- }
-
-void CTMGetImei::DoCancel()
- {
- iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
- }
-
-void CTMGetImei::RunL()
- {
- if(iStatus == KErrNone)
- {
- iImei = iV1.iSerialNumber;
- }
- iAsw.AsyncStop();
- }
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmactivitymanager.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
-* 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: Activity Manager
- *
-*/
-
-#include <e32base.h>
-#include <hwrmlight.h>
-
-#ifndef TMACTIVITYMANAGER_H
-#define TMACTIVITYMANAGER_H
-
-//5.0 and 9.2 behaves totally different way,
-//! uncomment on 5.0 !
-#define MONITOR_LIGHTS
-
-
-class MTMActivityManagerObserver
-
-{
-public :
- virtual void ActivityChanged(const TBool aActive) = 0;
-};
-
-
-class CTMActivityManager : public CActive
-#ifdef MONITOR_LIGHTS
- ,public MHWRMLightObserver
-#endif
-
-{
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return Instance of CThumbAGProcessor.
- */
- static CTMActivityManager* NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout = 60);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CTMActivityManager();
- void SetTimeout(TInt aTimeout);
- void Start();
- void Reset();
- void Stop();
- TBool IsInactive();
-
-
-protected: // from CActive
- void DoCancel();
- void RunL();
- TInt RunError(TInt aError);
-
-protected:
- CTMActivityManager(MTMActivityManagerObserver* aObserver, TInt aTimeout);
- void ConstructL();
- void NotifyObserver();
-
-#ifdef MONITOR_LIGHTS
-private: //From MHWRMLightObserver
- void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
-#endif
-
-protected:
- enum TWatch { ENone = 0, EWaitingForInactivity, EWaitingForActivity };
-
-protected:
- RTimer iTimer;
- TWatch iWatch;
- MTMActivityManagerObserver* iObserver; ///The observer of activity status
- TInt iTimeout; ///Current inactivity period
-
-#ifdef MONITOR_LIGHTS
- //Backlight control
- CHWRMLight* iLight;
- //backlight status
- TBool iLights;
-#endif
- //previous status
- TInt iPreviousStatus;
- TBool iFirstRound;
-};
-
-#endif // TMACTIVITYMANAGER_H
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmformatobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* 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: Monitors File system for Format events
-*
-*/
-
-
-#ifndef CTMFORMATOBSERVER_H
-#define CTMFORMATOBSERVER_H
-
-#include <babackup.h>
-#include "f32file.h"
-
-
-/**
- * Observer interface
- */
-class MTMFormatObserver
- {
-public:
-
- virtual void FormatNotification( TBool aFormat ) = 0;
- };
-
-/**
- * File System monitor class to monitor for format events
- *
- * @lib thumbnailsserver.exe
- * @since S60 3.0
- */
-class CTMFormatObserver: public CBase,
- public MBackupOperationObserver
- {
-
-public:
-
- /**
- * Two-phase constructor
- * @param aObserver observer to the monitor
- */
- static CTMFormatObserver* NewL( MTMFormatObserver& aObserver );
-
- /**
- * Two-phase constructor
- * @param aObserver observer to the monitor
- */
- static CTMFormatObserver* NewLC( MTMFormatObserver& aObserver );
-
- /**
- * Destructor
- */
- virtual ~CTMFormatObserver();
-
-public: // New functions
-
- /**
- * Polls for the current monitor status
- * If an event is happening, it will callback the observer of the event
- */
- void PollStatus();
-
-protected: // Base Class
-
- /*
- * From MBackupOperationObserver
- * Notifies this class of the backup event.
- * MMC App will signal a start / end.
- */
- void HandleBackupOperationEventL(const TBackupOperationAttributes& aBackupOperationAttributes);
-
-private:
-
- /**
- * C++ constructor
- * aObserver observer to this event
- */
- CTMFormatObserver ( MTMFormatObserver& aObserver );
-
- /*
- * Second phased constructor
- */
- void ConstructL();
-
-private: // data
-
- // not own
- MTMFormatObserver& iObserver;
-
- CBaBackupSessionWrapper* iBackupSession;
-
- };
-
-#endif // CTMFORMATOBSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmrpropertyobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
-* 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: TM RProperty Observer
- *
-*/
-
-
-#ifndef TMRPROPERTYDOBSERVER_H
-#define TMRPROPERTYDOBSERVER_H
-
-#include <e32base.h>
-#include <w32std.h>
-#include <e32property.h>
-
-
-/**
- * Observer interface for signaling the RProperty change
- */
-class MTMRPropertyObserver
- {
-public:
-
- virtual void RPropertyNotification(const TInt aError, const TUid aKeyCategory, const TUint aPropertyKey, const TInt aValue) = 0;
- };
-
-/**
- * Active object for observing P&S keys
- *
- * @since S60 v5.0
- */
-class CTMRPropertyObserver: public CActive
- {
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return Instance of CTMRPropertyObserver.
- */
- static CTMRPropertyObserver* NewL( MTMRPropertyObserver& aObserver, const TUid& aKeyCategory,
- const TInt aPropertyKey, TBool aDefineKey);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CTMRPropertyObserver();
-
-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 CTMRPropertyObserver.
- */
- CTMRPropertyObserver( MTMRPropertyObserver& aObserver, const TUid& aKeyCategory,
- const TInt iPropertyKey, TBool aDefineKey);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
-
- // not own
- MTMRPropertyObserver& iObserver;
-
- const TUid& iKeyCategory;
- RProperty iProperty;
- TInt iPropertyKey;
-
- TBool iDefineKey;
-};
-
-#endif // TMRPROPERTYDOBSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/inc/tmshutdownobserver.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
-* 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: TM Shutdown Observer
- *
-*/
-
-
-#ifndef TMSHUTDOWNOBSERVER_H
-#define TMSHUTDOWNOBSERVER_H
-
-#include <e32base.h>
-#include <w32std.h>
-#include <e32property.h>
-
-
-/**
- * Observer interface for signaling the need for shutdown
- */
-class MTMShutdownObserver
- {
-public:
-
- virtual void ShutdownNotification() = 0;
- };
-
-/**
- * Active object for observing P&S keys
- *
- * @since S60 v5.0
- */
-class CTMShutdownObserver: public CActive
- {
-public:
-
- /**
- * Two-phased constructor.
- *
- * @since S60 v5.0
- * @return Instance of CTMShutdownObserver.
- */
- static CTMShutdownObserver* NewL( MTMShutdownObserver& aObserver, const TUid& aKeyCategory,
- const TInt aPropertyKey, TBool aDefineKey);
-
- /**
- * Destructor
- *
- * @since S60 v5.0
- */
- virtual ~CTMShutdownObserver();
-
-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 CTMShutdownObserver.
- */
- CTMShutdownObserver( MTMShutdownObserver& aObserver, const TUid& aKeyCategory,
- const TInt iPropertyKey, TBool aDefineKey);
-
- /**
- * Symbian 2nd phase constructor can leave.
- *
- * @since S60 v5.0
- */
- void ConstructL();
-
-private:
-
- // not own
- MTMShutdownObserver& iObserver;
-
- const TUid& iKeyCategory;
- RProperty iProperty;
- TInt iPropertyKey;
-
- TBool iDefineKey;
-};
-
-#endif // TMSHUTDOWNOBSERVER_H
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmactivitymanager.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/*
-* 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: Activity Manager
-*
-*/
-
-#include "tmactivitymanager.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "tmactivitymanagerTraces.h"
-#endif
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::NewL()
-// ---------------------------------------------------------------------------
-//
-CTMActivityManager* CTMActivityManager::NewL(MTMActivityManagerObserver* aObserver, TInt aTimeout)
- {
- TN_DEBUG1( "CTMActivityManager::NewL()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_NEWL, "CTMActivityManager::NewL" );
-
- CTMActivityManager* self = new (ELeave) CTMActivityManager(aObserver, aTimeout);
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::CTMActivityManager()
-// ---------------------------------------------------------------------------
-//
-CTMActivityManager::CTMActivityManager(MTMActivityManagerObserver* aObserver, TInt aTimeout)
-: CActive(CActive::EPriorityHigh), iObserver(aObserver), iTimeout(aTimeout), iPreviousStatus(KErrNotFound)
- {
- TN_DEBUG1( "CTMActivityManager::CTMActivityManager()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_CTMACTIVITYMANAGER, "CTMActivityManager::CTMActivityManager" );
-
- CActiveScheduler::Add(this);
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::~CTMActivityManager()
-// ---------------------------------------------------------------------------
-//
-CTMActivityManager::~CTMActivityManager()
- {
- TN_DEBUG1( "CTMActivityManager::~CTMActivityManager()");
- OstTrace0( TRACE_NORMAL, DUP1_CTMACTIVITYMANAGER_CTMACTIVITYMANAGER, "CTMActivityManager::~CTMActivityManager" );
-
- iObserver = NULL;
- Cancel();
-
-#ifdef MONITOR_LIGHTS
- delete iLight;
- iLight = NULL;
-#endif
-
- iTimer.Cancel();
- iTimer.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CTMActivityManager::ConstructL()
- {
- TN_DEBUG1( "CTMActivityManager::ConstructL()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_CONSTRUCTL, "CTMActivityManager::ConstructL" );
-
- iTimer.CreateLocal();
- iWatch = ENone;
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::SetTimeout()
-// ---------------------------------------------------------------------------
-//
-void CTMActivityManager::SetTimeout(TInt aTimeout)
- {
- TN_DEBUG1( "CTMActivityManager::SetTimeout()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_SETTIMEOUT, "CTMActivityManager::SetTimeout" );
-
- iTimeout = aTimeout;
- Reset();
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::Reset()
-// ---------------------------------------------------------------------------
-//
-void CTMActivityManager::Reset()
- {
- TN_DEBUG1( "CTMActivityManager::Reset()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_RESET, "CTMActivityManager::Reset" );
-
-#ifdef MONITOR_LIGHTS
- delete iLight;
- iLight = NULL;
-#endif
-
- Cancel();
- Start();
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::DoCancel()
-// ---------------------------------------------------------------------------
-void CTMActivityManager::DoCancel()
- {
- TN_DEBUG1( "CTMActivityManager::DoCancel()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_DOCANCEL, "CTMActivityManager::DoCancel" );
-
-#ifdef MONITOR_LIGHTS
- delete iLight;
- iLight = NULL;
-#endif
-
- iTimer.Cancel();
- iWatch = ENone;
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::Start()
-// ---------------------------------------------------------------------------
-//
-void CTMActivityManager::Start()
- {
- TN_DEBUG1( "CTMActivityManager::Start()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_START, "CTMActivityManager::Start" );
-
-#ifdef MONITOR_LIGHTS
- if(!iLight)
- {
- TRAP_IGNORE(iLight = CHWRMLight::NewL(this));
- }
-#endif
-
- if ( iWatch == ENone )
- {
- iFirstRound = ETrue;
-
- if( !IsActive() )
- {
- SetActive();
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete( statusPtr, KErrNone );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::RunL()
-// ---------------------------------------------------------------------------
-//
-void CTMActivityManager::RunL()
- {
- TN_DEBUG4( "CTMActivityManager::RunL(0x%08x) %d, observer = 0x%08x", this, iStatus.Int(), iObserver);
- OstTrace1( TRACE_NORMAL, CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL;this=%o", this );
- OstTrace1( TRACE_NORMAL, DUP5_CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL;iStatus.Int()=%d", iStatus.Int() );
-
- if(iFirstRound)
- {
- TN_DEBUG1( "CTMActivityManager::RunL() iFirstRound");
- OstTrace0( TRACE_NORMAL, DUP1_CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL - iFirstRound" );
- iFirstRound = EFalse;
- if (!IsActive())
- {
- iWatch = EWaitingForInactivity;
- iTimer.Inactivity(iStatus, iTimeout);
- SetActive();
- }
- NotifyObserver();
- return;
- }
-
- if (iStatus == KErrNone)
- {
- if (iWatch == EWaitingForInactivity)
- {
- TInt inactivity = User::InactivityTime().Int();
- if (inactivity >= iTimeout)
- {
- TN_DEBUG1( "CTMActivityManager::RunL() inactive");
- OstTrace0( TRACE_NORMAL, DUP2_CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL - inactive" );
- NotifyObserver();
-
- if (!IsActive()) //observer might have called a Reset()
- {
- iTimer.Inactivity(iStatus,0);
- iWatch = EWaitingForActivity;
- }
- }
- else
- {
- iTimer.Inactivity(iStatus,iTimeout);
- }
- }
- else if (iWatch == EWaitingForActivity)
- {
- TN_DEBUG1( "CTMActivityManager::RunL() active");
- OstTrace0( TRACE_NORMAL, DUP3_CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL - active" );
- NotifyObserver();
-
- if (!IsActive()) //observer might have called a Reset()
- {
- iTimer.Inactivity(iStatus,iTimeout);
- iWatch = EWaitingForInactivity;
- }
- }
-
- if (!IsActive()) //observer might have called a Reset()
- {
- SetActive();
- }
- }
- else
- {
- iWatch = ENone;
- }
- TN_DEBUG1( "CTMActivityManager::RunL() end");
- OstTrace0( TRACE_NORMAL, DUP4_CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL - end" );
- }
-
-// ---------------------------------------------------------------------------
-// CTMActivityManager::RunError()
-// ---------------------------------------------------------------------------
-//
-TInt CTMActivityManager::RunError(TInt aError)
- {
- TN_DEBUG2( "CTMActivityManager::RunError() %d", aError);
- OstTrace1( TRACE_NORMAL, CTMACTIVITYMANAGER_RUNERROR, "CTMActivityManager::RunError;aError=%d", aError );
-
- if (aError != KErrNone)
- {
- Reset();
- }
-
- // nothing to do
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// IsInactive()
-// -----------------------------------------------------------------------------
-//
-TBool CTMActivityManager::IsInactive()
- {
-#ifdef MONITOR_LIGHTS
-#ifdef _DEBUG
-TInt inactivityTime = User::InactivityTime().Int();
-TN_DEBUG3( "CTMActivityManager::IsInactive()= %d, iLights = %d", User::InactivityTime().Int(), iLights);
-OstTrace1( TRACE_NORMAL, DUP6_CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL;inactivityTime=%d", inactivityTime );
-#endif
-#else
-TInt inactivityTime = User::InactivityTime().Int();
-TN_DEBUG2( "CTMActivityManager::IsInactive()= %d", User::InactivityTime().Int());
-OstTrace1( TRACE_NORMAL, DUP7_CTMACTIVITYMANAGER_RUNL, "CTMActivityManager::RunL;inactivityTime=%d", inactivityTime );
-#endif
-
- //if lights are off or inactivity timer is less that target the device is not idle
- if( User::InactivityTime() >= TTimeIntervalSeconds(iTimeout)
-#ifdef MONITOR_LIGHTS
- || !iLights
-#endif
- )
- {
- TN_DEBUG1( "CTMActivityManager::IsInactive() ETrue");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_ISINACTIVE, "CTMActivityManager::IsInactive - ETrue" );
- return ETrue;
- }
- TN_DEBUG1( "CTMActivityManager::IsInactive() EFalse");
- OstTrace0( TRACE_NORMAL, DUP1_CTMACTIVITYMANAGER_ISINACTIVE, "CTMActivityManager::IsInactive - EFalse" );
- return EFalse;
- }
-
-#ifdef MONITOR_LIGHTS
-// -----------------------------------------------------------------------------
-// LightStatusChanged()
-// -----------------------------------------------------------------------------
-//
-void CTMActivityManager::LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus)
- {
- TN_DEBUG3( "CTMActivityManager::LightStatusChanged() aTarget = %d, aStatus == %d", aTarget, aStatus);
- OstTraceExt2( TRACE_NORMAL, CTMACTIVITYMANAGER_LIGHTSTATUSCHANGED, "CTMActivityManager::LightStatusChanged;aTarget=%d;aStatus=%u", aTarget, aStatus );
-
- if(aTarget & CHWRMLight::EPrimaryDisplay)
- {
- if( aStatus == CHWRMLight::ELightOff )
- {
- TN_DEBUG1( "CTMActivityManager::LightStatusChanged() -- OFF");
- OstTrace0( TRACE_NORMAL, DUP1_CTMACTIVITYMANAGER_LIGHTSTATUSCHANGED, "CTMActivityManager::LightStatusChanged - OFF" );
- iLights = EFalse;
- }
- else
- {
- TN_DEBUG1( "CTMActivityManager::LightStatusChanged() -- ON");
- OstTrace0( TRACE_NORMAL, DUP2_CTMACTIVITYMANAGER_LIGHTSTATUSCHANGED, "CTMActivityManager::LightStatusChanged - ON" );
- iLights = ETrue;
- }
-
- NotifyObserver();
- }
- }
-#endif
-
-// -----------------------------------------------------------------------------
-// NotifyObserver()
-// -----------------------------------------------------------------------------
-//
-void CTMActivityManager::NotifyObserver()
- {
- TN_DEBUG1( "void CTMAActivityManager::NotifyObserver()");
- OstTrace0( TRACE_NORMAL, CTMACTIVITYMANAGER_NOTIFYOBSERVER, "CTMActivityManager::NotifyObserver" );
-
- TBool status = IsInactive();
-
- if( iPreviousStatus != status )
- {
- iPreviousStatus = status;
- if (iObserver)
- {
- iObserver->ActivityChanged(!status);
- }
- }
- }
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmformatobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-* 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: File System format monitor
-*
-*/
-
-#include "tmformatobserver.h"
-#include "thumbnaillog.h"
-
-#include <e32base.h>
-#include <f32file.h>
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "tmformatobserverTraces.h"
-#endif
-
-
-// ======== MEMBER FUNCTIONS ========
-
-CTMFormatObserver::CTMFormatObserver ( MTMFormatObserver& aObserver ):
- iObserver( aObserver )
- {
- TN_DEBUG1( "CTMFormatObserver::CTMFormatObserver()");
- OstTrace0( TRACE_NORMAL, CTMFORMATOBSERVER_CTMFORMATOBSERVER, "CTMFormatObserver::CTMFormatObserver" );
- }
-
-
-// ---------------------------------------------------------------------------
-// Second Phase Constructor
-// ---------------------------------------------------------------------------
-//
-void CTMFormatObserver::ConstructL()
- {
- TN_DEBUG1("CTMFormatObserver::ConstructL");
- OstTrace0( TRACE_NORMAL, CTMFORMATOBSERVER_CONSTRUCTL, "CTMFormatObserver::ConstructL" );
-
- iBackupSession = CBaBackupSessionWrapper::NewL();
- iBackupSession->RegisterBackupOperationObserverL( *this );
- }
-
-
-// ---------------------------------------------------------------------------
-// Two-Phased Constructor
-// ---------------------------------------------------------------------------
-//
-CTMFormatObserver* CTMFormatObserver::NewL( MTMFormatObserver& aObserver )
- {
- CTMFormatObserver* self = CTMFormatObserver::NewLC( aObserver );
- CleanupStack::Pop( self );
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// Two-Phased Constructor
-// ---------------------------------------------------------------------------
-//
-CTMFormatObserver* CTMFormatObserver::NewLC( MTMFormatObserver& aObserver )
- {
- CTMFormatObserver* self = new( ELeave ) CTMFormatObserver( aObserver );
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// destructor
-// ---------------------------------------------------------------------------
-//
-CTMFormatObserver::~CTMFormatObserver()
- {
- if( iBackupSession )
- {
- iBackupSession->DeRegisterBackupOperationObserver( *this );
- }
-
- delete iBackupSession;
- iBackupSession = NULL;
- }
-
-// ---------------------------------------------------------------------------
-// Checks the current status
-// ---------------------------------------------------------------------------
-//
-void CTMFormatObserver::PollStatus()
- {
- TN_DEBUG1("CTMFormatObserver::PollStatus()");
- OstTrace0( TRACE_NORMAL, CTMFORMATOBSERVER_POLLSTATUS, "CTMFormatObserver::PollStatus" );
-
- TBool formatting = iBackupSession->IsBackupOperationRunning();
-
- if( formatting )
- {
- iObserver.FormatNotification(ETrue);
- }
- }
-
-// ---------------------------------------------------------------------------
-// CThumbnailFormatObserver::HandleBackupOperationEventL
-// Handles a format operation
-// ---------------------------------------------------------------------------
-//
-void CTMFormatObserver::HandleBackupOperationEventL(
- const TBackupOperationAttributes& aBackupOperationAttributes)
- {
- TN_DEBUG1("CTMFormatObserver::HandleBackupOperationEventL");
- OstTrace0( TRACE_NORMAL, CTMFORMATOBSERVER_HANDLEBACKUPOPERATIONEVENTL, "CTMFormatObserver::HandleBackupOperationEventL" );
-
- if( aBackupOperationAttributes.iOperation == EStart )
- {
- iObserver.FormatNotification(ETrue);
- }
- else // TOperationType::EEnd or TOperationType::EAbort
- {
- iObserver.FormatNotification(EFalse);
- }
- }
-
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmshutdownobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
-* 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: Processor
-*
-*/
-
-
-#include <e32base.h>
-
-#include "tmshutdownobserver.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "tmshutdownobserverTraces.h"
-#endif
-
-
-// ---------------------------------------------------------------------------
-// CTMShutdownObserver::NewL()
-// ---------------------------------------------------------------------------
-//
-CTMShutdownObserver* CTMShutdownObserver::NewL( MTMShutdownObserver& aObserver,
- const TUid& aKeyCategory,
- const TInt aPropertyKey,
- TBool aDefineKey)
- {
- CTMShutdownObserver* self = new( ELeave )CTMShutdownObserver( aObserver,
- aKeyCategory,
- aPropertyKey,
- aDefineKey);
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CTMShutdownObserver::CTMShutdownObserver()
-// ---------------------------------------------------------------------------
-//
-CTMShutdownObserver::CTMShutdownObserver( MTMShutdownObserver& aObserver,
- const TUid& aKeyCategory,
- const TInt aPropertyKey,
- TBool aDefineKey)
- : CActive( CActive::EPriorityStandard ), iObserver( aObserver ),
- iKeyCategory( aKeyCategory ), iPropertyKey(aPropertyKey), iDefineKey( aDefineKey )
- {
- CActiveScheduler::Add( this );
- }
-
-// ---------------------------------------------------------------------------
-// CTMShutdownObserver::ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CTMShutdownObserver::ConstructL()
- {
- TN_DEBUG1( "CTMShutdownObserver::ConstructL()" );
- OstTrace0( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL" );
- // define P&S property types
- if (iDefineKey)
- {
- TN_DEBUG1( "CTMShutdownObserver::ConstructL() define" );
- OstTrace0( TRACE_NORMAL, DUP1_CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL - define" );
- RProperty::Define(iKeyCategory,iPropertyKey,
- RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy);
- }
-
- // attach to the property
- TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
- TN_DEBUG2( "CTMShutdownObserver::ConstructL() attach err = %d", err );
- OstTrace1( TRACE_NORMAL, DUP2_CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL - attach;err=%d", err );
- User::LeaveIfError(err);
-
- // wait for the previously attached property to be updated
- iProperty.Subscribe(iStatus);
- TN_DEBUG1( "CTMShutdownObserver::ConstructL() subscribe" );
- OstTrace0( TRACE_NORMAL, DUP3_CTMSHUTDOWNOBSERVER_CONSTRUCTL, "CTMShutdownObserver::ConstructL - subscribe" );
- SetActive();
- }
-
-// ---------------------------------------------------------------------------
-// CTMShutdownObserver::~CTMShutdownObserver()
-// ---------------------------------------------------------------------------
-//
-CTMShutdownObserver::~CTMShutdownObserver()
- {
- TN_DEBUG1( "CTMShutdownObserver::~CTMShutdownObserver()" );
- OstTrace0( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_CTMSHUTDOWNOBSERVER, "CTMShutdownObserver::~CTMShutdownObserver" );
- Cancel();
- iProperty.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CTMShutdownObserver::RunL()
-// ---------------------------------------------------------------------------
-//
-void CTMShutdownObserver::RunL()
- {
- TN_DEBUG2( "CTMShutdownObserver::RunL(%d)", iStatus.Int() );
- OstTrace1( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_RUNL, "CTMShutdownObserver::RunL;iStatus.Int()=%d", iStatus.Int() );
- // resubscribe before processing new value to prevent missing updates
- iProperty.Subscribe(iStatus);
- SetActive();
-
- // retrieve the value
- TInt value = 0;
- TInt err = iProperty.Get(value);
-
- TN_DEBUG2( "CTMShutdownObserver::RunL() Get err = %d", err );
- OstTrace1( TRACE_NORMAL, DUP1_CTMSHUTDOWNOBSERVER_RUNL, "CTMShutdownObserver::RunL - get err;err=%d", err );
-
- // observer callback
- if (value)
- {
- iObserver.ShutdownNotification();
- }
- }
-
-// ---------------------------------------------------------------------------
-// CTMShutdownObserver::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CTMShutdownObserver::DoCancel()
- {
- TN_DEBUG1( "CTMShutdownObserver::DoCancel()" );
- OstTrace0( TRACE_NORMAL, CTMSHUTDOWNOBSERVER_DOCANCEL, "CTMShutdownObserver::DoCancel" );
- iProperty.Cancel();
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/tmcommon/src/tmsrproptertyobserver.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
-* 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: RPropery observer
-*
-*/
-
-
-#include <e32base.h>
-
-#include "tmrpropertyobserver.h"
-#include "thumbnailmanagerconstants.h"
-#include "thumbnaillog.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "tmsrproptertyobserverTraces.h"
-#endif
-
-
-// ---------------------------------------------------------------------------
-// CTMRPropertyObserver::NewL()
-// ---------------------------------------------------------------------------
-//
-CTMRPropertyObserver* CTMRPropertyObserver::NewL( MTMRPropertyObserver& aObserver,
- const TUid& aKeyCategory,
- const TInt aPropertyKey,
- TBool aDefineKey)
- {
- CTMRPropertyObserver* self = new( ELeave )CTMRPropertyObserver( aObserver,
- aKeyCategory,
- aPropertyKey,
- aDefineKey);
- CleanupStack::PushL( self );
- self->ConstructL();
- CleanupStack::Pop( self );
- return self;
- }
-
-// ---------------------------------------------------------------------------
-// CTMRPropertyObserver::CTMRPropertyObserver()
-// ---------------------------------------------------------------------------
-//
-CTMRPropertyObserver::CTMRPropertyObserver( MTMRPropertyObserver& aObserver,
- const TUid& aKeyCategory,
- const TInt aPropertyKey,
- TBool aDefineKey)
- : CActive( CActive::EPriorityStandard ), iObserver( aObserver ),
- iKeyCategory( aKeyCategory ), iPropertyKey(aPropertyKey), iDefineKey( aDefineKey )
- {
- CActiveScheduler::Add( this );
- }
-
-// ---------------------------------------------------------------------------
-// CTMRPropertyObserver::ConstructL()
-// ---------------------------------------------------------------------------
-//
-void CTMRPropertyObserver::ConstructL()
- {
- TN_DEBUG1( "CTMRPropertyObserver::ConstructL()");
- OstTrace0( TRACE_NORMAL, CTMRPROPERTYOBSERVER_CONSTRUCTL, "CTMRPropertyObserver::ConstructL" );
- // define P&S property types
- if (iDefineKey)
- {
- RProperty::Define(iKeyCategory,iPropertyKey,
- RProperty::EInt);
- }
-
- // attach to the property
- TInt err = iProperty.Attach(iKeyCategory,iPropertyKey,EOwnerThread);
- User::LeaveIfError(err);
-
- SetActive();
- TRequestStatus* statusPtr = &iStatus;
- User::RequestComplete( statusPtr, KErrNone );
- }
-
-// ---------------------------------------------------------------------------
-// CTMRPropertyObserver::~CTMRPropertyObserver()
-// ---------------------------------------------------------------------------
-//
-CTMRPropertyObserver::~CTMRPropertyObserver()
- {
- TN_DEBUG1( "CTMRPropertyObserver::~CTMRPropertyObserver()");
- OstTrace0( TRACE_NORMAL, CTMRPROPERTYOBSERVER_CTMRPROPERTYOBSERVER, "CTMRPropertyObserver::~CTMRPropertyObserver" );
- Cancel();
- iProperty.Close();
- }
-
-// ---------------------------------------------------------------------------
-// CTMRPropertyObserver::RunL()
-// ---------------------------------------------------------------------------
-//
-void CTMRPropertyObserver::RunL()
- {
- TN_DEBUG1( "CTMRPropertyObserver::RunL()");
- OstTrace0( TRACE_NORMAL, CTMRPROPERTYOBSERVER_RUNL, "CTMRPropertyObserver::RunL" );
- // resubscribe before processing new value to prevent missing updates
- iProperty.Subscribe(iStatus);
- SetActive();
-
- // retrieve the value
- TInt value = 0;
- TInt ret = iProperty.Get(value);
-
- // observer callback
- iObserver.RPropertyNotification(ret, iKeyCategory, iPropertyKey, value);
- }
-
-// ---------------------------------------------------------------------------
-// CTMRPropertyObserver::DoCancel()
-// ---------------------------------------------------------------------------
-//
-void CTMRPropertyObserver::DoCancel()
- {
- TN_DEBUG1( "CTMRPropertyObserver::DoCancel()");
- OstTrace0( TRACE_NORMAL, CTMRPROPERTYOBSERVER_DOCANCEL, "CTMRPropertyObserver::DoCancel" );
- iProperty.Cancel();
- }
-
-// End of file
--- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/group/bld.inf Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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: Build information file
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_MMPFILES
-tmiadrestart.mmp
-
-// End of File
-
-
--- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/group/tmiadrestart.mmp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* 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: Project definition file
-*
-*/
-
-
-#include <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-
-VERSION 10.0
-TARGET tmiadrestart.exe
-TARGETTYPE EXE
-UID 0x0 0x2001FD52
-
-CAPABILITY ALL -TCB
-VENDORID VID_DEFAULT
-
-SOURCEPATH ../src
-SOURCE tmiadrestart.cpp
-
-// Default system include paths for middleware layer modules.
-MW_LAYER_SYSTEMINCLUDE
-
-USERINCLUDE ../inc
-USERINCLUDE ../../inc
-USERINCLUDE ../../thumbagdaemon/inc ../traces
-
-LIBRARY euser.lib
-
-PAGED
-BYTEPAIRCOMPRESSTARGET
-
-// End of File
-
-
--- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/inc/tmiadrestart.h Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-* 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: Thumbnail Manager IAD Restart
- *
-*/
-
-
-#ifndef TMIADRESTART_H
-#define TMIADRESTART_H
-
-#include <e32base.h>
-#include <w32std.h>
-
-GLDEF_C TInt E32Main();
-
-#endif // TMIADRESTART_H
--- a/imagehandlingutilities/thumbnailmanager/tmiadrestart/src/tmiadrestart.cpp Fri Sep 03 10:29:37 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
-* 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: Thumbnail Manager IAD Restart
-*
-*/
-
-
-#include <e32base.h>
-#include <e32std.h>
-#include <e32property.h>
-#include "thumbnaillog.h"
-
-#include "thumbnailmanagerconstants.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "tmiadrestartTraces.h"
-#endif
-
-LOCAL_C void MainL()
- {
- // delay so that cenrep has time to read new config
- TN_DEBUG1( "MainL() after" );
- OstTrace0( TRACE_NORMAL, _MAINL, "::MainL - after" );
-
- User::After(5000000);
-
- TInt res( KErrNone );
- RProcess process;
- TFullName name;
-
- // find and terminate Thumb AG Daemon
- TN_DEBUG1( "MainL() KTAGDaemonProcess find" );
- OstTrace0( TRACE_NORMAL, DUP1__MAINL, "::MainL - find" );
- TFindProcess findProcess( KTAGDaemonProcess );
-
- if ( findProcess.Next(name) == KErrNone )
- {
- res = process.Open(name);
- TN_DEBUG2( "MainL() KTAGDaemonProcess open res = %d", res );
- OstTrace1( TRACE_NORMAL, DUP2__MAINL, "::MainL;res=%d - open res", res );
-
- // logon to get termination signal
- TRequestStatus status;
- TN_DEBUG1( "MainL() KTAGDaemonProcess logon" );
- OstTrace0( TRACE_NORMAL, DUP3__MAINL, "::MainL - logon" );
- process.Logon(status);
-
- // shutdown using P&S key
- TN_DEBUG2( "MainL() KTAGDaemonProcess Set = %d", res );
- OstTrace1( TRACE_NORMAL, DUP4__MAINL, "::MainL - Set = res;res=%d", res );
- res = RProperty::Set(KTAGDPSNotification,KShutdown,1);
-
- // blocks here until thread is terminated
- TN_DEBUG1( "MainL() KTAGDaemonProcess wait" );
- OstTrace0( TRACE_NORMAL, DUP5__MAINL, "::MainL - KTAGDaemonProcess wait" );
- User::WaitForRequest(status);
-
- // reset key
- TN_DEBUG1( "MainL() KTAGDaemonProcess reset" );
- OstTrace0( TRACE_NORMAL, DUP6__MAINL, "::MainL - KTAGDaemonProcess reset" );
- res = RProperty::Set(KTAGDPSNotification, KShutdown, 0);
-
- TN_DEBUG1( "MainL() KTAGDaemonProcess close" );
- OstTrace0( TRACE_NORMAL, DUP7__MAINL, "::MainL - close" );
- process.Close();
- }
-
- // find and terminate Thumbnail Server
- TFindProcess findProcess2( KThumbnailServerProcess );
- TN_DEBUG1( "MainL() KThumbnailServerProcess find" );
- OstTrace0( TRACE_NORMAL, DUP8__MAINL, "::MainL - find" );
- if ( findProcess2.Next(name) == KErrNone )
- {
- res = process.Open(name);
- TN_DEBUG2( "MainL() KThumbnailServerProcess open res = %d", res );
- OstTrace1( TRACE_NORMAL, DUP9__MAINL, "::MainL - KThumbnailServerProcess open;res=%d", res );
-
- // logon to get termination signal
- TRequestStatus status;
- TN_DEBUG1( "MainL() KThumbnailServerProcess logon" );
- OstTrace0( TRACE_NORMAL, DUP10__MAINL, "::MainL - KThumbnailServerProcess logon" );
- process.Logon(status);
-
- // shutdown using P&S key
- TN_DEBUG2( "MainL() KThumbnailServerProcess Set res = %d", res );
- OstTrace1( TRACE_NORMAL, DUP11__MAINL, "::MainL - KThumbnailServerProcess Set;res=%d", res );
- res = RProperty::Set(KTMPSNotification,KShutdown,1);
-
- // blocks here until thread is terminated
- TN_DEBUG1( "MainL() KThumbnailServerProcess wait" );
- OstTrace0( TRACE_NORMAL, DUP12__MAINL, "::MainL - KThumbnailServerProcess wait" );
- User::WaitForRequest(status);
-
- // reset key
- TN_DEBUG2( "MainL() KThumbnailServerProcess reset res = %d", res );
- OstTrace1( TRACE_NORMAL, DUP13__MAINL, "::MainL;res=%d - KThumbnailServerProcess reset", res );
- res = RProperty::Set(KTMPSNotification, KShutdown, 0);
-
- TN_DEBUG1( "MainL() KThumbnailServerProcess close" );
- OstTrace0( TRACE_NORMAL, DUP14__MAINL, "::MainL - close" );
- process.Close();
- }
-
- // delay just in case old daemon hasn't died yet
- TN_DEBUG1( "MainL() after" );
- User::After(2500000);
-
- // start new ThumbAGDaemon
- RProcess server;
- TInt retryCount = 0;
-
- // Create the server process
- // KNullDesC param causes server's E32Main() to be run
- TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res );
- OstTrace1( TRACE_NORMAL, DUP15__MAINL, "::MainL - KTAGDaemonExe create res;res=%d", res );
- res = server.Create( KTAGDaemonExe, KNullDesC );
-
- // try again 3 times if fails
- while ( res != KErrNone)
- {
- TN_DEBUG1( "MainL() KTAGDaemonExe retry" );
- OstTrace0( TRACE_NORMAL, DUP16__MAINL, "::MainL- KTAGDaemonExe retry" );
- if (retryCount > 2)
- {
- TN_DEBUG1( "MainL() KTAGDaemonExe retry > 2" );
- OstTrace0( TRACE_NORMAL, DUP17__MAINL, "::MainL - KTAGDaemonExe retry > 2" );
- return;
- }
-
- TN_DEBUG1( "MainL() after" );
- OstTrace0( TRACE_NORMAL, DUP18__MAINL, "::MainL - after" );
- User::After(2500000);
- TN_DEBUG2( "MainL() KTAGDaemonExe create res = %d", res );
- OstTrace1( TRACE_NORMAL, DUP19__MAINL, "::MainL - KTAGDaemonExe create;res=%d", res );
- res = server.Create( KTAGDaemonExe, KNullDesC );
- retryCount++;
- }
-
- // Process created successfully
- TRequestStatus status;
- TN_DEBUG1( "MainL() Rendezvous" );
- OstTrace0( TRACE_NORMAL, DUP20__MAINL, "::MainL - Rendezvous" );
- server.Rendezvous( status );
- TN_DEBUG1( "MainL() Resume" );
- OstTrace0( TRACE_NORMAL, DUP21__MAINL, "::MainL - resume" );
- server.Resume(); // start it going
-
-
- // Wait until the completion of the server creation
- TN_DEBUG1( "MainL() wait" );
- OstTrace0( TRACE_NORMAL, DUP22__MAINL, "::MainL - wait" );
- User::WaitForRequest( status );
- TN_DEBUG1( "MainL() wait done" );
- OstTrace0( TRACE_NORMAL, DUP23__MAINL, "::MainL - wait done" );
-
- // Server created successfully
- server.Close(); // we're no longer interested in the other process
- }
-
-GLDEF_C TInt E32Main()
- {
- // Create cleanup stack
- __UHEAP_MARK;
- CTrapCleanup* cleanup = CTrapCleanup::New();
-
- // Run application code inside TRAP harness
- TInt err = KErrNone;
- TRAP(err, MainL());
-
- delete cleanup;
- cleanup = NULL;
- __UHEAP_MARKEND;
- return err;
- }
-
-// End of file
--- a/package_definition.xml Fri Sep 03 10:29:37 2010 +0300
+++ b/package_definition.xml Mon Sep 27 15:24:37 2010 +0300
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
- <package id="imghandling" name="Image Handling" levels="lib util if">
+ <package id="imghandling" name="Image Handling" version="2.0.0" levels="lib util if">
<collection id="imagehandling_plat" name="Image Handling Platform Interfaces" level="if">
<component id="image_handling_library_api" name="Image Handling Library API" class="api" filter="s60">
<meta rel="Api" href="imagehandling_plat/image_handling_library_api/image_handling_library_api.metaxml"/>