engine/collectionframework/thumbnailcreator/inc/glxtngeneratethumbnailtask.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:   Classes for thumbnail-related tasks.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  * @internal reviewed 30/07/2007 by Simon Brooks
       
    22  */
       
    23 
       
    24 #ifndef C_GLXTNGENERATETHUMBNAILTASK_H
       
    25 #define C_GLXTNGENERATETHUMBNAILTASK_H
       
    26 
       
    27 #include "glxtnloadthumbnailtask.h"
       
    28 
       
    29 class CGlxtnFileInfo;
       
    30 class CGlxtnFileUtility;
       
    31 class CGlxtnImageUtility;
       
    32 class CGlxtnVideoUtility;
       
    33 class CFbsBitmap;
       
    34 class CImageDecoder;
       
    35 class RFs;
       
    36 
       
    37 /**
       
    38  * Task to generate a high quality thumbnail for a media item.
       
    39  *
       
    40  * An instance of CImageDecoder is constructed to produce a bitmap from the
       
    41  * image file, scaling to the smallest possible size not smaller than the
       
    42  * required size.
       
    43  *
       
    44  * The task then uses ADIS to scale to the exact size required, and also uses
       
    45  * the sharpening and IETD algorithms to enhance the image.
       
    46  *
       
    47  * @ingroup glx_thumbnail_creator
       
    48  */
       
    49 NONSHARABLE_CLASS( CGlxtnGenerateThumbnailTask )
       
    50         : public CGlxtnLoadThumbnailTask
       
    51     {
       
    52 public:
       
    53     /**
       
    54     * Two-phased constructor.
       
    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 	static CGlxtnGenerateThumbnailTask* NewL(
       
    60 	    const TGlxThumbnailRequest& aRequestInfo,
       
    61 	    CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient);
       
    62     /**
       
    63     * Destructor.
       
    64     */
       
    65 	~CGlxtnGenerateThumbnailTask();
       
    66 
       
    67 protected:  // From CGlxtnTask
       
    68     void SetManager(CGlxtnTaskManager* aManager);
       
    69     virtual TBool DoStartL(TRequestStatus& aStatus);
       
    70 	virtual void DoCancel();
       
    71 	virtual TBool DoRunL(TRequestStatus& aStatus); 
       
    72     TBool DoRunError(TInt aError);
       
    73 
       
    74 private:
       
    75     /**
       
    76     * C++ default constructor.
       
    77     * @param aRequestInfo Parameters for the thumbnail request.
       
    78     * @param aFileUtility File utility for use by the task.
       
    79     * @param aClient Client initiating the request.
       
    80     */
       
    81     CGlxtnGenerateThumbnailTask(const TGlxThumbnailRequest& aRequestInfo,
       
    82         CGlxtnFileUtility& aFileUtility, MGlxtnThumbnailCreatorClient& aClient);
       
    83     /**
       
    84     * Symbian 2nd phase constructor.
       
    85     * @param aBitmapHandle Handle to bitmap in which to store the thumbnail.
       
    86     */
       
    87 	void ConstructL(TInt aBitmapHandle);
       
    88 
       
    89     /**
       
    90     * Start asynchronous decoding process for a high quality thumbnail.
       
    91     * @param aStatus Request status for the asynchronous operation.
       
    92     */
       
    93     void HighQualityDecodeL( TRequestStatus& aStatus );
       
    94     /**
       
    95     * @return ETrue if viewing the requested thumbnail size would require
       
    96     *       DRM rights.
       
    97     */
       
    98     TBool SizeRequiresDrmRights();
       
    99 
       
   100 private:
       
   101     /** Pointer to task manager (not owned) */
       
   102     CGlxtnTaskManager* iTaskManager;
       
   103     /** Utility to get thumbnail from image (owned) */
       
   104     CGlxtnImageUtility* iImageUtility;
       
   105     /** Utility to get thumbnail from video (owned) */
       
   106     CGlxtnVideoUtility* iVideoUtility;
       
   107     /** Image loaded from file (owned) */
       
   108     CFbsBitmap* iImage;
       
   109     /** Whether current item is a video */
       
   110     TBool iVideo;
       
   111     /** Whether current file is DRM protected */
       
   112     TBool iProtected;
       
   113     /** Flag to show BadFileMarker not created so no need to delete **/
       
   114     TBool iBadFileMarkerNotNeededFlag;
       
   115     };
       
   116         
       
   117 #endif // C_GLXTNGENERATETHUMBNAILTASK_H