|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __ResourceHandler_H |
|
17 #define __ResourceHandler_H |
|
18 |
|
19 |
|
20 #include "ResourceHandler.hrh" |
|
21 //for storing resource data |
|
22 #include "ResourceHandler_DataStructs.h" |
|
23 |
|
24 #include <apgwgnam.h> |
|
25 #include <apgtask.h> |
|
26 |
|
27 #include <coeccntx.h> |
|
28 |
|
29 #include <eikenv.h> |
|
30 #include <eikappui.h> |
|
31 #include <eikapp.h> |
|
32 #include <eikdoc.h> |
|
33 #include <techview/eikmenup.h> |
|
34 |
|
35 #include "ResourceHandler_Dialogs.h" // may not need for S60 |
|
36 |
|
37 #include <resourcehandler.rsg> |
|
38 #include <techview/eikchkbx.h> |
|
39 #include <techview/eikchlst.h> |
|
40 #include <techview/eiklbbut.h> |
|
41 |
|
42 #include <techview/eiklabel.h> |
|
43 #include <techview/eikcmbut.h> |
|
44 |
|
45 #ifdef UIQ |
|
46 #include <qiknumbereditor.h> |
|
47 #include <qikvertoptionbuttonlist.h> |
|
48 #endif |
|
49 |
|
50 |
|
51 #ifdef TV |
|
52 |
|
53 #include <techview/eikhopbt.h> |
|
54 // for CEikNumberEditor |
|
55 #include <techview/eikmfne.h> |
|
56 // for CEikButtonGroupContainer |
|
57 #include <techview/eikbtgpc.h> |
|
58 // for CEikNumberEditor |
|
59 #include <techview/eikmfne.h> |
|
60 #endif |
|
61 |
|
62 #include <techview/eikclb.h> //for column list box |
|
63 #include <techview/eikclbd.h> // for CColumnListBoxData in TV/UIQ |
|
64 |
|
65 #include <resourcehandler.rsg> |
|
66 // for CEikButtonGroupContainer |
|
67 #include <techview/eikbtgpc.h> |
|
68 |
|
69 #include <techview/eikon.hrh> |
|
70 |
|
71 #include <e32base.h> |
|
72 #include <e32cons.h> |
|
73 #include <e32hal.h> |
|
74 #include <hal.h> |
|
75 #include <txtfmlyr.h> |
|
76 #include <txtrich.h> |
|
77 #include <miutset.h> |
|
78 #include <mtmuids.h> |
|
79 #include <msvreg.h> |
|
80 #include <msvuids.h> |
|
81 #include <techview/eikedwin.h> |
|
82 #include <smut.h> |
|
83 #include <f32file.h> |
|
84 #include <f32dbg.h> |
|
85 |
|
86 |
|
87 // copy from k32std.h |
|
88 #define KHARDWARE 0x00000001 |
|
89 #define KBOOT 0x00000002 |
|
90 #define KSERVER 0x00000004 |
|
91 #define KMMU 0x00000008 |
|
92 #define KSEMAPHORE 0x00000010 |
|
93 #define KSCHED 0x00000020 |
|
94 #define KPROC 0x00000040 |
|
95 #define KEXEC 0x00000080 |
|
96 #define KEXECFAST 0x00000100 |
|
97 #define KTHREAD 0x00000200 |
|
98 #define KDLL 0x00000400 |
|
99 #define KLOGON 0x00000800 |
|
100 #define KPBUS1 0x00001000 |
|
101 #define KPBUS2 0x00002000 |
|
102 #define KPBUSDRV 0x00004000 |
|
103 #define KPOWER 0x00008000 |
|
104 #define KTIMING 0x00010000 |
|
105 #define KEVENT 0x00020000 |
|
106 #define KMEMTRACE 0x00080000 |
|
107 #define KIPC 0x00100000 |
|
108 #define KDEBUGGER 0x00200000 |
|
109 #define KVIDEO 0x00800000 |
|
110 #define KUSB 0x01000000 |
|
111 #define KPANIC 0x80000000 |
|
112 |
|
113 _LIT(KFormatDec, "%d"); |
|
114 _LIT(KFormatDec64, "%ld"); |
|
115 _LIT(KFormatUDec,"%u"); |
|
116 _LIT(KFormatHex, "%x"); |
|
117 _LIT(KAsterisk, "*"); |
|
118 _LIT(KFillName, "ResMan"); |
|
119 |
|
120 enum TMemorySizes |
|
121 { |
|
122 K4k = 0x00001000, // 4,096 |
|
123 K8k = 0x00002000, // 8,192 |
|
124 K16k = 0x00004000, // 16,384 |
|
125 K32k = 0x00008000, |
|
126 K64k = 0x00010000, // 65,536 |
|
127 K128k = 0x00020000, |
|
128 K256k = 0x00040000, // 262,144 |
|
129 K512k = 0x00080000, |
|
130 K1M = 0x00100000, |
|
131 K2M = 0x00200000, |
|
132 K4M = 0x00400000, |
|
133 K8M = 0x00800000, //8,388,608 |
|
134 K16M = 0x01000000 |
|
135 }; |
|
136 |
|
137 enum TObjectsViewed |
|
138 { |
|
139 EObjectNone, |
|
140 EObjectProcess, |
|
141 EObjectThread, |
|
142 EObjectChunk, |
|
143 EObjectLibrary, |
|
144 EObjectServer, |
|
145 EObjectSemaphore, |
|
146 EObjectMutex, |
|
147 EObjectLogicalDevice, |
|
148 EObjectPhysicalDevice, |
|
149 EObjectLogicalChannel, |
|
150 EObjectWindow, |
|
151 EObjectDrive, |
|
152 EObjectHal |
|
153 }; |
|
154 |
|
155 // Forward declarations |
|
156 |
|
157 class CResourceAppUi; |
|
158 class CResourceAppView; |
|
159 class CResourceListView; |
|
160 class CResourceView; |
|
161 |
|
162 // |
|
163 // |
|
164 // CResourceApplication |
|
165 // |
|
166 // |
|
167 |
|
168 class CResourceApplication : public CXKNAPPLICATION |
|
169 { |
|
170 private: |
|
171 // Inherited from class CApaApplication |
|
172 CApaDocument* CreateDocumentL(); |
|
173 TUid AppDllUid() const; |
|
174 }; |
|
175 // |
|
176 // |
|
177 // CResourceDocument |
|
178 // |
|
179 // |
|
180 class CResourceDocument : public CXKNDOCUMENT |
|
181 { |
|
182 public: |
|
183 static CResourceDocument* NewL(CEikApplication& aApp); |
|
184 CResourceDocument(CEikApplication& aApp); |
|
185 void ConstructL(); |
|
186 private: |
|
187 // Inherited from CXKNDOCUMENT |
|
188 CEikAppUi* CreateAppUiL(); |
|
189 }; |
|
190 // |
|
191 // |
|
192 // CResourceAppUi |
|
193 // |
|
194 // |
|
195 class CResourceAppUi : public CXKNAPPUI |
|
196 { |
|
197 public: |
|
198 void ConstructL(); |
|
199 ~CResourceAppUi(); |
|
200 |
|
201 private: |
|
202 // Inherited from class CXKNAPPUI |
|
203 void HandleCommandL(TInt aCommand); |
|
204 |
|
205 private: |
|
206 CResourceView* iListBoxView; |
|
207 void SetProcess(void); |
|
208 void SetThread(void); |
|
209 void SetDebug(void); |
|
210 void SetRam(void); |
|
211 void SetDrive(void); |
|
212 |
|
213 void AppendDesc(TDes& root, TDes& add); |
|
214 |
|
215 }; |
|
216 |
|
217 // |
|
218 // |
|
219 // CResourceDetails - stores resource names and details. |
|
220 // Used for resources for which not just the name but additional |
|
221 // details are displayed. |
|
222 // |
|
223 // |
|
224 class TResourceDetails |
|
225 { |
|
226 protected: |
|
227 TProcessData iProcessData; |
|
228 TThreadData iThreadData; |
|
229 TChunkData iChunkData; |
|
230 TSemaphoreData iSemaphoreData; |
|
231 TMutexData iMutexData; |
|
232 TDriveData iDriveData; |
|
233 THalData iHalData; |
|
234 TListData iListData; |
|
235 void GetProcessData(TDesC& aProcessName); |
|
236 void GetThreadData(TDesC& aThreadName); |
|
237 void GetChunkData(TFindChunk findHb, TDesC& aChunkName); |
|
238 void GetSemaphoreData(TFindSemaphore& findHb, TDesC& aSemaphoreName); |
|
239 void GetMutexData(TFindMutex& findHb, TDesC& aMutexName); |
|
240 void GetDriveData(TInt aValidDriveNum, TDriveUnit aDriveUnit, TVolumeInfo aVolumeInfo); |
|
241 void GetHalData(TInt aEntryNum, HAL::SEntry*); |
|
242 private: |
|
243 void AppendDotsToResourceName(TFullName& aResourceName); |
|
244 |
|
245 }; |
|
246 // |
|
247 // |
|
248 // CResourceList |
|
249 // |
|
250 // |
|
251 class CResourceList: public CCoeControl, public MCoeControlObserver, public TResourceDetails |
|
252 { |
|
253 public: |
|
254 void ConstructL(TInt aTablePosition); |
|
255 ~CResourceList(); |
|
256 protected: |
|
257 void UpdateResourceCount(TUint aNumberOfResource) {iResourceCount = aNumberOfResource;} |
|
258 void UpdateListData(); |
|
259 |
|
260 CCoeControl* GetListBox() const; |
|
261 |
|
262 private: |
|
263 void SetUpProcessTable(); |
|
264 void SetUpThreadTable(); |
|
265 void SetUpChunkTable(); |
|
266 void SetUpSemaphoreTable(); |
|
267 void SetUpMutexTable(); |
|
268 void SetUpDriveTable(); |
|
269 void SetUpHalTable(); |
|
270 void SetUpList(); //uses single column tables |
|
271 |
|
272 void GetResourceList(); |
|
273 void AddRow(const TProcessData& aProcessData); |
|
274 void AddRow(const TThreadData& aThreadData); |
|
275 void AddRow(const TChunkData& aChunkData); |
|
276 void AddRow(const TSemaphoreData& aSemaphoreData); |
|
277 void AddRow(const TMutexData& aMutexData); |
|
278 void AddRow(const TDriveData& aDriveData); |
|
279 void AddRow(const THalData& aHalData); |
|
280 void AddRow(const TListData& aListData); |
|
281 |
|
282 void GetThreadList(void); |
|
283 void GetProcessList(void); |
|
284 void GetChunkList(void); |
|
285 void GetLibraryList(void); |
|
286 void GetServerList(void); |
|
287 void GetSemaphoreList(void); |
|
288 void GetMutexList(void); |
|
289 void GetLogicalDeviceList(void); |
|
290 void GetPhysicalDeviceList(void); |
|
291 void GetLogicalChannelList(void); |
|
292 void GetWindowList(void); |
|
293 void GetDriveList(void); |
|
294 void GetHalList(void); |
|
295 |
|
296 void EmptyList(); |
|
297 |
|
298 CEikColumnListBox* iListBox; |
|
299 CTextListBoxModel* iModel; |
|
300 MDesCArray* iTextArray; |
|
301 CDesCArray* iListBoxItems; |
|
302 CColumnListBoxData* iListBoxData; |
|
303 protected: |
|
304 TInt iBorder; |
|
305 TUint iResourceCount; // Count of number of items in table |
|
306 TObjectsViewed iObjectsViewed; // What view is showing |
|
307 |
|
308 }; |
|
309 |
|
310 // |
|
311 // |
|
312 // CResourceView |
|
313 // |
|
314 // |
|
315 class CResourceView : public CResourceList |
|
316 { |
|
317 public: |
|
318 static CResourceView* NewL(const TRect& aRect, CResourceAppUi* aAppUi); |
|
319 |
|
320 ~CResourceView(); |
|
321 |
|
322 void SetCurrentObjects(TObjectsViewed aViewed) |
|
323 {iObjectsViewed = aViewed;}; |
|
324 |
|
325 void UpdateView(); |
|
326 |
|
327 private: |
|
328 // Private constructor to force NewL |
|
329 CResourceView(); |
|
330 void ConstructL(const TRect& aRect, CResourceAppUi* aAppUi); |
|
331 void InvalidateView(void) const; |
|
332 void UpdateTitle(void); |
|
333 protected: |
|
334 |
|
335 // Inherited from CCoeControl |
|
336 virtual TInt CountComponentControls() const; |
|
337 virtual CCoeControl* ComponentControl(TInt aIndex) const; |
|
338 virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); |
|
339 |
|
340 private: |
|
341 |
|
342 // Inherited from CCoeControl |
|
343 void Draw(const TRect& /*aRect*/) const; |
|
344 |
|
345 private: |
|
346 |
|
347 CResourceAppUi* iAppUi; |
|
348 |
|
349 // State Data |
|
350 TBuf<27> iTitle; // Title above table |
|
351 // Controls |
|
352 CEikCommandButton* iCommandButton; |
|
353 }; |
|
354 |
|
355 #endif |
|
356 |