|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
6 ** |
|
7 ** This file is part of the HbCore module of the UI Extensions for Mobile. |
|
8 ** |
|
9 ** GNU Lesser General Public License Usage |
|
10 ** This file may be used under the terms of the GNU Lesser General Public |
|
11 ** License version 2.1 as published by the Free Software Foundation and |
|
12 ** appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
13 ** Please review the following information to ensure the GNU Lesser General |
|
14 ** Public License version 2.1 requirements will be met: |
|
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
16 ** |
|
17 ** In addition, as a special exception, Nokia gives you certain additional |
|
18 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
20 ** |
|
21 ** If you have questions regarding the use of this file, please contact |
|
22 ** Nokia at developer.feedback@nokia.com. |
|
23 ** |
|
24 ****************************************************************************/ |
|
25 |
|
26 #ifndef HBTHEMECOMMON_P_H |
|
27 #define HBTHEMECOMMON_P_H |
|
28 |
|
29 #include <QImage> |
|
30 #include <QSize> |
|
31 #include <QMap> |
|
32 #include <QStringList> |
|
33 #include <QColor> |
|
34 #include <hbstring_p.h> |
|
35 #include <hbvector_p.h> |
|
36 #ifdef HB_SGIMAGE_ICON |
|
37 #include <sgresource/sgimage.h> |
|
38 #endif |
|
39 |
|
40 #define THEME_SERVER_NAME "hbthemeserver" |
|
41 #define HB_THEME_SHARED_PIXMAP_CHUNK "themeserver_chunk" |
|
42 #define ORGANIZATION "Nokia" |
|
43 #define THEME_COMPONENT "ThemeFramework" |
|
44 |
|
45 // To enable/disable debug messages for theme server functionality |
|
46 // this is master trace switch that enables all theme server related traces |
|
47 #undef THEME_SERVER_TRACES |
|
48 |
|
49 // To enable/disable debug messages for theme index functionality |
|
50 #undef THEME_INDEX_TRACES |
|
51 |
|
52 // To enable memory report creation (memory usage, fragmentation etc.) |
|
53 #undef HB_THEME_SERVER_MEMORY_REPORT |
|
54 // If master trace macro is defined, define also other theme traces |
|
55 #ifdef THEME_SERVER_TRACES |
|
56 #define THEME_INDEX_TRACES |
|
57 #endif |
|
58 |
|
59 |
|
60 // To enable fute testing for cache |
|
61 //#define HB_ICON_CACHE_DEBUG |
|
62 |
|
63 const unsigned int INITIALIZED_CHUNK_IDENTIFIER = 0x54535256; //'TSRV' |
|
64 struct HbSharedChunkHeader |
|
65 { |
|
66 unsigned int identifier; |
|
67 unsigned int mainAllocatorOffset; |
|
68 unsigned int subAllocatorOffset; |
|
69 }; |
|
70 |
|
71 enum LayerPriority { |
|
72 Priority_Core, |
|
73 Priority_Theme, |
|
74 Priority_AppTheme, |
|
75 Priority_Application, |
|
76 Priority_Operator |
|
77 }; |
|
78 |
|
79 // Assuming there is only one folder for single layer to keep it simple. |
|
80 // for icon resources there may be multiple folders but for there is other |
|
81 // approach being used for icons. Approaches need to be merged while refactoring |
|
82 // complete lookup |
|
83 typedef QMap<LayerPriority, QString> HbLayerFolderMap; |
|
84 struct HbMultiPartSizeData |
|
85 { |
|
86 // Indexing order is: |
|
87 |
|
88 // 'NinePieces' -> tl, t, tr, l, c, r, bl, b, br |
|
89 // 'ThreePiecesHorizontal' -> l, c, r |
|
90 // 'ThreePiecesVertical' -> t, c, b |
|
91 QString multiPartIconId; |
|
92 QRect sources[9]; // rects used from the rasterized frame part pixmaps |
|
93 QRect targets[9]; // frame part target rects inside the bounding rectangle of the frame |
|
94 QSize pixmapSizes[9]; // frame part pixmaps are rasterized to these sizes |
|
95 }; |
|
96 |
|
97 |
|
98 struct HbMultiIconParams |
|
99 { |
|
100 QString multiPartIconId; |
|
101 QStringList multiPartIconList; |
|
102 HbMultiPartSizeData multiPartIconData; |
|
103 QSizeF size; |
|
104 int aspectRatioMode; |
|
105 int mode; |
|
106 int options; |
|
107 bool mirrored; |
|
108 QColor color; |
|
109 int rgba; |
|
110 bool colorflag; |
|
111 }; |
|
112 |
|
113 |
|
114 enum HbIconFormatType { |
|
115 INVALID_FORMAT = -1, |
|
116 NVG, |
|
117 PIC, |
|
118 SVG, |
|
119 SGIMAGE, |
|
120 BLOB, |
|
121 OTHER_SUPPORTED_FORMATS |
|
122 }; |
|
123 |
|
124 struct HbSharedPixmapInfo |
|
125 { |
|
126 int offset; |
|
127 int width; |
|
128 int height; |
|
129 int defaultWidth; |
|
130 int defaultHeight; |
|
131 QImage::Format format; |
|
132 }; |
|
133 |
|
134 struct HbSharedNVGInfo |
|
135 { |
|
136 int offset; |
|
137 int dataSize; |
|
138 int width; |
|
139 int height; |
|
140 int defaultWidth; |
|
141 int defaultHeight; |
|
142 |
|
143 }; |
|
144 |
|
145 struct HbSharedPICInfo |
|
146 { |
|
147 int offset; |
|
148 int dataSize; |
|
149 int width; |
|
150 int height; |
|
151 int defaultWidth; |
|
152 int defaultHeight; |
|
153 }; |
|
154 |
|
155 struct HbSharedSgimageInfo |
|
156 { |
|
157 unsigned long long id; |
|
158 int width; |
|
159 int height; |
|
160 int defaultWidth; |
|
161 int defaultHeight; |
|
162 }; |
|
163 |
|
164 struct HbSharedBLOBInfo |
|
165 { |
|
166 int offset; |
|
167 int dataSize; |
|
168 }; |
|
169 |
|
170 struct HbSharedIconInfo |
|
171 { |
|
172 HbIconFormatType type; |
|
173 |
|
174 union |
|
175 { |
|
176 HbSharedPixmapInfo pixmapData; |
|
177 HbSharedNVGInfo nvgData; |
|
178 HbSharedPICInfo picData; |
|
179 HbSharedSgimageInfo sgImageData; |
|
180 HbSharedBLOBInfo blobData; |
|
181 }; |
|
182 |
|
183 HbSharedIconInfo():type(INVALID_FORMAT){} |
|
184 |
|
185 }; |
|
186 |
|
187 struct HbSharedIconInfoList |
|
188 { |
|
189 HbSharedIconInfo icon[9]; |
|
190 }; |
|
191 |
|
192 struct HbSharedStyleSheetInfo |
|
193 { |
|
194 int offset; |
|
195 int refCount; |
|
196 HbSharedStyleSheetInfo(): |
|
197 offset(-1), |
|
198 refCount(0) |
|
199 {} |
|
200 }; |
|
201 |
|
202 struct HbSharedEffectInfo |
|
203 { |
|
204 int offset; |
|
205 HbSharedEffectInfo(): offset(-1){} |
|
206 }; |
|
207 |
|
208 struct HbSharedWMLInfo |
|
209 { |
|
210 int offset; |
|
211 HbSharedWMLInfo() : offset(-1) {} |
|
212 }; |
|
213 |
|
214 struct HbDeviceProfileInfo |
|
215 { |
|
216 int offset; |
|
217 HbDeviceProfileInfo() : offset(-1) {} |
|
218 }; |
|
219 struct HbSecondaryCacheInfo |
|
220 { |
|
221 int offset; |
|
222 HbSecondaryCacheInfo() : offset(-1) {} |
|
223 }; |
|
224 |
|
225 struct HbSharedCacheItem { |
|
226 HbString key; |
|
227 int offset; |
|
228 HbSharedCacheItem():key(HbMemoryManager::SharedMemory),offset(-1) |
|
229 { |
|
230 } |
|
231 HbSharedCacheItem(const QString &cacheKey, |
|
232 int cacheOffset):key(cacheKey,HbMemoryManager::SharedMemory), |
|
233 offset(cacheOffset) |
|
234 { |
|
235 } |
|
236 }; |
|
237 |
|
238 // Currently HbVector is used. This one should be replaced with the Map/Hash |
|
239 // data structure. |
|
240 typedef HbVector<HbSharedCacheItem> HbSharedCache; |
|
241 |
|
242 // Function codes (opcodes) used in message passing between client and server |
|
243 enum HbThemeServerRequest |
|
244 { |
|
245 EIconLookup = 1, |
|
246 EIconDefaultSize, |
|
247 EStyleSheetLookup, |
|
248 EThemeSelection, |
|
249 EMultiPieceIcon, |
|
250 EMultiIcon, |
|
251 EWidgetMLLookup, |
|
252 EDeviceProfileOffset, |
|
253 ESecondaryCacheOffset, |
|
254 #ifdef HB_ICON_CACHE_DEBUG |
|
255 EIconCleanUp, |
|
256 ECacheIconCount, |
|
257 ERasterMemLimit, |
|
258 EVectorMemLimit, |
|
259 EFreeRasterMem, |
|
260 EFreeVectorMem, |
|
261 ELastAddedItemMem, |
|
262 ELastAddedItemRefCount, |
|
263 ELastRemovedItemMem, |
|
264 ELastRemovedItemRefCount, |
|
265 EEnableCache, |
|
266 ECacheHit, |
|
267 ECacheMiss, |
|
268 ECleanRasterLRUList, |
|
269 ECleanVectorLRUList, |
|
270 EServerHeap, |
|
271 EGpuLruCount, |
|
272 ECpuLruCount, |
|
273 EServerStat, |
|
274 EServerHeapMarkStart, |
|
275 EServerHeapMarkEnd, |
|
276 EServerAllocFail, |
|
277 EServerAllocReset, |
|
278 EFreeGPUMem, |
|
279 ETotalGPUMem, |
|
280 EGPULRUSize, |
|
281 ERefCount, |
|
282 #endif |
|
283 EThemeContentUpdate, |
|
284 EEffectLookupFilePath, |
|
285 EEffectAdd, |
|
286 EUnloadIcon, |
|
287 EUnloadMultiIcon, |
|
288 EMemoryGood, |
|
289 EFreeRam, |
|
290 EThemeServerStop, |
|
291 EThemeIndex |
|
292 #ifdef HB_THEME_SERVER_MEMORY_REPORT |
|
293 ,ECreateMemoryReport |
|
294 #endif |
|
295 }; |
|
296 |
|
297 #endif /* HBTHEMECOMMON_P_H */ |