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