|
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: Thumbnail background generation task implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 * @internal reviewed 30/07/2007 by Simon Brooks |
|
23 */ |
|
24 |
|
25 #ifndef GLXTNBACKGROUNDGENERATIONTASK_H |
|
26 #define GLXTNBACKGROUNDGENERATIONTASK_H |
|
27 |
|
28 // INCLUDES |
|
29 |
|
30 #include "glxtnsavethumbnailtask.h" |
|
31 #include <glxsettingsmodel.h> |
|
32 |
|
33 // CONSTANTS |
|
34 |
|
35 // MACROS |
|
36 |
|
37 // DATA TYPES |
|
38 |
|
39 // FUNCTION PROTOTYPES |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 |
|
43 class CGlxtnFileUtility; |
|
44 class CGlxtnImageUtility; |
|
45 class CGlxtnVideoUtility; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 /** |
|
50 * Background task to generate a thumbnail. |
|
51 * |
|
52 * @author Dan Rhodes |
|
53 * @ingroup glx_thumbnail_creator |
|
54 */ |
|
55 NONSHARABLE_CLASS(CGlxtnBackgroundGenerationTask) : public CGlxtnSaveThumbnailTask |
|
56 { |
|
57 public: // Constructors and destructor |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * @param iItemId Media ID of item to thumbnail. |
|
62 * @param aFileUtility File utility for use by the task. |
|
63 * @param aClient Client initiating the request. |
|
64 */ |
|
65 static CGlxtnBackgroundGenerationTask* NewL( |
|
66 const TGlxMediaId& iItemId, CGlxtnFileUtility& aFileUtility, |
|
67 MGlxtnThumbnailCreatorClient& aClient, |
|
68 CGlxSettingsModel::TSupportedOrientations aSupportedOrientations); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 virtual ~CGlxtnBackgroundGenerationTask(); |
|
74 |
|
75 private: // From CGlxtnTask |
|
76 TBool DoStartL(TRequestStatus& aStatus); |
|
77 void DoCancel(); |
|
78 TBool DoRunL(TRequestStatus& aStatus); |
|
79 TBool DoRunError(TInt aError); |
|
80 |
|
81 private: |
|
82 /** |
|
83 * C++ default constructor. |
|
84 * @param iItemId Media ID of item to thumbnail. |
|
85 * @param aFileUtility File utility for use by the task. |
|
86 * @param aClient Client initiating the request. |
|
87 */ |
|
88 CGlxtnBackgroundGenerationTask(const TGlxMediaId& iItemId, |
|
89 CGlxtnFileUtility& aFileUtility, |
|
90 MGlxtnThumbnailCreatorClient& aClient, |
|
91 CGlxSettingsModel::TSupportedOrientations aSupportedOrientations); |
|
92 |
|
93 /** |
|
94 * By default Symbian 2nd phase constructor is private. |
|
95 */ |
|
96 void ConstructL(); |
|
97 |
|
98 /** |
|
99 * Check whether next size already exists or needs to be generated. |
|
100 * @param aStatus Request status for the asynchronous operation. |
|
101 * @return ETrue if the task has issued an asyncronous request. |
|
102 */ |
|
103 TBool CheckNextL(TRequestStatus& aStatus); |
|
104 |
|
105 /** |
|
106 * Create the next size to be generated. |
|
107 * @param aStatus Request status for the asynchronous operation. |
|
108 * @return ETrue if the task has issued an asyncronous request. |
|
109 */ |
|
110 TBool ProcessNextL(TRequestStatus& aStatus); |
|
111 |
|
112 /** |
|
113 * Filter the thumbnail for the next required size. |
|
114 * @param aStatus Request status for the asynchronous operation. |
|
115 */ |
|
116 void FilterThumbnailL(TRequestStatus& aStatus); |
|
117 |
|
118 /** |
|
119 * Scale the thumbnail to the next required size. |
|
120 * @param aStatus Request status for the asynchronous operation. |
|
121 */ |
|
122 void ScaleThumbnailL(TRequestStatus& aStatus); |
|
123 |
|
124 /** |
|
125 * Decode the image for the required size. |
|
126 * @param aStatus Request status for the asynchronous operation. |
|
127 */ |
|
128 void DecodeImageL(TRequestStatus& aStatus); |
|
129 /** |
|
130 * calculates Grid Icon Size for landscape orientation and Fullscreen |
|
131 * Image size depending on Layout defines. |
|
132 */ |
|
133 void LayoutSpecificDataL(); |
|
134 |
|
135 |
|
136 private: // Data |
|
137 /** Pointer to client, or NULL after client goes away */ |
|
138 MGlxtnThumbnailCreatorClient* iClient; |
|
139 /** File utility */ |
|
140 CGlxtnFileUtility& iFileUtility; |
|
141 /** Array of sizes to check if need to generate */ |
|
142 RArray<TSize> iSizes; |
|
143 /** Array of sizes to generate */ |
|
144 RArray<TSize> iTodoSizes; |
|
145 /** Utility to get thumbnail from image */ |
|
146 CGlxtnImageUtility* iImageUtility; |
|
147 /** Utility to get thumbnail from video */ |
|
148 CGlxtnVideoUtility* iVideoUtility; |
|
149 /** Image loaded from file */ |
|
150 CFbsBitmap* iImage; |
|
151 /** Image loaded from file */ |
|
152 CFbsBitmap* iFilteredImage; |
|
153 /** Flag to show BadFileMarker not created so no need to delete **/ |
|
154 TBool iBadFileMarkerNotNeededFlag; |
|
155 /** Flag to show whether image has been decoded yet **/ |
|
156 TBool iImageDecoded; |
|
157 /** Flag to show which orientations are supported **/ |
|
158 CGlxSettingsModel::TSupportedOrientations iSupportedOrientations; |
|
159 TSize iGridIconSize; |
|
160 TSize iCoverflowIconSize; |
|
161 }; |
|
162 |
|
163 #endif // GLXTNBACKGROUNDGENERATIONTASK_H |
|
164 |
|
165 // End of File |