engine/collectionframework/thumbnailcreator/inc/glxtnloadthumbnailtask.h
changeset 71 27f2d7aec52a
parent 69 45459746d5e8
child 72 0a8e959402e5
equal deleted inserted replaced
69:45459746d5e8 71:27f2d7aec52a
     1 /*
       
     2 * Copyright (c) 2006-2007 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:   Base class for tasks which load thumbnails
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_GLXTNLOADTHUMBNAILTASK_H
       
    21 #define C_GLXTNLOADTHUMBNAILTASK_H
       
    22 
       
    23 #include "glxtntask.h"
       
    24 #include "glxtnstd.h"
       
    25 
       
    26 // Forward declarations
       
    27 class CGlxtnFileInfo;
       
    28 class CGlxtnFileUtility;
       
    29 class CFbsBitmap;
       
    30 class CImageDecoder;
       
    31 class TGlxThumbnailRequest;
       
    32 
       
    33 /**
       
    34  * Base class for tasks which load thumbnails.
       
    35  *
       
    36  * @author Dan Rhodes
       
    37  * @ingroup glx_thumbnail_creator
       
    38  */
       
    39 NONSHARABLE_CLASS( CGlxtnLoadThumbnailTask ) : public CGlxtnClientTask
       
    40     {
       
    41 public:
       
    42     /**
       
    43     * Destructor.
       
    44     */
       
    45     ~CGlxtnLoadThumbnailTask();
       
    46 
       
    47 protected:  // From CGlxtnTask
       
    48 	void DoCancel();
       
    49 
       
    50 protected:
       
    51     /**
       
    52     * C++ default constructor.
       
    53     * @param aId Task type ID.
       
    54     * @param aRequestInfo Parameters for the thumbnail request.
       
    55     * @param aFileUtility File utility for use by the task.
       
    56     * @param aClient Client initiating the request.
       
    57     */
       
    58     CGlxtnLoadThumbnailTask( const TGlxtnTaskId& aId,
       
    59                             const TGlxThumbnailRequest& aRequestInfo,
       
    60                             CGlxtnFileUtility& aFileUtility,
       
    61                             MGlxtnThumbnailCreatorClient& aClient );
       
    62     /**
       
    63     * Symbian 2nd phase constructor.
       
    64     * @param aBitmapHandle Handle to bitmap in which to store the thumbnail.
       
    65     */
       
    66     void ConstructL( TInt aBitmapHandle );
       
    67 
       
    68     /**
       
    69     * Start asynchronous loading.
       
    70     * @param aStatus Request status for the asynchronous operation.
       
    71     * @return ETrue if an asynchronous operation has been started.
       
    72     */
       
    73     TBool LoadThumbnailL( TRequestStatus& aStatus );
       
    74     /**
       
    75     * Create bitmap from loaded thumbnail data.
       
    76     * @param aStatus Request status for the asynchronous operation.
       
    77     * @return ETrue if an asynchronous operation has been started.
       
    78     */
       
    79     TBool HandleLoadedThumbnailL( TRequestStatus& aStatus );
       
    80     /**
       
    81     * Start asynchronous decoding.  iDecoder should point to a valid decoder.
       
    82     * @param aStatus Request status for the asynchronous operation.
       
    83     * @param aScaleBitmap If true, scale the loaded bitmap close to
       
    84     *       requested size.
       
    85     */
       
    86     void DecodeThumbnailL( TRequestStatus& aStatus, TBool aScaleBitmap );
       
    87 
       
    88 protected:
       
    89     enum TGeneratorState
       
    90         {
       
    91         EStateFetchingUri, EStateLoading, EStateDecodingThumbnail,
       
    92         EStateDecodingImage, EStateScaling, EStateFiltering
       
    93         };
       
    94 
       
    95     /** File utility */
       
    96     CGlxtnFileUtility& iFileUtility;
       
    97 	/** Current state for task state machine */
       
    98     TGeneratorState iState;
       
    99     /** File information for item to thumbnail (owned) */
       
   100     CGlxtnFileInfo* iInfo;
       
   101     /** Requested thumbnail size */
       
   102     TSize iRequestedSize;
       
   103     /** Thumbnail image data (owned) */
       
   104     HBufC8* iThumbData;
       
   105     /** Thumbnail data format */
       
   106     TGlxImageDataFormat iFormat;
       
   107     /** Decoder to decode the thumbnail data (owned) */
       
   108     CImageDecoder* iDecoder;
       
   109     /** Bitmap to decode image into (owned) */
       
   110     CFbsBitmap* iThumbnail;
       
   111     /** DRM allowed flag passed from thumbnail request */
       
   112     TBool iDrmAllowed;
       
   113     };
       
   114 
       
   115 #endif // C_GLXTNLOADTHUMBNAILTASK_H