|
1 /* |
|
2 * Copyright (c) 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: presene avatar decoder handler |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CSERVICEWIDGETIMAGEDECODER_H |
|
21 #define CSERVICEWIDGETIMAGEDECODER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 |
|
26 class CImageDecoder; |
|
27 class CBitmapScaler; |
|
28 class CFbsBitmap; |
|
29 class CImageEncoder; |
|
30 |
|
31 /** |
|
32 * decode notification class |
|
33 * |
|
34 * @lib servicewidgetdatapublisher.dll |
|
35 * @since S60 v5.0 |
|
36 */ |
|
37 |
|
38 class MServiceWidgetImagerDecodeObserver |
|
39 { |
|
40 public : |
|
41 /** |
|
42 * HandlerDecodeComplete notification once decode complete |
|
43 * @param aBitmap decoded bitmap |
|
44 * @since S60 v5.0 |
|
45 * takes the ownership of aBitmap |
|
46 */ |
|
47 virtual void HandlerDecodeCompleteL() = 0 ; |
|
48 |
|
49 /** |
|
50 * virtaul Destructor |
|
51 * @since S60 v5.0 |
|
52 */ |
|
53 virtual ~MServiceWidgetImagerDecodeObserver() |
|
54 { |
|
55 |
|
56 } |
|
57 }; |
|
58 |
|
59 /** |
|
60 * Utility class for asynchronously decoding the header thumbnail image |
|
61 * |
|
62 * @lib servicewidgetdatapublisher.dll |
|
63 * @since S60 v5.0 |
|
64 */ |
|
65 |
|
66 class CServiceWidgetImageDecoder : public CActive |
|
67 { |
|
68 enum TSWDEOperationId |
|
69 { |
|
70 EOpUnknown = -1, |
|
71 EOpEncodeBitmap, |
|
72 EOpComplete |
|
73 }; |
|
74 public: |
|
75 /** |
|
76 * Two-phased constructor |
|
77 * |
|
78 * @param aHeader The header control to which the bitmap is to be inserted after loading |
|
79 * @param aBitmapData Descriptor containing the bitmap data stream |
|
80 * @return a instance of same class |
|
81 * @since S60 v5.0 |
|
82 */ |
|
83 static CServiceWidgetImageDecoder* NewL(MServiceWidgetImagerDecodeObserver& aObserver ); |
|
84 |
|
85 /** |
|
86 * Destructor |
|
87 * @since S60 v5.0 |
|
88 */ |
|
89 ~CServiceWidgetImageDecoder(); |
|
90 |
|
91 /** |
|
92 * Starts the decoding process |
|
93 * @since S60 v5.0 |
|
94 * @param aBitmapData Descriptor containing the bitmap data stream |
|
95 * |
|
96 */ |
|
97 void StartDecodingL( const TDesC8& aBitmapData ); |
|
98 |
|
99 /** |
|
100 * From CActive |
|
101 * (see details from baseclass ) |
|
102 * @since S60 v5.0 |
|
103 */ |
|
104 void RunL(); |
|
105 |
|
106 /** |
|
107 * From CActive |
|
108 * (see details from baseclass ) |
|
109 * @since S60 v5.0 |
|
110 */ |
|
111 void DoCancel(); |
|
112 private: |
|
113 /** |
|
114 * First-phase (C++) constructor |
|
115 * @param aHeader The header control to which the bitmap is to be inserted after loading |
|
116 * @since S60 v5.0 |
|
117 */ |
|
118 CServiceWidgetImageDecoder(MServiceWidgetImagerDecodeObserver& aObserver); |
|
119 |
|
120 /** |
|
121 * Second phase constructor |
|
122 * @since S60 v5.0 |
|
123 */ |
|
124 void ConstructL(); |
|
125 |
|
126 /** |
|
127 * helper to do encoding |
|
128 * @since S60 v5.0 |
|
129 */ |
|
130 void StartEncodingL(); |
|
131 |
|
132 private : // data |
|
133 |
|
134 |
|
135 /** |
|
136 * Not Owns : notify once complete |
|
137 */ |
|
138 MServiceWidgetImagerDecodeObserver& iObserver; |
|
139 |
|
140 |
|
141 /** |
|
142 * Owns : The image decoder whose service is called to decode the image |
|
143 */ |
|
144 CImageDecoder* iImgDecoder; |
|
145 |
|
146 /** |
|
147 * Owns : The image encoder whose service is called to decode the image |
|
148 */ |
|
149 CImageEncoder* iImageEncoder; |
|
150 |
|
151 /** |
|
152 * Owns : Handle to the file server session for loading the bitmap |
|
153 */ |
|
154 RFs iFs; |
|
155 |
|
156 /** |
|
157 * The bitmap. |
|
158 * Owned until decoding is complete, then ownersip is transferred to header control. |
|
159 */ |
|
160 CFbsBitmap* iBitmap; // owned until completion |
|
161 |
|
162 /** |
|
163 * Owns : Copy of the bitmap data stream |
|
164 */ |
|
165 HBufC8* iBitmapData; |
|
166 |
|
167 /** |
|
168 * Owns : Copy of mimeType |
|
169 */ |
|
170 HBufC8* iMimeType; |
|
171 |
|
172 // next operation to perform |
|
173 TSWDEOperationId iNextOperationId; |
|
174 }; |
|
175 |
|
176 #endif /*CSERVICEWIDGETIMAGEDECODER_H*/ |