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