imagehandlingutilities/thumbnailmanager/thumbnailmanagerqt/inc/thumbnailmanager_p_qt.h
branchRCL_3
changeset 41 9d4d3445ce6e
parent 40 6257223ede8a
child 47 3d743e824514
equal deleted inserted replaced
40:6257223ede8a 41:9d4d3445ce6e
     1 /*
       
     2 * Copyright (c) 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef THUMBNAILMANAGER_P_QT_H
       
    19 #define THUMBNAILMANAGER_P_QT_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QPixmap>
       
    23 
       
    24 #include <thumbnailmanager.h>
       
    25 #include <thumbnailmanager_qt.h>
       
    26 #include <thumbnailmanagerobserver.h>
       
    27 
       
    28 
       
    29 class QString;
       
    30 class QSize;
       
    31 class CThumbnailManager;
       
    32 class MThumbnailData;
       
    33 class CFbsBitmap;
       
    34 class QByteArray;
       
    35 
       
    36 class TestThumbnailManager;
       
    37 
       
    38 class ThumbnailManagerPrivate : 
       
    39 public QObject,
       
    40 public MThumbnailManagerObserver
       
    41     {
       
    42     Q_OBJECT
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Constructor
       
    47      */    
       
    48         
       
    49     ThumbnailManagerPrivate();
       
    50 
       
    51     /**
       
    52      * Destructor
       
    53      */
       
    54     virtual ~ThumbnailManagerPrivate();
       
    55 
       
    56     /**
       
    57      * Get quality versus performance preference.
       
    58      */
       
    59     ThumbnailManager::QualityPreference qualityPreference() const;
       
    60     
       
    61     /**
       
    62      * Set quality versus performance preference.
       
    63      */
       
    64     bool setQualityPreference( ThumbnailManager::QualityPreference qualityPreference );
       
    65     
       
    66     /**
       
    67      * Get the current desired size for thumbnail bitmaps.
       
    68      */
       
    69     QSize thumbnailSize() const;
       
    70 
       
    71     /**
       
    72      * Set desired size for thumbnail bitmaps.
       
    73      */
       
    74     bool setThumbnailSize( const QSize& aThumbnailSize );
       
    75     
       
    76     /**
       
    77      * Set desired size for thumbnail bitmaps.
       
    78      */
       
    79     bool setThumbnailSize( ThumbnailManager::ThumbnailSize thumbnailSize );
       
    80 
       
    81     /**
       
    82      * Get current mode for thumbnail generation.
       
    83      */
       
    84     ThumbnailManager::ThumbnailMode mode() const;
       
    85 
       
    86     /**
       
    87      * Set mode for thumbnail generation. 
       
    88      */
       
    89     bool setMode( ThumbnailManager::ThumbnailMode mode );
       
    90 
       
    91     /**
       
    92      * Get a thumbnail for an object file. If a thumbnail already exists, it
       
    93      * is loaded and if a thumbnail does not exist, it is created
       
    94      * transparently. 
       
    95      */
       
    96     int getThumbnail( const QString& fileName, void * clientData, 
       
    97             int priority );
       
    98 
       
    99     /**
       
   100      * Get a persistent thumbnail for an object file. If a thumbnail already
       
   101      *  exists, it is loaded and if a thumbnail does not exist, it is created
       
   102      * transparently. 
       
   103      */    
       
   104     int getThumbnail( unsigned long int aThumbnailId, void * clientData, 
       
   105             int priority );
       
   106     
       
   107     /**
       
   108      * Set a thumbnail for an object file generated from pixmap delivered.
       
   109      * thumbnailReady() signal will be emited when the operation is complete.                           
       
   110      */    
       
   111     int setThumbnail( const QPixmap& source, const QString& fileName,
       
   112             void * clientData, int priority );
       
   113     
       
   114     /**
       
   115      * Set a thumbnail for an object file generated from pixmap delivered.
       
   116      * thumbnailReady() signal will be emited when the operation is complete.                           
       
   117      */    
       
   118     int setThumbnail( const QImage& source, const QString& fileName,
       
   119             void * clientData, int priority );
       
   120     
       
   121     /**
       
   122      * Set a thumbnail for an object file generated from source file.
       
   123      * thumbnailReady() signal will be emited when the operation is complete.                           
       
   124      */    
       
   125     int setThumbnail( const QString& sourceFileName, const QString& targetFileName,
       
   126             const QString& mimeType, void * clientData, int priority );   
       
   127     
       
   128     /**
       
   129      * Delete all thumbnails for a given object. This is an asynchronous
       
   130      * operation, which always returns immediately.
       
   131      */
       
   132     void deleteThumbnails( const QString& fileName );
       
   133 
       
   134     /**
       
   135      * Delete all thumbnails for a given object. This is an asynchronous
       
   136      * operation, which always returns immediately.
       
   137      */
       
   138     void deleteThumbnails( unsigned long int thumbnailId );
       
   139     
       
   140     /**
       
   141      * Cancel a thumbnail operation.
       
   142      */
       
   143     bool cancelRequest( int id );
       
   144 
       
   145     /**
       
   146      * Change the priority of a queued thumbnail operation.
       
   147      */
       
   148     bool changePriority( int id, int newPriority );
       
   149     
       
   150     //FROM  MThumbnailManagerObserver
       
   151     /**
       
   152      * Preview thumbnail generation or loading is complete.
       
   153      *
       
   154      * This callback is not called unless EOptimizeForQualityWithPreview flag
       
   155      * was specified.
       
   156      *
       
   157      * This callback is not called if any of the following is true:
       
   158      * - an error occurred while processing the preview thumbnail
       
   159      * - a suitable existing thumbnail was not found
       
   160      * - a high quality thumbnail is already available
       
   161      *
       
   162      * The MThumbnailData instance is only valid for the duration of
       
   163      * this call. It may not be stored for later use. If the client should
       
   164      * want to use the bitmap data later, it can claim ownership of the
       
   165      * CFbsBitmap object by calling DetachBitmap().
       
   166      *
       
   167      * @since S60 v5.0
       
   168      * @param aThumbnail     An object representing the resulting thumbnail.
       
   169      * @param aId            Request ID for the operation
       
   170      */
       
   171     void ThumbnailPreviewReady( MThumbnailData& aThumbnail,
       
   172         TThumbnailRequestId aId );
       
   173 
       
   174     /**
       
   175      * Final thumbnail bitmap generation or loading is complete.
       
   176      *
       
   177      * The MThumbnailData instance is only valid for the duration of
       
   178      * this call. It may not be stored for later use. If the client should
       
   179      * want to use the bitmap data later, it can claim ownership of the
       
   180      * CFbsBitmap object by calling DetachBitmap().
       
   181      *
       
   182      * @since S60 v5.0
       
   183      * @param aError         Error code.
       
   184      * @param aThumbnail     An object representing the resulting thumbnail.
       
   185      * @param aId            Request ID for the operation.
       
   186      */
       
   187     void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail,
       
   188         TThumbnailRequestId aId );
       
   189     
       
   190 
       
   191 signals:
       
   192 
       
   193     /**
       
   194      * Final thumbnail bitmap generation or loading is complete.
       
   195      */
       
   196     void thumbnailReady( QPixmap , void * , int , int );
       
   197 
       
   198     void thumbnailReady( QImage , void * , int , int );
       
   199 
       
   200 private:
       
   201     /**
       
   202      * Limit priority to presumed range.
       
   203      */
       
   204     int convertPriority(int basePriority);
       
   205 
       
   206 
       
   207 public:
       
   208     
       
   209     int connectionCounterImage;
       
   210 
       
   211     int connectionCounterPixmap;
       
   212     
       
   213 private:
       
   214     
       
   215     ThumbnailManager *q_ptr;
       
   216 
       
   217     CThumbnailManager* iThumbnailManager;
       
   218     
       
   219     QByteArray* byteArray;
       
   220 
       
   221     friend class ThumbnailManager;
       
   222     friend class TestThumbnailManager;
       
   223     
       
   224 };
       
   225 
       
   226 #endif // ThumbnailManager_H