35 |
35 |
36 // User includes |
36 // User includes |
37 #include "MemSpyViewThreads.h" |
37 #include "MemSpyViewThreads.h" |
38 #include "MemSpyViewMainMenu.h" |
38 #include "MemSpyViewMainMenu.h" |
39 #include "MemSpyContainerObserver.h" |
39 #include "MemSpyContainerObserver.h" |
|
40 #include "MemSpyUiUtils.h" |
40 |
41 |
41 // Constants |
42 // Constants |
42 const TInt KMemSpyMaxSearchTextLength = 30; |
43 const TInt KMemSpyMaxSearchTextLength = 30; |
43 const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4; |
44 const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4; |
44 |
45 |
45 |
46 |
46 /* |
|
47 CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) |
|
48 : CMemSpyViewBase( aEngine, aObserver ) |
|
49 { |
|
50 } |
|
51 |
|
52 |
|
53 CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ) |
|
54 : CMemSpyViewBase( aEngine, aObserver ), iCurrentProcess( &aProcess ) |
|
55 { |
|
56 iCurrentProcess->Open(); |
|
57 } |
|
58 */ |
|
59 |
|
60 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) |
47 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) |
61 : CMemSpyViewBase( aSession, aObserver ) |
48 : CMemSpyViewBase( aSession, aObserver ) |
62 { |
49 { |
63 } |
50 } |
64 |
|
65 /* |
|
66 CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ) |
|
67 : CMemSpyViewBase( aEngine, aObserver ), iCurrentProcess( &aProcess ) |
|
68 { |
|
69 iCurrentProcess->Open(); |
|
70 } |
|
71 */ |
|
72 |
51 |
73 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId ) |
52 CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId ) |
74 : CMemSpyViewBase( aEngine, aObserver ), iCurrentProcessId( aId ) |
53 : CMemSpyViewBase( aEngine, aObserver ), iCurrentProcessId( aId ) |
75 { |
54 { |
76 } |
55 } |
95 CMemSpyViewBase::ConstructL( aRect, aContainer ); |
74 CMemSpyViewBase::ConstructL( aRect, aContainer ); |
96 // |
75 // |
97 iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards ); |
76 iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards ); |
98 // |
77 // |
99 iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength ); |
78 iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength ); |
|
79 |
100 iSearchField->SetObserver( this ); |
80 iSearchField->SetObserver( this ); |
101 iSearchField->SetFocus( ETrue ); |
81 iSearchField->SetFocus( ETrue ); |
102 iSearchField->SetComponentsToInheritVisibility( ETrue ); |
82 iSearchField->SetComponentsToInheritVisibility( ETrue ); |
103 // |
83 // |
104 if ( aSelectionRune ) |
84 if ( iCurrentProcessId > 0 ) |
105 { |
85 { |
106 TInt index = 0; |
86 TInt index = 0; |
107 TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune ); |
87 // TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune ); |
108 for( TInt i=0; i<iProcesses.Count();i++) |
88 for( TInt i=0; i<iProcesses.Count();i++) |
109 { |
89 { |
110 if( iProcesses[i]->Id() == selectedItem ) |
90 if( iProcesses[i]->Id() == iCurrentProcessId ) |
111 { |
91 { |
112 index = i; |
92 index = i; |
113 } |
93 } |
114 } |
94 } |
115 |
95 |
117 { |
97 { |
118 iListBox->SetCurrentItemIndex( index ); |
98 iListBox->SetCurrentItemIndex( index ); |
119 HandleListBoxItemSelectedL( index ); |
99 HandleListBoxItemSelectedL( index ); |
120 } |
100 } |
121 } |
101 } |
122 else if ( iProcesses.Count() > 0 ) //TODO: to solve item selection when come back from previous view |
102 else if ( iProcesses.Count() > 0 ) |
123 { |
103 { |
124 iListBox->SetCurrentItemIndex( 0 ); |
104 iListBox->SetCurrentItemIndex( 0 ); |
125 HandleListBoxItemSelectedL( 0 ); |
105 HandleListBoxItemSelectedL( 0 ); |
126 } |
106 } |
127 // |
107 // |
162 } |
142 } |
163 |
143 |
164 |
144 |
165 CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL() |
145 CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL() |
166 { |
146 { |
167 CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id() ); |
147 CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id(), 0 ); |
168 CleanupStack::PushL( child ); |
148 CleanupStack::PushL( child ); |
169 child->ConstructL( Rect(), *Parent() ); |
149 child->ConstructL( Rect(), *Parent() ); |
170 CleanupStack::Pop( child ); |
150 CleanupStack::Pop( child ); |
171 return child; |
151 return child; |
172 |
152 |
377 |
357 |
378 iMemSpySession.GetProcessesL(iProcesses); // get processes array; |
358 iMemSpySession.GetProcessesL(iProcesses); // get processes array; |
379 iModel = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 1); //array for formated items |
359 iModel = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 1); //array for formated items |
380 |
360 |
381 _LIT( KTab, "\t" ); |
361 _LIT( KTab, "\t" ); |
382 //iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting |
362 iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting |
383 |
363 |
384 |
364 /* |
385 for( TInt i=0; i < iProcesses.Count(); i++ ) |
365 for( TInt i=0; i < iProcesses.Count(); i++ ) |
386 { |
366 { |
387 HBufC* tempName = HBufC::NewL( iProcesses[i]->Name().Length() + 16 ); |
367 HBufC* tempName = HBufC::NewL( iProcesses[i]->Name().Length() + 16 ); |
388 CleanupStack::PushL( tempName ); |
368 CleanupStack::PushL( tempName ); |
389 TPtr tempNamePtr( tempName->Des() ); |
369 TPtr tempNamePtr( tempName->Des() ); |
391 tempNamePtr.Append( iProcesses[i]->Name() ); |
371 tempNamePtr.Append( iProcesses[i]->Name() ); |
392 iModel->AppendL( tempNamePtr ); |
372 iModel->AppendL( tempNamePtr ); |
393 |
373 |
394 CleanupStack::PopAndDestroy( tempName ); |
374 CleanupStack::PopAndDestroy( tempName ); |
395 } |
375 } |
396 |
376 */ |
397 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
377 CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); |
398 //listbox->Model()->SetItemTextArray( &iEngine.Container() ); |
378 //listbox->Model()->SetItemTextArray( &iEngine.Container() ); |
399 listbox->Model()->SetItemTextArray( iModel ); |
379 listbox->Model()->SetItemTextArray( iModel ); |
400 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
380 listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
401 } |
381 } |
576 */ |
556 */ |
577 } |
557 } |
578 |
558 |
579 //Model formating methods |
559 //Model formating methods |
580 //TODO: to be debbuged |
560 //TODO: to be debbuged |
581 /* |
561 |
582 CDesCArrayFlat* CMemSpyViewProcesses::FormatModel( RArray<CMemSpyApiProcess*> aProcesses ) |
562 CDesCArrayFlat* CMemSpyViewProcesses::FormatModel( RArray<CMemSpyApiProcess*> aProcesses ) |
583 { |
563 { |
584 model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items |
564 model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items |
585 _LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " ); |
565 _LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " ); |
586 |
566 |
590 CleanupStack::PushL( tempName ); |
570 CleanupStack::PushL( tempName ); |
591 TPtr tempNamePtr( tempName->Des() ); |
571 TPtr tempNamePtr( tempName->Des() ); |
592 tempNamePtr.Copy( aProcesses[i]->Name() ); |
572 tempNamePtr.Copy( aProcesses[i]->Name() ); |
593 |
573 |
594 TBuf<10> priority; |
574 TBuf<10> priority; |
595 AppendPriority( priority, aProcesses[i]->Priority() ); |
575 TProcessPriority tempPriority = aProcesses[i]->Priority(); |
|
576 MemSpyUiUtils::AppendPriority( priority, tempPriority ); |
596 |
577 |
597 // Convert the full name to the format we want in the UI |
578 // Convert the full name to the format we want in the UI |
598 TBuf<KMaxFullName + 60> name; |
579 TBuf<KMaxFullName + 60> name; |
599 TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there |
580 TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there |
600 |
581 TUint32 tempSID = aProcesses[i]->SID(); |
601 name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempNamePtr, aProcesses[i]->SID() ); |
582 name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempName, tempSID ); //tempNamePtr |
602 |
583 |
603 if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method |
584 if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method |
604 { |
585 { |
605 AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() ); |
586 MemSpyUiUtils::AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() ); |
606 } |
587 } |
607 else |
588 else |
608 { |
589 { |
609 _LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" ); |
590 _LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" ); |
610 name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, aProcesses[i]->ThreadCount(), &priority ); |
591 name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, aProcesses[i]->ThreadCount(), &priority ); |
672 // show full exit info. |
653 // show full exit info. |
673 _LIT( KAbnormalFormatSpec, " %S-%d" ); |
654 _LIT( KAbnormalFormatSpec, " %S-%d" ); |
674 aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason ); |
655 aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason ); |
675 } |
656 } |
676 } |
657 } |
677 |
658 */ |
|
659 /* |
678 void CMemSpyViewProcesses::AppendExitType( TDes& aDes, TExitType aType ) |
660 void CMemSpyViewProcesses::AppendExitType( TDes& aDes, TExitType aType ) |
679 { |
661 { |
680 _LIT( KExitTypeKilled, "Killed" ); |
662 _LIT( KExitTypeKilled, "Killed" ); |
681 _LIT( KExitTypeTerminated, "Terminated" ); |
663 _LIT( KExitTypeTerminated, "Terminated" ); |
682 _LIT( KExitTypePanicked, "Panicked" ); |
664 _LIT( KExitTypePanicked, "Panicked" ); |