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