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