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