1 /* |
|
2 * Copyright (c) 2008-2008 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: Utility class for asynchronously decoding the header thumbnail image |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCAPPCOMMLAUNCHERIMAGEDECODING_H_ |
|
20 #define CCAPPCOMMLAUNCHERIMAGEDECODING_H_ |
|
21 |
|
22 #include "ccappcommlauncherheaders.h" |
|
23 |
|
24 class CCCAppCommLauncherHeaderControl; |
|
25 class CBitmapScaler; |
|
26 /** |
|
27 * Utility class for asynchronously decoding the header thumbnail image |
|
28 * |
|
29 * @code |
|
30 * ?good_class_usage_example(s) |
|
31 * @endcode |
|
32 * |
|
33 * @lib ccappcommlauncherplugin.dll |
|
34 * @since S60 v5.0 |
|
35 */ |
|
36 class CCCAppCommLauncherImageDecoding : public CActive |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Two-phased constructor |
|
41 * |
|
42 * @param aHeader The header control to which the bitmap is to be inserted after loading |
|
43 * @param aBitmapData Descriptor containing the bitmap data stream |
|
44 * @param aImageFile Descriptor containing image file name full path |
|
45 */ |
|
46 static CCCAppCommLauncherImageDecoding* NewL(CCCAppCommLauncherHeaderControl* aHeader, const TDesC8* aBitmapData, const TDesC* aImageFile); |
|
47 |
|
48 /** |
|
49 * Destructor |
|
50 */ |
|
51 ~CCCAppCommLauncherImageDecoding(); |
|
52 |
|
53 /** |
|
54 * Starts the decoding process |
|
55 * |
|
56 * @param aImageSize defines image size |
|
57 */ |
|
58 void StartL( TSize aImageSize ); |
|
59 |
|
60 /** |
|
61 * From CActive |
|
62 * (see details from baseclass ) |
|
63 */ |
|
64 void RunL(); |
|
65 |
|
66 /** |
|
67 * From CActive |
|
68 * (see details from baseclass ) |
|
69 */ |
|
70 void DoCancel(); |
|
71 private: |
|
72 /** |
|
73 * First-phase (C++) constructor |
|
74 * |
|
75 * @param aHeader The header control to which the bitmap is to be inserted after loading |
|
76 */ |
|
77 CCCAppCommLauncherImageDecoding(CCCAppCommLauncherHeaderControl* aHeader); |
|
78 |
|
79 /** |
|
80 * Second phase constructor |
|
81 * |
|
82 * @param aBitmapData Descriptor containing the bitmap data stream |
|
83 * @param aImageFile Descriptor containing image file name full path |
|
84 */ |
|
85 void ConstructL(const TDesC8* aBitmapData, const TDesC* aImageFile); |
|
86 |
|
87 /** |
|
88 * Scales bitmap |
|
89 * |
|
90 */ |
|
91 void ScaleBitmapL(); |
|
92 |
|
93 /** |
|
94 * Create bitmap |
|
95 * |
|
96 */ |
|
97 void CreateBitmapL(); |
|
98 |
|
99 enum TCcaImageDecoderState |
|
100 { |
|
101 ECcaConvertThumbnailImage = 1, |
|
102 ECcaScaleThumbnail, |
|
103 ECcaReadImageFromFile, |
|
104 ECcaConvertImageFromFile, |
|
105 ECcaScaleImage |
|
106 }; |
|
107 |
|
108 /** |
|
109 * The image scaler whose service is called to scale the image |
|
110 * Own. |
|
111 */ |
|
112 CBitmapScaler* iBitmapScaler; |
|
113 |
|
114 /** |
|
115 * The image decoder whose service is called to decode the image |
|
116 * Own. |
|
117 */ |
|
118 CImageDecoder* iImgDecoder; |
|
119 |
|
120 /** |
|
121 * The header control to which the bitmap is to be inserted after loading |
|
122 * Not own. |
|
123 */ |
|
124 CCCAppCommLauncherHeaderControl* iHeader; |
|
125 |
|
126 /** |
|
127 * Handle to the file server session for loading the bitmap |
|
128 */ |
|
129 RFs iFs; |
|
130 |
|
131 /** |
|
132 * The bitmap. |
|
133 * Owned until decoding is complete, then ownersip is transferred to header control. |
|
134 */ |
|
135 CFbsBitmap* iBitmap; // owned until completion |
|
136 |
|
137 /** |
|
138 * Copy of the bitmap data stream |
|
139 * Own. |
|
140 */ |
|
141 HBufC8* iBitmapData; |
|
142 |
|
143 /** |
|
144 * Copy of image name with path |
|
145 * Own. |
|
146 */ |
|
147 HBufC* iImageFullName; |
|
148 |
|
149 /** |
|
150 * Contact bitmap size |
|
151 */ |
|
152 TSize iBitmapSize; |
|
153 |
|
154 /** |
|
155 * Decoder internal state |
|
156 */ |
|
157 TInt iDecoderState; |
|
158 |
|
159 /** |
|
160 * Timer used to delay image conversion |
|
161 */ |
|
162 RTimer iTimer; |
|
163 }; |
|
164 |
|
165 #endif /*CCAPPCOMMLAUNCHERIMAGEDECODING_H_*/ |
|