mpviewplugins/mpdetailsviewplugin/tsrc/unittest_mpsongdata/stub/inc/thumbnailmanager_qt.h
branchGCC_SURGE
changeset 44 eff9df3d9c98
parent 30 b95ddb5a0d10
parent 42 79c49924ae23
equal deleted inserted replaced
30:b95ddb5a0d10 44:eff9df3d9c98
     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: ThumbnailManager stub for testing MpSongData
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef THUMBNAILMANAGER_QT_H_
       
    19 #define THUMBNAILMANAGER_QT_H_
       
    20 #include <qobject>
       
    21 #include <QPixmap.h>
       
    22 
       
    23 
       
    24 /** default priority value */
       
    25 const int tnmWrapperPriorityIdle = -100;
       
    26 
       
    27 class ThumbnailManager : public QObject
       
    28     {
       
    29     Q_OBJECT
       
    30 
       
    31 public:
       
    32 
       
    33 
       
    34     /** Thumbnail size. */
       
    35     enum ThumbnailSize
       
    36     {
       
    37         /**
       
    38          * Small thumbnail
       
    39          */
       
    40         ThumbnailSmall = 0,
       
    41         /**
       
    42          * Medium thumbnail
       
    43          */
       
    44         ThumbnailMedium,
       
    45         /**
       
    46          * Large thumbnail
       
    47          */
       
    48         ThumbnailLarge
       
    49     };
       
    50 
       
    51     /** Mode of thumbnail creation. */
       
    52     enum ThumbnailMode
       
    53         {
       
    54         /**
       
    55          * Default mode. This means that:
       
    56          * - Thumbnail must be as large as requested (unless the actual object is smaller).
       
    57          * - Smaller thumbnails may be up scaled to desired resolution.
       
    58          * - Aspect ratio is maintained and thumbnails are not cropped. The
       
    59          *   resulting thumbnail may smaller in either width or height if
       
    60          *   the aspect ratio of the object does not match the aspect ratio
       
    61          *   of the requested size.
       
    62          */
       
    63         Default = 0,
       
    64 
       
    65         /**
       
    66          * Allow thumbnails which are smaller than requested are. Thumbnail
       
    67          * bitmaps are never up scaled if this flag is set.
       
    68          */
       
    69         AllowAnySize = 1,
       
    70 
       
    71         /**
       
    72          * New thumbnail images are not created if this flag is set. Only
       
    73          * existing thumbnails may be returned. If a requested thumbnail does
       
    74          * not exist null pixmap will be returned.
       
    75          */
       
    76         DoNotCreate = 2,
       
    77 
       
    78         /**
       
    79          * Thumbnail images are cropped to match requested aspect ratio. If
       
    80          * this mode is set, the size of the resulting thumbnail always
       
    81          * matches the requested size.
       
    82          */
       
    83         CropToAspectRatio = 4
       
    84     };
       
    85 
       
    86     /**  Quality versus speed preference setting */
       
    87     enum QualityPreference
       
    88     {
       
    89         /**
       
    90          * Prefer thumbnails in the highest quality possible disregarding
       
    91          * any negative impact on performance.
       
    92          */
       
    93         OptimizeForQuality,
       
    94 
       
    95         /**
       
    96          * Get thumbnails as fast as possible, even if
       
    97          * it means lower quality.
       
    98          */
       
    99         OptimizeForPerformance
       
   100     };
       
   101 
       
   102     // Test utility functions
       
   103     static int getInitCounter();
       
   104     static void resetInitCounter();
       
   105 
       
   106     // Stub functions
       
   107     ThumbnailManager( QObject* parentPtr = NULL );
       
   108     virtual ~ThumbnailManager();
       
   109     bool setMode( ThumbnailMode mode );
       
   110     bool setQualityPreference( QualityPreference qualityPreference );
       
   111     bool setThumbnailSize( ThumbnailSize thumbnailSize );
       
   112     int getThumbnail( const QString& fileName, void * clientData = NULL,
       
   113             int priority = tnmWrapperPriorityIdle );
       
   114     bool cancelRequest( int id );
       
   115 
       
   116 signals:
       
   117 
       
   118     void thumbnailReady( QPixmap , void * , int , int );
       
   119 
       
   120 public:
       
   121 
       
   122     bool    mGetThumbFails;
       
   123     int     mThumbnailReqCounter;
       
   124     int     mCancelCounter;
       
   125 
       
   126 };
       
   127 
       
   128 #endif /* THUMBNAILMANAGER_QT_H_ */