engine/collectionframework/thumbnailcreator/inc/glxtnfilteravailabletask.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:   Task used for thumbnail availability filter.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  * @internal reviewed 30/07/2007 by Simon Brooks
       
    22  */
       
    23 
       
    24 #ifndef C_GLXTNFILTERAVAILABLETASK_H
       
    25 #define C_GLXTNFILTERAVAILABLETASK_H
       
    26 
       
    27 #include "glxtntask.h"
       
    28 
       
    29 // Forward declarations
       
    30 class CGlxtnFileInfo;
       
    31 
       
    32 /**
       
    33  * Task to filter a list of media item IDs to include only those which don't
       
    34  * have a high quality thumbnail of a given size.
       
    35  *
       
    36  * @author Dan Rhodes
       
    37  * @ingroup glx_thumbnail_creator
       
    38  */
       
    39 NONSHARABLE_CLASS(CGlxtnFilterAvailableTask) : public CGlxtnClientTask
       
    40     {
       
    41 public:
       
    42     /**
       
    43     * Two-phased constructor.
       
    44     * @param aItemArray Array of item IDs, from which those with thumbnails
       
    45     *                   should be removed.
       
    46     * @param aSize Size of thumbnail required.
       
    47     * @param aClient Client initiating the request.
       
    48     */
       
    49 	static CGlxtnFilterAvailableTask* NewL(
       
    50             	    const TArray<TGlxMediaId>& aItemArray, const TSize& aSize,
       
    51             	    MGlxtnThumbnailCreatorClient& aClient);
       
    52     /**
       
    53     * Destructor.
       
    54     */
       
    55     ~CGlxtnFilterAvailableTask();
       
    56 
       
    57 protected:  // From CGlxtnTask
       
    58 
       
    59     TBool DoStartL(TRequestStatus& aStatus);
       
    60 	void DoCancel();
       
    61 	TBool DoRunL(TRequestStatus& aStatus);
       
    62     TBool DoRunError(TInt aError);
       
    63 
       
    64 private:
       
    65     /**
       
    66     * C++ default constructor.
       
    67     * @param aSize Size of thumbnail required.
       
    68     * @param aClient Client initiating the request.
       
    69     */
       
    70     CGlxtnFilterAvailableTask(const TSize& aSize,
       
    71                                 MGlxtnThumbnailCreatorClient& aClient);
       
    72     /**
       
    73     * Symbian 2nd phase constructor.
       
    74     * @param aItemArray Array of item IDs, from which those with thumbnails
       
    75     *                   should be removed.
       
    76     */
       
    77 	void ConstructL(const TArray<TGlxMediaId>& aItemArray);
       
    78 
       
    79     /**
       
    80     * Start asynchronous request for file information for an item.
       
    81     * @param aStatus Request status for the asynchronous operation.
       
    82     */
       
    83     TBool GetFileInfoL(TRequestStatus& aStatus);
       
    84     /**
       
    85     * Start asynchronous check for thumbnail in persistent storage.
       
    86     * @param aStatus Request status for the asynchronous operation.
       
    87     */
       
    88     TBool CheckIdL(TRequestStatus& aStatus);
       
    89 
       
    90 private:
       
    91     enum TFilterState
       
    92         {
       
    93         EStateFetchingUri, EStateChecking
       
    94         };
       
    95 
       
    96     /** Size of thumbnail for which to check */
       
    97     TSize iSize;
       
    98     /** Array of media IDs from which those with thumbnails are removed */
       
    99     RArray<TGlxMediaId> iIdArray;
       
   100     /** Current task state */
       
   101     TFilterState iState;
       
   102     /** Current index in Id array */
       
   103     TInt iIndex;
       
   104     /** File info for current item */
       
   105     CGlxtnFileInfo* iFileInfo;
       
   106     };
       
   107 
       
   108 #endif  // C_GLXTNFILTERAVAILABLETASK_H