1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "MemSpyViewMainMenu.h" |
|
19 |
|
20 // Engine includes |
|
21 #include <memspy/engine/memspyengine.h> |
|
22 #include <memspy/engine/memspyengineobjectprocess.h> |
|
23 #include <memspy/engine/memspyengineobjectthread.h> |
|
24 #include <memspy/engine/memspyengineobjectcontainer.h> |
|
25 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h> |
|
26 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h> |
|
27 #include <memspy/engine/memspyenginehelperprocess.h> |
|
28 |
|
29 // User includes |
|
30 #include "MemSpyContainerObserver.h" |
|
31 #include "MemSpyViewProcesses.h" |
|
32 #include "MemSpyViewRAMInfo.h" |
|
33 #include "MemSpyViewROMInfo.h" |
|
34 #include "MemSpyViewServerList.h" |
|
35 #include "MemSpyViewOpenFiles.h" |
|
36 #include "MemSpyViewFBServBitmaps.h" |
|
37 #include "MemSpyViewSystemConfig.h" |
|
38 #include "MemSpyViewCodeSegList.h" |
|
39 #include "MemSpyViewChunkList.h" |
|
40 #include "MemSpyViewKernel.h" |
|
41 #include "MemSpyViewHeapTracking.h" |
|
42 #include "MemSpyViewDriveInfo.h" |
|
43 #include "MemSpyViewECom.h" |
|
44 #include "MemSpyViewMemoryTrackingAutoStartConfig.h" |
|
45 #include "MemSpyViewWindowGroups.h" |
|
46 |
|
47 // System includes |
|
48 #include <aknnotewrappers.h> |
|
49 |
|
50 |
|
51 CMemSpyViewMainMenu::CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) |
|
52 : CMemSpyViewBase( aEngine, aObserver ) |
|
53 { |
|
54 } |
|
55 |
|
56 |
|
57 void CMemSpyViewMainMenu::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
|
58 { |
|
59 _LIT( KTitle, "MemSpy" ); |
|
60 SetTitleL( KTitle ); |
|
61 // |
|
62 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
|
63 |
|
64 // Make sure the correct item is selected |
|
65 const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); |
|
66 const TInt index = IndexByViewType( viewType ); |
|
67 iListBox->SetCurrentItemIndex( index ); |
|
68 HandleListBoxItemSelectedL( index ); |
|
69 } |
|
70 |
|
71 |
|
72 void CMemSpyViewMainMenu::RefreshL() |
|
73 { |
|
74 SetListBoxModelL(); |
|
75 CMemSpyViewBase::RefreshL(); |
|
76 } |
|
77 |
|
78 |
|
79 TMemSpyViewType CMemSpyViewMainMenu::ViewType() const |
|
80 { |
|
81 return EMemSpyViewTypeMainMenu; |
|
82 } |
|
83 |
|
84 |
|
85 CMemSpyViewBase* CMemSpyViewMainMenu::PrepareChildViewL() |
|
86 { |
|
87 CMemSpyViewBase* child = NULL; |
|
88 const TInt index = iListBox->CurrentItemIndex(); |
|
89 |
|
90 #ifdef __WINS__ |
|
91 // threads & process view is not supported in the emulator environment |
|
92 if ( index == 0 ) |
|
93 { |
|
94 CAknInformationNote* note = new (ELeave) CAknInformationNote; |
|
95 note->ExecuteLD(_L("Not supported in the emulator, try Kernel -> Objects view")); |
|
96 return NULL; |
|
97 } |
|
98 #endif |
|
99 |
|
100 if ( index == 0 ) |
|
101 { |
|
102 child = new(ELeave) CMemSpyViewProcesses( iEngine, iObserver ); |
|
103 } |
|
104 else if ( index == 1 ) |
|
105 { |
|
106 child = new(ELeave) CMemSpyViewRAMInfo( iEngine, iObserver ); |
|
107 } |
|
108 else if ( index == 2 ) |
|
109 { |
|
110 child = new(ELeave) CMemSpyViewROMInfo( iEngine, iObserver ); |
|
111 } |
|
112 else if ( index == 3 ) |
|
113 { |
|
114 child = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver ); |
|
115 } |
|
116 else if ( index == 4 ) |
|
117 { |
|
118 child = new(ELeave) CMemSpyViewServerList( iEngine, iObserver ); |
|
119 } |
|
120 else if ( index == 5 ) |
|
121 { |
|
122 child = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver ); |
|
123 } |
|
124 else if ( index == 6 ) |
|
125 { |
|
126 child = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver ); |
|
127 } |
|
128 else if ( index == 7 ) |
|
129 { |
|
130 child = new(ELeave) CMemSpyViewOpenFiles( iEngine, iObserver ); |
|
131 } |
|
132 else if ( index == 8 ) |
|
133 { |
|
134 child = new(ELeave) CMemSpyViewSystemConfig( iEngine, iObserver ); |
|
135 } |
|
136 else if ( index == 9 ) |
|
137 { |
|
138 child = new(ELeave) CMemSpyViewKernel( iEngine, iObserver ); |
|
139 } |
|
140 else if ( index == 10 ) |
|
141 { |
|
142 child = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver ); |
|
143 } |
|
144 else if ( index == 11 ) |
|
145 { |
|
146 child = new(ELeave) CMemSpyViewMemoryTrackingAutoStartConfig( iEngine, iObserver ); |
|
147 } |
|
148 else if ( index == 12 ) |
|
149 { |
|
150 child = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver ); |
|
151 } |
|
152 else if ( index == 13 ) |
|
153 { |
|
154 child = new(ELeave) CMemSpyViewECom( iEngine, iObserver ); |
|
155 } |
|
156 else if ( index == 14 ) |
|
157 { |
|
158 child = new(ELeave) CMemSpyViewWindowGroups( iEngine, iObserver ); |
|
159 } |
|
160 CleanupStack::PushL( child ); |
|
161 child->ConstructL( Rect(), *Parent() ); |
|
162 CleanupStack::Pop( child ); |
|
163 return child; |
|
164 } |
|
165 |
|
166 |
|
167 void CMemSpyViewMainMenu::SetListBoxModelL() |
|
168 { |
|
169 CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); |
|
170 CleanupStack::PushL( model ); |
|
171 |
|
172 TBuf<KMaxFullName + 1> item; |
|
173 |
|
174 // 1st item = Processes |
|
175 _LIT(KItem1Format, "\tProcesses & Threads"); |
|
176 item.Format( KItem1Format ); |
|
177 model->AppendL( item ); |
|
178 |
|
179 // 2nd item = RAM info |
|
180 _LIT(KItem2Format, "\tRAM Info"); |
|
181 model->AppendL( KItem2Format ); |
|
182 |
|
183 // 3rd item = ROM info |
|
184 _LIT(KItem3Format, "\tROM Info"); |
|
185 model->AppendL( KItem3Format ); |
|
186 |
|
187 // 4th item = FBServ Bitmaps |
|
188 _LIT(KItem4Format, "\tFont & Bitmap\nServer"); |
|
189 model->AppendL( KItem4Format ); |
|
190 |
|
191 // 5th item = Servers |
|
192 _LIT(KItem5Format, "\tServers"); |
|
193 item.Format( KItem5Format); |
|
194 model->AppendL( item ); |
|
195 |
|
196 // 6th item = Chunks |
|
197 _LIT(KItem6Format, "\tChunks"); |
|
198 model->AppendL( KItem6Format ); |
|
199 |
|
200 // 7th item = Code Segments |
|
201 _LIT(KItem7Format, "\tCode Segments"); |
|
202 model->AppendL( KItem7Format ); |
|
203 |
|
204 // 8th item = Open Files |
|
205 _LIT(KItem8Format, "\tOpen Files"); |
|
206 model->AppendL( KItem8Format ); |
|
207 |
|
208 // 9th item = System Config |
|
209 _LIT(KItem9Format, "\tSystem\nConfiguration"); |
|
210 model->AppendL( KItem9Format ); |
|
211 |
|
212 // 10th item = Kernel |
|
213 _LIT(KItem10Format, "\tKernel"); |
|
214 model->AppendL( KItem10Format ); |
|
215 |
|
216 // 11th item = Heap Tracking |
|
217 _LIT(KItem11Format, "\tSystem-Wide Memory Tracking"); |
|
218 model->AppendL( KItem11Format ); |
|
219 |
|
220 // 12th item = Process-specific Tracking |
|
221 _LIT(KItem12Format, "\tProcess-Specific Memory Tracking"); |
|
222 model->AppendL( KItem12Format ); |
|
223 |
|
224 // 13th item = Drive Info |
|
225 _LIT(KItem13Format, "\tDrive Summary"); |
|
226 model->AppendL( KItem13Format ); |
|
227 |
|
228 // 14th item = ECOM |
|
229 _LIT(KItem14Format, "\tECom"); |
|
230 model->AppendL( KItem14Format ); |
|
231 |
|
232 // 15th item = Window Groups |
|
233 _LIT(KItem15Format, "\tWindow Groups"); |
|
234 model->AppendL( KItem15Format ); |
|
235 |
|
236 // Set up list box |
|
237 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
|
238 listbox->Model()->SetItemTextArray( model ); |
|
239 listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
240 CleanupStack::Pop( model ); |
|
241 } |
|
242 |
|
243 |
|
244 TInt CMemSpyViewMainMenu::IndexByViewType( TMemSpyViewType aType ) |
|
245 { |
|
246 TInt index = 0; |
|
247 // |
|
248 switch( aType ) |
|
249 { |
|
250 default: |
|
251 case EMemSpyViewTypeProcesses: |
|
252 index = 0; |
|
253 break; |
|
254 case EMemSpyViewTypeRAMInfo: |
|
255 index = 1; |
|
256 break; |
|
257 case EMemSpyViewTypeROMInfo: |
|
258 index = 2; |
|
259 break; |
|
260 case EMemSpyViewTypeFBServBitmaps: |
|
261 index = 3; |
|
262 break; |
|
263 case EMemSpyViewTypeServerList: |
|
264 index = 4; |
|
265 break; |
|
266 case EMemSpyViewTypeChunkList: |
|
267 index = 5; |
|
268 break; |
|
269 case EMemSpyViewTypeCodeSegmentList: |
|
270 index = 6; |
|
271 break; |
|
272 case EMemSpyViewTypeOpenFiles: |
|
273 index = 7; |
|
274 break; |
|
275 case EMemSpyViewTypeSystemConfig: |
|
276 index = 8; |
|
277 break; |
|
278 case EMemSpyViewTypeKernel: |
|
279 index = 9; |
|
280 break; |
|
281 case EMemSpyViewTypeHeapTracking: |
|
282 index = 10; |
|
283 break; |
|
284 case EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig: |
|
285 index = 11; |
|
286 break; |
|
287 case EMemSpyViewTypeDriveSummary: |
|
288 index = 12; |
|
289 break; |
|
290 case EMemSpyViewTypeECom: |
|
291 index = 13; |
|
292 break; |
|
293 case EMemSpyViewTypeWindowGroups: |
|
294 index = 14; |
|
295 break; |
|
296 } |
|
297 // |
|
298 return index; |
|
299 } |
|
300 |
|