engine/collectionframework/thumbnailcreator/inc/glxtnthumbnailcreator.h
changeset 71 27f2d7aec52a
parent 69 45459746d5e8
child 72 0a8e959402e5
equal deleted inserted replaced
69:45459746d5e8 71:27f2d7aec52a
     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  * @internal reviewed 30/07/2007 by Simon Brooks
       
    22  */
       
    23 
       
    24 #ifndef C_GLXTNTHUMBNAILCREATOR_H
       
    25 #define C_GLXTNTHUMBNAILCREATOR_H
       
    26 
       
    27 #include "glxtnstd.h"
       
    28 #include "glxtntask.h"
       
    29 #include <glxmediaid.h>
       
    30 #include <glxpanic.h>
       
    31 #include <glxthumbnailinfo.h>
       
    32 
       
    33 class CGlxtnFileUtility;
       
    34 class CGlxSettingsModel;
       
    35 class MGlxtnThumbnailCreatorClient;
       
    36 class MGlxtnThumbnailStorage;
       
    37 class TGlxThumbnailRequest;
       
    38 
       
    39 /**
       
    40  *  CGlxtnThumbnailCreator
       
    41  *
       
    42  *  Thumbnail creator is the thumbnail engine, and it loads and generates 
       
    43  *  thumbnails on the foreground and generates non-created thumbnails on
       
    44  *  the background
       
    45  *
       
    46  * @ingroup glx_thumbnail_creator
       
    47  */
       
    48 class CGlxtnThumbnailCreator : public CBase
       
    49     {
       
    50 public:
       
    51     /**
       
    52     * Starts the provisioning of a thumbnail.  This will result in a callback
       
    53     * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete().
       
    54     */
       
    55     IMPORT_C static CGlxtnThumbnailCreator* InstanceL();
       
    56     /**
       
    57     * Decrement the reference count, and delete the instance if the count
       
    58     * becomes zero.  Ensures any tasks using the given storage are cancelled.
       
    59     * @param aStorage Pointer to storage used by client, or NULL.
       
    60     */
       
    61     IMPORT_C void Close(MGlxtnThumbnailStorage* aStorage);
       
    62 
       
    63     /**
       
    64     * Destructor.
       
    65     */
       
    66 	~CGlxtnThumbnailCreator();
       
    67 
       
    68     /**
       
    69     * Starts the provisioning of a thumbnail.  This will result in a callback
       
    70     * to MGlxtnThumbnailCreatorClient::ThumbnailFetchComplete().
       
    71     * @param aRequestInfo Parameters for required thumbnail.
       
    72     * @param aClient Client initiating the request.
       
    73     */
       
    74     IMPORT_C void FetchThumbnailL(const TGlxThumbnailRequest& aRequestInfo,
       
    75                                     MGlxtnThumbnailCreatorClient& aClient);
       
    76 
       
    77     /**
       
    78     * Starts deleting all stored thumbnails for a given item.  This will result
       
    79     * in a callback to MGlxtnThumbnailCreatorClient::ThumbnailDeletionComplete().
       
    80     * @param aItemId ID of the media item.
       
    81     * @param aClient Client initiating the request.
       
    82     */
       
    83     IMPORT_C void DeleteThumbnailsL(const TGlxMediaId& aItemId,
       
    84                                     MGlxtnThumbnailCreatorClient& aClient);
       
    85 
       
    86     /**
       
    87     * Starts the filtering of items for which a thumbnail is available from a
       
    88     * list of item IDs.  This will result in a callback to
       
    89     * MGlxtnThumbnailCreatorClient::FilterAvailableComplete().
       
    90     * @param aItemArray Array of item IDs, from which those with thumbnails
       
    91     *                   should be removed.
       
    92     * @param aSize Size of thumbnail required.
       
    93     * @param aClient Client initiating the request.
       
    94     */
       
    95     IMPORT_C void FilterAvailableThumbnailsL(
       
    96                     const TArray<TGlxMediaId>& aItemArray, const TSize& aSize,
       
    97                     MGlxtnThumbnailCreatorClient& aClient);
       
    98 
       
    99     /**
       
   100     * Starts the cleanup of obsolete thumbnails from storage.  There is no
       
   101     * callback indicating completion of the request.
       
   102     * @param aStorage Pointer to storage used by client.
       
   103     */
       
   104     IMPORT_C void CleanupThumbnailsL(MGlxtnThumbnailStorage* aStorage);
       
   105 
       
   106     /** 
       
   107     * Cancel any ongoing tasks for a given item.  This ensures the TNC is not
       
   108     * locking the media file.
       
   109     * @param aItemId ID of the media item.
       
   110     */
       
   111     IMPORT_C void CancelRequest(const TGlxMediaId& aItemId);
       
   112 
       
   113 private:
       
   114 	CGlxtnThumbnailCreator();
       
   115 	void ConstructL();
       
   116 
       
   117 private:
       
   118     /** Task manager */
       
   119     CGlxtnTaskManager* iTaskManager;
       
   120     /** File utility used by the tasks */
       
   121     CGlxtnFileUtility* iFileUtility;
       
   122     /** Reference count of the single instance */
       
   123     TInt iReferenceCount;
       
   124     /** Settings Model used by the background tasks */
       
   125     CGlxSettingsModel* iSettingsModel;
       
   126     };
       
   127 
       
   128 #endif // C_GLXTNTHUMBNAILCREATOR_H