diff -r 000000000000 -r 4e91876724a2 photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h Thu Dec 17 08:45:44 2009 +0200 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Thumbnail creator: provides thumbnails and generates on background +* +*/ + + + + +/** + * @internal reviewed 30/07/2007 by Simon Brooks + */ + +#ifndef C_GLXTNTHUMBNAILCREATOR_H +#define C_GLXTNTHUMBNAILCREATOR_H + +#include "glxtnstd.h" +#include "glxtntask.h" +#include +#include +#include + +class CGlxtnFileUtility; +class CGlxSettingsModel; +class MGlxtnThumbnailCreatorClient; +class MGlxtnThumbnailStorage; +class TGlxThumbnailRequest; + +/** + * CGlxtnThumbnailCreator + * + * Thumbnail creator is the thumbnail engine, and it loads and generates + * thumbnails on the foreground and generates non-created thumbnails on + * the background + * + * @ingroup glx_thumbnail_creator + */ +class CGlxtnThumbnailCreator : public CBase + { +public: + /** + * Starts the provisioning of a thumbnail. This will result in a callback + * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete(). + */ + IMPORT_C static CGlxtnThumbnailCreator* InstanceL(); + /** + * Decrement the reference count, and delete the instance if the count + * becomes zero. Ensures any tasks using the given storage are cancelled. + * @param aStorage Pointer to storage used by client, or NULL. + */ + IMPORT_C void Close(MGlxtnThumbnailStorage* aStorage); + + /** + * Destructor. + */ + ~CGlxtnThumbnailCreator(); + + /** + * Starts the provisioning of a thumbnail. This will result in a callback + * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete(). + * @param aRequestInfo Parameters for required thumbnail. + * @param aClient Client initiating the request. + */ + IMPORT_C void FetchThumbnailL(const TGlxThumbnailRequest& aRequestInfo, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Starts deleting all stored thumbnails for a given item. This will result + * in a callback to MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete(). + * @param aItemId ID of the media item. + * @param aClient Client initiating the request. + */ + IMPORT_C void DeleteThumbnailsL(const TGlxMediaId& aItemId, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Starts the filtering of items for which a thumbnail is available from a + * list of item IDs. This will result in a callback to + * MGlxtnThumbnailCreatorClient::FilterAvailableComplete(). + * @param aItemArray Array of item IDs, from which those with thumbnails + * should be removed. + * @param aSize Size of thumbnail required. + * @param aClient Client initiating the request. + */ + IMPORT_C void FilterAvailableThumbnailsL( + const TArray& aItemArray, const TSize& aSize, + MGlxtnThumbnailCreatorClient& aClient); + + /** + * Starts the cleanup of obsolete thumbnails from storage. There is no + * callback indicating completion of the request. + * @param aStorage Pointer to storage used by client. + */ + IMPORT_C void CleanupThumbnailsL(MGlxtnThumbnailStorage* aStorage); + + /** + * Cancel any ongoing tasks for a given item. This ensures the TNC is not + * locking the media file. + * @param aItemId ID of the media item. + */ + IMPORT_C void CancelRequest(const TGlxMediaId& aItemId); + +private: + CGlxtnThumbnailCreator(); + void ConstructL(); + +private: + /** Task manager */ + CGlxtnTaskManager* iTaskManager; + /** File utility used by the tasks */ + CGlxtnFileUtility* iFileUtility; + /** Reference count of the single instance */ + TInt iReferenceCount; + /** Settings Model used by the background tasks */ + CGlxSettingsModel* iSettingsModel; + }; + +#endif // C_GLXTNTHUMBNAILCREATOR_H