photosgallery/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:    Thumbnail creator: provides thumbnails and generates on background
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  * @internal reviewed 30/07/2007 by Simon Brooks
       
    23  */
       
    24 
       
    25 #ifndef C_GLXTNTHUMBNAILCREATOR_H
       
    26 #define C_GLXTNTHUMBNAILCREATOR_H
       
    27 
       
    28 #include "glxtnstd.h"
       
    29 #include "glxtntask.h"
       
    30 #include <glxmediaid.h>
       
    31 #include <glxpanic.h>
       
    32 #include <glxthumbnailinfo.h>
       
    33 
       
    34 class CGlxtnFileUtility;
       
    35 class CGlxSettingsModel;
       
    36 class MGlxtnThumbnailCreatorClient;
       
    37 class MGlxtnThumbnailStorage;
       
    38 class TGlxThumbnailRequest;
       
    39 
       
    40 /**
       
    41  *  CGlxtnThumbnailCreator
       
    42  *
       
    43  *  Thumbnail creator is the thumbnail engine, and it loads and generates 
       
    44  *  thumbnails on the foreground and generates non-created thumbnails on
       
    45  *  the background
       
    46  *
       
    47  * @ingroup glx_thumbnail_creator
       
    48  */
       
    49 class CGlxtnThumbnailCreator : public CBase
       
    50     {
       
    51 public:
       
    52     /**
       
    53     * Starts the provisioning of a thumbnail.  This will result in a callback
       
    54     * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete().
       
    55     */
       
    56     IMPORT_C static CGlxtnThumbnailCreator* InstanceL();
       
    57     /**
       
    58     * Decrement the reference count, and delete the instance if the count
       
    59     * becomes zero.  Ensures any tasks using the given storage are cancelled.
       
    60     * @param aStorage Pointer to storage used by client, or NULL.
       
    61     */
       
    62     IMPORT_C void Close(MGlxtnThumbnailStorage* aStorage);
       
    63 
       
    64     /**
       
    65     * Destructor.
       
    66     */
       
    67 	~CGlxtnThumbnailCreator();
       
    68 
       
    69     /**
       
    70     * Starts the provisioning of a thumbnail.  This will result in a callback
       
    71     * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete().
       
    72     * @param aRequestInfo Parameters for required thumbnail.
       
    73     * @param aClient Client initiating the request.
       
    74     */
       
    75     IMPORT_C void FetchThumbnailL(const TGlxThumbnailRequest& aRequestInfo,
       
    76                                     MGlxtnThumbnailCreatorClient& aClient);
       
    77 
       
    78     /**
       
    79     * Starts deleting all stored thumbnails for a given item.  This will result
       
    80     * in a callback to MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete().
       
    81     * @param aItemId ID of the media item.
       
    82     * @param aClient Client initiating the request.
       
    83     */
       
    84     IMPORT_C void DeleteThumbnailsL(const TGlxMediaId& aItemId,
       
    85                                     MGlxtnThumbnailCreatorClient& aClient);
       
    86 
       
    87     /**
       
    88     * Starts the filtering of items for which a thumbnail is available from a
       
    89     * list of item IDs.  This will result in a callback to
       
    90     * MGlxtnThumbnailCreatorClient::FilterAvailableComplete().
       
    91     * @param aItemArray Array of item IDs, from which those with thumbnails
       
    92     *                   should be removed.
       
    93     * @param aSize Size of thumbnail required.
       
    94     * @param aClient Client initiating the request.
       
    95     */
       
    96     IMPORT_C void FilterAvailableThumbnailsL(
       
    97                     const TArray<TGlxMediaId>& aItemArray, const TSize& aSize,
       
    98                     MGlxtnThumbnailCreatorClient& aClient);
       
    99 
       
   100     /**
       
   101     * Starts the cleanup of obsolete thumbnails from storage.  There is no
       
   102     * callback indicating completion of the request.
       
   103     * @param aStorage Pointer to storage used by client.
       
   104     */
       
   105     IMPORT_C void CleanupThumbnailsL(MGlxtnThumbnailStorage* aStorage);
       
   106 
       
   107     /** 
       
   108     * Cancel any ongoing tasks for a given item.  This ensures the TNC is not
       
   109     * locking the media file.
       
   110     * @param aItemId ID of the media item.
       
   111     */
       
   112     IMPORT_C void CancelRequest(const TGlxMediaId& aItemId);
       
   113 
       
   114 private:
       
   115 	CGlxtnThumbnailCreator();
       
   116 	void ConstructL();
       
   117 
       
   118 private:
       
   119     /** Task manager */
       
   120     CGlxtnTaskManager* iTaskManager;
       
   121     /** File utility used by the tasks */
       
   122     CGlxtnFileUtility* iFileUtility;
       
   123     /** Reference count of the single instance */
       
   124     TInt iReferenceCount;
       
   125     /** Settings Model used by the background tasks */
       
   126     CGlxSettingsModel* iSettingsModel;
       
   127     };
       
   128 
       
   129 #endif // C_GLXTNTHUMBNAILCREATOR_H