36 #include "MemSpyViewProcesses.h" |
36 #include "MemSpyViewProcesses.h" |
37 #include "MemSpyViewThreadInfoItemList.h" |
37 #include "MemSpyViewThreadInfoItemList.h" |
38 |
38 |
39 |
39 |
40 |
40 |
41 /* |
41 CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId ) |
42 CMemSpyViewThreads::CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ) |
42 : CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId ), iCurrentThreadId( aThreadId ) |
43 : CMemSpyViewBase( aEngine, aObserver ), iParentProcess( aProcess ) |
|
44 { |
|
45 iParentProcess.Open(); |
|
46 } |
|
47 */ |
|
48 CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId ) |
|
49 : CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId ) |
|
50 { |
43 { |
51 } |
44 } |
52 |
45 |
53 |
46 |
54 CMemSpyViewThreads::~CMemSpyViewThreads() |
47 CMemSpyViewThreads::~CMemSpyViewThreads() |
56 } |
49 } |
57 |
50 |
58 |
51 |
59 void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
52 void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) |
60 { |
53 { |
|
54 iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); |
|
55 |
61 _LIT( KTitle, "Threads" ); |
56 _LIT( KTitle, "Threads" ); |
62 SetTitleL( KTitle ); |
57 SetTitleL( KTitle ); |
63 // |
58 // |
64 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
59 CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); |
65 // |
60 // |
66 if ( aSelectionRune ) |
61 if( iCurrentThreadId > 0 ) |
67 { |
62 { |
68 iListBox->SetCurrentItemIndex( 0 ); //for now |
63 for( TInt i = 0; i < iThreads.Count() ; i++ ) |
|
64 { |
|
65 if( iThreads[i]->Id() == iCurrentThreadId ) |
|
66 { |
|
67 const TInt index = i; |
|
68 if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) |
|
69 { |
|
70 iListBox->SetCurrentItemIndex( index ); |
|
71 HandleListBoxItemSelectedL( index ); |
|
72 } |
|
73 } |
|
74 } |
|
75 } |
|
76 else if( iThreads.Count() > 0 ) |
|
77 { |
|
78 iListBox->SetCurrentItemIndex( 0 ); |
69 HandleListBoxItemSelectedL( 0 ); |
79 HandleListBoxItemSelectedL( 0 ); |
70 /* TODO: |
80 } |
71 CMemSpyThread* selectedItem = reinterpret_cast< CMemSpyThread* >( aSelectionRune ); |
|
72 const TInt index = iParentProcess.ThreadIndexById( selectedItem->Id() ); |
|
73 if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) |
|
74 { |
|
75 iListBox->SetCurrentItemIndex( index ); |
|
76 HandleListBoxItemSelectedL( index ); |
|
77 } |
|
78 */ |
|
79 } |
|
80 //else if ( iParentProcess.Count() > 0 ) |
|
81 // { |
|
82 iListBox->SetCurrentItemIndex( 0 ); |
|
83 HandleListBoxItemSelectedL( 0 ); |
|
84 // } |
|
85 } |
81 } |
86 |
82 |
87 |
83 |
88 TProcessId CMemSpyViewThreads::Process() const |
84 TProcessId CMemSpyViewThreads::Process() const |
89 { |
85 { |
120 return parent; |
116 return parent; |
121 } |
117 } |
122 |
118 |
123 |
119 |
124 CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL() |
120 CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL() |
125 { |
121 { |
126 /* |
122 CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iCurrentThreadId ); |
127 CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, *iCurrentThread ); |
|
128 CleanupStack::PushL( child ); |
123 CleanupStack::PushL( child ); |
129 child->ConstructL( Rect(), *Parent() ); |
124 child->ConstructL( Rect(), *Parent(), EMemSpyThreadInfoItemTypeFirst ); |
130 CleanupStack::Pop( child ); |
125 CleanupStack::Pop( child ); |
131 return child; |
126 return child; |
132 */ |
|
133 } |
127 } |
134 |
128 |
135 |
129 |
136 void CMemSpyViewThreads::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
130 void CMemSpyViewThreads::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
137 { |
131 { |
331 } |
325 } |
332 |
326 |
333 |
327 |
334 void CMemSpyViewThreads::OnCmdInfoHandlesL() |
328 void CMemSpyViewThreads::OnCmdInfoHandlesL() |
335 { |
329 { |
336 /* |
330 iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId ); |
337 CMemSpyThread& thread = CurrentThread(); |
|
338 thread.InfoContainerForceSyncronousConstructionL().PrintL(); |
|
339 */ |
|
340 } |
331 } |
341 |
332 |
342 |
333 |
343 void CMemSpyViewThreads::SetListBoxModelL() |
334 void CMemSpyViewThreads::SetListBoxModelL() |
344 { |
335 { |
345 iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); |
336 //iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); |
346 |
337 |
347 iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items |
338 iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items |
348 |
339 |
349 _LIT( KTab, "\t" ); |
340 _LIT( KTab, "\t" ); |
350 |
341 |
359 iModel->AppendL( tempNamePtr ); |
350 iModel->AppendL( tempNamePtr ); |
360 |
351 |
361 CleanupStack::PopAndDestroy( tempName ); |
352 CleanupStack::PopAndDestroy( tempName ); |
362 } |
353 } |
363 |
354 |
364 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
355 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
365 //listbox->Model()->SetItemTextArray( &iParentProcess ); |
|
366 listbox->Model()->SetItemTextArray( iModel ); |
356 listbox->Model()->SetItemTextArray( iModel ); |
367 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
357 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
368 } |
358 } |
369 |
359 |
370 |
360 |