# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284542025 -10800 # Node ID 9b2cffad4b5eb54d4446897e57249d9c513cfda0 # Parent f8280f3bfeb78f9676dc11233a12837f5bef666d Revision: 201035 Kit: 201036 diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/data/creator.rss --- a/creator/data/creator.rss Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/data/creator.rss Wed Sep 15 12:13:45 2010 +0300 @@ -1009,7 +1009,7 @@ id = EAknMessageQueryContentId; control = AVKON_MESSAGE_QUERY { - message = "Version 5.3.5 - 30th October 2009. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; + message = "Version 5.3.6 - 30th August 2010. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; }; } }; diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_browserelement.h --- a/creator/inc/creator_browserelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_browserelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -41,7 +41,7 @@ public: static CCreatorBrowserElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); - + void AsyncExecuteCommandL(); protected: CCreatorBrowserElement(CCreatorEngine* aEngine); TInt GetBrowserCommandL() const; diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_calendarelement.h --- a/creator/inc/creator_calendarelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_calendarelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -102,6 +102,7 @@ public: static CCreatorCalendarElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); + void AsyncExecuteCommandL(); protected: CCreatorCalendarElement(CCreatorEngine* aEngine); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_connectionmethodelement.h --- a/creator/inc/creator_connectionmethodelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_connectionmethodelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -90,7 +90,7 @@ public: static CCreatorConnectionMethodElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); - + void AsyncExecuteCommandL(); protected: CCreatorConnectionMethodElement(CCreatorEngine* aEngine); }; diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_contactelement.h --- a/creator/inc/creator_contactelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_contactelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -143,6 +143,7 @@ public: static CCreatorContactElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); + void AsyncExecuteCommandL(); protected: CCreatorContactElement(CCreatorEngine* aEngine); }; @@ -154,6 +155,7 @@ { public: static CCreatorContactSetElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void AsyncExecuteCommand(); void ExecuteCommandL(); virtual void AddToCacheL(); protected: @@ -167,6 +169,7 @@ { public: static CCreatorContactGroupElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); + void AsyncExecuteCommandL(); void ExecuteCommandL(); protected: CCreatorContactGroupElement(CCreatorEngine* aEngine); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_fileelement.h --- a/creator/inc/creator_fileelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_fileelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -51,6 +51,7 @@ public: static CCreatorFileElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); + void AsyncExecuteCommandL(); protected: CCreatorFileElement(CCreatorEngine* aEngine); @@ -63,4 +64,4 @@ TInt64 iTimeZone; }; -#endif // CREATORFILEELEMENT_H_ \ No newline at end of file +#endif // CREATORFILEELEMENT_H_ diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_impselement.h --- a/creator/inc/creator_impselement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_impselement.h Wed Sep 15 12:13:45 2010 +0300 @@ -40,7 +40,7 @@ public: static CCreatorImpsServerElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); - + void AsyncExecuteCommandL(); protected: CCreatorImpsServerElement(CCreatorEngine* aEngine); }; diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_landmarkelement.h --- a/creator/inc/creator_landmarkelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_landmarkelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -47,7 +47,7 @@ public: static CCreatorLandmarkElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); - + void AsyncExecuteCommandL(); protected: CCreatorLandmarkElement(CCreatorEngine* aEngine); }; diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_logelement.h --- a/creator/inc/creator_logelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_logelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -39,7 +39,7 @@ public: static CCreatorLogElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); - + void AsyncExecuteCommandL(); protected: CCreatorLogElement(CCreatorEngine* aEngine); TInt GetLogCommandL( const TDesC& aFileIdStr, TBool aRandom ) const; diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_mailboxelement.h --- a/creator/inc/creator_mailboxelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_mailboxelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -115,7 +115,7 @@ public: static CCreatorMailboxElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); - + void AsyncExecuteCommandL(); protected: CCreatorMailboxElement(CCreatorEngine* aEngine); TBool SetTextParamL(const TDesC& aElemName, const TDesC& aElemContent, CMailboxesParameters* aParams, TBool aSetRandom ); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_messageelement.h --- a/creator/inc/creator_messageelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_messageelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -58,6 +58,7 @@ public: static CCreatorMessageElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); + void AsyncExecuteCommandL(); protected: CCreatorMessageElement(CCreatorEngine* aEngine); /* diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_model.h --- a/creator/inc/creator_model.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_model.h Wed Sep 15 12:13:45 2010 +0300 @@ -180,9 +180,24 @@ const CCreatorRandomDataParser::TRandomDataType aRandomDataType); void GenerateSourceImageFileL( const TTestDataPath aFileType, const TDesC& aFileName ); void GenereteSourceTextFileL( const TDesC& aFileName, TInt aSize ); + + /** + * CallBack for an asynchronous call of RunScriptL. + * @param aObject TAny object. + * @return KErrNone or error code. + */ + static TInt AsyncRunScriptCB( TAny* aObject ); + public: void ExecuteOptionsMenuCommandL(TInt aCommand); + + /** + * It starts asynchronous call of RunScriptL, because it can take a long time + * @return None. + */ + void AsyncRunScript(); + void RunScriptL(); TInt RunScriptL(const TDesC& aScriptFile); @@ -311,6 +326,7 @@ CImageEncoder* iEncoder; CFrameImageData* iFrameImageData; CBitmapScaler* iScaler; + CAsyncCallBack iAsyncRunScript; public: diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_noteelement.h --- a/creator/inc/creator_noteelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_noteelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -32,6 +32,7 @@ public: static CCreatorNoteElement* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); void ExecuteCommandL(); + void AsyncExecuteCommandL(); protected: CCreatorNoteElement(CCreatorEngine* aEngine); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/inc/creator_scriptelement.h --- a/creator/inc/creator_scriptelement.h Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/inc/creator_scriptelement.h Wed Sep 15 12:13:45 2010 +0300 @@ -227,12 +227,16 @@ virtual void AddToCacheL(); virtual TBool IsCommandElement() const; virtual void ExecuteCommandL(); + + void AsyncExecuteCommand(); //virtual void SaveCommandResultsL(); //virtual void DiscardCommandResultsL(); virtual TBool IsRoot() const; virtual RPointerArray& CommandParameters(); virtual const RPointerArray& CommandParameters() const; + void AsyncExecuteCommandAndWaitL(); + protected: /** @@ -286,6 +290,11 @@ */ void IncreasePhoneNumL( const TDesC& aOriginal, TInt aDelta, HBufC* aIncreased ) const; + static TInt ExecuteCommandCB( TAny *aPtr ); + virtual void AsyncExecuteCommandL(); + void StartNextLoop(); + void AsyncCommandFinished(); + protected: // Sub-element array @@ -303,6 +312,11 @@ TBool iIsRoot; CCreatorEngine* iEngine; RPointerArray iParameters; + + CAsyncCallBack iAsyncCallback; + CActiveSchedulerWait iWaiter; + volatile TInt iAsyncOpError; + TInt iLoopIndex; }; /** @@ -331,19 +345,4 @@ CCreatorCalendarElementBase(CCreatorEngine* aEngine); }; -/** - * Message elements - */ - -/** - * Base class for message elements - */ -class CCreatorMessageElementBase : public CCreatorScriptElement -{ -public: - static CCreatorMessageElementBase* NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext = KNullDesC); -protected: - CCreatorMessageElementBase(CCreatorEngine* aEngine); -}; - #endif /*CREATORSCRIPTELEMENT_H_*/ diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/rom/creator.iby --- a/creator/rom/creator.iby Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/rom/creator.iby Wed Sep 15 12:13:45 2010 +0300 @@ -35,12 +35,17 @@ data=ZPRIVATE\20011383\3GPP-70kB.3gpp private\20011383\3GPP-70kB.3gpp data=ZPRIVATE\20011383\AAC-100kB.aac private\20011383\AAC-100kB.aac data=ZPRIVATE\20011383\AMR-20kB.amr private\20011383\AMR-20kB.amr +data=ZPRIVATE\20011383\BMP-25kB.bmp private\20011383\BMP-25kB.bmp data=ZPRIVATE\20011383\Deck-1kB.saveddeck private\20011383\Deck-1kB.saveddeck data=ZPRIVATE\20011383\DOC-20kB.doc private\20011383\DOC-20kB.doc +data=ZPRIVATE\20011383\GIF-2kB.gif private\20011383\GIF-2kB.gif data=ZPRIVATE\20011383\HTML-20kB.html private\20011383\HTML-20kB.html data=ZPRIVATE\20011383\JAD-1kB.jad private\20011383\JAD-1kB.jad data=ZPRIVATE\20011383\JAR-10kB.jar private\20011383\JAR-10kB.jar data=ZPRIVATE\20011383\JP2-65kB.jp2 private\20011383\JP2-65kB.jp2 +data=ZPRIVATE\20011383\JPEG-200kB.jpg private\20011383\JPEG-200kB.jpg +data=ZPRIVATE\20011383\JPEG-25kB.jpg private\20011383\JPEG-25kB.jpg +data=ZPRIVATE\20011383\JPEG-500kB.jpg private\20011383\JPEG-500kB.jpg data=ZPRIVATE\20011383\MIDI-10kB.mid private\20011383\MIDI-10kB.mid data=ZPRIVATE\20011383\MP3-250kB.mp3 private\20011383\MP3-250kB.mp3 data=ZPRIVATE\20011383\MP4-200kB.mp4 private\20011383\MP4-200kB.mp4 @@ -53,6 +58,8 @@ data=ZPRIVATE\20011383\SVG-15kB.svg private\20011383\SVG-15kB.svg data=ZPRIVATE\20011383\SWF-15kB.swf private\20011383\SWF-15kB.swf data=ZPRIVATE\20011383\TIF-25kB.tif private\20011383\TIF-25kB.tif +data=ZPRIVATE\20011383\TXT-10kB.txt private\20011383\TXT-10kB.txt +data=ZPRIVATE\20011383\TXT-70kB.txt private\20011383\TXT-70kB.txt data=ZPRIVATE\20011383\VCF-1kB.vcf private\20011383\VCF-1kB.vcf data=ZPRIVATE\20011383\VCS-1kB.vcs private\20011383\VCS-1kB.vcs data=ZPRIVATE\20011383\WAV-20kB.wav private\20011383\WAV-20kB.wav diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/sis/Creator_stub.pkg --- a/creator/sis/Creator_stub.pkg Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/sis/Creator_stub.pkg Wed Sep 15 12:13:45 2010 +0300 @@ -68,3 +68,5 @@ ""-"z:\private\20011383\WAV-20kB.wav" ""-"z:\private\20011383\XLS-15kB.xls" ""-"z:\private\20011383\SISX-10kB.sisx" +""-"z:\private\20011383\WMA-50kB.wma" +""-"z:\private\20011383\WMV-200kB.wmv" diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_appui.cpp --- a/creator/src/creator_appui.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_appui.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -146,7 +146,7 @@ // run script case ECmdCreateFromFile: { - iEngine->RunScriptL(); + iEngine->AsyncRunScript(); } break; diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_browserelement.cpp --- a/creator/src/creator_browserelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_browserelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -44,6 +44,140 @@ iIsCommandElement = ETrue; } +void CCreatorBrowserElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt entryAmount = 1; + if( amountAttr ) + { + entryAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create browser entries, the amount of entries is defined by entryAmount: + if( iLoopIndex < entryAmount ) + { + CBrowserParameters* param = new (ELeave) CBrowserParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + if( elemName == KName ) + { + if( randomAttr || elemContent.Length() == 0) + { + elemContent.Set(iEngine->RandomString(CCreatorEngine::ECompany)); + } + if( iName->Des() == KBookmark ) + { + SetContentToTextParamL(param->iBookmarkName, elemContent); + } + else if( iName->Des() == KBookmarkFolder ) + { + SetContentToTextParamL(param->iBookmarkFolderName, elemContent); + } + else if( iName->Des() == KSavedPage ) + { + SetContentToTextParamL(param->iSavedDeckLinkName, elemContent); + } + else if( iName->Des() == KSavedPageFolder ) + { + SetContentToTextParamL(param->iSavedDeckFolderName, elemContent); + } + } + + else if( elemName == KPath ) + { + if( randomAttr || elemContent.Length() == 0) + { + SetContentToTextParamL(param->iSavedDeckLocalAddress, iEngine->TestDataPathL(CCreatorEngine::ESavedDeck_1kB)); + } + else + { + SetContentToTextParamL(param->iSavedDeckLocalAddress, elemContent); + } + } + else if( elemName == KUsername ) + { + if( randomAttr || elemContent.Length() == 0) + { + // Set username and password to same string + if( param->iBookmarkPassword && param->iBookmarkPassword->Length() > 0 ) + { + SetContentToTextParamL(param->iBookmarkUsername, param->iBookmarkPassword->Des()); + } + else + { + SetContentToTextParamL(param->iBookmarkUsername, iEngine->RandomString(CCreatorEngine::EFirstName)); + } + } + else + { + SetContentToTextParamL(param->iBookmarkUsername, elemContent); + } + } + else if( elemName == KPassword ) + { + if( randomAttr || elemContent.Length() == 0) + { + // Set username and password to same string + if( param->iBookmarkUsername && param->iBookmarkUsername->Length() > 0 ) + { + SetContentToTextParamL(param->iBookmarkPassword, param->iBookmarkUsername->Des()); + } + else + { + SetContentToTextParamL(param->iBookmarkPassword, iEngine->RandomString(CCreatorEngine::EFirstName)); + } + } + else + { + SetContentToTextParamL(param->iBookmarkPassword, elemContent); + } + } + else if( elemName == KUrl ) + { + if( randomAttr || elemContent.Length() == 0) + { + TDesC* tmpUrl = iEngine->CreateHTTPUrlLC(); + if( tmpUrl ) + { + SetContentToTextParamL(param->iBookmarkAddress, *tmpUrl ); + } + CleanupStack::PopAndDestroy(); // tmpUrl + } + else + { + SetContentToTextParamL(param->iBookmarkAddress, elemContent); + } + } + } + iEngine->AppendToCommandArrayL(GetBrowserCommandL(), param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + // stop loop and signal end of the executing command + AsyncCommandFinished(); + } + } + else + { + // No fields defined --> Add all fields with random values: + iEngine->AppendToCommandArrayL(GetBrowserCommandL(), 0, entryAmount); + // signal end of the executing command + AsyncCommandFinished(); + } + } /* * @@ -59,24 +193,14 @@ } // Get 'fields' element CCreatorScriptElement* fieldsElement = FindSubElement(KFields); - if( fieldsElement ) + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) { // Get sub-elements const RPointerArray& fields = fieldsElement->SubElements(); // Create browser entries, the amount of entries is defined by entryAmount: for( TInt cI = 0; cI < entryAmount; ++cI ) { - CBrowserParameters* param = 0; - - if( fields.Count() > 0 ) - param = new (ELeave) CBrowserParameters; - else - { - // No fields defined --> Add all fields with random values: - addAll = ETrue; - break; - } - + CBrowserParameters* param = new (ELeave) CBrowserParameters; CleanupStack::PushL(param); for( TInt i = 0; i < fields.Count(); ++i ) @@ -181,6 +305,7 @@ } else { + // No fields defined --> Add all fields with random values: addAll = ETrue; } diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_calendarelement.cpp --- a/creator/src/creator_calendarelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_calendarelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -488,6 +488,125 @@ } } +void CCreatorCalendarElement::AsyncExecuteCommandL() + { + LOGSTRING("Creator: CCreatorCalendarElement::AsyncExecuteCommandL"); + // Amount of calendar entries: + const CCreatorScriptAttribute* calEntryAmountAttr = this->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* calEntryTypeAttr = this->FindAttributeByName(KType); + TInt entryAmount = 1; + if( calEntryAmountAttr ) + { + entryAmount = ConvertStrToIntL(calEntryAmountAttr->Value()); + } + if( calEntryTypeAttr == 0 ) + { + LOGSTRING("ERROR in CCreatorCalendarElement::AsyncExecuteCommandL: Type attribute is missing."); + User::Leave(KErrGeneral); // type is required attribute + } + + // Find fields element: + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + + if( iLoopIndex < entryAmount ) + { + CCalenderInterimParameters* param = new (ELeave) CCalenderInterimParameters; + CleanupStack::PushL(param); + if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAppointment) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EAppointment, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAppointments, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + // We can step out from the for-loop, because the amount is given to engine. + // stop loop and signal end of the executing command + AsyncCommandFinished(); + return; + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeEvent ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EEvent, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryEvents, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + // We can step out from the for-loop, because the amount is given to engine. + // stop loop and signal end of the executing command + AsyncCommandFinished(); + return; + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeReminder ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EReminder, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryReminders, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + // We can step out from the for-loop, because the amount is given to engine. + // stop loop and signal end of the executing command + AsyncCommandFinished(); + return; + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeAnniversary ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(EAnniversary, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryAnniversaries, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + // We can step out from the for-loop, because the amount is given to engine. + // stop loop and signal end of the executing command + AsyncCommandFinished(); + return; + } + } + else if( CompareIgnoreCase(calEntryTypeAttr->Value(), KCalTypeTodo ) == 0 ) + { + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + FillEntryParamsL(ETodo, fieldsElement->SubElements(), param); + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, param); + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateCalendarEntryToDos, 0, entryAmount); + CleanupStack::PopAndDestroy(param); + // We can step out from the for-loop, because the amount is given to engine. + // stop loop and signal end of the executing command + AsyncCommandFinished(); + return; + } + } + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + // stop loop and signal end of the executing command + AsyncCommandFinished(); + } + } + void CCreatorCalendarElement::ExecuteCommandL() { LOGSTRING("Creator: CCreatorCalendarElement::ExecuteCommandL"); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_connectionmethodelement.cpp --- a/creator/src/creator_connectionmethodelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_connectionmethodelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -60,6 +60,423 @@ } #if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCreatorConnectionMethodElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt cmAmount = 1; + if( amountAttr ) + { + cmAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create connection method entries, the amount of entries is defined by cmAmount: + if( iLoopIndex < cmAmount ) + { + CConnectionSettingsParameters* param = new (ELeave) CConnectionSettingsParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( elemName == Kconnectionname ) + { + if( useRandom ) + { + param->SetRandomCMNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iConnectionName, elemContent); + // reserve extra space for possible renaming + TInt newLen = param->iConnectionName->Length() + KExtraSpace; + param->iConnectionName = param->iConnectionName->ReAllocL(newLen); + } + } + else if( elemName == Kstartpage ) + { + if( useRandom ) + { + param->SetRandomStartPageL(*iEngine); + } + else + { + SetContentToTextParamL(param->iStartPage, elemContent); + } + } + else if( elemName == Kwapwspoption ) + { + if( useRandom ) + { + param->SetRandomWapWspOptionL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kconnectionless) == 0 ) + { + param->iWapWspOption = ECmWapWspOptionConnectionless; + } + else if( CompareIgnoreCase(elemContent, Kconnectionoriented) == 0 ) + { + param->iWapWspOption = ECmWapWspOptionConnectionOriented; + } + } + } + else if( elemName == Kprotocoltype ) + { + if( useRandom ) + { + param->SetRandomProtocolTypeL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kipv4) == 0 ) + { + param->iProtocolType = RPacketContext::EPdpTypeIPv4; + } + else if( CompareIgnoreCase(elemContent, Kipv6) == 0 ) + { + param->iProtocolType = RPacketContext::EPdpTypeIPv6; + } + } + } + else if( elemName == Kloginname ) + { + if( useRandom ) + { + param->SetRandomLoginNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iLoginName, elemContent); + } + } + else if( elemName == Ksecureauthentication ) + { + if( useRandom ) + { + param->SetRandomSecureAuthenticationL(*iEngine); + } + else + { + param->iSecureAuthentication = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kloginpass ) + { + if( useRandom ) + { + param->SetRandomLoginPassL(*iEngine); + } + else + { + SetContentToTextParamL(param->iLoginPass, elemContent); + } + } + else if( elemName == Kpromptpassword ) + { + if( useRandom ) + { + param->SetRandomPromptPasswordL(*iEngine); + } + else + { + param->iPromptPassword = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kgatewayaddress ) + { + if( useRandom ) + { + param->SetRandomGatewayAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iGatewayAddress, elemContent); + } + } + else if( elemName == Ksubnetmask ) + { + if( useRandom ) + { + param->SetRandomSubnetMaskL(*iEngine); + } + else + { + SetContentToTextParamL(param->iSubnetMask, elemContent); + } + } + else if( elemName == Kdeviceipaddr ) + { + if( useRandom ) + { + param->SetRandomIPAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iIPAddr, elemContent); + } + } + else if( elemName == Kip4nameserver1 ) + { + if( useRandom ) + { + param->SetRandomIP4NameServer1L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP4NameServer1, elemContent); + } + } + else if( elemName == Kip4nameserver2 ) + { + if( useRandom ) + { + param->SetRandomIP4NameServer2L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP4NameServer2, elemContent); + } + } + else if( elemName == Kdatacalltelnumber ) + { + if( useRandom ) + { + param->SetRandomTelephoneNumberL(*iEngine); + } + else + { + SetContentToTextParamL(param->iDefaultTelNumber, elemContent); + } + } + else if( elemName == Kdatacalltypeisdn ) + { + if( useRandom ) + { + param->SetRandomBearerTypeIsdnL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kanalogue) == 0 ) + param->iBearerCallTypeIsdn = CMManager::ECmCallTypeAnalogue; + else if( CompareIgnoreCase( elemContent, Kisdnv110) == 0 ) + param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv110; + else if( CompareIgnoreCase( elemContent, Kisdnv120) == 0 ) + param->iBearerCallTypeIsdn = CMManager::ECmCallTypeISDNv120; + } + } + else if( elemName == Kbearertype ) + { + if( useRandom ) + { + param->iBearerType = KRandomBearerType; + } + else + { + if( CompareIgnoreCase(elemContent, Kwlan) == 0 ) + { + param->iBearerType = KUidWlanBearerType; + } + else if( CompareIgnoreCase(elemContent, Kgprs) == 0 ) + { + param->iBearerType = KUidPacketDataBearerType; + } + else if( CompareIgnoreCase(elemContent, Kdatacall) == 0 ) + { + param->iBearerType = KUidCSDBearerType; + } + else if( CompareIgnoreCase(elemContent, Khsgsm) == 0 ) + { + param->iBearerType = KUidHSCSDBearerType; + } + else if( CompareIgnoreCase(elemContent, Kembedded) == 0 ) + { + param->iBearerType = KUidEmbeddedDestination; + } + else if( CompareIgnoreCase(elemContent, Kvpn) == 0 ) + { + param->iBearerType = KPluginVPNBearerTypeUid; + } + else if( CompareIgnoreCase(elemContent, Klan) == 0 ) + { + param->iBearerType = KUidLanBearerType; + } + } + } + else if( elemName == Kdatacalllinespeed ) + { + if( useRandom ) + { + param->SetRandomBearerSpeedL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kautomatic) == 0 ) + { + param->iBearerSpeed = CMManager::ECmSpeedAutobaud; + } + else + { + TUint lineSpeed = ConvertStrToUintL(elemContent); + if( lineSpeed == 9600 ) + param->iBearerSpeed = CMManager::ECmSpeed9600; + else if( lineSpeed == 14400 ) + param->iBearerSpeed = CMManager::ECmSpeed14400; + else if( lineSpeed == 19200 ) + param->iBearerSpeed = CMManager::ECmSpeed19200; + else if( lineSpeed == 28800 ) + param->iBearerSpeed = CMManager::ECmSpeed28800; + else if( lineSpeed == 38400 ) + param->iBearerSpeed = CMManager::ECmSpeed38400; + else if( lineSpeed == 43200 ) + param->iBearerSpeed = CMManager::ECmSpeed43200; + else if( lineSpeed == 56000 ) + param->iBearerSpeed = CMManager::ECmSpeed56000; + } + } + } + else if( elemName == Kuseproxy ) + { + if( useRandom ) + { + param->SetRandomUseProxyL(*iEngine); + } + else + { + param->iUseProxy = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kproxyserveraddress ) + { + if( useRandom ) + { + param->SetRandomProxyAddressL(*iEngine); + } + else + { + SetContentToTextParamL(param->iProxyServerAddress, elemContent); + } + } + else if( elemName == Kproxyportnumber ) + { + if( useRandom ) + { + param->SetRandomProxyPortL(*iEngine); + } + else + { + param->iProxyPortNumber = ConvertStrToUintL(elemContent); + } + } + else if( elemName == Kip6nameserver1 ) + { + if( useRandom ) + { + param->SetRandomIPv6NameServer1L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP6NameServer1, elemContent); + } + } + else if( elemName == Kip6nameserver2 ) + { + if( useRandom ) + { + param->SetRandomIPv6NameServer2L(*iEngine); + } + else + { + SetContentToTextParamL(param->iIP6NameServer2, elemContent); + } + } + else if( elemName == Kdisabletextauth ) + { + if( useRandom ) + { + param->SetRandomDisableTextAuthL(*iEngine); + } + else + { + param->iDisableTextAuth = ConvertStrToBooleanL(elemContent); + } + } + else if( elemName == Kwlanname ) + { + if( useRandom ) + { + param->SetRandomWLANNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iWLANName, elemContent); + } + } + else if( elemName == Kwlanipaddr ) + { + if( useRandom ) + { + param->SetRandomWlanIpAddrL(*iEngine); + } + else + { + SetContentToTextParamL(param->iWlanIpAddr, elemContent); + } + } + else if( elemName == Kwlansecmode ) + { + if( useRandom ) + { + param->SetRandomWLANSecurityModeL(*iEngine); + } + else + { + if( CompareIgnoreCase(elemContent, Kopen) == 0) + param->iWLanSecMode = CMManager::EWlanSecModeOpen; + else if( CompareIgnoreCase(elemContent, Kwep) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecModeWep; + else if( CompareIgnoreCase(elemContent, Ke802_1x) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecMode802_1x; + else if( CompareIgnoreCase(elemContent, Kwpa) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecModeWpa; + else if( CompareIgnoreCase(elemContent, Kwpa2) == 0 ) + param->iWLanSecMode = CMManager::EWlanSecModeWpa2; + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + // stop loop and signal end of the executing command + AsyncCommandFinished(); + } + } + else + { + // No fields defined so add random entries: + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryAccessPoints, 0, cmAmount); + // signal end of the executing command + AsyncCommandFinished(); + } + } + void CCreatorConnectionMethodElement::ExecuteCommandL() { const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_contactelement.cpp --- a/creator/src/creator_contactelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_contactelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -171,6 +171,173 @@ } #if(!defined __SERIES60_30__ && !defined __SERIES60_31__) +void CCreatorContactElement::AsyncExecuteCommandL() + { + LOGSTRING("Creator: CCreatorContactElement::AsyncExecuteCommandL"); + // Find out how many contacts should we create: + const CCreatorScriptAttribute* contactAmountAttr = this->FindAttributeByName(KAmount); + TInt contactAmount = 1; + if( contactAmountAttr ) + { + contactAmount = ConvertStrToIntL(contactAmountAttr->Value()); + } + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + TInt fieldMappingTblSize = sizeof(fieldMappingTbl)/sizeof(FieldMapping); + if( iLoopIndex < contactAmount ) + { + CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL(); + CleanupStack::PushL(param); + // Loop all the field elements + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + + const RPointerArray& fieldList = fieldsElement->SubElements(); + + if( fieldList.Count() == 0 ) + { + + } + for( TInt i = 0; i < fieldList.Count(); ++i ) + { + TPtrC fieldName = fieldList[i]->Name(); + const CCreatorScriptAttribute* amountAttr = fieldList[i]->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* rndLenAttr = fieldList[i]->FindAttributeByName(KRandomLength); + const CCreatorScriptAttribute* increaseAttr = fieldList[i]->FindAttributeByName(KIncrease); + TBool increase( EFalse ); + if ( increaseAttr ) + { + increase = ConvertStrToBooleanL( increaseAttr->Value() ); + } + CCreatorContactField* field = 0; + for( TInt j = 0; j < fieldMappingTblSize; ++j ) + { + const FieldMapping& mapping = fieldMappingTbl[j]; + if( fieldName == mapping.iElementName ) + { + TInt rndLen = 0; + TPtrC content = fieldList[i]->Content(); + + MCreatorRandomDataField::TRandomLengthType randomLenType = MCreatorRandomDataField::ERandomLengthUndefined; + + if( content == TPtrC(KEmpty) || content == TPtrC(KNullDesC) ) + { + if( rndLenAttr == 0 ) + { + randomLenType = MCreatorRandomDataField::ERandomLengthDefault; + } + else + { + randomLenType = ResolveRandomDataTypeL(*rndLenAttr, rndLen); + } + } + else + { + // Special handling for file id content: + if( fieldName == KThumbnailId ) + { + // Thumbnail data is copied to the contact entry, so we can use temporary file: + CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content); + content.Set(iEngine->TestDataPathL(id)); + } + else if( fieldName == KRingToneId ) + { + // Contact entry contains just a link to the sound file, so we must + // copy the temporary file to a permanent location: + CCreatorEngine::TTestDataPath id = (CCreatorEngine::TTestDataPath) iEngine->GetAttachmentIdL(content); + TPtrC fullTargetPath(iEngine->CreateSoundFileL(id)); + content.Set(fullTargetPath); + } + } + TInt amountValue = 1; + if( amountAttr ) + { + amountValue = ConvertStrToIntL(amountAttr->Value()); + } + for( TInt k = 0; k < amountValue; ++k ) + { + if ( increase && + ( fieldName.FindF( _L("number") ) > KErrNotFound || + fieldName.FindF( _L("phone") ) > KErrNotFound ) ) + { + // increase phonenumber for each copy + HBufC* incNum = HBufC::NewLC( content.Length() + 3 ); + if ( amountValue > 1 ) + { + // amount defined in number field level + IncreasePhoneNumL( content, k, incNum ); + } + else + { + // amount defined in contact field level + IncreasePhoneNumL( content, iLoopIndex, incNum ); + } + field = CCreatorContactField::NewL( mapping.iFieldCode, *incNum ); + CleanupStack::PushL( field ); + field->SetRandomParametersL( randomLenType, rndLen ); + param->iContactFields.AppendL( field ); + CleanupStack::Pop( field ); + CleanupStack::PopAndDestroy( incNum ); + } + else + { + field = CCreatorContactField::NewL(mapping.iFieldCode, content); + CleanupStack::PushL(field); + field->SetRandomParametersL(randomLenType, rndLen); + param->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + } + break; + } + } + } + } + else + { + // No fields specified, so add all fields with random content: + for( TInt i = 0; i < fieldMappingTblSize; ++i ) + { + if( fieldMappingTbl[i].iElementName == KThumbnailId || + fieldMappingTbl[i].iElementName == KRingToneId ) + { + // Skip thumbnail and ringtone IDs, since they are duplicates with thumbnailpath and ringtonepath + continue; + } + CCreatorContactField* field = 0; + if(fieldMappingTbl[i].iDataType == EDataTypeText ) + { + field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC); + } + else if( fieldMappingTbl[i].iDataType == EDataTypeBinary ) + { + field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, KNullDesC8); + } + else if( fieldMappingTbl[i].iDataType == EDataTypeDateTime ) + { + TDateTime dateTime(Time::NullTTime().DateTime()); + field = CCreatorContactField::NewL(fieldMappingTbl[i].iFieldCode, dateTime); + } + if( field ) + { + CleanupStack::PushL(field); + field->SetRandomParametersL(MCreatorRandomDataField::ERandomLengthDefault, 0); + param->iContactFields.AppendL(field); + CleanupStack::Pop(field); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryContacts, param); + iParameters.AppendL(param); // Save the pointer to the parametes. + CleanupStack::Pop(param); + StartNextLoop(); + } + else + { + // stop loop and signal end of the executing command + AsyncCommandFinished(); + } + } + void CCreatorContactElement::ExecuteCommandL() { LOGSTRING("Creator: CCreatorContactElement::ExecuteCommandL"); @@ -350,6 +517,11 @@ CCreatorContactElementBase(aEngine) { } +void CCreatorContactSetElement::AsyncExecuteCommand() + { + AsyncCommandFinished(); + } + void CCreatorContactSetElement::ExecuteCommandL() { } @@ -406,6 +578,58 @@ } #if(!defined __SERIES60_30__ && !defined __SERIES60_31__ ) +void CCreatorContactGroupElement::AsyncExecuteCommandL() + { + LOGSTRING("Creator: CCreatorContactGroupElement::AsyncExecuteCommandL"); + // Get attributes (amount and name) + const CCreatorScriptAttribute* groupAmountAttr = this->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* groupNameAttr = this->FindAttributeByName(KName); + // How many groups to create: + TInt groupAmount = 1; + if( groupAmountAttr ) + { + groupAmount = ConvertStrToIntL(groupAmountAttr->Value()); + } + + if( iLoopIndex < groupAmount ) + { + CCreatorScriptElement* membersElement = FindSubElement(KMembers); + + if( membersElement ) + { + CVirtualPhonebookParameters* param = (CVirtualPhonebookParameters*) TCreatorFactory::CreatePhoneBookParametersL(); + CleanupStack::PushL(param); + + // Links to contact-sets: + const RPointerArray& linkList = membersElement->SubElements(); + if( linkList.Count() > 0 ) + { + for( TInt i = 0; i < linkList.Count(); ++i ) + { + AppendContactSetReferenceL(*linkList[i], param->iLinkIds); + } + } + + if( groupNameAttr ) + { + param->iGroupName->Des().Copy( groupNameAttr->Value() ); + } + else + { + param->iGroupName->Des().Copy( iEngine->RandomString(CCreatorEngine::EGroupName) ); + } + iEngine->AppendToCommandArrayL(ECmdCreatePhoneBookEntryGroups, param); + CleanupStack::Pop(param); + } + StartNextLoop(); + } + else + { + // stop loop and signal end of the executing command + AsyncCommandFinished(); + } + } + void CCreatorContactGroupElement::ExecuteCommandL() { LOGSTRING("Creator: CCreatorContactGroupElement::ExecuteCommandL"); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_fileelement.cpp --- a/creator/src/creator_fileelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_fileelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -62,6 +62,97 @@ /* * */ +void CCreatorFileElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt fileAmount = 1; + if( amountAttr ) + { + fileAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create files, the amount of files is defined by fileAmount: + if( iLoopIndex < fileAmount ) + { + CFilesParameters* param = new (ELeave) CFilesParameters; + CleanupStack::PushL( param ); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + + const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName( KRandomLength ); + + if( elemName == KType ) + { + param->iFileCommand = GetFileCommandL(elemContent, randomAttr || elemContent.Length() == 0); + } + else if( elemName == KDirectory ) + { + delete param->iFullFilePath; + param->iFullFilePath = 0; + if( randomAttr == 0 && elemContent.Length() > 0 ) + { + param->iFullFilePath = elemContent.AllocL(); + } + else + { + TFileName defaultPath; + iEngine->SetDefaultPathForFileCommandL( param->iFileCommand, defaultPath ); + param->iFullFilePath = defaultPath.AllocL(); + } + } + else if ( elemName == KEncryption ) + { + ParseDRMElementsL( field, param ); + } + } + + if ( !param->iFileCommand ) + { + param->iFileCommand = ECmdCreateFileEntryEmptyFolder; + } + iEngine->AppendToCommandArrayL( param->iFileCommand, param); + CleanupStack::Pop( param ); + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + else + { + _LIT(KDummy, ""); + if( iLoopIndex < fileAmount ) + { + CFilesParameters* param = new (ELeave) CFilesParameters; + CleanupStack::PushL(param); + delete param->iFullFilePath; + param->iFullFilePath = 0; + TFileName defaultPath; + param->iFileCommand = GetFileCommandL(KDummy, ETrue); + iEngine->SetDefaultPathForFileCommandL(param->iFileCommand, defaultPath); + param->iFullFilePath = defaultPath.AllocL(); + + iEngine->AppendToCommandArrayL(param->iFileCommand, param); + CleanupStack::Pop(param); + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + } + void CCreatorFileElement::ExecuteCommandL() { const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_impselement.cpp --- a/creator/src/creator_impselement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_impselement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -45,6 +45,110 @@ iIsCommandElement = ETrue; } +void CCreatorImpsServerElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt entryAmount = 1; + if( amountAttr ) + { + entryAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create note entries, the amount of entries is defined by entryAmount: + if( iLoopIndex < entryAmount ) + { + CIMPSParameters* param = new (ELeave) CIMPSParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( elemName == KName ) + { + if( useRandom ) + { + param->SetRandomNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerName, elemContent); + } + } + if( elemName == KUrl ) + { + if( useRandom ) + { + param->SetRandomUrlL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerURL, elemContent); + } + } + if( elemName == KUsername ) + { + if( useRandom ) + { + param->SetRandomUsernameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerUsername, elemContent); + } + } + if( elemName == KPassword ) + { + if( useRandom ) + { + param->SetRandomPasswordL(*iEngine); + } + else + { + SetContentToTextParamL(param->iServerPassword, elemContent); + } + } + if( elemName == KConnectionMethodName ) + { + if( useRandom || CompareIgnoreCase(elemContent, creatorimps::KDefault) == 0 ) + { + param->SetDefaultAccessPointL(); + } + else + { + SetContentToTextParamL(param->iServerAccessPointName, elemContent); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryIMPSServers, param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryIMPSServers, 0, entryAmount); + AsyncCommandFinished(); + } + } + void CCreatorImpsServerElement::ExecuteCommandL() { const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_landmarkelement.cpp --- a/creator/src/creator_landmarkelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_landmarkelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -43,6 +43,224 @@ iIsCommandElement = ETrue; } +void CCreatorLandmarkElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt lmAmount = 1; + if( amountAttr ) + { + lmAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create note entries, the amount of entries is defined by noteAmount: + if( iLoopIndex < lmAmount ) + { + CLandmarkParameters* param = new (ELeave) CLandmarkParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( elemName == KName ) + { + if( useRandom ) + { + param->SetRandomNameL(*iEngine); + } + else + { + SetContentToTextParamL(param->iName, elemContent); + } + } + else if( elemName == KCategory ) + { + if( useRandom ) + { + param->AddRandomCategoryL(*iEngine); + } + else + { + TPosLmItemId categoryId = CCreatorLandmarks::GetCategoryIdL(elemContent); + if( categoryId > 0 ) + { + param->iCategories.AppendL(categoryId); + } + } + } + else if( elemName == KDescription ) + { + if( useRandom ) + { + param->SetRandomDescriptionL(*iEngine); + } + else + { + SetContentToTextParamL(param->iDescription, elemContent); + } + } + else if( elemName == KStreet ) + { + if( useRandom ) + { + param->SetRandomStreetL(*iEngine); + } + else + { + SetContentToTextParamL(param->iStreet, elemContent); + } + } + else if( elemName == KPostalcode ) + { + if( useRandom ) + { + param->SetRandomPostCodeL(*iEngine); + } + else + { + SetContentToTextParamL(param->iPostCode, elemContent); + } + } + else if( elemName == KCity ) + { + if( useRandom ) + { + param->SetRandomCityL(*iEngine); + } + else + { + SetContentToTextParamL(param->iCity, elemContent); + } + } + else if( elemName == KState ) + { + if( useRandom ) + { + param->SetRandomStateL(*iEngine); + } + else + { + SetContentToTextParamL(param->iState, elemContent); + } + } + else if( elemName == KCountry ) + { + if( useRandom ) + { + param->SetRandomCountryL(*iEngine); + } + else + { + SetContentToTextParamL(param->iCountry, elemContent); + } + } + else if( elemName == KPhonenumber ) + { + if( useRandom ) + { + param->SetRandomPhoneNumberL(*iEngine); + } + else + { + SetContentToTextParamL(param->iPhonenumber, elemContent); + } + } + else if( elemName == KUrl ) + { + if( useRandom ) + { + param->SetRandomUrlL(*iEngine); + } + else + { + SetContentToTextParamL(param->iUrl, elemContent); + } + } + else if( elemName == KLatitude ) + { + if( useRandom ) + { + param->SetRandomLatitudeL(*iEngine); + } + else + { + ConvertStrToReal64L(elemContent, param->iLatitude); + } + } + else if( elemName == KLongitude ) + { + if( useRandom ) + { + param->SetRandomLongitudeL(*iEngine); + } + else + { + ConvertStrToReal64L(elemContent, param->iLongitude); + } + } + else if( elemName == KPositionaccuracy ) + { + if( useRandom ) + { + param->SetRandomPositionAccuracyL(*iEngine); + } + else + { + param->iPositionAccuracy = ConvertStrToIntL(elemContent); + } + } + else if( elemName == KAltitude ) + { + if( useRandom ) + { + param->SetRandomAltitudeL(*iEngine); + } + else + { + ConvertStrToReal32L(elemContent, param->iAltitude); + } + } + else if( elemName == KAltitudeaccuracy ) + { + if( useRandom ) + { + param->SetRandomAltitudeAccuracyL(*iEngine); + } + else + { + param->iAltitudeAccuracy = ConvertStrToIntL(elemContent); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryLandmarks, param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryLandmarks, 0, lmAmount); + AsyncCommandFinished(); + } + } + void CCreatorLandmarkElement::ExecuteCommandL() { const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_logelement.cpp --- a/creator/src/creator_logelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_logelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -45,6 +45,118 @@ /* * */ + +void CCreatorLogElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt logAmount = 1; + if( amountAttr ) + { + logAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create log entries, the amount of entries is defined by logAmount: + if( iLoopIndex < logAmount ) + { + TInt direction = -1; + CLogsParameters* param = new (ELeave) CLogsParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName(KRandomLength); + const CCreatorScriptAttribute* increaseAttr = field->FindAttributeByName(KIncrease); + TBool increase( EFalse ); + if ( increaseAttr ) + { + increase = ConvertStrToBooleanL( increaseAttr->Value() ); + } + + if( elemName == KDirection ) + { + direction = GetLogCommandL(elemContent, randomAttr || elemContent.Length() == 0); + } + else if( elemName == KDuration ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + param->iDuration = iEngine->RandomNumber(7200); + } + else + { + param->iDuration = ConvertStrToIntL(elemContent); + } + } + else if( elemName == KPhonenumber ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + SetContentToTextParamL(param->iPhoneNumber, iEngine->RandomString(CCreatorEngine::EPhoneNumber)); + } + else + { + if ( increase ) + { + delete param->iPhoneNumber; + param->iPhoneNumber = NULL; + param->iPhoneNumber = HBufC::NewL( elemContent.Length() + 3 ); + IncreasePhoneNumL( elemContent, iLoopIndex, param->iPhoneNumber ); + } + else + { + SetContentToTextParamL(param->iPhoneNumber, elemContent); + } + } + } + else if( elemName == KDatetime ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + param->iEventTime = iEngine->RandomTime(iEngine->RandomDate(CCreatorEngine::EDatePast), CCreatorEngine::EDatePast); + } + else + { + param->iEventTime = ConvertToDateTimeL(elemContent); + } + } + } + + if( direction == -1 ) + { + direction = GetLogCommandL(KEmpty, ETrue); + } + iEngine->AppendToCommandArrayL(direction, param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + else + { + if( iLoopIndex < logAmount ) + { + iEngine->AppendToCommandArrayL(GetLogCommandL(KEmpty, ETrue), 0, 1); + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + } + + void CCreatorLogElement::ExecuteCommandL() { const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_mailboxelement.cpp --- a/creator/src/creator_mailboxelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_mailboxelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -433,6 +433,74 @@ return ETrue; } +void CCreatorMailboxElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + const CCreatorScriptAttribute* typeAttr = FindAttributeByName(KMailboxType); + TInt amount = 1; + if( amountAttr ) + { + amount = ConvertStrToIntL(amountAttr->Value()); + } + + TMailboxType mailboxType = EMailboxPOP3; + + if( typeAttr && CompareIgnoreCase(typeAttr->Value(), Kimap4) == 0 ) + { + mailboxType = EMailboxIMAP4; + } + + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create mailbox entries, the amount of entries is defined by amount: + if( iLoopIndex < amount ) + { + CMailboxesParameters* param = new (ELeave) CMailboxesParameters; + CleanupStack::PushL(param); + + param->iMailboxType = mailboxType; + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useRandom = EFalse; + if( randomAttr || elemContent.Length() == 0 ) + { + useRandom = ETrue; + } + + if( SetTextParamL(elemName, elemContent, param, useRandom ) == EFalse && + SetBooleanParamL(elemName, elemContent, param, useRandom ) == EFalse && + SetIntegerParamL(elemName, elemContent, param, useRandom ) == EFalse && + SetEnumParamL(elemName, elemContent, param, useRandom ) ) + { + LOGSTRING2("CCreatorMailboxElement::AsyncExecuteCommandL: Unknown mailbox field: %S", &elemName); + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMailboxes, 0, amount); + AsyncCommandFinished(); + } + } + + void CCreatorMailboxElement::ExecuteCommandL() { const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_message.cpp --- a/creator/src/creator_message.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_message.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -22,6 +22,7 @@ #include "creator_contactsetcache.h" #include #include +#include #if(!defined __SERIES60_30__ && !defined __SERIES60_31__) #include @@ -790,8 +791,8 @@ waiter->StartAndWait(); CleanupStack::PopAndDestroy(waiter); - HBufC8* tempBuf = HBufC8::NewLC( parameters.iMessageBodyText->Des().Length() ); - tempBuf->Des().Copy( parameters.iMessageBodyText->Des() ); + HBufC8* tempBuf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( parameters.iMessageBodyText->Des() ); + CleanupStack::PushL(tempBuf); textFile.Write( tempBuf->Des() ); textFile.Close(); CleanupStack::PopAndDestroy(); //tempBuf diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_messageelement.cpp --- a/creator/src/creator_messageelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_messageelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -154,6 +154,332 @@ /* * */ +void CCreatorMessageElement::AsyncExecuteCommandL() + { + LOGSTRING("Creator: CCreatorMessageElement::AsyncExecuteCommandL"); + + // Find out the message type: + const CCreatorScriptAttribute* msgTypeAttr = this->FindAttributeByName(KType); + TPtrC msgType; + if( msgTypeAttr ) + { + msgType.Set(msgTypeAttr->Value()); + } + else + { + LOGSTRING("ERROR in CCreatorMessageElement::AsyncExecuteCommandL: Type attribute is missing."); + User::Leave(KErrGeneral); // type is required attribute + } + + // Find out the amount of calendar entries: + const CCreatorScriptAttribute* msgAmountAttr = this->FindAttributeByName(KAmount); + TInt msgAmount = 1; + if( msgAmountAttr ) + { + msgAmount = ConvertStrToIntL(msgAmountAttr->Value()); + } + + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0 ) + { + // Get sub-elements (i.e the message field elements) + const RPointerArray& fields = fieldsElement->SubElements(); + + // Create message entries, the amount of entries is defined by msgAmount: + if( iLoopIndex < msgAmount ) + { + CMessagesParameters* param = new (ELeave) CMessagesParameters; + CleanupStack::PushL(param); + + // Message type: + if( msgTypeAttr ) + { + SetMessageTypeL(*param, msgTypeAttr->Value()); + } + + // Loop all the message field elements: + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const RPointerArray& contactReferences = field->SubElements(); + const CCreatorScriptAttribute* randomAttr = field->FindAttributeByName(KRandomLength); + const CCreatorScriptAttribute* amountAttr = field->FindAttributeByName(KAmount); + const CCreatorScriptAttribute* increaseAttr = field->FindAttributeByName(KIncrease); + TBool increase( EFalse ); + if ( increaseAttr ) + { + increase = ConvertStrToBooleanL( increaseAttr->Value() ); + } + TInt fieldAmount = 1; + if( amountAttr ) + { + fieldAmount = ConvertStrToIntL(amountAttr->Value()); + } + + if( elemName == KTo ) + { + // Recipient ('to'-field) + for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex ) + { + if( (randomAttr || elemContent.Length() == 0 ) && contactReferences.Count() == 0 ) + { + // Random content + HBufC* toAddr = CreateMessageAddressLC(msgType); + if( toAddr ) + { + param->iRecipientAddressArray.AppendL(toAddr); + CleanupStack::Pop(); // toAddr + } + } + else + { + if( elemContent.Length() > 0 && contactReferences.Count() == 0) + { + // Explicit recipient given + HBufC* recipient = HBufC::NewL( elemContent.Length() + 3 ); + CleanupStack::PushL(recipient); + if ( increase ) + { + IncreasePhoneNumL( elemContent, iLoopIndex, recipient ); + } + else + { + recipient->Des().Copy(elemContent); + } + param->iRecipientAddressArray.AppendL(recipient); + CleanupStack::Pop(); // recipient + } + else + { + // Recipients specified with contact-set-references (if any) + for( TInt csI = 0; csI < contactReferences.Count(); ++csI ) + { + CCreatorScriptElement* contactSetRef = contactReferences[csI]; + AppendContactSetReferenceL(*contactSetRef, param->iRecipientLinkIds); + } + } + } + } + } + else if( elemName == KFrom ) + { + // Sender ('from'-field) + // Amount attribute for sender is ignored, because there can be only one sender + delete param->iSenderAddress; + param->iSenderAddress = 0; + if( (randomAttr || elemContent.Length() == 0 ) && contactReferences.Count() == 0 ) + { + // Get random address + param->iSenderAddress = CreateMessageAddressLC(msgType); + CleanupStack::Pop(); // param->iSenderAddress + } + else + { + if( elemContent.Length() > 0 && contactReferences.Count() == 0) + { + // Explicit sender address given + param->iSenderAddress = HBufC::NewL(elemContent.Length()); + if ( increase ) + { + IncreasePhoneNumL( elemContent, iLoopIndex, param->iSenderAddress ); + } + else + { + param->iSenderAddress->Des().Copy(elemContent); + } + } + else + { + // Senders specified with contact-set-references (if any) + for( TInt csI = 0; csI < contactReferences.Count(); ++csI ) + { + CCreatorScriptElement* contactSetRef = contactReferences[csI]; + AppendContactSetReferenceL(*contactSetRef, param->iSenderLinkIds); + } + } + } + } + else if( elemName == KFolder ) + { + // Folder type + if( CompareIgnoreCase(elemContent, KSent) == 0 ) + { + param->iFolderType = ESent; + } + else if( CompareIgnoreCase(elemContent, KInbox) == 0 ) + { + param->iFolderType = EInbox; + } + else if( CompareIgnoreCase(elemContent, KOutbox) == 0 ) + { + param->iFolderType = EOutbox; + } + else if( CompareIgnoreCase(elemContent, KDraft) == 0 ) + { + param->iFolderType = EDrafts; + } + } + else if( elemName == KSubject ) + { + // Message subject + delete param->iMessageSubject; + param->iMessageSubject = 0; + + if( randomAttr || elemContent.Length() == 0 ) + { + // Random data should be used + TPtrC temp = iEngine->RandomString(CCreatorEngine::EMessageSubject); + param->iMessageSubject = HBufC::NewL(temp.Length()); + param->iMessageSubject->Des().Copy(temp); + } + else + { + param->iMessageSubject = HBufC::NewL(elemContent.Length()); + param->iMessageSubject->Des().Copy(elemContent); + } + } + else if( elemName == KText ) + { + // Body text + delete param->iMessageBodyText; + param->iMessageBodyText = 0; + + if( randomAttr || elemContent.Length() == 0 ) + { + // Put random text: + if( randomAttr && randomAttr->Value() != KDefault ) + { + // Get the random length + TInt len = GetRandomBodyLengthL(randomAttr->Value(), msgTypeAttr->Value()); + if( len != KUndef ) + { + param->iMessageBodyText = iEngine->CreateRandomStringLC(len); + CleanupStack::Pop(); // param->iMessageBodyText + } + } + else + { + // Use default random data + TPtrC temp = iEngine->RandomString(CCreatorEngine::EMessageText); + param->iMessageBodyText = HBufC::NewL(temp.Length()); + param->iMessageBodyText->Des().Copy(temp); + } + } + else + { + param->iMessageBodyText = HBufC::NewL(elemContent.Length()); + param->iMessageBodyText->Des().Copy(elemContent); + } + } + else if( elemName == KAttachmentId ) + { + // Attachment file id + for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex ) + { + if( randomAttr || elemContent.Length() == 0) + { + //When type is AMS, attachement will be audio + if(param->iMessageType == EAMS) + { + param->iAttachments->AppendL(CCreatorEngine::EMP3_250kB); + } + //Otherwise attachement can be any file + else + { + //EJPEG_25kB is first (0) in the enum and LAST_FILE_ID is last in the enum, so real last item id is one before LAST_FILE_ID + param->iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID-1) ); + } + } + else + { + //When user has been set attechment by it self, we trust user selection (not validating value, e.g. if message is SMS and there is attachement) + TInt id = iEngine->GetAttachmentIdL(elemContent); + if( id != KUndef ) + { + param->iAttachments->AppendL( id ); + } + } + } + } + // Attachment file path handling + //E.g. C:\data\others\DOC-20kB.doc + else if( elemName == KAttachmentPath ) + { + // Attachment file id + for( TInt amountIndex = 0; amountIndex < fieldAmount; ++amountIndex ) + { + //Path is random, getting one of the files (not even using path attribute, but id with random) + if( randomAttr || elemContent.Length() == 0) + { + //EJPEG_25kB is first (0) in the enum and LAST_FILE_ID is last in the enum, so real last item id is one before LAST_FILE_ID + param->iAttachments->AppendL( iEngine->RandomNumber(CCreatorEngine::EJPEG_25kB, CCreatorEngine::LAST_FILE_ID -1) ); + } + //Otherwise adding attachement path as it is to paths. + else + { + //Adding Attachement file path + HBufC* elemData = elemContent.AllocLC(); + param->iAttachmentPaths.AppendL( elemData ); + CleanupStack::Pop(elemData); + } + } + } + else if ( elemName == KStatus ) + { + if( CompareIgnoreCase( elemContent, KNew ) == 0 ) + { + param->iCreateAsUnread = ETrue; + } + else if( CompareIgnoreCase( elemContent, KRead ) == 0 ) + { + param->iCreateAsUnread = EFalse; + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMessagingEntryMessagesViaScript, param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + else + { + if( iLoopIndex < msgAmount ) + { + TInt randMsg = 0; + if( msgType == KSms ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntrySMSInbox, ECmdCreateRandomEntrySMSSent); + else if( msgType == KMms ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryMMSInbox, ECmdCreateRandomEntryMMSSent); + else if( msgType == KAms ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryAMSInbox, ECmdCreateRandomEntryAMSSent); + else if( msgType == KEmail ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryEmailInbox, ECmdCreateRandomEntryEmailSent); + else if( msgType == KSmart ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryBIOInbox, ECmdCreateRandomEntryBIOSent); + else if( msgType == KBt ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryBTInbox, ECmdCreateRandomEntryBTSent); + else if( msgType == KIr ) + randMsg = iEngine->RandomNumber(ECmdCreateRandomEntryIRInbox, ECmdCreateRandomEntryIRSent); + + if( randMsg > 0 ) + { + iEngine->AppendToCommandArrayL(randMsg, 0, 1); + } + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + } void CCreatorMessageElement::ExecuteCommandL() { LOGSTRING("Creator: CCreatorMessageElement::ExecuteCommandL"); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_model.cpp --- a/creator/src/creator_model.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_model.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -57,10 +57,13 @@ // --------------------------------------------------------------------------- -CCreatorEngine::CCreatorEngine() -: -CActive(0) -{} +CCreatorEngine::CCreatorEngine() : + CActive(0), + iAsyncRunScript( CActive::EPriorityStandard ) + { + TCallBack asyncRunScriptCB( AsyncRunScriptCB, this ); + iAsyncRunScript.Set( asyncRunScriptCB ); + } // --------------------------------------------------------------------------- @@ -696,6 +699,25 @@ iTimer.Cancel(); } +// ---------------------------------------------------------------------------- +// CCreatorEngine::AsyncRunScript +// CallBack for an asynchronous call of RunScriptL +// ---------------------------------------------------------------------------- +// +TInt CCreatorEngine::AsyncRunScriptCB( TAny* aObject ) + { + TRAPD( err, static_cast( aObject )->RunScriptL() ); + return err; + } + +// --------------------------------------------------------------------------- + +void CCreatorEngine::AsyncRunScript() + { + LOGSTRING("Creator: CCreatorEngine::AsyncRunScript"); + iAsyncRunScript.CallBack(); + } + // --------------------------------------------------------------------------- void CCreatorEngine::RunScriptL() diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_noteelement.cpp --- a/creator/src/creator_noteelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_noteelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -43,6 +43,76 @@ iIsCommandElement = ETrue; } +void CCreatorNoteElement::AsyncExecuteCommandL() + { + const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); + TInt noteAmount = 1; + if( amountAttr ) + { + noteAmount = ConvertStrToIntL(amountAttr->Value()); + } + // Get 'fields' element + CCreatorScriptElement* fieldsElement = FindSubElement(KFields); + if( fieldsElement && fieldsElement->SubElements().Count() > 0) + { + // Get sub-elements + const RPointerArray& fields = fieldsElement->SubElements(); + // Create note entries, the amount of entries is defined by noteAmount: + if( iLoopIndex < noteAmount ) + { + CNotepadParameters* param = new (ELeave) CNotepadParameters; + CleanupStack::PushL(param); + + for( TInt i = 0; i < fields.Count(); ++i ) + { + CCreatorScriptElement* field = fields[i]; + TPtrC elemName = field->Name(); + TPtrC elemContent = field->Content(); + const CCreatorScriptAttribute* randomAttr = fields[i]->FindAttributeByName(KRandomLength); + TBool useMax = EFalse; + if( randomAttr && randomAttr->Value() == KMax ) + { + useMax = ETrue; + } + + if( elemName == KText ) + { + if( randomAttr || elemContent.Length() == 0 ) + { + if( useMax ) + { + TDesC* temp = iEngine->CreateRandomStringLC(KNotepadFieldLength); + SetContentToTextParamL(param->iNoteText, *temp); + CleanupStack::PopAndDestroy(); // temp + } + else + { + SetContentToTextParamL(param->iNoteText, iEngine->RandomString(CCreatorEngine::EMessageText)); + } + } + else + { + SetContentToTextParamL(param->iNoteText, elemContent); + } + } + } + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryNotes, param); + CleanupStack::Pop(); // param + StartNextLoop(); + } + else + { + AsyncCommandFinished(); + } + } + else + { + iEngine->AppendToCommandArrayL(ECmdCreateMiscEntryNotes, 0, noteAmount); + // signal end of the executing command + AsyncCommandFinished(); + } + } + void CCreatorNoteElement::ExecuteCommandL() { const CCreatorScriptAttribute* amountAttr = FindAttributeByName(KAmount); diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_scriptelement.cpp --- a/creator/src/creator_scriptelement.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_scriptelement.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -387,6 +387,51 @@ return iIsCommandElement; } +void CCreatorScriptElement::AsyncExecuteCommandAndWaitL() + { + iAsyncCallback.Cancel(); + iLoopIndex = 0; + iAsyncOpError = KErrNone; + // start async executing + iAsyncCallback.CallBack(); + // wait until async executing is finished + iWaiter.Start(); + User::LeaveIfError( iAsyncOpError ); + } + +TInt CCreatorScriptElement::ExecuteCommandCB( TAny* aPtr ) + { + static_cast( aPtr )->AsyncExecuteCommand(); + return KErrNone; + } + +void CCreatorScriptElement::AsyncExecuteCommand() + { + TRAPD( err, AsyncExecuteCommandL() ); + if( err != KErrNone ) + { + iAsyncOpError = err; + iAsyncCallback.Cancel(); + iWaiter.AsyncStop(); + } + } + +void CCreatorScriptElement::AsyncExecuteCommandL() + { + User::Panic(_L("CCreatorScriptElement::AsyncExecuteCommandL not written"), -1000); + } + +void CCreatorScriptElement::StartNextLoop() + { + iLoopIndex++; + iAsyncCallback.CallBack(); + } + +void CCreatorScriptElement::AsyncCommandFinished() + { + iWaiter.AsyncStop(); + } + void CCreatorScriptElement::ExecuteCommandL() { @@ -400,12 +445,15 @@ return EFalse; } -CCreatorScriptElement::CCreatorScriptElement(CCreatorEngine* aEngine) -: -iIsCommandElement(EFalse), -iIsRoot(EFalse), -iEngine(aEngine) - {} +CCreatorScriptElement::CCreatorScriptElement(CCreatorEngine* aEngine) : + iIsCommandElement(EFalse), + iIsRoot(EFalse), + iEngine(aEngine), + iAsyncCallback( CActive::EPriorityLow ) + { + TCallBack callback( ExecuteCommandCB, this); + iAsyncCallback.Set( callback ); + } void CCreatorScriptElement::ConstructL(const TDesC& aName, const TDesC& aContext) { @@ -693,29 +741,3 @@ iIsRoot=ETrue; } - -CCreatorCalendarElementBase* CCreatorCalendarElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) - { - CCreatorCalendarElementBase* self = new (ELeave) CCreatorCalendarElementBase(aEngine); - CleanupStack::PushL(self); - self->ConstructL(aName, aContext); - CleanupStack::Pop(); - return self; - } -CCreatorCalendarElementBase::CCreatorCalendarElementBase(CCreatorEngine* aEngine) -: -CCreatorScriptElement(aEngine) - { } - -CCreatorMessageElementBase* CCreatorMessageElementBase::NewL(CCreatorEngine* aEngine, const TDesC& aName, const TDesC& aContext) - { - CCreatorMessageElementBase* self = new (ELeave) CCreatorMessageElementBase(aEngine); - CleanupStack::PushL(self); - self->ConstructL(aName, aContext); - CleanupStack::Pop(); - return self; - } -CCreatorMessageElementBase::CCreatorMessageElementBase(CCreatorEngine* aEngine) -: -CCreatorScriptElement(aEngine) - { } diff -r f8280f3bfeb7 -r 9b2cffad4b5e creator/src/creator_scriptparser.cpp --- a/creator/src/creator_scriptparser.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/creator/src/creator_scriptparser.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -316,7 +316,11 @@ // Execute the command if this is a command element: if( elementInfo.iElement->IsCommandElement() ) { + #if(!defined __SERIES60_30__ && !defined __SERIES60_31__) + elementInfo.iElement->AsyncExecuteCommandAndWaitL(); + #else elementInfo.iElement->ExecuteCommandL(); + #endif } // Remove element from the stack: diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/data/memspyui.rss --- a/memspyui/data/memspyui.rss Tue Sep 14 21:20:12 2010 +0300 +++ b/memspyui/data/memspyui.rss Wed Sep 15 12:13:45 2010 +0300 @@ -35,7 +35,7 @@ // User includes -#include "MemSpy.hrh" +#include "../ui/avkon/inc/MemSpy.hrh" RESOURCE RSS_SIGNATURE { } @@ -220,9 +220,9 @@ items= { MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralSummary; txt = "Summary"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralDetailed; txt = "Detailed Info"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralHandles; txt = "Handle Info"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralKernelContainers; txt = "Kernel Containers"; } + MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralDetailed; txt = "Detailed Info"; }//, + //MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralHandles; txt = "Handle Info"; }, + //MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneralKernelContainers; txt = "Kernel Containers"; } }; } @@ -278,7 +278,7 @@ - +/* RESOURCE MENU_PANE r_memspy_menupane_process_sort { items= @@ -292,7 +292,6 @@ }; } - RESOURCE MENU_PANE r_memspy_menupane_process_info { items= @@ -301,6 +300,7 @@ MENU_ITEM { command = EMemSpyCmdProcessInfoHandles; txt = "Handles"; } }; } +*/ RESOURCE MENU_PANE r_memspy_menupane_process_end @@ -318,11 +318,11 @@ { items= { - MENU_ITEM { command = EMemSpyCmdProcessInfo; txt = "Info"; cascade = r_memspy_menupane_process_info; }, - MENU_ITEM { command = EMemSpyCmdProcessSort; txt = "Sort"; cascade = r_memspy_menupane_process_sort; }, - MENU_ITEM { command = EMemSpyCmdProcessEnd; txt = "End"; cascade = r_memspy_menupane_process_end; } + //MENU_ITEM { command = EMemSpyCmdProcessInfo; txt = "Info"; cascade = r_memspy_menupane_process_info; }, + //MENU_ITEM { command = EMemSpyCmdProcessSort; txt = "Sort"; cascade = r_memspy_menupane_process_sort; }, + MENU_ITEM { command = EMemSpyCmdProcessEnd; txt = "End"; cascade = r_memspy_menupane_process_end; } }; - } + } @@ -354,7 +354,7 @@ }; } - +/* RESOURCE MENU_PANE r_memspy_menupane_thread_info { items= @@ -362,7 +362,7 @@ MENU_ITEM { command = EMemSpyCmdThreadInfoHandles; txt = "Handles"; } }; } - +*/ RESOURCE MENU_PANE r_memspy_menupane_thread_end { @@ -379,7 +379,7 @@ { items= { - MENU_ITEM { command = EMemSpyCmdThreadInfo; txt = "Info"; cascade = r_memspy_menupane_thread_info; }, + //MENU_ITEM { command = EMemSpyCmdThreadInfo; txt = "Info"; cascade = r_memspy_menupane_thread_info; }, MENU_ITEM { command = EMemSpyCmdThreadSetPriority; txt = "Change Priority"; cascade = r_memspy_menupane_thread_priority; }, MENU_ITEM { command = EMemSpyCmdThreadEnd; txt = "End"; cascade = r_memspy_menupane_thread_end; } }; @@ -1019,7 +1019,7 @@ id = EAknMessageQueryContentId; control = AVKON_MESSAGE_QUERY { - message = "Version 1.2.1 - 15th June 2010. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; + message = "Version 2.1.0 - 15th June 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; }; } }; diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/group/MemSpyCapabilities.mmh --- a/memspyui/group/MemSpyCapabilities.mmh Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -CAPABILITY ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/group/bld.inf --- a/memspyui/group/bld.inf Tue Sep 14 21:20:12 2010 +0300 +++ b/memspyui/group/bld.inf Wed Sep 15 12:13:45 2010 +0300 @@ -11,44 +11,20 @@ * * Contributors: * -* Description: +* Description: * */ - #include -#include "../memspywindowserverhelper/group/bld.inf" -PRJ_EXPORTS -../data/MemSpyEComInterfaceIds.xml z:/private/2002129F/memspyecominterfaceids.xml -../data/MemSpyProcessMemoryTrackingAutoStartConfig.xml z:/private/2002129F/memspyprocessmemorytrackingautostartconfig.xml -../data/backup_registration.xml z:/private/2002129F/backup_registration.xml -../rom/memspyui.iby CORE_IBY_EXPORT_PATH(tools,memspyui.iby) +prj_platforms - -PRJ_MMPFILES -memspyui.mmp - -#ifndef SBSV2 - gnumakefile memspyui_icons_aif.mk +WINSCW GCCE ARMV5 ARMV6 - #ifdef MARM - gnumakefile memspyui_stub_sis.mk - #endif -#endif +#include "bld_generic.inf" + +#include "../ui/avkon/group/bld.inf" -#ifdef SBSV2 - PRJ_EXTENSIONS - START EXTENSION s60/mifconv - OPTION TARGETFILE memspyui_aif.mif - OPTION SOURCEDIR ../icons - OPTION SOURCES -c8,8 qgn_menu_memspyui - END +prj_mmpfiles - #ifdef MARM - START EXTENSION app-services/buildstubsis - OPTION SRCDIR ../sis - OPTION SISNAME MemSpy_stub - END - #endif -#endif +prj_extensions \ No newline at end of file diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/group/bld_generic.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/group/bld_generic.inf Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include "../memspywindowserverhelper/group/bld.inf" + +PRJ_EXPORTS +../data/MemSpyEComInterfaceIds.xml z:/private/2002129F/memspyecominterfaceids.xml +../data/MemSpyProcessMemoryTrackingAutoStartConfig.xml z:/private/2002129F/memspyprocessmemorytrackingautostartconfig.xml +../data/backup_registration.xml z:/private/2002129F/backup_registration.xml +../rom/memspyui.iby CORE_IBY_EXPORT_PATH(tools,memspyui.iby) + +#ifndef SBSV2 + gnumakefile memspyui_icons_aif.mk + + #ifdef MARM + gnumakefile memspyui_stub_sis.mk + #endif +#endif + +#ifdef SBSV2 + PRJ_EXTENSIONS + START EXTENSION s60/mifconv + OPTION TARGETFILE memspyui_aif.mif + OPTION SOURCEDIR ../icons + OPTION SOURCES -c8,8 qgn_menu_memspyui + END + + #ifdef MARM + START EXTENSION app-services/buildstubsis + OPTION SRCDIR ../sis + OPTION SISNAME MemSpy_stub + END + #endif +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/group/group.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/group/group.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,20 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = subdirs + +BLD_INF_RULES.prj_platforms += "$${LITERAL_HASH}include \"bld_generic.inf\"" diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/group/memspyui.mmp --- a/memspyui/group/memspyui.mmp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include -#include -#include - -TARGET memspyui.exe -TARGETTYPE exe -UID 0x100039CE 0x2002129F -VENDORID VID_DEFAULT -SMPSAFE - -EPOCSTACKSIZE 0x4000 -EPOCHEAPSIZE 0x100000 0x4000000 - -#include "MemSpyCapabilities.mmh" - -SOURCEPATH ../source -source MemSpyApp.cpp -source MemSpyAppUi.cpp -source MemSpyDocument.cpp -source MemSpyContainer.cpp -source MemSpyDeviceWideOperationDialog.cpp -source MemSpyExportBitmapsToMemoryCardDialog.cpp -source MemSpyUiUtils.cpp -source MemSpySettings.cpp -// -source MemSpyViewBase.cpp -source MemSpyViewMainMenu.cpp -source MemSpyViewType.cpp -source MemSpyViewProcesses.cpp -source MemSpyViewServerList.cpp -source MemSpyViewOpenFiles.cpp -source MemSpyViewRAMInfo.cpp -source MemSpyViewROMInfo.cpp -source MemSpyViewFBServBitmaps.cpp -source MemSpyViewSystemConfig.cpp -source MemSpyViewCodeSegList.cpp -source MemSpyViewChunkList.cpp -source MemSpyViewKernel.cpp -source MemSpyViewKernelContainers.cpp -source MemSpyViewKernelHeap.cpp -source MemSpyViewDriveInfo.cpp -source MemSpyViewECom.cpp -source MemSpyViewThreads.cpp -source MemSpyViewThreadInfoItemList.cpp -source MemSpyViewThreadInfoItemGeneric.cpp -source MemSpyViewThreadInfoItemHeap.cpp -source MemSpyViewThreadInfoItemStack.cpp -source MemSpyViewThreadInfoItemCodeSeg.cpp -source MemSpyViewThreadInfoItemChunk.cpp -source MemSpyViewThreadInfoItemServer.cpp -source MemSpyViewThreadInfoItemActiveObject.cpp -source MemSpyViewThreadInfoItemGeneralInfo.cpp -source MemSpyViewHeapTracking.cpp -source MemSpyViewHeapTrackingResults.cpp -source MemSpyViewHeapTrackingSettings.cpp -source MemSpyViewThreadInfoItemMemoryTracking.cpp -source MemSpyViewMemoryTrackingAutoStartConfig.cpp -source MemSpyViewWindowGroups.cpp -source MemSpyViewKernelObjects.cpp - -USERINCLUDE ../include - -APP_LAYER_SYSTEMINCLUDE - - -START RESOURCE ../data/memspyui.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -END - -START RESOURCE ../data/memspyui_reg.rss -DEPENDS memspyui.rsg -TARGETPATH /private/10003a3f/apps -END - - -LIBRARY fbscli.lib imageconversion.lib estor.lib apgrfx.lib -LIBRARY euser.lib apparc.lib cone.lib eikcore.lib -LIBRARY eikcoctl.lib avkon.lib etext.lib eikctl.lib -LIBRARY efsrv.lib bafl.lib egul.lib hal.lib -LIBRARY cdlengine.lib xmlframework.lib charconv.lib viewcli.lib -LIBRARY eikdlg.lib ws32.lib bitgdi.lib - -LIBRARY memspydriverclient.lib -LIBRARY memspyengine.lib - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpy.hrh --- a/memspyui/include/MemSpy.hrh Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPY_HRH -#define MEMSPY_HRH - -#define KMemSpyMenuCommandBase 50000 -#define KMemSpyMenuCommandViewSpecific (KMemSpyMenuCommandBase + 10000) - -enum TMemSpyCommandIds - { - //////////////////////////////// - // GENERIC MENU COMMANDS - //////////////////////////////// - EMemSpyCmdOpen = KMemSpyMenuCommandBase, - // - EMemSpyCmdView, - EMemSpyCmdViewRefresh, - EMemSpyCmdViewOutputToSink, - // - EMemSpyCmdTools, - EMemSpyCmdToolsListOpenFiles, - EMemSpyCmdToolsAbout, - // - EMemSpyCmdPhoneInfo, - EMemSpyCmdPhoneInfoGeneral, - EMemSpyCmdPhoneInfoGeneralSummary, - EMemSpyCmdPhoneInfoGeneralDetailed, - EMemSpyCmdPhoneInfoGeneralHandles, - EMemSpyCmdPhoneInfoGeneralKernelContainers, - EMemSpyCmdPhoneInfoHeap, - EMemSpyCmdPhoneInfoHeapInfoSummary, - EMemSpyCmdPhoneInfoHeapInfoCompact, - EMemSpyCmdPhoneInfoHeapCellListing, - EMemSpyCmdPhoneInfoHeapDump, - EMemSpyCmdPhoneInfoStack, - EMemSpyCmdPhoneInfoStackInfo, - EMemSpyCmdPhoneInfoStackInfoCompact, - EMemSpyCmdPhoneInfoStackDumpUser, - EMemSpyCmdPhoneInfoStackDumpKernel, - // - EMemSpyCmdAutoCapture, - EMemSpyCmdAutoCaptureToggle, - EMemSpyCmdAutoCaptureRetryTime, - EMemSpyCmdAutoCaptureOperationType, - - //////////////////////////////// - // VIEW SPECIFIC MENU COMMANDS - //////////////////////////////// - EMemSpyCmdProcess = KMemSpyMenuCommandViewSpecific, - EMemSpyCmdProcessInfo, - EMemSpyCmdProcessInfoSummary, - EMemSpyCmdProcessInfoHandles, - EMemSpyCmdProcessSort, - EMemSpyCmdProcessSortById, - EMemSpyCmdProcessSortByName, - EMemSpyCmdProcessSortByThreadCount, - EMemSpyCmdProcessSortByCodeSegs, - EMemSpyCmdProcessSortByHeapUsage, - EMemSpyCmdProcessSortByStackUsage, - EMemSpyCmdProcessEnd, - EMemSpyCmdProcessEndKill, - EMemSpyCmdProcessEndPanic, - EMemSpyCmdProcessEndTerminate, - // - EMemSpyCmdThread, - EMemSpyCmdThreadEnd, - EMemSpyCmdThreadEndKill, - EMemSpyCmdThreadEndPanic, - EMemSpyCmdThreadEndTerminate, - EMemSpyCmdThreadSetPriority, - EMemSpyCmdThreadSetPriorityAbsoluteVeryLow, - EMemSpyCmdThreadSetPriorityAbsoluteLowNormal, - EMemSpyCmdThreadSetPriorityAbsoluteLow, - EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal, - EMemSpyCmdThreadSetPriorityAbsoluteBackground, - EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal, - EMemSpyCmdThreadSetPriorityAbsoluteForeground, - EMemSpyCmdThreadSetPriorityAbsoluteHighNormal, - EMemSpyCmdThreadSetPriorityAbsoluteHigh, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime1, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime2, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime3, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime4, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime5, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime6, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime7, - EMemSpyCmdThreadSetPriorityAbsoluteRealTime8, - EMemSpyCmdThreadInfo, - EMemSpyCmdThreadInfoHandles, - // - EMemSpyCmdOutput, - EMemSpyCmdOutputToDebug, - EMemSpyCmdOutputToFile, - // - EMemSpyCmdHeap, - EMemSpyCmdHeapInfoThread, - EMemSpyCmdHeapData, - EMemSpyCmdHeapCellListing, - EMemSpyCmdHeapDataDump, - // - EMemSpyCmdStack, - EMemSpyCmdStackInfoThread, - EMemSpyCmdStackData, - EMemSpyCmdStackDataUser, - EMemSpyCmdStackDataKernel, - // - EMemSpyCmdChunk, - EMemSpyCmdChunkSort, - EMemSpyCmdChunkSortByName, - EMemSpyCmdChunkSortBySize, - EMemSpyCmdChunkListing, - // - EMemSpyCmdCodeSeg, - EMemSpyCmdCodeSegShow, - EMemSpyCmdCodeSegShowItemsAll, - EMemSpyCmdCodeSegShowItemsGlobalData, - EMemSpyCmdCodeSegShowCaps, - EMemSpyCmdCodeSegShowCapsWithTCBProcess, - EMemSpyCmdCodeSegShowCapsWithTCBAll, - EMemSpyCmdCodeSegShowCapsWithCommDDProcess, - EMemSpyCmdCodeSegShowCapsWithCommDDAll, - EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess, - EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll, - EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess, - EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll, - EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess, - EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll, - EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess, - EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll, - EMemSpyCmdCodeSegShowCapsWithDRMProcess, - EMemSpyCmdCodeSegShowCapsWithDRMAll, - EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess, - EMemSpyCmdCodeSegShowCapsWithTrustedUIAll, - EMemSpyCmdCodeSegShowCapsWithProtServProcess, - EMemSpyCmdCodeSegShowCapsWithProtServAll, - EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess, - EMemSpyCmdCodeSegShowCapsWithDiskAdminAll, - EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess, - EMemSpyCmdCodeSegShowCapsWithNetworkControlAll, - EMemSpyCmdCodeSegShowCapsWithAllFilesProcess, - EMemSpyCmdCodeSegShowCapsWithAllFilesAll, - EMemSpyCmdCodeSegShowCapsWithSwEventProcess, - EMemSpyCmdCodeSegShowCapsWithSwEventAll, - EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess, - EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll, - EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess, - EMemSpyCmdCodeSegShowCapsWithLocalServicesAll, - EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess, - EMemSpyCmdCodeSegShowCapsWithReadUserDataAll, - EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess, - EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll, - EMemSpyCmdCodeSegShowCapsWithLocationProcess, - EMemSpyCmdCodeSegShowCapsWithLocationAll, - EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess, - EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll, - EMemSpyCmdCodeSegShowCapsWithUserEnvProcess, - EMemSpyCmdCodeSegShowCapsWithUserEnvAll, - EMemSpyCmdCodeSegSort, - EMemSpyCmdCodeSegSortByName, - EMemSpyCmdCodeSegSortByCodeSize, - EMemSpyCmdCodeSegSortByDataSize, - EMemSpyCmdCodeSegSortByUid, - EMemSpyCmdCodeSegListing, - // - EMemSpyCmdImages, - EMemSpyCmdImagesSlideshow, - EMemSpyCmdImagesSaveAllToMemoryCard, - EMemSpyCmdImagesListing, - // - EMemSpyCmdActiveObject, - EMemSpyCmdActiveObjectListing, - // - EMemSpyCmdServerList, - EMemSpyCmdServerListOutput, - EMemSpyCmdServerListOutputListCSV, - EMemSpyCmdServerListOutputListDetailed, - EMemSpyCmdServerListSort, - EMemSpyCmdServerListSortByName, - EMemSpyCmdServerListSortBySessionCount, - // - EMemSpyCmdKernelContainers, - EMemSpyCmdKernelContainersOutput, - EMemSpyCmdKernelObjects, - EMemSpyCmdKernelObjectTerminate, - EMemSpyCmdKernelObjectSwitchTo, - EMemSpyCmdKernelObjectEnd, - EMemSpyCmdKernelObjectPanic, - - // - EMemSpyCmdKernelHeap, - EMemSpyCmdKernelHeapDump, - // - EMemSpyCmdRAM, - EMemSpyCmdRAMAvkonIconCacheDisabled, - EMemSpyCmdRAMAvkonIconCacheEnabled, - // - EMemSpyCmdBTrace, - EMemSpyCmdBTraceCaptureToggle, - // - EMemSpyCmdMemoryTracking, - EMemSpyCmdMemoryTrackingStart, - EMemSpyCmdMemoryTrackingStop, - EMemSpyCmdMemoryTrackingAutoStart, - EMemSpyCmdMemoryTrackingAutoStartItemAdd, - EMemSpyCmdMemoryTrackingAutoStartItemEdit, - EMemSpyCmdMemoryTrackingAutoStartItemDelete, - EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll, - EMemSpyCmdMemoryTrackingAutoStartItemImport, - EMemSpyCmdMemoryTrackingHWM, - EMemSpyCmdMemoryTrackingHWMReset, - EMemSpyCmdMemoryTrackingTotalWithSharedMem, - EMemSpyCmdMemoryTrackingTotalWithoutSharedMem, - - // - EMemSpyCmdWindowGroups, - EMemSpyCmdWindowGroupTerminate, - EMemSpyCmdWindowGroupSwitchTo, - EMemSpyCmdWindowGroupEnd, - EMemSpyCmdWindowGroupPanic - }; - -enum TMemSpyControlIds - { - EMemSpyCtrlIdProgressNote = 1000, - EMemSpyCtrlIdSlideShowImage, - EMemSpyCtrlIdWaitNote - }; - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyApp.h --- a/memspyui/include/MemSpyApp.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYAPP_H -#define MEMSPYAPP_H - -// System includes -#include - -// Constants -const TUid KUidMemSpy = { 0x2002129F }; - - -class CMemSpyApp : public CAknApplication - { -private: // From CApaApplication - CApaDocument* CreateDocumentL(); - TUid AppDllUid() const; - }; - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyAppUi.h --- a/memspyui/include/MemSpyAppUi.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYAPPUI_H -#define MEMSPYAPPUI_H - -// System includes -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyDeviceWideOperationDialog.h" -#include "MemSpyContainerObserver.h" -#include - -// Classes referenced -class CEikMenuBar; -class CMemSpyEngine; -class CMemSpyContainer; -class CMemSpyDocument; - - -class CMemSpyAppUi : public CAknAppUi, public MMemSpyContainerObserver, public MCoeControlObserver, public MMemSpyEngineObserver, public MMemSpyDeviceWideOperationDialogObserver - { -public: - CMemSpyAppUi( CMemSpyEngine& aEngine ); - ~CMemSpyAppUi(); - void ConstructL(); - -public: // API - CMemSpyDocument& MemSpyDocument(); - const CMemSpyDocument& MemSpyDocument() const; - inline CMemSpyContainer& Container() { return *iAppContainer; } - -private: // From Avkon - void HandleStatusPaneSizeChange(); - -private: // From MCoeControlObserver - void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); - -private: // From MEikMenuObserver - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: // From CEikAppUi - void HandleForegroundEventL(TBool aForeground); - void HandleCommandL(TInt aCommand); - TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - -private: // From MMemSpyContainerObserver - void HandleThreadSelectedL( const CMemSpyThread& aThread ); - -private: // From MMemSpyEngineObserver - void HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext ); - -private: // From MMemSpyDeviceWideOperationDialogObserver - void DWOperationStarted(); - void DWOperationCancelled(); - void DWOperationCompleted(); - -private: // Internal methods - void UpdateCBAL(); - void InitiateMemSpyClientServerOperationL( TInt aOpCode ); - void SetViewServerTimeOutStatus( TBool aEnabled ); - -private: // Command handlers - void OnCmdBackL(); - void OnCmdExitL(); - void OnCmdOpenL(); - void OnCmdAboutL(); - - // Output - void OnCmdOutputToDebugL(); - void OnCmdOutputToFileL(); - - // Phone-information - void OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp ); - void OnCmdPhoneInformationOperationKernelContainersL(); - - // Automatic capture - void OnCmdAutoCaptureToggleL(); - void OnCmdAutoCaptureRetryTimeL(); - void OnCmdAutoCaptureOperationTypeL(); - - // Misc - void OnCmdToolsBitmapsSaveToMemoryCardL(); - void OnCmdToolsSendToBackgroundL(); - void OnCmdToolsBringToForegroundL(); - -private: // Auto capture related - static TInt AutoCaptureCallBack( TAny* aSelf ); - void AutoCaptureCallBackL(); - -private: // Member data - CMemSpyEngine& iEngine; - CMemSpyContainer* iAppContainer; - - // For phone information dialog - TBool iRunningDeviceWideOperation; - - // For auto-capture - TInt iAutoCaptureTimerPeriod; - CMemSpyDeviceWideOperations::TOperation iAutoCaptureOperationType; - CPeriodic* iAutoCaptureTimer; - }; - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyContainer.h --- a/memspyui/include/MemSpyContainer.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYCONTAINER_H -#define MEMSPYCONTAINER_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" -#include "MemSpyViewObserver.h" - -// Classes referenced -class CMemSpyEngine; -class CMemSpyProcess; -class CMemSpyThread; -class CMemSpyThreadInfoItemBase; -class CMemSpyEngineObjectContainer; -class MMemSpyContainerObserver; - - -class CMemSpyContainer : public CCoeControl, public MMemSpyViewObserver - { -public: - CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver ); - ~CMemSpyContainer(); - void ConstructL( const TRect& aRect ); - -public: // API - inline TMemSpyViewType ActiveViewType() const { return iActiveView->ViewType(); } - inline CMemSpyViewBase& ActiveView() const { return *iActiveView; } - -public: // API - void NavigateToParentViewL(); - void NavigateToChildViewL(); - void HandleCommandL( TInt aCommand ); - void SetNewActiveViewL( CMemSpyViewBase* aNewView ); - -public: // Command handlers - void OnCmdViewRefreshL(); - -private: // From CCoeControl - void SizeChanged(); - TInt CountComponentControls() const; - CCoeControl* ComponentControl(TInt aIndex) const; - void Draw(const TRect& aRect) const; - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - -private: // From MMemSpyViewObserver - void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext ); - -private: // Internal methods - CMemSpyViewBase* PrepareTopLevelViewL(); - -private: // Member data - CMemSpyEngine& iEngine; - MMemSpyContainerObserver& iObserver; - CMemSpyViewBase* iActiveView; - CMemSpyViewBase* iPreviousView; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyContainerObserver.h --- a/memspyui/include/MemSpyContainerObserver.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYCONTAINEROBSERVER_H -#define MEMSPYCONTAINEROBSERVER_H - -// Classes referenced -class CMemSpyThread; - - -class MMemSpyContainerObserver - { -public: - virtual void HandleThreadSelectedL( const CMemSpyThread& aThread ) = 0; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyDeviceWideOperationDialog.h --- a/memspyui/include/MemSpyDeviceWideOperationDialog.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYDEVICEWIDEOPERATIONDIALOG_H -#define MEMSPYDEVICEWIDEOPERATIONDIALOG_H - -// System includes -#include -#include - -// Engine includes -#include - -// Classes referenced -class CMemSpyEngine; - -class MMemSpyDeviceWideOperationDialogObserver - { -public: - virtual void DWOperationStarted() = 0; - virtual void DWOperationCancelled() = 0; - virtual void DWOperationCompleted() = 0; - }; - - -class CMemSpyDeviceWideOperationDialog : public CBase, public MProgressDialogCallback, public MMemSpyDeviceWideOperationsObserver - { -public: - static void ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation ); - ~CMemSpyDeviceWideOperationDialog(); - -private: - CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver ); - void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation ); - -public: // API - void Cancel(); - -private: // From MProgressDialogCallback - void DialogDismissedL( TInt aButtonId ); - -private: // From MMemSpyDeviceWideOperationsObserver - void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 ); - -private: // Internal methods - void SetDialogCaptionL( const TDesC& aText ); - -private: // Member data - CMemSpyEngine& iEngine; - MMemSpyDeviceWideOperationDialogObserver& iObserver; - TBool iForcedCancel; - CEikProgressInfo* iProgressInfo; - CAknProgressDialog* iProgressDialog; - CMemSpyDeviceWideOperations* iOperation; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyDocument.h --- a/memspyui/include/MemSpyDocument.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYDOCUMENT_H -#define MEMSPYDOCUMENT_H - -// System includes -#include - -// Classes referenced -class CMemSpyEngine; -class CEikAppUi; -class CMemSpySettings; - - -class CMemSpyDocument : public CAknDocument - { -public: // Constructors and destructor - static CMemSpyDocument* NewL(CEikApplication& aApp); - ~CMemSpyDocument(); - -private: - CMemSpyDocument(CEikApplication& aApp); - void ConstructL(); - -public: - CMemSpyEngine& Engine(); - const CMemSpyEngine& Engine() const; - CMemSpySettings& Settings(); - const CMemSpySettings& Settings() const; - -private: // Framework - CEikAppUi* CreateAppUiL(); - -private: // Data members - CMemSpyEngine* iEngine; - CMemSpySettings* iSettings; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyExportBitmapsToMemoryCardDialog.h --- a/memspyui/include/MemSpyExportBitmapsToMemoryCardDialog.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H -#define MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H - -// System includes -#include -#include -#include - -// Classes referenced -class CMemSpyEngineFbServBitmap; -class CMemSpyEngineFbServBitmapArray; - - - -class CMemSpyExportBitmapsToMemoryCardDialog : public CActive, public MProgressDialogCallback - { -public: - static CMemSpyExportBitmapsToMemoryCardDialog* NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ); - ~CMemSpyExportBitmapsToMemoryCardDialog(); - -private: - CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ); - void ConstructL(); - -public: // API - void Cancel(); - static TBool CheckMemoryCardAvailableL( RFs& aFsSession ); - -private: // From CActive - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - -private: // From MProgressDialogCallback - void DialogDismissedL( TInt aButtonId ); - -private: // Internal methods - void CompleteSelf( TInt aError ); - void ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap ); - void IdentifyBmpMimeTypeL(); - void PruneExistingBitmapFilesL(); - void PrepareFolderNameSpecL(); - TBool TryToExportSingleBitmapL(); - -private: // Member data - RFs& iFsSession; - const CMemSpyEngineFbServBitmapArray& iBitmaps; - TInt iBitmapIndex; - TBool iDialogDismissed; - CEikProgressInfo* iProgressInfo; - CAknProgressDialog* iProgressDialog; - CImageEncoder* iEncoder; - HBufC8* iBmpMimeType; - HBufC* iFolderName; - RFileExtensionMIMETypeArray iMimeTypeArray; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpySettings.h --- a/memspyui/include/MemSpySettings.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYSETTINGS_H -#define MEMSPYSETTINGS_H - -// System includes -#include -#include -#include - -// Engine includes -#include - -// Classes referenced -class CMemSpyEngine; - - -class CMemSpySettings : public CBase - { -public: - static CMemSpySettings* NewL( RFs& aFsSession, CMemSpyEngine& aEngine ); - ~CMemSpySettings(); - -private: - CMemSpySettings( RFs& aFsSession, CMemSpyEngine& aEngine ); - void ConstructL(); - -public: // API - inline RFs& FsSession() { return iFsSession; } - void StoreSettingsL(); - -private: // Settings methods - void RestoreSettingsL(); - void GetSettingsFileNameL( TDes& aFileName ); - void GetSettingsPathL( TDes& aPath ); - RFile SettingsFileLC( TBool aReplace = EFalse ); - -private: // Data members - RFs& iFsSession; - CMemSpyEngine& iEngine; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyUiUtils.h --- a/memspyui/include/MemSpyUiUtils.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYUIUTILS_H -#define MEMSPYUIUTILS_H - -// System includes -#include - -// Engine includes -#include - - -class MemSpyUiUtils : public MemSpyEngineUtils - { -public: - static void Format( TDes& aBuf, TInt aResourceId, ...); - static void GetErrorText( TDes& aBuf, TInt aError ); - }; - - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewBase.h --- a/memspyui/include/MemSpyViewBase.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWBASE_H -#define MEMSPYVIEWBASE_H - -// System includes -#include -#include -#include - -// User includes -#include "MemSpy.hrh" -#include "MemSpyViewType.h" -#include "MemSpyViewObserver.h" -#include "MemSpySettings.h" - -// Classes referenced -class CMemSpyEngine; -class CMemSpyContainer; -class MMemSpyViewObserver; - - -class CMemSpyViewBase : public CCoeControl, public MCoeControlObserver, public MEikListBoxObserver - { -public: - CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewBase(); - virtual void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // API - virtual TMemSpyViewType ViewType() const = 0; - virtual CMemSpyViewBase* PrepareParentViewL(); - virtual CMemSpyViewBase* PrepareChildViewL(); - virtual void RefreshL(); - virtual TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - virtual TUint MenuCascadeResourceId() const; - virtual TInt MenuCascadeCommandId() const; - -private: // Command handlers - virtual void OnCmdViewOutputToSinkL(); - -protected: // Construction support - void SetTitleL( const TDesC& aText ); - TPtrC TitleL() const; - virtual CEikListBox* ConstructListBoxL(); - virtual void SetListBoxModelL() = 0; - -protected: // Internal framework - virtual void HandleListBoxItemActionedL( TInt aIndex ); - virtual void HandleListBoxItemSelectedL( TInt aIndex ); - -protected: // Event reporting - void ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext = NULL ); - void SetListBoxCurrentItemIndexL( TInt aIndex ); - -protected: // Utility methods - CMemSpyContainer& Container(); - CMemSpySettings& Settings(); - const CMemSpySettings& Settings() const; - -public: // From CCoeControl - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - -protected: // From CCoeControl - void Draw( const TRect& aRect ) const; - void SizeChanged(); - void FocusChanged( TDrawNow aDrawNow ); - TInt CountComponentControls() const; - CCoeControl* ComponentControl( TInt aIndex ) const; - -protected: // From MCoeControlObserver - void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ); - -protected: // From MEikListBoxObserver - void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType); - -protected: // Member data - CMemSpyEngine& iEngine; - MMemSpyViewObserver& iObserver; - // - CEikListBox* iListBox; - -private: - CMemSpySettings* iSettings; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewChunkList.h --- a/memspyui/include/MemSpyViewChunkList.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWCHUNKLIST_H -#define MEMSPYVIEWCHUNKLIST_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyEngineChunkList; -class CMemSpyEngineChunkEntry; - - - - -class CMemSpyViewChunkBase : public CMemSpyViewBase - { -public: - CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList ); - ~CMemSpyViewChunkBase(); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CHUNK_LIST; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdChunk; } - -protected: // Command handlers - void OnCmdListingL(); - -protected: // Data members - CMemSpyEngineChunkList* iList; - }; - - - - -class CMemSpyViewChunkList : public CMemSpyViewChunkBase - { -public: - CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // Data members - CMemSpyEngineChunkEntry* iCurrentChunk; - }; - - - -class CMemSpyViewChunkDetails : public CMemSpyViewChunkBase - { -public: - CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Data members - CMemSpyEngineChunkEntry& iChunk; - }; - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewCodeSegList.h --- a/memspyui/include/MemSpyViewCodeSegList.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,125 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWCODESEGLIST_H -#define MEMSPYVIEWCODESEGLIST_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyEngineCodeSegList; -class CMemSpyEngineCodeSegEntry; - - -class CMemSpyViewCodeSegBase : public CMemSpyViewBase - { -public: - CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList ); - ~CMemSpyViewCodeSegBase(); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - void RefreshL(); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CODESEG_LIST; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdCodeSeg; } - -protected: // Command handlers - void OnCmdCodeSegmentListingL(); - void OnCmdShowItemsAllL(); - void OnCmdShowItemsGlobalDataL(); - void OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries ); - -protected: // Data members - CMemSpyEngineCodeSegList* iList; - }; - - - - -class CMemSpyViewCodeSegList : public CMemSpyViewCodeSegBase - { -public: - CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // Data members - CMemSpyEngineCodeSegEntry* iCurrentCodeSegment; - }; - - - -class CMemSpyViewCodeSegDetails : public CMemSpyViewCodeSegBase - { -public: - CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Data members - CMemSpyEngineCodeSegEntry& iCodeSegment; - }; - - - - - - -class TMemSpyViewCodeSegFilter - { -public: - inline TMemSpyViewCodeSegFilter( TCapability aCapability, TBool aAllBinaries = ETrue ) - : iCapability( aCapability ), iAllBinaries( aAllBinaries ) - { - } - -public: - static TBool FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune ); - -private: - TCapability iCapability; - TBool iAllBinaries; - }; - - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewDriveInfo.h --- a/memspyui/include/MemSpyViewDriveInfo.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWDRIVEINFO_H -#define MEMSPYVIEWDRIVEINFO_H - -// System includes -#include -#include - -// Engine includes -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - - - -class CMemSpyViewDriveInfoBase : public CMemSpyViewBase - { -public: - CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewDriveInfoBase(); - void BaseConstructL(); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - -protected: // Data members - CMemSpyEngineDriveList* iList; - }; - - - - -class CMemSpyViewDriveList : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveListObserver - { -public: - CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void RefreshL(); - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // From MMemSpyEngineDriveListObserver - void HandleDriveListChangedL( const CMemSpyEngineDriveList& aList ); - -private: // Data members - TBool iUseDriveNumber; - TDriveNumber iDriveNumber; - CMemSpyEngineDriveEntry* iCurrentDrive; - }; - - - -class CMemSpyViewDriveInfo : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveEntryObserver - { -public: - CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // From MMemSpyEngineDriveEntryObserver - void HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& aEntry ); - -private: // Data members - const TDriveNumber iDriveNumber; - CMemSpyEngineDriveEntry* iDriveInfo; - }; - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewECom.h --- a/memspyui/include/MemSpyViewECom.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWECOM_H -#define MEMSPYVIEWECOM_H - -// System includes -#include -#include -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Engine includes -#include - - -class CMemSpyViewECom : public CMemSpyViewBase - { -public: - CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // Data members - CMemSpyEngineEComCategory* iCurrent; - }; - - - -class CMemSpyViewEComCategory : public CMemSpyViewBase - { -public: - CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // Data members - CMemSpyEngineEComCategory& iCategory; - CMemSpyEngineEComInterface* iCurrent; - }; - - - - -class CMemSpyViewEComInterface : public CMemSpyViewBase - { -public: - CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // Data members - CMemSpyEngineEComInterface& iInterface; - CMemSpyEngineEComImplementation* iCurrent; - }; - - - - - - -class CMemSpyViewEComImplementation : public CMemSpyViewBase - { -public: - CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Data members - CMemSpyEngineEComImplementation& iImplementation; - }; - - - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewFBServBitmaps.h --- a/memspyui/include/MemSpyViewFBServBitmaps.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWFBSERVBITMAPS_H -#define MEMSPYVIEWFBSERVBITMAPS_H - -// System includes -#include -#include -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Engine includes -#include - - - -class CMemSpyViewFBServBase : public CMemSpyViewBase - { -public: - CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ); - ~CMemSpyViewFBServBase(); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_IMAGES; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdImages; } - -protected: // Command handlers - void OnCmdSlideShowL(); - void OnCmdExportToMemoryCardL(); - void OnCmdImageListingL(); - -protected: // Data members - CMemSpyEngineFbServBitmapArray* iBitmaps; - }; - - - - - -class CMemSpyViewFBServBitmaps : public CMemSpyViewFBServBase, public MMemSpyEngineFbSerbBitmapArrayObserver - { -public: - CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ); - ~CMemSpyViewFBServBitmaps(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From MMemSpyEngineFbSerbBitmapArrayObserver - void HandleFbServBitmapArrayEventL( TEvent aEvent ); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // Idle timer update - static TInt IdleUpdateListBoxModel( TAny* aSelf ); - void DoIdleUpdateListBoxModelL(); - -private: // Data members - RArray iBitmapHandles; - CMemSpyEngineFbServBitmap* iCurrentBitmap; - CPeriodic* iIdleResetListboxTimer; - }; - - - -class CMemSpyViewFBServBitmapInfo : public CMemSpyViewFBServBase - { -public: - CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - -private: // Data members - CMemSpyEngineFbServBitmap& iBitmapObject; - }; - - - - -class CMemSpyViewFBServBitmapViewer : public CMemSpyViewFBServBase - { -public: - CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ); - ~CMemSpyViewFBServBitmapViewer(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - CEikListBox* ConstructListBoxL(); - -private: // From CCoeControl - void Draw(const TRect& aRect) const; - void SizeChanged(); - TInt CountComponentControls() const; - CCoeControl* ComponentControl( TInt aIndex ) const; - -private: // Data members - CMemSpyEngineFbServBitmap& iBitmapObject; - CEikImage* iImage; - TRect iBorderRect; - }; - - - - - -class CMemSpyViewFBServSlideshow : public CAknDialog - { -public: - static void NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ); - ~CMemSpyViewFBServSlideshow(); - -private: - CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ); - void ConstructL(); - -private: - void PreLayoutDynInitL(); - TBool OkToExitL(TInt aButtonId); - -private: // Idle timer update - static TInt IdleUpdate( TAny* aSelf ); - void ShowNextImageL(); - -private: // Data members - CMemSpyEngineFbServBitmapArray& iBitmaps; - TInt& iIndex; - CPeriodic* iTimer; - }; - - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewHeapTracking.h --- a/memspyui/include/MemSpyViewHeapTracking.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWHEAPTRACKING_H -#define MEMSPYVIEWHEAPTRACKING_H - -// System includes -#include -#include -#include - -// Engine includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewHeapTracking : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver - { -public: - CMemSpyViewHeapTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewHeapTracking(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -public: - static TInt AsyncStopTimerCallback( TAny* aParam ); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // From MMemSpyEngineHelperSysMemTrackerObserver - void HandleCyclesResetL(); - void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - -private: // Internal methods - TInt IndexByViewType( TMemSpyViewType aType ); - void SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig ); - TInt AsyncStopTimerCallback(); - -private: // Enum - enum TMemSpyViewHeapTrackingState - { - EMemSpyViewHeapTrackingStateIdle = 0, - EMemSpyViewHeapTrackingStateTimerOn, - EMemSpyViewHeapTrackingStateSingleOn - }; - -private: // Data - TMemSpyEngineHelperSysMemTrackerConfig iOriginalConfig; - TMemSpyViewHeapTrackingState iState; - CAsyncCallBack* iStopTimerCallBack; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewHeapTrackingResults.h --- a/memspyui/include/MemSpyViewHeapTrackingResults.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWHEAPTRACKINGRESULTS_H -#define MEMSPYVIEWHEAPTRACKINGRESULTS_H - -// System includes -#include -#include -#include - -// Engine includes -#include - -// Driver includes -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyEngineHelperSysMemTrackerCycle; -class CMemSpyEngineHelperSysMemTrackerCycleChange; - - -class CMemSpyViewHeapTrackingResults : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver - { -public: - CMemSpyViewHeapTrackingResults( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewHeapTrackingResults(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // From MMemSpyEngineHelperSysMemTrackerObserver - void HandleCyclesResetL(); - void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - }; - - - - - - - -class CMemSpyViewHeapTrackingResultsCycleInfo : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver - { -public: - CMemSpyViewHeapTrackingResultsCycleInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - ~CMemSpyViewHeapTrackingResultsCycleInfo(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // From MMemSpyEngineHelperSysMemTrackerObserver - void HandleCyclesResetL(); - void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - -private: // Data members - const CMemSpyEngineHelperSysMemTrackerCycle& iCycle; - }; - - - - - -/* -class CMemSpyViewHeapTrackingResultsChangeDescriptor : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver - { -public: - CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex ); - ~CMemSpyViewHeapTrackingResultsChangeDescriptor(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // From MMemSpyEngineHelperSysMemTrackerObserver - void HandleCyclesResetL(); - void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); - -private: // Data members - const CMemSpyEngineHelperSysMemTrackerCycle& iCycle; - const CMemSpyEngineHelperSysMemTrackerCycleChange& iChangeDescriptor; - TInt iIndex; // For selection rune when moving to parent view - }; -*/ - - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewHeapTrackingSettings.h --- a/memspyui/include/MemSpyViewHeapTrackingSettings.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWHEAPTRACKINGSETTINGS_H -#define MEMSPYVIEWHEAPTRACKINGSETTINGS_H - -// System includes -#include -#include -#include -#include -#include -#include - - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewHeapTrackingSettings : public CMemSpyViewBase - { -public: - CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewHeapTrackingSettings(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Internal methods - static void PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected ); - }; - - - - -class CSWMTCategorySelectionCheckBoxSettingItem : public CAknSettingItem - { -public: - CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories ); - virtual ~CSWMTCategorySelectionCheckBoxSettingItem(); - -public: - CSelectionItemList* ItemArray() const; - -protected: - void CompleteConstructionL(); - void StoreL(); - void LoadL(); - void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ); - -private: - void AddNewItemToArrayL(const TDesC& aLabel); - -private: - CSelectionItemList* iItemArray; - HBufC* iSettingText; - TInt& iExtCategories; - }; - - - - - - -class CMemSpySWMTCategorySelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage - { - public: - CMemSpySWMTCategorySelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray ); - public: // New functions - void UpdateCba(); - }; - - - - - - -class CMemSpyAllowEmptyDataDialog : public CAknTextQueryDialog - { - public: - CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone = ENoTone ); - protected: // from CAknTextQueryDialog - void UpdateLeftSoftKeyL(); - }; - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewKernel.h --- a/memspyui/include/MemSpyViewKernel.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWKERNEL_H -#define MEMSPYVIEWKERNEL_H - -// System includes -#include -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewKernel : public CMemSpyViewBase - { -public: - CMemSpyViewKernel( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewKernel(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Internal methods - static TInt IndexByViewType( TMemSpyViewType aType ); - -private: // Data members - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewKernelContainers.h --- a/memspyui/include/MemSpyViewKernelContainers.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWKERNELCONTAINERS_H -#define MEMSPYVIEWKERNELCONTAINERS_H - -// System includes -#include -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyEngineGenericKernelObjectContainer; - - -class CMemSpyViewKernelContainers : public CMemSpyViewBase - { -public: - CMemSpyViewKernelContainers( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewKernelContainers(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_CONTAINERS; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelContainers; } - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - TBool HandleCommandL( TInt aCommand ); - -private: // Command handlers - void OnCmdOutputAllContainerContentsL(); - -private: // Internal methods - -private: // Data members - CMemSpyEngineGenericKernelObjectContainer* iModel; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewKernelHeap.h --- a/memspyui/include/MemSpyViewKernelHeap.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWKERNELHEAP_H -#define MEMSPYVIEWKERNELHEAP_H - -// System includes -#include -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyEngineGenericKernelObjectContainer; - - -class CMemSpyViewKernelHeap : public CMemSpyViewBase - { -public: - CMemSpyViewKernelHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewKernelHeap(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_HEAP; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelHeap; } - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - TBool HandleCommandL( TInt aCommand ); - -private: // Command handlers - void OnCmdDumpKernelHeapL(); - -private: // Internal methods - -private: // Data members - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewKernelObjects.h --- a/memspyui/include/MemSpyViewKernelObjects.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWKERNELOBJECTS_H -#define MEMSPYVIEWKERNELOBJECTS_H - -// System includes -#include -#include -#include -#include - -// User includes -#include "MemSpyViewBase.h" -#include - -// Classes referenced -class CMemSpyEngineGenericKernelObjectContainer; -class CMemSpyEngineGenericKernelObjectList; -class CAknNavigationDecorator; -class CAknNavigationControlContainer; -class CAknTabGroup; - - -class CMemSpyViewKernelObjects : public CMemSpyViewBase, public MAknTabObserver - { -public: - CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType ); - ~CMemSpyViewKernelObjects(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - CEikListBox* ConstructListBoxL(); - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_OBJECTS; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelObjects; } - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - TBool HandleCommandL( TInt aCommand ); - -private: // From CCoeControl - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - -private: // From MAknTabObserver - void TabChangedL( TInt aIndex ); - -private: // Command handlers - void OnCmdTerminateL(); - void OnCmdSwitchToL(); - void OnCmdEndL(); - void OnCmdPanicL(); - -private: // Internal methods - void CreateTabsL(); - void DetailsL(); - void AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ); - -private: // Data members - CMemSpyEngineGenericKernelObjectContainer* iModel; - CDesCArrayFlat* iItems; - TMemSpyDriverContainerType iObjectType; - CMemSpyEngineGenericKernelObjectList* iObjectList; - CAknNavigationDecorator* iNavDecorator; - CAknNavigationControlContainer* iNavContainer; - CAknTabGroup* iTabs; - TInt iCurrItemIndex; - }; - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewMainMenu.h --- a/memspyui/include/MemSpyViewMainMenu.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWMAINMENU_H -#define MEMSPYVIEWMAINMENU_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyProcess; - - -class CMemSpyViewMainMenu : public CMemSpyViewBase - { -public: - CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Internal methods - static TInt IndexByViewType( TMemSpyViewType aType ); - -private: // Data members - }; - - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewMemoryTrackingAutoStartConfig.h --- a/memspyui/include/MemSpyViewMemoryTrackingAutoStartConfig.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H -#define MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H - -// System includes -#include -#include -#include -#include // MContentHandler mix in class -#include - -// User includes -#include "MemSpyViewBase.h" - -// Literal constants -_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigSearchPath, "E:\\MemSpy\\" ); -_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, "MemSpyProcessMemoryTrackingAutoStartConfig.xml" ); - -// Classes referenced -class CCnvCharacterSetConverter; - -// Namespaces referenced -using namespace Xml; - - -class CMemSpyViewMemoryTrackingAutoStartConfig : public CMemSpyViewBase, public MContentHandler - { -public: - CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewMemoryTrackingAutoStartConfig(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - TBool HandleCommandL( TInt aCommand ); - void HandleListBoxItemActionedL( TInt aIndex ); - void SetListBoxModelL(); - void RefreshL(); - -public: // Menu framework - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - TUint MenuCascadeResourceId() const; - TInt MenuCascadeCommandId() const; - -private: // Command handlers - void OnCmdItemAddL(); - void OnCmdItemEditL(); - void OnCmdItemDeleteL(); - void OnCmdItemDeleteAllL(); - void OnCmdItemImportL(); - -private: // Internal methods - TUid ShowDialogL( TUid aUid ); - void SaveChangesL(); - static TUid ValidateProcessUid( const TDesC& aUid ); - -private: // Internal XML methods - void FindXmlInstallTimeL(); - void FindXmlUserSuppliedL(); - HBufC* FindEComXmlFileNameLC(); - void ConvertL( const TDesC8& aInput, TDes16& aOutput ); - void ParseL( const TDesC& aFileName ); - -private: // XML helper functions - void OnSectionProcessL( const RAttributeArray& aAttributes ); - -private: // From MContentHandler - void OnStartDocumentL( const RDocumentParameters& aDocParam, TInt aErrorCode ); - void OnEndDocumentL( TInt aErrorCode ); - void OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode ); - void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode ); - void OnContentL( const TDesC8& aBytes, TInt aErrorCode ); - void OnStartPrefixMappingL( const RString& aPrefix, const RString& aUri, TInt aErrorCode ); - void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode ); - void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode ); - void OnSkippedEntityL( const RString& aName, TInt aErrorCode ); - void OnProcessingInstructionL( const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode ); - void OnError( TInt aErrorCode ); - TAny* GetExtendedInterface( const TInt32 aUid ); - -private: // Data members - RArray< TUid > iProcessUids; - TInt iParserErrorCode; - TInt iCharconvConverterState; - TBool iSeenMasterSection; - CParser* iParser; - CCnvCharacterSetConverter* iConverter; - HBufC* iXMLFileNameInstallTime; - HBufC* iXMLFileNameUserSupplied; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewObserver.h --- a/memspyui/include/MemSpyViewObserver.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWOBSERVER_H -#define MEMSPYVIEWOBSERVER_H - -// User includes -#include "MemSpyViewType.h" - -// Classes referenced -class CMemSpyViewBase; - -class MMemSpyViewObserver - { -public: // Enumerations - enum TViewEventType - { - EEventItemActioned = 0, - EEventItemSelected - }; - -public: // From MMemSpyViewObserver - virtual void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext ) = 0; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewOpenFiles.h --- a/memspyui/include/MemSpyViewOpenFiles.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWOPENFILES_H -#define MEMSPYVIEWOPENFILES_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewOpenFiles : public CMemSpyViewBase - { -public: - CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewOpenFiles(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - CEikListBox* ConstructListBoxL(); - void RefreshL(); - TBool HandleCommandL( TInt aCommand ); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // Command handlers - void OnCmdListOpenFilesL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aCurrentIndex ); - -private: // Internal - static TBool CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight ); - -private: // Data members - RArray iThreadIds; - const TThreadId* iActionedThreadId; - RArray iFileNames; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewProcesses.h --- a/memspyui/include/MemSpyViewProcesses.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWPROCESSES_H -#define MEMSPYVIEWPROCESSES_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyProcess; -class CAknSearchField; - - -class CMemSpyViewProcesses : public CMemSpyViewBase - { -public: - CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ); - ~CMemSpyViewProcesses(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // API - CMemSpyProcess& CurrentProcess() const; - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_PROCESS; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdProcess; } - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: // Command handlers - - // Sorting - void OnCmdSortByIdL(); - void OnCmdSortByNameL(); - void OnCmdSortByThreadCountL(); - void OnCmdSortByCodeSegsL(); - void OnCmdSortByHeapUsageL(); - void OnCmdSortByStackUsageL(); - - // Info - void OnCmdInfoSummaryL(); - void OnCmdInfoHandlesL(); - - // Ending - void OnCmdEndTerminateL(); - void OnCmdEndPanicL(); - void OnCmdEndKillL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aIndex ); - void HandleListBoxItemSelectedL( TInt aIndex ); - -private: // From CCoeControl - void SizeChanged(); - TInt CountComponentControls() const; - CCoeControl* ComponentControl( TInt aIndex ) const; - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); - void FocusChanged( TDrawNow /*aDrawNow*/ ); - -private: // From MCoeControlObserver - void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); - -private: // Internal methods - void SelectListBoxItemByFindTextL(); - -private: // Data members - CMemSpyProcess* iCurrentProcess; - CAknSearchField* iSearchField; - HBufC* iMatcherBuffer; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewRAMInfo.h --- a/memspyui/include/MemSpyViewRAMInfo.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWRAMINFO_H -#define MEMSPYVIEWRAMINFO_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewRAMInfo : public CMemSpyViewBase - { -public: - CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_RAM; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdRAM; } - -private: // Command handlers - void OnCmdSetIconCacheStatusL( TBool aEnabled ); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Data members - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewROMInfo.h --- a/memspyui/include/MemSpyViewROMInfo.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWROMINFO_H -#define MEMSPYVIEWROMINFO_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewROMInfo : public CMemSpyViewBase - { -public: - CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Data members - }; - - -#endif - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewServerList.h --- a/memspyui/include/MemSpyViewServerList.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWSERVERLIST_H -#define MEMSPYVIEWSERVERLIST_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyEngineServerList; -class CMemSpyEngineServerEntry; - - -class CMemSpyViewServerList : public CMemSpyViewBase - { -public: - CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewServerList(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_SERVER_LIST; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdServerList; } - -private: // Command handlers - void OnCmdServerListSortByNameL(); - void OnCmdServerListSortBySessionCountL(); - void OnCmdServerListOutputSummaryL(); - void OnCmdServerListOutputDetailedL(); - void OnCmdServerListOutputGenericL( TBool aDetailed ); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aCurrentIndex ); - -private: // Data members - CMemSpyEngineServerList* iList; - const CMemSpyEngineServerEntry* iActionedItem; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewSystemConfig.h --- a/memspyui/include/MemSpyViewSystemConfig.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWSYSTEMCONFIG_H -#define MEMSPYVIEWSYSTEMCONFIG_H - -// System includes -#include -#include -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewSystemConfig : public CMemSpyViewBase - { -public: - CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewSystemConfig(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Internal enumerations - - enum TMemSpyDisplayMode - { - ENone, - EGray2, - EGray4, - EGray16, - EGray256, - EColor16, - EColor256, - EColor64K, - EColor16M, - ERgb, - EColor4K, - EColor16MU, - EColor16MA, - EColor16MAP, - EColorLast - }; - -private: // Internal methods - static void GetManufacturer( TDes& aBuf ); - static void GetDeviceFamily( TDes& aBuf ); - static void GetCPU( TDes& aBuf ); - static void GetCPUABI( TDes& aBuf ); - static void GetStartupReason( TDes& aBuf ); - static void GetKeyboard( TDes& aBuf ); - static void GetMachineUid( TDes& aBuf ); - static void GetDisplayType( TDes& aBuf ); - static void GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode ); - // - static TInt GetHALValue( HALData::TAttribute aAttribute, TInt& aValue ); - TInt GetHALValueAsStringL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); - TInt GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL, TInt aWidth = -1 ); - TInt GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); - TInt GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); - TInt GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); - -private: - void AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix = NULL ); - void AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix = NULL ); - -private: // Data members - CDesCArrayFlat* iModel; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemActiveObject.h --- a/memspyui/include/MemSpyViewThreadInfoItemActiveObject.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H -#define MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - -// Classes referenced -class CMemSpyEngineActiveObjectArray; - - - -class CMemSpyViewThreadInfoItemActiveObjectBase : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemActiveObjectBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_ACTIVE_OBJECTS; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdActiveObject; } - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -protected: - CMemSpyEngineActiveObjectArray& ActiveObjectArray() const; - -private: // Command handlers - void OnCmdWriteAOListingL(); - }; - - - -class CMemSpyViewThreadInfoItemActiveObject : public CMemSpyViewThreadInfoItemActiveObjectBase - { -public: - CMemSpyViewThreadInfoItemActiveObject( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareChildViewL(); - }; - - - - -class CMemSpyViewThreadInfoItemActiveObjectDetails : public CMemSpyViewThreadInfoItemActiveObjectBase - { -public: - CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress ); - -public: // From CMemSpyViewBase - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Data members - TAny* iObjectAddress; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemChunk.h --- a/memspyui/include/MemSpyViewThreadInfoItemChunk.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMCHUNK_H -#define MEMSPYVIEWTHREADINFOITEMCHUNK_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - - -class CMemSpyViewThreadInfoItemChunk : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemChunk( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - -private: // From CMemSpyViewBase - CMemSpyViewBase* PrepareChildViewL(); - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemCodeSeg.h --- a/memspyui/include/MemSpyViewThreadInfoItemCodeSeg.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMCODESEG_H -#define MEMSPYVIEWTHREADINFOITEMCODESEG_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - - -class CMemSpyViewThreadInfoItemCodeSeg : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemCodeSeg( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - -private: // From CMemSpyViewBase - CMemSpyViewBase* PrepareChildViewL(); - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemGeneralInfo.h --- a/memspyui/include/MemSpyViewThreadInfoItemGeneralInfo.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMGENERALINFO_H -#define MEMSPYVIEWTHREADINFOITEMGENERALINFO_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - - -class CMemSpyViewThreadInfoItemGeneralInfo : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemGeneralInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - void HandleListBoxItemActionedL( TInt aCurrentIndex ); - -private: // Command handlers - void OnCmdToggleKernelEventHooksL(); - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemGeneric.h --- a/memspyui/include/MemSpyViewThreadInfoItemGeneric.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMGENERIC_H -#define MEMSPYVIEWTHREADINFOITEMGENERIC_H - -// System includes -#include -#include - -// Engine includes -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CAknWaitDialog; -class CMemSpyProcess; -class CMemSpyThread; -class CMemSpyThreadInfoContainer; -class CMemSpyThreadInfoItemBase; - - -class CMemSpyViewThreadInfoItemGeneric : public CMemSpyViewBase - { -public: - CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType ); - ~CMemSpyViewThreadInfoItemGeneric(); - -public: // From CMemSpyViewBase - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // API - CMemSpyProcess& Process() const; - CMemSpyThread& Thread() const; - CMemSpyThreadInfoContainer& Container() const; - CMemSpyThreadInfoItemBase& InfoItem() const; - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - TBool HandleCommandL( TInt aCommand ); - -protected: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aCurrentIndex ); - void HandleListBoxItemSelectedL( TInt aCurrentIndex ); - -private: // Internal methods - void ShowWaitNoteL(); - void DestroyWaitNote(); - static TInt CheckForItemConstructionComplete( TAny* aSelf ); - -protected: // Member data - CMemSpyThreadInfoContainer& iContainer; - CMemSpyThreadInfoItemBase* iInfoItem; - -private: // Member data - CAknWaitDialog* iWaitNote; - CPeriodic* iWaitConstructionChecker; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemHeap.h --- a/memspyui/include/MemSpyViewThreadInfoItemHeap.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMHEAP_H -#define MEMSPYVIEWTHREADINFOITEMHEAP_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - - -class CMemSpyViewThreadInfoItemHeap : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_HEAP; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdHeap; } - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: // Command handlers - void OnCmdHeapDataL(); - void OnCmdHeapCellListingL(); - void OnCmdHeapInfoL(); - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemList.h --- a/memspyui/include/MemSpyViewThreadInfoItemList.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMLIST_H -#define MEMSPYVIEWTHREADINFOITEMLIST_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" -#include - -// Classes referenced -class CMemSpyProcess; -class CMemSpyThread; -class CMemSpyThreadInfoItemBase; - - -class CMemSpyViewThreadInfoItemList : public CMemSpyViewBase, public MMemSpyThreadInfoContainerObserver - { -public: - CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread ); - ~CMemSpyViewThreadInfoItemList(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // API - const CMemSpyProcess& Process() const; - const CMemSpyThread& Thread() const; - const CMemSpyThreadInfoItemBase& CurrentInfoItem() const; - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; } - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: // Command handlers - void OnCmdInfoHandlesL(); - -private: // From MMemSpyThreadInfoContainerObserver - void HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType ); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aCurrentIndex ); - void HandleListBoxItemSelectedL( TInt aCurrentIndex ); - static TInt IdleUpdateListBoxModel( TAny* aSelf ); - void DoIdleUpdateListBoxModelL(); - -private: // Member data - CMemSpyThread& iThread; - CMemSpyThreadInfoItemBase* iCurrentInfoItem; - CPeriodic* iIdleResetListboxTimer; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemMemoryTracking.h --- a/memspyui/include/MemSpyViewThreadInfoItemMemoryTracking.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H -#define MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H - -// System includes -#include -#include - -// Engine includes -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - -// Classes referenced -class CMemSpyEngineProcessMemoryTracker; - - -class CMemSpyViewThreadInfoItemMemoryTracking : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver - { -public: - CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - TBool HandleCommandL( TInt aCommand ); - TInt IndexByViewType( TMemSpyViewType aType ); - void HandleListBoxItemActionedL( TInt aIndex ); - void RefreshL(); - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTracking; } - -private: // From MMemSpyEngineProcessMemoryTrackerObserver - void HandleMemoryTrackingStartedL(); - void HandleMemoryTrackingStoppedL(); - void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); - -private: // Command handlers - void OnCmdTrackingStartL(); - void OnCmdTrackingStopL(); - void OnCmdHWMResetL(); - void OnCmdTotalWithSharedMemL(); - void OnCmdTotalWithoutSharedMemL(); - }; - - -class CMemSpyViewThreadInfoItemMemoryTrackingCurrent : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver - { -public: - CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - void RefreshL(); - void SetListBoxModelL(); - -private: // From MMemSpyEngineProcessMemoryTrackerObserver - void HandleMemoryTrackingStartedL() { } - void HandleMemoryTrackingStoppedL() { } - void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); - }; - - - -class CMemSpyViewThreadInfoItemMemoryTrackingHWM : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver - { -public: - CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - TBool HandleCommandL( TInt aCommand ); - void RefreshL(); - void SetListBoxModelL(); - -private: // From MMemSpyEngineProcessMemoryTrackerObserver - void HandleMemoryTrackingStartedL() { } - void HandleMemoryTrackingStoppedL() { } - void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING_HWM; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTrackingHWM; } - -private: // Command handlers - void OnCmdHWMResetL(); - }; - - - - -class CMemSpyViewThreadInfoItemMemoryTrackingPeak : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver - { -public: - CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - TBool HandleCommandL( TInt aCommand ); - void RefreshL(); - void SetListBoxModelL(); - -private: // From MMemSpyEngineProcessMemoryTrackerObserver - void HandleMemoryTrackingStartedL() { } - void HandleMemoryTrackingStoppedL() { } - void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); - }; - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemServer.h --- a/memspyui/include/MemSpyViewThreadInfoItemServer.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMSERVER_H -#define MEMSPYVIEWTHREADINFOITEMSERVER_H - -// System includes -#include -#include -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - -// Classes referenced -class TMemSpyDriverHandleInfoGeneric; - - - -class CMemSpyViewThreadInfoItemServer : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemServer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - -public: // From CMemSpyViewBase - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - void HandleListBoxItemSelectedL( TInt aCurrentIndex ); - -public: // From CMemSpyViewBase - CMemSpyViewBase* PrepareChildViewL(); - -private: // Data members - TMemSpyDriverHandleInfoGeneric iCurrentInfoItemDetails; - }; - - - -class CMemSpyViewThreadInfoItemServerDetails : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ); - -public: // From CMemSpyViewBase - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareChildViewL(); - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aCurrentIndex ); - void HandleListBoxItemSelectedL( TInt aCurrentIndex ); - -private: // Internal methods - -private: // Member data - const TMemSpyDriverHandleInfoGeneric iInfoItemDetails; - }; - - - -class CMemSpyViewThreadInfoItemServerSessions : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ); - -public: // From CMemSpyViewBase - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - -private: // Member data - const TMemSpyDriverHandleInfoGeneric iInfoItemDetails; - }; - - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreadInfoItemStack.h --- a/memspyui/include/MemSpyViewThreadInfoItemStack.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADINFOITEMSTACK_H -#define MEMSPYVIEWTHREADINFOITEMSTACK_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewThreadInfoItemGeneric.h" - - -class CMemSpyViewThreadInfoItemStack : public CMemSpyViewThreadInfoItemGeneric - { -public: - CMemSpyViewThreadInfoItemStack( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); - -public: // From CMemSpyViewBase - TBool HandleCommandL( TInt aCommand ); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_STACK; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdStack; } - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -private: // Command handlers - void OnCmdDeviceStackSummaryL(); - void OnCmdStackInfoL(); - void OnCmdStackDataUserL(); - void OnCmdStackDataKernelL(); - void OnCmdStackDataUserAllThreadsL(); - void OnCmdStackDataKernelAllThreadsL(); - void OnCmdStackWatchForHighWatermarkL(); - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewThreads.h --- a/memspyui/include/MemSpyViewThreads.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTHREADS_H -#define MEMSPYVIEWTHREADS_H - -// System includes -#include -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced -class CMemSpyProcess; -class CMemSpyThread; - - -class CMemSpyViewThreads : public CMemSpyViewBase - { -public: - CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ); - ~CMemSpyViewThreads(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // API - const CMemSpyProcess& Process() const; - CMemSpyThread& CurrentThread(); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; } - void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); - -public: // From CMemSpyViewBase - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - TBool HandleCommandL( TInt aCommand ); - -private: // Command handlers - void OnCmdEndKillL(); - void OnCmdEndTerminateL(); - void OnCmdEndPanicL(); - void OnCmdSetPriorityL( TInt aCommand ); - void OnCmdInfoHandlesL(); - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - void HandleListBoxItemActionedL( TInt aCurrentIndex ); - void HandleListBoxItemSelectedL( TInt aCurrentIndex ); - -private: // Member data - CMemSpyProcess& iParentProcess; - CMemSpyThread* iCurrentThread; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewType.h --- a/memspyui/include/MemSpyViewType.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWTYPE_H -#define MEMSPYVIEWTYPE_H - -// System includes -#include - -// Enumerations -enum TMemSpyViewType - { - EMemSpyViewTypeNone = -1, - EMemSpyViewTypeMainMenu = 0, - EMemSpyViewTypeProcesses, - EMemSpyViewTypeRAMInfo, - EMemSpyViewTypeROMInfo, - EMemSpyViewTypeServerList, - EMemSpyViewTypeOpenFiles, - EMemSpyViewTypeFBServBitmaps, - EMemSpyViewTypeFBServBitmapInfo, - EMemSpyViewTypeFBServBitmapViewer, - EMemSpyViewTypeCodeSegmentList, - EMemSpyViewTypeCodeSegmentDetails, - EMemSpyViewTypeChunkList, - EMemSpyViewTypeChunkDetails, - EMemSpyViewTypeSystemConfig, - EMemSpyViewTypeKernel, - EMemSpyViewTypeKernelContainers, - EMemSpyViewTypeKernelObjects, - EMemSpyViewTypeKernelHeap, - EMemSpyViewTypeDriveSummary, - EMemSpyViewTypeDriveInfo, - EMemSpyViewTypeECom, - EMemSpyViewTypeEComCategory, - EMemSpyViewTypeEComInterface, - EMemSpyViewTypeEComImplementation, - EMemSpyViewTypeThreads, - EMemSpyViewTypeThreadInfoItemList, - EMemSpyViewTypeThreadInfoItemHeap, - EMemSpyViewTypeThreadInfoItemStack, - EMemSpyViewTypeThreadInfoItemChunk, - EMemSpyViewTypeThreadInfoItemCodeSeg, - EMemSpyViewTypeThreadInfoItemServer, - EMemSpyViewTypeThreadInfoItemServerDetails, - EMemSpyViewTypeThreadInfoItemServerSessions, - EMemSpyViewTypeThreadInfoItemSession, - EMemSpyViewTypeThreadInfoItemSemaphore, - EMemSpyViewTypeThreadInfoItemMutex, - EMemSpyViewTypeThreadInfoItemTimer, - EMemSpyViewTypeThreadInfoItemLDD, - EMemSpyViewTypeThreadInfoItemPDD, - EMemSpyViewTypeThreadInfoItemLogicalChannel, - EMemSpyViewTypeThreadInfoItemChangeNotifier, - EMemSpyViewTypeThreadInfoItemUndertaker, - EMemSpyViewTypeThreadInfoItemMessageQueue, - EMemSpyViewTypeThreadInfoItemConditionalVariable, - EMemSpyViewTypeThreadInfoItemOpenFiles, - EMemSpyViewTypeThreadInfoItemActiveObject, - EMemSpyViewTypeThreadInfoItemActiveObjectDetails, - EMemSpyViewTypeThreadInfoItemGeneralInfo, - EMemSpyViewTypeThreadInfoItemOtherThreads, - EMemSpyViewTypeThreadInfoItemOtherProcesses, - EMemSpyViewTypeThreadInfoItemOwnedThreadHandles, - EMemSpyViewTypeThreadInfoItemOwnedProcessHandles, - EMemSpyViewTypeHeapTracking, - EMemSpyViewTypeHeapTrackingSettings, - EMemSpyViewTypeHeapTrackingResults, - EMemSpyViewTypeHeapTrackingResultsCycleInfo, - EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor, - EMemSpyViewTypeThreadInfoItemMemoryTracking, - EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig, - EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics, - EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent, - EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM, - EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak, - EMemSpyViewTypeWindowGroups - }; - - -class MemSpyViewTypeUtils - { -public: - static TBool IsOpenableItem( TMemSpyViewType aType ); - static TBool IsThreadInfoItem( TMemSpyViewType aType ); - static TBool IsExitableView( TMemSpyViewType aType ); - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/MemSpyViewWindowGroups.h --- a/memspyui/include/MemSpyViewWindowGroups.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef MEMSPYVIEWWINDOWGROUPS_H -#define MEMSPYVIEWWINDOWGROUPS_H - -// System includes -#include -#include -#include - -// Engine includes -#include - -// User includes -#include "MemSpyViewBase.h" - -// Classes referenced - - -class CMemSpyViewWindowGroups : public CMemSpyViewBase - { -public: - CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); - ~CMemSpyViewWindowGroups(); - void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); - -public: // From CMemSpyViewBase - CEikListBox* ConstructListBoxL(); - void RefreshL(); - TMemSpyViewType ViewType() const; - CMemSpyViewBase* PrepareParentViewL(); - CMemSpyViewBase* PrepareChildViewL(); - -public: // Menu framework - TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_WINDOW_GROUPS; } - TInt MenuCascadeCommandId() const { return EMemSpyCmdWindowGroups; } - -private: // From CMemSpyViewBase - void SetListBoxModelL(); - TBool HandleCommandL( TInt aCommand ); - -private: // Command handlers - void OnCmdSwitchToL(); - void OnCmdEndL( TInt aCommand ); - -private: // Internal methods - void DetailsL(); - void AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ); - -private: // Data members - MMemSpyEngineWindowGroupList* iWindowGroupList; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/include/viewcli.h --- a/memspyui/include/viewcli.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// - -#ifndef __VIEWCLI_H__ -#define __VIEWCLI_H__ - -#include -#include -#include - -// -// Forward declarations. -// - -class RVwsSession; -class CVwsSessionEventHandler; -class MVwsAppStarter; - -class MVwsSessionWrapperObserver -/** -The MVwsSessionObserver specifies an interface through which server events to be handled by the owner of -a client session are notified - -@publishedAll -@deprecated -*/ -//@internalTechnology @released - - { -public: - - /** - * Handles the view event aEvent for a view added through the client session being observed. - * Handles events for all the views added by the client. - */ - virtual void HandleViewEventL(const TVwsViewEvent& aEvent)=0; - }; - - -class CVwsSessionWrapper : public CBase -/** -The CVwsSessionWrapper class mediates access to the view server client session which it creates, and wraps in -support for notification of server events. A session observer will be called back with server events if -it maintains an outstanding request for asynchronous event notification. - -@publishedPartner -@released -*/ -//@internalTechnology @released - - { -public: - IMPORT_C static CVwsSessionWrapper* NewL(); - IMPORT_C static CVwsSessionWrapper* NewLC(); - IMPORT_C static CVwsSessionWrapper* NewL(MVwsSessionWrapperObserver& aObserver); - IMPORT_C static CVwsSessionWrapper* NewLC(MVwsSessionWrapperObserver& aObserver); - IMPORT_C ~CVwsSessionWrapper(); - IMPORT_C static TInt StartViewServer(MVwsAppStarter& aAppStarter); - IMPORT_C TInt ShutdownViewServer(); - IMPORT_C TInt AddView(const TVwsViewId& aViewId); - IMPORT_C TInt RemoveView(const TVwsViewId& aViewId) const; - IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId,TInt aMode); - IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId); - IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); - IMPORT_C TInt ActivateViewViaViewEvent(const TVwsViewIdAndMessage& aViewIdAndMessage); - IMPORT_C TInt RequestCustomMessage(TDes8& aMessageBufPtr) const; - IMPORT_C void QueueAsyncRequest(); - IMPORT_C TInt StartApp(TUid aAppToStart); - IMPORT_C TInt DeactivateActiveView(); - IMPORT_C TInt DeactivateActiveViewIfOwnerMatch(); - IMPORT_C TInt NotifyNextDeactivation(const TVwsViewId& aViewId); - IMPORT_C TInt NotifyNextDeactivation(); - IMPORT_C TInt NotifyNextActivation(const TVwsViewId& aViewId); - IMPORT_C TInt NotifyNextActivation(); - IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId,TInt aMode) const; - IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId) const; - IMPORT_C TInt GetSystemDefaultView(TVwsViewId& aViewId); - IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); - IMPORT_C TInt SetClientRequestTimeOut(TTimeIntervalMicroSeconds32 aDuration); - IMPORT_C TInt SetServerEventTimeOut(TTimeIntervalMicroSeconds32 aDuration); - IMPORT_C TInt EnableServerEventTimeOut(TBool aEnable); - IMPORT_C TInt CheckSourceOfViewSwitch(TBool& aResult,const TSecurityPolicy& aSecurityPolicy,const char* aDiagnostic); - IMPORT_C TInt EnableServerBlankScreen(TBool aEnable); - IMPORT_C TInt EnableExternalViewSwitches(TBool aEnable); - IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus); - IMPORT_C TInt SetCrossCheckUid(const TUid& aCrossCheckUid); - IMPORT_C TInt SetWindowBackgroundColor(const TRgb& aBgColor); -public: - /** - @internalComponent - @released - */ - IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl); - /** - @internalComponent - @released - */ - IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus, TInt aCustomControl); - /** - @internalComponent - @released - */IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl); - /** - @internalComponent - @released - */ - IMPORT_C TInt GetCurrentActiveViewInSystem(TVwsViewId& aActiveViewId); -private: - CVwsSessionWrapper(); - CVwsSessionWrapper(MVwsSessionWrapperObserver& aObserver); - void ConstructL(); - TInt CheckCreateViewServerSession(); - TBool IsSchedulerRunning(); -private: - RVwsSession* iVwsSession; - CVwsSessionEventHandler* iViewEventHandler; - MVwsSessionWrapperObserver* iObserver; - }; - - -// -// Panic. -// -/** -@internalComponent -*/ -enum TVwsPanic - { - EVwsCreateScheduler=1, - EVwsThreadRename - }; - -/** -@internalComponent -*/ -GLREF_C void Panic(TVwsPanic aPanic); - -/** -Server thread start. - -@internalComponent -*/ -GLDEF_C TInt ViewServerThreadStart(TAny* aPtr); - -/** -@internalComponent -*/ -struct SVwsCommandLine - { - MVwsAppStarter* iAppStarter; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/memspyui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/memspyui.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,23 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = subdirs + +DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG + +SUBDIRS = group \ + ui/hb diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/rom/memspyui.iby --- a/memspyui/rom/memspyui.iby Tue Sep 14 21:20:12 2010 +0300 +++ b/memspyui/rom/memspyui.iby Wed Sep 15 12:13:45 2010 +0300 @@ -22,11 +22,8 @@ S60_APP_EXE(MemSpyUI) S60_APP_AIF_ICONS(MemSpyUI) S60_APP_RESOURCE(MemSpyUI) -#ifdef S60_UPGRADABLE_APP_REG_RSC - S60_UPGRADABLE_APP_REG_RSC(MemSpyUI) -#else - S60_APP_AIF_RSC(MemSpyUI) -#endif +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,MemSpyUI) +data=ZPRIVATE\10003a3f\import\APPS\MemSpyUI_reg.RSC Private\10003a3f\import\Apps\MemSpyUI_reg.rsc data=ZPRIVATE\2002129F\MemSpyEComInterfaceIds.xml \private\2002129F\MemSpyEComInterfaceIds.xml diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyApp.cpp --- a/memspyui/source/MemSpyApp.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyApp.h" - -// System includes -#include - -// User includes -#include "MemSpyDocument.h" - - - -TUid CMemSpyApp::AppDllUid() const - { - return KUidMemSpy; - } - - -CApaDocument* CMemSpyApp::CreateDocumentL() - { - return CMemSpyDocument::NewL( *this ); - } - - -EXPORT_C CApaApplication* NewApplication() - { - return new CMemSpyApp; - } - - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyAppUi.cpp --- a/memspyui/source/MemSpyAppUi.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,721 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyAppUi.h" - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainer.h" -#include "MemSpyDocument.h" -#include "MemSpySettings.h" -#include "MemSpyDeviceWideOperationDialog.h" -#include "MemSpyViewRAMInfo.h" // for aknicon config check -#include "MemSpyExportBitmapsToMemoryCardDialog.h" -#include "MemSpy.hrh" -#include "viewcli.h" - -// Constants -const TInt KMemSpyDefaultAutoCaptureTimerPeriod = 60; -const TUint32 KMemSpyEikSrvSID = 0x10003a4a; - - -CMemSpyAppUi::CMemSpyAppUi( CMemSpyEngine& aEngine ) -: iEngine( aEngine ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ) - { - iEngine.SetObserver( this ); - } - - -CMemSpyAppUi::~CMemSpyAppUi() - { - RDebug::Printf( "[MemSpy] MemSpy is now closing." ); - // - delete iAutoCaptureTimer; - // - if (iAppContainer) - { - RemoveFromStack( iAppContainer ); - delete iAppContainer; - } - // - iEngine.SetObserver( NULL ); - SetViewServerTimeOutStatus( ETrue ); - } - - -void CMemSpyAppUi::ConstructL() - { - BaseConstructL( EAknEnableSkin ); - // - iAppContainer = new (ELeave) CMemSpyContainer( iEngine, *this ); - iAppContainer->SetMopParent(this); - iAppContainer->ConstructL( ClientRect() ); - iAppContainer->SetObserver( this ); - iAppContainer->SetFocus( ETrue ); - AddToStackL( iAppContainer ); - // - iAutoCaptureTimer = CPeriodic::NewL( CActive::EPriorityIdle ); - // - iEikonEnv->SetSystem( ETrue ); - // - SetViewServerTimeOutStatus( EFalse ); - } - - -CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() - { - CMemSpyDocument* doc = static_cast< CMemSpyDocument* >( Document() ); - return *doc; - } - - -const CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() const - { - const CMemSpyDocument* doc = static_cast< const CMemSpyDocument* >( Document() ); - return *doc; - } - - -void CMemSpyAppUi::HandleStatusPaneSizeChange() - { - iAppContainer->SetRect( ClientRect() ); - } - - -void CMemSpyAppUi::HandleControlEventL( CCoeControl* aControl, TCoeEvent /*aEventType*/ ) - { - if ( aControl == iAppContainer ) - { - UpdateCBAL(); - } - } - - -void CMemSpyAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - CMemSpyViewBase& view = iAppContainer->ActiveView(); - const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); - // - const TBool openableView = MemSpyViewTypeUtils::IsOpenableItem( viewType ); - const TBool exitable = MemSpyViewTypeUtils::IsExitableView( viewType ); - // -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - START - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable ); -#endif - // - if ( aResourceId == R_MEMSPY_MENUPANE ) - { - const TInt count = aMenuPane->NumberOfItemsInPane(); - for( TInt i=0; iItemDataByIndexL( i ); - - // If the command is inside the view-specific range then we'll hide it - // unless the view and command id matches. - const TBool isViewSpecific = ( menuPaneMetaData.iCommandId >= KMemSpyMenuCommandViewSpecific ); - if ( isViewSpecific ) - { - // Check whether this view requires this command item. - dimItem = ( view.MenuCascadeCommandId() != menuPaneMetaData.iCommandId ); - } - - aMenuPane->SetItemDimmed( menuPaneMetaData.iCommandId, dimItem ); - } - - aMenuPane->SetItemDimmed( EMemSpyCmdOpen, !openableView ); - aMenuPane->SetItemDimmed( EAknSoftkeyBack, exitable ); - aMenuPane->SetItemDimmed( EAknCmdExit, !exitable ); - } - else if ( aResourceId == R_MEMSPY_MENUPANE_TOOLS ) - { - const TBool inOpenFilesView = ( viewType == EMemSpyViewTypeOpenFiles ); - aMenuPane->SetItemDimmed( EMemSpyCmdToolsListOpenFiles, !inOpenFilesView ); - } - else if ( aResourceId == R_MEMSPY_MENUPANE_VIEW ) - { - // Hide the refresh item when in the thread info container view - aMenuPane->SetItemDimmed( EMemSpyCmdViewRefresh, viewType == EMemSpyViewTypeThreadInfoItemList ); - aMenuPane->SetItemDimmed( EMemSpyCmdViewOutputToSink, viewType == EMemSpyViewTypeThreadInfoItemList ); - } - else if ( aResourceId == R_MEMSPY_MENUPANE_OUTPUT ) - { - const TMemSpySinkType currentSink = iEngine.SinkType(); - aMenuPane->SetItemDimmed( EMemSpyCmdOutputToDebug, currentSink == ESinkTypeDebug ); - aMenuPane->SetItemDimmed( EMemSpyCmdOutputToFile, currentSink == ESinkTypeFile ); - } - else if ( aResourceId == R_MEMSPY_MENUPANE_AUTO_CAPTURE ) - { - // Change the auto-capture toggle caption appropriately... - TInt resId = R_MEMSPY_AUTO_CAPTURE_ENABLE; - if ( iAutoCaptureTimer->IsActive() ) - { - resId = R_MEMSPY_AUTO_CAPTURE_DISABLE; - } - aMenuPane->SetItemTextL( EMemSpyCmdAutoCaptureToggle, resId ); - } - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - sending to view..." ); -#endif - - view.DynInitMenuPaneL( aResourceId, aMenuPane ); - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - END - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable ); -#endif - } - - -TKeyResponse CMemSpyAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ ) - { - return EKeyWasNotConsumed; - } - - -void CMemSpyAppUi::HandleCommandL( TInt aCommand ) - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - START - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); -#endif - - switch ( aCommand ) - { - case EAknSoftkeyBack: - OnCmdBackL(); - break; - - case EEikCmdExit: - case EAknCmdExit: - case EAknSoftkeyExit: - OnCmdExitL(); - break; - - case EMemSpyCmdOpen: - OnCmdOpenL(); - break; - - case EMemSpyCmdOutputToDebug: - OnCmdOutputToDebugL(); - break; - case EMemSpyCmdOutputToFile: - OnCmdOutputToFileL(); - break; - - case EMemSpyCmdToolsAbout: - OnCmdAboutL(); - break; - // - case EMemSpyCmdPhoneInfoGeneralSummary: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralSummary ); - break; - case EMemSpyCmdPhoneInfoGeneralDetailed: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed ); - break; - case EMemSpyCmdPhoneInfoGeneralHandles: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralHandles ); - break; - case EMemSpyCmdPhoneInfoGeneralKernelContainers: - OnCmdPhoneInformationOperationKernelContainersL(); - break; - // - case EMemSpyCmdPhoneInfoHeapInfoSummary: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ); - break; - case EMemSpyCmdPhoneInfoHeapInfoCompact: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact ); - break; - case EMemSpyCmdPhoneInfoHeapCellListing: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapCellListing ); - break; - case EMemSpyCmdPhoneInfoHeapDump: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapData ); - break; - // - case EMemSpyCmdPhoneInfoStackInfo: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackInfo ); - break; - case EMemSpyCmdPhoneInfoStackInfoCompact: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact ); - break; - case EMemSpyCmdPhoneInfoStackDumpUser: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataUser ); - break; - case EMemSpyCmdPhoneInfoStackDumpKernel: - OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataKernel ); - break; - - case EMemSpyCmdAutoCaptureToggle: - OnCmdAutoCaptureToggleL(); - break; - case EMemSpyCmdAutoCaptureRetryTime: - OnCmdAutoCaptureRetryTimeL(); - break; - case EMemSpyCmdAutoCaptureOperationType: - OnCmdAutoCaptureOperationTypeL(); - break; - - default: - iAppContainer->HandleCommandL( aCommand ); - break; - } - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - END - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); -#endif - } - - -void CMemSpyAppUi::HandleForegroundEventL( TBool aForeground) - { - // Refresh the container when coming to the foreground - if ( aForeground ) - { - iAppContainer->OnCmdViewRefreshL(); - } - } - - -void CMemSpyAppUi::HandleThreadSelectedL( const CMemSpyThread& /*aThread*/ ) - { - MEikAppUiFactory* appUiFactory = (iEikonEnv)->AppUiFactory(); - appUiFactory->MenuBar()->TryDisplayMenuBarL(); - } - - -void CMemSpyAppUi::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext ) - { - if ( aEvent == MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged ) - { - // Get the original container - const CMemSpyEngineObjectContainer& oldContainer = *reinterpret_cast< CMemSpyEngineObjectContainer* >( aContext ); - (void) oldContainer; - - // Refresh the container - iAppContainer->OnCmdViewRefreshL(); - } - else if ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest ) - { - const TInt function = reinterpret_cast( aContext ); - InitiateMemSpyClientServerOperationL( function ); - } - } - - -void CMemSpyAppUi::DWOperationStarted() - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); -#endif - - iRunningDeviceWideOperation = ETrue; - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); -#endif - } - - -void CMemSpyAppUi::DWOperationCancelled() - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); -#endif - - iAutoCaptureTimer->Cancel(); - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); -#endif - } - - -void CMemSpyAppUi::DWOperationCompleted() - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); -#endif - - iRunningDeviceWideOperation = EFalse; - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - END - iAutoCaptureTimer is active: %d", iAutoCaptureTimer->IsActive() ); -#endif - } - - -void CMemSpyAppUi::UpdateCBAL() - { - CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); - const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); - // - if ( MemSpyViewTypeUtils::IsExitableView( viewType ) ) - { - cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_EXIT ); - } - else - { - cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); - } - - cba->MakeVisible( ETrue ); - cba->DrawNow(); - } - - -void CMemSpyAppUi::InitiateMemSpyClientServerOperationL( TInt aOpCode ) - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d", aOpCode ); -#endif - - switch( aOpCode ) - { - case EMemSpyClientServerOpSummaryInfo: - HandleCommandL( EMemSpyCmdPhoneInfoGeneralSummary ); - break; - case EMemSpyClientServerOpSummaryInfoDetailed: - HandleCommandL( EMemSpyCmdPhoneInfoGeneralDetailed ); - break; - // - case EMemSpyClientServerOpHeapInfo: - HandleCommandL( EMemSpyCmdPhoneInfoHeapInfoSummary ); - break; - case EMemSpyClientServerOpHeapCellListing: - HandleCommandL( EMemSpyCmdPhoneInfoHeapCellListing ); - break; - case EMemSpyClientServerOpHeapData: - HandleCommandL( EMemSpyCmdPhoneInfoHeapDump ); - break; - // - case EMemSpyClientServerOpStackInfo: - HandleCommandL( EMemSpyCmdPhoneInfoStackInfo ); - break; - case EMemSpyClientServerOpStackDataUser: - HandleCommandL( EMemSpyCmdPhoneInfoStackDumpUser ); - break; - case EMemSpyClientServerOpStackDataKernel: - HandleCommandL( EMemSpyCmdPhoneInfoStackDumpKernel ); - break; - // - case EMemSpyClientServerOpBitmapsSave: - OnCmdToolsBitmapsSaveToMemoryCardL(); - break; - case EMemSpyClientServerOpSendToBackground: - OnCmdToolsSendToBackgroundL(); - break; - case EMemSpyClientServerOpBringToForeground: - OnCmdToolsBringToForegroundL(); - break; - case EMemSpyClientServerOpExit: - OnCmdExitL(); - break; - // - default: - User::Leave( KErrNotSupported ); - break; - } - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode ); -#endif - } - - -void CMemSpyAppUi::SetViewServerTimeOutStatus( TBool aEnabled ) - { - TRAP_IGNORE( - iEngine.HelperProcess().ImpersonateL( KMemSpyEikSrvSID ); - // - CVwsSessionWrapper* ses = CVwsSessionWrapper::NewLC(); - ses->EnableServerEventTimeOut( aEnabled ); - CleanupStack::PopAndDestroy( ses ); - // - iEngine.HelperProcess().ImpersonateL( 0 ); - ); - } - - -void CMemSpyAppUi::OnCmdBackL() - { - const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); - // - if ( !MemSpyViewTypeUtils::IsExitableView( viewType ) ) - { - // Should go back one view - iAppContainer->NavigateToParentViewL(); - } - } - - -void CMemSpyAppUi::OnCmdExitL() - { - Exit(); - } - - -void CMemSpyAppUi::OnCmdOpenL() - { - const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); - // - if ( !MemSpyViewTypeUtils::IsOpenableItem( viewType ) ) - { - // Should go back one view - iAppContainer->NavigateToChildViewL(); - } - } - - -void CMemSpyAppUi::OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp ) - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - START - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); -#endif - - if ( !iRunningDeviceWideOperation ) - { - CMemSpyDeviceWideOperationDialog::ExecuteLD( iEngine, *this, aOp ); - } - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - END - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); -#endif - } - - -void CMemSpyAppUi::OnCmdPhoneInformationOperationKernelContainersL() - { - CMemSpyEngineGenericKernelObjectContainer* list = iEngine.HelperKernelContainers().ObjectsAllL(); - CleanupStack::PushL( list ); - iEngine.HelperKernelContainers().OutputL( *list ); - CleanupStack::PopAndDestroy( list ); - } - - - - - - - - - - - - - - - - - - - - - - -void CMemSpyAppUi::OnCmdAutoCaptureToggleL() - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); -#endif - - if ( iAutoCaptureTimer->IsActive() ) - { - iAutoCaptureTimer->Cancel(); - } - else - { - iAutoCaptureTimer->Cancel(); - // - const TTimeIntervalMicroSeconds32 interval( iAutoCaptureTimerPeriod * 1000000 ); - iAutoCaptureTimer->Start( 0, interval, TCallBack(AutoCaptureCallBack, this) ); - } - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); -#endif - } - - -void CMemSpyAppUi::OnCmdAutoCaptureRetryTimeL() - { - CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( iAutoCaptureTimerPeriod ); - dialog->ExecuteLD( R_MEMSPY_DEVICE_WIDE_SETTINGS ); - } - - -void CMemSpyAppUi::OnCmdAutoCaptureOperationTypeL() - { - CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES ); - CleanupStack::PushL(items); - // - TInt currentItem = iAutoCaptureOperationType; - // - CAknRadioButtonSettingPage* dialog = new(ELeave) CAknRadioButtonSettingPage( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES_SETTINGS_PAGE, currentItem, items ); - if ( dialog->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) - { - iAutoCaptureOperationType = static_cast< CMemSpyDeviceWideOperations::TOperation >( currentItem ); - } - // - CleanupStack::PopAndDestroy( items ); - } - - -TInt CMemSpyAppUi::AutoCaptureCallBack( TAny* aSelf ) - { - CMemSpyAppUi* self = reinterpret_cast< CMemSpyAppUi* >( aSelf ); - TRAPD( err, self->AutoCaptureCallBackL() ); - // - const TBool callMeBackAgain = ( err == KErrNone ); - return callMeBackAgain; - } - - -void CMemSpyAppUi::AutoCaptureCallBackL() - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); -#endif - - OnCmdPhoneInformationOperationL( iAutoCaptureOperationType ); - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - END - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); -#endif - } - - - - - - - - - - - - - - - - - - - - - -void CMemSpyAppUi::OnCmdOutputToDebugL() - { - iEngine.InstallSinkL( ESinkTypeDebug ); - MemSpyDocument().Settings().StoreSettingsL(); - } - - -void CMemSpyAppUi::OnCmdOutputToFileL() - { - iEngine.InstallSinkL( ESinkTypeFile ); - MemSpyDocument().Settings().StoreSettingsL(); - } - - - - - - - - - - - -void CMemSpyAppUi::OnCmdAboutL() - { - CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; - dialog->ExecuteLD( R_MEMSPYUI_ABOUT_DIALOG ); - } - - - - - - - - - - - - -void CMemSpyAppUi::OnCmdToolsBitmapsSaveToMemoryCardL() - { - // Get bitmap handles - RArray handles; - CleanupClosePushL( handles ); - iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( handles ); - - // Build bitmap list - CMemSpyEngineFbServBitmapArray* array = CMemSpyEngineFbServBitmapArray::NewL( handles ); - CleanupStack::PopAndDestroy( &handles ); - CleanupStack::PushL( array ); - - // Export... - CMemSpyExportBitmapsToMemoryCardDialog* dialog = CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *array ); - - // All done - CleanupStack::PopAndDestroy( array ); - } - - -void CMemSpyAppUi::OnCmdToolsSendToBackgroundL() - { - TApaTask task( iCoeEnv->WsSession() ); - task.SendToBackground(); - } - - -void CMemSpyAppUi::OnCmdToolsBringToForegroundL() - { - iCoeEnv->BringOwnerToFront(); - } - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyContainer.cpp --- a/memspyui/source/MemSpyContainer.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,222 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyContainer.h" - -// System includes -#include // for example label control -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - - - - -CMemSpyContainer::CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver ) -: iEngine( aEngine ), iObserver( aObserver ) - { - } - - -CMemSpyContainer::~CMemSpyContainer() - { - delete iPreviousView; - delete iActiveView; - } - - -void CMemSpyContainer::ConstructL(const TRect& aRect) - { - CreateWindowL(); - SetRect(aRect); - PrepareTopLevelViewL(); - ActivateL(); - } - - -void CMemSpyContainer::NavigateToParentViewL() - { - CMemSpyViewBase* parentView = iActiveView->PrepareParentViewL(); - // - if ( parentView == NULL ) - { - // Parent can be null, in which case, revert to top-level view - PrepareTopLevelViewL(); - } - else - { - SetNewActiveViewL( parentView ); - } - } - - -void CMemSpyContainer::NavigateToChildViewL() - { - CMemSpyViewBase* childView = iActiveView->PrepareChildViewL(); - // - if ( childView != NULL ) - { - SetNewActiveViewL( childView ); - } - } - - -void CMemSpyContainer::HandleCommandL( TInt aCommand ) - { - switch( aCommand ) - { - case EMemSpyCmdViewRefresh: - OnCmdViewRefreshL(); - break; - default: - if ( iActiveView ) - { - iActiveView->HandleCommandL( aCommand ); - } - break; - } - } - - -void CMemSpyContainer::OnCmdViewRefreshL() - { - if ( iActiveView ) - { - TRAPD(err, iActiveView->RefreshL()); - if ( err != KErrNone ) - { - // Error during view refreshing (perhaps the thread doesn't exist anymore). - // Try to replace the active view with its parent... - NavigateToParentViewL(); - } - } - } - - -void CMemSpyContainer::SizeChanged() - { - if ( iActiveView ) - { - iActiveView->SetRect( Rect() ); - } - } - - -TInt CMemSpyContainer::CountComponentControls() const - { - return 1; - } - - -CCoeControl* CMemSpyContainer::ComponentControl(TInt /*aIndex*/) const - { - return iActiveView; - } - - -void CMemSpyContainer::Draw(const TRect& aRect) const - { - CWindowGc& gc = SystemGc(); - // - gc.SetPenStyle(CGraphicsContext::ENullPen); - gc.SetBrushColor(KRgbGray); - gc.SetBrushStyle(CGraphicsContext::ESolidBrush); - gc.DrawRect(aRect); - } - - -TKeyResponse CMemSpyContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse response = EKeyWasNotConsumed; - // - if ( iActiveView ) - { - response = iActiveView->OfferKeyEventL( aKeyEvent, aType ); - } - // - return response; - } - - -void CMemSpyContainer::HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType /*aViewType*/, CMemSpyViewBase& aReportingView, TAny* /*aContext*/ ) - { - if ( aEvent == EEventItemActioned ) - { - // Get the view to generate a child - CMemSpyViewBase* child = aReportingView.PrepareChildViewL(); - if ( child == NULL ) - { - // View doesn't have a child - treat it as item activation and - // report event to observer. - - } - else - { - // Child view becomes the active one - SetNewActiveViewL( child ); - } - } - } - - -CMemSpyViewBase* CMemSpyContainer::PrepareTopLevelViewL() - { - CMemSpyViewMainMenu* view = new(ELeave) CMemSpyViewMainMenu( iEngine, *this ); - CleanupStack::PushL( view ); - view->ConstructL( Rect(), *this ); - SetNewActiveViewL( view ); - CleanupStack::Pop( view ); - return view; - } - - -void CMemSpyContainer::SetNewActiveViewL( CMemSpyViewBase* aNewView ) - { - delete iPreviousView; - // - iPreviousView = iActiveView; - if ( iPreviousView ) - { - iPreviousView->MakeVisible( EFalse ); - iPreviousView->SetFocus( EFalse ); - } - // - iActiveView = aNewView; - iActiveView->RefreshL(); - iActiveView->SetFocus( ETrue ); - // - ReportEventL( MCoeControlObserver::EEventStateChanged ); - } - - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyDeviceWideOperationDialog.cpp --- a/memspyui/source/MemSpyDeviceWideOperationDialog.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyDeviceWideOperationDialog.h" - -// System includes -#include -#include -#include -#include -#include -#include -#include - - -CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver ) -: iEngine( aEngine ), iObserver( aObserver ) - { - } - - -CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - { -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - START - iForcedCancel: %d", iForcedCancel ); -#endif - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting operation...: 0x%08x", iOperation ); -#endif - delete iOperation; - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting dialog...: 0x%08x", iProgressDialog ); -#endif - iProgressInfo = NULL; - delete iProgressDialog; - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - sending EDialogDismissed to observer..." ); -#endif - - iObserver.DWOperationCompleted(); - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - END" ); -#endif - } - - -void CMemSpyDeviceWideOperationDialog::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation ) - { -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - START" ); -#endif - - iOperation = CMemSpyDeviceWideOperations::NewL( iEngine, *this, aOperation ); - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - constructed operation..." ); -#endif - - ASSERT( iProgressDialog == NULL ); - iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue ); - iProgressDialog->PrepareLC( R_MEMSPY_DEVICE_WIDE_OPERATION_PROGRESS_DIALOG ); - iProgressDialog->SetCallback( this ); - iProgressDialog->SetGloballyCapturing( ETrue ); - // - iProgressInfo = iProgressDialog->GetProgressInfoL(); - iProgressInfo->SetFinalValue( iOperation->TotalOperationSize() ); - // - iProgressDialog->RunLD(); - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - END" ); -#endif - } - -void CMemSpyDeviceWideOperationDialog::ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation ) - { - CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aEngine, aObserver ); - CleanupStack::PushL( self ); - self->ExecuteL( aOperation ); - CleanupStack::PopAndDestroy( self ); - } - - -void CMemSpyDeviceWideOperationDialog::Cancel() - { -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - START - iOperation: 0x%08x, iForcedCancel: %d", iOperation, iForcedCancel ); -#endif - - iForcedCancel = ETrue; - // - if ( iOperation ) - { - iOperation->Cancel(); - } - // - iObserver.DWOperationCancelled(); - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - END" ); -#endif - } - - -void CMemSpyDeviceWideOperationDialog::DialogDismissedL( TInt aButtonId ) - { -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - START - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel ); -#else - (void) aButtonId; -#endif - - Cancel(); - -#ifdef _DEBUG - RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - END - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel ); -#endif - } - - -void CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 ) - { -#ifdef _DEBUG - RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - START - aEvent: %d, iProgressDialog: 0x%08x, aParam1: %d, aParam2: %S"), aEvent, iProgressDialog, aParam1, &aParam2 ); -#endif - - switch( aEvent ) - { - case MMemSpyDeviceWideOperationsObserver::EOperationSized: - break; - case MMemSpyDeviceWideOperationsObserver::EOperationStarting: - iObserver.DWOperationStarted(); - break; - case MMemSpyDeviceWideOperationsObserver::EOperationProgressStart: - ASSERT( iProgressDialog != NULL ); - SetDialogCaptionL( aParam2 ); - break; - case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd: - ASSERT( iProgressDialog != NULL ); - iProgressInfo->IncrementAndDraw( aParam1 ); - break; - case MMemSpyDeviceWideOperationsObserver::EOperationCancelled: - break; - case MMemSpyDeviceWideOperationsObserver::EOperationCompleting: - { - ASSERT( iProgressDialog != NULL ); - const TInt finalValue = iProgressInfo->Info().iFinalValue; - iProgressInfo->SetAndDraw( finalValue ); - break; - } - case MMemSpyDeviceWideOperationsObserver::EOperationCompleted: - if ( iProgressDialog ) - { - iProgressDialog->ProcessFinishedL(); - } - break; - default: - break; - } - -#ifdef _DEBUG - RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - END - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 ); -#endif - } - - -void CMemSpyDeviceWideOperationDialog::SetDialogCaptionL( const TDesC& aText ) - { - if ( aText.Length() ) - { - iProgressDialog->SetTextL( aText ); - iProgressDialog->DrawNow(); - } - } - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyDocument.cpp --- a/memspyui/source/MemSpyDocument.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyDocument.h" - -// Engine includes -#include - -// User includes -#include "MemSpyAppUi.h" -#include "MemSpySettings.h" - - -CMemSpyDocument::CMemSpyDocument(CEikApplication& aApp) -: CAknDocument(aApp) - { - } - - -CMemSpyDocument::~CMemSpyDocument() - { - delete iSettings; - delete iEngine; - } - - -void CMemSpyDocument::ConstructL() - { - RFs& fsSession = CCoeEnv::Static()->FsSession(); - // - iEngine = CMemSpyEngine::NewL( fsSession ); - iSettings = CMemSpySettings::NewL( fsSession, *iEngine ); - } - - -CMemSpyDocument* CMemSpyDocument::NewL(CEikApplication& aApp) - { - CMemSpyDocument* self = new (ELeave) CMemSpyDocument( aApp ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - } - - -CMemSpyEngine& CMemSpyDocument::Engine() - { - return *iEngine; - } - - -const CMemSpyEngine& CMemSpyDocument::Engine() const - { - return *iEngine; - } - - -CMemSpySettings& CMemSpyDocument::Settings() - { - return *iSettings; - } - - -const CMemSpySettings& CMemSpyDocument::Settings() const - { - return *iSettings; - } - - -CEikAppUi* CMemSpyDocument::CreateAppUiL() - { - return new (ELeave) CMemSpyAppUi( *iEngine ); - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyExportBitmapsToMemoryCardDialog.cpp --- a/memspyui/source/MemSpyExportBitmapsToMemoryCardDialog.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,328 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyExportBitmapsToMemoryCardDialog.h" - -// System includes -#include -#include -#include -#include -#include -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Driver includes -#include - -// Literal constants -_LIT( KMemSpyBitmapExportFolderAndFileName, "e:\\MemSpy\\Images\\%04d%02d%02d_%02d.%02d.%02d\\"); - - -CMemSpyExportBitmapsToMemoryCardDialog::CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ) -: CActive(EPriorityIdle), iFsSession(aFsSession), iBitmaps(aBitmaps) - { - CActiveScheduler::Add(this); - } - - -CMemSpyExportBitmapsToMemoryCardDialog::~CMemSpyExportBitmapsToMemoryCardDialog() - { - Cancel(); - // - delete iProgressDialog; - // - iMimeTypeArray.ResetAndDestroy(); - iMimeTypeArray.Close(); - // - if ( iEncoder ) - { - iEncoder->Cancel(); - } - delete iEncoder; - delete iFolderName; - delete iBmpMimeType; - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::ConstructL() - { - // Check card is ready - if ( CheckMemoryCardAvailableL( iFsSession ) == EFalse ) - { - User::Leave( KErrNotReady ); - } - - // Get mime type for BMP file - IdentifyBmpMimeTypeL(); - - // Prepare unique empty folder - PrepareFolderNameSpecL(); - - // Prepare UI stuff - iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ) ); - iProgressDialog->SetCallback( this ); - iProgressDialog->SetGloballyCapturing( ETrue ); - iProgressDialog->PrepareLC( R_MEMSPY_EXPORT_TO_MEMORYCARD_DIALOG ); - // - iProgressInfo = iProgressDialog->GetProgressInfoL( ); - iProgressInfo->SetFinalValue( iBitmaps.Count() ); - // - iProgressDialog->MakeVisible( ETrue ); // Visible right away - // - iDialogDismissed = EFalse; - iProgressInfo->SetAndDraw( 0 ); - - // Start the process rolling... - CompleteSelf(KErrNone); - - // - iProgressDialog->RunLD( ); - } - - -CMemSpyExportBitmapsToMemoryCardDialog* CMemSpyExportBitmapsToMemoryCardDialog::NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ) - { - CMemSpyExportBitmapsToMemoryCardDialog* self = new(ELeave) CMemSpyExportBitmapsToMemoryCardDialog( aFsSession, aBitmaps ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::Cancel() - { - CActive::Cancel(); - } - - -TBool CMemSpyExportBitmapsToMemoryCardDialog::CheckMemoryCardAvailableL( RFs& aFsSession ) - { - TBool available = EFalse; - // - TDriveInfo driveInfo; - if ( aFsSession.Drive( driveInfo, EDriveE ) == KErrNone ) - { - // Other checks needed? - available = ETrue; - } - // - return available; - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::RunL() - { - const TInt error = iStatus.Int(); - User::LeaveIfError( error ); - - if ( !iDialogDismissed ) - { - // Do we have more items to process? - if ( TryToExportSingleBitmapL() ) - { - _LIT(KTextFormat, "Saving image\n%d/%d"); - TBuf<128> buf; - buf.Format( KTextFormat, iBitmapIndex, iBitmaps.Count() ); - // - iProgressDialog->SetTextL( buf ); - iProgressInfo->SetAndDraw( iBitmapIndex ); - iProgressDialog->DrawDeferred(); - } - else - { - // We're done - RunL will not be called again - if (iProgressInfo) - { - const TInt finalValue = iProgressInfo->Info().iFinalValue; - iProgressInfo->SetAndDraw( finalValue ); - // - delete iProgressDialog; - iProgressDialog = NULL; - // - delete this; - } - } - - User::ResetInactivityTime(); - } - else - { - delete iProgressDialog; - iProgressDialog = NULL; - // - delete this; - } - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::DoCancel() - { - if ( iEncoder ) - { - iEncoder->Cancel(); - } - - iDialogDismissed = ETrue; - } - - -TInt CMemSpyExportBitmapsToMemoryCardDialog::RunError( TInt /*aError*/ ) - { - TRAP_IGNORE( - - // Try the next image - if ( TryToExportSingleBitmapL() == EFalse ) - { - iDialogDismissed = ETrue; - delete this; - } - ); - // - return KErrNone; - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::DialogDismissedL( TInt /*aButtonId*/ ) - { - iDialogDismissed = ETrue; - iProgressDialog = NULL; - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::CompleteSelf( TInt aError ) - { - TRequestStatus* status = &iStatus; - User::RequestComplete( status, aError ); - SetActive(); - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap ) - { - // Create a filename - TFileName fileName( *iFolderName ); - aBitmap.GetExportableFileNameL( fileName ); - - // Create encoder object... - CImageEncoder* encoder = CImageEncoder::FileNewL( iFsSession, fileName, *iBmpMimeType ); - delete iEncoder; - iEncoder = encoder; - - // Start operation - iEncoder->Convert( &iStatus, aBitmap.Bitmap() ); - SetActive(); - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::IdentifyBmpMimeTypeL() - { - _LIT(KBmpExtension, ".bmp"); - CImageEncoder::GetFileTypesL( iMimeTypeArray ); - // - const TInt count = iMimeTypeArray.Count(); - // - for( TInt i=0; iFileExtension().FindF( KBmpExtension ) >= 0 ) - { - // Found it - save mime type info - iBmpMimeType = extension->MIMEType().AllocL(); - iMimeTypeArray.ResetAndDestroy(); - iMimeTypeArray.Close(); - return; - } - } - // - User::Leave( KErrNotFound ); - } - - -void CMemSpyExportBitmapsToMemoryCardDialog::PrepareFolderNameSpecL() - { - delete iFolderName; - iFolderName = NULL; - - // Make a unique filename format specifier. - TTime now; - now.HomeTime(); - const TDateTime dt( now.DateTime() ); - - // Build it up... - iFolderName = HBufC::NewL( KMaxFileName ); - TPtr pName( iFolderName->Des() ); - pName.Format( KMemSpyBitmapExportFolderAndFileName, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second()); - - // Create directory - const TInt error = iFsSession.MkDirAll( pName ); - User::LeaveIfError( error ); - } - - -TBool CMemSpyExportBitmapsToMemoryCardDialog::TryToExportSingleBitmapL() - { - TBool startedExport = EFalse; - - const TInt count = iBitmaps.Count(); - for( ; ( iBitmapIndex < count ) && ( startedExport == EFalse ); iBitmapIndex++ ) - { - const CMemSpyEngineFbServBitmap& memSpyBitmap = iBitmaps.At( iBitmapIndex ); - const CFbsBitmap& fbsBitmap = memSpyBitmap.Bitmap(); - const TSize size( fbsBitmap.SizeInPixels() ); - - // We don't want to export bitmaps which have a zero-pixel dimension. - if ( size.iHeight > 0 && size.iWidth > 0 ) - { - // This completes the object's request status and will therefore - // result in a further call to RunL() when the export to BMP - // is completed. - ExportBitmapL( memSpyBitmap ); - - // And indicate we managed to start an operation... - startedExport = ETrue; - } - } - // - return startedExport; - } - - - - - - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpySettings.cpp --- a/memspyui/source/MemSpySettings.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpySettings.h" - -// System includes -#include -#include - -// Engine includes -#include -#include -#include -#include -#include - -// Constants -_LIT( KMemSpySettingsFileName, "settings.dat" ); - -// Version 03 dumped some of the system wide memory tracker settings -const TInt KMemSpySettingsFileFormatVersion = 6; - - -CMemSpySettings::CMemSpySettings( RFs& aFsSession, CMemSpyEngine& aEngine ) -: iFsSession( aFsSession ), iEngine( aEngine ) - { - } - - -CMemSpySettings::~CMemSpySettings() - { - TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - START" ) ); - TRAP_IGNORE( StoreSettingsL() ); - TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - END" ) ); - } - - -void CMemSpySettings::ConstructL() - { - TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - START") ) ); - - TRAP_IGNORE( RestoreSettingsL() ); - - TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - END") ) ); - } - - -CMemSpySettings* CMemSpySettings::NewL( RFs& aFsSession, CMemSpyEngine& aEngine ) - { - CMemSpySettings* self = new(ELeave) CMemSpySettings( aFsSession, aEngine ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -void CMemSpySettings::GetSettingsFileNameL( TDes& aFileName ) - { - GetSettingsPathL( aFileName ); - aFileName.Append( KMemSpySettingsFileName ); - TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsFileNameL() - aFileName: %S"), &aFileName ) ); - } - - -void CMemSpySettings::GetSettingsPathL( TDes& aPath ) - { - TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - START") ) ); - aPath.Zero(); - - // Get private data cage path - TInt err = iFsSession.PrivatePath( aPath ); - TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - priv path err: %d"), err ) ); - User::LeaveIfError( err ); - - // Combine with C: drive - const TDriveUnit cDrive( EDriveC ); - const TDriveName cDriveName( cDrive.Name() ); - aPath.Insert( 0, cDriveName ); - - iFsSession.MkDirAll( aPath ); - TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - END - %S"), &aPath ) ); - } - - -RFile CMemSpySettings::SettingsFileLC( TBool aReplace ) - { - TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - START - aReplace: %d"), aReplace ) ); - - TFileName* fileName = new(ELeave) TFileName(); - CleanupStack::PushL( fileName ); - GetSettingsFileNameL( *fileName ); - TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - fileName: %S"), fileName ) ); - - RFile file; - TInt error = KErrNone; - // - if ( aReplace ) - { - error = file.Replace( iFsSession, *fileName, EFileWrite ); - TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - replace err: %d"), error ) ); - } - else - { - error = file.Open( iFsSession, *fileName, EFileWrite ); - TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - open err: %d"), error ) ); - // - if ( error == KErrNotFound ) - { - error = file.Create( iFsSession, *fileName, EFileWrite ); - } - } - // - User::LeaveIfError( error ); - CleanupStack::PopAndDestroy( fileName ); - CleanupClosePushL( file ); - // - TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - END") ) ); - return file; - } - - -void CMemSpySettings::StoreSettingsL() - { - TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - START" ) ); - - RFile file = SettingsFileLC( ETrue ); - RFileWriteStream stream( file ); - CleanupStack::Pop(); // file - CleanupClosePushL( stream ); - - // Verion info - stream.WriteInt32L( KMemSpySettingsFileFormatVersion ); - - // Engine settings - TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - sinkType: %d", iEngine.SinkType() ) ); - stream.WriteUint8L( iEngine.SinkType() ); - - // Get SWMT config - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig swmtConfig; - swmt.GetConfig( swmtConfig ); - - // Write SWMT settings - stream.WriteInt32L( swmtConfig.TimerPeriod().Int() ); - stream.WriteUint8L( swmtConfig.DumpData() ); - - // Write memory tracking auto-start process list - const RArray& processUidList = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList(); - stream.WriteInt32L( processUidList.Count() ); - for( TInt i=0; i 0 ) - { - stream.WriteL( swmtConfig.iThreadNameFilter, swmtConfig.iThreadNameFilter.Length() ); - } - - // Write mode - stream.WriteInt32L( swmtConfig.iMode ); - - stream.CommitL(); - CleanupStack::PopAndDestroy( &stream ); // Closes file - TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - END - sinkType: %d", iEngine.SinkType() ) ); - } - - -void CMemSpySettings::RestoreSettingsL() - { - TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - START - current engine sinkType: %d", iEngine.SinkType() ) ); - - RFile file = SettingsFileLC(); - RFileReadStream stream( file ); - CleanupStack::Pop(); // file - CleanupClosePushL( stream ); - - // Version info - const TInt version = stream.ReadInt32L(); // discarded for now - TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - version: %d", version ) ); - - // Engine settings - TMemSpySinkType type = static_cast< TMemSpySinkType >( stream.ReadUint8L() ); - TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - read sinkType: %d", type ) ); - iEngine.InstallSinkL( type ); - - // Set SWMT config - TMemSpyEngineHelperSysMemTrackerConfig swmtConfig; - swmtConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( stream.ReadInt32L() ); - swmtConfig.iDumpData = static_cast< TBool >( stream.ReadUint8L() ); - - if ( version < 3 ) - { - // Restore but ignore old delta tracker settings which aren't used anymore - // - /* iHeapDeltaTrackerIncludeKernel =*/ static_cast< TBool >( stream.ReadUint8L() ); - /* iHeapDeltaTrackerCheckAllocCellCounts =*/ static_cast< TBool >( stream.ReadUint8L() ); - /* iHeapDeltaTrackerCheckFreeCellCounts =*/ static_cast< TBool >( stream.ReadUint8L() ); - } - - // Restore memory tracking auto-start process uids if file format supports it... - if ( version >= 2 ) - { - RArray list; - CleanupClosePushL( list ); - // - const TInt count = stream.ReadInt32L(); - for( TInt i=0; i> processUid; - // - TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - process tracker uid[%02d]: 0x%08x", i, processUid.iUid ) ); - User::LeaveIfError( list.Append( processUid ) ); - } - // - CMemSpyEngineHelperProcess& processHelper = iEngine.HelperProcess(); - processHelper.SetMemoryTrackingAutoStartProcessListL( list ); - CleanupStack::PopAndDestroy( &list ); - } - - // Restore memory tracking categories - if ( version > 3 ) - { - swmtConfig.iEnabledCategories = stream.ReadInt32L(); - } - - // Write heap tracking thread name filter - if ( version > 4 ) - { - TInt len = stream.ReadInt32L(); - if ( len > 0 ) - { - stream.ReadL( swmtConfig.iThreadNameFilter, len ); - } - } - - // Write mode - if ( version > 5 ) - { - swmtConfig.iMode = (TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode)stream.ReadInt32L(); - } - - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - swmt.SetConfigL( swmtConfig ); - - CleanupStack::PopAndDestroy( &stream ); // Closes file - TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - END - engine sink type: %d", iEngine.SinkType() ) ); - } - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyUiUtils.cpp --- a/memspyui/source/MemSpyUiUtils.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyUiUtils.h" - -// System includes -#include -#include - - - - -void MemSpyUiUtils::Format( TDes& aBuf, TInt aResourceId, ...) - { - VA_LIST list; - VA_START(list,aResourceId); - TBuf<128> format; - CCoeEnv::Static()->ReadResource( format, aResourceId ); - aBuf.FormatList( format, list ); - } - - -void MemSpyUiUtils::GetErrorText( TDes& aBuf, TInt aError ) - { - if ( aError == KErrNotSupported ) - { - _LIT( KMemSpyErrorText, "Not Supported" ); - aBuf = KMemSpyErrorText; - } - else if ( aError == KErrNotReady ) - { - _LIT( KMemSpyErrorText, "Not Ready" ); - aBuf = KMemSpyErrorText; - } - else if ( aError == KErrNotFound ) - { - _LIT( KMemSpyErrorText, "Missing" ); - aBuf = KMemSpyErrorText; - } - else if ( aError == KErrGeneral ) - { - _LIT( KMemSpyErrorText, "General Error" ); - aBuf = KMemSpyErrorText; - } - else - { - _LIT( KMemSpyItemValueError, "Error: %d" ); - aBuf.Format( KMemSpyItemValueError, aError ); - } - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewBase.cpp --- a/memspyui/source/MemSpyViewBase.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,413 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewBase.h" - -// System includes -#include // for example label control -#include -#include -#include -#include -#include -#include -#include -#include - -// Engine includes -#include -#include -#include - -// User includes -#include "MemSpyAppUi.h" -#include "MemSpyDocument.h" -#include "MemSpyContainer.h" -#include "MemSpyContainerObserver.h" - - - - -CMemSpyViewBase::CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: iEngine( aEngine ), iObserver( aObserver ) - { - } - - -CMemSpyViewBase::~CMemSpyViewBase() - { - delete iListBox; - } - - -void CMemSpyViewBase::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* /*aSelectionRune*/ ) - { - iSettings = &static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() )->MemSpyDocument().Settings(); - // - User::LeaveIfError( SetParent( &aContainer ) ); - SetContainerWindowL( aContainer ); - - SetComponentsToInheritVisibility( ETrue ); - - iListBox = ConstructListBoxL(); - if ( iListBox ) - { - iListBox->SetFocus( ETrue ); - } - - SetRect( aRect ); - ActivateL(); - } - - -void CMemSpyViewBase::SetTitleL( const TDesC& aText ) - { - CEikStatusPane* statusPane = static_cast ( iEikonEnv->EikAppUi() )->StatusPane(); - CAknTitlePane* title = static_cast ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - title->SetTextL( aText ); - } - - -TPtrC CMemSpyViewBase::TitleL() const - { - TPtrC ret( KNullDesC ); - // - CEikStatusPane* statusPane = static_cast ( iEikonEnv->EikAppUi() )->StatusPane(); - CAknTitlePane* title = static_cast ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - if ( title->Text() ) - { - ret.Set( *title->Text() ); - } - // - return ret; - } - - -CMemSpyViewBase* CMemSpyViewBase::PrepareParentViewL() - { - return NULL; - } - - -CMemSpyViewBase* CMemSpyViewBase::PrepareChildViewL() - { - return NULL; - } - - -void CMemSpyViewBase::RefreshL() - { - if ( iListBox ) - { - iListBox->UpdateScrollBarsL(); - } - - DrawDeferred(); - } - - -TBool CMemSpyViewBase::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch( aCommand ) - { - case EMemSpyCmdViewOutputToSink: - OnCmdViewOutputToSinkL(); - break; - default: - handled = EFalse; - break; - } - // - return handled; - } - - -void CMemSpyViewBase::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) - { - } - - -TUint CMemSpyViewBase::MenuCascadeResourceId() const - { - return 0; - } - - -TInt CMemSpyViewBase::MenuCascadeCommandId() const - { - return 0; - } - - -void CMemSpyViewBase::OnCmdViewOutputToSinkL() - { - if ( iListBox ) - { - // Prepare sink - CMemSpyEngineOutputSink& sink = iEngine.Sink(); - HBufC* name = MemSpyEngineUtils::CleanupTextLC( TitleL() ); - sink.OutputSectionHeadingL( *name, TChar('-') ); - CleanupStack::PopAndDestroy( name ); - sink.OutputPrefixSetLC( _L(" ") ); // Slight insertion - - // Get text from underlying listbox model... - MTextListBoxModel* model = static_cast< MTextListBoxModel* >( iListBox->Model() ); - const TInt count = model->NumberOfItems(); - - // First pass to get max lengths - TInt maxLengthCaption = 0; - TInt maxLengthValue = 0; - - for( TInt j=0; jItemText( j ) ); - const TInt length = pItem.Length(); - - // Check if its split or not? - const TInt splitPos = pItem.FindF( _L("\t\t") ); - if ( splitPos > 0 ) - { - maxLengthCaption = Max( maxLengthCaption, splitPos ); - maxLengthValue = Max( maxLengthValue, length - splitPos + 1 ); - } - else - { - maxLengthCaption = Max( maxLengthCaption, length ); - } - } - - // Second pass - real this time - to print the values - HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 ); - TPtr pLine( line->Des() ); - // - for( TInt i=0; iItemText( i ) ); - const TInt length = pItem.Length(); - // - TPtrC pCaption( KNullDesC ); - TPtrC pValue( KNullDesC ); - // - const TInt splitPos = pItem.FindF( _L("\t\t") ); - if ( splitPos > 0 ) - { - pCaption.Set( pItem.Left( splitPos ) ); - pValue.Set( pItem.Mid( splitPos + 1 ) ); - } - else - { - pCaption.Set( pItem ); - } - - // Remove initial tabs in caption - HBufC* caption = MemSpyEngineUtils::CleanupTextLC( pCaption ); - - // Create value item & replace any further tabs - HBufC* value = MemSpyEngineUtils::CleanupTextLC( pValue ); - - // Now format the final line, with padding. - pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') ); - pLine.Append( *value ); - CleanupStack::PopAndDestroy( 2, caption ); - - // Sink output - sink.OutputLineL( pLine ); - } - - // Remove prefix & tidy up - CleanupStack::PopAndDestroy( line ); - sink.OutputBlankLineL(); - CleanupStack::PopAndDestroy(); // clear prefix - } - } - - -CEikListBox* CMemSpyViewBase::ConstructListBoxL() - { - delete iListBox; - iListBox = NULL; - CAknSettingStyleListBox* listbox = new(ELeave) CAknSettingStyleListBox(); - iListBox = listbox; - // - listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); - listbox->SetContainerWindowL( *this ); - listbox->CreateScrollBarFrameL( ETrue ); - SetListBoxModelL(); - listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - listbox->SetListBoxObserver( this ); - listbox->SetObserver( this ); - listbox->SetComponentsToInheritVisibility( ETrue ); - // - return listbox; - } - - -void CMemSpyViewBase::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewBase::HandleListBoxItemSelectedL( TInt /*aIndex*/ ) - { - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - -void CMemSpyViewBase::ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext ) - { - iObserver.HandleMemSpyViewEventL( aEvent, ViewType(), *this, aContext ); - } - - -void CMemSpyViewBase::SetListBoxCurrentItemIndexL( TInt aIndex ) - { - if ( iListBox ) - { - iListBox->SetCurrentItemIndex( aIndex ); - HandleListBoxItemSelectedL( aIndex ); - } - } - - -CMemSpyContainer& CMemSpyViewBase::Container() - { - CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() ); - return appUi->Container(); - } - - -CMemSpySettings& CMemSpyViewBase::Settings() - { - return *iSettings; - } - - -const CMemSpySettings& CMemSpyViewBase::Settings() const - { - return *iSettings; - } - - -void CMemSpyViewBase::Draw( const TRect& aRect ) const - { - CWindowGc& gc = SystemGc(); - // - gc.SetPenStyle( CGraphicsContext::ENullPen ); - gc.SetBrushColor( KRgbWhite ); - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - gc.DrawRect( aRect ); - } - - -void CMemSpyViewBase::SizeChanged() - { - if ( iListBox ) - { - iListBox->SetRect( Rect() ); - } - } - - -void CMemSpyViewBase::FocusChanged(TDrawNow /*aDrawNow*/) - { - if ( iListBox ) - { - iListBox->SetFocus( IsFocused() ); - } - } - - -TInt CMemSpyViewBase::CountComponentControls() const - { - TInt count = 0; - if ( iListBox ) - { - ++count; - } - // - return count; - } - - -CCoeControl* CMemSpyViewBase::ComponentControl(TInt aIndex) const - { - switch ( aIndex ) - { - case 0: - return iListBox; - default: - return NULL; - } - } - - -TKeyResponse CMemSpyViewBase::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse resp = EKeyWasNotConsumed; - if ( iListBox ) - { - resp = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - // - if ( resp == EKeyWasNotConsumed && aType == EEventKeyDown && aKeyEvent.iCode == EKeyBackspace ) - { - // When backspace is pushed, go to the parent view - CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() ); - appUi->Container().NavigateToParentViewL(); - resp = EKeyWasConsumed; - } - // - return resp; - } - - -void CMemSpyViewBase::HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ) - { - if ( aControl == iListBox ) - { - if ( aEventType == MCoeControlObserver::EEventStateChanged ) - { - const TInt index = iListBox->CurrentItemIndex(); - HandleListBoxItemSelectedL( index ); - } - } - } - - -void CMemSpyViewBase::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) - { - const TInt index = iListBox->CurrentItemIndex(); - // - switch (aEventType) - { - case EEventItemActioned: - case EEventEnterKeyPressed: - case EEventItemDoubleClicked: - HandleListBoxItemActionedL( index ); - break; - - default: - break; - } - } - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewChunkList.cpp --- a/memspyui/source/MemSpyViewChunkList.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,346 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewChunkList.h" - -// System includes -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" - - - -CMemSpyViewChunkBase::CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList ) -: CMemSpyViewBase( aEngine, aObserver ), iList( aList ) - { - } - - -CMemSpyViewChunkBase::~CMemSpyViewChunkBase() - { - delete iList; - } - - -TBool CMemSpyViewChunkBase::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdChunkSortByName: - iList->SortByNameL(); - CMemSpyViewBase::RefreshL(); - break; - case EMemSpyCmdChunkSortBySize: - iList->SortBySizeL(); - CMemSpyViewBase::RefreshL(); - break; - case EMemSpyCmdChunkListing: - OnCmdListingL(); - break; - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewChunkBase::OnCmdListingL() - { - // Begin a new data stream - _LIT( KMemSpyContext, "Chunk List" ); - _LIT( KMemSpyFolder, "Chunks" ); - iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); - - // Set prefix for overall listing - _LIT( KOverallPrefix, "Chunk List - " ); - iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); - - // Create header - CMemSpyEngineChunkList::OutputDataColumnsL( iEngine ); - - // List items - const TInt count = iList->Count(); - for(TInt i=0; iAt( i ); - // - entry.OutputDataL( iEngine.HelperChunk() ); - } - - // Tidy up - CleanupStack::PopAndDestroy(); // prefix - - // End data stream - iEngine.Sink().DataStreamEndL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewChunkBase( aEngine, aObserver, NULL ) - { - } - - -CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList ) -: CMemSpyViewChunkBase( aEngine, aObserver, &aList ) - { - } - - -void CMemSpyViewChunkList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Chunks" ); - SetTitleL( KTitle ); - - if ( iList == NULL ) - { - // Prepare code segment list - iList = iEngine.HelperChunk().ListL(); - } - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - if ( aSelectionRune != NULL ) - { - iCurrentChunk = reinterpret_cast< CMemSpyEngineChunkEntry* >( aSelectionRune ); - const TInt index = iList->ItemIndex( *iCurrentChunk ); - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - iListBox->DrawDeferred(); - } - - -TMemSpyViewType CMemSpyViewChunkList::ViewType() const - { - return EMemSpyViewTypeChunkList; - } - - -CMemSpyViewBase* CMemSpyViewChunkList::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewChunkList::PrepareChildViewL() - { - CMemSpyViewBase* child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *iList, *iCurrentChunk ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iList = NULL; - - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewChunkList::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iList ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewChunkList::HandleListBoxItemActionedL( TInt aIndex ) - { - const TInt count = iList->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineChunkEntry& chunk = iList->At( aIndex ); - iCurrentChunk = &chunk; - } - else - { - iCurrentChunk = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewChunkList::HandleListBoxItemSelectedL( TInt aIndex ) - { - const TInt count = iList->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineChunkEntry& chunk = iList->At( aIndex ); - iCurrentChunk = &chunk; - } - else - { - iCurrentChunk = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewChunkDetails::CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk ) -: CMemSpyViewChunkBase( aEngine, aObserver, &aList ), iChunk( aSelectedChunk ) - { - } - - -void CMemSpyViewChunkDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Chunk Details" ); - SetTitleL( KTitle ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewChunkDetails::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewChunkDetails::ViewType() const - { - return EMemSpyViewTypeChunkDetails; - } - - -CMemSpyViewBase* CMemSpyViewChunkDetails::PrepareParentViewL() - { - CMemSpyViewChunkList* parent = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver, *iList ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iList = NULL; - - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iChunk ); - CleanupStack::Pop( parent ); - return parent; - } - - -void CMemSpyViewChunkDetails::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iChunk ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - - - - - - - - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewCodeSegList.cpp --- a/memspyui/source/MemSpyViewCodeSegList.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,500 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewCodeSegList.h" - -// System includes -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyViewThreads.h" -#include "MemSpyContainerObserver.h" -#include "MemSpyExportBitmapsToMemoryCardDialog.h" - - - -CMemSpyViewCodeSegBase::CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList ) -: CMemSpyViewBase( aEngine, aObserver ), iList( aList ) - { - } - - -CMemSpyViewCodeSegBase::~CMemSpyViewCodeSegBase() - { - delete iList; - } - - -TBool CMemSpyViewCodeSegBase::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdCodeSegSortByName: - iList->SortByFileNameL(); - CMemSpyViewBase::RefreshL(); - break; - case EMemSpyCmdCodeSegSortByCodeSize: - iList->SortByCodeSizeL(); - CMemSpyViewBase::RefreshL(); - break; - case EMemSpyCmdCodeSegSortByDataSize: - iList->SortByDataSizeL(); - CMemSpyViewBase::RefreshL(); - break; - case EMemSpyCmdCodeSegSortByUid: - iList->SortByUidsL(); - CMemSpyViewBase::RefreshL(); - break; - case EMemSpyCmdCodeSegListing: - OnCmdCodeSegmentListingL(); - break; - case EMemSpyCmdCodeSegShowItemsAll: - OnCmdShowItemsAllL(); - break; - case EMemSpyCmdCodeSegShowItemsGlobalData: - OnCmdShowItemsGlobalDataL(); - break; - - case EMemSpyCmdCodeSegShowCapsWithTCBProcess: - case EMemSpyCmdCodeSegShowCapsWithTCBAll: - OnCmdFilterByCapabilityL( ECapabilityTCB, aCommand == EMemSpyCmdCodeSegShowCapsWithTCBAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithCommDDProcess: - case EMemSpyCmdCodeSegShowCapsWithCommDDAll: - OnCmdFilterByCapabilityL( ECapabilityCommDD, aCommand == EMemSpyCmdCodeSegShowCapsWithCommDDAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess: - case EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll: - OnCmdFilterByCapabilityL( ECapabilityPowerMgmt, aCommand == EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess: - case EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll: - OnCmdFilterByCapabilityL( ECapabilityMultimediaDD, aCommand == EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess: - case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll: - OnCmdFilterByCapabilityL( ECapabilityReadDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess: - case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll: - OnCmdFilterByCapabilityL( ECapabilityWriteDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithDRMProcess: - case EMemSpyCmdCodeSegShowCapsWithDRMAll: - OnCmdFilterByCapabilityL( ECapabilityDRM, aCommand == EMemSpyCmdCodeSegShowCapsWithDRMAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess: - case EMemSpyCmdCodeSegShowCapsWithTrustedUIAll: - OnCmdFilterByCapabilityL( ECapabilityTrustedUI, aCommand == EMemSpyCmdCodeSegShowCapsWithTrustedUIAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithProtServProcess: - case EMemSpyCmdCodeSegShowCapsWithProtServAll: - OnCmdFilterByCapabilityL( ECapabilityProtServ, aCommand == EMemSpyCmdCodeSegShowCapsWithProtServAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess: - case EMemSpyCmdCodeSegShowCapsWithDiskAdminAll: - OnCmdFilterByCapabilityL( ECapabilityDiskAdmin, aCommand == EMemSpyCmdCodeSegShowCapsWithDiskAdminAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess: - case EMemSpyCmdCodeSegShowCapsWithNetworkControlAll: - OnCmdFilterByCapabilityL( ECapabilityNetworkControl, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkControlAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithAllFilesProcess: - case EMemSpyCmdCodeSegShowCapsWithAllFilesAll: - OnCmdFilterByCapabilityL( ECapabilityAllFiles, aCommand == EMemSpyCmdCodeSegShowCapsWithAllFilesAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithSwEventProcess: - case EMemSpyCmdCodeSegShowCapsWithSwEventAll: - OnCmdFilterByCapabilityL( ECapabilitySwEvent, aCommand == EMemSpyCmdCodeSegShowCapsWithSwEventAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess: - case EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll: - OnCmdFilterByCapabilityL( ECapabilityNetworkServices, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess: - case EMemSpyCmdCodeSegShowCapsWithLocalServicesAll: - OnCmdFilterByCapabilityL( ECapabilityLocalServices, aCommand == EMemSpyCmdCodeSegShowCapsWithLocalServicesAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess: - case EMemSpyCmdCodeSegShowCapsWithReadUserDataAll: - OnCmdFilterByCapabilityL( ECapabilityReadUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadUserDataAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess: - case EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll: - OnCmdFilterByCapabilityL( ECapabilityWriteUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithLocationProcess: - case EMemSpyCmdCodeSegShowCapsWithLocationAll: - OnCmdFilterByCapabilityL( ECapabilityLocation, aCommand == EMemSpyCmdCodeSegShowCapsWithLocationAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess: - case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll: - OnCmdFilterByCapabilityL( ECapabilitySurroundingsDD, aCommand == EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll ); - break; - case EMemSpyCmdCodeSegShowCapsWithUserEnvProcess: - case EMemSpyCmdCodeSegShowCapsWithUserEnvAll: - OnCmdFilterByCapabilityL( ECapabilityUserEnvironment, aCommand == EMemSpyCmdCodeSegShowCapsWithUserEnvAll ); - break; - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewCodeSegBase::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewCodeSegBase::OnCmdCodeSegmentListingL() - { - // Begin a new data stream - _LIT( KMemSpyContext, "CodeSeg List - " ); - _LIT( KMemSpyFolder, "CodeSegs" ); - iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); - - // Set prefix for overall listing - _LIT(KOverallPrefix, "CodeSeg List - "); - iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); - - // Create header - CMemSpyEngineCodeSegList::OutputDataColumnsL( iEngine ); - - // List items - const TInt count = iList->Count(); - for(TInt i=0; iAt( i ); - // - entry.OutputDataL( iEngine.HelperCodeSegment() ); - } - - // Tidy up - CleanupStack::PopAndDestroy(); // prefix - - // End data stream - iEngine.Sink().DataStreamEndL(); - } - - -void CMemSpyViewCodeSegBase::OnCmdShowItemsAllL() - { - iList->ShowAllL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewCodeSegBase::OnCmdShowItemsGlobalDataL() - { - iList->ShowOnlyEntriesWithGlobalDataL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewCodeSegBase::OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries ) - { - TMemSpyViewCodeSegFilter filterLogic( aCapability, aAllBinaries ); - TMemSpyEngineVisibiltyFunction filterFunction( TMemSpyViewCodeSegFilter::FilterItem, &filterLogic ); - iList->ShowL( filterFunction ); - CMemSpyViewBase::RefreshL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewCodeSegBase( aEngine, aObserver, NULL ) - { - } - - -CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList ) -: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList ) - { - } - - -void CMemSpyViewCodeSegList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Code Segments" ); - SetTitleL( KTitle ); - - if ( iList == NULL ) - { - // Prepare code segment list - iList = iEngine.HelperCodeSegment().CodeSegmentListL(); - iList->SortByCodeSizeL(); - } - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - if ( aSelectionRune != NULL ) - { - iCurrentCodeSegment = reinterpret_cast< CMemSpyEngineCodeSegEntry* >( aSelectionRune ); - const TInt index = iList->ItemIndex( *iCurrentCodeSegment ); - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - iListBox->DrawDeferred(); - } - - -TMemSpyViewType CMemSpyViewCodeSegList::ViewType() const - { - return EMemSpyViewTypeCodeSegmentList; - } - - -CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareChildViewL() - { - CMemSpyViewBase* child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *iList, *iCurrentCodeSegment ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iList = NULL; - - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewCodeSegList::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iList ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewCodeSegList::HandleListBoxItemActionedL( TInt aIndex ) - { - const TInt count = iList->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex ); - iCurrentCodeSegment = &codeSeg; - } - else - { - iCurrentCodeSegment = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewCodeSegList::HandleListBoxItemSelectedL( TInt aIndex ) - { - const TInt count = iList->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex ); - iCurrentCodeSegment = &codeSeg; - } - else - { - iCurrentCodeSegment = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewCodeSegDetails::CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment ) -: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList ), iCodeSegment( aSelectedCodeSegment ) - { - } - - -void CMemSpyViewCodeSegDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Code Segment Details" ); - SetTitleL( KTitle ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewCodeSegDetails::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewCodeSegDetails::ViewType() const - { - return EMemSpyViewTypeCodeSegmentDetails; - } - - -CMemSpyViewBase* CMemSpyViewCodeSegDetails::PrepareParentViewL() - { - CMemSpyViewCodeSegList* parent = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver, *iList ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iList = NULL; - - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iCodeSegment ); - CleanupStack::Pop( parent ); - return parent; - } - - -void CMemSpyViewCodeSegDetails::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iCodeSegment ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - - - - - - - - - - - - - - - - - - - - -TBool TMemSpyViewCodeSegFilter::FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune ) - { - TMemSpyViewCodeSegFilter* self = reinterpret_cast< TMemSpyViewCodeSegFilter* >( aRune ); - - TBool match = aItem->HasCapability( self->iCapability ); - if ( match && self->iAllBinaries == EFalse ) - { - // We're only looking for EXE's... - TParsePtrC parser( aItem->FileName() ); - const TPtrC pExtension( parser.Ext() ); - _LIT(KProcessExtension, ".exe"); - // - match = ( pExtension.CompareF( KProcessExtension ) == 0 ); - } - // - return match; - } - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewDriveInfo.cpp --- a/memspyui/source/MemSpyViewDriveInfo.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,381 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewDriveInfo.h" - -// System includes -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" - - - -CMemSpyViewDriveInfoBase::CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewDriveInfoBase::~CMemSpyViewDriveInfoBase() - { - if ( iList ) - { - iList->SetObserver( NULL ); - } - // - delete iList; - } - - -void CMemSpyViewDriveInfoBase::BaseConstructL() - { - iList = iEngine.HelperFileSystem().DriveListL(); - } - - -TBool CMemSpyViewDriveInfoBase::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( EFalse ), iDriveNumber( EDriveA ) - { - } - - -CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ) -: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( ETrue ), iDriveNumber( aDriveNumber ) - { - } - - -void CMemSpyViewDriveList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - BaseConstructL(); - - _LIT( KTitle, "Drive Summary" ); - SetTitleL( KTitle ); - - // Start watching list - iList->SetObserver( this ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - if ( iUseDriveNumber ) - { -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iDriveNumber: %c:", iDriveNumber + 'A' ); -#endif - iCurrentDrive = iList->EntryByDriveNumber( iDriveNumber ); - -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iCurrentDrive: 0x%08x", iCurrentDrive ); -#endif - if ( iCurrentDrive ) - { - const TInt index = iList->ItemIndex( *iCurrentDrive ); -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - index: %d", index ); -#endif - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - } - - iListBox->DrawDeferred(); - } - - -TMemSpyViewType CMemSpyViewDriveList::ViewType() const - { - return EMemSpyViewTypeDriveSummary; - } - - -CMemSpyViewBase* CMemSpyViewDriveList::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - // - if ( parent ) - { - iList->SetObserver( NULL ); - } - // - return parent; - } - - -CMemSpyViewBase* CMemSpyViewDriveList::PrepareChildViewL() - { - ASSERT( iCurrentDrive ); - CMemSpyViewBase* child = new(ELeave) CMemSpyViewDriveInfo( iEngine, iObserver, iCurrentDrive->DriveNumber() ); - - // Stop watching list - if ( child ) - { - iList->SetObserver( NULL ); - } - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iList = NULL; - - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewDriveList::RefreshL() - { - if ( iList ) - { - iList->SetObserver( NULL ); - } - // - CMemSpyEngineDriveList* list = iEngine.HelperFileSystem().DriveListL(); - delete iList; - iList = list; - iList->SetObserver( this ); - // - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewDriveList::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iList ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewDriveList::HandleListBoxItemActionedL( TInt aIndex ) - { - const TInt count = iList->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineDriveEntry& entry = iList->At( aIndex ); - iCurrentDrive = &entry; - } - else - { - iCurrentDrive = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewDriveList::HandleListBoxItemSelectedL( TInt aIndex ) - { - const TInt count = iList->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineDriveEntry& entry = iList->At( aIndex ); - iCurrentDrive = &entry; - } - else - { - iCurrentDrive = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - -void CMemSpyViewDriveList::HandleDriveListChangedL( const CMemSpyEngineDriveList& /*aList*/ ) - { - RefreshL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewDriveInfo::CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ) -: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iDriveNumber( aDriveNumber ) - { - } - - -void CMemSpyViewDriveInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - BaseConstructL(); - // - iDriveInfo = iList->EntryByDriveNumber( iDriveNumber ); - if ( !iDriveInfo ) - { - User::Leave( KErrNotFound ); - } - iDriveInfo->SetObserver( this ); - - _LIT( KTitleFormat, "Drive %S Info" ); - const TDriveName name( iDriveInfo->DriveUnit().Name() ); - TName title; - title.Format( KTitleFormat, &name ); - SetTitleL( title ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewDriveInfo::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewDriveInfo::ViewType() const - { - return EMemSpyViewTypeDriveInfo; - } - - -CMemSpyViewBase* CMemSpyViewDriveInfo::PrepareParentViewL() - { - ASSERT( iDriveInfo ); - CMemSpyViewDriveList* parent = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver, iDriveInfo->DriveNumber() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( parent ); - // - if ( parent ) - { - iDriveInfo->SetObserver( NULL ); - } - // - return parent; - } - - -void CMemSpyViewDriveInfo::SetListBoxModelL() - { - if ( iDriveInfo ) - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iDriveInfo ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - } - - -void CMemSpyViewDriveInfo::HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& /*aEntry*/ ) - { - RefreshL(); - } - - - - - - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewECom.cpp --- a/memspyui/source/MemSpyViewECom.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,475 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewECom.h" - -// System includes -#include - -// Engine includes -#include -#include - -// User includes -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - - - -CMemSpyViewECom::CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -void CMemSpyViewECom::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "ECom" ); - SetTitleL( KTitle ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Select first item - TInt index = KErrNotFound; - if ( aSelectionRune != NULL ) - { - iCurrent = reinterpret_cast< CMemSpyEngineEComCategory* >( aSelectionRune ); - index = iEngine.HelperECom().IndexOf( *iCurrent ); - } - - if ( index >= 0 && index < iEngine.HelperECom().Count() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - iListBox->DrawDeferred(); - } - } - - -void CMemSpyViewECom::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewECom::ViewType() const - { - return EMemSpyViewTypeECom; - } - - -CMemSpyViewBase* CMemSpyViewECom::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewECom::PrepareChildViewL() - { - CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, *iCurrent ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewECom::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iEngine.HelperECom() ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewECom::HandleListBoxItemActionedL( TInt aIndex ) - { - const TInt count = iEngine.HelperECom().Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex ); - iCurrent = &category; - } - else - { - iCurrent = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewECom::HandleListBoxItemSelectedL( TInt aIndex ) - { - const TInt count = iEngine.HelperECom().Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex ); - iCurrent = &category; - } - else - { - iCurrent = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - - - - - - - - - - - -CMemSpyViewEComCategory::CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory ) -: CMemSpyViewBase( aEngine, aObserver ), iCategory( aCategory ) - { - } - - -void CMemSpyViewEComCategory::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - SetTitleL( iCategory.Name() ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Select first item - TInt index = KErrNotFound; - if ( aSelectionRune != NULL ) - { - iCurrent = reinterpret_cast< CMemSpyEngineEComInterface* >( aSelectionRune ); - index = iCategory.IndexOf( *iCurrent ); - } - - if ( index >= 0 && index < iCategory.Count() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - iListBox->DrawDeferred(); - } - } - - -void CMemSpyViewEComCategory::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewEComCategory::ViewType() const - { - return EMemSpyViewTypeEComCategory; - } - - -CMemSpyViewBase* CMemSpyViewEComCategory::PrepareParentViewL() - { - CMemSpyViewECom* parent = new(ELeave) CMemSpyViewECom( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iCategory ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewEComCategory::PrepareChildViewL() - { - CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, *iCurrent ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewEComCategory::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iCategory ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewEComCategory::HandleListBoxItemActionedL( TInt aIndex ) - { - const TInt count = iCategory.Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineEComInterface& entry = iCategory.At( aIndex ); - iCurrent = &entry; - } - else - { - iCurrent = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewEComCategory::HandleListBoxItemSelectedL( TInt aIndex ) - { - const TInt count = iCategory.Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineEComInterface& entry = iCategory.At( aIndex ); - iCurrent = &entry; - } - else - { - iCurrent = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewEComInterface::CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface ) -: CMemSpyViewBase( aEngine, aObserver ), iInterface( aInterface ) - { - } - - -void CMemSpyViewEComInterface::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - SetTitleL( iInterface.Name() ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Select first item - TInt index = KErrNotFound; - if ( aSelectionRune != NULL ) - { - iCurrent = reinterpret_cast< CMemSpyEngineEComImplementation* >( aSelectionRune ); - index = iInterface.IndexOf( *iCurrent ); - } - - if ( index >= 0 && index < iInterface.Count() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - iListBox->DrawDeferred(); - } - } - - -void CMemSpyViewEComInterface::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewEComInterface::ViewType() const - { - return EMemSpyViewTypeEComInterface; - } - - -CMemSpyViewBase* CMemSpyViewEComInterface::PrepareParentViewL() - { - CMemSpyViewEComCategory* parent = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, iInterface.Category() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iInterface ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewEComInterface::PrepareChildViewL() - { - CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComImplementation( iEngine, iObserver, *iCurrent ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewEComInterface::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iInterface ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewEComInterface::HandleListBoxItemActionedL( TInt aIndex ) - { - const TInt count = iInterface.Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex ); - iCurrent = &entry; - } - else - { - iCurrent = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewEComInterface::HandleListBoxItemSelectedL( TInt aIndex ) - { - const TInt count = iInterface.Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex ); - iCurrent = &entry; - } - else - { - iCurrent = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewEComImplementation::CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation ) -: CMemSpyViewBase( aEngine, aObserver ), iImplementation( aImplementation ) - { - } - - -void CMemSpyViewEComImplementation::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - SetTitleL( iImplementation.Name() ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Select first item - if ( iImplementation.MdcaCount() ) - { - iListBox->SetCurrentItemIndex( 0 ); - HandleListBoxItemSelectedL( 0 ); - iListBox->DrawDeferred(); - } - } - - -void CMemSpyViewEComImplementation::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewEComImplementation::ViewType() const - { - return EMemSpyViewTypeEComImplementation; - } - - -CMemSpyViewBase* CMemSpyViewEComImplementation::PrepareParentViewL() - { - CMemSpyViewEComInterface* parent = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, iImplementation.Interface() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iImplementation ); - CleanupStack::Pop( parent ); - return parent; - } - - -void CMemSpyViewEComImplementation::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iImplementation ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewFBServBitmaps.cpp --- a/memspyui/source/MemSpyViewFBServBitmaps.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,746 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewFBServBitmaps.h" - -// System includes -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyViewThreads.h" -#include "MemSpyContainerObserver.h" -#include "MemSpyExportBitmapsToMemoryCardDialog.h" - -// Constants -const TInt KMemSpyIdleResetListboxTimerPeriod = 500000; -const TInt KMemSpyImageSlideshowPeriod = 1000000; - - - -CMemSpyViewFBServBase::CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ) -: CMemSpyViewBase( aEngine, aObserver ), iBitmaps( aBitmaps ) - { - } - - -CMemSpyViewFBServBase::~CMemSpyViewFBServBase() - { -#ifdef _DEBUG - RDebug::Printf("CMemSpyViewFBServBase::~CMemSpyViewFBServBase() - deleting bitmaps: 0x%08x", iBitmaps ); -#endif - delete iBitmaps; - } - - -TBool CMemSpyViewFBServBase::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdImagesSlideshow: - OnCmdSlideShowL(); - break; -#ifndef __WINS__ - case EMemSpyCmdImagesSaveAllToMemoryCard: - OnCmdExportToMemoryCardL(); - break; -#endif - case EMemSpyCmdImagesListing: - OnCmdImageListingL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewFBServBase::OnCmdSlideShowL() - { - TInt index = 0; - CMemSpyViewFBServSlideshow::NewLD( *iBitmaps, index ); - - // Select the item that was last displayed - const TInt count = iBitmaps->Count(); - if ( iListBox && index >= 0 && index < count ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - DrawDeferred(); - } - } - - -void CMemSpyViewFBServBase::OnCmdExportToMemoryCardL() - { - // Deletes itself - CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *iBitmaps ); - } - - -void CMemSpyViewFBServBase::OnCmdImageListingL() - { - // Begin a new data stream - _LIT( KMemSpyContext, "Bitmap List - " ); - _LIT( KMemSpyFolder, "Bitmaps" ); - iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); - - // Set prefix for overall listing - _LIT(KOverallPrefix, "Bitmap List - "); - iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); - - // Create header - CMemSpyEngineFbServBitmap::OutputDataColumnsL( iEngine ); - - // List items - const TInt count = iBitmaps->Count(); - for(TInt i=0; iAt( i ); - // - bitmap.OutputDataL( iEngine ); - } - - // Tidy up - CleanupStack::PopAndDestroy(); // prefix - - // End data stream - iEngine.Sink().DataStreamEndL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewFBServBase( aEngine, aObserver, NULL ) - { -#ifdef _DEBUG - RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(1) - iBitmaps is: 0x%08x", iBitmaps ); -#endif - } - - -CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ) -: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ) - { -#ifdef _DEBUG - RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(2) - iBitmaps is: 0x%08x", iBitmaps ); -#endif - } - - -CMemSpyViewFBServBitmaps::~CMemSpyViewFBServBitmaps() - { - delete iIdleResetListboxTimer; - iBitmapHandles.Close(); - } - - -void CMemSpyViewFBServBitmaps::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Font & Bitmap Server" ); - SetTitleL( KTitle ); - - if ( iBitmaps == NULL ) - { - // Prepare bitmap handles - iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( iBitmapHandles ); - - // Create bitmap array - construction occurs asynchronously - iBitmaps = CMemSpyEngineFbServBitmapArray::NewL( CActive::EPriorityIdle, iBitmapHandles, *this ); - } - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Create idle listbox refresh timer - if ( iBitmaps->Count() == 0 ) - { - iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityLow ); - } - else - { - if ( aSelectionRune != NULL ) - { - iCurrentBitmap = reinterpret_cast< CMemSpyEngineFbServBitmap* >( aSelectionRune ); - const TInt index = iBitmaps->BitmapIndexByHandle( iCurrentBitmap->Handle() ); - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - iListBox->DrawDeferred(); - } - } - - -void CMemSpyViewFBServBitmaps::RefreshL() - { -#ifdef _DEBUG - RDebug::Printf("CMemSpyViewFBServBitmaps::RefreshL() - iBitmaps->Count(): %d", iBitmaps->Count()); -#endif - - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewFBServBitmaps::ViewType() const - { - return EMemSpyViewTypeFBServBitmaps; - } - - -CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareChildViewL() - { - CMemSpyViewBase* child = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, *iCurrentBitmap ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iBitmaps = NULL; - - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewFBServBitmaps::HandleFbServBitmapArrayEventL( TEvent aEvent ) - { - if ( aEvent == EBitmapItemsCreated ) - { - } - else if ( aEvent == EBitmapArrayConstructionComplete ) - { - } - // - iIdleResetListboxTimer->Cancel(); - iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod/2, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) ); - } - - -void CMemSpyViewFBServBitmaps::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iBitmaps ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewFBServBitmaps::HandleListBoxItemActionedL( TInt aIndex ) - { - const TInt count = iBitmaps->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex ); - iCurrentBitmap = &bitmap; - } - else - { - iCurrentBitmap = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewFBServBitmaps::HandleListBoxItemSelectedL( TInt aIndex ) - { - const TInt count = iBitmaps->Count(); - if ( aIndex >= 0 && aIndex < count ) - { - CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex ); - iCurrentBitmap = &bitmap; - } - else - { - iCurrentBitmap = NULL; - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - -TInt CMemSpyViewFBServBitmaps::IdleUpdateListBoxModel( TAny* aSelf ) - { - CMemSpyViewFBServBitmaps* self = reinterpret_cast< CMemSpyViewFBServBitmaps* >( aSelf ); - TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() ); - return EFalse; - } - - -void CMemSpyViewFBServBitmaps::DoIdleUpdateListBoxModelL() - { - // Try to maintain current item selection if at all possible. - TInt handle = 0; - if ( iCurrentBitmap ) - { - handle = iCurrentBitmap->Handle(); - iCurrentBitmap = NULL; - } - - // Update list box & model - iListBox->HandleItemAdditionL(); - iListBox->DrawDeferred(); - - // Try to select previous item if it is still available - const TInt index = iBitmaps->BitmapIndexByHandle( handle ); - if ( index >= 0 && index < iBitmaps->Count() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - iIdleResetListboxTimer->Cancel(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ) -: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap ) - { -#ifdef _DEBUG - RDebug::Printf("CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo() - iBitmaps is: 0x%08x", iBitmaps ); -#endif - } - - -void CMemSpyViewFBServBitmapInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Bitmap Details" ); - SetTitleL( KTitle ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - if ( iBitmaps->Count() ) - { - iListBox->SetCurrentItemIndex( 0 ); - HandleListBoxItemSelectedL( 0 ); - } - } - - -void CMemSpyViewFBServBitmapInfo::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewFBServBitmapInfo::ViewType() const - { - return EMemSpyViewTypeFBServBitmapInfo; - } - - -CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareParentViewL() - { - CMemSpyViewFBServBitmaps* parent = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver, iBitmaps ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iBitmaps = NULL; - - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iBitmapObject ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareChildViewL() - { - CMemSpyViewFBServBitmapViewer* child = new(ELeave) CMemSpyViewFBServBitmapViewer( iEngine, iObserver, iBitmaps, iBitmapObject ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iBitmaps = NULL; - - CleanupStack::PushL( child ); - CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() ); - const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() ); - child->ConstructL( rect, *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewFBServBitmapInfo::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iBitmapObject ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewFBServBitmapInfo::HandleListBoxItemActionedL( TInt aIndex ) - { - // Only report the event if its the first item that was actioned - if ( aIndex == 0 ) - { - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ) -: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap ) - { -#ifdef _DEBUG - RDebug::Printf("CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer() - iBitmaps is: 0x%08x", iBitmaps ); -#endif - } - - -CMemSpyViewFBServBitmapViewer::~CMemSpyViewFBServBitmapViewer() - { - delete iImage; - } - - -void CMemSpyViewFBServBitmapViewer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Bitmap Preview" ); - SetTitleL( KTitle ); - - // Finish construction - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Prepare image - iImage = new(ELeave) CEikImage(); - iImage->SetContainerWindowL( *this ); - iImage->SetPicture( &iBitmapObject.Bitmap(), NULL ); - iImage->SetPictureOwnedExternally( ETrue ); - SizeChanged(); - } - - -void CMemSpyViewFBServBitmapViewer::RefreshL() - { - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewFBServBitmapViewer::ViewType() const - { - return EMemSpyViewTypeFBServBitmapViewer; - } - - -CMemSpyViewBase* CMemSpyViewFBServBitmapViewer::PrepareParentViewL() - { - CMemSpyViewFBServBitmapInfo* parent = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, iBitmapObject ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - iBitmaps = NULL; - - CleanupStack::PushL( parent ); - CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() ); - const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() ); - parent->ConstructL( rect, *Parent() ); - CleanupStack::Pop( parent ); - return parent; - } - - -void CMemSpyViewFBServBitmapViewer::SetListBoxModelL() - { - } - - -CEikListBox* CMemSpyViewFBServBitmapViewer::ConstructListBoxL() - { - return NULL; - } - - -void CMemSpyViewFBServBitmapViewer::Draw( const TRect& /*aRect*/ ) const - { - CWindowGc& gc = SystemGc(); - // - gc.SetPenStyle( CGraphicsContext::ENullPen ); - gc.SetBrushColor( KRgbWhite ); - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - gc.DrawRect( Rect() ); - // - gc.SetBrushColor( KRgbBlack ); - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - gc.DrawRect( iBorderRect ); - } - - -void CMemSpyViewFBServBitmapViewer::SizeChanged() - { - TRect rect( Rect() ); - TSize size( rect.Size() ); - // - TSize bitmapSize( iBitmapObject.Bitmap().SizeInPixels() ); - - // Try to center image, if possible. - if ( bitmapSize.iWidth < size.iWidth ) - { - const TInt offset = ( size.iWidth - bitmapSize.iWidth) / 2; - rect.Move( offset, 0 ); - size.iWidth = bitmapSize.iWidth; - } - if ( bitmapSize.iHeight < size.iHeight ) - { - const TInt offset = ( size.iHeight - bitmapSize.iHeight) / 2; - rect.Move( 0, offset ); - size.iHeight = bitmapSize.iHeight; - } - // - rect.SetSize( size ); - if ( iImage ) - { - iImage->SetRect( rect ); - } - iBorderRect = rect; - iBorderRect.Grow( 2, 2 ); - } - - -TInt CMemSpyViewFBServBitmapViewer::CountComponentControls() const - { - TInt count = 0; - // - if ( iImage ) - { - ++count; - } - // - return count; - } - - -CCoeControl* CMemSpyViewFBServBitmapViewer::ComponentControl( TInt /*aIndex*/ ) const - { - return iImage; - } - - - - - - - - - - - - - - - - - -CMemSpyViewFBServSlideshow::CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ) -: iBitmaps( aBitmaps ), iIndex( aIndex ) - { - } - - -CMemSpyViewFBServSlideshow::~CMemSpyViewFBServSlideshow() - { - delete iTimer; - } - - -void CMemSpyViewFBServSlideshow::ConstructL() - { - iTimer = CPeriodic::NewL( CActive::EPriorityLow ); - iTimer->Start( KMemSpyImageSlideshowPeriod, KMemSpyImageSlideshowPeriod, TCallBack( IdleUpdate, this ) ); - } - - -void CMemSpyViewFBServSlideshow::NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ) - { - CMemSpyViewFBServSlideshow* self = new(ELeave) CMemSpyViewFBServSlideshow( aBitmaps, aIndex ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - // - self->ExecuteLD( R_MEMSPY_IMAGE_SLIDESHOW ); - } - - -void CMemSpyViewFBServSlideshow::PreLayoutDynInitL() - { - ShowNextImageL(); - } - - -TBool CMemSpyViewFBServSlideshow::OkToExitL( TInt /*aButtonId*/ ) - { - return ETrue; - } - - -TInt CMemSpyViewFBServSlideshow::IdleUpdate( TAny* aSelf ) - { - CMemSpyViewFBServSlideshow* self = reinterpret_cast< CMemSpyViewFBServSlideshow* >( aSelf ); - TRAP_IGNORE( self->ShowNextImageL() ); - return EFalse; - } - - -void CMemSpyViewFBServSlideshow::ShowNextImageL() - { - CEikImage* imageControl = static_cast< CEikImage* >( Control(EMemSpyCtrlIdSlideShowImage) ); - - // Get the right image - const TInt imageCount = iBitmaps.Count(); - if ( iIndex < imageCount ) - { - CMemSpyEngineFbServBitmap& bitmap = iBitmaps.At( iIndex ); - imageControl->SetPicture( &bitmap.Bitmap(), NULL ); - imageControl->SetPictureOwnedExternally( ETrue ); - - // Prepare title - const TSize size( bitmap.Bitmap().SizeInPixels() ); - _LIT(KTitleFormat, "%3d x %3d"); - TBuf<128> title; - title.Format( KTitleFormat, size.iWidth, size.iHeight ); - SetTitleL( title ); - // - User::ResetInactivityTime(); - // - Layout(); - // - ++iIndex; - } - else - { - // Dismiss myself. - delete this; - } - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewHeapTracking.cpp --- a/memspyui/source/MemSpyViewHeapTracking.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,435 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewHeapTracking.h" - -// System includes -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" -#include "MemSpyViewHeapTrackingSettings.h" -#include "MemSpyViewHeapTrackingResults.h" - - -CMemSpyViewHeapTracking::CMemSpyViewHeapTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ), - iState( EMemSpyViewHeapTrackingStateIdle ) - { - if ( iEngine.HelperSysMemTracker().IsActive() ) - { - iState = EMemSpyViewHeapTrackingStateTimerOn; - } - } - - -CMemSpyViewHeapTracking::~CMemSpyViewHeapTracking() - { - delete iStopTimerCallBack; - iEngine.HelperSysMemTracker().RemoveObserver( this ); - } - - -void CMemSpyViewHeapTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "System-Wide Memory Tracking" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Backup current config because it may be overwritten with Basic/Full mode settings. - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig config; - swmt.GetConfig( config ); - iOriginalConfig = config; - - if ( config.iMode != TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom ) - { - // Set config. Needed for updating config for Basic or Full mode. - SetConfigByModeL( config.iMode, config ); - } - - // Make sure the correct item is selected - TInt index = 0; - if ( aSelectionRune != NULL ) - { - const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); - index = IndexByViewType( viewType ); - } - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - -void CMemSpyViewHeapTracking::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewHeapTracking::ViewType() const - { - return EMemSpyViewTypeHeapTracking; - } - - -CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareParentViewL() - { - - // Save custom settings even if mode is Basic or Full - TRAP_IGNORE( - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig config; - swmt.GetConfig( config ); - config.iEnabledCategories = iOriginalConfig.iEnabledCategories; - config.iThreadNameFilter = iOriginalConfig.iThreadNameFilter; - config.iDumpData = iOriginalConfig.iDumpData; - swmt.SetConfigL( config ); - Settings().StoreSettingsL(); - ); - - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - const TInt index = iListBox->CurrentItemIndex(); - - // Get current config - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig config; - swmt.GetConfig( config ); - - // - if ( index == 0 ) - { - // This is the start/stop toggle so we don't make a child view - child = NULL; - - // ... instead we either start or stop the tracker - if ( !iEngine.HelperSysMemTracker().IsActive() ) - { - iState = EMemSpyViewHeapTrackingStateSingleOn; - // Setting observer to be able to stop SWMT after first cycle is completed - iEngine.HelperSysMemTracker().SetObserver( this ); - iEngine.HelperSysMemTracker().StartL(); - } - - // Redraw listbox - RefreshL(); - } - else if ( index == 1 ) - { - // This is the start/stop toggle so we don't make a child view - child = NULL; - - // ... instead we either start or stop the tracker - if ( iEngine.HelperSysMemTracker().IsActive() && iState == EMemSpyViewHeapTrackingStateTimerOn ) - { - iState = EMemSpyViewHeapTrackingStateIdle; - iEngine.HelperSysMemTracker().StopL(); - } - else if ( iState == EMemSpyViewHeapTrackingStateIdle ) - { - iState = EMemSpyViewHeapTrackingStateTimerOn; - iEngine.HelperSysMemTracker().StartL(); - } - - // Redraw listbox - RefreshL(); - } - else if ( index == 2 ) - { - switch ( config.iMode ) - { - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic: - { - // Set Full mode - SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull, config ); - break; - } - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull: - { - // Set Custom mode - SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom, config ); - break; - } - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom: - { - // Set Basic mode - SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic, config ); - break; - } - default: break; - } - - // Redraw listbox - RefreshL(); - } - else if ( index == 3 ) - { - if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom ) - { - child = new(ELeave) CMemSpyViewHeapTrackingSettings( iEngine, iObserver ); - } - else - { - child = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver ); - } - } - else if ( index == 4 ) - { - child = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver ); - } - if ( child ) - { - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - } - - // - return child; - } - - -void CMemSpyViewHeapTracking::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf item; - - // Get current config - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig config; - swmt.GetConfig( config ); - - // 1st item - _LIT( KItem1FormatEnable, "\tGet dump now" ); - model->AppendL( KItem1FormatEnable ); - - - // 1st item - if ( iEngine.HelperSysMemTracker().IsActive() && iState == EMemSpyViewHeapTrackingStateTimerOn ) - { - _LIT( KItem1FormatEnable, "\tStop timer\t\t%d (sec)" ); - TName item; - item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 ); - model->AppendL( item ); - } - else - { - _LIT( KItem1FormatEnable, "\tStart timer\t\t%d (sec)" ); - TName item; - item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 ); - model->AppendL( item ); - } - - // 2nd item - switch ( config.iMode ) - { - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic: - { - _LIT( KItem2Format, "\tTracking mode\t\tBasic" ); - model->AppendL( KItem2Format ); - break; - } - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull: - { - _LIT( KItem2Format, "\tTracking mode\t\tFull" ); - model->AppendL( KItem2Format ); - break; - } - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom: - { - _LIT( KItem2Format, "\tTracking mode\t\tCustom" ); - model->AppendL( KItem2Format ); - - // 3rd item - TFullName item; - if ( config.DumpData() && - config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap ) - { - _LIT( KItem3Format, "\tSettings\t\t%d categ., dump" ); - item.Format( KItem3Format, config.EnabledCategoryCount() ); - } - else - { - _LIT( KItem3Format, "\tSettings\t\t%d categories" ); - item.Format( KItem3Format, config.EnabledCategoryCount() ); - } - model->AppendL( item ); - break; - } - default: break; - } - - // 4th item - const TInt cycleCount = iEngine.HelperSysMemTracker().MdcaCount(); - if ( cycleCount ) - { - _LIT( KItem2Format, "\tResults\t\t%d cycles" ); - TFullName item; - item.Format( KItem2Format, cycleCount ); - model->AppendL( item ); - } - else - { - _LIT( KItem2Format, "\tResults\t\tNo results" ); - model->AppendL( KItem2Format ); - } - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -void CMemSpyViewHeapTracking::HandleCyclesResetL() - { - } - - -void CMemSpyViewHeapTracking::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) - { - } - - -void CMemSpyViewHeapTracking::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) - { - // Stopping SWMT does not work directly from this function. - // It has to be made asynchronously. - iStopTimerCallBack = new (ELeave) CAsyncCallBack( TCallBack( CMemSpyViewHeapTracking::AsyncStopTimerCallback, this ), CActive::EPriorityStandard ); - iStopTimerCallBack->CallBack(); - } - - -TInt CMemSpyViewHeapTracking::IndexByViewType( TMemSpyViewType aType ) - { - // Get current config - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig config; - swmt.GetConfig( config ); - - TInt index = 0; - // - switch( aType ) - { - default: - case EMemSpyViewTypeHeapTrackingResults: - { - if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom ) - { - index = 4; - } - else - { - index = 3; - } - break; - } - case EMemSpyViewTypeHeapTrackingSettings: - index = 3; - break; - } - // - return index; - } - - -void CMemSpyViewHeapTracking::SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) - { - switch ( aMode ) - { - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic: - { - aConfig.iMode = aMode; - aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap | - TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks | - TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData | - TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory; - aConfig.iDumpData = EFalse; - break; - } - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull: - { - aConfig.iMode = aMode; - aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll; - aConfig.iDumpData = ETrue; - aConfig.iThreadNameFilter = KNullDesC; - break; - } - case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom: - { - aConfig.iMode = aMode; - aConfig.iEnabledCategories = iOriginalConfig.iEnabledCategories; - aConfig.iDumpData = iOriginalConfig.iDumpData; - aConfig.iThreadNameFilter = iOriginalConfig.iThreadNameFilter; - break; - } - default: User::Leave( KErrArgument ); - } - // Push changes to SWMT - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - swmt.SetConfigL( aConfig ); - Settings().StoreSettingsL(); - } - - -TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback( TAny* aParam ) - { - CMemSpyViewHeapTracking* view = static_cast( aParam ); - return view->AsyncStopTimerCallback(); - } - - -TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback() - { - iState = EMemSpyViewHeapTrackingStateIdle; - iEngine.HelperSysMemTracker().RemoveObserver( this ); - TRAP_IGNORE( - iEngine.HelperSysMemTracker().StopL(); - RefreshL(); - ); - delete iStopTimerCallBack; - iStopTimerCallBack = NULL; - return KErrNone; - } - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewHeapTrackingResults.cpp --- a/memspyui/source/MemSpyViewHeapTrackingResults.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,434 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewHeapTrackingResults.h" - -// System includes -#include -#ifdef __EPOC32__ -#include -#endif - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyContainer.h" -#include "MemSpyViewHeapTracking.h" -#include "MemSpyContainerObserver.h" - - -CMemSpyViewHeapTrackingResults::CMemSpyViewHeapTrackingResults( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - iEngine.HelperSysMemTracker().SetObserver( this ); - } - - -CMemSpyViewHeapTrackingResults::~CMemSpyViewHeapTrackingResults() - { - iEngine.HelperSysMemTracker().RemoveObserver( this ); - } - - -void CMemSpyViewHeapTrackingResults::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Results Summary" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Make sure the correct item is selected - const TInt cycleNumber = ((TInt) aSelectionRune); - const TInt maxCycle = iEngine.HelperSysMemTracker().MdcaCount(); - if ( cycleNumber > 0 && cycleNumber <= maxCycle ) - { - iListBox->SetCurrentItemIndex( cycleNumber - 1 ); - HandleListBoxItemSelectedL( cycleNumber ); - } - } - - -void CMemSpyViewHeapTrackingResults::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewHeapTrackingResults::ViewType() const - { - return EMemSpyViewTypeHeapTrackingResults; - } - - -CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareParentViewL() - { - CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - // - iEngine.HelperSysMemTracker().RemoveObserver( this ); - // - return parent; - } - - -CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareChildViewL() - { - const TInt index = iListBox->CurrentItemIndex(); - // - CMemSpyViewBase* child = NULL; - if ( index >= 0 ) - { - const CMemSpyEngineHelperSysMemTrackerCycle* cycle = iEngine.HelperSysMemTracker().CompletedCycles()[ index ]; - // - child = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iEngine, iObserver, *cycle ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - // - iEngine.HelperSysMemTracker().RemoveObserver( this ); - } - // - return child; - } - - -void CMemSpyViewHeapTrackingResults::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - MDesCArray* contents = &iEngine.HelperSysMemTracker(); - listbox->Model()->SetItemTextArray( contents ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewHeapTrackingResults::HandleCyclesResetL() - { - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewHeapTrackingResults::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) - { - } - - -void CMemSpyViewHeapTrackingResults::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) - { - SetListBoxCurrentItemIndexL( iEngine.HelperSysMemTracker().MdcaCount() - 1 ); - CMemSpyViewBase::RefreshL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewHeapTrackingResultsCycleInfo::CMemSpyViewHeapTrackingResultsCycleInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) -: CMemSpyViewBase( aEngine, aObserver ), iCycle( aCycle ) - { - iEngine.HelperSysMemTracker().SetObserver( this ); - } - - -CMemSpyViewHeapTrackingResultsCycleInfo::~CMemSpyViewHeapTrackingResultsCycleInfo() - { - iEngine.HelperSysMemTracker().RemoveObserver( this ); - } - - -void CMemSpyViewHeapTrackingResultsCycleInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitleFormat, "Cycle Summary [%04d]" ); - TBuf<30> buf; - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - SetTitleL( buf ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Make sure the correct item is selected - const TInt index = ((TInt) aSelectionRune); - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - -void CMemSpyViewHeapTrackingResultsCycleInfo::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewHeapTrackingResultsCycleInfo::ViewType() const - { - return EMemSpyViewTypeHeapTrackingResultsCycleInfo; - } - - -CMemSpyViewBase* CMemSpyViewHeapTrackingResultsCycleInfo::PrepareParentViewL() - { - CMemSpyViewHeapTrackingResults* parent = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) iCycle.CycleNumber() ); - CleanupStack::Pop( parent ); - // - iEngine.HelperSysMemTracker().RemoveObserver( this ); - // - return parent; - } - - -void CMemSpyViewHeapTrackingResultsCycleInfo::SetListBoxModelL() - { - MDesCArray& model = const_cast< MDesCArray& >( static_cast< const MDesCArray&>( iCycle ) ); - // - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &model ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCyclesResetL() - { - Container().NavigateToParentViewL(); - } - - -void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) - { - } - - -void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) - { - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/* - - - -CMemSpyViewHeapTrackingResultsChangeDescriptor::CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex ) -: CMemSpyViewBase( aEngine, aObserver ), iCycle( aCycle ), iChangeDescriptor( aChangeDescriptor ), iIndex( aIndex ) - { - iEngine.HelperSysMemTracker().SetObserver( this ); - } - - -CMemSpyViewHeapTrackingResultsChangeDescriptor::~CMemSpyViewHeapTrackingResultsChangeDescriptor() - { - iEngine.HelperSysMemTracker().RemoveObserver( this ); - } - - -void CMemSpyViewHeapTrackingResultsChangeDescriptor::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - TBuf<30> buf; - if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapUser ) - { - _LIT( KTitleFormat, "User Heap Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapKernel ) - { - _LIT( KTitleFormat, "Kernel Heap Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeChunk ) - { - _LIT( KTitleFormat, "Chunk Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeRamDrive ) - { - _LIT( KTitleFormat, "RAM Drive Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeStack ) - { - _LIT( KTitleFormat, "Stack Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeGlobalData ) - { - _LIT( KTitleFormat, "Global Data Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeCode ) - { - _LIT( KTitleFormat, "RAM-Loaded Code Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHandle ) - { - _LIT( KTitleFormat, "Handle Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeOpenFile ) - { - _LIT( KTitleFormat, "Open File Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeDiskSpace ) - { - _LIT( KTitleFormat, "Disk Space Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeBitmap ) - { - _LIT( KTitleFormat, "Bitmap Change [%04d]" ); - buf.Format( KTitleFormat, iCycle.CycleNumber() ); - } - // - SetTitleL( buf ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewHeapTrackingResultsChangeDescriptor::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewHeapTrackingResultsChangeDescriptor::ViewType() const - { - return EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor; - } - - -CMemSpyViewBase* CMemSpyViewHeapTrackingResultsChangeDescriptor::PrepareParentViewL() - { - CMemSpyViewHeapTrackingResultsCycleInfo* parent = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iEngine, iObserver, iCycle ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) iIndex ); - CleanupStack::Pop( parent ); - // - iEngine.HelperSysMemTracker().RemoveObserver( this ); - // - return parent; - } - - -void CMemSpyViewHeapTrackingResultsChangeDescriptor::SetListBoxModelL() - { - MDesCArray& model = const_cast< MDesCArray& >( static_cast< const MDesCArray&>( iChangeDescriptor ) ); - // - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &model ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCyclesResetL() - { - CMemSpyViewHeapTrackingResults* mainResultsMenu = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver ); - CleanupStack::PushL( mainResultsMenu ); - mainResultsMenu->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( mainResultsMenu ); - // - Container().SetNewActiveViewL( mainResultsMenu ); - } - - -void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) - { - } - - -void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) - { - } -*/ - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewHeapTrackingSettings.cpp --- a/memspyui/source/MemSpyViewHeapTrackingSettings.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,422 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewHeapTrackingSettings.h" - -// System includes -#include -#ifdef __EPOC32__ -#include -#endif -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpySettings.h" -#include "MemSpyViewHeapTracking.h" -#include "MemSpyContainerObserver.h" - - -CMemSpyViewHeapTrackingSettings::CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewHeapTrackingSettings::~CMemSpyViewHeapTrackingSettings() - { - } - - -void CMemSpyViewHeapTrackingSettings::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Settings" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewHeapTrackingSettings::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewHeapTrackingSettings::ViewType() const - { - return EMemSpyViewTypeHeapTrackingSettings; - } - - -CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareParentViewL() - { - CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareChildViewL() - { - const TInt index = iListBox->CurrentItemIndex(); - - // Get current config - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig config; - swmt.GetConfig( config ); - - // This view abuses the child view callback to toggle field values and/or - // display settings dialogs. - if ( index == 0 ) - { - TInt period = config.iTimerPeriod.Int() / 1000000; - CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( period ); - if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_TIMER_PERIOD ) ) - { - config.iTimerPeriod = period * 1000000; - } - } - else if ( index == 1 ) - { - TInt categories( config.iEnabledCategories ); - CSWMTCategorySelectionCheckBoxSettingItem* settingItem = new (ELeave) CSWMTCategorySelectionCheckBoxSettingItem( 0, categories ); - CleanupStack::PushL( settingItem ); - settingItem->ConstructL( EFalse, - 0, - _L("SWMT Categories"), - NULL, - R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE, - EAknCtPopupSettingList, - NULL, - NULL ); - - CMemSpySWMTCategorySelectionCheckBoxSettingPage* dlg = new(ELeave) CMemSpySWMTCategorySelectionCheckBoxSettingPage( R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE, settingItem->ItemArray() ); - dlg->SetSettingPageObserver( settingItem ); - if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) - { - config.iEnabledCategories = categories; - } - CleanupStack::PopAndDestroy( settingItem ); - } - else if ( index == 2 ) - { - config.iDumpData = !config.iDumpData; - } - else if ( index == 3 ) - { - TName nameFilter; - nameFilter.Copy( config.iThreadNameFilter ); - CMemSpyAllowEmptyDataDialog* dialog = new (ELeave) CMemSpyAllowEmptyDataDialog( nameFilter ); - if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_NAME_FILTER ) ) - { - config.iThreadNameFilter = nameFilter; - } - } - - // Push changes to SWMT - swmt.SetConfigL( config ); - Settings().StoreSettingsL(); - - RefreshL(); - return NULL; - } - - -void CMemSpyViewHeapTrackingSettings::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf item; - - // Get current config - CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); - TMemSpyEngineHelperSysMemTrackerConfig config; - swmt.GetConfig( config ); - - // 1st item - _LIT( KItem1Format, "\tTracking timer period\t\t%d (sec)" ); - item.Format( KItem1Format, config.iTimerPeriod.Int() / 1000000 ); - model->AppendL( item ); - - // 2nd item - _LIT( KItem3Format, "\tCategories\t\t%d selected" ); - item.Format( KItem3Format, config.EnabledCategoryCount() ); - model->AppendL( item ); - - // following items are related only to User Heap category, - // so hide them if User Heap is not selected - if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap ) - { - // 3th item - _LIT( KItem2Format, "\tDump data" ); - PrepareItemBufL( item, KItem2Format, config.iDumpData, config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap && config.iThreadNameFilter.Length() > 0 ); - model->AppendL( item ); - - // 4th item - if ( config.iDumpData ) - { - _LIT( KItem4Format, "\tHeap data thread filter\t\t%S" ); - if ( config.iThreadNameFilter.Length() > 0 ) - { - item.Format( KItem4Format, &config.iThreadNameFilter ); - } - else - { - item.Format( KItem4Format, &_L("No filtering") ); - } - model->AppendL( item ); - } - } - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -void CMemSpyViewHeapTrackingSettings::PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected ) - { - aBuf.Copy( aCaption ); - // - if ( aStatus ) - { - if ( aHeapCategorySelected ) - { - _LIT( KItemEnabled, "\t\tCustom" ); - aBuf.Append( KItemEnabled ); - } - else - { - _LIT( KItemEnabled, "\t\tAll user heaps" ); - aBuf.Append( KItemEnabled ); - } - } - else - { - _LIT( KItemDisabled, "\t\tDisabled" ); - aBuf.Append( KItemDisabled ); - } - } - - - - - - - - - -// -------------------------------------------------------------------------------------------- - -CSWMTCategorySelectionCheckBoxSettingItem::CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories ): - CAknSettingItem(aIdentifier), iExtCategories( aCategories ) - { - } - - -CSWMTCategorySelectionCheckBoxSettingItem::~CSWMTCategorySelectionCheckBoxSettingItem() - { - delete iSettingText; - if( iItemArray ) - { - iItemArray->ResetAndDestroy(); - delete iItemArray; - } - } - - -CSelectionItemList* CSWMTCategorySelectionCheckBoxSettingItem::ItemArray() const - { - return iItemArray; - } - - -void CSWMTCategorySelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel) - { - TBuf<64> buf; - buf.Copy( aLabel ); - CSelectableItem* item = new (ELeave) CSelectableItem( buf, EFalse ); - CleanupStack::PushL( item ); - item->ConstructL(); - iItemArray->AppendL( item ); // Ownership is transferred - CleanupStack::Pop(); // item - } - - -void CSWMTCategorySelectionCheckBoxSettingItem::CompleteConstructionL() - { - SetEmptyItemTextL(_L("Nothing selected")); - iItemArray = new(ELeave) CSelectionItemList(16); - AddNewItemToArrayL( _L("User Heap") ); // 0 - AddNewItemToArrayL( _L("Kernel Heap") ); // 1 - AddNewItemToArrayL( _L("User Stacks") ); // 2 - AddNewItemToArrayL( _L("Global Data") ); // 3 - AddNewItemToArrayL( _L("Disk Usage") ); // 4 - AddNewItemToArrayL( _L("Open Files") ); // 5 - AddNewItemToArrayL( _L("RAM-loaded Code") ); // 6 - AddNewItemToArrayL( _L("System Memory") ); // 7 - AddNewItemToArrayL( _L("Local Chunks") ); // 8 - AddNewItemToArrayL( _L("Global Chunks") ); // 9 - AddNewItemToArrayL( _L("RAM Drive") ); // 10 - AddNewItemToArrayL( _L("FileServer Cache") );// 11 - AddNewItemToArrayL( _L("Kernel Handles") ); // 12 - AddNewItemToArrayL( _L("Bitmap Handles") ); // 13 - AddNewItemToArrayL( _L("Window Groups") ); // 14 - } - - -void CSWMTCategorySelectionCheckBoxSettingItem::StoreL() - { - iExtCategories = 0; - if ( iItemArray->At( 11 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache; - if ( iItemArray->At( 13 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles; - if ( iItemArray->At( 0 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap; - if ( iItemArray->At( 1 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap; - if ( iItemArray->At( 8 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks; - if ( iItemArray->At( 9 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks; - if ( iItemArray->At( 10 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive; - if ( iItemArray->At( 2 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks; - if ( iItemArray->At( 3 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData; - if ( iItemArray->At( 6 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode; - if ( iItemArray->At( 12 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles; - if ( iItemArray->At( 5 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles; - if ( iItemArray->At( 4 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage; - if ( iItemArray->At( 7 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory; - if ( iItemArray->At( 14 )->SelectionStatus() ) - iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; - } - - -void CSWMTCategorySelectionCheckBoxSettingItem::LoadL() - { - iItemArray->At( 11 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache ); - iItemArray->At( 13 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles ); - iItemArray->At( 0 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap ); - iItemArray->At( 1 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap ); - iItemArray->At( 8 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks ); - iItemArray->At( 9 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks ); - iItemArray->At( 10 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive ); - iItemArray->At( 2 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks ); - iItemArray->At( 3 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData ); - iItemArray->At( 6 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode ); - iItemArray->At( 12 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles ); - iItemArray->At( 5 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles ); - iItemArray->At( 4 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage ); - iItemArray->At( 7 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory ); - iItemArray->At( 14 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups ); - } - - -void CSWMTCategorySelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ) - { - switch( aEventType ) - { - case EEventSettingOked: - { - // If settings oked, save new values - StoreL(); - break; - } - case EEventSettingCancelled: - { - // If setting is cancelled, load old values - LoadL(); - break; - } - case EEventSettingChanged: - { - // If setting has changed, update CBA visibility - static_cast( aSettingPage )->UpdateCba(); - break; - } - default: - { - break; - } - } - CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType ); - } - - -CMemSpySWMTCategorySelectionCheckBoxSettingPage::CMemSpySWMTCategorySelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray ) - : CAknCheckBoxSettingPage( aResourceID, aItemArray ) - { - } - - -void CMemSpySWMTCategorySelectionCheckBoxSettingPage::UpdateCba() - { - // Cache the pointer to button group container - CEikButtonGroupContainer* cba = Cba(); - // Left softkey should be visible if there are items selected, - // i.e. the selection index array has items. - TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 ); - // Resolve left softkey command id - TInt leftId( cba->ButtonGroup()->CommandId( 0 ) ); - // Check if left softkey visibility has changed - if( visible != cba->IsCommandVisible( leftId ) ) - { - // Left softkey visibility has changed, update it - cba->MakeCommandVisible( leftId, visible ); - } - } - - - - -CMemSpyAllowEmptyDataDialog::CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone ) - : CAknTextQueryDialog( aText, aTone ) - { - } - - -void CMemSpyAllowEmptyDataDialog::UpdateLeftSoftKeyL() - { - MakeLeftSoftkeyVisible( ETrue ); - } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewKernel.cpp --- a/memspyui/source/MemSpyViewKernel.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,161 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewKernel.h" - -// System includes -#include -#ifdef __EPOC32__ -#include -#endif - -// Engine includes -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" -#include "MemSpyViewKernelHeap.h" -#include "MemSpyViewKernelContainers.h" - - - -CMemSpyViewKernel::CMemSpyViewKernel( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewKernel::~CMemSpyViewKernel() - { - } - - -void CMemSpyViewKernel::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Kernel" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Make sure the correct item is selected - const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); - const TInt index = IndexByViewType( viewType ); - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - -void CMemSpyViewKernel::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewKernel::ViewType() const - { - return EMemSpyViewTypeKernel; - } - - -CMemSpyViewBase* CMemSpyViewKernel::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewKernel::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - const TInt index = iListBox->CurrentItemIndex(); - // - if ( index == 0 ) - { - child = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver ); - } - else if ( index == 1 ) - { - child = new(ELeave) CMemSpyViewKernelHeap( iEngine, iObserver ); - } - - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewKernel::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf item; - - // 1st item = Processes - _LIT( KItem1Format, "\tObjects" ); - item.Format( KItem1Format ); - model->AppendL( item ); - - // 2nd item = System Config - _LIT( KItem2Format, "\tHeap" ); - model->AppendL( KItem2Format ); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -TInt CMemSpyViewKernel::IndexByViewType( TMemSpyViewType aType ) - { - TInt index = 0; - // - switch( aType ) - { - default: - case EMemSpyViewTypeKernelContainers: - index = 0; - break; - case EMemSpyViewTypeKernelHeap: - index = 1; - break; - } - // - return index; - } - - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewKernelContainers.cpp --- a/memspyui/source/MemSpyViewKernelContainers.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewKernelContainers.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewKernel.h" -#include "MemSpyContainerObserver.h" -#include "MemSpyViewKernelObjects.h" - -// Literal constants - - - -CMemSpyViewKernelContainers::CMemSpyViewKernelContainers( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewKernelContainers::~CMemSpyViewKernelContainers() - { - delete iModel; - } - - -void CMemSpyViewKernelContainers::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Kernel Objects" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewKernelContainers::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewKernelContainers::ViewType() const - { - return EMemSpyViewTypeKernelContainers; - } - - -CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareParentViewL() - { - CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - const TInt index = iListBox->CurrentItemIndex(); - child = new(ELeave) CMemSpyViewKernelObjects( iEngine, iObserver, iModel->At( index ).Type() ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewKernelContainers::SetListBoxModelL() - { - // Take ownership of new model - CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers(); - CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL(); - delete iModel; - iModel = model; - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -TBool CMemSpyViewKernelContainers::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdKernelContainersOutput: - OnCmdOutputAllContainerContentsL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL() - { - CMemSpyEngineOutputSink& sink = iEngine.Sink(); - iModel->OutputL( sink ); - } - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewKernelHeap.cpp --- a/memspyui/source/MemSpyViewKernelHeap.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewKernelHeap.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewKernel.h" -#include "MemSpyContainerObserver.h" - -// Literal constants - - - -CMemSpyViewKernelHeap::CMemSpyViewKernelHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewKernelHeap::~CMemSpyViewKernelHeap() - { - } - - -void CMemSpyViewKernelHeap::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Kernel Heap" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewKernelHeap::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewKernelHeap::ViewType() const - { - return EMemSpyViewTypeKernelHeap; - } - - -CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareParentViewL() - { - CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - return child; - } - - -void CMemSpyViewKernelHeap::SetListBoxModelL() - { - // Get list contents - TMemSpyHeapInfo heapInfo; - iEngine.HelperHeap().GetHeapInfoKernelL( heapInfo ); - CMemSpyEngineOutputList* list = iEngine.HelperHeap().NewHeapSummaryShortLC( heapInfo ); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( list ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( list ); - } - - -TBool CMemSpyViewKernelHeap::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdKernelHeapDump: - OnCmdDumpKernelHeapL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewKernelHeap::OnCmdDumpKernelHeapL() - { - iEngine.HelperHeap().OutputHeapDataKernelL(); - } - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewKernelObjects.cpp --- a/memspyui/source/MemSpyViewKernelObjects.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,851 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewKernelObjects.h" - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewKernel.h" -#include "MemSpyContainerObserver.h" -#include "MemSpyViewKernelContainers.h" - -const TInt KMaxInfoLength = 128; - -CMemSpyViewKernelObjects::CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType ) -: CMemSpyViewBase( aEngine, aObserver ), - iObjectType( aObjectType ), - iCurrItemIndex( KErrNotFound ) - { - } - - -CMemSpyViewKernelObjects::~CMemSpyViewKernelObjects() - { - if ( iNavContainer && iNavDecorator ) - { - iNavContainer->Pop( iNavDecorator ); - delete iNavDecorator; - } - delete iModel; - delete iItems; - delete iObjectList; - } - - -void CMemSpyViewKernelObjects::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Kernel Objects" ); - SetTitleL( KTitle ); - iItems = new(ELeave) CDesCArrayFlat(5); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - CreateTabsL(); - } - - -CEikListBox* CMemSpyViewKernelObjects::ConstructListBoxL() - { - delete iListBox; - iListBox = NULL; - CAknSingleStyleListBox* listbox = new (ELeave) CAknSingleStyleListBox(); - iListBox = listbox; - listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); - listbox->SetContainerWindowL( *this ); - listbox->CreateScrollBarFrameL( ETrue ); - SetListBoxModelL(); - listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - listbox->SetListBoxObserver( this ); - listbox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); - listbox->SetObserver( this ); - return listbox; - } - - -void CMemSpyViewKernelObjects::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewKernelObjects::ViewType() const - { - return EMemSpyViewTypeKernelObjects; - } - - -CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareParentViewL() - { - if ( iNavContainer && iNavDecorator ) - { - iNavContainer->Pop( iNavDecorator ); - delete iNavDecorator; - iNavDecorator = NULL; - } - CMemSpyViewBase* parent = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - if ( iListBox && - iListBox->Model()->NumberOfItems() && - iListBox->CurrentItemIndex() > KErrNotFound ) - { - DetailsL(); - } - return child; - } - - -void CMemSpyViewKernelObjects::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == R_MEMSPY_MENUPANE ) - { - if ( iObjectType > EMemSpyDriverContainerTypeProcess ) - { - // Display Terminate, Switch to, End and Panic - // commands only for Threads and processes - aMenuPane->SetItemDimmed( EMemSpyCmdKernelObjects, ETrue ); - } - } - } - - -void CMemSpyViewKernelObjects::SetListBoxModelL() - { - _LIT( KLineFormatSpec, "\t%S" ); - - // Take ownership of new model - CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers(); - CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL(); - - delete iModel; - iModel = model; - - iItems->Reset(); - delete iObjectList; - iObjectList = NULL; - iObjectList = kernelContainerManager.ObjectsForSpecificContainerL( iObjectType ); - - // TODO: CMemSpyEngineGenericKernelObjectList could inherit MDesCArray like - // CMemSpyEngineGenericKernelObjectContainer does. iObjectList could then be passed - // to listbox model: - // listbox->Model()->SetItemTextArray( iObjectList ); - - TName item; - TName name; - for ( TInt i = 0; i < iObjectList->Count(); i++ ) - { - name.Copy( iObjectList->At( i ).iName ); - item.Format( KLineFormatSpec, &name ); - iItems->AppendL( item ); - } - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iItems ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -TBool CMemSpyViewKernelObjects::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdKernelObjectTerminate: - { - TRAPD( err, OnCmdTerminateL() ); - if ( err ) - { - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - note->ExecuteLD( _L("Cannot terminate task") ); - } - break; - } - case EMemSpyCmdKernelObjectSwitchTo: - { - TRAPD( err, OnCmdSwitchToL() ); - if ( err ) - { - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - note->ExecuteLD( _L("Cannot bring to foreground") ); - } - break; - } - case EMemSpyCmdKernelObjectEnd: - { - TRAPD( err, OnCmdEndL() ); - if ( err ) - { - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - note->ExecuteLD( _L("Cannot end task") ); - } - break; - } - case EMemSpyCmdKernelObjectPanic: - { - TRAPD( err, OnCmdPanicL() ); - if ( err ) - { - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - note->ExecuteLD( _L("Cannot panic task") ); - } - break; - } - default: - { - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - } - // - return handled; - } - - -TKeyResponse CMemSpyViewKernelObjects::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse resp = EKeyWasNotConsumed; - if ( iTabs && ( aKeyEvent.iScanCode == EStdKeyRightArrow || aKeyEvent.iScanCode == EStdKeyLeftArrow ) ) - { - resp = iTabs->OfferKeyEventL( aKeyEvent, aType ); - } - else - { - resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType ); - } - return resp; - } - - -void CMemSpyViewKernelObjects::TabChangedL( TInt /*aIndex*/ ) - { - iObjectType = (TMemSpyDriverContainerType)iTabs->ActiveTabId(); - RefreshL(); - } - - -void CMemSpyViewKernelObjects::OnCmdTerminateL() - { - switch ( iObjectType ) - { - case EMemSpyDriverContainerTypeThread: - { - TBool doTerminate = ETrue; - - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - - // Try to find the thread in question... - CMemSpyProcess* process = NULL; - CMemSpyThread* thread = NULL; - User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); - - if ( thread ) - { - thread->Open(); - // - if ( thread->IsSystemPermanent() || thread->IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - thread->TerminateL(); - } - } - RefreshL(); - break; - } - case EMemSpyDriverContainerTypeProcess: - { - TBool doTerminate = ETrue; - // Obtain the process that corresponds to the selected item - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - CMemSpyProcess& process = container.ProcessByIdL( id ); - process.Open(); - - if ( process.IsSystemPermanent() || process.IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - process.TerminateL(); - RefreshL(); - } - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - } - } - - -void CMemSpyViewKernelObjects::OnCmdSwitchToL() - { - TInt wgCount; - RWsSession wsSession; - User::LeaveIfError( wsSession.Connect() ); - CleanupClosePushL( wsSession ); - User::LeaveIfError( wgCount = wsSession.NumWindowGroups() ); - RArray wgArray; - CleanupClosePushL( wgArray ); - User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) ); - TApaTask task( wsSession ); - TBool brought( EFalse ); - TInt wgId( KErrNotFound ); - TThreadId threadId; - switch ( iObjectType ) - { - case EMemSpyDriverContainerTypeThread: - { - TThreadId currentThreadId( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - - // loop trough all window groups and see if a thread id matches - while( !brought && wgCount-- ) - { - wgId = wgArray[wgCount].iId; - User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) ); - if ( threadId == currentThreadId ) - { - CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId ); - task.SetWgId( wgId ); - if ( !wgName->Hidden() && task.Exists() ) - { - task.BringToForeground(); - brought = ETrue; - } - CleanupStack::PopAndDestroy( wgName ); - } - } - break; - } - case EMemSpyDriverContainerTypeProcess: - { - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - CMemSpyProcess& process = container.ProcessByIdL( id ); - - // loop trough threads in a process - for ( TInt i = 0; i < process.MdcaCount(); i++ ) - { - TInt wgCountLocal = wgCount; - - // loop trough all window groups and see if a thread id matches - while( !brought && wgCountLocal-- ) - { - wgId = wgArray[wgCountLocal].iId; - User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) ); - if ( threadId == process.At( i ).Id() ) - { - CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId ); - task.SetWgId( wgId ); - if ( !wgName->Hidden() && task.Exists() ) - { - task.BringToForeground(); - brought = ETrue; - } - CleanupStack::PopAndDestroy( wgName ); - } - } - } - - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - } - if ( !brought ) - { - // Error handling in HandleCommandL - User::Leave( KErrGeneral ); - } - CleanupStack::PopAndDestroy( 2 ); //wgArray,wsSession - } - - -void CMemSpyViewKernelObjects::OnCmdEndL() - { - switch ( iObjectType ) - { - case EMemSpyDriverContainerTypeThread: - { - TBool doTerminate = ETrue; - - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - - // Try to find the thread in question... - CMemSpyProcess* process = NULL; - CMemSpyThread* thread = NULL; - User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); - - if ( thread ) - { - thread->Open(); - // - if ( thread->IsSystemPermanent() || thread->IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - thread->KillL(); - } - } - RefreshL(); - break; - } - case EMemSpyDriverContainerTypeProcess: - { - TBool doTerminate = ETrue; - // Obtain the process that corresponds to the selected item - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - CMemSpyProcess& process = container.ProcessByIdL( id ); - process.Open(); - - if ( process.IsSystemPermanent() || process.IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - if ( doTerminate ) - { - process.KillL(); - RefreshL(); - } - - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - } - } - - -void CMemSpyViewKernelObjects::OnCmdPanicL() - { - switch ( iObjectType ) - { - case EMemSpyDriverContainerTypeThread: - { - TBool doTerminate = ETrue; - - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - - // Try to find the thread in question... - CMemSpyProcess* process = NULL; - CMemSpyThread* thread = NULL; - User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); - - if ( thread ) - { - thread->Open(); - // - if ( thread->IsSystemPermanent() || thread->IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - thread->PanicL(); - } - } - RefreshL(); - break; - } - case EMemSpyDriverContainerTypeProcess: - { - TBool doTerminate = ETrue; - // Obtain the process that corresponds to the selected item - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - CMemSpyProcess& process = container.ProcessByIdL( id ); - process.Open(); - - if ( process.IsSystemPermanent() || process.IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - if ( doTerminate ) - { - process.PanicL(); - RefreshL(); - } - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - } - } - - -void CMemSpyViewKernelObjects::CreateTabsL() - { - CEikStatusPane* statusPane = static_cast ( iEikonEnv->EikAppUi() )->StatusPane(); - TUid uid; - uid.iUid = EEikStatusPaneUidNavi; - iNavDecorator = ((CAknNavigationControlContainer*)(statusPane->ControlL(uid)))->Top(); - - if ( !iNavDecorator ) - { - iNavContainer = (CAknNavigationControlContainer*)statusPane->ControlL(uid); - iNavDecorator = iNavContainer->CreateTabGroupL(); - - iTabs = ( CAknTabGroup* )iNavDecorator->DecoratedControl(); - iTabs->SetTabFixedWidthL( KTabWidthWithThreeLongTabs ); - - for ( TInt i = 0; i < iModel->Count(); i++ ) - { - const CMemSpyEngineGenericKernelObjectList& item = iModel->At( i ); - iTabs->AddTabL( item.Type(), item.TypeAsString( item.Type() ) ); - } - iTabs->SetActiveTabById( iObjectType ); - iTabs->SetObserver( this ); - iNavContainer->PushL( *iNavDecorator ); - } - } - - -void CMemSpyViewKernelObjects::DetailsL() - { - HBufC* messageBuf = HBufC::NewLC( 40960 ); - TPtr messagePtr = messageBuf->Des(); - - const TMemSpyDriverHandleInfoGeneric& selectedObject = iObjectList->At( iListBox->CurrentItemIndex() ); - - // General attributes: - TFullName name; - name.Copy( selectedObject.iNameDetail ); - AppendFormatString( messagePtr, _L("Name: %S\n"), &name ); - name.Zero(); - name.Copy( selectedObject.iName ); - AppendFormatString( messagePtr, _L("FullName: %S\n"), &name ); - name.Zero(); - AppendFormatString( messagePtr, _L("AccessCount: %d\n"), selectedObject.iAccessCount ); - AppendFormatString( messagePtr, _L("UniqueID: %d\n"), selectedObject.iUniqueID ); - AppendFormatString( messagePtr, _L("Protection: %u\n"), selectedObject.iProtection ); - AppendFormatString( messagePtr, _L("OwnrAddr: 0x%08X\n"), selectedObject.iAddressOfKernelOwner ); - AppendFormatString( messagePtr, _L("KernelAddr: 0x%08X"), selectedObject.iHandle ); - - // Object type specific attributes: - switch ( selectedObject.iType ) - { - case EMemSpyDriverContainerTypeUnknown: - { - break; - } - case EMemSpyDriverContainerTypeThread: - { - AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), selectedObject.iAddressOfOwningProcess ); - AppendFormatString( messagePtr, _L("ThreadID: %d\n"), selectedObject.iId ); - AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority ); - TFullName procName; - procName.Copy( selectedObject.iNameOfOwner ); - AppendFormatString( messagePtr, _L("Proc: %S"), &procName ); - procName.Zero(); - break; - } - case EMemSpyDriverContainerTypeProcess: - { - AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), selectedObject.iAddressOfOwningProcess ); - AppendFormatString( messagePtr, _L("CreatorId: %u\n"), selectedObject.iCreatorId ); - AppendFormatString( messagePtr, _L("Attributes: 0x%08X\n"), selectedObject.iAttributes ); - AppendFormatString( messagePtr, _L("StckChnk: 0x%08X\n"), selectedObject.iAddressOfDataBssStackChunk ); - AppendFormatString( messagePtr, _L("ProcessID: %d\n"), selectedObject.iId ); - AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority ); - AppendFormatString( messagePtr, _L("SecurityZone: %d"), selectedObject.iSecurityZone ); - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TProcessId id( selectedObject.iId ); - TRAP_IGNORE( - CMemSpyProcess& process = container.ProcessByIdL( id ); - AppendFormatString( messagePtr, _L("\nSID: 0x%08X\n"), process.SID() ); - AppendFormatString( messagePtr, _L("VID: 0x%08X\n"), process.VID() ); - AppendFormatString( messagePtr, _L("UID1: 0x%08X\n"), process.UIDs()[0].iUid ); - AppendFormatString( messagePtr, _L("UID2: 0x%08X\n"), process.UIDs()[1].iUid ); - AppendFormatString( messagePtr, _L("UID3: 0x%08X\n"), process.UIDs()[2].iUid ); - AppendFormatString( messagePtr, _L("Caps: 0x%08X%08X"), process.Capabilities().iCaps[0], process.Capabilities().iCaps[1]); - ); - break; - } - case EMemSpyDriverContainerTypeChunk: - { - AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), selectedObject.iAddressOfOwningProcess ); - AppendFormatString( messagePtr, _L("Size: %d\n"), selectedObject.iSize ); - AppendFormatString( messagePtr, _L("MaxSize: %d\n"), selectedObject.iMaxSize ); - AppendFormatString( messagePtr, _L("Bottom: %d\n"), selectedObject.iBottom ); - AppendFormatString( messagePtr, _L("Top: %d\n"), selectedObject.iTop ); - AppendFormatString( messagePtr, _L("Attr: 0x%08X\n"), selectedObject.iAttributes ); - AppendFormatString( messagePtr, _L("Start: %d\n"), selectedObject.iStartPos ); - AppendFormatString( messagePtr, _L("CntrlID: %u\n"), selectedObject.iControllingOwner ); - AppendFormatString( messagePtr, _L("Restrictions: %u\n"), selectedObject.iRestrictions ); - AppendFormatString( messagePtr, _L("MapAttr: %u\n"), selectedObject.iMapAttr ); - AppendFormatString( messagePtr, _L("Type: %u\n"), selectedObject.iChunkType ); - TFullName procName; - procName.Copy( selectedObject.iNameOfOwner ); - AppendFormatString( messagePtr, _L("Proc: %S"), &procName ); - procName.Zero(); - // OwnerAddr iAddressOfKernelOwner already listed - // ProcAddr iAddressOfOwningProcess already listed - break; - } - case EMemSpyDriverContainerTypeLibrary: - { - AppendFormatString( messagePtr, _L("\nMapCount: %d\n"), selectedObject.iMapCount ); - AppendFormatString( messagePtr, _L("State: %u\n"), selectedObject.iState ); - AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), selectedObject.iAddressOfCodeSeg ); - break; - } - case EMemSpyDriverContainerTypeSemaphore: - { - AppendFormatString( messagePtr, _L("\nCount: %d\n"), selectedObject.iCount ); - AppendFormatString( messagePtr, _L("Resetting: %u"), selectedObject.iResetting ); - break; - } - case EMemSpyDriverContainerTypeMutex: - { - AppendFormatString( messagePtr, _L("\nHoldCount: %d\n"), selectedObject.iCount ); - AppendFormatString( messagePtr, _L("WaitCount: %d\n"), selectedObject.iWaitCount ); - AppendFormatString( messagePtr, _L("Resetting: %u\n"), selectedObject.iResetting ); - AppendFormatString( messagePtr, _L("Order: %u"), selectedObject.iOrder ); - break; - } - case EMemSpyDriverContainerTypeTimer: - { - AppendFormatString( messagePtr, _L("\nState: %d\n"), selectedObject.iTimerState ); - AppendFormatString( messagePtr, _L("Type: %d"), selectedObject.iTimerType ); - break; - } - case EMemSpyDriverContainerTypeServer: - { - // Owner == ThrdAddr - AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), selectedObject.iAddressOfOwningThread ); - TFullName thrName; - thrName.Copy( selectedObject.iNameOfOwner ); - AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName ); - thrName.Zero(); - AppendFormatString( messagePtr, _L("Type: %d\n"), selectedObject.iSessionType ); - TBuf8<55>buf; - RArray sessions; - CleanupClosePushL( sessions ); - iEngine.HelperServer().GetServerSessionsL( selectedObject, sessions ); - const TInt count = sessions.Count(); - for ( TInt i = 0; i < count; i++ ) - { - const TMemSpyDriverServerSessionInfo& session = sessions[ i ]; - AppendFormatString( messagePtr, _L("SessAddr: 0x%08X\n"), session.iAddress ); - TFullName sessName; - sessName.Copy( session.iName ); - AppendFormatString( messagePtr, _L("Sess: %S\n"), &sessName ); - } - CleanupStack::PopAndDestroy( &sessions ); - break; - } - case EMemSpyDriverContainerTypeSession: - { - // Server == SvrAddr - AppendFormatString( messagePtr, _L("\nServer: 0x%08X\n"), selectedObject.iAddressOfServer ); - TFullName srvName; - srvName.Copy( selectedObject.iName ); - AppendFormatString( messagePtr, _L("Srv: %S\n"), &srvName ); - srvName.Zero(); - // Session: not supported - AppendFormatString( messagePtr, _L("AccCount: %u\n"), selectedObject.iTotalAccessCount ); - AppendFormatString( messagePtr, _L("SesType: %u\n"), selectedObject.iSessionType ); - AppendFormatString( messagePtr, _L("SvrType: %u\n"), selectedObject.iSvrSessionType ); - AppendFormatString( messagePtr, _L("MsgCount: %d\n"), selectedObject.iMsgCount ); - AppendFormatString( messagePtr, _L("MsgLimit: %d"), selectedObject.iMsgLimit ); - break; - } - case EMemSpyDriverContainerTypeLogicalDevice: - { - AppendFormatString( messagePtr, - _L("\nVersion: %d.%d.%d\n"), - selectedObject.iVersion.iMajor, - selectedObject.iVersion.iMinor, - selectedObject.iVersion.iBuild ); - AppendFormatString( messagePtr, _L("ParseMask: 0x%08X\n"), selectedObject.iParseMask ); - AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), selectedObject.iUnitsMask ); - AppendFormatString( messagePtr, _L("Open channels: %d"), selectedObject.iOpenChannels ); - break; - } - case EMemSpyDriverContainerTypePhysicalDevice: - { - AppendFormatString( messagePtr, - _L("\nVersion: %d.%d.%d\n"), - selectedObject.iVersion.iMajor, - selectedObject.iVersion.iMinor, - selectedObject.iVersion.iBuild ); - AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), selectedObject.iUnitsMask ); - AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), selectedObject.iAddressOfCodeSeg ); - break; - } - case EMemSpyDriverContainerTypeLogicalChannel: - { - // No other details - break; - } - case EMemSpyDriverContainerTypeChangeNotifier: - { - AppendFormatString( messagePtr, _L("\nChanges: %u\n"), selectedObject.iChanges ); - // Thread == ThrdAddr - AppendFormatString( messagePtr, _L("ThrdAddr: 0x%08X\n"), selectedObject.iAddressOfOwningThread ); - TFullName thrName; - thrName.Copy( selectedObject.iNameOfOwner ); - AppendFormatString( messagePtr, _L("Thr: %S"), &thrName ); - thrName.Zero(); - break; - } - case EMemSpyDriverContainerTypeUndertaker: - { - // Thread == ThrdAddr - AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), selectedObject.iAddressOfOwningThread ); - TFullName thrName; - thrName.Copy( selectedObject.iNameOfOwner ); - AppendFormatString( messagePtr, _L("Thr: %S"), &thrName ); - thrName.Zero(); - break; - } - case EMemSpyDriverContainerTypeMsgQueue: - { - // No other details - break; - } - case EMemSpyDriverContainerTypePropertyRef: - { - /* - Not listing details here, as propertyRef is not listed in TaskMgr. - Following propertyRef attributes are available at engine side. - - IsReady - Type - Category - Key - RefCount - ThreadId - CreatorSID - */ - break; - } - case EMemSpyDriverContainerTypeCondVar: - { - AppendFormatString( messagePtr, _L("\nResetting: %u\n"), selectedObject.iResetting ); - // Using iAddressOfOwningThread for mutex - AppendFormatString( messagePtr, _L("Mutex: 0x%08X\n"), selectedObject.iAddressOfOwningThread ); - // Using iNameOfOwner for mutex - TFullName mtxName; - mtxName.Copy( selectedObject.iNameOfOwner ); - AppendFormatString( messagePtr, _L("Mtx: %S\n"), &mtxName ); - mtxName.Zero(); - AppendFormatString( messagePtr, _L("WaitCount: %d\n"), selectedObject.iWaitCount ); - - RArray threads; - CleanupClosePushL( threads ); - iEngine.HelperCondVar().GetCondVarSuspendedThreadsL( selectedObject, threads ); - const TInt count = threads.Count(); - for ( TInt i = 0; i < count; i++ ) - { - const TMemSpyDriverCondVarSuspendedThreadInfo& thr = threads[ i ]; - AppendFormatString( messagePtr, _L("SuspThrdAddr: 0x%08X\n"), thr.iAddress ); - TFullName thrName; - thrName.Copy( thr.iName ); - AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName ); - } - CleanupStack::PopAndDestroy( &threads ); - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - } - - CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); - dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG ); - TFileName headerText; - headerText.Copy( selectedObject.iName ); - dialog->SetHeaderTextL( headerText ); - dialog->SetMessageTextL(messagePtr); - dialog->RunLD(); - CleanupStack::PopAndDestroy( messageBuf ); - } - - -void CMemSpyViewKernelObjects::AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ) - { - TBuf infoString; - VA_LIST list; - VA_START ( list, aFmt ); - infoString.FormatList( aFmt, list ); - aPtr.Append( infoString ); - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewMainMenu.cpp --- a/memspyui/source/MemSpyViewMainMenu.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,300 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewMainMenu.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewProcesses.h" -#include "MemSpyViewRAMInfo.h" -#include "MemSpyViewROMInfo.h" -#include "MemSpyViewServerList.h" -#include "MemSpyViewOpenFiles.h" -#include "MemSpyViewFBServBitmaps.h" -#include "MemSpyViewSystemConfig.h" -#include "MemSpyViewCodeSegList.h" -#include "MemSpyViewChunkList.h" -#include "MemSpyViewKernel.h" -#include "MemSpyViewHeapTracking.h" -#include "MemSpyViewDriveInfo.h" -#include "MemSpyViewECom.h" -#include "MemSpyViewMemoryTrackingAutoStartConfig.h" -#include "MemSpyViewWindowGroups.h" - -// System includes -#include - - -CMemSpyViewMainMenu::CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -void CMemSpyViewMainMenu::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "MemSpy" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // Make sure the correct item is selected - const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); - const TInt index = IndexByViewType( viewType ); - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - -void CMemSpyViewMainMenu::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewMainMenu::ViewType() const - { - return EMemSpyViewTypeMainMenu; - } - - -CMemSpyViewBase* CMemSpyViewMainMenu::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - const TInt index = iListBox->CurrentItemIndex(); - -#ifdef __WINS__ - // threads & process view is not supported in the emulator environment - if ( index == 0 ) - { - CAknInformationNote* note = new (ELeave) CAknInformationNote; - note->ExecuteLD(_L("Not supported in the emulator, try Kernel -> Objects view")); - return NULL; - } -#endif - - if ( index == 0 ) - { - child = new(ELeave) CMemSpyViewProcesses( iEngine, iObserver ); - } - else if ( index == 1 ) - { - child = new(ELeave) CMemSpyViewRAMInfo( iEngine, iObserver ); - } - else if ( index == 2 ) - { - child = new(ELeave) CMemSpyViewROMInfo( iEngine, iObserver ); - } - else if ( index == 3 ) - { - child = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver ); - } - else if ( index == 4 ) - { - child = new(ELeave) CMemSpyViewServerList( iEngine, iObserver ); - } - else if ( index == 5 ) - { - child = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver ); - } - else if ( index == 6 ) - { - child = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver ); - } - else if ( index == 7 ) - { - child = new(ELeave) CMemSpyViewOpenFiles( iEngine, iObserver ); - } - else if ( index == 8 ) - { - child = new(ELeave) CMemSpyViewSystemConfig( iEngine, iObserver ); - } - else if ( index == 9 ) - { - child = new(ELeave) CMemSpyViewKernel( iEngine, iObserver ); - } - else if ( index == 10 ) - { - child = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver ); - } - else if ( index == 11 ) - { - child = new(ELeave) CMemSpyViewMemoryTrackingAutoStartConfig( iEngine, iObserver ); - } - else if ( index == 12 ) - { - child = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver ); - } - else if ( index == 13 ) - { - child = new(ELeave) CMemSpyViewECom( iEngine, iObserver ); - } - else if ( index == 14 ) - { - child = new(ELeave) CMemSpyViewWindowGroups( iEngine, iObserver ); - } - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewMainMenu::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf item; - - // 1st item = Processes - _LIT(KItem1Format, "\tProcesses & Threads"); - item.Format( KItem1Format ); - model->AppendL( item ); - - // 2nd item = RAM info - _LIT(KItem2Format, "\tRAM Info"); - model->AppendL( KItem2Format ); - - // 3rd item = ROM info - _LIT(KItem3Format, "\tROM Info"); - model->AppendL( KItem3Format ); - - // 4th item = FBServ Bitmaps - _LIT(KItem4Format, "\tFont & Bitmap\nServer"); - model->AppendL( KItem4Format ); - - // 5th item = Servers - _LIT(KItem5Format, "\tServers"); - item.Format( KItem5Format); - model->AppendL( item ); - - // 6th item = Chunks - _LIT(KItem6Format, "\tChunks"); - model->AppendL( KItem6Format ); - - // 7th item = Code Segments - _LIT(KItem7Format, "\tCode Segments"); - model->AppendL( KItem7Format ); - - // 8th item = Open Files - _LIT(KItem8Format, "\tOpen Files"); - model->AppendL( KItem8Format ); - - // 9th item = System Config - _LIT(KItem9Format, "\tSystem\nConfiguration"); - model->AppendL( KItem9Format ); - - // 10th item = Kernel - _LIT(KItem10Format, "\tKernel"); - model->AppendL( KItem10Format ); - - // 11th item = Heap Tracking - _LIT(KItem11Format, "\tSystem-Wide Memory Tracking"); - model->AppendL( KItem11Format ); - - // 12th item = Process-specific Tracking - _LIT(KItem12Format, "\tProcess-Specific Memory Tracking"); - model->AppendL( KItem12Format ); - - // 13th item = Drive Info - _LIT(KItem13Format, "\tDrive Summary"); - model->AppendL( KItem13Format ); - - // 14th item = ECOM - _LIT(KItem14Format, "\tECom"); - model->AppendL( KItem14Format ); - - // 15th item = Window Groups - _LIT(KItem15Format, "\tWindow Groups"); - model->AppendL( KItem15Format ); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -TInt CMemSpyViewMainMenu::IndexByViewType( TMemSpyViewType aType ) - { - TInt index = 0; - // - switch( aType ) - { - default: - case EMemSpyViewTypeProcesses: - index = 0; - break; - case EMemSpyViewTypeRAMInfo: - index = 1; - break; - case EMemSpyViewTypeROMInfo: - index = 2; - break; - case EMemSpyViewTypeFBServBitmaps: - index = 3; - break; - case EMemSpyViewTypeServerList: - index = 4; - break; - case EMemSpyViewTypeChunkList: - index = 5; - break; - case EMemSpyViewTypeCodeSegmentList: - index = 6; - break; - case EMemSpyViewTypeOpenFiles: - index = 7; - break; - case EMemSpyViewTypeSystemConfig: - index = 8; - break; - case EMemSpyViewTypeKernel: - index = 9; - break; - case EMemSpyViewTypeHeapTracking: - index = 10; - break; - case EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig: - index = 11; - break; - case EMemSpyViewTypeDriveSummary: - index = 12; - break; - case EMemSpyViewTypeECom: - index = 13; - break; - case EMemSpyViewTypeWindowGroups: - index = 14; - break; - } - // - return index; - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewMemoryTrackingAutoStartConfig.cpp --- a/memspyui/source/MemSpyViewMemoryTrackingAutoStartConfig.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,570 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewMemoryTrackingAutoStartConfig.h" - -// System includes -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - -// Literal constants -_LIT8( KMemSpyProcessMemoryTrackerXmlFileMimeType, "text/xml" ); -_LIT8( KMemSpyXmlSpec_MasterSection, "memspy_process_memory_tracking" ); -_LIT8( KMemSpyXmlSpec_EntryProcess, "process" ); -_LIT8( KMemSpyXmlSpec_EntryProcess_SID, "sid" ); -_LIT8( KMemSpyXmlSpec_HexPrefix, "0x" ); - - - -CMemSpyViewMemoryTrackingAutoStartConfig::CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewMemoryTrackingAutoStartConfig::~CMemSpyViewMemoryTrackingAutoStartConfig() - { - iProcessUids.Close(); - // - delete iParser; - delete iConverter; - // - delete iXMLFileNameInstallTime; - delete iXMLFileNameUserSupplied; - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - - // We only convert from UTF-8 to UTF-16 - iParser = CParser::NewL( KMemSpyProcessMemoryTrackerXmlFileMimeType, *this ); - iConverter = CCnvCharacterSetConverter::NewL(); - if ( iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iEngine.FsSession() ) == CCnvCharacterSetConverter::ENotAvailable ) - { - User::Leave(KErrNotFound); - } - - // Search for standard files - FindXmlInstallTimeL(); - FindXmlUserSuppliedL(); - - // Copy items to our own temporary list... - const RArray& list = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList(); - for( TInt i=0; iConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - - return parent; - } - - -TBool CMemSpyViewMemoryTrackingAutoStartConfig::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdMemoryTrackingAutoStartItemAdd: - OnCmdItemAddL(); - break; - case EMemSpyCmdMemoryTrackingAutoStartItemEdit: - OnCmdItemEditL(); - break; - case EMemSpyCmdMemoryTrackingAutoStartItemDelete: - OnCmdItemDeleteL(); - break; - case EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll: - OnCmdItemDeleteAllL(); - break; - case EMemSpyCmdMemoryTrackingAutoStartItemImport: - OnCmdItemImportL(); - break; - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - OnCmdItemEditL(); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf<128> buf; - _LIT( KProcUidFormatSpec, "\t0x%08x" ); - - const TInt count = iProcessUids.Count(); - for( TInt i=0; iAppendL( buf ); - } - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - iListBox->HandleItemAdditionL(); - iListBox->DrawDeferred(); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == MenuCascadeResourceId() ) - { - const TInt count = iProcessUids.Count(); - const TInt index = iListBox->CurrentItemIndex(); - - // We cannot edit an item if none exists - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemEdit, ( count == 0 || index < 0 || index > count - 1 ) ); - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDelete, ( count == 0 || index < 0 || index > count - 1 ) ); - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll, ( count <= 1 || index > count - 1 ) ); - - // We can only import items if an XML file is available - const TBool xmlAvailable = ( iXMLFileNameInstallTime->Length() || iXMLFileNameUserSupplied->Length() ); - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemImport, !xmlAvailable ); - } - } - - -TUint CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeResourceId() const - { - return R_MEMSPY_MENUPANE_MEMORY_TRACKING_AUTOSTART; - } - - -TInt CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeCommandId() const - { - return EMemSpyCmdMemoryTrackingAutoStart; - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemAddL() - { - const TUid uid = ShowDialogL( KNullUid ); - if ( uid != KNullUid ) - { - User::LeaveIfError( iProcessUids.Append( uid ) ); - SaveChangesL(); - RefreshL(); - iListBox->HandleItemAdditionL(); - iListBox->DrawDeferred(); - } - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemEditL() - { - const TInt index = iListBox->CurrentItemIndex(); - if ( index >= 0 && index < iProcessUids.Count() ) - { - TUid processUid = iProcessUids[ index ]; - processUid = ShowDialogL( processUid ); - // - if ( processUid != KNullUid ) - { - iProcessUids[ index ] = processUid; - SaveChangesL(); - RefreshL(); - iListBox->HandleItemAdditionL(); - iListBox->DrawDeferred(); - } - } - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteL() - { - const TInt index = iListBox->CurrentItemIndex(); - if ( index >= 0 && index < iProcessUids.Count() ) - { - iProcessUids.Remove( index ); - SaveChangesL(); - RefreshL(); - iListBox->HandleItemRemovalL(); - iListBox->DrawDeferred(); - - const TInt newIndex = index - 1; - const TInt count = iProcessUids.Count(); - if ( newIndex >=0 && newIndex < count ) - { - iListBox->SetCurrentItemIndex( index ); - } - } - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteAllL() - { - iProcessUids.Reset(); - SaveChangesL(); - RefreshL(); - iListBox->HandleItemRemovalL(); - iListBox->DrawDeferred(); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemImportL() - { - if ( iXMLFileNameInstallTime->Length() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_INSTALLED_XML_DIALOG ) ) - { - TRAP_IGNORE( ParseL( *iXMLFileNameInstallTime ) ); - } - } - if ( iXMLFileNameUserSupplied->Length() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_USERDEFINED_XML_DIALOG ) ) - { - TRAP_IGNORE( ParseL( *iXMLFileNameUserSupplied ) ); - } - } - - SaveChangesL(); - RefreshL(); - iListBox->HandleItemRemovalL(); - iListBox->DrawDeferred(); - } - - -TUid CMemSpyViewMemoryTrackingAutoStartConfig::ShowDialogL( TUid aUid ) - { - TUid uid = KNullUid; - // - _LIT( KProcessUidFormat, "%x" ); - TBuf<128> buf; - buf.Format( KProcessUidFormat, aUid ); - // - CAknTextQueryDialog* dialog = new(ELeave) CAknTextQueryDialog( buf ); - const TBool dialogActioned = ( dialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_PROCESS_UID_DIALOG ) ); - // - if ( dialogActioned ) - { - // Validate the text - uid = ValidateProcessUid( buf ); - } - // - return uid; - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::SaveChangesL() - { - iEngine.HelperProcess().SetMemoryTrackingAutoStartProcessListL( iProcessUids ); - Settings().StoreSettingsL(); - } - - -TUid CMemSpyViewMemoryTrackingAutoStartConfig::ValidateProcessUid( const TDesC& aUid ) - { - TUid ret = KNullUid; - TBool isValid = ETrue; - // - const TInt length = aUid.Length(); - for( TInt i=0; i= 8 ) - { - TRadix radix = EDecimal; - TPtrC8 pValue( value ); - // - if ( value.Length() == 10 && value.Left( 2 ) == KMemSpyXmlSpec_HexPrefix ) - { - pValue.Set( value.Mid( 2 ) ); - radix = EHex; - } - // - TUint32 uidVal = 0; - TLex8 lexer( pValue ); - const TInt err = lexer.Val( uidVal, radix ); - User::LeaveIfError( err ); - uid.iUid = uidVal; - gotSID = ETrue; - } - } - } - } - // - if ( gotSID ) - { - User::LeaveIfError( iProcessUids.Append( uid ) ); - } - else - { - User::Leave( KErrCorrupt ); - } - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndDocumentL( TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - // - const TPtrC8 name( aElement.LocalName().DesC() ); - // - if ( name.CompareF( KMemSpyXmlSpec_MasterSection ) == 0 ) - { - iSeenMasterSection = ETrue; - } - else if ( iSeenMasterSection && name.CompareF( KMemSpyXmlSpec_EntryProcess ) == 0 ) - { - OnSectionProcessL( aAttributes ); - } - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndElementL( const RTagInfo& /*aElement*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnContentL( const TDesC8& /*aBytes*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartPrefixMappingL( const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndPrefixMappingL( const RString& /*aPrefix*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnSkippedEntityL( const RString& /*aName*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnProcessingInstructionL( const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode ) - { - User::LeaveIfError( aErrorCode ); - } - - -void CMemSpyViewMemoryTrackingAutoStartConfig::OnError( TInt aErrorCode ) - { - iParserErrorCode = aErrorCode; - } - - -TAny* CMemSpyViewMemoryTrackingAutoStartConfig::GetExtendedInterface( const TInt32 /*aUid*/ ) - { - return NULL; - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewOpenFiles.cpp --- a/memspyui/source/MemSpyViewOpenFiles.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewOpenFiles.h" - -// System includes -#include -#include -#include -#include -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewThreads.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - - - - -CMemSpyViewOpenFiles::CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewOpenFiles::~CMemSpyViewOpenFiles() - { - iThreadIds.Close(); - iFileNames.Close(); - } - - -void CMemSpyViewOpenFiles::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Open Files" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -CEikListBox* CMemSpyViewOpenFiles::ConstructListBoxL() - { - delete iListBox; - iListBox = NULL; - CAknDoubleGraphicStyleListBox* listbox = new (ELeave) CAknDoubleGraphicStyleListBox(); - iListBox = listbox; - // - listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); - listbox->SetContainerWindowL( *this ); - listbox->CreateScrollBarFrameL( ETrue ); - SetListBoxModelL(); - listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - listbox->SetListBoxObserver( this ); - listbox->SetObserver( this ); - - // Create icon array - CAknIconArray* iconArray = new (ELeave) CAknIconArray(1); - CleanupStack::PushL( iconArray ); - - // Create bitmap - CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); - CleanupStack::PushL( bitmap ); - const TInt error1 = bitmap->Create( TSize(10,10), EColor16M ); - User::LeaveIfError( error1 ); - - // Create mask - CFbsBitmap* mask = new(ELeave) CFbsBitmap(); - CleanupStack::PushL( mask ); - const TInt error2 = mask->Create( TSize(10,10), EColor16M ); - User::LeaveIfError( error2 ); - - // Create icon & transfer bitmap - CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); - CleanupStack::Pop( 2, bitmap ); - CleanupStack::PushL( icon ); - - // Transfer icon to array - iconArray->AppendL( icon ); - CleanupStack::Pop( icon ); - - // Give icon array to listbox - static_cast(iListBox)->ItemDrawer()->FormattedCellData()->SetIconArrayL(iconArray); - CleanupStack::Pop( iconArray ); - // - return listbox; - } - - -void CMemSpyViewOpenFiles::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewOpenFiles::ViewType() const - { - return EMemSpyViewTypeOpenFiles; - } - - -TBool CMemSpyViewOpenFiles::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdToolsListOpenFiles: - OnCmdListOpenFilesL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewOpenFiles::OnCmdListOpenFilesL() - { - iEngine.ListOpenFilesL(); - } - - -CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - - // First, try to find the selected thread - if ( iActionedThreadId ) - { - // Try to create a view of the thread in question - CMemSpyProcess* process = NULL; - CMemSpyThread* thread = NULL; - const TInt error = iEngine.Container().ProcessAndThreadByThreadId( *iActionedThreadId, process, thread ); - if ( error == KErrNone && thread != NULL ) - { - child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, thread->Process() ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent(), thread ); - CleanupStack::Pop( child ); - } - } - // - return child; - } - - -void CMemSpyViewOpenFiles::SetListBoxModelL() - { - _LIT(KLineFormatSpec, "%d\t%S\t%S %S"); - - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf item; - TMemSpySizeText valueBuf; - TBuf<64> timeBuf; - - iFileNames.Reset(); - iThreadIds.Reset(); - iActionedThreadId = NULL; - - RFs& fsSession = iCoeEnv->FsSession(); - TOpenFileScan scanner( fsSession ); - - CFileList* list = NULL; - scanner.NextL( list ); - - TIdentityRelation comparer( CompareTEntryObjects ); - - while( list != NULL ) - { - CleanupStack::PushL( list ); - - const TInt entryCount = list->Count(); - for(TInt i=0; iAppendL( item ); - iThreadIds.AppendL( scanner.ThreadId() ); - iFileNames.AppendL( entry ); - } - } - - CleanupStack::PopAndDestroy( list ); - list = NULL; - scanner.NextL( list ); - } - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -void CMemSpyViewOpenFiles::HandleListBoxItemActionedL( TInt aCurrentIndex ) - { - if ( aCurrentIndex >= 0 && aCurrentIndex < iThreadIds.Count() ) - { - iActionedThreadId = &iThreadIds[ aCurrentIndex ]; - } - else - { - iActionedThreadId = NULL; - } - - // Notify observer about an item being 'fired' - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -TBool CMemSpyViewOpenFiles::CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight ) - { - return ( aLeft.iName.CompareF( aRight.iName ) == 0 ); - } - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewProcesses.cpp --- a/memspyui/source/MemSpyViewProcesses.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,513 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewProcesses.h" - -// System includes -#include -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyViewThreads.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - -// Constants -const TInt KMemSpyMaxSearchTextLength = 30; -const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4; - - - -CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewProcesses::CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ) -: CMemSpyViewBase( aEngine, aObserver ), iCurrentProcess( &aProcess ) - { - iCurrentProcess->Open(); - } - - -CMemSpyViewProcesses::~CMemSpyViewProcesses() - { - if ( iCurrentProcess ) - { - iCurrentProcess->Close(); - } - // - delete iSearchField; - delete iMatcherBuffer; - } - - -void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Processes\n& Threads" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - // - iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards ); - // - iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength ); - iSearchField->SetObserver( this ); - iSearchField->SetFocus( ETrue ); - iSearchField->SetComponentsToInheritVisibility( ETrue ); - // - CMemSpyEngineObjectContainer& container = iEngine.Container(); - if ( aSelectionRune ) - { - CMemSpyProcess* selectedItem = reinterpret_cast< CMemSpyProcess* >( aSelectionRune ); - const TInt index = container.ProcessIndexById( selectedItem->Id() ); - if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - } - else if ( container.Count() > 0 ) - { - iListBox->SetCurrentItemIndex( 0 ); - HandleListBoxItemSelectedL( 0 ); - } - // - SizeChanged(); - ActivateL(); - } - - -CMemSpyProcess& CMemSpyViewProcesses::CurrentProcess() const - { - __ASSERT_ALWAYS( iCurrentProcess != NULL, User::Invariant() ); - return *iCurrentProcess; - } - - -void CMemSpyViewProcesses::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewProcesses::ViewType() const - { - return EMemSpyViewTypeProcesses; - } - - -CMemSpyViewBase* CMemSpyViewProcesses::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL() - { - CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, *iCurrentProcess ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewProcesses::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == MenuCascadeResourceId() ) - { - CMemSpyProcess& process = CurrentProcess(); - const TBool hide = ( iEngine.Container().Count() == 0 ) || process.IsDead(); - // - aMenuPane->SetItemDimmed( EMemSpyCmdProcessInfo, hide ); - aMenuPane->SetItemDimmed( EMemSpyCmdProcessEnd, hide ); - } - } - - -TBool CMemSpyViewProcesses::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - // Sorting - case EMemSpyCmdProcessSortById: - OnCmdSortByIdL(); - break; - case EMemSpyCmdProcessSortByName: - OnCmdSortByNameL(); - break; - case EMemSpyCmdProcessSortByThreadCount: - OnCmdSortByThreadCountL(); - break; - case EMemSpyCmdProcessSortByCodeSegs: - OnCmdSortByCodeSegsL(); - break; - case EMemSpyCmdProcessSortByHeapUsage: - OnCmdSortByHeapUsageL(); - break; - case EMemSpyCmdProcessSortByStackUsage: - OnCmdSortByStackUsageL(); - break; - // End - case EMemSpyCmdProcessEndTerminate: - OnCmdEndTerminateL(); - break; - case EMemSpyCmdProcessEndKill: - OnCmdEndKillL(); - break; - case EMemSpyCmdProcessEndPanic: - OnCmdEndPanicL(); - break; - // Info - case EMemSpyCmdProcessInfoSummary: - OnCmdInfoSummaryL(); - break; - case EMemSpyCmdProcessInfoHandles: - OnCmdInfoHandlesL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewProcesses::OnCmdSortByIdL() - { - iEngine.Container().SortById(); - RefreshL(); - } - - -void CMemSpyViewProcesses::OnCmdSortByNameL() - { - iEngine.Container().SortByName(); - RefreshL(); - } - - -void CMemSpyViewProcesses::OnCmdSortByThreadCountL() - { - iEngine.Container().SortByThreadCount(); - RefreshL(); - } - - -void CMemSpyViewProcesses::OnCmdSortByCodeSegsL() - { - iEngine.Container().SortByCodeSegs(); - RefreshL(); - } - - -void CMemSpyViewProcesses::OnCmdSortByHeapUsageL() - { - iEngine.Container().SortByHeapUsage(); - RefreshL(); - } - - -void CMemSpyViewProcesses::OnCmdSortByStackUsageL() - { - iEngine.Container().SortByStackUsage(); - RefreshL(); - } - - -void CMemSpyViewProcesses::OnCmdInfoSummaryL() - { - CMemSpyProcess& process = CurrentProcess(); - iEngine.HelperProcess().OutputProcessInfoL( process ); - } - - -void CMemSpyViewProcesses::OnCmdInfoHandlesL() - { - CMemSpyProcess& process = CurrentProcess(); - // - const TInt threadCount = process.Count(); - for( TInt i=0; iExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - process.TerminateL(); - RefreshL(); - } - } - - -void CMemSpyViewProcesses::OnCmdEndPanicL() - { - TBool doTerminate = ETrue; - CMemSpyProcess& process = CurrentProcess(); - // - if ( process.IsSystemPermanent() || process.IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - process.PanicL(); - RefreshL(); - } - } - - -void CMemSpyViewProcesses::OnCmdEndKillL() - { - TBool doTerminate = ETrue; - CMemSpyProcess& process = CurrentProcess(); - // - if ( process.IsSystemPermanent() || process.IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - process.KillL(); - RefreshL(); - } - } - - - - -void CMemSpyViewProcesses::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iEngine.Container() ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewProcesses::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - // Notify observer about an item being 'fired' - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewProcesses::HandleListBoxItemSelectedL( TInt aIndex ) - { - if ( iCurrentProcess ) - { - iCurrentProcess->Close(); - } - - // Obtain the process that corresponds to the selected item - CMemSpyEngineObjectContainer& container = iEngine.Container(); - CMemSpyProcess& process = container.At( aIndex ); - iCurrentProcess = &process; - iCurrentProcess->Open(); - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - -void CMemSpyViewProcesses::SizeChanged() - { - const TRect rect( Rect() ); - - if ( iListBox && iSearchField ) - { - const TInt lafIndex_H = 1; - AknLayoutUtils::LayoutControl( iListBox, rect, AknLayout::list_gen_pane( lafIndex_H ) ); - AknLayoutUtils::LayoutControl( iSearchField, rect, AknLayout::find_pane() ); - } - else - { - CMemSpyViewBase::SizeChanged(); - } - -/* - // Search field - TSize searchFieldSize( iSearchField->MinimumSize() ); // BALLS: search field doesn't implement minimum size correctly?!?!? - searchFieldSize.SetWidth( rect.Width() ); - const TRect searchFieldRect( TPoint( rect.iTl.iX, rect.iBr.iY ), searchFieldSize ); - iSearchField->SetRect( searchFieldRect ); - - // Listbox - TSize listBoxSize( rect.Size() - TSize( 0, searchFieldSize.iHeight ) ); - iListBox->SetRect( rect.iTl, listBoxSize ); -*/ - } - - -TInt CMemSpyViewProcesses::CountComponentControls() const - { - TInt count = 0; - // - if ( iListBox != NULL ) - { - ++count; - } - if ( iSearchField != NULL ) - { - ++count; - } - // - return count; - } - - -CCoeControl* CMemSpyViewProcesses::ComponentControl( TInt aIndex ) const - { - CCoeControl* ret = iListBox; - // - if ( aIndex == 1 ) - { - ret = iSearchField; - } - // - return ret; - } - - -TKeyResponse CMemSpyViewProcesses::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - TKeyResponse resp = EKeyWasNotConsumed; - // - if ( aType == EEventKey ) - { - switch( aKeyEvent.iCode ) - { - case EKeyUpArrow: - case EKeyDownArrow: - case EKeyEnter: - case EKeyOK: - if ( iListBox ) - { - resp = iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - break; - default: - break; - } - // - if ( resp == EKeyWasNotConsumed ) - { - // Do we need to show the find field? - resp = iSearchField->OfferKeyEventL( aKeyEvent, aType ); - } - } - // - return resp; - } - - -void CMemSpyViewProcesses::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) - { - CMemSpyViewBase::HandleControlEventL( aControl, aEventType ); - // - if ( aEventType == MCoeControlObserver::EEventStateChanged ) - { - if ( aControl == iSearchField ) - { - SelectListBoxItemByFindTextL(); - } - } - } - - -void CMemSpyViewProcesses::FocusChanged( TDrawNow /*aDrawNow*/ ) - { - if ( iListBox ) - { - iListBox->SetFocus( IsFocused() ); - } - if ( iSearchField ) - { - iSearchField->SetFocus( IsFocused() ); - } - } - - -void CMemSpyViewProcesses::SelectListBoxItemByFindTextL() - { - _LIT( KMemSpyWildcardCharacter, "*" ); - - TPtr pBuffer( iMatcherBuffer->Des() ); - iSearchField->GetSearchText( pBuffer ); - //pBuffer.Insert( 0, KMemSpyWildcardCharacter ); - pBuffer.Append( KMemSpyWildcardCharacter ); - - CMemSpyEngineObjectContainer& container = iEngine.Container(); - const TInt count = container.Count(); - // - TInt index = 0; - while( index < count ) - { - CMemSpyProcess& process = container.At( index ); - const TPtrC processName( process.Name() ); - // - if ( processName.MatchF( pBuffer ) >= 0 ) - { - HandleListBoxItemSelectedL( index ); - iListBox->ScrollToMakeItemVisible( index ); - iListBox->SetCurrentItemIndexAndDraw( index ); - return; - } - - ++index; - } - } - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewRAMInfo.cpp --- a/memspyui/source/MemSpyViewRAMInfo.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewRAMInfo.h" - -// System includes -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - - - - - - -CMemSpyViewRAMInfo::CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -void CMemSpyViewRAMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "RAM Info" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewRAMInfo::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewRAMInfo::ViewType() const - { - return EMemSpyViewTypeRAMInfo; - } - - -CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - return child; - } - - -void CMemSpyViewRAMInfo::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf item; - - TInt value; - TMemSpySizeText size; - TMemoryInfoV1Buf memInfoBuf; - UserHal::MemoryInfo( memInfoBuf ); - const TMemoryInfoV1 memInfo( memInfoBuf() ); - - // 1st item = Total RAM - _LIT(KItem1Format, "\tTotal RAM\t\t%S"); - size = MemSpyUiUtils::FormatSizeText( memInfo.iTotalRamInBytes ); - item.Format( KItem1Format, &size ); - model->AppendL( item ); - - // 2nd item = Max free RAM - _LIT(KItem2Format, "\tMax Free RAM\t\t%S"); - size = MemSpyUiUtils::FormatSizeText( memInfo.iMaxFreeRamInBytes ); - item.Format( KItem2Format, &size ); - model->AppendL( item ); - - // 3rd item = Free RAM - _LIT(KItem3Format, "\tFree RAM\t\t%S (%S)"); - const TMemSpyPercentText freeRamPercentage( MemSpyEngineUtils::FormatPercentage( TReal( memInfo.iTotalRamInBytes ), TReal( memInfo.iFreeRamInBytes ) ) ); - size = MemSpyUiUtils::FormatSizeText( memInfo.iFreeRamInBytes ); - item.Format( KItem3Format, &size, &freeRamPercentage ); - model->AppendL( item ); - - // 4th item = RAM disk info - _LIT(KItem4Format, "\tRAM Disk Size\t\t%S"); - size = MemSpyUiUtils::FormatSizeText( memInfo.iInternalDiskRamInBytes ); - item.Format( KItem4Format, &size ); - model->AppendL( item ); - - // 5th item = Max RAM disk size - _LIT(KItem5Format, "\tMax RAM Disk Size\t\t%S"); - HAL::Get( HALData::EMaxRAMDriveSize, value ); - size = MemSpyUiUtils::FormatSizeText( value ); - item.Format( KItem5Format, &size ); - model->AppendL( item ); - - // 6th item = RAM page size - _LIT(KItem6Format, "\tMemory Page Size\t\t%S"); - HAL::Get( HALData::EMemoryPageSize, value ); - size = MemSpyUiUtils::FormatSizeText( value ); - item.Format( KItem6Format, &size ); - model->AppendL( item ); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -TBool CMemSpyViewRAMInfo::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - if ( iEngine.HelperRAM().IsAknIconCacheConfigurable() ) - { - switch ( aCommand ) - { - case EMemSpyCmdRAMAvkonIconCacheDisabled: - OnCmdSetIconCacheStatusL( EFalse ); - break; - case EMemSpyCmdRAMAvkonIconCacheEnabled: - OnCmdSetIconCacheStatusL( ETrue ); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - } - else - { - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - } - // - return handled; - } - - -void CMemSpyViewRAMInfo::OnCmdSetIconCacheStatusL( TBool aEnabled ) - { - ASSERT( iEngine.HelperRAM().IsAknIconCacheConfigurable() ); - // - const TInt64 savedAmount = iEngine.HelperRAM().SetAknIconCacheStatusL( aEnabled ); - if ( !aEnabled ) - { - TBuf<128> buf; - // - if ( savedAmount != 0 ) - { - _LIT(KSavedAmountFormatBuffer, "Saved %S of RAM"); - const TMemSpySizeText savedAmountString( MemSpyEngineUtils::FormatSizeText( savedAmount, 0, EFalse ) ); - buf.Format( KSavedAmountFormatBuffer, &savedAmountString ); - } - else - { - _LIT(KDidNotSaveAnyRAM, "Operation did not save any RAM"); - buf.Copy( KDidNotSaveAnyRAM ); - } - - // Show dialog - CAknNoteDialog* note = new( ELeave ) CAknNoteDialog( CAknNoteDialog::ENoTone ); - CleanupStack::PushL( note ); - note->SetTextWrapping( ETrue ); - note->PrepareLC( R_MEMSPY_RAM_MEMORY_DELTA_DIALOG ); - note->SetTextL( buf ); - CleanupStack::Pop( note ); - note->RunLD(); - } - // - RefreshL(); - } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewROMInfo.cpp --- a/memspyui/source/MemSpyViewROMInfo.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,270 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewROMInfo.h" - -// System includes -#include -#ifdef __EPOC32__ -#include -#endif - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - -// Remap of E32 DP constants, needed so MemSpy can still build on v9.1 -enum TMemSpyDemandPagingKernelConfigFlags - { - EMemSpyKernelConfigPagingPolicyMask = 3<<5, - EMemSpyKernelConfigPagingPolicyNoPaging = 0<<5, - EMemSpyKernelConfigPagingPolicyAlwaysPage = 1<<5, - EMemSpyKernelConfigPagingPolicyDefaultUnpaged = 2<<5, - EMemSpyKernelConfigPagingPolicyDefaultPaged = 3<<5, - }; - - - -CMemSpyViewROMInfo::CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -void CMemSpyViewROMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "ROM Info" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewROMInfo::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewROMInfo::ViewType() const - { - return EMemSpyViewTypeROMInfo; - } - - -CMemSpyViewBase* CMemSpyViewROMInfo::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewROMInfo::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - return child; - } - - -void CMemSpyViewROMInfo::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - CleanupStack::PushL( model ); - - TBuf item; - - TInt value = 0; - TMemSpySizeText valueBuf; - TMemSpySizeText valueBuf2; - - // 1st item = Total RAM - _LIT(KItem1Format, "\tROM Size (HAL)\t\t%S"); - HAL::Get( HALData::EMemoryROM, value ); - valueBuf = MemSpyUiUtils::FormatSizeText( value ); - item.Format( KItem1Format, &valueBuf ); - model->AppendL( item ); - -#ifdef __EPOC32__ - TBuf<128> buf2; - _LIT( KTimeFormatSpecLocal, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" ); - const TUint main_start = UserSvr::RomHeaderAddress(); - TRomHeader* romHeader = (TRomHeader*) main_start; - - _LIT(KItem2Format, "\tROM Size (Header)\t\t%S"); - valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iRomSize ) ); - item.Format( KItem2Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem2aFormat, "\tROM Page Size\t\t%S"); - HAL::Get( HALData::EMemoryPageSize, value ); - valueBuf = MemSpyUiUtils::FormatSizeText( value ); - item.Format( KItem2aFormat, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem10Format, "\tVersion\t\tv%2d.%02d.%06d"); - item.Format( KItem10Format, romHeader->iVersion.iMajor, romHeader->iVersion.iMinor, romHeader->iVersion.iBuild ); - model->AppendL( item ); - - _LIT(KItem3Format, "\tTimestamp\t\t%S"); - TTime time( romHeader->iTime ); - time.FormatL( buf2, KTimeFormatSpecLocal ); - item.Format( KItem3Format, &buf2 ); - model->AppendL( item ); - - _LIT(KItem4Format, "\tAddress Range\t\t%S - %S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomBase ); - MemSpyUiUtils::FormatHex( valueBuf2, (romHeader->iRomBase + romHeader->iRomSize )); - item.Format( KItem4Format, &valueBuf, &valueBuf2 ); - model->AppendL( item ); - - _LIT(KItem5Format, "\tPrimary File Address\t\t%S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iPrimaryFile ); - item.Format( KItem5Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem6Format, "\tSecondary File Address\t\t%S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iSecondaryFile ); - item.Format( KItem6Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem7Format, "\tChecksum\t\t%S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iCheckSum ); - item.Format( KItem7Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem8Format, "\tKernel Config Flags\t\t%S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iKernelConfigFlags ); - item.Format( KItem8Format, &valueBuf ); - model->AppendL( item ); - - if ( romHeader->iKernelConfigFlags & EKernelConfigIpcV1Available ) - { - _LIT(KItem8aFormat, "\tIPC v1 Available\t\tYes"); - item.Copy( KItem8aFormat ); - model->AppendL( item ); - } - if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforcement ) - { - _LIT(KItem8bFormat, "\tPlatSec Enforcement\t\tYes"); - item.Copy( KItem8bFormat ); - model->AppendL( item ); - } - if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecDiagnostics ) - { - _LIT(KItem8cFormat, "\tPlatSec Diagnostics\t\tYes"); - item.Copy( KItem8cFormat ); - model->AppendL( item ); - } - if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecProcessIsolation ) - { - _LIT(KItem8dFormat, "\tPlatSec Process Isolation\t\tYes"); - item.Copy( KItem8dFormat ); - model->AppendL( item ); - } - if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforceSysBin ) - { - _LIT(KItem8eFormat, "\tEnforce \\Sys\\Bin\\\t\tYes"); - item.Copy( KItem8eFormat ); - model->AppendL( item ); - } - - const TUint32 pagingPolicy = ( romHeader->iKernelConfigFlags & EMemSpyKernelConfigPagingPolicyMask ); -#ifdef _DEBUG - RDebug::Printf( "pagingPolicy: %u (0x%08x)", pagingPolicy, pagingPolicy ); -#endif - _LIT(KItem8eFormat, "\tDemand Paging\t\t%S"); - // - if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyNoPaging ) - { - _LIT( KDemandPagingPolicyNoPaging, "No Paging" ); - item.Format( KItem8eFormat, &KDemandPagingPolicyNoPaging ); - } - else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyAlwaysPage ) - { - _LIT( KDemandPagingPolicyAlwaysPage, "Always Paging" ); - item.Format( KItem8eFormat, &KDemandPagingPolicyAlwaysPage); - } - else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultUnpaged ) - { - _LIT( KDemandPagingPolicyDefaultUnpaged, "Default Unpaged" ); - item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultUnpaged); - } - else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultPaged ) - { - _LIT( KDemandPagingPolicyDefaultPaged, "Default Paged" ); - item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultPaged ); - } - // - model->AppendL( item ); - - _LIT(KItem9Format, "\tSection Header Address\t\t%S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomSectionHeader ); - item.Format( KItem9Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem11Format, "\tCompressed Size\t\t%S"); - valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iCompressedSize ) ); - item.Format( KItem11Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem12Format, "\tUncompressed Size\t\t%S"); - valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iUncompressedSize ) ); - item.Format( KItem12Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem13Format, "\tDisabled Caps. #1\t\t%S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[0] ); - item.Format( KItem13Format, &valueBuf ); - model->AppendL( item ); - - _LIT(KItem14Format, "\tDisabled Caps. #2\t\t%S"); - MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[1] ); - item.Format( KItem14Format, &valueBuf ); - model->AppendL( item ); - - for(TInt i=0; iiTraceMask[i] ); - item.Format( KItem15Format, i+1, &valueBuf ); - model->AppendL( item ); - } - -#endif - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewServerList.cpp --- a/memspyui/source/MemSpyViewServerList.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,227 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewServerList.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyViewThreads.h" -#include "MemSpyContainerObserver.h" - - - - -CMemSpyViewServerList::CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewServerList::~CMemSpyViewServerList() - { - delete iList; - } - - -void CMemSpyViewServerList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Running Servers" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -TBool CMemSpyViewServerList::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdServerListSortByName: - OnCmdServerListSortByNameL(); - break; - case EMemSpyCmdServerListSortBySessionCount: - OnCmdServerListSortBySessionCountL(); - break; - case EMemSpyCmdServerListOutputListCSV: - OnCmdServerListOutputSummaryL(); - break; - case EMemSpyCmdServerListOutputListDetailed: - OnCmdServerListOutputDetailedL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewServerList::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewServerList::ViewType() const - { - return EMemSpyViewTypeServerList; - } - - -CMemSpyViewBase* CMemSpyViewServerList::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewServerList::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - - // First, try to find the selected thread - if ( iActionedItem ) - { - // Try to create a view of the thread in question - CMemSpyProcess* process = NULL; - CMemSpyThread* thread = NULL; - // - const TInt error = iEngine.Container().ProcessAndThreadByThreadId( iActionedItem->Id(), process, thread ); - // - if ( error == KErrNone && thread != NULL ) - { - child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, thread->Process() ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent(), thread ); - CleanupStack::Pop( child ); - } - } - // - return child; - } - - -void CMemSpyViewServerList::SetListBoxModelL() - { - delete iList; - iList = NULL; - iList = iEngine.HelperServer().ServerListL(); - // - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iList ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewServerList::HandleListBoxItemActionedL( TInt aCurrentIndex ) - { - if ( aCurrentIndex >= 0 && aCurrentIndex < iList->Count() ) - { - const CMemSpyEngineServerEntry& serverInfo = iList->At( aCurrentIndex ); - iActionedItem = &serverInfo; - } - else - { - iActionedItem = NULL; - } - - // Notify observer about an item being 'fired' - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewServerList::OnCmdServerListSortByNameL() - { - iList->SortByNameL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewServerList::OnCmdServerListSortBySessionCountL() - { - iList->SortBySessionCountL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewServerList::OnCmdServerListOutputSummaryL() - { - OnCmdServerListOutputGenericL( EFalse ); - } - - -void CMemSpyViewServerList::OnCmdServerListOutputDetailedL() - { - OnCmdServerListOutputGenericL( ETrue ); - } - - -void CMemSpyViewServerList::OnCmdServerListOutputGenericL( TBool aDetailed ) - { - // Begin a new data stream - _LIT( KMemSpyContext, "Server List - " ); - _LIT( KMemSpyFolder, "Servers" ); - iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); - - // Set prefix for overall listing - iEngine.Sink().OutputPrefixSetLC( KMemSpyContext ); - - // Create header - CMemSpyEngineServerList::OutputDataColumnsL( iEngine, aDetailed ); - - // List items - const TInt count = iList->Count(); - for(TInt i=0; iAt( i ); - // - server.OutputDataL( iEngine.HelperServer(), aDetailed ); - } - - // Tidy up - CleanupStack::PopAndDestroy(); // prefix - - // End data stream - iEngine.Sink().DataStreamEndL(); - } - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewSystemConfig.cpp --- a/memspyui/source/MemSpyViewSystemConfig.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,883 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewSystemConfig.h" - -// System includes -#include -#include -#include -#ifdef __EPOC32__ -#include -#endif - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - -// Literal constants -_LIT( KMemSpyItemValueNotKnown, "Unknown" ); - - - -CMemSpyViewSystemConfig::CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewSystemConfig::~CMemSpyViewSystemConfig() - { - delete iModel; - } - - -void CMemSpyViewSystemConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "System Configuration" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -void CMemSpyViewSystemConfig::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewSystemConfig::ViewType() const - { - return EMemSpyViewTypeSystemConfig; - } - - -CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - return child; - } - - -void CMemSpyViewSystemConfig::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); - delete iModel; - iModel = model; - - TBuf<128> valueBuf; - TInt value = 0; - TInt value2 = 0; - TMemSpySizeText sizeBuf; - - // - _LIT(KItem1Format, "Manufacturer"); - GetManufacturer( valueBuf ); - AddItemL( KItem1Format, valueBuf ); - - // - _LIT(KItem2Format, "Machine Uid"); - GetMachineUid( valueBuf ); - AddItemL( KItem2Format, valueBuf ); - - // - _LIT(KItem1aFormat, "Model Uid"); - GetHALValueAsHexL( HALData::EModel, KItem1aFormat ); - - // - _LIT(KItem2aFormat, "Device Family"); - GetDeviceFamily( valueBuf ); - AddItemL( KItem2aFormat, valueBuf ); - - // - _LIT(KItem2bFormat, "Device Family Rev."); - GetHALValueAsNumericL( HALData::EDeviceFamilyRev, KItem2bFormat ); - - // - _LIT(KItem3Format, "Hardware Rev."); - GetHALValueAsNumericL( HALData::EManufacturerHardwareRev, KItem3Format ); - - // - _LIT(KItem4Format, "Software Rev."); - GetHALValueAsNumericL( HALData::EManufacturerSoftwareRev, KItem4Format ); - - // - _LIT(KItem5Format, "Software Build"); - GetHALValueAsNumericL( HALData::EManufacturerSoftwareBuild, KItem5Format ); - - // - _LIT(KItem6Format, "CPU"); - GetCPU( valueBuf ); - AddItemL( KItem6Format, valueBuf ); - - // - _LIT(KItem7Format, "CPU ABI"); - GetCPUABI( valueBuf ); - AddItemL( KItem7Format, valueBuf ); - - // - _LIT(KItem8Format, "CPU Speed"); - _LIT(KItem8Suffix, "KHz"); - GetHALValueAsNumericL( HALData::ECPUSpeed, KItem8Format, &KItem8Suffix ); - - // - _LIT(KItem8aFormat, "Floating Point Support"); - GetHALValueAsYesNoL( HALData::EHardwareFloatingPoint, KItem8aFormat ); - - // - _LIT(KItem8bFormat, "System Tick Period"); - _LIT(KItem8bSuffix, "ms"); - GetHALValueAsNumericL( HALData::ESystemTickPeriod, KItem8bFormat, &KItem8bSuffix ); - - // - _LIT(KItem8cFormat, "Nano Tick Period"); - _LIT(KItem8cSuffix, "us"); - GetHALValueAsNumericL( HALData::ENanoTickPeriod, KItem8cFormat, &KItem8cSuffix ); - - // - _LIT(KItem9Format, "Startup Reason"); - GetStartupReason( valueBuf ); - AddItemL( KItem9Format, valueBuf ); - - // - _LIT(KItem10Format, "Language"); - GetHALValueAsNumericL( HALData::ELanguageIndex, KItem10Format, NULL, 4 ); - - // - _LIT(KItem10aFormat, "Locale"); - GetHALValueAsNumericL( HALData::ELocaleLoaded, KItem10aFormat, NULL, 4 ); - - // - _LIT(KItem11aFormat, "Clipboard Drive"); - GetHALValueAsDriveLetterL( HALData::EClipboardDrive, KItem11aFormat ); - - // - _LIT(KItem11bFormat, "System Drive (Hal)"); - GetHALValueAsDriveLetterL( HALData::ESystemDrive, KItem11bFormat ); - - // - _LIT(KItem11cFormat, "System Drive (F32)"); - TDriveNumber systemDrive = CMemSpyEngineHelperFileSystem::GetSystemDrive(); - AddItemL( systemDrive, KItem11cFormat ); - - // - _LIT(KItem11dFormat, "System Drive (Bafl)"); - value = BaflUtils::GetSystemDrive( systemDrive ); - if ( value == KErrNone ) - { - AddItemL( systemDrive, KItem11dFormat ); - } - else - { - MemSpyUiUtils::GetErrorText( valueBuf, value ); - AddItemL( KItem11dFormat, valueBuf ); - } - - // - _LIT(KItem12Format, "Display Type"); - GetDisplayType( valueBuf ); - AddItemL( KItem12Format, valueBuf ); - // - _LIT(KItem12aCaption, "Display Size"); - _LIT(KItem12aFormat, "%d x %d"); - value = value2 = 0; - GetHALValue( HALData::EDisplayXPixels, value ); - GetHALValue( HALData::EDisplayYPixels, value2 ); - valueBuf.Format( KItem12aFormat, value, value2 ); - AddItemL( KItem12aCaption, valueBuf ); - - // - _LIT(KItem13Format, "Display Depth"); - _LIT(KItem13Suffix, "bpp"); - GetHALValueAsNumericL( HALData::EDisplayBitsPerPixel, KItem13Format, &KItem13Suffix ); - - // - _LIT(KItem14Format, "Display Mode Count"); - GetHALValueAsNumericL( HALData::EDisplayNumModes, KItem14Format ); - - // - _LIT(KItem14aFormat, "Current Mode"); - GetHALValueAsNumericL( HALData::EDisplayMode, KItem14aFormat ); - - // - _LIT(KItem15Format, "Display Address"); - GetHALValueAsHexL( HALData::EDisplayMemoryAddress, KItem15Format ); - - // - _LIT(KItem16Format, "Screen Count"); - GetHALValueAsNumericL( HALData::EDisplayNumberOfScreens, KItem16Format ); - - // - _LIT(KItem17Format, "Eikon Def. Disp. Mode"); - GetDisplayMode( valueBuf, static_cast( CEikonEnv::Static()->DefaultDisplayMode() ) ); - AddItemL( KItem17Format, valueBuf ); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - iModel = NULL; - } - - -void CMemSpyViewSystemConfig::GetManufacturer( TDes& aBuf ) - { - TInt value = KErrGeneral; - GetHALValue( HALData::EManufacturer, value ); - // - switch( value ) - { - case HALData::EManufacturer_Ericsson: - { - _LIT( KName, "Ericsson" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Motorola: - { - _LIT( KName, "Motorola" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Nokia: - { - _LIT( KName, "Nokia" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Panasonic: - { - _LIT( KName, "Panasonic" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Psion: - { - _LIT( KName, "Psion" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Intel: - { - _LIT( KName, "Intel" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Cogent: - { - _LIT( KName, "Cogent" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Cirrus: - { - _LIT( KName, "Cirrus" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_Linkup: - { - _LIT( KName, "Linkup" ); - aBuf.Copy( KName ); - } - break; - case HALData::EManufacturer_TexasInstruments: - { - _LIT( KName, "Texas Instruments" ); - aBuf.Copy( KName ); - } - break; - default: - aBuf.Copy( KMemSpyItemValueNotKnown ); - break; - } - } - - -void CMemSpyViewSystemConfig::GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode ) - { - switch( aMode ) - { - case ENone: - { - _LIT( KName, "ENone" ); - aBuf.Copy( KName ); - } - case EGray2: - { - _LIT( KName, "EGray2" ); - aBuf.Copy( KName ); - } - case EGray4: - { - _LIT( KName, "EGray4" ); - aBuf.Copy( KName ); - } - case EGray16: - { - _LIT( KName, "EGray16" ); - aBuf.Copy( KName ); - } - case EGray256: - { - _LIT( KName, "EGray256" ); - aBuf.Copy( KName ); - } - case EColor16: - { - _LIT( KName, "EColor16" ); - aBuf.Copy( KName ); - } - case EColor256: - { - _LIT( KName, "EColor256" ); - aBuf.Copy( KName ); - } - case EColor64K: - { - _LIT( KName, "EColor64K" ); - aBuf.Copy( KName ); - } - case EColor16M: - { - _LIT( KName, "EColor16M" ); - aBuf.Copy( KName ); - } - case ERgb: - { - _LIT( KName, "ERgb" ); - aBuf.Copy( KName ); - } - break; - case EColor4K: - { - _LIT( KName, "EColor4K" ); - aBuf.Copy( KName ); - } - break; - case EColor16MU: - { - _LIT( KName, "EColor16MU" ); - aBuf.Copy( KName ); - } - break; - case EColor16MA: - { - _LIT( KName, "EColor16MA" ); - aBuf.Copy( KName ); - } - break; - case EColor16MAP: - { - _LIT( KName, "EColor16MAP" ); - aBuf.Copy( KName ); - } - break; - default: - aBuf.Copy( KMemSpyItemValueNotKnown ); - break; - } - } - - -void CMemSpyViewSystemConfig::GetDeviceFamily( TDes& aBuf ) - { - TInt value = KErrGeneral; - GetHALValue( HALData::EDeviceFamily, value ); - // - switch( value ) - { - case HALData::EDeviceFamily_Crystal: - { - _LIT( KName, "Crystal" ); - aBuf.Copy( KName ); - } - break; - case HALData::EDeviceFamily_Pearl: - { - _LIT( KName, "Pearl" ); - aBuf.Copy( KName ); - } - break; - case HALData::EDeviceFamily_Quartz: - { - _LIT( KName, "Quartz" ); - aBuf.Copy( KName ); - } - break; - default: - aBuf.Copy( KMemSpyItemValueNotKnown ); - break; - } - } - - -void CMemSpyViewSystemConfig::GetCPU( TDes& aBuf ) - { - TInt value = KErrGeneral; - GetHALValue( HALData::ECPU, value ); - // - switch( value ) - { - case HALData::ECPU_ARM: - { - _LIT( KName, "ARM" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPU_MCORE: - { - _LIT( KName, "mCORE" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPU_X86: - { - _LIT( KName, "X86" ); - aBuf.Copy( KName ); - } - break; - default: - aBuf.Copy( KMemSpyItemValueNotKnown ); - break; - } - } - - -void CMemSpyViewSystemConfig::GetCPUABI( TDes& aBuf ) - { - TInt value = KErrGeneral; - GetHALValue( HALData::ECPUABI, value ); - // - switch( value ) - { - case HALData::ECPUABI_ARM4: - { - _LIT( KName, "ARM4" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPUABI_ARMI: - { - _LIT( KName, "ARMI" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPUABI_THUMB: - { - _LIT( KName, "ARM4" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPUABI_MCORE: - { - _LIT( KName, "mCORE" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPUABI_MSVC: - { - _LIT( KName, "MSVC" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPUABI_ARM5T: - { - _LIT( KName, "ARM5T" ); - aBuf.Copy( KName ); - } - break; - case HALData::ECPUABI_X86: - { - _LIT( KName, "X86" ); - aBuf.Copy( KName ); - } - break; - default: - aBuf.Copy( KMemSpyItemValueNotKnown ); - break; - } - } - - -void CMemSpyViewSystemConfig::GetStartupReason( TDes& aBuf ) - { - TInt value = KErrGeneral; - GetHALValue( HALData::ESystemStartupReason, value ); - // - switch( value ) - { - case HALData::ESystemStartupReason_Cold: - { - _LIT( KName, "Cold" ); - aBuf.Copy( KName ); - } - break; - case HALData::ESystemStartupReason_Warm: - { - _LIT( KName, "Warm" ); - aBuf.Copy( KName ); - } - break; - case HALData::ESystemStartupReason_Fault: - { - _LIT( KName, "Fault" ); - aBuf.Copy( KName ); - } - break; - default: - aBuf.Copy( KMemSpyItemValueNotKnown ); - break; - } - } - - -void CMemSpyViewSystemConfig::GetKeyboard( TDes& aBuf ) - { - _LIT(KComma, ", "); - TInt value = KErrGeneral; - GetHALValue( HALData::EKeyboard, value ); - // - aBuf.Zero(); - if ( value & EKeyboard_Keypad ) - { - _LIT( KName, "Keypad" ); - aBuf.Copy( KName ); - } - - - if ( value & EKeyboard_Full ) - { - if ( aBuf.Length() ) - { - aBuf.Append( KComma ); - } - - _LIT( KName, "Full Keyboard" ); - aBuf.Copy( KName ); - } - - if ( !aBuf.Length() ) - { - aBuf.Copy( KMemSpyItemValueNotKnown ); - } - } - - -void CMemSpyViewSystemConfig::GetMachineUid( TDes& aBuf ) - { - TInt value = KErrGeneral; - GetHALValue( HALData::EMachineUid, value ); - // - switch( value ) - { - case HALData::EMachineUid_Series5mx: - { - _LIT( KName, "Series 5mx" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_Brutus: - { - _LIT( KName, "Brutus" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_Cogent: - { - _LIT( KName, "Cogent" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_Win32Emulator: - { - _LIT( KName, "Win32 Emulator" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_WinC: - { - _LIT( KName, "WINC" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_CL7211_Eval: - { - _LIT( KName, "CL7211" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_LinkUp: - { - _LIT( KName, "LinkUp" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_Assabet: - { - _LIT( KName, "Assabet" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_IQ80310: - { - _LIT( KName, "IQ80310" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_Lubbock: - { - _LIT( KName, "Lubbock" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_Integrator: - { - _LIT( KName, "Integrator" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_Helen: - { - _LIT( KName, "Helen" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_X86PC: - { - _LIT( KName, "X86PC" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_OmapH2: - { - _LIT( KName, "OmapH2" ); - aBuf.Copy( KName ); - } - break; - case HALData::EMachineUid_OmapH4: - { - _LIT( KName, "OmapH4" ); - aBuf.Copy( KName ); - } - break; - default: - { - _LIT( KName, "0x%08x" ); - aBuf.Format( KName, value ); - } - break; - } - } - - -void CMemSpyViewSystemConfig::GetDisplayType( TDes& aBuf ) - { - TInt value = KErrGeneral; - GetHALValue( HALData::EDisplayIsMono, value ); - // - if ( value == 0 ) - { - _LIT( KName, "Colour" ); - aBuf.Copy( KName ); - } - else if ( value == 1 ) - { - _LIT( KName, "Mono" ); - aBuf.Copy( KName ); - } - else - { - MemSpyUiUtils::GetErrorText( aBuf, value ); - } - } - - -TInt CMemSpyViewSystemConfig::GetHALValue( HALData::TAttribute aAttribute, TInt& aValue ) - { - aValue = KErrGeneral; - const TInt error = HAL::Get( aAttribute, aValue ); - -#ifdef _DEBUG - if ( error != KErrNone ) - { - RDebug::Printf("CMemSpyViewSystemConfig::GetHALValue() - aAttribute: %3d, error: %d, value: %d", aAttribute, error, aValue); - } -#endif - - return error; - } - - -TInt CMemSpyViewSystemConfig::GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix, TInt aWidth ) - { - TBuf<20> valueBuf; - TInt value = 0; - // - const TInt error = GetHALValue( aAttribute, value ); - if ( error == KErrNone ) - { - if ( aWidth > 0 && aWidth < 12 ) - { - valueBuf.NumFixedWidthUC( (TUint) value, EDecimal, aWidth ); - } - else - { - valueBuf.Num( value ); - } - - AddItemL( aCaption, valueBuf, aSuffix ); - } - else - { - MemSpyUiUtils::GetErrorText( valueBuf, error ); - AddItemL( aCaption, valueBuf ); - } - // - return error; - } - - -TInt CMemSpyViewSystemConfig::GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix ) - { - TBuf<20> valueBuf; - TInt value = 0; - // - const TInt error = GetHALValue( aAttribute, value ); - if ( error == KErrNone ) - { - MemSpyEngineUtils::FormatHex( valueBuf, value ); - AddItemL( aCaption, valueBuf, aSuffix ); - } - else - { - MemSpyUiUtils::GetErrorText( valueBuf, error ); - AddItemL( aCaption, valueBuf ); - } - // - return error; - } - - -TInt CMemSpyViewSystemConfig::GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix ) - { - TBuf<20> valueBuf; - TInt value = 0; - // - const TInt error = GetHALValue( aAttribute, value ); - if ( error == KErrNone || error == KErrNotSupported ) - { - _LIT(KYes, "Yes"); - _LIT(KNo, "No"); - _LIT(KError, "Error: %d"); - - if ( error < KErrNone ) - { - valueBuf.Format( KError, error ); - } - else if ( value == EFalse ) - { - valueBuf.Copy( KNo ); - } - else if ( error == KErrNone ) - { - valueBuf.Copy( KYes ); - } - - AddItemL( aCaption, valueBuf, aSuffix ); - } - else - { - MemSpyUiUtils::GetErrorText( valueBuf, error ); - AddItemL( aCaption, valueBuf ); - } - // - return error; - } - - -TInt CMemSpyViewSystemConfig::GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix ) - { - TInt value = 0; - const TInt error = GetHALValue( aAttribute, value ); - // - if ( error == KErrNone && ( value >= EDriveA && value <= EDriveZ ) ) - { - AddItemL( (TDriveNumber) value, aCaption, aSuffix ); - } - else - { - _LIT( KItemNotSet, "Not Defined"); - AddItemL( aCaption, KItemNotSet ); - } - // - return error; - } - - -void CMemSpyViewSystemConfig::AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix ) - { - _LIT(KItemFormat, "\t%S\t\t%S"); - // - TBuf item; - item.Format( KItemFormat, &aCaption, &aValue ); - if ( aSuffix ) - { - _LIT(KSpace, " "); - item.Append( KSpace ); - item.Append( *aSuffix ); - } - // - iModel->AppendL( item ); - } - - -void CMemSpyViewSystemConfig::AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix ) - { - TBuf<20> valueBuf; - // - const TDriveUnit drive( aDrive ); - valueBuf.Copy( drive.Name() ); - // - AddItemL( aCaption, valueBuf, aSuffix ); - } - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemActiveObject.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemActiveObject.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,241 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemActiveObject.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" - - - -CMemSpyViewThreadInfoItemActiveObjectBase::CMemSpyViewThreadInfoItemActiveObjectBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeActiveObject ) - { - } - - -TBool CMemSpyViewThreadInfoItemActiveObjectBase::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdActiveObjectListing: - OnCmdWriteAOListingL(); - break; - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewThreadInfoItemActiveObjectBase::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == R_MEMSPY_MENUPANE ) - { - aMenuPane->SetItemDimmed( EMemSpyCmdActiveObject, Thread().IsDead() ); - } - } - - -CMemSpyEngineActiveObjectArray& CMemSpyViewThreadInfoItemActiveObjectBase::ActiveObjectArray() const - { - CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( iInfoItem ); - return activeObjectArray->Array(); - } - - -void CMemSpyViewThreadInfoItemActiveObjectBase::OnCmdWriteAOListingL() - { - CMemSpyEngineActiveObjectArray& objects = ActiveObjectArray(); - - // Begin a new data stream - _LIT( KMemSpyContext, "Active Object List - " ); - _LIT( KMemSpyFolder, "Active Objects" ); - iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); - - // Set prefix for overall listing - iEngine.Sink().OutputPrefixSetLC( KMemSpyContext ); - - // Create header - CMemSpyEngineActiveObjectArray::OutputDataColumnsL( iEngine ); - - // List items - const TInt count = objects.Count(); - for(TInt i=0; i( iInfoItem ); - TInt selectedIndex = 0; - if ( aSelectionRune ) - { - CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray(); - const TInt index = activeObjectArray.ObjectIndexByAddress( aSelectionRune ); - if ( index >= 0 && index < activeObjectArray.Count() ) - { - selectedIndex = index + 1; - } - } - - // Select item - if ( infoItem->DetailsCount() > 0 ) - { - iListBox->SetCurrentItemIndex( selectedIndex ); - HandleListBoxItemSelectedL( selectedIndex ); - } - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemActiveObject::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemActiveObject; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObject::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - - // Get current entry address - TInt index = iListBox->CurrentItemIndex(); - if ( index > 0 ) - { - --index; - CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray(); - // - if ( index >= 0 && index < activeObjectArray.MdcaCount() ) - { - CMemSpyEngineActiveObject& object = activeObjectArray.At( index ); - TAny* aoAddress = object.Address(); - // - child = new(ELeave) CMemSpyViewThreadInfoItemActiveObjectDetails( iEngine, iObserver, iInfoItem->Container(), aoAddress ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent(), NULL ); - CleanupStack::Pop( child ); - } - } - // - return child; - } - - - - - - - - - - - -CMemSpyViewThreadInfoItemActiveObjectDetails::CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress ) -: CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer ), iObjectAddress( aObjectAddress ) - { - } - - -void CMemSpyViewThreadInfoItemActiveObjectDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune ); - - _LIT( KTitle, "Active Object Details" ); - SetTitleL( KTitle ); - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemActiveObjectDetails::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemActiveObjectDetails; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObjectDetails::PrepareParentViewL() - { - CMemSpyViewThreadInfoItemActiveObject* parent = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iInfoItem->Container() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), iObjectAddress ); - CleanupStack::Pop( parent ); - return parent; - } - - -void CMemSpyViewThreadInfoItemActiveObjectDetails::SetListBoxModelL() - { - // Try to find the right entry - CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray(); - const TInt index = activeObjectArray.ObjectIndexByAddress( iObjectAddress ); - User::LeaveIfError( index ); - CMemSpyEngineActiveObject& object = activeObjectArray.At( index ); - // - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &object ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemChunk.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemChunk.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemChunk.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewChunkList.h" - - - -CMemSpyViewThreadInfoItemChunk::CMemSpyViewThreadInfoItemChunk( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeChunk ) - { - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemChunk::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - - // Get the code segment list - CMemSpyThreadInfoChunk* chunkInfoItem = static_cast< CMemSpyThreadInfoChunk* >( iInfoItem ); - CMemSpyEngineChunkList* list = &chunkInfoItem->List(); - - // Get the current code segment that corresponds to our currently focused list item. - const TInt index = iListBox->CurrentItemIndex(); - if ( index >= 0 && index < list->Count() ) - { - CMemSpyEngineChunkEntry& entry = list->At( index ); - child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *list, entry ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - chunkInfoItem->NullifyList(); - - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - } - - return child; - } - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemCodeSeg.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemCodeSeg.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemCodeSeg.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewCodeSegList.h" - - - -CMemSpyViewThreadInfoItemCodeSeg::CMemSpyViewThreadInfoItemCodeSeg( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeCodeSeg ) - { - } - - -TBool CMemSpyViewThreadInfoItemCodeSeg::HandleCommandL( TInt aCommand ) - { - TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); - return handled; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemCodeSeg::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - - // Get the code segment list - CMemSpyThreadInfoCodeSeg* codeSegInfoItem = static_cast< CMemSpyThreadInfoCodeSeg* >( iInfoItem ); - CMemSpyEngineCodeSegList* list = &codeSegInfoItem->List(); - - // Get the current code segment that corresponds to our currently focused list item. - const TInt index = iListBox->CurrentItemIndex(); - if ( index >= 0 && index < list->Count() ) - { - CMemSpyEngineCodeSegEntry& entry = list->At( index ); - child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *list, entry ); - - // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. - // This object is about to die in any case. - codeSegInfoItem->NullifyList(); - - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - } - - return child; - } - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemGeneralInfo.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemGeneralInfo.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemGeneralInfo.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewThreads.h" -#include "MemSpyViewThreadInfoItemHeap.h" - - - -CMemSpyViewThreadInfoItemGeneralInfo::CMemSpyViewThreadInfoItemGeneralInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeGeneralInfo ) - { - } - - -TBool CMemSpyViewThreadInfoItemGeneralInfo::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - - - -void CMemSpyViewThreadInfoItemGeneralInfo::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemGeneric.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemGeneric.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemGeneric.h" - -// System includes -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewThreadInfoItemList.h" - -// Constants -const TInt KMemSpyConstructionCheckerTimerPeriod = 500000; // 1/2 second - - - -CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType ) -: CMemSpyViewBase( aEngine, aObserver ), iContainer( aInfoContainer ) - { - iContainer.Thread().Process().Open(); - iContainer.Thread().Open(); - iContainer.Open(); - // - iInfoItem = &iContainer.Item( aType ); - __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); - iInfoItem->Open(); - } - - -CMemSpyViewThreadInfoItemGeneric::~CMemSpyViewThreadInfoItemGeneric() - { - if ( iInfoItem ) - { - iInfoItem->Close(); - } - // - DestroyWaitNote(); - // - iContainer.Close(); - iContainer.Thread().Close(); - iContainer.Thread().Process().Close(); - } - - -void CMemSpyViewThreadInfoItemGeneric::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - const TPtrC pTitle( iInfoItem->Name().Mid( 1 ) ); - SetTitleL( pTitle ); - // - if ( iInfoItem->IsReady() == EFalse ) - { -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::ConstructL() - show wait note - item not ready, iType: %d", iInfoItem->Type() ); -#endif - - // Wait for engine data to be made ready... - ShowWaitNoteL(); - } - - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -CMemSpyProcess& CMemSpyViewThreadInfoItemGeneric::Process() const - { - return iContainer.Thread().Process(); - } - - -CMemSpyThread& CMemSpyViewThreadInfoItemGeneric::Thread() const - { - return iContainer.Thread(); - } - - -CMemSpyThreadInfoContainer& CMemSpyViewThreadInfoItemGeneric::Container() const - { - return iContainer; - } - - -CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemGeneric::InfoItem() const - { - __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); - return *iInfoItem; - } - - -void CMemSpyViewThreadInfoItemGeneric::RefreshL() - { - iInfoItem->RebuildL(); - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemGeneric::ViewType() const - { - TMemSpyViewType type = EMemSpyViewTypeNone; - // - switch( iInfoItem->Type() ) - { - case EMemSpyThreadInfoItemTypeHeap: - type = EMemSpyViewTypeThreadInfoItemHeap; - break; - case EMemSpyThreadInfoItemTypeStack: - type = EMemSpyViewTypeThreadInfoItemStack; - break; - case EMemSpyThreadInfoItemTypeChunk: - type = EMemSpyViewTypeThreadInfoItemChunk; - break; - case EMemSpyThreadInfoItemTypeCodeSeg: - type = EMemSpyViewTypeThreadInfoItemCodeSeg; - break; - case EMemSpyThreadInfoItemTypeServer: - type = EMemSpyViewTypeThreadInfoItemServer; - break; - case EMemSpyThreadInfoItemTypeSession: - type = EMemSpyViewTypeThreadInfoItemSession; - break; - case EMemSpyThreadInfoItemTypeSemaphore: - type = EMemSpyViewTypeThreadInfoItemSemaphore; - break; - case EMemSpyThreadInfoItemTypeMutex: - type = EMemSpyViewTypeThreadInfoItemMutex; - break; - case EMemSpyThreadInfoItemTypeTimer: - type = EMemSpyViewTypeThreadInfoItemTimer; - break; - case EMemSpyThreadInfoItemTypeLDD: - type = EMemSpyViewTypeThreadInfoItemLDD; - break; - case EMemSpyThreadInfoItemTypePDD: - type = EMemSpyViewTypeThreadInfoItemPDD; - break; - case EMemSpyThreadInfoItemTypeLogicalChannel: - type = EMemSpyViewTypeThreadInfoItemLogicalChannel; - break; - case EMemSpyThreadInfoItemTypeChangeNotifier: - type = EMemSpyViewTypeThreadInfoItemChangeNotifier; - break; - case EMemSpyThreadInfoItemTypeUndertaker: - type = EMemSpyViewTypeThreadInfoItemUndertaker; - break; - case EMemSpyThreadInfoItemTypeMessageQueue: - type = EMemSpyViewTypeThreadInfoItemMessageQueue; - break; - case EMemSpyThreadInfoItemTypeConditionalVariable: - type = EMemSpyViewTypeThreadInfoItemConditionalVariable; - break; - case EMemSpyThreadInfoItemTypeOpenFiles: - type = EMemSpyViewTypeThreadInfoItemOpenFiles; - break; - case EMemSpyThreadInfoItemTypeActiveObject: - type = EMemSpyViewTypeThreadInfoItemActiveObject; - break; - case EMemSpyThreadInfoItemTypeGeneralInfo: - type = EMemSpyViewTypeThreadInfoItemGeneralInfo; - break; - case EMemSpyThreadInfoItemTypeOtherThreads: - type = EMemSpyViewTypeThreadInfoItemOtherThreads; - break; - case EMemSpyThreadInfoItemTypeOtherProcesses: - type = EMemSpyViewTypeThreadInfoItemOtherProcesses; - break; - case EMemSpyThreadInfoItemTypeOwnedThreadHandles: - type = EMemSpyViewTypeThreadInfoItemOwnedThreadHandles; - break; - case EMemSpyThreadInfoItemTypeOwnedProcessHandles: - type = EMemSpyViewTypeThreadInfoItemOwnedProcessHandles; - break; - - default: - __ASSERT_DEBUG( EFalse, User::Invariant() ); - break; - } - // - return type; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL() - { - CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, Thread() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), iInfoItem ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL() - { - __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); - CMemSpyViewBase* child = NULL; - // - return child; - } - - -TBool CMemSpyViewThreadInfoItemGeneric::HandleCommandL( TInt aCommand ) - { - TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); - return handled; - } - - -void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iInfoItem ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - // Notify observer about an item being 'fired' - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemSelectedL( TInt /*aIndex*/ ) - { - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - -void CMemSpyViewThreadInfoItemGeneric::ShowWaitNoteL() - { - // Ugly, but I'm not adding an observer mechanism just for this wait dialog. - __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() ); - iWaitConstructionChecker = CPeriodic::NewL( CActive::EPriorityLow ); - iWaitConstructionChecker->Start( KMemSpyConstructionCheckerTimerPeriod, - KMemSpyConstructionCheckerTimerPeriod, - TCallBack( CheckForItemConstructionComplete, this ) ); - - if ( !iWaitNote ) - { - iWaitNote = new ( ELeave ) CAknWaitDialog( reinterpret_cast ( &iWaitNote ), ETrue ); - iWaitNote->ExecuteDlgLD( CAknNoteDialog::ENoTone, R_MEMSPY_PREPARING_INFO_ITEM_CONTAINER_WAIT_NOTE ); - } - } - - -void CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - { -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - START" ); -#endif - // - delete iWaitConstructionChecker; - iWaitConstructionChecker = NULL; - // - if ( iWaitNote ) - { - TRAP_IGNORE( iWaitNote->ProcessFinishedL() ); // deletes the dialog - iWaitNote = NULL; - } - // -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - END" ); -#endif - } - - -TInt CMemSpyViewThreadInfoItemGeneric::CheckForItemConstructionComplete( TAny* aSelf ) - { - CMemSpyViewThreadInfoItemGeneric& self = *reinterpret_cast< CMemSpyViewThreadInfoItemGeneric* >( aSelf ); - // -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::CheckForItemConstructionComplete() - ready status: %d, iType: %d", self.iInfoItem->IsReady(), self.iInfoItem->Type() ); -#endif - // - TBool callAgain = ETrue; - if ( self.iInfoItem->IsReady() ) - { - self.DestroyWaitNote(); - callAgain = EFalse; - } - // - return callAgain; - } - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemHeap.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemHeap.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemHeap.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewThreads.h" -#include "MemSpyViewThreadInfoItemHeap.h" - - - -CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeHeap ) - { - } - - -TBool CMemSpyViewThreadInfoItemHeap::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { -#ifndef __WINS__ - case EMemSpyCmdHeapDataDump: - OnCmdHeapDataL(); - break; -#endif - case EMemSpyCmdHeapCellListing: - OnCmdHeapCellListingL(); - break; - case EMemSpyCmdHeapInfoThread: - OnCmdHeapInfoL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewThreadInfoItemHeap::OnCmdHeapDataL() - { - iEngine.HelperHeap().OutputHeapDataUserL( Thread() ); - } - - -void CMemSpyViewThreadInfoItemHeap::OnCmdHeapCellListingL() - { - iEngine.HelperHeap().OutputCellListingUserL( Thread() ); - } - - -void CMemSpyViewThreadInfoItemHeap::OnCmdHeapInfoL() - { - iEngine.HelperHeap().OutputHeapInfoUserL( Thread() ); - } - - -void CMemSpyViewThreadInfoItemHeap::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == R_MEMSPY_MENUPANE ) - { - aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() ); - } - } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemList.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemList.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,336 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemList.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewThreads.h" -#include "MemSpyViewThreadInfoItemHeap.h" -#include "MemSpyViewThreadInfoItemStack.h" -#include "MemSpyViewThreadInfoItemChunk.h" -#include "MemSpyViewThreadInfoItemCodeSeg.h" -#include "MemSpyViewThreadInfoItemServer.h" -#include "MemSpyViewThreadInfoItemActiveObject.h" -#include "MemSpyViewThreadInfoItemGeneralInfo.h" -#include "MemSpyViewThreadInfoItemMemoryTracking.h" - -// Constants -const TInt KMemSpyIdleResetListboxTimerPeriod = 250000; - - -CMemSpyViewThreadInfoItemList::CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread ) -: CMemSpyViewBase( aEngine, aObserver ), iThread( aThread ) - { - iThread.Process().Open(); - iThread.Open(); - } - - -CMemSpyViewThreadInfoItemList::~CMemSpyViewThreadInfoItemList() - { - delete iIdleResetListboxTimer; - - TRAP_IGNORE( - CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); - container.ObserverRemove( *this ); - ); - - if ( iCurrentInfoItem ) - { - iCurrentInfoItem->Close(); - } - - iThread.Process().Close(); - iThread.Close(); - } - - - -void CMemSpyViewThreadInfoItemList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Thread Objects" ); - SetTitleL( KTitle ); - // - iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityIdle ); - // - CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); - container.ObserverAddL( *this ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - // - if ( aSelectionRune ) - { - CMemSpyThreadInfoItemBase* selectedItem = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelectionRune ); - const TInt index = container.InfoItemIndexByType( selectedItem->Type() ); - if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - } - else if ( container.MdcaCount() > 0 ) - { - iListBox->SetCurrentItemIndex( 0 ); - HandleListBoxItemSelectedL( 0 ); - } - } - - -const CMemSpyProcess& CMemSpyViewThreadInfoItemList::Process() const - { - return iThread.Process(); - } - - -const CMemSpyThread& CMemSpyViewThreadInfoItemList::Thread() const - { - return iThread; - } - - -const CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemList::CurrentInfoItem() const - { - __ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() ); - return *iCurrentInfoItem; - } - - -void CMemSpyViewThreadInfoItemList::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemList::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemList; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareParentViewL() - { - CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, iThread.Process() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iThread ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareChildViewL() - { - __ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() ); - CMemSpyViewBase* child = NULL; - - // Decide what type of child view to create... - const TMemSpyThreadInfoItemType type = iCurrentInfoItem->Type(); - // - switch( type ) - { - case EMemSpyThreadInfoItemTypeHeap: - child = new(ELeave) CMemSpyViewThreadInfoItemHeap( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeStack: - child = new(ELeave) CMemSpyViewThreadInfoItemStack( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeChunk: - child = new(ELeave) CMemSpyViewThreadInfoItemChunk( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeCodeSeg: - child = new(ELeave) CMemSpyViewThreadInfoItemCodeSeg( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeServer: - child = new(ELeave) CMemSpyViewThreadInfoItemServer( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeActiveObject: - child = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeGeneralInfo: - child = new(ELeave) CMemSpyViewThreadInfoItemGeneralInfo( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeMemoryTracking: - child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, iThread.InfoContainerL() ); - break; - case EMemSpyThreadInfoItemTypeSession: - case EMemSpyThreadInfoItemTypeSemaphore: - case EMemSpyThreadInfoItemTypeMutex: - case EMemSpyThreadInfoItemTypeTimer: - case EMemSpyThreadInfoItemTypeLDD: - case EMemSpyThreadInfoItemTypePDD: - case EMemSpyThreadInfoItemTypeLogicalChannel: - case EMemSpyThreadInfoItemTypeChangeNotifier: - case EMemSpyThreadInfoItemTypeUndertaker: - case EMemSpyThreadInfoItemTypeMessageQueue: - case EMemSpyThreadInfoItemTypeConditionalVariable: - case EMemSpyThreadInfoItemTypeOpenFiles: - case EMemSpyThreadInfoItemTypeOtherThreads: - case EMemSpyThreadInfoItemTypeOtherProcesses: - case EMemSpyThreadInfoItemTypeOwnedThreadHandles: - case EMemSpyThreadInfoItemTypeOwnedProcessHandles: - child = new(ELeave) CMemSpyViewThreadInfoItemGeneric( iEngine, iObserver, iThread.InfoContainerL(), type ); - break; - - default: - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0) ); - break; - } - // - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -TBool CMemSpyViewThreadInfoItemList::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdThreadInfoHandles: - OnCmdInfoHandlesL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewThreadInfoItemList::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == R_MEMSPY_MENUPANE ) - { - aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() ); - } - else if ( aResourceId == MenuCascadeResourceId() ) - { - // Always remove these items - they are only shown in the master thread view - aMenuPane->SetItemDimmed( EMemSpyCmdThreadSetPriority, ETrue ); - aMenuPane->SetItemDimmed( EMemSpyCmdThreadEnd, ETrue ); - } - } - - -void CMemSpyViewThreadInfoItemList::OnCmdInfoHandlesL() - { - iThread.InfoContainerForceSyncronousConstructionL().PrintL(); - } - - -void CMemSpyViewThreadInfoItemList::HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType ) - { - if ( aEvent == EInfoItemChanged ) - { - } - else if ( aEvent == EInfoItemDestroyed ) - { - if ( iCurrentInfoItem && iCurrentInfoItem->Type() == aType ) - { - iCurrentInfoItem->Close(); - iCurrentInfoItem = NULL; - } - } - - iIdleResetListboxTimer->Cancel(); - iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) ); - } - - -void CMemSpyViewThreadInfoItemList::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iThread.InfoContainerL() ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewThreadInfoItemList::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - // Notify observer about an item being 'fired' - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewThreadInfoItemList::HandleListBoxItemSelectedL( TInt aIndex ) - { - if ( iCurrentInfoItem ) - { - CMemSpyThreadInfoItemBase* item = iCurrentInfoItem; - iCurrentInfoItem = NULL; - item->Close(); - } - - // Identify the type of item to display... - iCurrentInfoItem = &iThread.InfoContainerL().Item( aIndex ); - iCurrentInfoItem->Open(); - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - -TInt CMemSpyViewThreadInfoItemList::IdleUpdateListBoxModel( TAny* aSelf ) - { - CMemSpyViewThreadInfoItemList* self = reinterpret_cast< CMemSpyViewThreadInfoItemList* >( aSelf ); - TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() ); - return EFalse; - } - - -void CMemSpyViewThreadInfoItemList::DoIdleUpdateListBoxModelL() - { - CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); - - // Try to maintain current item selection if at all possible. - TMemSpyThreadInfoItemType type = EMemSpyThreadInfoItemTypeHeap; - if ( iCurrentInfoItem ) - { - type = iCurrentInfoItem->Type(); - } - - // Update list box & model - SetListBoxModelL(); - iListBox->HandleItemAdditionL(); - RefreshL(); - - // Try to select previous item if it is still available - const TInt index = container.InfoItemIndexByType( type ); - if ( index >= 0 && index < container.MdcaCount() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - - iIdleResetListboxTimer->Cancel(); - } - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemMemoryTracking.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemMemoryTracking.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,664 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemMemoryTracking.h" - -// System includes -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" - - -CMemSpyViewThreadInfoItemMemoryTracking::CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) - { - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverAddL( *this ); - - // Reset the title - _LIT( KCustomTitle, "Memory Statistics" ); - SetTitleL( KCustomTitle ); - - // Select the appropriate view - const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune ); - const TInt index = IndexByViewType( viewType ); - // -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::ConstructL() - aSelectionRune: 0x%08x, viewType: %d, index: %d", aSelectionRune, viewType, index ); -#endif - // - if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTracking::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareParentViewL() - { - CMemSpyViewBase* parent = CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL(); - - // Stop observing changes - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverRemove( *this ); - - return parent; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - // - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - const TInt index = iListBox->CurrentItemIndex(); - if ( index == 1 ) - { - child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingCurrent( iEngine, iObserver, Container() ); - } - else if ( index == 2 ) - { - child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingHWM( iEngine, iObserver, Container() ); - } - else if ( index == 3 ) - { - child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingPeak( iEngine, iObserver, Container() ); - } - // - if ( child ) - { - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - - // Stop observing changes - item->TrackingObserverRemove( *this ); - } - // - return child; - } - - -TBool CMemSpyViewThreadInfoItemMemoryTracking::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdMemoryTrackingStart: - OnCmdTrackingStartL(); - break; - case EMemSpyCmdMemoryTrackingStop: - OnCmdTrackingStopL(); - break; - case EMemSpyCmdMemoryTrackingHWMReset: - OnCmdHWMResetL(); - break; - case EMemSpyCmdMemoryTrackingTotalWithSharedMem: - OnCmdTotalWithSharedMemL(); - break; - case EMemSpyCmdMemoryTrackingTotalWithoutSharedMem: - OnCmdTotalWithoutSharedMemL(); - break; - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -TInt CMemSpyViewThreadInfoItemMemoryTracking::IndexByViewType( TMemSpyViewType aType ) - { - TInt index = 0; - // - switch( aType ) - { - default: - case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent: - index = 1; - break; - case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM: - index = 2; - break; - case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak: - index = 3; - break; - } - // - return index; - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::HandleListBoxItemActionedL( TInt aIndex ) - { - if ( aIndex == 0 ) - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - if ( item->TrackingActive() ) - { - OnCmdTrackingStopL(); - } - else - { - OnCmdTrackingStartL(); - } - } - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - - // Ensure we refresh the listbox content - iListBox->DrawDeferred(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - iListBox->DrawDeferred(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == MenuCascadeResourceId() ) - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - // - if ( !item->TrackerExists() || item->TrackingActive() ) - { - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStart, ETrue ); - } - else - { - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStop, ETrue ); - } - // - if ( item->TotalIncludesSharedMemory() ) - { - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithSharedMem, ETrue ); - } - else - { - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithoutSharedMem, ETrue ); - } - - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingHWMReset, Thread().IsDead() ); - } - else if ( aResourceId == R_MEMSPY_MENUPANE ) - { - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTracking, Thread().IsDead() ); - aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStart, Thread().IsDead() ); - } - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStartedL() - { - RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStoppedL() - { - RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) - { -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this ); -#endif - - CMemSpyViewBase::RefreshL(); - iListBox->DrawDeferred(); - -#ifdef _DEBUG - RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this ); -#endif - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStartL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingStartL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStopL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingStopL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdHWMResetL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingResetHWML(); - RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithSharedMemL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingSetTotalIncludesSharedMemoryL( ETrue ); - RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithoutSharedMemL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingSetTotalIncludesSharedMemoryL( EFalse ); - RefreshL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewThreadInfoItemMemoryTrackingCurrent::CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) - { - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); - - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverAddL( *this ); - - // Reset the title - _LIT( KCustomTitle, "Current Statistics" ); - SetTitleL( KCustomTitle ); - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingCurrent::PrepareParentViewL() - { - CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - - // Stop observing changes - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverRemove( *this ); - - return parent; - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::SetListBoxModelL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - MDesCArray* model = &item->InfoCurrent(); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) - { - CMemSpyViewBase::RefreshL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewThreadInfoItemMemoryTrackingHWM::CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) - { - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingHWM::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); - - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverAddL( *this ); - - // Reset the title - _LIT( KCustomTitle, "HWM Statistics" ); - SetTitleL( KCustomTitle ); - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingHWM::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingHWM::PrepareParentViewL() - { - CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - - // Stop observing changes - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverRemove( *this ); - - return parent; - } - - -TBool CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdMemoryTrackingHWMReset: - OnCmdHWMResetL(); - break; - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingHWM::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingHWM::SetListBoxModelL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - MDesCArray* model = &item->InfoHWM(); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) - { - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingHWM::OnCmdHWMResetL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingResetHWML(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewThreadInfoItemMemoryTrackingPeak::CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) - { - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingPeak::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); - - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverAddL( *this ); - - // Reset the title - _LIT( KCustomTitle, "Peak Statistics" ); - SetTitleL( KCustomTitle ); - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingPeak::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingPeak::PrepareParentViewL() - { - CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - - // Stop observing changes - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - item->TrackingObserverRemove( *this ); - - return parent; - } - - -TBool CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingPeak::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingPeak::SetListBoxModelL() - { - CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); - MDesCArray* model = &item->InfoPeak(); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) - { - CMemSpyViewBase::RefreshL(); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemServer.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemServer.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,391 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemServer.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" - -// Constants -const TInt KMemSpyServerSessionsIndex = 2; - - - -CMemSpyViewThreadInfoItemServer::CMemSpyViewThreadInfoItemServer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ) - { - } - - -void CMemSpyViewThreadInfoItemServer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - // Causes list of server's to be prepared - CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); - - _LIT( KTitle, "Server List" ); - SetTitleL( KTitle ); - -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreadInfoItemServer::ConstructL() - aSelectionRune: 0x%08x", aSelectionRune ); -#endif - - // Try to select the correct server - CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem ); - TInt selectedIndex = 0; - if ( aSelectionRune ) - { - // Treat the rune as a handle, and try to look it up - selectedIndex = infoItem->DetailsIndexByHandle( aSelectionRune ); - } - - // Select item - if ( infoItem->DetailsCount() > 0 ) - { - iListBox->SetCurrentItemIndex( selectedIndex ); - HandleListBoxItemSelectedL( selectedIndex ); - } - } - - -TBool CMemSpyViewThreadInfoItemServer::HandleCommandL( TInt aCommand ) - { - TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); - return handled; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemServer::PrepareChildViewL() - { - CMemSpyViewThreadInfoItemServerDetails* child = new(ELeave) CMemSpyViewThreadInfoItemServerDetails( iEngine, iObserver, iContainer, iCurrentInfoItemDetails ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL( TInt aIndex ) - { - // Identify the type of item to display... - CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem ); - iCurrentInfoItemDetails = infoItem->DetailsAt( aIndex ); - -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL() - iCurrentInfoItemDetails.iHandle: 0x%08x", iCurrentInfoItemDetails.iHandle ); -#endif - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewThreadInfoItemServerDetails::CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails ) - { - } - - -void CMemSpyViewThreadInfoItemServerDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - // Causes list of server's to be prepared - CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); - - _LIT( KTitle, "Server Details" ); - SetTitleL( KTitle ); - - // Try to select the correct server - TInt selectedIndex = 0; - if ( aSelectionRune ) - { - // Presence of non-null item means that we came from the "Server sessions" list - selectedIndex = KMemSpyServerSessionsIndex; - } - - // Select item - iListBox->SetCurrentItemIndex( selectedIndex ); - HandleListBoxItemSelectedL( selectedIndex ); - } - - -TBool CMemSpyViewThreadInfoItemServerDetails::HandleCommandL( TInt aCommand ) - { - TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); - return handled; - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemServerDetails::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemServerDetails; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - const TInt currentIndex = iListBox->CurrentItemIndex(); - // - if ( currentIndex == KMemSpyServerSessionsIndex ) - { - CMemSpyViewThreadInfoItemServerSessions* serverSessions = new(ELeave) CMemSpyViewThreadInfoItemServerSessions( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails ); - CleanupStack::PushL( serverSessions ); - serverSessions->ConstructL( Rect(), *Parent(), NULL ); - CleanupStack::Pop( serverSessions ); - child = serverSessions; - } - // - return child; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareParentViewL() - { - CMemSpyViewThreadInfoItemServer* parent = new(ELeave) CMemSpyViewThreadInfoItemServer( iEngine, iObserver, iInfoItem->Container() ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), iInfoItemDetails.iHandle ); - CleanupStack::Pop( parent ); - return parent; - } - - -void CMemSpyViewThreadInfoItemServerDetails::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4); - CleanupStack::PushL( model ); - - TBuf item; - - // 1st item = session type - const TPtrC pServerSessionType = CMemSpyThreadInfoServer::SessionType( iInfoItemDetails.iSessionType ); - _LIT(KItem1Format, "\tServer Type\t\t%S"); - item.Format( KItem1Format, &pServerSessionType ); - model->AppendL( item ); - - // 2nd item = session count - _LIT(KItem2Format, "\tConnected Sessions\t\t%d"); - item.Format( KItem2Format, iInfoItemDetails.iCount ); - model->AppendL( item ); - - // 3rd item = view sessions - if ( iInfoItem->Container().MdcaCount() > 0 ) - { - _LIT(KItem3Format, "\tView Sessions"); - model->AppendL( KItem3Format ); - } - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - -void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - // Notify observer about an item being 'fired' - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemSelectedL( TInt /*aIndex*/ ) - { - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CMemSpyViewThreadInfoItemServerSessions::CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails ) - { - } - - -void CMemSpyViewThreadInfoItemServerSessions::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); - // - _LIT( KTitle, "Connected Session List" ); - SetTitleL( KTitle ); - } - - -TBool CMemSpyViewThreadInfoItemServerSessions::HandleCommandL( TInt aCommand ) - { - TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); - return handled; - } - - -TMemSpyViewType CMemSpyViewThreadInfoItemServerSessions::ViewType() const - { - return EMemSpyViewTypeThreadInfoItemServerSessions; - } - - -CMemSpyViewBase* CMemSpyViewThreadInfoItemServerSessions::PrepareParentViewL() - { - CMemSpyViewThreadInfoItemServerDetails* parent = new(ELeave) CMemSpyViewThreadInfoItemServerDetails( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), this ); - CleanupStack::Pop( parent ); - return parent; - } - - -void CMemSpyViewThreadInfoItemServerSessions::SetListBoxModelL() - { - CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4); - CleanupStack::PushL( model ); - - // Get handles - RArray sessions; - CleanupClosePushL( sessions ); - iEngine.HelperServer().GetServerSessionsL( iInfoItemDetails, sessions ); - - // Prepare items - TBuf item; - const TInt count = sessions.Count(); - for( TInt i=0; iName() ); - item.Append( KInsertTab ); - item.Append( KInsertTab ); - item.Append( thread->Name() ); - } - } - else if ( session.iOwnerType == TMemSpyDriverServerSessionInfo::EOwnerProcess ) - { - // Find the process object - CMemSpyProcess* process = NULL; - TRAPD( error, process = &iEngine.Container().ProcessByIdL( session.iOwnerId ) ); - if ( error == KErrNone ) - { - item.Append( process->Name() ); - } - } - - if ( !item.Length() ) - { - // Fall-back case - item.Copy( session.iName ); - } - - // Add item - item.Insert( 0, KInsertTab ); - model->AppendL( item ); - } - CleanupStack::PopAndDestroy( &sessions ); - - // Set up list box - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( model ); - listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); - CleanupStack::Pop( model ); - } - - - - - - - - - - - - - - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreadInfoItemStack.cpp --- a/memspyui/source/MemSpyViewThreadInfoItemStack.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreadInfoItemStack.h" - -// Engine includes -#include -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewThreads.h" -#include "MemSpyViewThreadInfoItemHeap.h" - - - -CMemSpyViewThreadInfoItemStack::CMemSpyViewThreadInfoItemStack( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) -: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeStack ) - { - } - - -TBool CMemSpyViewThreadInfoItemStack::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { -#ifndef __WINS__ - case EMemSpyCmdStackDataUser: - OnCmdStackDataUserL(); - break; - case EMemSpyCmdStackDataKernel: - OnCmdStackDataKernelL(); - break; -#endif - case EMemSpyCmdStackInfoThread: - OnCmdStackInfoL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewThreadInfoItemStack::OnCmdStackInfoL() - { - iEngine.HelperStack().OutputStackInfoL( Thread() ); - } - - -void CMemSpyViewThreadInfoItemStack::OnCmdStackDataUserL() - { - iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainUser ); - } - - -void CMemSpyViewThreadInfoItemStack::OnCmdStackDataKernelL() - { - iEngine.HelperStack().OutputStackDataL( Thread(), EMemSpyDriverDomainKernel ); - } - - -void CMemSpyViewThreadInfoItemStack::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == R_MEMSPY_MENUPANE ) - { - aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() ); - } - } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewThreads.cpp --- a/memspyui/source/MemSpyViewThreads.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewThreads.h" - -// System includes -#include -#include - -// Engine includes -#include -#include -#include -#include -#include -#include -#include - -// User includes -#include "MemSpyContainerObserver.h" -#include "MemSpyViewProcesses.h" -#include "MemSpyViewThreadInfoItemList.h" - - - - -CMemSpyViewThreads::CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ) -: CMemSpyViewBase( aEngine, aObserver ), iParentProcess( aProcess ) - { - iParentProcess.Open(); - } - - -CMemSpyViewThreads::~CMemSpyViewThreads() - { - iParentProcess.Close(); - if ( iCurrentThread ) - { - iCurrentThread->Close(); - } - } - - -void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Threads" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - // - if ( aSelectionRune ) - { - CMemSpyThread* selectedItem = reinterpret_cast< CMemSpyThread* >( aSelectionRune ); - const TInt index = iParentProcess.ThreadIndexById( selectedItem->Id() ); - if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) - { - iListBox->SetCurrentItemIndex( index ); - HandleListBoxItemSelectedL( index ); - } - } - else if ( iParentProcess.Count() > 0 ) - { - iListBox->SetCurrentItemIndex( 0 ); - HandleListBoxItemSelectedL( 0 ); - } - } - - -const CMemSpyProcess& CMemSpyViewThreads::Process() const - { - return iParentProcess; - } - - -CMemSpyThread& CMemSpyViewThreads::CurrentThread() - { - __ASSERT_ALWAYS( iCurrentThread != NULL, User::Invariant() ); - return *iCurrentThread; - } - - -void CMemSpyViewThreads::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewThreads::ViewType() const - { - return EMemSpyViewTypeThreads; - } - - -CMemSpyViewBase* CMemSpyViewThreads::PrepareParentViewL() - { - CMemSpyViewProcesses* parent = new(ELeave) CMemSpyViewProcesses( iEngine, iObserver, iParentProcess ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), &iParentProcess ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL() - { - CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iEngine, iObserver, *iCurrentThread ); - CleanupStack::PushL( child ); - child->ConstructL( Rect(), *Parent() ); - CleanupStack::Pop( child ); - return child; - } - - -void CMemSpyViewThreads::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) - { - if ( aResourceId == R_MEMSPY_MENUPANE ) - { - CMemSpyThread& thread = CurrentThread(); - aMenuPane->SetItemDimmed( EMemSpyCmdThread, thread.IsDead() ); - } - } - - -TBool CMemSpyViewThreads::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdThreadEndKill: - OnCmdEndKillL(); - break; - case EMemSpyCmdThreadEndTerminate: - OnCmdEndTerminateL(); - break; - case EMemSpyCmdThreadEndPanic: - OnCmdEndPanicL(); - break; - case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow: - case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal: - case EMemSpyCmdThreadSetPriorityAbsoluteLow: - case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal: - case EMemSpyCmdThreadSetPriorityAbsoluteBackground: - case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal: - case EMemSpyCmdThreadSetPriorityAbsoluteForeground: - case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal: - case EMemSpyCmdThreadSetPriorityAbsoluteHigh: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7: - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8: - OnCmdSetPriorityL( aCommand ); - break; - - case EMemSpyCmdThreadInfoHandles: - OnCmdInfoHandlesL(); - break; - - default: - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - // - return handled; - } - - -void CMemSpyViewThreads::OnCmdEndKillL() - { - TBool doTerminate = ETrue; - CMemSpyThread& thread = CurrentThread(); - // - if ( thread.IsSystemPermanent() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - thread.KillL(); - RefreshL(); - } - } - - -void CMemSpyViewThreads::OnCmdEndTerminateL() - { - TBool doTerminate = ETrue; - CMemSpyThread& thread = CurrentThread(); - // - if ( thread.IsSystemPermanent() || thread.IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - thread.TerminateL(); - RefreshL(); - } - } - - -void CMemSpyViewThreads::OnCmdEndPanicL() - { - TBool doTerminate = ETrue; - CMemSpyThread& thread = CurrentThread(); - // - if ( thread.IsSystemPermanent() || thread.IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - thread.PanicL(); - RefreshL(); - } - } - - -void CMemSpyViewThreads::OnCmdSetPriorityL( TInt aCommand ) - { - TThreadPriority pri = EPriorityAbsoluteBackground; - switch( aCommand ) - { - case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow: - pri = EPriorityAbsoluteVeryLow; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal: - pri = EPriorityAbsoluteLowNormal; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteLow: - pri = EPriorityAbsoluteLow; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal: - pri = EPriorityAbsoluteBackgroundNormal; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteBackground: - pri = EPriorityAbsoluteBackground; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal: - pri = EPriorityAbsoluteForegroundNormal; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteForeground: - pri = EPriorityAbsoluteForeground; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal: - pri = EPriorityAbsoluteHighNormal; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteHigh: - pri = EPriorityAbsoluteHigh; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1: - pri = EPriorityAbsoluteRealTime1; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2: - pri = EPriorityAbsoluteRealTime2; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3: - pri = EPriorityAbsoluteRealTime3; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4: - pri = EPriorityAbsoluteRealTime4; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5: - pri = EPriorityAbsoluteRealTime5; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6: - pri = EPriorityAbsoluteRealTime6; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7: - pri = EPriorityAbsoluteRealTime7; - break; - case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8: - pri = EPriorityAbsoluteRealTime8; - break; - } - -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - pri: %d", pri ); -#endif - - CMemSpyThread& thread = CurrentThread(); - thread.SetPriorityL( pri ); - RefreshL(); - -#ifdef _DEBUG - RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - END" ); -#endif - } - - -void CMemSpyViewThreads::OnCmdInfoHandlesL() - { - CMemSpyThread& thread = CurrentThread(); - thread.InfoContainerForceSyncronousConstructionL().PrintL(); - } - - -void CMemSpyViewThreads::SetListBoxModelL() - { - CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( &iParentProcess ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -void CMemSpyViewThreads::HandleListBoxItemActionedL( TInt /*aIndex*/ ) - { - // Notify observer about an item being 'fired' - ReportEventL( MMemSpyViewObserver::EEventItemActioned ); - } - - -void CMemSpyViewThreads::HandleListBoxItemSelectedL( TInt aIndex ) - { - if ( iCurrentThread ) - { - iCurrentThread->Close(); - } - - // Obtain the thread that corresponds to the selected item - CMemSpyThread& thread = iParentProcess.At( aIndex ); - iCurrentThread = &thread; - iCurrentThread->Open(); - - // Notify observer about item selection - ReportEventL( MMemSpyViewObserver::EEventItemSelected ); - } - - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewType.cpp --- a/memspyui/source/MemSpyViewType.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewType.h" - - - - -TBool MemSpyViewTypeUtils::IsOpenableItem( TMemSpyViewType aType ) - { - TBool openable = EFalse; - // - switch( aType ) - { - case EMemSpyViewTypeMainMenu: - case EMemSpyViewTypeProcesses: - case EMemSpyViewTypeServerList: - case EMemSpyViewTypeThreads: - case EMemSpyViewTypeThreadInfoItemList: - case EMemSpyViewTypeThreadInfoItemServer: - case EMemSpyViewTypeThreadInfoItemSession: - openable = ETrue; - break; - default: - break; - } - // - return openable; - } - - -TBool MemSpyViewTypeUtils::IsThreadInfoItem( TMemSpyViewType aType ) - { - TBool infoItem = ETrue; - // - switch( aType ) - { - case EMemSpyViewTypeMainMenu: - case EMemSpyViewTypeRAMInfo: - case EMemSpyViewTypeROMInfo: - case EMemSpyViewTypeServerList: - case EMemSpyViewTypeOpenFiles: - case EMemSpyViewTypeProcesses: - case EMemSpyViewTypeThreads: - case EMemSpyViewTypeThreadInfoItemList: - infoItem = EFalse; - break; - default: - break; - } - // - return infoItem; - } - - -TBool MemSpyViewTypeUtils::IsExitableView( TMemSpyViewType aType ) - { - TBool ret = EFalse; - // - switch( aType ) - { - case EMemSpyViewTypeMainMenu: - ret = ETrue; - break; - default: - break; - } - // - return ret; - } - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/source/MemSpyViewWindowGroups.cpp --- a/memspyui/source/MemSpyViewWindowGroups.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,314 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "MemSpyViewWindowGroups.h" - -// System includes -#include -#include -#include - -// Engine includes -#include -#include -#include - -// User includes -#include "MemSpyUiUtils.h" -#include "MemSpyViewMainMenu.h" -#include "MemSpyContainerObserver.h" - -// Literal constants -const TInt KMaxInfoLength = 128; - - -CMemSpyViewWindowGroups::CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) -: CMemSpyViewBase( aEngine, aObserver ) - { - } - - -CMemSpyViewWindowGroups::~CMemSpyViewWindowGroups() - { - delete iWindowGroupList; - } - - -void CMemSpyViewWindowGroups::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) - { - _LIT( KTitle, "Window Groups" ); - SetTitleL( KTitle ); - // - CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); - } - - -CEikListBox* CMemSpyViewWindowGroups::ConstructListBoxL() - { - delete iListBox; - iListBox = NULL; - CAknSingleNumberStyleListBox* listbox = new (ELeave) CAknSingleNumberStyleListBox(); - iListBox = listbox; - listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); - listbox->SetContainerWindowL( *this ); - listbox->CreateScrollBarFrameL( ETrue ); - SetListBoxModelL(); - listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); - listbox->SetListBoxObserver( this ); - listbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); - listbox->SetObserver( this ); - return listbox; - } - -void CMemSpyViewWindowGroups::RefreshL() - { - SetListBoxModelL(); - CMemSpyViewBase::RefreshL(); - } - - -TMemSpyViewType CMemSpyViewWindowGroups::ViewType() const - { - return EMemSpyViewTypeWindowGroups; - } - - -CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareParentViewL() - { - CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); - CleanupStack::PushL( parent ); - parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); - CleanupStack::Pop( parent ); - return parent; - } - - -CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareChildViewL() - { - CMemSpyViewBase* child = NULL; - if ( iListBox && - iListBox->Model()->NumberOfItems() && - iListBox->CurrentItemIndex() > KErrNotFound ) - { - DetailsL(); - } - return child; - } - - -void CMemSpyViewWindowGroups::SetListBoxModelL() - { - // Take ownership of new model - MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer(); - MMemSpyEngineWindowGroupList* windowGroupList = windowServerManager.WindowGroupListL(); - delete iWindowGroupList; - iWindowGroupList = windowGroupList; - - // Set up list box - CAknSingleNumberStyleListBox* listbox = static_cast< CAknSingleNumberStyleListBox* >( iListBox ); - listbox->Model()->SetItemTextArray( iWindowGroupList ); - listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - } - - -TBool CMemSpyViewWindowGroups::HandleCommandL( TInt aCommand ) - { - TBool handled = ETrue; - // - switch ( aCommand ) - { - case EMemSpyCmdWindowGroupTerminate: - { - TRAPD( err, OnCmdEndL( aCommand ) ); - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - if ( err ) - { - note->ExecuteLD( _L("Cannot terminate task") ); - } - else - { - note->ExecuteLD( _L("Task terminated") ); - } - break; - } - case EMemSpyCmdWindowGroupSwitchTo: - { - TRAPD( err, OnCmdSwitchToL() ); - if ( err ) - { - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - note->ExecuteLD( _L("Cannot bring to foreground") ); - } - break; - } - case EMemSpyCmdWindowGroupEnd: - { - TRAPD( err, OnCmdEndL( aCommand ) ); - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - if ( err ) - { - note->ExecuteLD( _L("Cannot end task") ); - } - else - { - note->ExecuteLD( _L("Task exited") ); - } - break; - } - case EMemSpyCmdWindowGroupPanic: - { - TRAPD( err, OnCmdEndL( aCommand ) ); - CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); - if ( err ) - { - note->ExecuteLD( _L("Cannot panic task") ); - } - else - { - note->ExecuteLD( _L("Task panic'ed") ); - } - break; - } - default: - { - handled = CMemSpyViewBase::HandleCommandL( aCommand ); - break; - } - } - // - return handled; - } - - -void CMemSpyViewWindowGroups::OnCmdSwitchToL() - { - MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer(); - TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId; - windowServerManager.SwitchToL( id ); - } - - -void CMemSpyViewWindowGroups::OnCmdEndL( TInt aCommand ) - { - TBool doTerminate = ETrue; - - CMemSpyEngineObjectContainer& container = iEngine.Container(); - TThreadId id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iThreadId; - - // Try to find the thread in question... - CMemSpyProcess* process = NULL; - CMemSpyThread* thread = NULL; - User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); - - if ( thread ) - { - thread->Open(); - // - if ( thread->IsSystemPermanent() || thread->IsSystemCritical() ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - } - // - if ( doTerminate ) - { - switch ( aCommand ) - { - case EMemSpyCmdWindowGroupTerminate: - { - thread->TerminateL(); - break; - } - case EMemSpyCmdWindowGroupEnd: - { - thread->KillL(); - break; - } - case EMemSpyCmdWindowGroupPanic: - { - thread->PanicL(); - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - } - } - } - RefreshL(); - } - - -void CMemSpyViewWindowGroups::DetailsL() - { - HBufC* messageBuf = HBufC::NewLC( 4096 ); - TPtr messagePtr = messageBuf->Des(); - - // Fetch data from helper - TMemSpyEngineWindowGroupDetails selectedObject; - MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer(); - TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId; - windowServerManager.GetWindowGroupDetailsL( id, selectedObject ); - - // Append info to string buffer - AppendFormatString( messagePtr, _L("WG ID: %d\n"), selectedObject.iId ); - AppendFormatString( messagePtr, _L("Client ThreadId: %Lu\n"), selectedObject.iThreadId.Id() ); - TFullName name; - name.Copy( selectedObject.iFullName ); - AppendFormatString( messagePtr, _L("Thr: %S\n"), &name ); - name.Zero(); - AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority ); - AppendFormatString( messagePtr, _L("Handle: 0x%08X\n"), selectedObject.iWindowGroupHandle ); - name.Copy( selectedObject.iName ); - AppendFormatString( messagePtr, _L("Name: %S\n"), &name ); - name.Zero(); - AppendFormatString( messagePtr, _L("UID: 0x%08X\n"), selectedObject.iUID ); - AppendFormatString( messagePtr, _L("IsBusy: %d\n"), selectedObject.iIsBusy ); - AppendFormatString( messagePtr, _L("IsSystem: %d\n"), selectedObject.iIsSystem ); - AppendFormatString( messagePtr, _L("IsHidden: %d\n"), selectedObject.iIsHidden ); - name.Copy( selectedObject.iCaption ); - AppendFormatString( messagePtr, _L("Caption: %S\n"), &name ); - name.Zero(); - name.Copy( selectedObject.iDocName ); - AppendFormatString( messagePtr, _L("Docname: %S"), &name ); - name.Zero(); - - // Display the buffer on a dialog - CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); - dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG ); - TFileName headerText; - headerText.Copy( selectedObject.iFullName ); - dialog->SetHeaderTextL( headerText ); - dialog->SetMessageTextL( messagePtr ); - dialog->RunLD(); - - CleanupStack::PopAndDestroy( messageBuf ); - } - - -void CMemSpyViewWindowGroups::AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ) - { - TBuf infoString; - VA_LIST list; - VA_START ( list, aFmt ); - infoString.FormatList( aFmt, list ); - aPtr.Append( infoString ); - } - - diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/group/MemSpyCapabilities.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/group/MemSpyCapabilities.mmh Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,19 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +CAPABILITY ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/group/bld.inf Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +PRJ_MMPFILES +memspyui.mmp diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/group/memspyui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/group/memspyui.mmp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include + +TARGET memspyui.exe +TARGETTYPE exe +UID 0x100039CE 0x2002129F +VENDORID VID_DEFAULT +SMPSAFE + +EPOCSTACKSIZE 0x4000 +EPOCHEAPSIZE 0x100000 0x4000000 + +#include "MemSpyCapabilities.mmh" + +SOURCEPATH ../src +source MemSpyApp.cpp +source MemSpyAppUi.cpp +source MemSpyDocument.cpp +source MemSpyContainer.cpp +source MemSpyDeviceWideOperationDialog.cpp +source MemSpyExportBitmapsToMemoryCardDialog.cpp +source MemSpyUiUtils.cpp +source MemSpySettings.cpp +// +source MemSpyViewBase.cpp +source MemSpyViewMainMenu.cpp +source MemSpyViewType.cpp +source MemSpyViewProcesses.cpp +source MemSpyViewServerList.cpp +/* +source MemSpyViewOpenFiles.cpp +source MemSpyViewRAMInfo.cpp +source MemSpyViewROMInfo.cpp +source MemSpyViewFBServBitmaps.cpp +source MemSpyViewSystemConfig.cpp +source MemSpyViewCodeSegList.cpp +source MemSpyViewChunkList.cpp +*/ +source MemSpyViewKernel.cpp +source MemSpyViewKernelContainers.cpp +source MemSpyViewKernelHeap.cpp +source MemSpyViewKernelObjects.cpp +/* +source MemSpyViewDriveInfo.cpp +source MemSpyViewECom.cpp +*/ +source MemSpyViewThreads.cpp +source MemSpyViewThreadInfoItemList.cpp +source MemSpyViewThreadInfoItemGeneric.cpp +source MemSpyViewThreadInfoItemHeap.cpp +source MemSpyViewThreadInfoItemStack.cpp +source MemSpyViewThreadInfoItemCodeSeg.cpp +source MemSpyViewThreadInfoItemChunk.cpp +source MemSpyViewThreadInfoItemServer.cpp +source MemSpyViewThreadInfoItemActiveObject.cpp +source MemSpyViewThreadInfoItemGeneralInfo.cpp + +source MemSpyViewHeapTracking.cpp +source MemSpyViewHeapTrackingResults.cpp +source MemSpyViewHeapTrackingSettings.cpp +/* +source MemSpyViewThreadInfoItemMemoryTracking.cpp +source MemSpyViewMemoryTrackingAutoStartConfig.cpp +source MemSpyViewWindowGroups.cpp +source MemSpyViewKernelObjects.cpp +*/ + +USERINCLUDE ../inc + +APP_LAYER_SYSTEMINCLUDE + + +START RESOURCE ../../../data/memspyui.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +END + +START RESOURCE ../../../data/memspyui_reg.rss +DEPENDS memspyui.rsg +TARGETPATH /private/10003a3f/import/apps +END + +LIBRARY fbscli.lib imageconversion.lib estor.lib apgrfx.lib +LIBRARY euser.lib apparc.lib cone.lib eikcore.lib +LIBRARY eikcoctl.lib avkon.lib etext.lib eikctl.lib +LIBRARY efsrv.lib bafl.lib egul.lib hal.lib +LIBRARY cdlengine.lib xmlframework.lib charconv.lib viewcli.lib +LIBRARY eikdlg.lib ws32.lib bitgdi.lib + +LIBRARY MemSpyClient.lib +LIBRARY memspydriverclient.lib +LIBRARY memspyengine.lib diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpy.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpy.hrh Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,246 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPY_HRH +#define MEMSPY_HRH + +#define KMemSpyMenuCommandBase 50000 +#define KMemSpyMenuCommandViewSpecific (KMemSpyMenuCommandBase + 10000) + +enum TMemSpyCommandIds + { + //////////////////////////////// + // GENERIC MENU COMMANDS + //////////////////////////////// + EMemSpyCmdOpen = KMemSpyMenuCommandBase, + // + EMemSpyCmdView, + EMemSpyCmdViewRefresh, + EMemSpyCmdViewOutputToSink, + // + EMemSpyCmdTools, + EMemSpyCmdToolsListOpenFiles, + EMemSpyCmdToolsAbout, + // + EMemSpyCmdPhoneInfo, + EMemSpyCmdPhoneInfoGeneral, + EMemSpyCmdPhoneInfoGeneralSummary, + EMemSpyCmdPhoneInfoGeneralDetailed, + EMemSpyCmdPhoneInfoGeneralHandles, + EMemSpyCmdPhoneInfoGeneralKernelContainers, + EMemSpyCmdPhoneInfoHeap, + EMemSpyCmdPhoneInfoHeapInfoSummary, + EMemSpyCmdPhoneInfoHeapInfoCompact, + EMemSpyCmdPhoneInfoHeapCellListing, + EMemSpyCmdPhoneInfoHeapDump, + EMemSpyCmdPhoneInfoStack, + EMemSpyCmdPhoneInfoStackInfo, + EMemSpyCmdPhoneInfoStackInfoCompact, + EMemSpyCmdPhoneInfoStackDumpUser, + EMemSpyCmdPhoneInfoStackDumpKernel, + // + EMemSpyCmdAutoCapture, + EMemSpyCmdAutoCaptureToggle, + EMemSpyCmdAutoCaptureRetryTime, + EMemSpyCmdAutoCaptureOperationType, + + //////////////////////////////// + // VIEW SPECIFIC MENU COMMANDS + //////////////////////////////// + EMemSpyCmdProcess = KMemSpyMenuCommandViewSpecific, + EMemSpyCmdProcessInfo, + EMemSpyCmdProcessInfoSummary, + EMemSpyCmdProcessInfoHandles, + EMemSpyCmdProcessSort, + EMemSpyCmdProcessSortById, + EMemSpyCmdProcessSortByName, + EMemSpyCmdProcessSortByThreadCount, + EMemSpyCmdProcessSortByCodeSegs, + EMemSpyCmdProcessSortByHeapUsage, + EMemSpyCmdProcessSortByStackUsage, + EMemSpyCmdProcessEnd, + EMemSpyCmdProcessEndKill, + EMemSpyCmdProcessEndPanic, + EMemSpyCmdProcessEndTerminate, + // + EMemSpyCmdThread, + EMemSpyCmdThreadEnd, + EMemSpyCmdThreadEndKill, + EMemSpyCmdThreadEndPanic, + EMemSpyCmdThreadEndTerminate, + EMemSpyCmdThreadSetPriority, + EMemSpyCmdThreadSetPriorityAbsoluteVeryLow, + EMemSpyCmdThreadSetPriorityAbsoluteLowNormal, + EMemSpyCmdThreadSetPriorityAbsoluteLow, + EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal, + EMemSpyCmdThreadSetPriorityAbsoluteBackground, + EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal, + EMemSpyCmdThreadSetPriorityAbsoluteForeground, + EMemSpyCmdThreadSetPriorityAbsoluteHighNormal, + EMemSpyCmdThreadSetPriorityAbsoluteHigh, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime1, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime2, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime3, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime4, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime5, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime6, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime7, + EMemSpyCmdThreadSetPriorityAbsoluteRealTime8, + EMemSpyCmdThreadInfo, + EMemSpyCmdThreadInfoHandles, + // + EMemSpyCmdOutput, + EMemSpyCmdOutputToDebug, + EMemSpyCmdOutputToFile, + // + EMemSpyCmdHeap, + EMemSpyCmdHeapInfoThread, + EMemSpyCmdHeapData, + EMemSpyCmdHeapCellListing, + EMemSpyCmdHeapDataDump, + // + EMemSpyCmdStack, + EMemSpyCmdStackInfoThread, + EMemSpyCmdStackData, + EMemSpyCmdStackDataUser, + EMemSpyCmdStackDataKernel, + // + EMemSpyCmdChunk, + EMemSpyCmdChunkSort, + EMemSpyCmdChunkSortByName, + EMemSpyCmdChunkSortBySize, + EMemSpyCmdChunkListing, + // + EMemSpyCmdCodeSeg, + EMemSpyCmdCodeSegShow, + EMemSpyCmdCodeSegShowItemsAll, + EMemSpyCmdCodeSegShowItemsGlobalData, + EMemSpyCmdCodeSegShowCaps, + EMemSpyCmdCodeSegShowCapsWithTCBProcess, + EMemSpyCmdCodeSegShowCapsWithTCBAll, + EMemSpyCmdCodeSegShowCapsWithCommDDProcess, + EMemSpyCmdCodeSegShowCapsWithCommDDAll, + EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess, + EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll, + EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess, + EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll, + EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess, + EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll, + EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess, + EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll, + EMemSpyCmdCodeSegShowCapsWithDRMProcess, + EMemSpyCmdCodeSegShowCapsWithDRMAll, + EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess, + EMemSpyCmdCodeSegShowCapsWithTrustedUIAll, + EMemSpyCmdCodeSegShowCapsWithProtServProcess, + EMemSpyCmdCodeSegShowCapsWithProtServAll, + EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess, + EMemSpyCmdCodeSegShowCapsWithDiskAdminAll, + EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess, + EMemSpyCmdCodeSegShowCapsWithNetworkControlAll, + EMemSpyCmdCodeSegShowCapsWithAllFilesProcess, + EMemSpyCmdCodeSegShowCapsWithAllFilesAll, + EMemSpyCmdCodeSegShowCapsWithSwEventProcess, + EMemSpyCmdCodeSegShowCapsWithSwEventAll, + EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess, + EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll, + EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess, + EMemSpyCmdCodeSegShowCapsWithLocalServicesAll, + EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess, + EMemSpyCmdCodeSegShowCapsWithReadUserDataAll, + EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess, + EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll, + EMemSpyCmdCodeSegShowCapsWithLocationProcess, + EMemSpyCmdCodeSegShowCapsWithLocationAll, + EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess, + EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll, + EMemSpyCmdCodeSegShowCapsWithUserEnvProcess, + EMemSpyCmdCodeSegShowCapsWithUserEnvAll, + EMemSpyCmdCodeSegSort, + EMemSpyCmdCodeSegSortByName, + EMemSpyCmdCodeSegSortByCodeSize, + EMemSpyCmdCodeSegSortByDataSize, + EMemSpyCmdCodeSegSortByUid, + EMemSpyCmdCodeSegListing, + // + EMemSpyCmdImages, + EMemSpyCmdImagesSlideshow, + EMemSpyCmdImagesSaveAllToMemoryCard, + EMemSpyCmdImagesListing, + // + EMemSpyCmdActiveObject, + EMemSpyCmdActiveObjectListing, + // + EMemSpyCmdServerList, + EMemSpyCmdServerListOutput, + EMemSpyCmdServerListOutputListCSV, + EMemSpyCmdServerListOutputListDetailed, + EMemSpyCmdServerListSort, + EMemSpyCmdServerListSortByName, + EMemSpyCmdServerListSortBySessionCount, + // + EMemSpyCmdKernelContainers, + EMemSpyCmdKernelContainersOutput, + EMemSpyCmdKernelObjects, + EMemSpyCmdKernelObjectTerminate, + EMemSpyCmdKernelObjectSwitchTo, + EMemSpyCmdKernelObjectEnd, + EMemSpyCmdKernelObjectPanic, + + // + EMemSpyCmdKernelHeap, + EMemSpyCmdKernelHeapDump, + // + EMemSpyCmdRAM, + EMemSpyCmdRAMAvkonIconCacheDisabled, + EMemSpyCmdRAMAvkonIconCacheEnabled, + // + EMemSpyCmdBTrace, + EMemSpyCmdBTraceCaptureToggle, + // + EMemSpyCmdMemoryTracking, + EMemSpyCmdMemoryTrackingStart, + EMemSpyCmdMemoryTrackingStop, + EMemSpyCmdMemoryTrackingAutoStart, + EMemSpyCmdMemoryTrackingAutoStartItemAdd, + EMemSpyCmdMemoryTrackingAutoStartItemEdit, + EMemSpyCmdMemoryTrackingAutoStartItemDelete, + EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll, + EMemSpyCmdMemoryTrackingAutoStartItemImport, + EMemSpyCmdMemoryTrackingHWM, + EMemSpyCmdMemoryTrackingHWMReset, + EMemSpyCmdMemoryTrackingTotalWithSharedMem, + EMemSpyCmdMemoryTrackingTotalWithoutSharedMem, + + // + EMemSpyCmdWindowGroups, + EMemSpyCmdWindowGroupTerminate, + EMemSpyCmdWindowGroupSwitchTo, + EMemSpyCmdWindowGroupEnd, + EMemSpyCmdWindowGroupPanic + }; + +enum TMemSpyControlIds + { + EMemSpyCtrlIdProgressNote = 1000, + EMemSpyCtrlIdSlideShowImage, + EMemSpyCtrlIdWaitNote + }; + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyApp.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYAPP_H +#define MEMSPYAPP_H + +// System includes +#include + +// Constants +const TUid KUidMemSpy = { 0x2002129F }; + + +class CMemSpyApp : public CAknApplication + { +private: // From CApaApplication + CApaDocument* CreateDocumentL(); + TUid AppDllUid() const; + }; + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyAppUi.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYAPPUI_H +#define MEMSPYAPPUI_H + +// System includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyDeviceWideOperationDialog.h" +#include "MemSpyContainerObserver.h" +#include +#include "MemSpySettings.h" + +// Classes referenced +class CEikMenuBar; +class CMemSpyEngine; +class CMemSpyContainer; +class CMemSpyDocument; + +//cigasto +class RMemSpySession; + + +class CMemSpyAppUi : public CAknAppUi, public MMemSpyContainerObserver, public MCoeControlObserver, public MMemSpyEngineObserver//, public MMemSpyDeviceWideOperationDialogObserver + { +public: + //CMemSpyAppUi( CMemSpyEngine& aEngine ); + CMemSpyAppUi( RMemSpySession& aMemSpySession ); + ~CMemSpyAppUi(); + void ConstructL(); + +public: // API + CMemSpyDocument& MemSpyDocument(); + const CMemSpyDocument& MemSpyDocument() const; + inline CMemSpyContainer& Container() { return *iAppContainer; } + +private: // From Avkon + void HandleStatusPaneSizeChange(); + +private: // From MCoeControlObserver + void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType); + +private: // From MEikMenuObserver + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +private: // From CEikAppUi + void HandleForegroundEventL(TBool aForeground); + void HandleCommandL(TInt aCommand); + TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + +private: // From MMemSpyContainerObserver + void HandleThreadSelectedL( const CMemSpyThread& aThread ); + +private: // From MMemSpyEngineObserver + void HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext ); + +private: // From MMemSpyDeviceWideOperationDialogObserver + void DWOperationStarted(); + void DWOperationCancelled(); + void DWOperationCompleted(); + +private: // Internal methods + void UpdateCBAL(); + void InitiateMemSpyClientServerOperationL( TInt aOpCode ); + void SetViewServerTimeOutStatus( TBool aEnabled ); + +private: // Command handlers + void OnCmdBackL(); + void OnCmdExitL(); + void OnCmdOpenL(); + void OnCmdAboutL(); + + // Output + void OnCmdOutputToDebugL(); + void OnCmdOutputToFileL(); + + // Phone-information + //void OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::TOperation aOp ); + void OnCmdPhoneInformationOperationL( TDeviceWideOperation aOperation ); + void OnCmdPhoneInformationOperationKernelContainersL(); + + // Automatic capture + void OnCmdAutoCaptureToggleL(); + void OnCmdAutoCaptureRetryTimeL(); + void OnCmdAutoCaptureOperationTypeL(); + + // Misc + void OnCmdToolsBitmapsSaveToMemoryCardL(); + void OnCmdToolsSendToBackgroundL(); + void OnCmdToolsBringToForegroundL(); + +private: // Auto capture related + static TInt AutoCaptureCallBack( TAny* aSelf ); + void AutoCaptureCallBackL(); + +private: // Member data + //CMemSpyEngine& iEngine; + RMemSpySession& iMemSpySession; + CMemSpyContainer* iAppContainer; + CMemSpySettings* iSettings; + + // For phone information dialog + TBool iRunningDeviceWideOperation; + + // For auto-capture + TInt iAutoCaptureTimerPeriod; + CMemSpyDeviceWideOperations::TOperation iAutoCaptureOperationType; + CPeriodic* iAutoCaptureTimer; + }; + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyContainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYCONTAINER_H +#define MEMSPYCONTAINER_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" +#include "MemSpyViewObserver.h" + +// Classes referenced +class CMemSpyEngine; +class CMemSpyProcess; +class CMemSpyThread; +class CMemSpyThreadInfoItemBase; +class CMemSpyEngineObjectContainer; +class MMemSpyContainerObserver; +//cigasto +class RMemSpySession; + +class CMemSpyContainer : public CCoeControl, public MMemSpyViewObserver + { +public: + //CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver ); + CMemSpyContainer( RMemSpySession& aSession, MMemSpyContainerObserver& aObserver ); + ~CMemSpyContainer(); + void ConstructL( const TRect& aRect ); + +public: // API + inline TMemSpyViewType ActiveViewType() const { return iActiveView->ViewType(); } + inline CMemSpyViewBase& ActiveView() const { return *iActiveView; } + +public: // API + void NavigateToParentViewL(); + void NavigateToChildViewL(); + void HandleCommandL( TInt aCommand ); + void SetNewActiveViewL( CMemSpyViewBase* aNewView ); + +public: // Command handlers + void OnCmdViewRefreshL(); + +private: // From CCoeControl + void SizeChanged(); + TInt CountComponentControls() const; + CCoeControl* ComponentControl(TInt aIndex) const; + void Draw(const TRect& aRect) const; + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + +private: // From MMemSpyViewObserver + void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext ); + +private: // Internal methods + CMemSpyViewBase* PrepareTopLevelViewL(); + +private: // Member data + //CMemSpyEngine& iEngine; + RMemSpySession& iMemSpySession; + MMemSpyContainerObserver& iObserver; + CMemSpyViewBase* iActiveView; + CMemSpyViewBase* iPreviousView; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyContainerObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyContainerObserver.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYCONTAINEROBSERVER_H +#define MEMSPYCONTAINEROBSERVER_H + +// Classes referenced +class CMemSpyThread; + + +class MMemSpyContainerObserver + { +public: + virtual void HandleThreadSelectedL( const CMemSpyThread& aThread ) = 0; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYDEVICEWIDEOPERATIONDIALOG_H +#define MEMSPYDEVICEWIDEOPERATIONDIALOG_H + +// System includes +#include +#include +#include + +// Engine includes +#include +#include +#include + +//#include "MemSpyAppUi.h" + +// Classes referenced +//class RMemSpySession; + +enum TDeviceWideOperation +{ + OutputPhoneInfo = 0, + + OutputDetailedPhoneInfo, + + OutputHeapInfo, + + OutputCompactHeapInfo, + + OutputHeapCellListing, + + OutputHeapData, + + OutputStackInfo, + + OutputCompactStackInfo, + + OutputUserStackData, + + OutputKernelStackData +}; + + +class MMemSpyDeviceWideOperationDialogObserver + { +public: + virtual void DWOperationStarted() = 0; + virtual void DWOperationCancelled() = 0; + virtual void DWOperationCompleted() = 0; + }; + + +class CMemSpyDwoProgressTracker : public CActive, public MProgressDialogCallback +{ +public: + CMemSpyDwoProgressTracker(RMemSpySession &aSession); + + virtual ~CMemSpyDwoProgressTracker(); + + void Start(); + + void Cancel(); + + TMemSpyDeviceWideOperationProgress Progress() { return iProgress; } + + CAknProgressDialog* ProgressDialog() { return iProgressDialog; } + + void UpdateProcessDialogL( TInt aProgress, const TDesC& aProgressText ); + +protected: // from CActive + + void DialogDismissedL(TInt aButtonId); + + virtual void RunL(); + + virtual void DoCancel(); + + virtual TInt RunError(TInt aError); + +private: + TMemSpyDeviceWideOperationProgress iProgress; + RMemSpySession iSession; + + CEikProgressInfo* iProgressInfo; + CAknProgressDialog* iProgressDialog; +}; + + + + + + +class CMemSpyDwoTracker : public CActive +{ +public: + CMemSpyDwoTracker(RMemSpySession &aSession, TDeviceWideOperation aOperation); + + virtual ~CMemSpyDwoTracker(); + + void Start(); + + void Cancel(); + +protected: // from CActive + + virtual void RunL(); + + virtual void DoCancel(); + + virtual TInt RunError(TInt aError); + +private: + RMemSpySession iSession; + CMemSpyDwoProgressTracker *iProgressTracker; + TDeviceWideOperation iOperation; +}; + + + + + + + +class CMemSpyDeviceWideOperationDialog : public CBase, public MProgressDialogCallback, public MMemSpyDeviceWideOperationsObserver + { +public: + //static void ExecuteLD( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation ); + //static void ExecuteLD( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver, CMemSpyDeviceWideOperations::TOperation aOperation ); + static void ExecuteLD( RMemSpySession& aSession, TDeviceWideOperation aOp ); + ~CMemSpyDeviceWideOperationDialog(); + + //added + static CMemSpyDwoTracker* CreateDeviceWideOperation( RMemSpySession& aSession, TDeviceWideOperation aOp ); + +private: + //CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver ); + //CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver ); + CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession ); + //void ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation ); + void ExecuteL( TDeviceWideOperation aOp ); + +public: // API + void Cancel(); + +private: // From MProgressDialogCallback + void DialogDismissedL( TInt aButtonId ); + +private: // From MMemSpyDeviceWideOperationsObserver + void HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 ); + +private: // Internal methods + void SetDialogCaptionL( const TDesC& aText ); + +private: // Member data + //CMemSpyEngine& iEngine; + RMemSpySession iSession; + //MMemSpyDeviceWideOperationDialogObserver& iObserver; + TBool iForcedCancel; + CEikProgressInfo* iProgressInfo; + CAknProgressDialog* iProgressDialog; + CMemSpyDeviceWideOperations* iOperation; + }; + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyDocument.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYDOCUMENT_H +#define MEMSPYDOCUMENT_H + +// System includes +#include + +// Classes referenced +class CMemSpyEngine; +class CEikAppUi; +class CMemSpySettings; +//cigasto +class RMemSpySession; + + +class CMemSpyDocument : public CAknDocument + { +public: // Constructors and destructor + static CMemSpyDocument* NewL(CEikApplication& aApp); + ~CMemSpyDocument(); + +private: + CMemSpyDocument(CEikApplication& aApp); + void ConstructL(); + +public: +// CMemSpyEngine& Engine(); +// const CMemSpyEngine& Engine() const; + CMemSpySettings& Settings(); + const CMemSpySettings& Settings() const; + +private: // Framework + CEikAppUi* CreateAppUiL(); + +private: // Data members +// CMemSpyEngine* iEngine; + CMemSpySettings* iSettings; + //cigasto + RMemSpySession* iMemSpySession; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyExportBitmapsToMemoryCardDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyExportBitmapsToMemoryCardDialog.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H +#define MEMSPYEXPORTBITMAPSTOMEMORYCARDDIALOG_H + +// System includes +#include +#include +#include + +// Classes referenced +class CMemSpyEngineFbServBitmap; +class CMemSpyEngineFbServBitmapArray; + + + +class CMemSpyExportBitmapsToMemoryCardDialog : public CActive, public MProgressDialogCallback + { +public: + static CMemSpyExportBitmapsToMemoryCardDialog* NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ); + ~CMemSpyExportBitmapsToMemoryCardDialog(); + +private: + CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ); + void ConstructL(); + +public: // API + void Cancel(); + static TBool CheckMemoryCardAvailableL( RFs& aFsSession ); + +private: // From CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: // From MProgressDialogCallback + void DialogDismissedL( TInt aButtonId ); + +private: // Internal methods + void CompleteSelf( TInt aError ); + void ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap ); + void IdentifyBmpMimeTypeL(); + void PruneExistingBitmapFilesL(); + void PrepareFolderNameSpecL(); + TBool TryToExportSingleBitmapL(); + +private: // Member data + RFs& iFsSession; + const CMemSpyEngineFbServBitmapArray& iBitmaps; + TInt iBitmapIndex; + TBool iDialogDismissed; + CEikProgressInfo* iProgressInfo; + CAknProgressDialog* iProgressDialog; + CImageEncoder* iEncoder; + HBufC8* iBmpMimeType; + HBufC* iFolderName; + RFileExtensionMIMETypeArray iMimeTypeArray; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpySettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpySettings.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYSETTINGS_H +#define MEMSPYSETTINGS_H + +// System includes +#include +#include +#include + +// Engine includes +#include +#include + +// Classes referenced +class CMemSpyEngine; + +//cigasto +class RMemSpySession; + + +class CMemSpySettings : public CBase + { +public: + //static CMemSpySettings* NewL( RFs& aFsSession, CMemSpyEngine& aEngine ); + static CMemSpySettings* NewL( RFs& aFsSession, RMemSpySession& aSession ); + ~CMemSpySettings(); + +private: + //CMemSpySettings( RFs& aFsSession, CMemSpyEngine& aEngine ); + CMemSpySettings( RFs& aFsSession, RMemSpySession& aSession ); + void ConstructL(); + +public: // API + inline RFs& FsSession() { return iFsSession; } + void StoreSettingsL(); + + void SetSinkType( TMemSpySinkType aType ) { iSinkType = aType; } + +private: // Settings methods + void RestoreSettingsL(); + void GetSettingsFileNameL( TDes& aFileName ); + void GetSettingsPathL( TDes& aPath ); + RFile SettingsFileLC( TBool aReplace = EFalse ); + +private: // Data members + RFs& iFsSession; + RMemSpySession& iMemSpySession; + +private: //Settings + TMemSpySinkType iSinkType; + TMemSpyEngineHelperSysMemTrackerConfig iSwmtConfig; + RArray iUidList; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyUiUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyUiUtils.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYUIUTILS_H +#define MEMSPYUIUTILS_H + +// System includes +#include +#include + +// Engine includes +#include +#include + +typedef TBuf<20> TMemSpySizeText; + +_LIT( KTab, "\t" ); + +//ThreadInfoItemList view types +_LIT( KTypeUnknown, "Unknown Type" ); +_LIT( KGeneral, "General" ); +_LIT( KHeap, "Heap" ); +_LIT( KStack, "Stack" ); +_LIT( KChunks, "Chunks" ); +_LIT( KCodeSegs, "Code Segments" ); +_LIT( KOpenFiles, "Open Files" ); +_LIT( KActiveObjects, "Active Objects" ); +_LIT( KThreadHandlers, "Handlers to other Threads" ); +_LIT( KProcessHandlers, "Handlers to other Processes" ); +_LIT( KServers, "Servers running in Thread" ); +_LIT( KConnections, "Client <> Server Connections" ); +_LIT( KSemaphores, "Semaphores" ); +_LIT( KThreadReferences, "References in Thread" ); +_LIT( KProcessReferences, "References in Process" ); +_LIT( KMutexes, "Mutexes" ); +_LIT( KTimers, "Timers" ); +_LIT( KDD, "Logical DD Channels" ); +_LIT( KChangeNotif, "Change Notifiers" ); +_LIT( KUndertakers, "Undertakers" ); +_LIT( KLogicalDrivers, "Logical Device Drivers" ); +_LIT( KPhysicalDrivers, "Physical Device Drivers" ); + +//Kernel Object types +_LIT( KTypeThread, "Thread" ); +_LIT( KTypeProcess, "Process" ); +_LIT( KTypeChunk, "Chunk" ); +_LIT( KTypeLibrary, "Library" ); +_LIT( KTypeSemaphore, "Semaphore" ); +_LIT( KTypeMutex, "Mutex" ); +_LIT( KTypeTimer, "Timer" ); +_LIT( KTypeServer, "Server" ); +_LIT( KTypeSession, "Session" ); +_LIT( KTypeLogicalDevice, "Logical Device" ); +_LIT( KTypePhysicalDevice, "Physical Device" ); +_LIT( KTypeLogicalChannel, "Logical Channel" ); +_LIT( KTypeChangeNotifier, "Change Notifier" ); +_LIT( KTypeUndertaker, "Undertaker" ); +_LIT( KTypeMsgQueue, "Msg. Queue" ); +_LIT( KTypePropertyRef, "Property Ref." ); +_LIT( KTypeCondVar, "Conditional Var." ); + + +class MemSpyUiUtils : public MemSpyEngineUtils + { +public: + static void Format( TDes& aBuf, TInt aResourceId, ...); + static void GetErrorText( TDes& aBuf, TInt aError ); + static HBufC* FormatItem( const TDesC& aCaption ); + static TDesC& ThreadInfoItemNameByType( TMemSpyThreadInfoItemType aType ); + static void AppendPriority( TDes& aDes, TProcessPriority aPriority ); + static void AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory ); + static void AppendExitType( TDes& aDes, TExitType aType ); + + //for Kernel Objects + static TPtrC TypeAsString( TMemSpyDriverContainerType aType ); + static TMemSpySizeText FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding = EFalse ); + }; + + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewBase.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,109 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWBASE_H +#define MEMSPYVIEWBASE_H + +// System includes +#include +#include +#include + +// User includes +#include "MemSpy.hrh" +#include "MemSpyViewType.h" +#include "MemSpyViewObserver.h" +#include "MemSpySettings.h" + +// Classes referenced +class CMemSpyEngine; +class CMemSpyContainer; +class MMemSpyViewObserver; +//cigasto +class RMemSpySession; + +class CMemSpyViewBase : public CCoeControl, public MCoeControlObserver, public MEikListBoxObserver + { +public: + //CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewBase( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewBase(); + virtual void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // API + virtual TMemSpyViewType ViewType() const = 0; + virtual CMemSpyViewBase* PrepareParentViewL(); + virtual CMemSpyViewBase* PrepareChildViewL(); + virtual void RefreshL(); + virtual TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + virtual TUint MenuCascadeResourceId() const; + virtual TInt MenuCascadeCommandId() const; + +private: // Command handlers + virtual void OnCmdViewOutputToSinkL(); + +protected: // Construction support + void SetTitleL( const TDesC& aText ); + TPtrC TitleL() const; + virtual CEikListBox* ConstructListBoxL(); + virtual void SetListBoxModelL() = 0; + +protected: // Internal framework + virtual void HandleListBoxItemActionedL( TInt aIndex ); + virtual void HandleListBoxItemSelectedL( TInt aIndex ); + +protected: // Event reporting + void ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext = NULL ); + void SetListBoxCurrentItemIndexL( TInt aIndex ); + +protected: // Utility methods + CMemSpyContainer& Container(); + CMemSpySettings& Settings(); + const CMemSpySettings& Settings() const; + +public: // From CCoeControl + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + +protected: // From CCoeControl + void Draw( const TRect& aRect ) const; + void SizeChanged(); + void FocusChanged( TDrawNow aDrawNow ); + TInt CountComponentControls() const; + CCoeControl* ComponentControl( TInt aIndex ) const; + +protected: // From MCoeControlObserver + void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ); + +protected: // From MEikListBoxObserver + void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType); + +protected: // Member data + //CMemSpyEngine& iEngine; + RMemSpySession& iMemSpySession; + MMemSpyViewObserver& iObserver; + // + CEikListBox* iListBox; + +private: + CMemSpySettings* iSettings; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewChunkList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewChunkList.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWCHUNKLIST_H +#define MEMSPYVIEWCHUNKLIST_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class CMemSpyEngineChunkList; +class CMemSpyEngineChunkEntry; + + + + +class CMemSpyViewChunkBase : public CMemSpyViewBase + { +public: + CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList ); + ~CMemSpyViewChunkBase(); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CHUNK_LIST; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdChunk; } + +protected: // Command handlers + void OnCmdListingL(); + +protected: // Data members + CMemSpyEngineChunkList* iList; + }; + + + + +class CMemSpyViewChunkList : public CMemSpyViewChunkBase + { +public: + CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // Data members + CMemSpyEngineChunkEntry* iCurrentChunk; + }; + + + +class CMemSpyViewChunkDetails : public CMemSpyViewChunkBase + { +public: + CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Data members + CMemSpyEngineChunkEntry& iChunk; + }; + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewCodeSegList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewCodeSegList.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWCODESEGLIST_H +#define MEMSPYVIEWCODESEGLIST_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class CMemSpyEngineCodeSegList; +class CMemSpyEngineCodeSegEntry; + + +class CMemSpyViewCodeSegBase : public CMemSpyViewBase + { +public: + CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList ); + ~CMemSpyViewCodeSegBase(); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + void RefreshL(); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_CODESEG_LIST; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdCodeSeg; } + +protected: // Command handlers + void OnCmdCodeSegmentListingL(); + void OnCmdShowItemsAllL(); + void OnCmdShowItemsGlobalDataL(); + void OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries ); + +protected: // Data members + CMemSpyEngineCodeSegList* iList; + }; + + + + +class CMemSpyViewCodeSegList : public CMemSpyViewCodeSegBase + { +public: + CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // Data members + CMemSpyEngineCodeSegEntry* iCurrentCodeSegment; + }; + + + +class CMemSpyViewCodeSegDetails : public CMemSpyViewCodeSegBase + { +public: + CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Data members + CMemSpyEngineCodeSegEntry& iCodeSegment; + }; + + + + + + +class TMemSpyViewCodeSegFilter + { +public: + inline TMemSpyViewCodeSegFilter( TCapability aCapability, TBool aAllBinaries = ETrue ) + : iCapability( aCapability ), iAllBinaries( aAllBinaries ) + { + } + +public: + static TBool FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune ); + +private: + TCapability iCapability; + TBool iAllBinaries; + }; + + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewDriveInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewDriveInfo.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWDRIVEINFO_H +#define MEMSPYVIEWDRIVEINFO_H + +// System includes +#include +#include + +// Engine includes +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced + + + + +class CMemSpyViewDriveInfoBase : public CMemSpyViewBase + { +public: + CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewDriveInfoBase(); + void BaseConstructL(); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + +protected: // Data members + CMemSpyEngineDriveList* iList; + }; + + + + +class CMemSpyViewDriveList : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveListObserver + { +public: + CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void RefreshL(); + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // From MMemSpyEngineDriveListObserver + void HandleDriveListChangedL( const CMemSpyEngineDriveList& aList ); + +private: // Data members + TBool iUseDriveNumber; + TDriveNumber iDriveNumber; + CMemSpyEngineDriveEntry* iCurrentDrive; + }; + + + +class CMemSpyViewDriveInfo : public CMemSpyViewDriveInfoBase, public MMemSpyEngineDriveEntryObserver + { +public: + CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // From MMemSpyEngineDriveEntryObserver + void HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& aEntry ); + +private: // Data members + const TDriveNumber iDriveNumber; + CMemSpyEngineDriveEntry* iDriveInfo; + }; + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewECom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewECom.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWECOM_H +#define MEMSPYVIEWECOM_H + +// System includes +#include +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Engine includes +#include + + +class CMemSpyViewECom : public CMemSpyViewBase + { +public: + CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // Data members + CMemSpyEngineEComCategory* iCurrent; + }; + + + +class CMemSpyViewEComCategory : public CMemSpyViewBase + { +public: + CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // Data members + CMemSpyEngineEComCategory& iCategory; + CMemSpyEngineEComInterface* iCurrent; + }; + + + + +class CMemSpyViewEComInterface : public CMemSpyViewBase + { +public: + CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // Data members + CMemSpyEngineEComInterface& iInterface; + CMemSpyEngineEComImplementation* iCurrent; + }; + + + + + + +class CMemSpyViewEComImplementation : public CMemSpyViewBase + { +public: + CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Data members + CMemSpyEngineEComImplementation& iImplementation; + }; + + + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewFBServBitmaps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewFBServBitmaps.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWFBSERVBITMAPS_H +#define MEMSPYVIEWFBSERVBITMAPS_H + +// System includes +#include +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Engine includes +#include + + + +class CMemSpyViewFBServBase : public CMemSpyViewBase + { +public: + CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ); + ~CMemSpyViewFBServBase(); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_IMAGES; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdImages; } + +protected: // Command handlers + void OnCmdSlideShowL(); + void OnCmdExportToMemoryCardL(); + void OnCmdImageListingL(); + +protected: // Data members + CMemSpyEngineFbServBitmapArray* iBitmaps; + }; + + + + + +class CMemSpyViewFBServBitmaps : public CMemSpyViewFBServBase, public MMemSpyEngineFbSerbBitmapArrayObserver + { +public: + CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ); + ~CMemSpyViewFBServBitmaps(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From MMemSpyEngineFbSerbBitmapArrayObserver + void HandleFbServBitmapArrayEventL( TEvent aEvent ); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // Idle timer update + static TInt IdleUpdateListBoxModel( TAny* aSelf ); + void DoIdleUpdateListBoxModelL(); + +private: // Data members + RArray iBitmapHandles; + CMemSpyEngineFbServBitmap* iCurrentBitmap; + CPeriodic* iIdleResetListboxTimer; + }; + + + +class CMemSpyViewFBServBitmapInfo : public CMemSpyViewFBServBase + { +public: + CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + +private: // Data members + CMemSpyEngineFbServBitmap& iBitmapObject; + }; + + + + +class CMemSpyViewFBServBitmapViewer : public CMemSpyViewFBServBase + { +public: + CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ); + ~CMemSpyViewFBServBitmapViewer(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + CEikListBox* ConstructListBoxL(); + +private: // From CCoeControl + void Draw(const TRect& aRect) const; + void SizeChanged(); + TInt CountComponentControls() const; + CCoeControl* ComponentControl( TInt aIndex ) const; + +private: // Data members + CMemSpyEngineFbServBitmap& iBitmapObject; + CEikImage* iImage; + TRect iBorderRect; + }; + + + + + +class CMemSpyViewFBServSlideshow : public CAknDialog + { +public: + static void NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ); + ~CMemSpyViewFBServSlideshow(); + +private: + CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ); + void ConstructL(); + +private: + void PreLayoutDynInitL(); + TBool OkToExitL(TInt aButtonId); + +private: // Idle timer update + static TInt IdleUpdate( TAny* aSelf ); + void ShowNextImageL(); + +private: // Data members + CMemSpyEngineFbServBitmapArray& iBitmaps; + TInt& iIndex; + CPeriodic* iTimer; + }; + + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewHeapTracking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewHeapTracking.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWHEAPTRACKING_H +#define MEMSPYVIEWHEAPTRACKING_H + +// System includes +#include +#include +#include + +// Engine includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class RMemSpySession; + + +class CMemSpyViewHeapTracking : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver + { +public: + CMemSpyViewHeapTracking( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewHeapTracking(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +public: + static TInt AsyncStopTimerCallback( TAny* aParam ); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // From MMemSpyEngineHelperSysMemTrackerObserver + void HandleCyclesResetL(); + void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + +private: // Internal methods + TInt IndexByViewType( TMemSpyViewType aType ); + void SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig ); + TInt AsyncStopTimerCallback(); + void GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ); + void SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ); + +private: // Enum + enum TMemSpyViewHeapTrackingState + { + EMemSpyViewHeapTrackingStateIdle = 0, + EMemSpyViewHeapTrackingStateTimerOn, + EMemSpyViewHeapTrackingStateSingleOn + }; + +private: // Data + TMemSpyEngineHelperSysMemTrackerConfig iOriginalConfig; + TMemSpyViewHeapTrackingState iState; + CAsyncCallBack* iStopTimerCallBack; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewHeapTrackingResults.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingResults.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWHEAPTRACKINGRESULTS_H +#define MEMSPYVIEWHEAPTRACKINGRESULTS_H + +// System includes +#include +#include +#include + +// Engine includes +#include +#include + +// Driver includes +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class CMemSpyEngineHelperSysMemTrackerCycle; +class CMemSpyEngineHelperSysMemTrackerCycleChange; +class RMemSpySession; + +class CMemSpyViewHeapTrackingResults : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver + { +public: + //CMemSpyViewHeapTrackingResults( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewHeapTrackingResults( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewHeapTrackingResults(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // From MMemSpyEngineHelperSysMemTrackerObserver + void HandleCyclesResetL(); + void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); +private: + RArray iCycles; + }; + + + + + + + +class CMemSpyViewHeapTrackingResultsCycleInfo : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver + { +public: + // CMemSpyViewHeapTrackingResultsCycleInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + CMemSpyViewHeapTrackingResultsCycleInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, const CMemSpyApiMemoryTrackingCycle& aCycle ); + ~CMemSpyViewHeapTrackingResultsCycleInfo(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // From MMemSpyEngineHelperSysMemTrackerObserver + void HandleCyclesResetL(); + void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + +private: // Data members + //const CMemSpyEngineHelperSysMemTrackerCycle& iCycle; + const CMemSpyApiMemoryTrackingCycle& iCycle; + }; + + + + + +/* +class CMemSpyViewHeapTrackingResultsChangeDescriptor : public CMemSpyViewBase, public MMemSpyEngineHelperSysMemTrackerObserver + { +public: + CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex ); + ~CMemSpyViewHeapTrackingResultsChangeDescriptor(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // From MMemSpyEngineHelperSysMemTrackerObserver + void HandleCyclesResetL(); + void HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + void HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ); + +private: // Data members + const CMemSpyEngineHelperSysMemTrackerCycle& iCycle; + const CMemSpyEngineHelperSysMemTrackerCycleChange& iChangeDescriptor; + TInt iIndex; // For selection rune when moving to parent view + }; +*/ + + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewHeapTrackingSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingSettings.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWHEAPTRACKINGSETTINGS_H +#define MEMSPYVIEWHEAPTRACKINGSETTINGS_H + +// System includes +#include +#include +#include +#include +#include +#include + + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class RMemSpySession; + + +class CMemSpyViewHeapTrackingSettings : public CMemSpyViewBase + { +public: + //CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewHeapTrackingSettings( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewHeapTrackingSettings(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + void GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ); + void SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Internal methods + static void PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected ); + }; + + + + +class CSWMTCategorySelectionCheckBoxSettingItem : public CAknSettingItem + { +public: + CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories ); + virtual ~CSWMTCategorySelectionCheckBoxSettingItem(); + +public: + CSelectionItemList* ItemArray() const; + +protected: + void CompleteConstructionL(); + void StoreL(); + void LoadL(); + void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ); + +private: + void AddNewItemToArrayL(const TDesC& aLabel); + +private: + CSelectionItemList* iItemArray; + HBufC* iSettingText; + TInt& iExtCategories; + }; + + + + + + +class CMemSpySWMTCategorySelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage + { + public: + CMemSpySWMTCategorySelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray ); + public: // New functions + void UpdateCba(); + }; + + + + + + +class CMemSpyAllowEmptyDataDialog : public CAknTextQueryDialog + { + public: + CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone = ENoTone ); + protected: // from CAknTextQueryDialog + void UpdateLeftSoftKeyL(); + }; + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewKernel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewKernel.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWKERNEL_H +#define MEMSPYVIEWKERNEL_H + +// System includes +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class RMemSpySession; + +class CMemSpyViewKernel : public CMemSpyViewBase + { +public: + CMemSpyViewKernel( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewKernel(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Internal methods + static TInt IndexByViewType( TMemSpyViewType aType ); + +private: // Data members + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewKernelContainers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewKernelContainers.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWKERNELCONTAINERS_H +#define MEMSPYVIEWKERNELCONTAINERS_H + +// System includes +#include +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +#include +#include + +// Classes referenced +class CMemSpyEngineGenericKernelObjectContainer; + +class RMemSpySession; + +class CMemSpyViewKernelContainers : public CMemSpyViewBase + { +public: + CMemSpyViewKernelContainers( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewKernelContainers(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + TPtrC TypeAsString( TMemSpyDriverContainerType aType ); + + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_CONTAINERS; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelContainers; } + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + TBool HandleCommandL( TInt aCommand ); + +private: // Command handlers + void OnCmdOutputAllContainerContentsL(); + +private: // Internal methods + +private: // Data members + //CMemSpyEngineGenericKernelObjectContainer* iModel; + RArray iKernelObjects; //array of raw items data + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewKernelHeap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewKernelHeap.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWKERNELHEAP_H +#define MEMSPYVIEWKERNELHEAP_H + +// System includes +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" +#include + +// Classes referenced +class CMemSpyEngineGenericKernelObjectContainer; + +class RMemSpySession; + +class CMemSpyViewKernelHeap : public CMemSpyViewBase + { +public: + CMemSpyViewKernelHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewKernelHeap(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_HEAP; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelHeap; } + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + TBool HandleCommandL( TInt aCommand ); + +private: // Command handlers + void OnCmdDumpKernelHeapL(); + +private: // Internal methods + //CDesCArrayFlat* FormatModel( RArray &aHeap ); + CDesCArrayFlat* FormatModel( CMemSpyApiHeap* aHeap ); + HBufC* FormatItem( const TDesC& aCaption, const TDesC& aValue ); + HBufC* FormatItem( const TDesC& aCaption, TInt aValue ); + HBufC* FormatItem( const TDesC& aCaption, TUint aValue ); + HBufC* FormatItem( const TDesC& aCaption, const TInt64& aValue ); + HBufC* FormatItem( const TDesC& aCaption, TAny* aValue ); + HBufC* FormatItem( const TDesC& aCaption, TUint* aValue ); + HBufC* FormatItem( const TDesC& aCaption, TUint8* aValue ); + HBufC* FormatPercentageItem( const TDesC& aCaption, TReal aOneHundredPercentValue, TReal aValue ); + +private: // Data members + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWKERNELOBJECTS_H +#define MEMSPYVIEWKERNELOBJECTS_H + +// System includes +#include +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" +#include +#include + +// Classes referenced +class CMemSpyEngineGenericKernelObjectContainer; +class CMemSpyEngineGenericKernelObjectList; +class CAknNavigationDecorator; +class CAknNavigationControlContainer; +class CAknTabGroup; + +class RMemSpySession; + +class CMemSpyViewKernelObjects : public CMemSpyViewBase, public MAknTabObserver + { +public: + //CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType ); + CMemSpyViewKernelObjects( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType ); + ~CMemSpyViewKernelObjects(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + CEikListBox* ConstructListBoxL(); + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_KERNEL_OBJECTS; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdKernelObjects; } + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + TBool HandleCommandL( TInt aCommand ); + +private: // From CCoeControl + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + +private: // From MAknTabObserver + void TabChangedL( TInt aIndex ); + +private: // Command handlers + void OnCmdTerminateL(); + void OnCmdSwitchToL(); + void OnCmdEndL(); + void OnCmdPanicL(); + +private: // Internal methods + void CreateTabsL(); + void DetailsL(); + void AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ); + +private: // Data members + //CMemSpyEngineGenericKernelObjectContainer* iModel; + CDesCArrayFlat* iItems; + TMemSpyDriverContainerType iObjectType; + CMemSpyEngineGenericKernelObjectList* iObjectList; + CAknNavigationDecorator* iNavDecorator; + CAknNavigationControlContainer* iNaviPane; + CAknNavigationControlContainer* iNavContainer; + CAknTabGroup* iTabs; + TInt iCurrItemIndex; + CDesCArrayFlat* iModel; + RArray iKernelObjectItems; + }; + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewMainMenu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewMainMenu.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWMAINMENU_H +#define MEMSPYVIEWMAINMENU_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class CMemSpyProcess; + +//cigasto +class RMemSpySession; + +class CMemSpyViewMainMenu : public CMemSpyViewBase + { +public: + //CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewMainMenu( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Internal methods + static TInt IndexByViewType( TMemSpyViewType aType ); + +private: // Data members + }; + + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewMemoryTrackingAutoStartConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewMemoryTrackingAutoStartConfig.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H +#define MEMSPYVIEWMEMORYTRACKINGAUTOSTARTCONFIG_H + +// System includes +#include +#include +#include +#include // MContentHandler mix in class +#include + +// User includes +#include "MemSpyViewBase.h" + +// Literal constants +_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigSearchPath, "E:\\MemSpy\\" ); +_LIT( KMemSpyProcessMemoryTrackingAutoStartConfigFileName, "MemSpyProcessMemoryTrackingAutoStartConfig.xml" ); + +// Classes referenced +class CCnvCharacterSetConverter; + +// Namespaces referenced +using namespace Xml; + + +class CMemSpyViewMemoryTrackingAutoStartConfig : public CMemSpyViewBase, public MContentHandler + { +public: + CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewMemoryTrackingAutoStartConfig(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + TBool HandleCommandL( TInt aCommand ); + void HandleListBoxItemActionedL( TInt aIndex ); + void SetListBoxModelL(); + void RefreshL(); + +public: // Menu framework + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + TUint MenuCascadeResourceId() const; + TInt MenuCascadeCommandId() const; + +private: // Command handlers + void OnCmdItemAddL(); + void OnCmdItemEditL(); + void OnCmdItemDeleteL(); + void OnCmdItemDeleteAllL(); + void OnCmdItemImportL(); + +private: // Internal methods + TUid ShowDialogL( TUid aUid ); + void SaveChangesL(); + static TUid ValidateProcessUid( const TDesC& aUid ); + +private: // Internal XML methods + void FindXmlInstallTimeL(); + void FindXmlUserSuppliedL(); + HBufC* FindEComXmlFileNameLC(); + void ConvertL( const TDesC8& aInput, TDes16& aOutput ); + void ParseL( const TDesC& aFileName ); + +private: // XML helper functions + void OnSectionProcessL( const RAttributeArray& aAttributes ); + +private: // From MContentHandler + void OnStartDocumentL( const RDocumentParameters& aDocParam, TInt aErrorCode ); + void OnEndDocumentL( TInt aErrorCode ); + void OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode ); + void OnEndElementL( const RTagInfo& aElement, TInt aErrorCode ); + void OnContentL( const TDesC8& aBytes, TInt aErrorCode ); + void OnStartPrefixMappingL( const RString& aPrefix, const RString& aUri, TInt aErrorCode ); + void OnEndPrefixMappingL( const RString& aPrefix, TInt aErrorCode ); + void OnIgnorableWhiteSpaceL( const TDesC8& aBytes, TInt aErrorCode ); + void OnSkippedEntityL( const RString& aName, TInt aErrorCode ); + void OnProcessingInstructionL( const TDesC8& aTarget, const TDesC8& aData, TInt aErrorCode ); + void OnError( TInt aErrorCode ); + TAny* GetExtendedInterface( const TInt32 aUid ); + +private: // Data members + RArray< TUid > iProcessUids; + TInt iParserErrorCode; + TInt iCharconvConverterState; + TBool iSeenMasterSection; + CParser* iParser; + CCnvCharacterSetConverter* iConverter; + HBufC* iXMLFileNameInstallTime; + HBufC* iXMLFileNameUserSupplied; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewObserver.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWOBSERVER_H +#define MEMSPYVIEWOBSERVER_H + +// User includes +#include "MemSpyViewType.h" + +// Classes referenced +class CMemSpyViewBase; + +class MMemSpyViewObserver + { +public: // Enumerations + enum TViewEventType + { + EEventItemActioned = 0, + EEventItemSelected + }; + +public: // From MMemSpyViewObserver + virtual void HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType aViewType, CMemSpyViewBase& aReportingView, TAny* aContext ) = 0; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewOpenFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewOpenFiles.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWOPENFILES_H +#define MEMSPYVIEWOPENFILES_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced + + +class CMemSpyViewOpenFiles : public CMemSpyViewBase + { +public: + CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewOpenFiles(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + CEikListBox* ConstructListBoxL(); + void RefreshL(); + TBool HandleCommandL( TInt aCommand ); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // Command handlers + void OnCmdListOpenFilesL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aCurrentIndex ); + +private: // Internal + static TBool CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight ); + +private: // Data members + RArray iThreadIds; + const TThreadId* iActionedThreadId; + RArray iFileNames; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewProcesses.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewProcesses.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWPROCESSES_H +#define MEMSPYVIEWPROCESSES_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +#include + +// Classes referenced +class CMemSpyProcess; +class CAknSearchField; +class RMemSpySession; + +class CMemSpyViewProcesses : public CMemSpyViewBase + { +public: + //CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + //CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ); + CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); +// CMemSpyViewProcesses( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ); + CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId ); + ~CMemSpyViewProcesses(); + //void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TProcessId aSelectionRune = NULL ); + +public: // API + CMemSpyProcess& CurrentProcess() const; + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_PROCESS; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdProcess; } + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +private: // Command handlers + + // Sorting + void OnCmdSortByIdL(); + void OnCmdSortByNameL(); + void OnCmdSortByThreadCountL(); + void OnCmdSortByCodeSegsL(); + void OnCmdSortByHeapUsageL(); + void OnCmdSortByStackUsageL(); + + // Info + void OnCmdInfoSummaryL(); + void OnCmdInfoHandlesL(); + + // Ending + void OnCmdEndTerminateL(); + void OnCmdEndPanicL(); + void OnCmdEndKillL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aIndex ); + void HandleListBoxItemSelectedL( TInt aIndex ); + +private: // From CCoeControl + void SizeChanged(); + TInt CountComponentControls() const; + CCoeControl* ComponentControl( TInt aIndex ) const; + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + void FocusChanged( TDrawNow /*aDrawNow*/ ); + +private: // From MCoeControlObserver + void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); + +private: // Internal methods + void SelectListBoxItemByFindTextL(); + + CDesCArrayFlat* FormatModel( RArray aProcesses ); + void AppendPriority( TDes& aDes, TProcessPriority aPriority ); + void AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory ); + void AppendExitType( TDes& aDes, TExitType aType ); + +private: // Data members + CMemSpyProcess* iCurrentProcess; + TProcessId iCurrentProcessId; + CAknSearchField* iSearchField; + HBufC* iMatcherBuffer; + RArray iProcesses; //cigasto + CDesCArrayFlat* iModel; + CDesCArrayFlat* model; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewRAMInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewRAMInfo.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWRAMINFO_H +#define MEMSPYVIEWRAMINFO_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced + + +class CMemSpyViewRAMInfo : public CMemSpyViewBase + { +public: + CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_RAM; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdRAM; } + +private: // Command handlers + void OnCmdSetIconCacheStatusL( TBool aEnabled ); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Data members + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewROMInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewROMInfo.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWROMINFO_H +#define MEMSPYVIEWROMINFO_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced + + +class CMemSpyViewROMInfo : public CMemSpyViewBase + { +public: + CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Data members + }; + + +#endif + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewServerList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewServerList.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWSERVERLIST_H +#define MEMSPYVIEWSERVERLIST_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +#include +#include + +// Classes referenced +class CMemSpyEngineServerList; +class CMemSpyEngineServerEntry; +class RMemSpySession; + +class CMemSpyViewServerList : public CMemSpyViewBase + { +public: + //CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + CMemSpyViewServerList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewServerList(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_SERVER_LIST; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdServerList; } + +private: // Command handlers + void OnCmdServerListSortByNameL(); + void OnCmdServerListSortBySessionCountL(); + void OnCmdServerListOutputSummaryL(); + void OnCmdServerListOutputDetailedL(); + void OnCmdServerListOutputGenericL( TBool aDetailed ); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aCurrentIndex ); + +private: // Data members + CMemSpyEngineServerList* iList; + const CMemSpyEngineServerEntry* iActionedItem; + TInt iActionedItemIndex; + RArray iServers; + CDesCArrayFlat* iModel; + TSortType iSort; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewSystemConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewSystemConfig.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,97 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWSYSTEMCONFIG_H +#define MEMSPYVIEWSYSTEMCONFIG_H + +// System includes +#include +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced + + +class CMemSpyViewSystemConfig : public CMemSpyViewBase + { +public: + CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewSystemConfig(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Internal enumerations + + enum TMemSpyDisplayMode + { + ENone, + EGray2, + EGray4, + EGray16, + EGray256, + EColor16, + EColor256, + EColor64K, + EColor16M, + ERgb, + EColor4K, + EColor16MU, + EColor16MA, + EColor16MAP, + EColorLast + }; + +private: // Internal methods + static void GetManufacturer( TDes& aBuf ); + static void GetDeviceFamily( TDes& aBuf ); + static void GetCPU( TDes& aBuf ); + static void GetCPUABI( TDes& aBuf ); + static void GetStartupReason( TDes& aBuf ); + static void GetKeyboard( TDes& aBuf ); + static void GetMachineUid( TDes& aBuf ); + static void GetDisplayType( TDes& aBuf ); + static void GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode ); + // + static TInt GetHALValue( HALData::TAttribute aAttribute, TInt& aValue ); + TInt GetHALValueAsStringL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); + TInt GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL, TInt aWidth = -1 ); + TInt GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); + TInt GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); + TInt GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix = NULL ); + +private: + void AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix = NULL ); + void AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix = NULL ); + +private: // Data members + CDesCArrayFlat* iModel; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H +#define MEMSPYVIEWTHREADINFOITEMACTIVEOBJECT_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +// Classes referenced +class CMemSpyEngineActiveObjectArray; +class RMemSpySession; + + +class CMemSpyViewThreadInfoItemActiveObjectBase : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemActiveObjectBase( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_ACTIVE_OBJECTS; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdActiveObject; } + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +protected: + CMemSpyEngineActiveObjectArray& ActiveObjectArray() const; + +private: // Command handlers + void OnCmdWriteAOListingL(); + }; + + + +class CMemSpyViewThreadInfoItemActiveObject : public CMemSpyViewThreadInfoItemActiveObjectBase + { +public: + CMemSpyViewThreadInfoItemActiveObject( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareChildViewL(); + }; + + + + +class CMemSpyViewThreadInfoItemActiveObjectDetails : public CMemSpyViewThreadInfoItemActiveObjectBase + { +public: + CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress ); + +public: // From CMemSpyViewBase + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Data members + TAny* iObjectAddress; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMCHUNK_H +#define MEMSPYVIEWTHREADINFOITEMCHUNK_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +class RMemSpySession; + +class CMemSpyViewThreadInfoItemChunk : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemChunk( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + +private: // From CMemSpyViewBase + CMemSpyViewBase* PrepareChildViewL(); + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMCODESEG_H +#define MEMSPYVIEWTHREADINFOITEMCODESEG_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +class RMemSpySession; + +class CMemSpyViewThreadInfoItemCodeSeg : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemCodeSeg( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + +private: // From CMemSpyViewBase + CMemSpyViewBase* PrepareChildViewL(); + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMGENERALINFO_H +#define MEMSPYVIEWTHREADINFOITEMGENERALINFO_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +class CMemSpyThreadInfoContainer; +class CMemSpyThreadInfoItemBase; +class RMemSpySession; + +class CMemSpyViewThreadInfoItemGeneralInfo : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemGeneralInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + void HandleListBoxItemActionedL( TInt aCurrentIndex ); + +private: // Command handlers + void OnCmdToggleKernelEventHooksL(); + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMGENERIC_H +#define MEMSPYVIEWTHREADINFOITEMGENERIC_H + +// System includes +#include +#include + +// Engine includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced +class CAknWaitDialog; +class CMemSpyProcess; +class CMemSpyThread; +class CMemSpyThreadInfoContainer; +class CMemSpyThreadInfoItemBase; +class RMemSpySession; + +class CMemSpyViewThreadInfoItemGeneric : public CMemSpyViewBase + { +public: + //CMemSpyViewThreadInfoItemGeneric( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aInfoContainer, TMemSpyThreadInfoItemType aType ); + CMemSpyViewThreadInfoItemGeneric( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcessId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + ~CMemSpyViewThreadInfoItemGeneric(); + +public: // From CMemSpyViewBase + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // API + CMemSpyProcess& Process() const; + CMemSpyThread& Thread() const; + CMemSpyThreadInfoContainer& Container() const; + CMemSpyThreadInfoItemBase& InfoItem() const; + TThreadId ThreadId() { return iThreadId; } + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + TBool HandleCommandL( TInt aCommand ); + +protected: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aCurrentIndex ); + void HandleListBoxItemSelectedL( TInt aCurrentIndex ); + +private: // Internal methods + void ShowWaitNoteL(); + void DestroyWaitNote(); + static TInt CheckForItemConstructionComplete( TAny* aSelf ); + +protected: // Member data + //CMemSpyThreadInfoContainer& iContainer; + //CMemSpyThreadInfoItemBase* iInfoItem; + +private: // Member data + CAknWaitDialog* iWaitNote; + CPeriodic* iWaitConstructionChecker; + + RArray iThreadInfoItems; //cigasto + CDesCArrayFlat* iModel; + TThreadId iThreadId; + TProcessId iParentProcessId; + TMemSpyThreadInfoItemType iType; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMHEAP_H +#define MEMSPYVIEWTHREADINFOITEMHEAP_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +class RMemSpySession; + +class CMemSpyViewThreadInfoItemHeap : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_HEAP; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdHeap; } + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +private: // Command handlers + void OnCmdHeapDataL(); + void OnCmdHeapCellListingL(); + void OnCmdHeapInfoL(); + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMLIST_H +#define MEMSPYVIEWTHREADINFOITEMLIST_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewBase.h" +#include + +// Classes referenced +class CMemSpyProcess; +class CMemSpyThread; +class CMemSpyThreadInfoItemBase; +class RMemSpySession; + +class CMemSpyViewThreadInfoItemList : public CMemSpyViewBase, public MMemSpyThreadInfoContainerObserver + { +public: + //CMemSpyViewThreadInfoItemList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThread& aThread ); + CMemSpyViewThreadInfoItemList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcess, TThreadId aThread ); + ~CMemSpyViewThreadInfoItemList(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TMemSpyThreadInfoItemType iType); + +public: // API + const CMemSpyThreadInfoItemBase& CurrentInfoItem() const; + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; } + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +private: // Command handlers + void OnCmdInfoHandlesL(); + +private: // From MMemSpyThreadInfoContainerObserver + void HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType ); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aCurrentIndex ); + void HandleListBoxItemSelectedL( TInt aCurrentIndex ); + static TInt IdleUpdateListBoxModel( TAny* aSelf ); + void DoIdleUpdateListBoxModelL(); + +private: // Member data + //CMemSpyThread& iThread; + TThreadId iThreadId; + TProcessId iParentProcessId; + CMemSpyThreadInfoItemBase* iCurrentInfoItem; + TInt iCurrentInfoItemId; + CPeriodic* iIdleResetListboxTimer; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemMemoryTracking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemMemoryTracking.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H +#define MEMSPYVIEWTHREADINFOITEMMEMORYTRACKING_H + +// System includes +#include +#include + +// Engine includes +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +// Classes referenced +class CMemSpyEngineProcessMemoryTracker; + + +class CMemSpyViewThreadInfoItemMemoryTracking : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver + { +public: + CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + TBool HandleCommandL( TInt aCommand ); + TInt IndexByViewType( TMemSpyViewType aType ); + void HandleListBoxItemActionedL( TInt aIndex ); + void RefreshL(); + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTracking; } + +private: // From MMemSpyEngineProcessMemoryTrackerObserver + void HandleMemoryTrackingStartedL(); + void HandleMemoryTrackingStoppedL(); + void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); + +private: // Command handlers + void OnCmdTrackingStartL(); + void OnCmdTrackingStopL(); + void OnCmdHWMResetL(); + void OnCmdTotalWithSharedMemL(); + void OnCmdTotalWithoutSharedMemL(); + }; + + +class CMemSpyViewThreadInfoItemMemoryTrackingCurrent : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver + { +public: + CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + void RefreshL(); + void SetListBoxModelL(); + +private: // From MMemSpyEngineProcessMemoryTrackerObserver + void HandleMemoryTrackingStartedL() { } + void HandleMemoryTrackingStoppedL() { } + void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); + }; + + + +class CMemSpyViewThreadInfoItemMemoryTrackingHWM : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver + { +public: + CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + TBool HandleCommandL( TInt aCommand ); + void RefreshL(); + void SetListBoxModelL(); + +private: // From MMemSpyEngineProcessMemoryTrackerObserver + void HandleMemoryTrackingStartedL() { } + void HandleMemoryTrackingStoppedL() { } + void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_MEMORY_TRACKING_HWM; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdMemoryTrackingHWM; } + +private: // Command handlers + void OnCmdHWMResetL(); + }; + + + + +class CMemSpyViewThreadInfoItemMemoryTrackingPeak : public CMemSpyViewThreadInfoItemGeneric, public MMemSpyEngineProcessMemoryTrackerObserver + { +public: + CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + TBool HandleCommandL( TInt aCommand ); + void RefreshL(); + void SetListBoxModelL(); + +private: // From MMemSpyEngineProcessMemoryTrackerObserver + void HandleMemoryTrackingStartedL() { } + void HandleMemoryTrackingStoppedL() { } + void HandleMemoryChangedL( const TProcessId& aPid, const TMemSpyDriverProcessInspectionInfo& aCurrentInfo, const TMemSpyDriverProcessInspectionInfo& aHWMInfoIncShared, const TMemSpyDriverProcessInspectionInfo& aHWMInfoExcShared ); + }; + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMSERVER_H +#define MEMSPYVIEWTHREADINFOITEMSERVER_H + +// System includes +#include +#include +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +// Classes referenced +class TMemSpyDriverHandleInfoGeneric; +class RMemSpySession; + +class CMemSpyViewThreadInfoItemServer : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemServer( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + +public: // From CMemSpyViewBase + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + void HandleListBoxItemSelectedL( TInt aCurrentIndex ); + +public: // From CMemSpyViewBase + CMemSpyViewBase* PrepareChildViewL(); + +private: // Data members + TMemSpyDriverHandleInfoGeneric iCurrentInfoItemDetails; + }; + + + +class CMemSpyViewThreadInfoItemServerDetails : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ); + +public: // From CMemSpyViewBase + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareChildViewL(); + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aCurrentIndex ); + void HandleListBoxItemSelectedL( TInt aCurrentIndex ); + +private: // Internal methods + +private: // Member data + const TMemSpyDriverHandleInfoGeneric iInfoItemDetails; + }; + + + +class CMemSpyViewThreadInfoItemServerSessions : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ); + +public: // From CMemSpyViewBase + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + +private: // Member data + const TMemSpyDriverHandleInfoGeneric iInfoItemDetails; + }; + + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADINFOITEMSTACK_H +#define MEMSPYVIEWTHREADINFOITEMSTACK_H + +// System includes +#include +#include + +// User includes +#include "MemSpyViewThreadInfoItemGeneric.h" + +class RMemSpySession; + +class CMemSpyViewThreadInfoItemStack : public CMemSpyViewThreadInfoItemGeneric + { +public: + CMemSpyViewThreadInfoItemStack( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ); + +public: // From CMemSpyViewBase + TBool HandleCommandL( TInt aCommand ); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_STACK; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdStack; } + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +private: // Command handlers + void OnCmdDeviceStackSummaryL(); + void OnCmdStackInfoL(); + void OnCmdStackDataUserL(); + void OnCmdStackDataKernelL(); + void OnCmdStackDataUserAllThreadsL(); + void OnCmdStackDataKernelAllThreadsL(); + void OnCmdStackWatchForHighWatermarkL(); + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewThreads.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewThreads.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTHREADS_H +#define MEMSPYVIEWTHREADS_H + +// System includes +#include +#include +#include + +// User includes +#include "MemSpyViewBase.h" + +#include + +// Classes referenced +class CMemSpyProcess; +class CMemSpyThread; +class RMemSpySession; + +class CMemSpyViewThreads : public CMemSpyViewBase + { +public: + //CMemSpyViewThreads( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyProcess& aProcess ); + CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId ); + ~CMemSpyViewThreads(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // API + //const CMemSpyProcess& Process() const; + //CMemSpyThread& CurrentThread(); + TProcessId Process() const; + TThreadId CurrentThread(); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_THREAD; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdThread; } + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + +public: // From CMemSpyViewBase + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + TBool HandleCommandL( TInt aCommand ); + +private: // Command handlers + void OnCmdEndKillL(); + void OnCmdEndTerminateL(); + void OnCmdEndPanicL(); + void OnCmdSetPriorityL( TInt aCommand ); + void OnCmdInfoHandlesL(); + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + void HandleListBoxItemActionedL( TInt aCurrentIndex ); + void HandleListBoxItemSelectedL( TInt aCurrentIndex ); + void AppendPriority( TDes& aDes, TThreadPriority aPriority ); + +private: // Member data + //CMemSpyProcess& iParentProcess; + //CMemSpyThread* iCurrentThread; + TThreadId iCurrentThreadId; + TProcessId iParentProcessId; + + RArray iThreads; + CDesCArrayFlat* iModel; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewType.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewType.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWTYPE_H +#define MEMSPYVIEWTYPE_H + +// System includes +#include + +// Enumerations +enum TMemSpyViewType + { + EMemSpyViewTypeNone = -1, + EMemSpyViewTypeMainMenu = 0, + EMemSpyViewTypeProcesses, + EMemSpyViewTypeRAMInfo, + EMemSpyViewTypeROMInfo, + EMemSpyViewTypeServerList, + EMemSpyViewTypeOpenFiles, + EMemSpyViewTypeFBServBitmaps, + EMemSpyViewTypeFBServBitmapInfo, + EMemSpyViewTypeFBServBitmapViewer, + EMemSpyViewTypeCodeSegmentList, + EMemSpyViewTypeCodeSegmentDetails, + EMemSpyViewTypeChunkList, + EMemSpyViewTypeChunkDetails, + EMemSpyViewTypeSystemConfig, + EMemSpyViewTypeKernel, + EMemSpyViewTypeKernelContainers, + EMemSpyViewTypeKernelObjects, + EMemSpyViewTypeKernelHeap, + EMemSpyViewTypeDriveSummary, + EMemSpyViewTypeDriveInfo, + EMemSpyViewTypeECom, + EMemSpyViewTypeEComCategory, + EMemSpyViewTypeEComInterface, + EMemSpyViewTypeEComImplementation, + EMemSpyViewTypeThreads, + EMemSpyViewTypeThreadInfoItemList, + EMemSpyViewTypeThreadInfoItemHeap, + EMemSpyViewTypeThreadInfoItemStack, + EMemSpyViewTypeThreadInfoItemChunk, + EMemSpyViewTypeThreadInfoItemCodeSeg, + EMemSpyViewTypeThreadInfoItemServer, + EMemSpyViewTypeThreadInfoItemServerDetails, + EMemSpyViewTypeThreadInfoItemServerSessions, + EMemSpyViewTypeThreadInfoItemSession, + EMemSpyViewTypeThreadInfoItemSemaphore, + EMemSpyViewTypeThreadInfoItemMutex, + EMemSpyViewTypeThreadInfoItemTimer, + EMemSpyViewTypeThreadInfoItemLDD, + EMemSpyViewTypeThreadInfoItemPDD, + EMemSpyViewTypeThreadInfoItemLogicalChannel, + EMemSpyViewTypeThreadInfoItemChangeNotifier, + EMemSpyViewTypeThreadInfoItemUndertaker, + EMemSpyViewTypeThreadInfoItemMessageQueue, + EMemSpyViewTypeThreadInfoItemConditionalVariable, + EMemSpyViewTypeThreadInfoItemOpenFiles, + EMemSpyViewTypeThreadInfoItemActiveObject, + EMemSpyViewTypeThreadInfoItemActiveObjectDetails, + EMemSpyViewTypeThreadInfoItemGeneralInfo, + EMemSpyViewTypeThreadInfoItemOtherThreads, + EMemSpyViewTypeThreadInfoItemOtherProcesses, + EMemSpyViewTypeThreadInfoItemOwnedThreadHandles, + EMemSpyViewTypeThreadInfoItemOwnedProcessHandles, + EMemSpyViewTypeHeapTracking, + EMemSpyViewTypeHeapTrackingSettings, + EMemSpyViewTypeHeapTrackingResults, + EMemSpyViewTypeHeapTrackingResultsCycleInfo, + EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor, + EMemSpyViewTypeThreadInfoItemMemoryTracking, + EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig, + EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics, + EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent, + EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM, + EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak, + EMemSpyViewTypeWindowGroups + }; + + +class MemSpyViewTypeUtils + { +public: + static TBool IsOpenableItem( TMemSpyViewType aType ); + static TBool IsThreadInfoItem( TMemSpyViewType aType ); + static TBool IsExitableView( TMemSpyViewType aType ); + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/MemSpyViewWindowGroups.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/MemSpyViewWindowGroups.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEWWINDOWGROUPS_H +#define MEMSPYVIEWWINDOWGROUPS_H + +// System includes +#include +#include +#include + +// Engine includes +#include + +// User includes +#include "MemSpyViewBase.h" + +// Classes referenced + + +class CMemSpyViewWindowGroups : public CMemSpyViewBase + { +public: + CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ); + ~CMemSpyViewWindowGroups(); + void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL ); + +public: // From CMemSpyViewBase + CEikListBox* ConstructListBoxL(); + void RefreshL(); + TMemSpyViewType ViewType() const; + CMemSpyViewBase* PrepareParentViewL(); + CMemSpyViewBase* PrepareChildViewL(); + +public: // Menu framework + TUint MenuCascadeResourceId() const { return R_MEMSPY_MENUPANE_WINDOW_GROUPS; } + TInt MenuCascadeCommandId() const { return EMemSpyCmdWindowGroups; } + +private: // From CMemSpyViewBase + void SetListBoxModelL(); + TBool HandleCommandL( TInt aCommand ); + +private: // Command handlers + void OnCmdSwitchToL(); + void OnCmdEndL( TInt aCommand ); + +private: // Internal methods + void DetailsL(); + void AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ); + +private: // Data members + MMemSpyEngineWindowGroupList* iWindowGroupList; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/inc/viewcli.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/inc/viewcli.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,166 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef __VIEWCLI_H__ +#define __VIEWCLI_H__ + +#include +#include +#include + +// +// Forward declarations. +// + +class RVwsSession; +class CVwsSessionEventHandler; +class MVwsAppStarter; + +class MVwsSessionWrapperObserver +/** +The MVwsSessionObserver specifies an interface through which server events to be handled by the owner of +a client session are notified + +@publishedAll +@deprecated +*/ +//@internalTechnology @released + + { +public: + + /** + * Handles the view event aEvent for a view added through the client session being observed. + * Handles events for all the views added by the client. + */ + virtual void HandleViewEventL(const TVwsViewEvent& aEvent)=0; + }; + + +class CVwsSessionWrapper : public CBase +/** +The CVwsSessionWrapper class mediates access to the view server client session which it creates, and wraps in +support for notification of server events. A session observer will be called back with server events if +it maintains an outstanding request for asynchronous event notification. + +@publishedPartner +@released +*/ +//@internalTechnology @released + + { +public: + IMPORT_C static CVwsSessionWrapper* NewL(); + IMPORT_C static CVwsSessionWrapper* NewLC(); + IMPORT_C static CVwsSessionWrapper* NewL(MVwsSessionWrapperObserver& aObserver); + IMPORT_C static CVwsSessionWrapper* NewLC(MVwsSessionWrapperObserver& aObserver); + IMPORT_C ~CVwsSessionWrapper(); + IMPORT_C static TInt StartViewServer(MVwsAppStarter& aAppStarter); + IMPORT_C TInt ShutdownViewServer(); + IMPORT_C TInt AddView(const TVwsViewId& aViewId); + IMPORT_C TInt RemoveView(const TVwsViewId& aViewId) const; + IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId,TInt aMode); + IMPORT_C TInt SetSystemDefaultView(const TVwsViewId& aViewId); + IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); + IMPORT_C TInt ActivateViewViaViewEvent(const TVwsViewIdAndMessage& aViewIdAndMessage); + IMPORT_C TInt RequestCustomMessage(TDes8& aMessageBufPtr) const; + IMPORT_C void QueueAsyncRequest(); + IMPORT_C TInt StartApp(TUid aAppToStart); + IMPORT_C TInt DeactivateActiveView(); + IMPORT_C TInt DeactivateActiveViewIfOwnerMatch(); + IMPORT_C TInt NotifyNextDeactivation(const TVwsViewId& aViewId); + IMPORT_C TInt NotifyNextDeactivation(); + IMPORT_C TInt NotifyNextActivation(const TVwsViewId& aViewId); + IMPORT_C TInt NotifyNextActivation(); + IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId,TInt aMode) const; + IMPORT_C TInt SetDefaultView(const TVwsViewId& aViewId) const; + IMPORT_C TInt GetSystemDefaultView(TVwsViewId& aViewId); + IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage); + IMPORT_C TInt SetClientRequestTimeOut(TTimeIntervalMicroSeconds32 aDuration); + IMPORT_C TInt SetServerEventTimeOut(TTimeIntervalMicroSeconds32 aDuration); + IMPORT_C TInt EnableServerEventTimeOut(TBool aEnable); + IMPORT_C TInt CheckSourceOfViewSwitch(TBool& aResult,const TSecurityPolicy& aSecurityPolicy,const char* aDiagnostic); + IMPORT_C TInt EnableServerBlankScreen(TBool aEnable); + IMPORT_C TInt EnableExternalViewSwitches(TBool aEnable); + IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus); + IMPORT_C TInt SetCrossCheckUid(const TUid& aCrossCheckUid); + IMPORT_C TInt SetWindowBackgroundColor(const TRgb& aBgColor); +public: + /** + @internalComponent + @released + */ + IMPORT_C TInt ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl); + /** + @internalComponent + @released + */ + IMPORT_C void ActivateView(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TRequestStatus& aStatus, TInt aCustomControl); + /** + @internalComponent + @released + */IMPORT_C TInt CreateActivateViewEvent(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC8& aCustomMessage, TInt aCustomControl); + /** + @internalComponent + @released + */ + IMPORT_C TInt GetCurrentActiveViewInSystem(TVwsViewId& aActiveViewId); +private: + CVwsSessionWrapper(); + CVwsSessionWrapper(MVwsSessionWrapperObserver& aObserver); + void ConstructL(); + TInt CheckCreateViewServerSession(); + TBool IsSchedulerRunning(); +private: + RVwsSession* iVwsSession; + CVwsSessionEventHandler* iViewEventHandler; + MVwsSessionWrapperObserver* iObserver; + }; + + +// +// Panic. +// +/** +@internalComponent +*/ +enum TVwsPanic + { + EVwsCreateScheduler=1, + EVwsThreadRename + }; + +/** +@internalComponent +*/ +GLREF_C void Panic(TVwsPanic aPanic); + +/** +Server thread start. + +@internalComponent +*/ +GLDEF_C TInt ViewServerThreadStart(TAny* aPtr); + +/** +@internalComponent +*/ +struct SVwsCommandLine + { + MVwsAppStarter* iAppStarter; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyApp.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyApp.h" + +// System includes +#include + +// User includes +#include "MemSpyDocument.h" + + + +TUid CMemSpyApp::AppDllUid() const + { + return KUidMemSpy; + } + + +CApaDocument* CMemSpyApp::CreateDocumentL() + { + return CMemSpyDocument::NewL( *this ); + } + + +EXPORT_C CApaApplication* NewApplication() + { + return new CMemSpyApp; + } + + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyAppUi.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,761 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyAppUi.h" + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//cigasto +#include + +// User includes +#include "MemSpyContainer.h" +#include "MemSpyDocument.h" +#include "MemSpySettings.h" +#include "MemSpyDeviceWideOperationDialog.h" +#include "MemSpyViewRAMInfo.h" // for aknicon config check +#include "MemSpyExportBitmapsToMemoryCardDialog.h" +#include "MemSpy.hrh" +#include "viewcli.h" + +// Constants +const TInt KMemSpyDefaultAutoCaptureTimerPeriod = 60; +const TUint32 KMemSpyEikSrvSID = 0x10003a4a; + +/* +CMemSpyAppUi::CMemSpyAppUi( CMemSpyEngine& aEngine ) +: iEngine( aEngine ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ) + { + iEngine.SetObserver( this ); + } +*/ +CMemSpyAppUi::CMemSpyAppUi( RMemSpySession &aSession ) +: iMemSpySession( aSession ), iAutoCaptureTimerPeriod( KMemSpyDefaultAutoCaptureTimerPeriod ), iAutoCaptureOperationType( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ) + { + //iEngine.SetObserver( this ); + } + +CMemSpyAppUi::~CMemSpyAppUi() + { + RDebug::Printf( "[MemSpy] MemSpy is now closing." ); + // + delete iAutoCaptureTimer; + // + if (iAppContainer) + { + RemoveFromStack( iAppContainer ); + delete iAppContainer; + } + // + //iEngine.SetObserver( NULL ); + SetViewServerTimeOutStatus( ETrue ); + } + + +void CMemSpyAppUi::ConstructL() + { + BaseConstructL( EAknEnableSkin ); + // + //iAppContainer = new (ELeave) CMemSpyContainer( iEngine, *this ); + iAppContainer = new (ELeave) CMemSpyContainer( iMemSpySession, *this ); + iAppContainer->SetMopParent(this); + iAppContainer->ConstructL( ClientRect() ); + iAppContainer->SetObserver( this ); + iAppContainer->SetFocus( ETrue ); + AddToStackL( iAppContainer ); + // + iAutoCaptureTimer = CPeriodic::NewL( CActive::EPriorityIdle ); + // + iEikonEnv->SetSystem( ETrue ); + // + SetViewServerTimeOutStatus( EFalse ); + } + + +CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() + { + CMemSpyDocument* doc = static_cast< CMemSpyDocument* >( Document() ); + return *doc; + } + + +const CMemSpyDocument& CMemSpyAppUi::MemSpyDocument() const + { + const CMemSpyDocument* doc = static_cast< const CMemSpyDocument* >( Document() ); + return *doc; + } + + +void CMemSpyAppUi::HandleStatusPaneSizeChange() + { + iAppContainer->SetRect( ClientRect() ); + } + + +void CMemSpyAppUi::HandleControlEventL( CCoeControl* aControl, TCoeEvent /*aEventType*/ ) + { + if ( aControl == iAppContainer ) + { + UpdateCBAL(); + } + } + + +void CMemSpyAppUi::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + CMemSpyViewBase& view = iAppContainer->ActiveView(); + const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); + // + const TBool openableView = MemSpyViewTypeUtils::IsOpenableItem( viewType ); + const TBool exitable = MemSpyViewTypeUtils::IsExitableView( viewType ); + // +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - START - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable ); +#endif + // + if ( aResourceId == R_MEMSPY_MENUPANE ) + { + const TInt count = aMenuPane->NumberOfItemsInPane(); + for( TInt i=0; iItemDataByIndexL( i ); + + // If the command is inside the view-specific range then we'll hide it + // unless the view and command id matches. + const TBool isViewSpecific = ( menuPaneMetaData.iCommandId >= KMemSpyMenuCommandViewSpecific ); + if ( isViewSpecific ) + { + // Check whether this view requires this command item. + dimItem = ( view.MenuCascadeCommandId() != menuPaneMetaData.iCommandId ); + } + + aMenuPane->SetItemDimmed( menuPaneMetaData.iCommandId, dimItem ); + } + + aMenuPane->SetItemDimmed( EMemSpyCmdOpen, !openableView ); + aMenuPane->SetItemDimmed( EAknSoftkeyBack, exitable ); + aMenuPane->SetItemDimmed( EAknCmdExit, !exitable ); + } + else if ( aResourceId == R_MEMSPY_MENUPANE_TOOLS ) + { + const TBool inOpenFilesView = ( viewType == EMemSpyViewTypeOpenFiles ); + aMenuPane->SetItemDimmed( EMemSpyCmdToolsListOpenFiles, !inOpenFilesView ); + } + else if ( aResourceId == R_MEMSPY_MENUPANE_VIEW ) + { + // Hide the refresh item when in the thread info container view + aMenuPane->SetItemDimmed( EMemSpyCmdViewRefresh, viewType == EMemSpyViewTypeThreadInfoItemList ); + aMenuPane->SetItemDimmed( EMemSpyCmdViewOutputToSink, viewType == EMemSpyViewTypeThreadInfoItemList ); + } + else if ( aResourceId == R_MEMSPY_MENUPANE_OUTPUT ) + { + TMemSpySinkType currentSink; + iMemSpySession.GetOutputSink( currentSink ); + aMenuPane->SetItemDimmed( EMemSpyCmdOutputToDebug, currentSink == ESinkTypeDebug ); + aMenuPane->SetItemDimmed( EMemSpyCmdOutputToFile, currentSink == ESinkTypeFile ); + } + else if ( aResourceId == R_MEMSPY_MENUPANE_AUTO_CAPTURE ) + { + // Change the auto-capture toggle caption appropriately... + TInt resId = R_MEMSPY_AUTO_CAPTURE_ENABLE; + if ( iAutoCaptureTimer->IsActive() ) + { + resId = R_MEMSPY_AUTO_CAPTURE_DISABLE; + } + aMenuPane->SetItemTextL( EMemSpyCmdAutoCaptureToggle, resId ); + } + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - sending to view..." ); +#endif + + view.DynInitMenuPaneL( aResourceId, aMenuPane ); + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DynInitMenuPaneL() - END - aResourceId: 0x%08x (%8d), iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d, viewType: %d, openableView: %d, exitable: %d", aResourceId, aResourceId, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive(), viewType, openableView, exitable ); +#endif + } + + +TKeyResponse CMemSpyAppUi::HandleKeyEventL( const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ ) + { + return EKeyWasNotConsumed; + } + + +void CMemSpyAppUi::HandleCommandL( TInt aCommand ) + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - START - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); +#endif + + switch ( aCommand ) + { + case EAknSoftkeyBack: + OnCmdBackL(); + break; + + case EEikCmdExit: + case EAknCmdExit: + case EAknSoftkeyExit: + OnCmdExitL(); + break; + + case EMemSpyCmdOpen: + OnCmdOpenL(); + break; + + case EMemSpyCmdOutputToDebug: + OnCmdOutputToDebugL(); + break; + case EMemSpyCmdOutputToFile: + OnCmdOutputToFileL(); + break; + + case EMemSpyCmdToolsAbout: + OnCmdAboutL(); + break; + // + case EMemSpyCmdPhoneInfoGeneralSummary: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralSummary ); + OnCmdPhoneInformationOperationL( OutputPhoneInfo ); + break; + case EMemSpyCmdPhoneInfoGeneralDetailed: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralDetailed ); + OnCmdPhoneInformationOperationL( OutputDetailedPhoneInfo ); + break; + /* + case EMemSpyCmdPhoneInfoGeneralHandles: + OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityGeneralHandles ); + break; + case EMemSpyCmdPhoneInfoGeneralKernelContainers: + OnCmdPhoneInformationOperationKernelContainersL(); + break; + // + */ + case EMemSpyCmdPhoneInfoHeapInfoSummary: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapInfo ); + OnCmdPhoneInformationOperationL (OutputHeapInfo ); + break; + case EMemSpyCmdPhoneInfoHeapInfoCompact: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceHeapInfoCompact ); + OnCmdPhoneInformationOperationL( OutputCompactHeapInfo ); + break; + case EMemSpyCmdPhoneInfoHeapCellListing: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapCellListing ); + OnCmdPhoneInformationOperationL( OutputHeapCellListing ); + break; + + case EMemSpyCmdPhoneInfoHeapDump: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityHeapData ); + OnCmdPhoneInformationOperationL( OutputHeapData ); + break; + // + case EMemSpyCmdPhoneInfoStackInfo: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackInfo ); + OnCmdPhoneInformationOperationL( OutputStackInfo ); + break; + case EMemSpyCmdPhoneInfoStackInfoCompact: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EEntireDeviceStackInfoCompact ); + OnCmdPhoneInformationOperationL( OutputCompactStackInfo ); + break; + case EMemSpyCmdPhoneInfoStackDumpUser: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataUser ); + OnCmdPhoneInformationOperationL( OutputUserStackData ); + break; + case EMemSpyCmdPhoneInfoStackDumpKernel: + //OnCmdPhoneInformationOperationL( CMemSpyDeviceWideOperations::EPerEntityStackDataKernel ); + OnCmdPhoneInformationOperationL( OutputKernelStackData ); + break; + + case EMemSpyCmdAutoCaptureToggle: + OnCmdAutoCaptureToggleL(); + break; + case EMemSpyCmdAutoCaptureRetryTime: + OnCmdAutoCaptureRetryTimeL(); + break; + case EMemSpyCmdAutoCaptureOperationType: + OnCmdAutoCaptureOperationTypeL(); + break; + + default: + iAppContainer->HandleCommandL( aCommand ); + break; + } + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::HandleCommandL() - END - aCommand: %8d, iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", aCommand, iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); +#endif + } + + +void CMemSpyAppUi::HandleForegroundEventL( TBool aForeground) + { + // Refresh the container when coming to the foreground + if ( aForeground ) + { + iAppContainer->OnCmdViewRefreshL(); + } + } + + +void CMemSpyAppUi::HandleThreadSelectedL( const CMemSpyThread& /*aThread*/ ) + { + MEikAppUiFactory* appUiFactory = (iEikonEnv)->AppUiFactory(); + appUiFactory->MenuBar()->TryDisplayMenuBarL(); + } + + +void CMemSpyAppUi::HandleMemSpyEngineEventL( MMemSpyEngineObserver::TEvent aEvent, TAny* aContext ) + { + if ( aEvent == MMemSpyEngineObserver::EHandleThreadsOrProcessesChanged ) + { + // Get the original container + const CMemSpyEngineObjectContainer& oldContainer = *reinterpret_cast< CMemSpyEngineObjectContainer* >( aContext ); + (void) oldContainer; + + // Refresh the container + iAppContainer->OnCmdViewRefreshL(); + } + else if ( aEvent == MMemSpyEngineObserver::EHandleClientServerOperationRequest ) + { + const TInt function = reinterpret_cast( aContext ); + InitiateMemSpyClientServerOperationL( function ); + } + } + + +void CMemSpyAppUi::DWOperationStarted() + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); +#endif + + iRunningDeviceWideOperation = ETrue; + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationStarted() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); +#endif + } + + +void CMemSpyAppUi::DWOperationCancelled() + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); +#endif + + iAutoCaptureTimer->Cancel(); + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCancelled() - END - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); +#endif + } + + +void CMemSpyAppUi::DWOperationCompleted() + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - START - iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); +#endif + + iRunningDeviceWideOperation = EFalse; + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::DWOperationCompleted() - END - iAutoCaptureTimer is active: %d", iAutoCaptureTimer->IsActive() ); +#endif + } + + +void CMemSpyAppUi::UpdateCBAL() + { + CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); + const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); + // + if ( MemSpyViewTypeUtils::IsExitableView( viewType ) ) + { + cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_EXIT ); + } + else + { + cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ); + } + + cba->MakeVisible( ETrue ); + cba->DrawNow(); + } + + +void CMemSpyAppUi::InitiateMemSpyClientServerOperationL( TInt aOpCode ) + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - START - aOpCode: %d", aOpCode ); +#endif + + switch( aOpCode ) + { + case EMemSpyClientServerOpSummaryInfo: + HandleCommandL( EMemSpyCmdPhoneInfoGeneralSummary ); + break; + case EMemSpyClientServerOpSummaryInfoDetailed: + HandleCommandL( EMemSpyCmdPhoneInfoGeneralDetailed ); + break; + // + case EMemSpyClientServerOpHeapInfo: + HandleCommandL( EMemSpyCmdPhoneInfoHeapInfoSummary ); + break; + case EMemSpyClientServerOpHeapCellListing: + HandleCommandL( EMemSpyCmdPhoneInfoHeapCellListing ); + break; + case EMemSpyClientServerOpHeapData: + HandleCommandL( EMemSpyCmdPhoneInfoHeapDump ); + break; + // + case EMemSpyClientServerOpStackInfo: + HandleCommandL( EMemSpyCmdPhoneInfoStackInfo ); + break; + case EMemSpyClientServerOpStackDataUser: + HandleCommandL( EMemSpyCmdPhoneInfoStackDumpUser ); + break; + case EMemSpyClientServerOpStackDataKernel: + HandleCommandL( EMemSpyCmdPhoneInfoStackDumpKernel ); + break; + // + case EMemSpyClientServerOpBitmapsSave: + OnCmdToolsBitmapsSaveToMemoryCardL(); + break; + case EMemSpyClientServerOpSendToBackground: + OnCmdToolsSendToBackgroundL(); + break; + case EMemSpyClientServerOpBringToForeground: + OnCmdToolsBringToForegroundL(); + break; + case EMemSpyClientServerOpExit: + OnCmdExitL(); + break; + // + default: + User::Leave( KErrNotSupported ); + break; + } + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::InitiateMemSpyClientServerOperationL() - END - aOpCode: %d", aOpCode ); +#endif + } + + +void CMemSpyAppUi::SetViewServerTimeOutStatus( TBool aEnabled ) + { + /* TODO + iMemSpySession.SetServerTimeOutStatus( KMemSpyEikSrvSID, aEnabled ); + */ + /* + TRAP_IGNORE( + iEngine.HelperProcess().ImpersonateL( KMemSpyEikSrvSID ); + // + CVwsSessionWrapper* ses = CVwsSessionWrapper::NewLC(); + ses->EnableServerEventTimeOut( aEnabled ); + CleanupStack::PopAndDestroy( ses ); + // + iEngine.HelperProcess().ImpersonateL( 0 ); + ); + */ + } + + +void CMemSpyAppUi::OnCmdBackL() + { + const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); + // + if ( !MemSpyViewTypeUtils::IsExitableView( viewType ) ) + { + // Should go back one view + iAppContainer->NavigateToParentViewL(); + } + } + + +void CMemSpyAppUi::OnCmdExitL() + { + Exit(); + } + + +void CMemSpyAppUi::OnCmdOpenL() + { + const TMemSpyViewType viewType = iAppContainer->ActiveViewType(); + // + if ( MemSpyViewTypeUtils::IsOpenableItem( viewType ) ) + { + // Should go back one view + iAppContainer->NavigateToChildViewL(); + } + } + + +void CMemSpyAppUi::OnCmdPhoneInformationOperationL( TDeviceWideOperation aOperation ) + { + // + //CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, aOperation ); + CMemSpyDwoTracker* tracker = CMemSpyDeviceWideOperationDialog::CreateDeviceWideOperation( iMemSpySession, aOperation ); + tracker->Start(); + /* +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - START - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); +#endif + + if ( !iRunningDeviceWideOperation ) + { + CMemSpyDeviceWideOperationDialog::ExecuteLD( iMemSpySession, *this, aOp ); + } + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdPhoneInformationOperationL() - END - aOp: %d, iRunningDeviceWideOperation: %d, iAutoCaptureTimer is active: %d", aOp, iRunningDeviceWideOperation, iAutoCaptureTimer->IsActive() ); +#endif + */ + } + + +void CMemSpyAppUi::OnCmdPhoneInformationOperationKernelContainersL() + { + /* TODO + iMemSpySession.OutputKernelObjects(); + */ + /* + CMemSpyEngineGenericKernelObjectContainer* list = iEngine.HelperKernelContainers().ObjectsAllL(); + CleanupStack::PushL( list ); + iEngine.HelperKernelContainers().OutputL( *list ); + CleanupStack::PopAndDestroy( list ); + */ + } + + + + + + + + + + + + + + + + + + + + + + +void CMemSpyAppUi::OnCmdAutoCaptureToggleL() + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); +#endif + + if ( iAutoCaptureTimer->IsActive() ) + { + iAutoCaptureTimer->Cancel(); + } + else + { + iAutoCaptureTimer->Cancel(); + // + const TTimeIntervalMicroSeconds32 interval( iAutoCaptureTimerPeriod * 1000000 ); + iAutoCaptureTimer->Start( 0, interval, TCallBack(AutoCaptureCallBack, this) ); + } + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::OnCmdAutoCaptureToggleL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); +#endif + } + + +void CMemSpyAppUi::OnCmdAutoCaptureRetryTimeL() + { + CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( iAutoCaptureTimerPeriod ); + dialog->ExecuteLD( R_MEMSPY_DEVICE_WIDE_SETTINGS ); + } + + +void CMemSpyAppUi::OnCmdAutoCaptureOperationTypeL() + { + CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES ); + CleanupStack::PushL(items); + // + TInt currentItem = iAutoCaptureOperationType; + // + CAknRadioButtonSettingPage* dialog = new(ELeave) CAknRadioButtonSettingPage( R_MEMSPY_AUTO_CAPTURE_OPERATION_TYPES_SETTINGS_PAGE, currentItem, items ); + if ( dialog->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) ) + { + iAutoCaptureOperationType = static_cast< CMemSpyDeviceWideOperations::TOperation >( currentItem ); + } + // + CleanupStack::PopAndDestroy( items ); + } + + +TInt CMemSpyAppUi::AutoCaptureCallBack( TAny* aSelf ) + { + CMemSpyAppUi* self = reinterpret_cast< CMemSpyAppUi* >( aSelf ); + TRAPD( err, self->AutoCaptureCallBackL() ); + // + const TBool callMeBackAgain = ( err == KErrNone ); + return callMeBackAgain; + } + + +void CMemSpyAppUi::AutoCaptureCallBackL() + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - START - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); +#endif + + // OnCmdPhoneInformationOperationL( iAutoCaptureOperationType ); + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyAppUi::AutoCaptureCallBackL() - END - iAutoCaptureOperationType: %d, iAutoCaptureTimer is active: %d", iAutoCaptureOperationType, iAutoCaptureTimer->IsActive() ); +#endif + } + + + + + + + + + + + + + + + + + + + + + +void CMemSpyAppUi::OnCmdOutputToDebugL() + { + iMemSpySession.SwitchOutputSinkL( ESinkTypeDebug ); //set in engine + MemSpyDocument().Settings().SetSinkType( ESinkTypeDebug ); //set in settings + } + + +void CMemSpyAppUi::OnCmdOutputToFileL() + { + iMemSpySession.SwitchOutputSinkL( ESinkTypeFile ); //set in engine + MemSpyDocument().Settings().SetSinkType( ESinkTypeFile ); //set in settings + } + + + + + + + + + + + +void CMemSpyAppUi::OnCmdAboutL() + { + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; + dialog->ExecuteLD( R_MEMSPYUI_ABOUT_DIALOG ); + } + + + + + + + + + + + + +void CMemSpyAppUi::OnCmdToolsBitmapsSaveToMemoryCardL() + { + /* TODO + // Get bitmap handles + RArray handles; + CleanupClosePushL( handles ); + iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( handles ); + + // Build bitmap list + CMemSpyEngineFbServBitmapArray* array = CMemSpyEngineFbServBitmapArray::NewL( handles ); + CleanupStack::PopAndDestroy( &handles ); + CleanupStack::PushL( array ); + + // Export... + CMemSpyExportBitmapsToMemoryCardDialog* dialog = CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *array ); + + // All done + CleanupStack::PopAndDestroy( array ); + */ + } + + +void CMemSpyAppUi::OnCmdToolsSendToBackgroundL() + { + TApaTask task( iCoeEnv->WsSession() ); + task.SendToBackground(); + } + + +void CMemSpyAppUi::OnCmdToolsBringToForegroundL() + { + iCoeEnv->BringOwnerToFront(); + } + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyContainer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,227 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyContainer.h" + +// System includes +#include // for example label control +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + + + +/* +CMemSpyContainer::CMemSpyContainer( CMemSpyEngine& aEngine, MMemSpyContainerObserver& aObserver ) +: iEngine( aEngine ), iObserver( aObserver ) + { + } +*/ +CMemSpyContainer::CMemSpyContainer( RMemSpySession& aSession, MMemSpyContainerObserver& aObserver ) +: iMemSpySession( aSession ), iObserver( aObserver ) + { + } + +CMemSpyContainer::~CMemSpyContainer() + { + delete iPreviousView; + delete iActiveView; + } + + +void CMemSpyContainer::ConstructL(const TRect& aRect) + { + CreateWindowL(); + SetRect(aRect); + PrepareTopLevelViewL(); + ActivateL(); + } + + +void CMemSpyContainer::NavigateToParentViewL() + { + CMemSpyViewBase* parentView = iActiveView->PrepareParentViewL(); + // + if ( parentView == NULL ) + { + // Parent can be null, in which case, revert to top-level view + PrepareTopLevelViewL(); + } + else + { + SetNewActiveViewL( parentView ); + } + } + + +void CMemSpyContainer::NavigateToChildViewL() + { + CMemSpyViewBase* childView = iActiveView->PrepareChildViewL(); + // + if ( childView != NULL ) + { + SetNewActiveViewL( childView ); + } + } + + +void CMemSpyContainer::HandleCommandL( TInt aCommand ) + { + switch( aCommand ) + { + case EMemSpyCmdViewRefresh: + OnCmdViewRefreshL(); + break; + default: + if ( iActiveView ) + { + iActiveView->HandleCommandL( aCommand ); + } + break; + } + } + + +void CMemSpyContainer::OnCmdViewRefreshL() + { + if ( iActiveView ) + { + TRAPD(err, iActiveView->RefreshL()); + if ( err != KErrNone ) + { + // Error during view refreshing (perhaps the thread doesn't exist anymore). + // Try to replace the active view with its parent... + NavigateToParentViewL(); + } + } + } + + +void CMemSpyContainer::SizeChanged() + { + if ( iActiveView ) + { + iActiveView->SetRect( Rect() ); + } + } + + +TInt CMemSpyContainer::CountComponentControls() const + { + return 1; + } + + +CCoeControl* CMemSpyContainer::ComponentControl(TInt /*aIndex*/) const + { + return iActiveView; + } + + +void CMemSpyContainer::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + // + gc.SetPenStyle(CGraphicsContext::ENullPen); + gc.SetBrushColor(KRgbGray); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.DrawRect(aRect); + } + + +TKeyResponse CMemSpyContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse response = EKeyWasNotConsumed; + // + if ( iActiveView ) + { + response = iActiveView->OfferKeyEventL( aKeyEvent, aType ); + } + // + return response; + } + + +void CMemSpyContainer::HandleMemSpyViewEventL( TViewEventType aEvent, TMemSpyViewType /*aViewType*/, CMemSpyViewBase& aReportingView, TAny* /*aContext*/ ) + { + if ( aEvent == EEventItemActioned ) + { + // Get the view to generate a child + CMemSpyViewBase* child = aReportingView.PrepareChildViewL(); + if ( child == NULL ) + { + // View doesn't have a child - treat it as item activation and + // report event to observer. + + } + else + { + // Child view becomes the active one + SetNewActiveViewL( child ); + } + } + } + + +CMemSpyViewBase* CMemSpyContainer::PrepareTopLevelViewL() + { + //CMemSpyViewMainMenu* view = new(ELeave) CMemSpyViewMainMenu( iEngine, *this ); + CMemSpyViewMainMenu* view = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, *this ); + CleanupStack::PushL( view ); + view->ConstructL( Rect(), *this ); + SetNewActiveViewL( view ); + CleanupStack::Pop( view ); + return view; + } + + +void CMemSpyContainer::SetNewActiveViewL( CMemSpyViewBase* aNewView ) + { + delete iPreviousView; + // + iPreviousView = iActiveView; + if ( iPreviousView ) + { + iPreviousView->MakeVisible( EFalse ); + iPreviousView->SetFocus( EFalse ); + } + // + iActiveView = aNewView; + iActiveView->RefreshL(); + iActiveView->SetFocus( ETrue ); + // + ReportEventL( MCoeControlObserver::EEventStateChanged ); + } + + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,387 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyDeviceWideOperationDialog.h" + +// System includes +#include +#include +#include +#include +#include +#include +#include + +#include + +/* +CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( CMemSpyEngine& aEngine, MMemSpyDeviceWideOperationDialogObserver& aObserver ) +: iEngine( aEngine ), iObserver( aObserver ) + { + } + +CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession, MMemSpyDeviceWideOperationDialogObserver& aObserver ) +: iSession( aSession ), iObserver( aObserver ) + { + } +*/ + +CMemSpyDeviceWideOperationDialog::CMemSpyDeviceWideOperationDialog( RMemSpySession& aSession ) +: iSession( aSession ) + { + } + + +CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() + { +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - START - iForcedCancel: %d", iForcedCancel ); +#endif + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting operation...: 0x%08x", iOperation ); +#endif + delete iOperation; + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - deleting dialog...: 0x%08x", iProgressDialog ); +#endif + iProgressInfo = NULL; + delete iProgressDialog; + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - sending EDialogDismissed to observer..." ); +#endif + + //iObserver.DWOperationCompleted(); //TODO + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::~CMemSpyDeviceWideOperationDialog() - END" ); +#endif + } + + +//void CMemSpyDeviceWideOperationDialog::ExecuteL( CMemSpyDeviceWideOperations::TOperation aOperation ) +void CMemSpyDeviceWideOperationDialog::ExecuteL( TDeviceWideOperation aOp ) + { + /* +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - START" ); +#endif + + iOperation = CMemSpyDeviceWideOperations::NewL( iEngine, *this, aOperation ); + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - constructed operation..." ); +#endif + + ASSERT( iProgressDialog == NULL ); + iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue ); + iProgressDialog->PrepareLC( R_MEMSPY_DEVICE_WIDE_OPERATION_PROGRESS_DIALOG ); + iProgressDialog->SetCallback( this ); + iProgressDialog->SetGloballyCapturing( ETrue ); + // + iProgressInfo = iProgressDialog->GetProgressInfoL(); + iProgressInfo->SetFinalValue( iOperation->TotalOperationSize() ); + // + iProgressDialog->RunLD(); + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::ExecuteL() - END" ); +#endif + */ + } + +void CMemSpyDeviceWideOperationDialog::ExecuteLD( RMemSpySession& aSession, TDeviceWideOperation aOp ) + { + //CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aSession, aObserver ); + CMemSpyDeviceWideOperationDialog* self = new(ELeave) CMemSpyDeviceWideOperationDialog( aSession ); + CleanupStack::PushL( self ); + self->ExecuteL( aOp ); + CleanupStack::PopAndDestroy( self ); + } + + +void CMemSpyDeviceWideOperationDialog::Cancel() + { +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - START - iOperation: 0x%08x, iForcedCancel: %d", iOperation, iForcedCancel ); +#endif + + iForcedCancel = ETrue; + // + if ( iOperation ) + { + iOperation->Cancel(); + } + // + //iObserver.DWOperationCancelled(); + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::Cancel() - END" ); +#endif + } + + +void CMemSpyDeviceWideOperationDialog::DialogDismissedL( TInt aButtonId ) + { +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - START - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel ); +#else + (void) aButtonId; +#endif + + Cancel(); + +#ifdef _DEBUG + RDebug::Printf("[MemSpy] CMemSpyDeviceWideOperationDialog::DialogDismissedL() - END - aButtonId: %d, iForcedCancel: %d", aButtonId, iForcedCancel ); +#endif + } + + +void CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent( TEvent aEvent, TInt aParam1, const TDesC& aParam2 ) + { +#ifdef _DEBUG + RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - START - aEvent: %d, iProgressDialog: 0x%08x, aParam1: %d, aParam2: %S"), aEvent, iProgressDialog, aParam1, &aParam2 ); +#endif + + switch( aEvent ) + { + case MMemSpyDeviceWideOperationsObserver::EOperationSized: + break; + case MMemSpyDeviceWideOperationsObserver::EOperationStarting: + //iObserver.DWOperationStarted(); + break; + case MMemSpyDeviceWideOperationsObserver::EOperationProgressStart: + ASSERT( iProgressDialog != NULL ); + SetDialogCaptionL( aParam2 ); + break; + case MMemSpyDeviceWideOperationsObserver::EOperationProgressEnd: + ASSERT( iProgressDialog != NULL ); + iProgressInfo->IncrementAndDraw( aParam1 ); + break; + case MMemSpyDeviceWideOperationsObserver::EOperationCancelled: + break; + case MMemSpyDeviceWideOperationsObserver::EOperationCompleting: + { + ASSERT( iProgressDialog != NULL ); + const TInt finalValue = iProgressInfo->Info().iFinalValue; + iProgressInfo->SetAndDraw( finalValue ); + break; + } + case MMemSpyDeviceWideOperationsObserver::EOperationCompleted: + if ( iProgressDialog ) + { + iProgressDialog->ProcessFinishedL(); + } + break; + default: + break; + } + +#ifdef _DEBUG + RDebug::Print( _L("[MemSpy] CMemSpyDeviceWideOperationDialog::HandleDeviceWideOperationEvent() - END - aEvent: %d, aParam1: %d, aParam2: %S"), aEvent, aParam1, &aParam2 ); +#endif + } + + +void CMemSpyDeviceWideOperationDialog::SetDialogCaptionL( const TDesC& aText ) + { + if ( aText.Length() ) + { + iProgressDialog->SetTextL( aText ); + iProgressDialog->DrawNow(); + } + } + +CMemSpyDwoTracker* CMemSpyDeviceWideOperationDialog::CreateDeviceWideOperation( RMemSpySession& aSession, TDeviceWideOperation aOp ) +{ + return new CMemSpyDwoTracker( aSession, aOp ); +} + + + + + + + + + + + + + +CMemSpyDwoProgressTracker::CMemSpyDwoProgressTracker(RMemSpySession &aSession) + : CActive( EPriorityStandard ), iSession( aSession ) + { + CActiveScheduler::Add(this); + } + +CMemSpyDwoProgressTracker::~CMemSpyDwoProgressTracker() + { + Cancel(); + } + +void CMemSpyDwoProgressTracker::Start() + { + ASSERT( iProgressDialog == NULL ); + iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue ); + iProgressDialog->PrepareLC( R_MEMSPY_DEVICE_WIDE_OPERATION_PROGRESS_DIALOG ); + iProgressDialog->SetCallback( this ); + iProgressDialog->SetGloballyCapturing( ETrue ); + iProgressInfo = iProgressDialog->GetProgressInfoL(); + + iSession.NotifyDeviceWideOperationProgress( iProgress, iStatus ); + + UpdateProcessDialogL( iProgress.Progress(), iProgress.Description() ); + + SetActive(); + + iProgressDialog->RunLD(); + } + +void CMemSpyDwoProgressTracker::Cancel() + { + } + +void CMemSpyDwoProgressTracker::RunL() + { + // If an error occurred handle it in RunError(). + User::LeaveIfError(iStatus.Int()); + + // Resubmit the request immediately + iSession.NotifyDeviceWideOperationProgress( iProgress, iStatus ); + + SetActive(); + + UpdateProcessDialogL( iProgress.Progress(), iProgress.Description() ); + } + +void CMemSpyDwoProgressTracker::DoCancel() + { + } + +TInt CMemSpyDwoProgressTracker::RunError(TInt aError) + { + // KErrNotReady and KErrCancel errors are OK, they just notify + // us about the outstanding notification request that won't be + // processed. + return KErrNone; + } + +void CMemSpyDwoProgressTracker::UpdateProcessDialogL( TInt aProgress, const TDesC& aProgressText ) + { + if(iProgressDialog) + { + iProgressDialog->SetTextL( aProgressText ); + } + + if(iProgressInfo) + { + iProgressInfo->SetAndDraw( aProgress ); + } + } + +void CMemSpyDwoProgressTracker::DialogDismissedL(TInt aButtonId) + { + iProgressDialog = NULL; + iProgressInfo = NULL; + + Cancel(); + } + + + + + + + + + + + + + + +CMemSpyDwoTracker::CMemSpyDwoTracker( RMemSpySession &aSession, TDeviceWideOperation aOperation ) +: CActive( EPriorityStandard ), + iSession( aSession ), + iProgressTracker(new CMemSpyDwoProgressTracker( aSession )), + iOperation( aOperation ) + { + CActiveScheduler::Add(this); + } + +CMemSpyDwoTracker::~CMemSpyDwoTracker() + { + Cancel(); + + delete iProgressTracker; + } + +void CMemSpyDwoTracker::Start() +{ + void (RMemSpySession::*functions[])(TRequestStatus&) = { + &RMemSpySession::OutputPhoneInfo, + &RMemSpySession::OutputDetailedPhoneInfo, + &RMemSpySession::OutputHeapInfo, + &RMemSpySession::OutputCompactHeapInfo, + &RMemSpySession::OutputHeapCellListing, + &RMemSpySession::OutputHeapData, + &RMemSpySession::OutputStackInfo, + &RMemSpySession::OutputCompactStackInfo, + &RMemSpySession::OutputUserStackData, + &RMemSpySession::OutputKernelStackData }; + + (iSession.*functions[iOperation])(iStatus); + + SetActive(); + + iProgressTracker->Start(); +} + +void CMemSpyDwoTracker::Cancel() +{ +} + +void CMemSpyDwoTracker::RunL() + { + // If an error occurred handle it in RunError(). + User::LeaveIfError(iStatus.Int()); + + if( !IsActive() ) + { + iProgressTracker->ProgressDialog()->ProcessFinishedL(); + } + } + +void CMemSpyDwoTracker::DoCancel() +{ + // Cancel progress tracker + iProgressTracker->Cancel(); + + iSession.CancelDeviceWideOperationL(); +} + +TInt CMemSpyDwoTracker::RunError(TInt aError) +{ + // Emit the finished(false) signal to notify user + // operation was canceled + //emit finished(false); //TODO: + + return KErrNone; +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyDocument.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,103 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyDocument.h" + +// Engine includes +#include + +// User includes +#include "MemSpyAppUi.h" +#include "MemSpySettings.h" + +//cigasto +#include + + +CMemSpyDocument::CMemSpyDocument(CEikApplication& aApp) +: CAknDocument(aApp) + { + } + + +CMemSpyDocument::~CMemSpyDocument() + { + delete iSettings; + iMemSpySession->Close(); + } + + +void CMemSpyDocument::ConstructL() + { + RFs& fsSession = CCoeEnv::Static()->FsSession(); + //cigasto + //iEngine = CMemSpyEngine::NewL( fsSession ); + + iMemSpySession = new (ELeave) RMemSpySession(); + //RMemSpySession iMemSpySession; + TInt error = iMemSpySession->Connect(); + if(error != KErrNotFound) + { + User::LeaveIfError( error ); + } + + //iSettings = CMemSpySettings::NewL( fsSession, *iEngine ); + iSettings = CMemSpySettings::NewL( fsSession, *iMemSpySession ); + } + + +CMemSpyDocument* CMemSpyDocument::NewL(CEikApplication& aApp) + { + CMemSpyDocument* self = new (ELeave) CMemSpyDocument( aApp ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +/* +CMemSpyEngine& CMemSpyDocument::Engine() + { + return *iEngine; + } + + +const CMemSpyEngine& CMemSpyDocument::Engine() const + { + return *iEngine; + } +*/ + +CMemSpySettings& CMemSpyDocument::Settings() + { + return *iSettings; + } + + +const CMemSpySettings& CMemSpyDocument::Settings() const + { + return *iSettings; + } + + +CEikAppUi* CMemSpyDocument::CreateAppUiL() + { + //return new (ELeave) CMemSpyAppUi( *iEngine ); + return new (ELeave) CMemSpyAppUi( *iMemSpySession ); + } + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyExportBitmapsToMemoryCardDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyExportBitmapsToMemoryCardDialog.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,328 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyExportBitmapsToMemoryCardDialog.h" + +// System includes +#include +#include +#include +#include +#include +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Driver includes +#include + +// Literal constants +_LIT( KMemSpyBitmapExportFolderAndFileName, "e:\\MemSpy\\Images\\%04d%02d%02d_%02d.%02d.%02d\\"); + + +CMemSpyExportBitmapsToMemoryCardDialog::CMemSpyExportBitmapsToMemoryCardDialog( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ) +: CActive(EPriorityIdle), iFsSession(aFsSession), iBitmaps(aBitmaps) + { + CActiveScheduler::Add(this); + } + + +CMemSpyExportBitmapsToMemoryCardDialog::~CMemSpyExportBitmapsToMemoryCardDialog() + { + Cancel(); + // + delete iProgressDialog; + // + iMimeTypeArray.ResetAndDestroy(); + iMimeTypeArray.Close(); + // + if ( iEncoder ) + { + iEncoder->Cancel(); + } + delete iEncoder; + delete iFolderName; + delete iBmpMimeType; + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::ConstructL() + { + // Check card is ready + if ( CheckMemoryCardAvailableL( iFsSession ) == EFalse ) + { + User::Leave( KErrNotReady ); + } + + // Get mime type for BMP file + IdentifyBmpMimeTypeL(); + + // Prepare unique empty folder + PrepareFolderNameSpecL(); + + // Prepare UI stuff + iProgressDialog = new( ELeave ) CAknProgressDialog( reinterpret_cast< CEikDialog** >( &iProgressDialog ) ); + iProgressDialog->SetCallback( this ); + iProgressDialog->SetGloballyCapturing( ETrue ); + iProgressDialog->PrepareLC( R_MEMSPY_EXPORT_TO_MEMORYCARD_DIALOG ); + // + iProgressInfo = iProgressDialog->GetProgressInfoL( ); + iProgressInfo->SetFinalValue( iBitmaps.Count() ); + // + iProgressDialog->MakeVisible( ETrue ); // Visible right away + // + iDialogDismissed = EFalse; + iProgressInfo->SetAndDraw( 0 ); + + // Start the process rolling... + CompleteSelf(KErrNone); + + // + iProgressDialog->RunLD( ); + } + + +CMemSpyExportBitmapsToMemoryCardDialog* CMemSpyExportBitmapsToMemoryCardDialog::NewL( RFs& aFsSession, const CMemSpyEngineFbServBitmapArray& aBitmaps ) + { + CMemSpyExportBitmapsToMemoryCardDialog* self = new(ELeave) CMemSpyExportBitmapsToMemoryCardDialog( aFsSession, aBitmaps ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::Cancel() + { + CActive::Cancel(); + } + + +TBool CMemSpyExportBitmapsToMemoryCardDialog::CheckMemoryCardAvailableL( RFs& aFsSession ) + { + TBool available = EFalse; + // + TDriveInfo driveInfo; + if ( aFsSession.Drive( driveInfo, EDriveE ) == KErrNone ) + { + // Other checks needed? + available = ETrue; + } + // + return available; + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::RunL() + { + const TInt error = iStatus.Int(); + User::LeaveIfError( error ); + + if ( !iDialogDismissed ) + { + // Do we have more items to process? + if ( TryToExportSingleBitmapL() ) + { + _LIT(KTextFormat, "Saving image\n%d/%d"); + TBuf<128> buf; + buf.Format( KTextFormat, iBitmapIndex, iBitmaps.Count() ); + // + iProgressDialog->SetTextL( buf ); + iProgressInfo->SetAndDraw( iBitmapIndex ); + iProgressDialog->DrawDeferred(); + } + else + { + // We're done - RunL will not be called again + if (iProgressInfo) + { + const TInt finalValue = iProgressInfo->Info().iFinalValue; + iProgressInfo->SetAndDraw( finalValue ); + // + delete iProgressDialog; + iProgressDialog = NULL; + // + delete this; + } + } + + User::ResetInactivityTime(); + } + else + { + delete iProgressDialog; + iProgressDialog = NULL; + // + delete this; + } + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::DoCancel() + { + if ( iEncoder ) + { + iEncoder->Cancel(); + } + + iDialogDismissed = ETrue; + } + + +TInt CMemSpyExportBitmapsToMemoryCardDialog::RunError( TInt /*aError*/ ) + { + TRAP_IGNORE( + + // Try the next image + if ( TryToExportSingleBitmapL() == EFalse ) + { + iDialogDismissed = ETrue; + delete this; + } + ); + // + return KErrNone; + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::DialogDismissedL( TInt /*aButtonId*/ ) + { + iDialogDismissed = ETrue; + iProgressDialog = NULL; + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::CompleteSelf( TInt aError ) + { + TRequestStatus* status = &iStatus; + User::RequestComplete( status, aError ); + SetActive(); + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::ExportBitmapL( const CMemSpyEngineFbServBitmap& aBitmap ) + { + // Create a filename + TFileName fileName( *iFolderName ); + aBitmap.GetExportableFileNameL( fileName ); + + // Create encoder object... + CImageEncoder* encoder = CImageEncoder::FileNewL( iFsSession, fileName, *iBmpMimeType ); + delete iEncoder; + iEncoder = encoder; + + // Start operation + iEncoder->Convert( &iStatus, aBitmap.Bitmap() ); + SetActive(); + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::IdentifyBmpMimeTypeL() + { + _LIT(KBmpExtension, ".bmp"); + CImageEncoder::GetFileTypesL( iMimeTypeArray ); + // + const TInt count = iMimeTypeArray.Count(); + // + for( TInt i=0; iFileExtension().FindF( KBmpExtension ) >= 0 ) + { + // Found it - save mime type info + iBmpMimeType = extension->MIMEType().AllocL(); + iMimeTypeArray.ResetAndDestroy(); + iMimeTypeArray.Close(); + return; + } + } + // + User::Leave( KErrNotFound ); + } + + +void CMemSpyExportBitmapsToMemoryCardDialog::PrepareFolderNameSpecL() + { + delete iFolderName; + iFolderName = NULL; + + // Make a unique filename format specifier. + TTime now; + now.HomeTime(); + const TDateTime dt( now.DateTime() ); + + // Build it up... + iFolderName = HBufC::NewL( KMaxFileName ); + TPtr pName( iFolderName->Des() ); + pName.Format( KMemSpyBitmapExportFolderAndFileName, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second()); + + // Create directory + const TInt error = iFsSession.MkDirAll( pName ); + User::LeaveIfError( error ); + } + + +TBool CMemSpyExportBitmapsToMemoryCardDialog::TryToExportSingleBitmapL() + { + TBool startedExport = EFalse; + + const TInt count = iBitmaps.Count(); + for( ; ( iBitmapIndex < count ) && ( startedExport == EFalse ); iBitmapIndex++ ) + { + const CMemSpyEngineFbServBitmap& memSpyBitmap = iBitmaps.At( iBitmapIndex ); + const CFbsBitmap& fbsBitmap = memSpyBitmap.Bitmap(); + const TSize size( fbsBitmap.SizeInPixels() ); + + // We don't want to export bitmaps which have a zero-pixel dimension. + if ( size.iHeight > 0 && size.iWidth > 0 ) + { + // This completes the object's request status and will therefore + // result in a further call to RunL() when the export to BMP + // is completed. + ExportBitmapL( memSpyBitmap ); + + // And indicate we managed to start an operation... + startedExport = ETrue; + } + } + // + return startedExport; + } + + + + + + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpySettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpySettings.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,300 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpySettings.h" + +// System includes +#include +#include + +// Engine includes +#include +#include +#include +#include + +#include + +// Constants +_LIT( KMemSpySettingsFileName, "settings.dat" ); //file or avkon client settings + +// Version 03 dumped some of the system wide memory tracker settings +const TInt KMemSpySettingsFileFormatVersion = 6; + +CMemSpySettings::CMemSpySettings( RFs& aFsSession, RMemSpySession& aSession ) +: iFsSession( aFsSession ), iMemSpySession( aSession ) + { + } + + +CMemSpySettings::~CMemSpySettings() + { + TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - START" ) ); + TRAP_IGNORE( StoreSettingsL() ); + TRACE( RDebug::Printf( "CMemSpySettings::~CMemSpySettings() - END" ) ); + } + + +void CMemSpySettings::ConstructL() + { + TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - START") ) ); + + TRAP_IGNORE( RestoreSettingsL() ); + + TRACE( RDebug::Print( _L("CMemSpySettings::ConstructL() - END") ) ); + } + +CMemSpySettings* CMemSpySettings::NewL( RFs& aFsSession, RMemSpySession& aSession ) + { + CMemSpySettings* self = new(ELeave) CMemSpySettings( aFsSession, aSession ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +void CMemSpySettings::GetSettingsFileNameL( TDes& aFileName ) + { + GetSettingsPathL( aFileName ); + aFileName.Append( KMemSpySettingsFileName ); + TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsFileNameL() - aFileName: %S"), &aFileName ) ); + } + + +void CMemSpySettings::GetSettingsPathL( TDes& aPath ) + { + TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - START") ) ); + aPath.Zero(); + + // Get private data cage path + TInt err = iFsSession.PrivatePath( aPath ); + TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - priv path err: %d"), err ) ); + User::LeaveIfError( err ); + + // Combine with C: drive + const TDriveUnit cDrive( EDriveC ); + const TDriveName cDriveName( cDrive.Name() ); + aPath.Insert( 0, cDriveName ); + + iFsSession.MkDirAll( aPath ); + TRACE( RDebug::Print( _L("CMemSpySettings::GetSettingsPathL() - END - %S"), &aPath ) ); + } + +RFile CMemSpySettings::SettingsFileLC( TBool aReplace ) + { + TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - START - aReplace: %d"), aReplace ) ); + + TFileName* fileName = new(ELeave) TFileName(); + CleanupStack::PushL( fileName ); + GetSettingsFileNameL( *fileName ); + TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - fileName: %S"), fileName ) ); + + RFile file; + TInt error = KErrNone; + // + if ( aReplace ) + { + error = file.Replace( iFsSession, *fileName, EFileWrite ); + TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - replace err: %d"), error ) ); + } + else + { + error = file.Open( iFsSession, *fileName, EFileWrite ); + TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - open err: %d"), error ) ); + // + if ( error == KErrNotFound ) + { + error = file.Create( iFsSession, *fileName, EFileWrite ); + } + } + // + User::LeaveIfError( error ); + CleanupStack::PopAndDestroy( fileName ); + CleanupClosePushL( file ); + // + TRACE( RDebug::Print( _L("CMemSpySettings::SettingsFileLC() - END") ) ); + return file; + } + + +void CMemSpySettings::StoreSettingsL() + { + TRACE( RDebug::Printf( "CMemSpySettings::StoreSettingsL() - START" ) ); + + RFile file = SettingsFileLC( ETrue ); + RFileWriteStream stream( file ); + CleanupStack::Pop(); // file + CleanupClosePushL( stream ); + + // Verion info + stream.WriteInt32L( KMemSpySettingsFileFormatVersion ); + + stream.WriteUint8L( iSinkType ); + + + // Get SWMT config + //CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); + //TMemSpyEngineHelperSysMemTrackerConfig swmtConfig; + //swmt.GetConfig( swmtConfig ); + + // Write SWMT settings + //stream.WriteInt32L( swmtConfig.TimerPeriod().Int() ); + //stream.WriteUint8L( swmtConfig.DumpData() ); + + stream.WriteInt32L( iSwmtConfig.TimerPeriod().Int() ); + stream.WriteUint8L( iSwmtConfig.DumpData() ); + + // Write memory tracking auto-start process list + /* + const RArray& processUidList = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList(); + stream.WriteInt32L( processUidList.Count() ); + for( TInt i=0; i 0 ) + { + stream.WriteL( swmtConfig.iThreadNameFilter, swmtConfig.iThreadNameFilter.Length() ); + } + + // Write mode + stream.WriteInt32L( swmtConfig.iMode ); + */ + if ( iSwmtConfig.iThreadNameFilter.Length() > 0 ) + { + stream.WriteL( iSwmtConfig.iThreadNameFilter, iSwmtConfig.iThreadNameFilter.Length() ); + } + + // Write mode + stream.WriteInt32L( iSwmtConfig.iMode ); + + stream.CommitL(); + CleanupStack::PopAndDestroy( &stream ); // Closes file + } + +void CMemSpySettings::RestoreSettingsL() + { + RFile file = SettingsFileLC(); + RFileReadStream stream( file ); + CleanupStack::Pop(); // file + CleanupClosePushL( stream ); + + // Version info + const TInt version = stream.ReadInt32L(); // discarded for now + TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - version: %d", version ) ); + + // Engine settings + TMemSpySinkType type = static_cast< TMemSpySinkType >( stream.ReadUint8L() ); + TRACE( RDebug::Printf( "CMemSpySettings::RestoreSettingsL() - read sinkType: %d", type ) ); + + //iEngine.InstallSinkL( type ); + //iMemSpySession.SwitchOutputSink( type ); //TODO: to argue to set stuf in engine from here + + // Set SWMT config + TMemSpyEngineHelperSysMemTrackerConfig swmtConfig; + swmtConfig.iTimerPeriod = TTimeIntervalMicroSeconds32( stream.ReadInt32L() ); + swmtConfig.iDumpData = static_cast< TBool >( stream.ReadUint8L() ); + + if ( version < 3 ) + { + // Restore but ignore old delta tracker settings which aren't used anymore + // + static_cast< TBool >( stream.ReadUint8L() ); + static_cast< TBool >( stream.ReadUint8L() ); + static_cast< TBool >( stream.ReadUint8L() ); + } + + // Restore memory tracking auto-start process uids if file format supports it... + if ( version >= 2 ) + { + RArray list; + CleanupClosePushL( list ); + // + const TInt count = stream.ReadInt32L(); + + //CArrayFixFlat* list = new(ELeave)CArrayFixFlat(count); + //CleanupStack::PushL(list ); + + for( TInt i=0; i> processUid; + // + User::LeaveIfError( list.Append( processUid ) ); + //list->AppendL( processUid ); + } + // + //CMemSpyEngineHelperProcess& processHelper = iEngine.HelperProcess(); + //processHelper.SetMemoryTrackingAutoStartProcessListL( list ); + //iMemSpySession.SetSwmtAutoStartProcessList( list ); + iUidList = list; //TODO: to get it into the engine + + CleanupStack::PopAndDestroy( &list ); + } + + // Restore memory tracking categories + if ( version > 3 ) + { + swmtConfig.iEnabledCategories = stream.ReadInt32L(); + } + + // Write heap tracking thread name filter + if ( version > 4 ) + { + TInt len = stream.ReadInt32L(); + if ( len > 0 ) + { + stream.ReadL( swmtConfig.iThreadNameFilter, len ); + } + } + + // Write mode + if ( version > 5 ) + { + swmtConfig.iMode = (TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode)stream.ReadInt32L(); + } + + //CMemSpyEngineHelperSysMemTracker& swmt = iEngine.HelperSysMemTracker(); + //swmt.SetConfigL( swmtConfig ); + //iMemSpySession.SetSwmtConfig( swmtConfig ); + + iSwmtConfig = swmtConfig; //TODO: to get it into the engine + + CleanupStack::PopAndDestroy( &stream ); // Closes file + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyUiUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyUiUtils.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,367 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyUiUtils.h" + +// System includes +#include +#include + + + + +void MemSpyUiUtils::Format( TDes& aBuf, TInt aResourceId, ...) + { + VA_LIST list; + VA_START(list,aResourceId); + TBuf<128> format; + CCoeEnv::Static()->ReadResource( format, aResourceId ); + aBuf.FormatList( format, list ); + } + + +void MemSpyUiUtils::GetErrorText( TDes& aBuf, TInt aError ) + { + if ( aError == KErrNotSupported ) + { + _LIT( KMemSpyErrorText, "Not Supported" ); + aBuf = KMemSpyErrorText; + } + else if ( aError == KErrNotReady ) + { + _LIT( KMemSpyErrorText, "Not Ready" ); + aBuf = KMemSpyErrorText; + } + else if ( aError == KErrNotFound ) + { + _LIT( KMemSpyErrorText, "Missing" ); + aBuf = KMemSpyErrorText; + } + else if ( aError == KErrGeneral ) + { + _LIT( KMemSpyErrorText, "General Error" ); + aBuf = KMemSpyErrorText; + } + else + { + _LIT( KMemSpyItemValueError, "Error: %d" ); + aBuf.Format( KMemSpyItemValueError, aError ); + } + } + +HBufC* MemSpyUiUtils::FormatItem( const TDesC& aCaption ) + { + HBufC* retBuf = HBufC::NewL( 32 ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + return retBuf; + } + +TDesC& MemSpyUiUtils::ThreadInfoItemNameByType( TMemSpyThreadInfoItemType aType ) + { + TPtrC pType( KTypeUnknown ); + + switch( aType ) + { + case EMemSpyThreadInfoItemTypeFirst: + pType.Set(KGeneral); + break; + case EMemSpyThreadInfoItemTypeHeap: + pType.Set(KHeap); + break; + case EMemSpyThreadInfoItemTypeStack: + pType.Set(KStack); + break; + case EMemSpyThreadInfoItemTypeChunk: + pType.Set(KChunks); + break; + case EMemSpyThreadInfoItemTypeCodeSeg: + pType.Set(KCodeSegs); + break; + case EMemSpyThreadInfoItemTypeOpenFiles: + pType.Set(KOpenFiles); + break; + case EMemSpyThreadInfoItemTypeActiveObject: + pType.Set(KActiveObjects); + break; + case EMemSpyThreadInfoItemTypeOwnedThreadHandles: + pType.Set(KThreadHandlers); + break; + case EMemSpyThreadInfoItemTypeOwnedProcessHandles: + pType.Set(KProcessHandlers); + break; + case EMemSpyThreadInfoItemTypeServer: + pType.Set(KServers); + break; + case EMemSpyThreadInfoItemTypeSession: + pType.Set(KConnections); + break; + case EMemSpyThreadInfoItemTypeSemaphore: + pType.Set(KSemaphores); + break; + case EMemSpyThreadInfoItemTypeOtherThreads: + pType.Set(KThreadReferences); + break; + case EMemSpyThreadInfoItemTypeOtherProcesses: + pType.Set(KProcessReferences); + break; + case EMemSpyThreadInfoItemTypeMutex: + pType.Set(KMutexes); + break; + case EMemSpyThreadInfoItemTypeTimer: + pType.Set(KTimers); + break; + case EMemSpyThreadInfoItemTypeLogicalChannel: + pType.Set(KDD); + break; + case EMemSpyThreadInfoItemTypeChangeNotifier: + pType.Set(KChangeNotif); + break; + case EMemSpyThreadInfoItemTypeUndertaker: + pType.Set(KUndertakers); + break; + case EMemSpyThreadInfoItemTypeLDD: + pType.Set(KLogicalDrivers); + break; + case EMemSpyThreadInfoItemTypePDD: + pType.Set(KPhysicalDrivers); + break; + + default: + break; + } + return pType; + } + + +void MemSpyUiUtils::AppendPriority( TDes& aDes, TProcessPriority aPriority ) + { + switch( aPriority ) + { + case EPriorityLow: + aDes += _L("[L]"); + break; + case EPriorityBackground: + aDes += _L("[B]"); + break; + case EPriorityForeground: + aDes += _L("[F]"); + break; + case EPriorityHigh: + aDes += _L("[H]"); + break; + case EPriorityWindowServer: + aDes += _L("[WS]"); + break; + case EPriorityFileServer: + aDes += _L("[FS]"); + break; + case EPriorityRealTimeServer: + aDes += _L("[RTS]"); + break; + case EPrioritySupervisor: + aDes += _L("[SUP]"); + break; + default: + aDes += _L("[?]"); + break; + } + } + +void MemSpyUiUtils::AppendExitInfo( TDes& aDes, TExitType aType, TInt aExitReason, const TDesC& aExitCategory ) + { + aDes.Append( '[' ); + const TInt length = aDes.Length(); + AppendExitType( aDes, aType ); + aDes.SetLength( length + 1 ); // Remove all but the first letter + aDes.Append( ']' ); + + if ( aType == EExitKill || aType == EExitPending ) + { + // Kill implies "clean" exit. Pending implies not yet dead. + } + else + { + TMemSpyTruncateOverflow overflow; + + // Terminate or Panic implies abnormal exit condition, so + // show full exit info. + _LIT( KAbnormalFormatSpec, " %S-%d" ); + aDes.AppendFormat( KAbnormalFormatSpec, &overflow, &aExitCategory, aExitReason ); + } + } + + +void MemSpyUiUtils::AppendExitType( TDes& aDes, TExitType aType ) + { + _LIT( KExitTypeKilled, "Killed" ); + _LIT( KExitTypeTerminated, "Terminated" ); + _LIT( KExitTypePanicked, "Panicked" ); + _LIT( KExitTypePending, "Pending" ); + + // Panic and Terminate are exceptional exit conditions. + // Kill, is ironically, not an exceptional condition. + switch( aType ) + { + case EExitKill: + aDes += KExitTypeKilled; + break; + case EExitTerminate: + aDes += KExitTypeTerminated; + break; + case EExitPanic: + aDes += KExitTypePanicked; + break; + default: + case EExitPending: + aDes += KExitTypePending; + break; + } + } + + +TPtrC MemSpyUiUtils::TypeAsString( TMemSpyDriverContainerType aType ) + { + TPtrC pType( KTypeUnknown ); + // + switch( aType ) + { + case EMemSpyDriverContainerTypeThread: + pType.Set( KTypeThread ); + break; + case EMemSpyDriverContainerTypeProcess: + pType.Set( KTypeProcess ); + break; + case EMemSpyDriverContainerTypeChunk: + pType.Set( KTypeChunk ); + break; + case EMemSpyDriverContainerTypeLibrary: + pType.Set( KTypeLibrary ); + break; + case EMemSpyDriverContainerTypeSemaphore: + pType.Set( KTypeSemaphore ); + break; + case EMemSpyDriverContainerTypeMutex: + pType.Set( KTypeMutex ); + break; + case EMemSpyDriverContainerTypeTimer: + pType.Set( KTypeTimer ); + break; + case EMemSpyDriverContainerTypeServer: + pType.Set( KTypeServer ); + break; + case EMemSpyDriverContainerTypeSession: + pType.Set( KTypeSession ); + break; + case EMemSpyDriverContainerTypeLogicalDevice: + pType.Set( KTypeLogicalDevice ); + break; + case EMemSpyDriverContainerTypePhysicalDevice: + pType.Set( KTypePhysicalDevice ); + break; + case EMemSpyDriverContainerTypeLogicalChannel: + pType.Set( KTypeLogicalChannel ); + break; + case EMemSpyDriverContainerTypeChangeNotifier: + pType.Set( KTypeChangeNotifier ); + break; + case EMemSpyDriverContainerTypeUndertaker: + pType.Set( KTypeUndertaker ); + break; + case EMemSpyDriverContainerTypeMsgQueue: + pType.Set( KTypeMsgQueue ); + break; + case EMemSpyDriverContainerTypePropertyRef: + pType.Set( KTypePropertyRef ); + break; + case EMemSpyDriverContainerTypeCondVar: + pType.Set( KTypeCondVar ); + break; + + default: + break; + } + // + return pType; + } + +TMemSpySizeText MemSpyUiUtils::FormatSizeText( const TInt64& aValue, TInt aDecimalPlaces, TBool aExtraRounding ) + { + _LIT(KFormatKilo, "%dK"); + _LIT(KFormatMega, "%SM"); + _LIT(KFormatGiga, "%SG"); + + TMemSpySizeText buf; + if ( aValue < 1024000 ) // If < 1000K + { + TInt sizeInK = 0; + + if ( aValue != 0 ) + { + sizeInK = I64INT( (aValue + 512) >> 10 ); + if (sizeInK < 1) + { + sizeInK = 1; + } + if (sizeInK > 999) + { + sizeInK = 999; + } + } + + buf.Format( KFormatKilo, sizeInK ); + } + else + { + TReal sizeInM = I64INT( aValue ); + sizeInM /= 1048576; + if ( sizeInM < 1 ) + { + sizeInM = 1; + } + + TPtrC pFormat( KFormatMega ); + if ( sizeInM >= 1000 ) + { + sizeInM /= 1024; // Size in G + if (sizeInM < 1) + { + sizeInM = 1; + } + + pFormat.Set( KFormatGiga ); + } + + if ( sizeInM > 999.9) + { + sizeInM = 999.9; + } + + if ( aExtraRounding ) + { + sizeInM += 0.499999; + } + + TBuf<16> size; + size.Num( sizeInM, TRealFormat( 14, aDecimalPlaces ) ); // Allow for "17179869184.0"G which is 2^64 + buf.Format( pFormat, &size ); + } + + return buf; + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewBase.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,422 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewBase.h" + +// System includes +#include // for example label control +#include +#include +#include +#include +#include +#include +#include +#include + +// Engine includes +#include +#include +#include + +// User includes +#include "MemSpyAppUi.h" +#include "MemSpyDocument.h" +#include "MemSpyContainer.h" +#include "MemSpyContainerObserver.h" + + + +/* +CMemSpyViewBase::CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: iEngine( aEngine ), iObserver( aObserver ) + { + } +*/ +CMemSpyViewBase::CMemSpyViewBase( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: iMemSpySession( aSession ), iObserver( aObserver ) + { + } + + +CMemSpyViewBase::~CMemSpyViewBase() + { + delete iListBox; + } + + +void CMemSpyViewBase::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* /*aSelectionRune*/ ) + { + iSettings = &static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() )->MemSpyDocument().Settings(); + // + User::LeaveIfError( SetParent( &aContainer ) ); + SetContainerWindowL( aContainer ); + + SetComponentsToInheritVisibility( ETrue ); + + iListBox = ConstructListBoxL(); + if ( iListBox ) + { + iListBox->SetFocus( ETrue ); + } + + SetRect( aRect ); + ActivateL(); + } + + +void CMemSpyViewBase::SetTitleL( const TDesC& aText ) + { + CEikStatusPane* statusPane = static_cast ( iEikonEnv->EikAppUi() )->StatusPane(); + CAknTitlePane* title = static_cast ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + title->SetTextL( aText ); + } + + +TPtrC CMemSpyViewBase::TitleL() const + { + TPtrC ret( KNullDesC ); + // + CEikStatusPane* statusPane = static_cast ( iEikonEnv->EikAppUi() )->StatusPane(); + CAknTitlePane* title = static_cast ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + if ( title->Text() ) + { + ret.Set( *title->Text() ); + } + // + return ret; + } + + +CMemSpyViewBase* CMemSpyViewBase::PrepareParentViewL() + { + return NULL; + } + + +CMemSpyViewBase* CMemSpyViewBase::PrepareChildViewL() + { + return NULL; + } + + +void CMemSpyViewBase::RefreshL() + { + if ( iListBox ) + { + iListBox->UpdateScrollBarsL(); + } + + DrawDeferred(); + } + + +TBool CMemSpyViewBase::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch( aCommand ) + { + case EMemSpyCmdViewOutputToSink: + OnCmdViewOutputToSinkL(); + break; + default: + handled = EFalse; + break; + } + // + return handled; + } + + +void CMemSpyViewBase::DynInitMenuPaneL( TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ ) + { + } + + +TUint CMemSpyViewBase::MenuCascadeResourceId() const + { + return 0; + } + + +TInt CMemSpyViewBase::MenuCascadeCommandId() const + { + return 0; + } + + +void CMemSpyViewBase::OnCmdViewOutputToSinkL() + { + //cigasto so solve - outputs content of the listbox into the sink + //to discuss format with Orbit + /* + if ( iListBox ) + { + // Prepare sink + CMemSpyEngineOutputSink& sink = iEngine.Sink(); + HBufC* name = MemSpyEngineUtils::CleanupTextLC( TitleL() ); + sink.OutputSectionHeadingL( *name, TChar('-') ); + CleanupStack::PopAndDestroy( name ); + sink.OutputPrefixSetLC( _L(" ") ); // Slight insertion + + // Get text from underlying listbox model... + MTextListBoxModel* model = static_cast< MTextListBoxModel* >( iListBox->Model() ); + const TInt count = model->NumberOfItems(); + + // First pass to get max lengths + TInt maxLengthCaption = 0; + TInt maxLengthValue = 0; + + for( TInt j=0; jItemText( j ) ); + const TInt length = pItem.Length(); + + // Check if its split or not? + const TInt splitPos = pItem.FindF( _L("\t\t") ); + if ( splitPos > 0 ) + { + maxLengthCaption = Max( maxLengthCaption, splitPos ); + maxLengthValue = Max( maxLengthValue, length - splitPos + 1 ); + } + else + { + maxLengthCaption = Max( maxLengthCaption, length ); + } + } + + // Second pass - real this time - to print the values + HBufC* line = HBufC::NewLC( ( maxLengthCaption + maxLengthValue ) + 20 ); + TPtr pLine( line->Des() ); + // + for( TInt i=0; iItemText( i ) ); + const TInt length = pItem.Length(); + // + TPtrC pCaption( KNullDesC ); + TPtrC pValue( KNullDesC ); + // + const TInt splitPos = pItem.FindF( _L("\t\t") ); + if ( splitPos > 0 ) + { + pCaption.Set( pItem.Left( splitPos ) ); + pValue.Set( pItem.Mid( splitPos + 1 ) ); + } + else + { + pCaption.Set( pItem ); + } + + // Remove initial tabs in caption + HBufC* caption = MemSpyEngineUtils::CleanupTextLC( pCaption ); + + // Create value item & replace any further tabs + HBufC* value = MemSpyEngineUtils::CleanupTextLC( pValue ); + + // Now format the final line, with padding. + pLine.Justify( *caption, maxLengthCaption + 3, ELeft, TChar(' ') ); + pLine.Append( *value ); + CleanupStack::PopAndDestroy( 2, caption ); + + // Sink output + sink.OutputLineL( pLine ); + } + + // Remove prefix & tidy up + CleanupStack::PopAndDestroy( line ); + sink.OutputBlankLineL(); + CleanupStack::PopAndDestroy(); // clear prefix + } + */ + } + + +CEikListBox* CMemSpyViewBase::ConstructListBoxL() + { + delete iListBox; + iListBox = NULL; + CAknSettingStyleListBox* listbox = new(ELeave) CAknSettingStyleListBox(); + iListBox = listbox; + // + listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); + listbox->SetContainerWindowL( *this ); + listbox->CreateScrollBarFrameL( ETrue ); + SetListBoxModelL(); + listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + listbox->SetListBoxObserver( this ); + listbox->SetObserver( this ); + listbox->SetComponentsToInheritVisibility( ETrue ); + // + return listbox; + } + + +void CMemSpyViewBase::HandleListBoxItemActionedL( TInt /*aIndex*/ ) + { + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewBase::HandleListBoxItemSelectedL( TInt /*aIndex*/ ) + { + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + +void CMemSpyViewBase::ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext ) + { + iObserver.HandleMemSpyViewEventL( aEvent, ViewType(), *this, aContext ); + } + + +void CMemSpyViewBase::SetListBoxCurrentItemIndexL( TInt aIndex ) + { + if ( iListBox ) + { + iListBox->SetCurrentItemIndex( aIndex ); + HandleListBoxItemSelectedL( aIndex ); + } + } + + +CMemSpyContainer& CMemSpyViewBase::Container() + { + CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() ); + return appUi->Container(); + } + + +CMemSpySettings& CMemSpyViewBase::Settings() + { + return *iSettings; + } + + +const CMemSpySettings& CMemSpyViewBase::Settings() const + { + return *iSettings; + } + + +void CMemSpyViewBase::Draw( const TRect& aRect ) const + { + CWindowGc& gc = SystemGc(); + // + gc.SetPenStyle( CGraphicsContext::ENullPen ); + gc.SetBrushColor( KRgbWhite ); + gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc.DrawRect( aRect ); + } + + +void CMemSpyViewBase::SizeChanged() + { + if ( iListBox ) + { + iListBox->SetRect( Rect() ); + } + } + + +void CMemSpyViewBase::FocusChanged(TDrawNow /*aDrawNow*/) + { + if ( iListBox ) + { + iListBox->SetFocus( IsFocused() ); + } + } + + +TInt CMemSpyViewBase::CountComponentControls() const + { + TInt count = 0; + if ( iListBox ) + { + ++count; + } + // + return count; + } + + +CCoeControl* CMemSpyViewBase::ComponentControl(TInt aIndex) const + { + switch ( aIndex ) + { + case 0: + return iListBox; + default: + return NULL; + } + } + + +TKeyResponse CMemSpyViewBase::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse resp = EKeyWasNotConsumed; + if ( iListBox ) + { + resp = iListBox->OfferKeyEventL( aKeyEvent, aType ); + } + // + if ( resp == EKeyWasNotConsumed && aType == EEventKeyDown && aKeyEvent.iCode == EKeyBackspace ) + { + // When backspace is pushed, go to the parent view + CMemSpyAppUi* appUi = static_cast< CMemSpyAppUi* >( iEikonEnv->EikAppUi() ); + appUi->Container().NavigateToParentViewL(); + resp = EKeyWasConsumed; + } + // + return resp; + } + + +void CMemSpyViewBase::HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ) + { + if ( aControl == iListBox ) + { + if ( aEventType == MCoeControlObserver::EEventStateChanged ) + { + const TInt index = iListBox->CurrentItemIndex(); + HandleListBoxItemSelectedL( index ); + } + } + } + + +void CMemSpyViewBase::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) + { + const TInt index = iListBox->CurrentItemIndex(); + // + switch (aEventType) + { + case EEventItemActioned: + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + HandleListBoxItemActionedL( index ); + break; + + default: + break; + } + } + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewChunkList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewChunkList.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,346 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewChunkList.h" + +// System includes +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" + + + +CMemSpyViewChunkBase::CMemSpyViewChunkBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList* aList ) +: CMemSpyViewBase( aEngine, aObserver ), iList( aList ) + { + } + + +CMemSpyViewChunkBase::~CMemSpyViewChunkBase() + { + delete iList; + } + + +TBool CMemSpyViewChunkBase::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdChunkSortByName: + iList->SortByNameL(); + CMemSpyViewBase::RefreshL(); + break; + case EMemSpyCmdChunkSortBySize: + iList->SortBySizeL(); + CMemSpyViewBase::RefreshL(); + break; + case EMemSpyCmdChunkListing: + OnCmdListingL(); + break; + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewChunkBase::OnCmdListingL() + { + // Begin a new data stream + _LIT( KMemSpyContext, "Chunk List" ); + _LIT( KMemSpyFolder, "Chunks" ); + iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); + + // Set prefix for overall listing + _LIT( KOverallPrefix, "Chunk List - " ); + iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); + + // Create header + CMemSpyEngineChunkList::OutputDataColumnsL( iEngine ); + + // List items + const TInt count = iList->Count(); + for(TInt i=0; iAt( i ); + // + entry.OutputDataL( iEngine.HelperChunk() ); + } + + // Tidy up + CleanupStack::PopAndDestroy(); // prefix + + // End data stream + iEngine.Sink().DataStreamEndL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewChunkBase( aEngine, aObserver, NULL ) + { + } + + +CMemSpyViewChunkList::CMemSpyViewChunkList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList ) +: CMemSpyViewChunkBase( aEngine, aObserver, &aList ) + { + } + + +void CMemSpyViewChunkList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Chunks" ); + SetTitleL( KTitle ); + + if ( iList == NULL ) + { + // Prepare code segment list + iList = iEngine.HelperChunk().ListL(); + } + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + if ( aSelectionRune != NULL ) + { + iCurrentChunk = reinterpret_cast< CMemSpyEngineChunkEntry* >( aSelectionRune ); + const TInt index = iList->ItemIndex( *iCurrentChunk ); + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + iListBox->DrawDeferred(); + } + + +TMemSpyViewType CMemSpyViewChunkList::ViewType() const + { + return EMemSpyViewTypeChunkList; + } + + +CMemSpyViewBase* CMemSpyViewChunkList::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewChunkList::PrepareChildViewL() + { + CMemSpyViewBase* child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *iList, *iCurrentChunk ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iList = NULL; + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewChunkList::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iList ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewChunkList::HandleListBoxItemActionedL( TInt aIndex ) + { + const TInt count = iList->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineChunkEntry& chunk = iList->At( aIndex ); + iCurrentChunk = &chunk; + } + else + { + iCurrentChunk = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewChunkList::HandleListBoxItemSelectedL( TInt aIndex ) + { + const TInt count = iList->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineChunkEntry& chunk = iList->At( aIndex ); + iCurrentChunk = &chunk; + } + else + { + iCurrentChunk = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewChunkDetails::CMemSpyViewChunkDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineChunkList& aList, CMemSpyEngineChunkEntry& aSelectedChunk ) +: CMemSpyViewChunkBase( aEngine, aObserver, &aList ), iChunk( aSelectedChunk ) + { + } + + +void CMemSpyViewChunkDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Chunk Details" ); + SetTitleL( KTitle ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewChunkDetails::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewChunkDetails::ViewType() const + { + return EMemSpyViewTypeChunkDetails; + } + + +CMemSpyViewBase* CMemSpyViewChunkDetails::PrepareParentViewL() + { + CMemSpyViewChunkList* parent = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver, *iList ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iList = NULL; + + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), &iChunk ); + CleanupStack::Pop( parent ); + return parent; + } + + +void CMemSpyViewChunkDetails::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &iChunk ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + + + + + + + + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewCodeSegList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewCodeSegList.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,500 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewCodeSegList.h" + +// System includes +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyViewThreads.h" +#include "MemSpyContainerObserver.h" +#include "MemSpyExportBitmapsToMemoryCardDialog.h" + + + +CMemSpyViewCodeSegBase::CMemSpyViewCodeSegBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList* aList ) +: CMemSpyViewBase( aEngine, aObserver ), iList( aList ) + { + } + + +CMemSpyViewCodeSegBase::~CMemSpyViewCodeSegBase() + { + delete iList; + } + + +TBool CMemSpyViewCodeSegBase::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdCodeSegSortByName: + iList->SortByFileNameL(); + CMemSpyViewBase::RefreshL(); + break; + case EMemSpyCmdCodeSegSortByCodeSize: + iList->SortByCodeSizeL(); + CMemSpyViewBase::RefreshL(); + break; + case EMemSpyCmdCodeSegSortByDataSize: + iList->SortByDataSizeL(); + CMemSpyViewBase::RefreshL(); + break; + case EMemSpyCmdCodeSegSortByUid: + iList->SortByUidsL(); + CMemSpyViewBase::RefreshL(); + break; + case EMemSpyCmdCodeSegListing: + OnCmdCodeSegmentListingL(); + break; + case EMemSpyCmdCodeSegShowItemsAll: + OnCmdShowItemsAllL(); + break; + case EMemSpyCmdCodeSegShowItemsGlobalData: + OnCmdShowItemsGlobalDataL(); + break; + + case EMemSpyCmdCodeSegShowCapsWithTCBProcess: + case EMemSpyCmdCodeSegShowCapsWithTCBAll: + OnCmdFilterByCapabilityL( ECapabilityTCB, aCommand == EMemSpyCmdCodeSegShowCapsWithTCBAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithCommDDProcess: + case EMemSpyCmdCodeSegShowCapsWithCommDDAll: + OnCmdFilterByCapabilityL( ECapabilityCommDD, aCommand == EMemSpyCmdCodeSegShowCapsWithCommDDAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess: + case EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll: + OnCmdFilterByCapabilityL( ECapabilityPowerMgmt, aCommand == EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess: + case EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll: + OnCmdFilterByCapabilityL( ECapabilityMultimediaDD, aCommand == EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess: + case EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll: + OnCmdFilterByCapabilityL( ECapabilityReadDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess: + case EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll: + OnCmdFilterByCapabilityL( ECapabilityWriteDeviceData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithDRMProcess: + case EMemSpyCmdCodeSegShowCapsWithDRMAll: + OnCmdFilterByCapabilityL( ECapabilityDRM, aCommand == EMemSpyCmdCodeSegShowCapsWithDRMAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess: + case EMemSpyCmdCodeSegShowCapsWithTrustedUIAll: + OnCmdFilterByCapabilityL( ECapabilityTrustedUI, aCommand == EMemSpyCmdCodeSegShowCapsWithTrustedUIAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithProtServProcess: + case EMemSpyCmdCodeSegShowCapsWithProtServAll: + OnCmdFilterByCapabilityL( ECapabilityProtServ, aCommand == EMemSpyCmdCodeSegShowCapsWithProtServAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess: + case EMemSpyCmdCodeSegShowCapsWithDiskAdminAll: + OnCmdFilterByCapabilityL( ECapabilityDiskAdmin, aCommand == EMemSpyCmdCodeSegShowCapsWithDiskAdminAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess: + case EMemSpyCmdCodeSegShowCapsWithNetworkControlAll: + OnCmdFilterByCapabilityL( ECapabilityNetworkControl, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkControlAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithAllFilesProcess: + case EMemSpyCmdCodeSegShowCapsWithAllFilesAll: + OnCmdFilterByCapabilityL( ECapabilityAllFiles, aCommand == EMemSpyCmdCodeSegShowCapsWithAllFilesAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithSwEventProcess: + case EMemSpyCmdCodeSegShowCapsWithSwEventAll: + OnCmdFilterByCapabilityL( ECapabilitySwEvent, aCommand == EMemSpyCmdCodeSegShowCapsWithSwEventAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess: + case EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll: + OnCmdFilterByCapabilityL( ECapabilityNetworkServices, aCommand == EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess: + case EMemSpyCmdCodeSegShowCapsWithLocalServicesAll: + OnCmdFilterByCapabilityL( ECapabilityLocalServices, aCommand == EMemSpyCmdCodeSegShowCapsWithLocalServicesAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess: + case EMemSpyCmdCodeSegShowCapsWithReadUserDataAll: + OnCmdFilterByCapabilityL( ECapabilityReadUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithReadUserDataAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess: + case EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll: + OnCmdFilterByCapabilityL( ECapabilityWriteUserData, aCommand == EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithLocationProcess: + case EMemSpyCmdCodeSegShowCapsWithLocationAll: + OnCmdFilterByCapabilityL( ECapabilityLocation, aCommand == EMemSpyCmdCodeSegShowCapsWithLocationAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess: + case EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll: + OnCmdFilterByCapabilityL( ECapabilitySurroundingsDD, aCommand == EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll ); + break; + case EMemSpyCmdCodeSegShowCapsWithUserEnvProcess: + case EMemSpyCmdCodeSegShowCapsWithUserEnvAll: + OnCmdFilterByCapabilityL( ECapabilityUserEnvironment, aCommand == EMemSpyCmdCodeSegShowCapsWithUserEnvAll ); + break; + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewCodeSegBase::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewCodeSegBase::OnCmdCodeSegmentListingL() + { + // Begin a new data stream + _LIT( KMemSpyContext, "CodeSeg List - " ); + _LIT( KMemSpyFolder, "CodeSegs" ); + iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); + + // Set prefix for overall listing + _LIT(KOverallPrefix, "CodeSeg List - "); + iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); + + // Create header + CMemSpyEngineCodeSegList::OutputDataColumnsL( iEngine ); + + // List items + const TInt count = iList->Count(); + for(TInt i=0; iAt( i ); + // + entry.OutputDataL( iEngine.HelperCodeSegment() ); + } + + // Tidy up + CleanupStack::PopAndDestroy(); // prefix + + // End data stream + iEngine.Sink().DataStreamEndL(); + } + + +void CMemSpyViewCodeSegBase::OnCmdShowItemsAllL() + { + iList->ShowAllL(); + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewCodeSegBase::OnCmdShowItemsGlobalDataL() + { + iList->ShowOnlyEntriesWithGlobalDataL(); + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewCodeSegBase::OnCmdFilterByCapabilityL( TCapability aCapability, TBool aAllBinaries ) + { + TMemSpyViewCodeSegFilter filterLogic( aCapability, aAllBinaries ); + TMemSpyEngineVisibiltyFunction filterFunction( TMemSpyViewCodeSegFilter::FilterItem, &filterLogic ); + iList->ShowL( filterFunction ); + CMemSpyViewBase::RefreshL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewCodeSegBase( aEngine, aObserver, NULL ) + { + } + + +CMemSpyViewCodeSegList::CMemSpyViewCodeSegList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList ) +: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList ) + { + } + + +void CMemSpyViewCodeSegList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Code Segments" ); + SetTitleL( KTitle ); + + if ( iList == NULL ) + { + // Prepare code segment list + iList = iEngine.HelperCodeSegment().CodeSegmentListL(); + iList->SortByCodeSizeL(); + } + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + if ( aSelectionRune != NULL ) + { + iCurrentCodeSegment = reinterpret_cast< CMemSpyEngineCodeSegEntry* >( aSelectionRune ); + const TInt index = iList->ItemIndex( *iCurrentCodeSegment ); + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + iListBox->DrawDeferred(); + } + + +TMemSpyViewType CMemSpyViewCodeSegList::ViewType() const + { + return EMemSpyViewTypeCodeSegmentList; + } + + +CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewCodeSegList::PrepareChildViewL() + { + CMemSpyViewBase* child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *iList, *iCurrentCodeSegment ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iList = NULL; + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewCodeSegList::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iList ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewCodeSegList::HandleListBoxItemActionedL( TInt aIndex ) + { + const TInt count = iList->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex ); + iCurrentCodeSegment = &codeSeg; + } + else + { + iCurrentCodeSegment = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewCodeSegList::HandleListBoxItemSelectedL( TInt aIndex ) + { + const TInt count = iList->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineCodeSegEntry& codeSeg = iList->At( aIndex ); + iCurrentCodeSegment = &codeSeg; + } + else + { + iCurrentCodeSegment = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewCodeSegDetails::CMemSpyViewCodeSegDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineCodeSegList& aList, CMemSpyEngineCodeSegEntry& aSelectedCodeSegment ) +: CMemSpyViewCodeSegBase( aEngine, aObserver, &aList ), iCodeSegment( aSelectedCodeSegment ) + { + } + + +void CMemSpyViewCodeSegDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Code Segment Details" ); + SetTitleL( KTitle ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewCodeSegDetails::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewCodeSegDetails::ViewType() const + { + return EMemSpyViewTypeCodeSegmentDetails; + } + + +CMemSpyViewBase* CMemSpyViewCodeSegDetails::PrepareParentViewL() + { + CMemSpyViewCodeSegList* parent = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver, *iList ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iList = NULL; + + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), &iCodeSegment ); + CleanupStack::Pop( parent ); + return parent; + } + + +void CMemSpyViewCodeSegDetails::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &iCodeSegment ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + + + + + + + + + + + + + + + + + + + + +TBool TMemSpyViewCodeSegFilter::FilterItem( const CMemSpyEngineCodeSegEntry*& aItem, TAny* aRune ) + { + TMemSpyViewCodeSegFilter* self = reinterpret_cast< TMemSpyViewCodeSegFilter* >( aRune ); + + TBool match = aItem->HasCapability( self->iCapability ); + if ( match && self->iAllBinaries == EFalse ) + { + // We're only looking for EXE's... + TParsePtrC parser( aItem->FileName() ); + const TPtrC pExtension( parser.Ext() ); + _LIT(KProcessExtension, ".exe"); + // + match = ( pExtension.CompareF( KProcessExtension ) == 0 ); + } + // + return match; + } + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewDriveInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewDriveInfo.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,381 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewDriveInfo.h" + +// System includes +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" + + + +CMemSpyViewDriveInfoBase::CMemSpyViewDriveInfoBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +CMemSpyViewDriveInfoBase::~CMemSpyViewDriveInfoBase() + { + if ( iList ) + { + iList->SetObserver( NULL ); + } + // + delete iList; + } + + +void CMemSpyViewDriveInfoBase::BaseConstructL() + { + iList = iEngine.HelperFileSystem().DriveListL(); + } + + +TBool CMemSpyViewDriveInfoBase::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( EFalse ), iDriveNumber( EDriveA ) + { + } + + +CMemSpyViewDriveList::CMemSpyViewDriveList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ) +: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iUseDriveNumber( ETrue ), iDriveNumber( aDriveNumber ) + { + } + + +void CMemSpyViewDriveList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + BaseConstructL(); + + _LIT( KTitle, "Drive Summary" ); + SetTitleL( KTitle ); + + // Start watching list + iList->SetObserver( this ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + if ( iUseDriveNumber ) + { +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iDriveNumber: %c:", iDriveNumber + 'A' ); +#endif + iCurrentDrive = iList->EntryByDriveNumber( iDriveNumber ); + +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - iCurrentDrive: 0x%08x", iCurrentDrive ); +#endif + if ( iCurrentDrive ) + { + const TInt index = iList->ItemIndex( *iCurrentDrive ); +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewDriveList::ConstructL() - index: %d", index ); +#endif + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + } + + iListBox->DrawDeferred(); + } + + +TMemSpyViewType CMemSpyViewDriveList::ViewType() const + { + return EMemSpyViewTypeDriveSummary; + } + + +CMemSpyViewBase* CMemSpyViewDriveList::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + // + if ( parent ) + { + iList->SetObserver( NULL ); + } + // + return parent; + } + + +CMemSpyViewBase* CMemSpyViewDriveList::PrepareChildViewL() + { + ASSERT( iCurrentDrive ); + CMemSpyViewBase* child = new(ELeave) CMemSpyViewDriveInfo( iEngine, iObserver, iCurrentDrive->DriveNumber() ); + + // Stop watching list + if ( child ) + { + iList->SetObserver( NULL ); + } + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iList = NULL; + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewDriveList::RefreshL() + { + if ( iList ) + { + iList->SetObserver( NULL ); + } + // + CMemSpyEngineDriveList* list = iEngine.HelperFileSystem().DriveListL(); + delete iList; + iList = list; + iList->SetObserver( this ); + // + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewDriveList::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iList ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewDriveList::HandleListBoxItemActionedL( TInt aIndex ) + { + const TInt count = iList->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineDriveEntry& entry = iList->At( aIndex ); + iCurrentDrive = &entry; + } + else + { + iCurrentDrive = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewDriveList::HandleListBoxItemSelectedL( TInt aIndex ) + { + const TInt count = iList->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineDriveEntry& entry = iList->At( aIndex ); + iCurrentDrive = &entry; + } + else + { + iCurrentDrive = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + +void CMemSpyViewDriveList::HandleDriveListChangedL( const CMemSpyEngineDriveList& /*aList*/ ) + { + RefreshL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewDriveInfo::CMemSpyViewDriveInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TDriveNumber aDriveNumber ) +: CMemSpyViewDriveInfoBase( aEngine, aObserver ), iDriveNumber( aDriveNumber ) + { + } + + +void CMemSpyViewDriveInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + BaseConstructL(); + // + iDriveInfo = iList->EntryByDriveNumber( iDriveNumber ); + if ( !iDriveInfo ) + { + User::Leave( KErrNotFound ); + } + iDriveInfo->SetObserver( this ); + + _LIT( KTitleFormat, "Drive %S Info" ); + const TDriveName name( iDriveInfo->DriveUnit().Name() ); + TName title; + title.Format( KTitleFormat, &name ); + SetTitleL( title ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewDriveInfo::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewDriveInfo::ViewType() const + { + return EMemSpyViewTypeDriveInfo; + } + + +CMemSpyViewBase* CMemSpyViewDriveInfo::PrepareParentViewL() + { + ASSERT( iDriveInfo ); + CMemSpyViewDriveList* parent = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver, iDriveInfo->DriveNumber() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( parent ); + // + if ( parent ) + { + iDriveInfo->SetObserver( NULL ); + } + // + return parent; + } + + +void CMemSpyViewDriveInfo::SetListBoxModelL() + { + if ( iDriveInfo ) + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iDriveInfo ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + } + + +void CMemSpyViewDriveInfo::HandleDriveEntryChangedL( const CMemSpyEngineDriveEntry& /*aEntry*/ ) + { + RefreshL(); + } + + + + + + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewECom.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewECom.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,475 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewECom.h" + +// System includes +#include + +// Engine includes +#include +#include + +// User includes +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + + + +CMemSpyViewECom::CMemSpyViewECom( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +void CMemSpyViewECom::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "ECom" ); + SetTitleL( KTitle ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Select first item + TInt index = KErrNotFound; + if ( aSelectionRune != NULL ) + { + iCurrent = reinterpret_cast< CMemSpyEngineEComCategory* >( aSelectionRune ); + index = iEngine.HelperECom().IndexOf( *iCurrent ); + } + + if ( index >= 0 && index < iEngine.HelperECom().Count() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + iListBox->DrawDeferred(); + } + } + + +void CMemSpyViewECom::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewECom::ViewType() const + { + return EMemSpyViewTypeECom; + } + + +CMemSpyViewBase* CMemSpyViewECom::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewECom::PrepareChildViewL() + { + CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, *iCurrent ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewECom::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &iEngine.HelperECom() ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewECom::HandleListBoxItemActionedL( TInt aIndex ) + { + const TInt count = iEngine.HelperECom().Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex ); + iCurrent = &category; + } + else + { + iCurrent = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewECom::HandleListBoxItemSelectedL( TInt aIndex ) + { + const TInt count = iEngine.HelperECom().Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineEComCategory& category = iEngine.HelperECom().At( aIndex ); + iCurrent = &category; + } + else + { + iCurrent = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + + + + + + + + + + + + +CMemSpyViewEComCategory::CMemSpyViewEComCategory( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComCategory& aCategory ) +: CMemSpyViewBase( aEngine, aObserver ), iCategory( aCategory ) + { + } + + +void CMemSpyViewEComCategory::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + SetTitleL( iCategory.Name() ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Select first item + TInt index = KErrNotFound; + if ( aSelectionRune != NULL ) + { + iCurrent = reinterpret_cast< CMemSpyEngineEComInterface* >( aSelectionRune ); + index = iCategory.IndexOf( *iCurrent ); + } + + if ( index >= 0 && index < iCategory.Count() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + iListBox->DrawDeferred(); + } + } + + +void CMemSpyViewEComCategory::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewEComCategory::ViewType() const + { + return EMemSpyViewTypeEComCategory; + } + + +CMemSpyViewBase* CMemSpyViewEComCategory::PrepareParentViewL() + { + CMemSpyViewECom* parent = new(ELeave) CMemSpyViewECom( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), &iCategory ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewEComCategory::PrepareChildViewL() + { + CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, *iCurrent ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewEComCategory::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &iCategory ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewEComCategory::HandleListBoxItemActionedL( TInt aIndex ) + { + const TInt count = iCategory.Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineEComInterface& entry = iCategory.At( aIndex ); + iCurrent = &entry; + } + else + { + iCurrent = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewEComCategory::HandleListBoxItemSelectedL( TInt aIndex ) + { + const TInt count = iCategory.Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineEComInterface& entry = iCategory.At( aIndex ); + iCurrent = &entry; + } + else + { + iCurrent = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewEComInterface::CMemSpyViewEComInterface( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComInterface& aInterface ) +: CMemSpyViewBase( aEngine, aObserver ), iInterface( aInterface ) + { + } + + +void CMemSpyViewEComInterface::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + SetTitleL( iInterface.Name() ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Select first item + TInt index = KErrNotFound; + if ( aSelectionRune != NULL ) + { + iCurrent = reinterpret_cast< CMemSpyEngineEComImplementation* >( aSelectionRune ); + index = iInterface.IndexOf( *iCurrent ); + } + + if ( index >= 0 && index < iInterface.Count() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + iListBox->DrawDeferred(); + } + } + + +void CMemSpyViewEComInterface::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewEComInterface::ViewType() const + { + return EMemSpyViewTypeEComInterface; + } + + +CMemSpyViewBase* CMemSpyViewEComInterface::PrepareParentViewL() + { + CMemSpyViewEComCategory* parent = new(ELeave) CMemSpyViewEComCategory( iEngine, iObserver, iInterface.Category() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), &iInterface ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewEComInterface::PrepareChildViewL() + { + CMemSpyViewBase* child = new(ELeave) CMemSpyViewEComImplementation( iEngine, iObserver, *iCurrent ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewEComInterface::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &iInterface ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewEComInterface::HandleListBoxItemActionedL( TInt aIndex ) + { + const TInt count = iInterface.Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex ); + iCurrent = &entry; + } + else + { + iCurrent = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewEComInterface::HandleListBoxItemSelectedL( TInt aIndex ) + { + const TInt count = iInterface.Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineEComImplementation& entry = iInterface.At( aIndex ); + iCurrent = &entry; + } + else + { + iCurrent = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewEComImplementation::CMemSpyViewEComImplementation( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineEComImplementation& aImplementation ) +: CMemSpyViewBase( aEngine, aObserver ), iImplementation( aImplementation ) + { + } + + +void CMemSpyViewEComImplementation::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + SetTitleL( iImplementation.Name() ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Select first item + if ( iImplementation.MdcaCount() ) + { + iListBox->SetCurrentItemIndex( 0 ); + HandleListBoxItemSelectedL( 0 ); + iListBox->DrawDeferred(); + } + } + + +void CMemSpyViewEComImplementation::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewEComImplementation::ViewType() const + { + return EMemSpyViewTypeEComImplementation; + } + + +CMemSpyViewBase* CMemSpyViewEComImplementation::PrepareParentViewL() + { + CMemSpyViewEComInterface* parent = new(ELeave) CMemSpyViewEComInterface( iEngine, iObserver, iImplementation.Interface() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), &iImplementation ); + CleanupStack::Pop( parent ); + return parent; + } + + +void CMemSpyViewEComImplementation::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &iImplementation ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewFBServBitmaps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewFBServBitmaps.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,746 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewFBServBitmaps.h" + +// System includes +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyViewThreads.h" +#include "MemSpyContainerObserver.h" +#include "MemSpyExportBitmapsToMemoryCardDialog.h" + +// Constants +const TInt KMemSpyIdleResetListboxTimerPeriod = 500000; +const TInt KMemSpyImageSlideshowPeriod = 1000000; + + + +CMemSpyViewFBServBase::CMemSpyViewFBServBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ) +: CMemSpyViewBase( aEngine, aObserver ), iBitmaps( aBitmaps ) + { + } + + +CMemSpyViewFBServBase::~CMemSpyViewFBServBase() + { +#ifdef _DEBUG + RDebug::Printf("CMemSpyViewFBServBase::~CMemSpyViewFBServBase() - deleting bitmaps: 0x%08x", iBitmaps ); +#endif + delete iBitmaps; + } + + +TBool CMemSpyViewFBServBase::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdImagesSlideshow: + OnCmdSlideShowL(); + break; +#ifndef __WINS__ + case EMemSpyCmdImagesSaveAllToMemoryCard: + OnCmdExportToMemoryCardL(); + break; +#endif + case EMemSpyCmdImagesListing: + OnCmdImageListingL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewFBServBase::OnCmdSlideShowL() + { + TInt index = 0; + CMemSpyViewFBServSlideshow::NewLD( *iBitmaps, index ); + + // Select the item that was last displayed + const TInt count = iBitmaps->Count(); + if ( iListBox && index >= 0 && index < count ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + DrawDeferred(); + } + } + + +void CMemSpyViewFBServBase::OnCmdExportToMemoryCardL() + { + // Deletes itself + CMemSpyExportBitmapsToMemoryCardDialog::NewL( iCoeEnv->FsSession(), *iBitmaps ); + } + + +void CMemSpyViewFBServBase::OnCmdImageListingL() + { + // Begin a new data stream + _LIT( KMemSpyContext, "Bitmap List - " ); + _LIT( KMemSpyFolder, "Bitmaps" ); + iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); + + // Set prefix for overall listing + _LIT(KOverallPrefix, "Bitmap List - "); + iEngine.Sink().OutputPrefixSetLC( KOverallPrefix ); + + // Create header + CMemSpyEngineFbServBitmap::OutputDataColumnsL( iEngine ); + + // List items + const TInt count = iBitmaps->Count(); + for(TInt i=0; iAt( i ); + // + bitmap.OutputDataL( iEngine ); + } + + // Tidy up + CleanupStack::PopAndDestroy(); // prefix + + // End data stream + iEngine.Sink().DataStreamEndL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewFBServBase( aEngine, aObserver, NULL ) + { +#ifdef _DEBUG + RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(1) - iBitmaps is: 0x%08x", iBitmaps ); +#endif + } + + +CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps ) +: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ) + { +#ifdef _DEBUG + RDebug::Printf("CMemSpyViewFBServBitmaps::CMemSpyViewFBServBitmaps(2) - iBitmaps is: 0x%08x", iBitmaps ); +#endif + } + + +CMemSpyViewFBServBitmaps::~CMemSpyViewFBServBitmaps() + { + delete iIdleResetListboxTimer; + iBitmapHandles.Close(); + } + + +void CMemSpyViewFBServBitmaps::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Font & Bitmap Server" ); + SetTitleL( KTitle ); + + if ( iBitmaps == NULL ) + { + // Prepare bitmap handles + iEngine.HelperFbServ().GetArrayOfBitmapHandlesL( iBitmapHandles ); + + // Create bitmap array - construction occurs asynchronously + iBitmaps = CMemSpyEngineFbServBitmapArray::NewL( CActive::EPriorityIdle, iBitmapHandles, *this ); + } + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Create idle listbox refresh timer + if ( iBitmaps->Count() == 0 ) + { + iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityLow ); + } + else + { + if ( aSelectionRune != NULL ) + { + iCurrentBitmap = reinterpret_cast< CMemSpyEngineFbServBitmap* >( aSelectionRune ); + const TInt index = iBitmaps->BitmapIndexByHandle( iCurrentBitmap->Handle() ); + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + iListBox->DrawDeferred(); + } + } + + +void CMemSpyViewFBServBitmaps::RefreshL() + { +#ifdef _DEBUG + RDebug::Printf("CMemSpyViewFBServBitmaps::RefreshL() - iBitmaps->Count(): %d", iBitmaps->Count()); +#endif + + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewFBServBitmaps::ViewType() const + { + return EMemSpyViewTypeFBServBitmaps; + } + + +CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewFBServBitmaps::PrepareChildViewL() + { + CMemSpyViewBase* child = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, *iCurrentBitmap ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iBitmaps = NULL; + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewFBServBitmaps::HandleFbServBitmapArrayEventL( TEvent aEvent ) + { + if ( aEvent == EBitmapItemsCreated ) + { + } + else if ( aEvent == EBitmapArrayConstructionComplete ) + { + } + // + iIdleResetListboxTimer->Cancel(); + iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod/2, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) ); + } + + +void CMemSpyViewFBServBitmaps::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iBitmaps ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewFBServBitmaps::HandleListBoxItemActionedL( TInt aIndex ) + { + const TInt count = iBitmaps->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex ); + iCurrentBitmap = &bitmap; + } + else + { + iCurrentBitmap = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewFBServBitmaps::HandleListBoxItemSelectedL( TInt aIndex ) + { + const TInt count = iBitmaps->Count(); + if ( aIndex >= 0 && aIndex < count ) + { + CMemSpyEngineFbServBitmap& bitmap = iBitmaps->At( aIndex ); + iCurrentBitmap = &bitmap; + } + else + { + iCurrentBitmap = NULL; + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + +TInt CMemSpyViewFBServBitmaps::IdleUpdateListBoxModel( TAny* aSelf ) + { + CMemSpyViewFBServBitmaps* self = reinterpret_cast< CMemSpyViewFBServBitmaps* >( aSelf ); + TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() ); + return EFalse; + } + + +void CMemSpyViewFBServBitmaps::DoIdleUpdateListBoxModelL() + { + // Try to maintain current item selection if at all possible. + TInt handle = 0; + if ( iCurrentBitmap ) + { + handle = iCurrentBitmap->Handle(); + iCurrentBitmap = NULL; + } + + // Update list box & model + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); + + // Try to select previous item if it is still available + const TInt index = iBitmaps->BitmapIndexByHandle( handle ); + if ( index >= 0 && index < iBitmaps->Count() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + iIdleResetListboxTimer->Cancel(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ) +: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap ) + { +#ifdef _DEBUG + RDebug::Printf("CMemSpyViewFBServBitmapInfo::CMemSpyViewFBServBitmapInfo() - iBitmaps is: 0x%08x", iBitmaps ); +#endif + } + + +void CMemSpyViewFBServBitmapInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Bitmap Details" ); + SetTitleL( KTitle ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + if ( iBitmaps->Count() ) + { + iListBox->SetCurrentItemIndex( 0 ); + HandleListBoxItemSelectedL( 0 ); + } + } + + +void CMemSpyViewFBServBitmapInfo::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewFBServBitmapInfo::ViewType() const + { + return EMemSpyViewTypeFBServBitmapInfo; + } + + +CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareParentViewL() + { + CMemSpyViewFBServBitmaps* parent = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver, iBitmaps ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iBitmaps = NULL; + + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), &iBitmapObject ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewFBServBitmapInfo::PrepareChildViewL() + { + CMemSpyViewFBServBitmapViewer* child = new(ELeave) CMemSpyViewFBServBitmapViewer( iEngine, iObserver, iBitmaps, iBitmapObject ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iBitmaps = NULL; + + CleanupStack::PushL( child ); + CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() ); + const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() ); + child->ConstructL( rect, *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewFBServBitmapInfo::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &iBitmapObject ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewFBServBitmapInfo::HandleListBoxItemActionedL( TInt aIndex ) + { + // Only report the event if its the first item that was actioned + if ( aIndex == 0 ) + { + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyEngineFbServBitmapArray* aBitmaps, CMemSpyEngineFbServBitmap& aSelectedBitmap ) +: CMemSpyViewFBServBase( aEngine, aObserver, aBitmaps ), iBitmapObject( aSelectedBitmap ) + { +#ifdef _DEBUG + RDebug::Printf("CMemSpyViewFBServBitmapViewer::CMemSpyViewFBServBitmapViewer() - iBitmaps is: 0x%08x", iBitmaps ); +#endif + } + + +CMemSpyViewFBServBitmapViewer::~CMemSpyViewFBServBitmapViewer() + { + delete iImage; + } + + +void CMemSpyViewFBServBitmapViewer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Bitmap Preview" ); + SetTitleL( KTitle ); + + // Finish construction + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Prepare image + iImage = new(ELeave) CEikImage(); + iImage->SetContainerWindowL( *this ); + iImage->SetPicture( &iBitmapObject.Bitmap(), NULL ); + iImage->SetPictureOwnedExternally( ETrue ); + SizeChanged(); + } + + +void CMemSpyViewFBServBitmapViewer::RefreshL() + { + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewFBServBitmapViewer::ViewType() const + { + return EMemSpyViewTypeFBServBitmapViewer; + } + + +CMemSpyViewBase* CMemSpyViewFBServBitmapViewer::PrepareParentViewL() + { + CMemSpyViewFBServBitmapInfo* parent = new(ELeave) CMemSpyViewFBServBitmapInfo( iEngine, iObserver, iBitmaps, iBitmapObject ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + iBitmaps = NULL; + + CleanupStack::PushL( parent ); + CEikAppUi* appUi = static_cast< CEikAppUi* >( iEikonEnv->AppUi() ); + const TRect rect( TPoint( 0, 0 ), appUi->ClientRect().Size() ); + parent->ConstructL( rect, *Parent() ); + CleanupStack::Pop( parent ); + return parent; + } + + +void CMemSpyViewFBServBitmapViewer::SetListBoxModelL() + { + } + + +CEikListBox* CMemSpyViewFBServBitmapViewer::ConstructListBoxL() + { + return NULL; + } + + +void CMemSpyViewFBServBitmapViewer::Draw( const TRect& /*aRect*/ ) const + { + CWindowGc& gc = SystemGc(); + // + gc.SetPenStyle( CGraphicsContext::ENullPen ); + gc.SetBrushColor( KRgbWhite ); + gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc.DrawRect( Rect() ); + // + gc.SetBrushColor( KRgbBlack ); + gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); + gc.DrawRect( iBorderRect ); + } + + +void CMemSpyViewFBServBitmapViewer::SizeChanged() + { + TRect rect( Rect() ); + TSize size( rect.Size() ); + // + TSize bitmapSize( iBitmapObject.Bitmap().SizeInPixels() ); + + // Try to center image, if possible. + if ( bitmapSize.iWidth < size.iWidth ) + { + const TInt offset = ( size.iWidth - bitmapSize.iWidth) / 2; + rect.Move( offset, 0 ); + size.iWidth = bitmapSize.iWidth; + } + if ( bitmapSize.iHeight < size.iHeight ) + { + const TInt offset = ( size.iHeight - bitmapSize.iHeight) / 2; + rect.Move( 0, offset ); + size.iHeight = bitmapSize.iHeight; + } + // + rect.SetSize( size ); + if ( iImage ) + { + iImage->SetRect( rect ); + } + iBorderRect = rect; + iBorderRect.Grow( 2, 2 ); + } + + +TInt CMemSpyViewFBServBitmapViewer::CountComponentControls() const + { + TInt count = 0; + // + if ( iImage ) + { + ++count; + } + // + return count; + } + + +CCoeControl* CMemSpyViewFBServBitmapViewer::ComponentControl( TInt /*aIndex*/ ) const + { + return iImage; + } + + + + + + + + + + + + + + + + + +CMemSpyViewFBServSlideshow::CMemSpyViewFBServSlideshow( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ) +: iBitmaps( aBitmaps ), iIndex( aIndex ) + { + } + + +CMemSpyViewFBServSlideshow::~CMemSpyViewFBServSlideshow() + { + delete iTimer; + } + + +void CMemSpyViewFBServSlideshow::ConstructL() + { + iTimer = CPeriodic::NewL( CActive::EPriorityLow ); + iTimer->Start( KMemSpyImageSlideshowPeriod, KMemSpyImageSlideshowPeriod, TCallBack( IdleUpdate, this ) ); + } + + +void CMemSpyViewFBServSlideshow::NewLD( CMemSpyEngineFbServBitmapArray& aBitmaps, TInt& aIndex ) + { + CMemSpyViewFBServSlideshow* self = new(ELeave) CMemSpyViewFBServSlideshow( aBitmaps, aIndex ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + // + self->ExecuteLD( R_MEMSPY_IMAGE_SLIDESHOW ); + } + + +void CMemSpyViewFBServSlideshow::PreLayoutDynInitL() + { + ShowNextImageL(); + } + + +TBool CMemSpyViewFBServSlideshow::OkToExitL( TInt /*aButtonId*/ ) + { + return ETrue; + } + + +TInt CMemSpyViewFBServSlideshow::IdleUpdate( TAny* aSelf ) + { + CMemSpyViewFBServSlideshow* self = reinterpret_cast< CMemSpyViewFBServSlideshow* >( aSelf ); + TRAP_IGNORE( self->ShowNextImageL() ); + return EFalse; + } + + +void CMemSpyViewFBServSlideshow::ShowNextImageL() + { + CEikImage* imageControl = static_cast< CEikImage* >( Control(EMemSpyCtrlIdSlideShowImage) ); + + // Get the right image + const TInt imageCount = iBitmaps.Count(); + if ( iIndex < imageCount ) + { + CMemSpyEngineFbServBitmap& bitmap = iBitmaps.At( iIndex ); + imageControl->SetPicture( &bitmap.Bitmap(), NULL ); + imageControl->SetPictureOwnedExternally( ETrue ); + + // Prepare title + const TSize size( bitmap.Bitmap().SizeInPixels() ); + _LIT(KTitleFormat, "%3d x %3d"); + TBuf<128> title; + title.Format( KTitleFormat, size.iWidth, size.iHeight ); + SetTitleL( title ); + // + User::ResetInactivityTime(); + // + Layout(); + // + ++iIndex; + } + else + { + // Dismiss myself. + delete this; + } + } + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewHeapTracking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewHeapTracking.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,488 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewHeapTracking.h" + +// System includes +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" +#include "MemSpyViewHeapTrackingSettings.h" +#include "MemSpyViewHeapTrackingResults.h" + + + +CMemSpyViewHeapTracking::CMemSpyViewHeapTracking( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ), + iState( EMemSpyViewHeapTrackingStateIdle ) + { + /* + if ( iEngine.HelperSysMemTracker().IsActive() ) + { + iState = EMemSpyViewHeapTrackingStateTimerOn; + } + */ + } + + +CMemSpyViewHeapTracking::~CMemSpyViewHeapTracking() + { + delete iStopTimerCallBack; + //iEngine.HelperSysMemTracker().RemoveObserver( this ); + } + + +void CMemSpyViewHeapTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "System-Wide Memory Tracking" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Backup current config because it may be overwritten with Basic/Full mode settings. + TMemSpyEngineHelperSysMemTrackerConfig config; + + GetSwmtConfig( config ); + + iOriginalConfig = config; + + if ( config.iMode != TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom ) + { + // Set config. Needed for updating config for Basic or Full mode. + SetConfigByModeL( config.iMode, config ); + } + + // Make sure the correct item is selected + TInt index = 0; + if ( aSelectionRune != NULL ) + { + const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); + index = IndexByViewType( viewType ); + } + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + +void CMemSpyViewHeapTracking::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::SizeChanged(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewHeapTracking::ViewType() const + { + return EMemSpyViewTypeHeapTracking; + } + + +CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareParentViewL() + { + + // Save custom settings even if mode is Basic or Full + TRAP_IGNORE( + iMemSpySession.SetSwmtCategoriesL( iOriginalConfig.iEnabledCategories ); + iMemSpySession.SetSwmtFilter( iOriginalConfig.iThreadNameFilter ); + iMemSpySession.SetSwmtHeapDumpsEnabledL( iOriginalConfig.iDumpData ); + Settings().StoreSettingsL(); + ); + + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewHeapTracking::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + const TInt index = iListBox->CurrentItemIndex(); + + // Get current config + TMemSpyEngineHelperSysMemTrackerConfig config; + + GetSwmtConfig( config ); + + // + if ( index == 0 ) + { + // This is the start/stop toggle so we don't make a child view + child = NULL; + + // ... instead we either start or stop the tracker + // if ( !iEngine.HelperSysMemTracker().IsActive() ) + if ( !iMemSpySession.IsSwmtRunningL() ) + { + iState = EMemSpyViewHeapTrackingStateSingleOn; + // Setting observer to be able to stop SWMT after first cycle is completed + //iEngine.HelperSysMemTracker().SetObserver( this ); + iMemSpySession.ForceSwmtUpdateL(); + } + + // Redraw listbox + RefreshL(); + } + else if ( index == 1 ) + { + // This is the start/stop toggle so we don't make a child view + child = NULL; + + // ... instead we either start or stop the tracker + if ( iMemSpySession.IsSwmtRunningL() && iState == EMemSpyViewHeapTrackingStateTimerOn ) + { + iState = EMemSpyViewHeapTrackingStateIdle; + iMemSpySession.StopSwmtTimerL(); + + } + else if ( iState == EMemSpyViewHeapTrackingStateIdle ) + { + iState = EMemSpyViewHeapTrackingStateTimerOn; + iMemSpySession.StartSwmtTimerL(); + } + + // Redraw listbox + RefreshL(); + } + else if ( index == 2 ) + { + switch ( config.iMode ) + { + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic: + { + // Set Full mode + SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull, config ); + break; + } + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull: + { + // Set Custom mode + SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom, config ); + break; + } + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom: + { + // Set Basic mode + SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic, config ); + break; + } + default: break; + } + + // Redraw listbox + RefreshL(); + } + else if ( index == 3 ) + { + if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom ) + { + child = new(ELeave) CMemSpyViewHeapTrackingSettings( iMemSpySession, iObserver ); + } + else + { + child = new(ELeave) CMemSpyViewHeapTrackingResults( iMemSpySession, iObserver ); + } + } + else if ( index == 4 ) + { + child = new(ELeave) CMemSpyViewHeapTrackingResults( iMemSpySession, iObserver ); + } + if ( child ) + { + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + } + + // + return child; + } + + +void CMemSpyViewHeapTracking::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf item; + + // Get current config + TMemSpyEngineHelperSysMemTrackerConfig config; + + GetSwmtConfig( config ); + + // 1st item + _LIT( KItem1FormatEnable, "\tGet dump now" ); + model->AppendL( KItem1FormatEnable ); + + + // 1st item + //if ( iEngine.HelperSysMemTracker().IsActive() && iState == EMemSpyViewHeapTrackingStateTimerOn ) + if ( iMemSpySession.IsSwmtRunningL() && iState == EMemSpyViewHeapTrackingStateTimerOn ) + { + _LIT( KItem1FormatEnable, "\tStop timer\t\t%d (sec)" ); + TName item; + item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 ); + model->AppendL( item ); + } + else + { + _LIT( KItem1FormatEnable, "\tStart timer\t\t%d (sec)" ); + TName item; + item.Format( KItem1FormatEnable, config.iTimerPeriod.Int() / 1000000 ); + model->AppendL( item ); + } + + // 2nd item + switch ( config.iMode ) + { + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic: + { + _LIT( KItem2Format, "\tTracking mode\t\tBasic" ); + model->AppendL( KItem2Format ); + break; + } + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull: + { + _LIT( KItem2Format, "\tTracking mode\t\tFull" ); + model->AppendL( KItem2Format ); + break; + } + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom: + { + _LIT( KItem2Format, "\tTracking mode\t\tCustom" ); + model->AppendL( KItem2Format ); + + // 3rd item + TFullName item; + if ( config.iDumpData && + config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap ) + { + _LIT( KItem3Format, "\tSettings\t\t%d categ., dump" ); + + TInt count(0); + for( TInt bit = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 ) + { + if ( bit & config.iEnabledCategories ) + { + count++; + } + } + item.Format( KItem3Format, count ); + } + else + { + _LIT( KItem3Format, "\tSettings\t\t%d categories" ); + TInt count(0); + for( TInt bit = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 ) + { + if ( bit & config.iEnabledCategories ) + { + count++; + } + } + + item.Format( KItem3Format, count ); + } + model->AppendL( item ); + break; + } + default: break; + } + + // 4th item + TInt cycleCount = iMemSpySession.GetSwmtCyclesCount(); + + if ( cycleCount > 0 ) + { + _LIT( KItem2Format, "\tResults\t\t%d cycles" ); + TFullName item; + item.Format( KItem2Format, cycleCount ); + model->AppendL( item ); + } + else + { + _LIT( KItem2Format, "\tResults\t\tNo results" ); + model->AppendL( KItem2Format ); + } + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + +void CMemSpyViewHeapTracking::HandleCyclesResetL() + { + } + + +void CMemSpyViewHeapTracking::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) + { + } + + +void CMemSpyViewHeapTracking::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) + { + // Stopping SWMT does not work directly from this function. + // It has to be made asynchronously. + // iStopTimerCallBack = new (ELeave) CAsyncCallBack( TCallBack( CMemSpyViewHeapTracking::AsyncStopTimerCallback, this ), CActive::EPriorityStandard ); + // iStopTimerCallBack->CallBack(); + } + + +TInt CMemSpyViewHeapTracking::IndexByViewType( TMemSpyViewType aType ) + { + // Get current config + TMemSpyEngineHelperSysMemTrackerConfig config; + + GetSwmtConfig( config ); + + TInt index = 0; + // + switch( aType ) + { + default: + case EMemSpyViewTypeHeapTrackingResults: + { + if ( config.iMode == TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom ) + { + index = 4; + } + else + { + index = 3; + } + break; + } + case EMemSpyViewTypeHeapTrackingSettings: + index = 3; + break; + } + // + return index; + } + + +void CMemSpyViewHeapTracking::SetConfigByModeL( TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode aMode, TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) + { + switch ( aMode ) + { + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeBasic: + { + aConfig.iMode = aMode; + aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap | + TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks | + TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData | + TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory; + aConfig.iDumpData = EFalse; + break; + } + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeFull: + { + aConfig.iMode = aMode; + aConfig.iEnabledCategories = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryAll; + aConfig.iDumpData = ETrue; + aConfig.iThreadNameFilter = KNullDesC; + break; + } + case TMemSpyEngineHelperSysMemTrackerConfig::MemSpyEngineSysMemTrackerModeCustom: + { + aConfig.iMode = aMode; + aConfig.iEnabledCategories = iOriginalConfig.iEnabledCategories; + aConfig.iDumpData = iOriginalConfig.iDumpData; + aConfig.iThreadNameFilter = iOriginalConfig.iThreadNameFilter; + break; + } + default: User::Leave( KErrArgument ); + } + // Push changes to SWMT + SetSwmtConfig( aConfig ); + Settings().StoreSettingsL(); + } + + +TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback( TAny* aParam ) + { + CMemSpyViewHeapTracking* view = static_cast( aParam ); + return view->AsyncStopTimerCallback(); + } + + +TInt CMemSpyViewHeapTracking::AsyncStopTimerCallback() + { + iState = EMemSpyViewHeapTrackingStateIdle; + // iEngine.HelperSysMemTracker().RemoveObserver( this ); + TRAP_IGNORE( + iMemSpySession.StopSwmtTimerL(); + RefreshL(); + ); + delete iStopTimerCallBack; + iStopTimerCallBack = NULL; + return KErrNone; + } + +void CMemSpyViewHeapTracking::GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) + { + TInt categories = 0; + iMemSpySession.GetSwmtCategoriesL( categories ); + aConfig.iEnabledCategories = categories; + + TInt timerPeriod = 0; + iMemSpySession.GetSwmtTimerIntervalL( timerPeriod ); + aConfig.iTimerPeriod = timerPeriod; + + TBool dumpData = EFalse; + iMemSpySession.GetSwmtHeapDumpsEnabledL( dumpData ); + aConfig.iDumpData = dumpData; + + TName threadNameFilter; + iMemSpySession.GetSwmtFilter( threadNameFilter ); + aConfig.iThreadNameFilter = threadNameFilter; + + TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode mode; + iMemSpySession.GetSwmtMode( mode ); + aConfig.iMode = mode; + } + +void CMemSpyViewHeapTracking::SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) + { + iMemSpySession.SetSwmtMode( aConfig.iMode ); + iMemSpySession.SetSwmtCategoriesL( aConfig.iEnabledCategories ); + iMemSpySession.SetSwmtTimerIntervalL( aConfig.iTimerPeriod.Int() ); + iMemSpySession.SetSwmtHeapDumpsEnabledL( aConfig.iDumpData ); + iMemSpySession.SetSwmtFilter( aConfig.iThreadNameFilter ); + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewHeapTrackingResults.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewHeapTrackingResults.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,515 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewHeapTrackingResults.h" + +// System includes +#include +#ifdef __EPOC32__ +#include +#endif + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyContainer.h" +#include "MemSpyViewHeapTracking.h" +#include "MemSpyContainerObserver.h" + + +_LIT( KCycle, "Cycle" ); +_LIT( KTime, "Time" ); +_LIT( KMemoryFree, "Memory Free" ); +_LIT( KMemoryChange, "Memory Change (vs. Last Cycle)" ); +_LIT( KNumOfChanges, "Number of Changes" ); + +CMemSpyViewHeapTrackingResults::CMemSpyViewHeapTrackingResults( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ) + { + //iEngine.HelperSysMemTracker().SetObserver( this ); + } + + +CMemSpyViewHeapTrackingResults::~CMemSpyViewHeapTrackingResults() + { + //iEngine.HelperSysMemTracker().RemoveObserver( this ); + } + + +void CMemSpyViewHeapTrackingResults::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Results Summary" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Make sure the correct item is selected + const TInt cycleNumber = ((TInt) aSelectionRune); + TInt maxCycle = iMemSpySession.GetSwmtCyclesCount(); + if ( cycleNumber > 0 && cycleNumber <= maxCycle ) + { + iListBox->SetCurrentItemIndex( cycleNumber - 1 ); + HandleListBoxItemSelectedL( cycleNumber ); + } + } + + +void CMemSpyViewHeapTrackingResults::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewHeapTrackingResults::ViewType() const + { + return EMemSpyViewTypeHeapTrackingResults; + } + + +CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareParentViewL() + { + CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + // + // iEngine.HelperSysMemTracker().RemoveObserver( this ); + // + return parent; + } + + +CMemSpyViewBase* CMemSpyViewHeapTrackingResults::PrepareChildViewL() + { + const TInt index = iListBox->CurrentItemIndex(); + // + CMemSpyViewBase* child = NULL; + + if ( index >= 0 ) + { + //const CMemSpyEngineHelperSysMemTrackerCycle* cycle = iEngine.HelperSysMemTracker().CompletedCycles()[ index ]; + const CMemSpyApiMemoryTrackingCycle* cycle = iCycles[ index ]; + // + child = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iMemSpySession, iObserver, *cycle ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + // + //iEngine.HelperSysMemTracker().RemoveObserver( this ); + } + + // + return child; + } + + +void CMemSpyViewHeapTrackingResults::SetListBoxModelL() + { + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + + iMemSpySession.GetMemoryTrackingCyclesL( iCycles ); + + CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( iCycles.Count()); + + for ( TInt i = 0; i < iCycles.Count(); i++ ) + { + HBufC* tempName = HBufC::NewL( iCycles[i]->Caption().Length() + 16 ); + CleanupStack::PushL( tempName ); + TPtr tempNamePtr( tempName->Des() ); + + TBuf temp; + temp.Copy(iCycles[i]->Caption()); + tempNamePtr.Append( temp ); + model->AppendL( tempNamePtr ); + + CleanupStack::PopAndDestroy( tempName ); + } + + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewHeapTrackingResults::HandleCyclesResetL() + { + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewHeapTrackingResults::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) + { + } + + +void CMemSpyViewHeapTrackingResults::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) + { + TInt count = iMemSpySession.GetSwmtCyclesCount(); + SetListBoxCurrentItemIndexL( count - 1 ); + CMemSpyViewBase::RefreshL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewHeapTrackingResultsCycleInfo::CMemSpyViewHeapTrackingResultsCycleInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, const CMemSpyApiMemoryTrackingCycle& aCycle ) +: CMemSpyViewBase( aSession, aObserver ), iCycle( aCycle ) + { + //iEngine.HelperSysMemTracker().SetObserver( this ); + } + + +CMemSpyViewHeapTrackingResultsCycleInfo::~CMemSpyViewHeapTrackingResultsCycleInfo() + { + //iEngine.HelperSysMemTracker().RemoveObserver( this ); + } + + +void CMemSpyViewHeapTrackingResultsCycleInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitleFormat, "Cycle Summary [%04d]" ); + TBuf<30> buf; + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + SetTitleL( buf ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Make sure the correct item is selected + const TInt index = ((TInt) aSelectionRune); + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + +void CMemSpyViewHeapTrackingResultsCycleInfo::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewHeapTrackingResultsCycleInfo::ViewType() const + { + return EMemSpyViewTypeHeapTrackingResultsCycleInfo; + } + + +CMemSpyViewBase* CMemSpyViewHeapTrackingResultsCycleInfo::PrepareParentViewL() + { + CMemSpyViewHeapTrackingResults* parent = new(ELeave) CMemSpyViewHeapTrackingResults( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) iCycle.CycleNumber() ); + CleanupStack::Pop( parent ); + // + //iEngine.HelperSysMemTracker().RemoveObserver( this ); + // + return parent; + } + + +void CMemSpyViewHeapTrackingResultsCycleInfo::SetListBoxModelL() + { + CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 6 ); + + HBufC* buf = HBufC::NewL( 64 ); + TPtr pBuf( buf->Des() ); + + TBuf<4> cycleBuf; + _LIT( KCycleFormat, "%d"); + cycleBuf.Format( KCycleFormat, iCycle.CycleNumber() ); + + pBuf.Zero(); + pBuf.Append( _L("\t") ); + pBuf.Append( KCycle ); + pBuf.Append( _L("\t\t") ); + pBuf.Append( cycleBuf ); + model->AppendL( pBuf ); + + //time: + TBuf<128> timeBuf; + const TDateTime dt = iCycle.Time().DateTime(); + // + _LIT( KTimeFormatSpec, "%04d%02d%02d %02d:%02d:%02d" ); + timeBuf.Format( KTimeFormatSpec, dt.Year(), dt.Month()+1, dt.Day()+1, dt.Hour(), dt.Minute(), dt.Second() ); + pBuf.Zero(); + pBuf.Append( _L("\t")); + pBuf.Append( KTime ); + pBuf.Append( _L("\t\t") ); + pBuf.Append( timeBuf ); + model->AppendL( pBuf ); + + TBuf<16> memoryFreeBuf; + memoryFreeBuf.Format( KCycleFormat, iCycle.FreeMemory() ); + pBuf.Zero(); + pBuf.Append( _L("\t") ); + pBuf.Append( KMemoryFree ); + pBuf.Append( _L("\t\t") ); + pBuf.Append( memoryFreeBuf ); + model->AppendL( pBuf ); + + memoryFreeBuf.Format( KCycleFormat, iCycle.MemoryDelta() ); + pBuf.Zero(); + pBuf.Append( _L("\t") ); + pBuf.Append( KMemoryChange ); + pBuf.Append( _L("\t\t") ); + pBuf.Append( memoryFreeBuf ); + model->AppendL( pBuf ); + + cycleBuf.Format( KCycleFormat, iCycle.ChangeCount() ); + pBuf.Zero(); + pBuf.Append( _L("\t") ); + pBuf.Append( KNumOfChanges ); + pBuf.Append( _L("\t\t") ); + pBuf.Append( cycleBuf ); + model->AppendL( pBuf ); + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCyclesResetL() + { + Container().NavigateToParentViewL(); + } + + +void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) + { + } + + +void CMemSpyViewHeapTrackingResultsCycleInfo::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& /*aCycle*/ ) + { + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/* + + + +CMemSpyViewHeapTrackingResultsChangeDescriptor::CMemSpyViewHeapTrackingResultsChangeDescriptor( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, const CMemSpyEngineHelperSysMemTrackerCycle& aCycle, const CMemSpyEngineHelperSysMemTrackerCycleChange& aChangeDescriptor, TInt aIndex ) +: CMemSpyViewBase( aEngine, aObserver ), iCycle( aCycle ), iChangeDescriptor( aChangeDescriptor ), iIndex( aIndex ) + { + iEngine.HelperSysMemTracker().SetObserver( this ); + } + + +CMemSpyViewHeapTrackingResultsChangeDescriptor::~CMemSpyViewHeapTrackingResultsChangeDescriptor() + { + iEngine.HelperSysMemTracker().RemoveObserver( this ); + } + + +void CMemSpyViewHeapTrackingResultsChangeDescriptor::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + TBuf<30> buf; + if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapUser ) + { + _LIT( KTitleFormat, "User Heap Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHeapKernel ) + { + _LIT( KTitleFormat, "Kernel Heap Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeChunk ) + { + _LIT( KTitleFormat, "Chunk Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeRamDrive ) + { + _LIT( KTitleFormat, "RAM Drive Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeStack ) + { + _LIT( KTitleFormat, "Stack Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeGlobalData ) + { + _LIT( KTitleFormat, "Global Data Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeCode ) + { + _LIT( KTitleFormat, "RAM-Loaded Code Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeHandle ) + { + _LIT( KTitleFormat, "Handle Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeOpenFile ) + { + _LIT( KTitleFormat, "Open File Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeDiskSpace ) + { + _LIT( KTitleFormat, "Disk Space Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + else if ( iChangeDescriptor.Type() == EMemSpyEngineSysMemTrackerTypeBitmap ) + { + _LIT( KTitleFormat, "Bitmap Change [%04d]" ); + buf.Format( KTitleFormat, iCycle.CycleNumber() ); + } + // + SetTitleL( buf ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewHeapTrackingResultsChangeDescriptor::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewHeapTrackingResultsChangeDescriptor::ViewType() const + { + return EMemSpyViewTypeHeapTrackingResultsCycleChangeDescriptor; + } + + +CMemSpyViewBase* CMemSpyViewHeapTrackingResultsChangeDescriptor::PrepareParentViewL() + { + CMemSpyViewHeapTrackingResultsCycleInfo* parent = new(ELeave) CMemSpyViewHeapTrackingResultsCycleInfo( iEngine, iObserver, iCycle ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) iIndex ); + CleanupStack::Pop( parent ); + // + iEngine.HelperSysMemTracker().RemoveObserver( this ); + // + return parent; + } + + +void CMemSpyViewHeapTrackingResultsChangeDescriptor::SetListBoxModelL() + { + MDesCArray& model = const_cast< MDesCArray& >( static_cast< const MDesCArray&>( iChangeDescriptor ) ); + // + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &model ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCyclesResetL() + { + CMemSpyViewHeapTrackingResults* mainResultsMenu = new(ELeave) CMemSpyViewHeapTrackingResults( iEngine, iObserver ); + CleanupStack::PushL( mainResultsMenu ); + mainResultsMenu->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( mainResultsMenu ); + // + Container().SetNewActiveViewL( mainResultsMenu ); + } + + +void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleStartedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) + { + } + + +void CMemSpyViewHeapTrackingResultsChangeDescriptor::HandleCycleFinishedL( const CMemSpyEngineHelperSysMemTrackerCycle& aCycle ) + { + } +*/ + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewHeapTrackingSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewHeapTrackingSettings.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,470 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewHeapTrackingSettings.h" + +// System includes +#include +#ifdef __EPOC32__ +#include +#endif +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpySettings.h" +#include "MemSpyViewHeapTracking.h" +#include "MemSpyContainerObserver.h" + +/* +CMemSpyViewHeapTrackingSettings::CMemSpyViewHeapTrackingSettings( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } +*/ +CMemSpyViewHeapTrackingSettings::CMemSpyViewHeapTrackingSettings( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ) + { + } + + +CMemSpyViewHeapTrackingSettings::~CMemSpyViewHeapTrackingSettings() + { + } + + +void CMemSpyViewHeapTrackingSettings::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Settings" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewHeapTrackingSettings::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::SizeChanged(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewHeapTrackingSettings::ViewType() const + { + return EMemSpyViewTypeHeapTrackingSettings; + } + + +CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareParentViewL() + { + CMemSpyViewHeapTracking* parent = new(ELeave) CMemSpyViewHeapTracking( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewHeapTrackingSettings::PrepareChildViewL() + { + const TInt index = iListBox->CurrentItemIndex(); + + // Get current config + TMemSpyEngineHelperSysMemTrackerConfig config; + GetSwmtConfig( config ); + + // This view abuses the child view callback to toggle field values and/or + // display settings dialogs. + if ( index == 0 ) + { + TInt period = config.iTimerPeriod.Int() / 1000000; + CAknNumberQueryDialog* dialog = new(ELeave) CAknNumberQueryDialog( period ); + if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_TIMER_PERIOD ) ) + { + config.iTimerPeriod = period * 1000000; + } + } + else if ( index == 1 ) + { + TInt categories( config.iEnabledCategories ); + CSWMTCategorySelectionCheckBoxSettingItem* settingItem = new (ELeave) CSWMTCategorySelectionCheckBoxSettingItem( 0, categories ); + CleanupStack::PushL( settingItem ); + settingItem->ConstructL( EFalse, + 0, + _L("SWMT Categories"), + NULL, + R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE, + EAknCtPopupSettingList, + NULL, + NULL ); + + CMemSpySWMTCategorySelectionCheckBoxSettingPage* dlg = new(ELeave) CMemSpySWMTCategorySelectionCheckBoxSettingPage( R_MEMSPYUI_SWMT_CATEGORIES_SETTING_PAGE, settingItem->ItemArray() ); + dlg->SetSettingPageObserver( settingItem ); + if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) + { + config.iEnabledCategories = categories; + } + CleanupStack::PopAndDestroy( settingItem ); + } + else if ( index == 2 ) + { + config.iDumpData = !config.iDumpData; + } + else if ( index == 3 ) + { + TName nameFilter; + nameFilter.Copy( config.iThreadNameFilter ); + CMemSpyAllowEmptyDataDialog* dialog = new (ELeave) CMemSpyAllowEmptyDataDialog( nameFilter ); + if ( dialog->ExecuteLD( R_MEMSPY_HEAP_TRACKER_NAME_FILTER ) ) + { + config.iThreadNameFilter = nameFilter; + } + } + + // Push changes to SWMT + SetSwmtConfig( config ); + Settings().StoreSettingsL(); + + RefreshL(); + return NULL; + } + + +void CMemSpyViewHeapTrackingSettings::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf item; + + // Get current config + TMemSpyEngineHelperSysMemTrackerConfig config; + GetSwmtConfig( config ); + + // 1st item + _LIT( KItem1Format, "\tTracking timer period\t\t%d (sec)" ); + item.Format( KItem1Format, config.iTimerPeriod.Int() / 1000000 ); + model->AppendL( item ); + + // 2nd item + _LIT( KItem3Format, "\tCategories\t\t%d selected" ); + + TInt count(0); + for( TInt bit = TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; bit > 0; bit = bit >> 1 ) + { + if ( bit & config.iEnabledCategories ) + { + count++; + } + } + + item.Format( KItem3Format, count ); + model->AppendL( item ); + + // following items are related only to User Heap category, + // so hide them if User Heap is not selected + if ( config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap ) + { + // 3th item + _LIT( KItem2Format, "\tDump data" ); + PrepareItemBufL( item, KItem2Format, config.iDumpData, config.iEnabledCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap && config.iThreadNameFilter.Length() > 0 ); + model->AppendL( item ); + + // 4th item + if ( config.iDumpData ) + { + _LIT( KItem4Format, "\tHeap data thread filter\t\t%S" ); + if ( config.iThreadNameFilter.Length() > 0 ) + { + item.Format( KItem4Format, &config.iThreadNameFilter ); + } + else + { + item.Format( KItem4Format, &_L("No filtering") ); + } + model->AppendL( item ); + } + } + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + + +void CMemSpyViewHeapTrackingSettings::PrepareItemBufL( TDes& aBuf, const TDesC& aCaption, TBool aStatus, TBool aHeapCategorySelected ) + { + aBuf.Copy( aCaption ); + // + if ( aStatus ) + { + if ( aHeapCategorySelected ) + { + _LIT( KItemEnabled, "\t\tCustom" ); + aBuf.Append( KItemEnabled ); + } + else + { + _LIT( KItemEnabled, "\t\tAll user heaps" ); + aBuf.Append( KItemEnabled ); + } + } + else + { + _LIT( KItemDisabled, "\t\tDisabled" ); + aBuf.Append( KItemDisabled ); + } + } + +void CMemSpyViewHeapTrackingSettings::GetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) + { + TMemSpyEngineHelperSysMemTrackerConfig::TMemSpyEngineSysMemTrackerMode mode; + iMemSpySession.GetSwmtMode( mode ); + aConfig.iMode = mode; + + TInt categories = 0; + iMemSpySession.GetSwmtCategoriesL( categories ); + aConfig.iEnabledCategories = categories; + + TInt timerPeriod = 0; + iMemSpySession.GetSwmtTimerIntervalL( timerPeriod ); + aConfig.iTimerPeriod = timerPeriod; + + TBool dumpData = EFalse; + iMemSpySession.GetSwmtHeapDumpsEnabledL( dumpData ); + aConfig.iDumpData = dumpData; + + TName threadNameFilter; + iMemSpySession.GetSwmtFilter( threadNameFilter ); + aConfig.iThreadNameFilter = threadNameFilter; + } + +void CMemSpyViewHeapTrackingSettings::SetSwmtConfig( TMemSpyEngineHelperSysMemTrackerConfig& aConfig ) + { + iMemSpySession.SetSwmtMode( aConfig.iMode ); + iMemSpySession.SetSwmtCategoriesL( aConfig.iEnabledCategories ); + iMemSpySession.SetSwmtTimerIntervalL( aConfig.iTimerPeriod.Int() ); + iMemSpySession.SetSwmtHeapDumpsEnabledL( aConfig.iDumpData ); + iMemSpySession.SetSwmtFilter( aConfig.iThreadNameFilter ); + } + + + + + + + + + + +// -------------------------------------------------------------------------------------------- + +CSWMTCategorySelectionCheckBoxSettingItem::CSWMTCategorySelectionCheckBoxSettingItem( TInt aIdentifier, TInt& aCategories ): + CAknSettingItem(aIdentifier), iExtCategories( aCategories ) + { + } + + +CSWMTCategorySelectionCheckBoxSettingItem::~CSWMTCategorySelectionCheckBoxSettingItem() + { + delete iSettingText; + if( iItemArray ) + { + iItemArray->ResetAndDestroy(); + delete iItemArray; + } + } + + +CSelectionItemList* CSWMTCategorySelectionCheckBoxSettingItem::ItemArray() const + { + return iItemArray; + } + + +void CSWMTCategorySelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel) + { + TBuf<64> buf; + buf.Copy( aLabel ); + CSelectableItem* item = new (ELeave) CSelectableItem( buf, EFalse ); + CleanupStack::PushL( item ); + item->ConstructL(); + iItemArray->AppendL( item ); // Ownership is transferred + CleanupStack::Pop(); // item + } + + +void CSWMTCategorySelectionCheckBoxSettingItem::CompleteConstructionL() + { + SetEmptyItemTextL(_L("Nothing selected")); + iItemArray = new(ELeave) CSelectionItemList(16); + AddNewItemToArrayL( _L("User Heap") ); // 0 + AddNewItemToArrayL( _L("Kernel Heap") ); // 1 + AddNewItemToArrayL( _L("User Stacks") ); // 2 + AddNewItemToArrayL( _L("Global Data") ); // 3 + AddNewItemToArrayL( _L("Disk Usage") ); // 4 + AddNewItemToArrayL( _L("Open Files") ); // 5 + AddNewItemToArrayL( _L("RAM-loaded Code") ); // 6 + AddNewItemToArrayL( _L("System Memory") ); // 7 + AddNewItemToArrayL( _L("Local Chunks") ); // 8 + AddNewItemToArrayL( _L("Global Chunks") ); // 9 + AddNewItemToArrayL( _L("RAM Drive") ); // 10 + AddNewItemToArrayL( _L("FileServer Cache") );// 11 + AddNewItemToArrayL( _L("Kernel Handles") ); // 12 + AddNewItemToArrayL( _L("Bitmap Handles") ); // 13 + AddNewItemToArrayL( _L("Window Groups") ); // 14 + } + + +void CSWMTCategorySelectionCheckBoxSettingItem::StoreL() + { + iExtCategories = 0; + if ( iItemArray->At( 11 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache; + if ( iItemArray->At( 13 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles; + if ( iItemArray->At( 0 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap; + if ( iItemArray->At( 1 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap; + if ( iItemArray->At( 8 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks; + if ( iItemArray->At( 9 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks; + if ( iItemArray->At( 10 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive; + if ( iItemArray->At( 2 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks; + if ( iItemArray->At( 3 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData; + if ( iItemArray->At( 6 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode; + if ( iItemArray->At( 12 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles; + if ( iItemArray->At( 5 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles; + if ( iItemArray->At( 4 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage; + if ( iItemArray->At( 7 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory; + if ( iItemArray->At( 14 )->SelectionStatus() ) + iExtCategories |= TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups; + } + + +void CSWMTCategorySelectionCheckBoxSettingItem::LoadL() + { + iItemArray->At( 11 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryFileServerCache ); + iItemArray->At( 13 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryBitmapHandles ); + iItemArray->At( 0 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserHeap ); + iItemArray->At( 1 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHeap ); + iItemArray->At( 8 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryLocalChunks ); + iItemArray->At( 9 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalChunks ); + iItemArray->At( 10 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMDrive ); + iItemArray->At( 2 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryUserStacks ); + iItemArray->At( 3 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryGlobalData ); + iItemArray->At( 6 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryRAMLoadedCode ); + iItemArray->At( 12 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryKernelHandles ); + iItemArray->At( 5 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryOpenFiles ); + iItemArray->At( 4 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryDiskusage ); + iItemArray->At( 7 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategorySystemMemory ); + iItemArray->At( 14 )->SetSelectionStatus( iExtCategories & TMemSpyEngineHelperSysMemTrackerConfig::EMemSpyEngineSysMemTrackerCategoryWindowGroups ); + } + + +void CSWMTCategorySelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ) + { + switch( aEventType ) + { + case EEventSettingOked: + { + // If settings oked, save new values + StoreL(); + break; + } + case EEventSettingCancelled: + { + // If setting is cancelled, load old values + LoadL(); + break; + } + case EEventSettingChanged: + { + // If setting has changed, update CBA visibility + static_cast( aSettingPage )->UpdateCba(); + break; + } + default: + { + break; + } + } + CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType ); + } + + +CMemSpySWMTCategorySelectionCheckBoxSettingPage::CMemSpySWMTCategorySelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray ) + : CAknCheckBoxSettingPage( aResourceID, aItemArray ) + { + } + + +void CMemSpySWMTCategorySelectionCheckBoxSettingPage::UpdateCba() + { + // Cache the pointer to button group container + CEikButtonGroupContainer* cba = Cba(); + // Left softkey should be visible if there are items selected, + // i.e. the selection index array has items. + TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 ); + // Resolve left softkey command id + TInt leftId( cba->ButtonGroup()->CommandId( 0 ) ); + // Check if left softkey visibility has changed + if( visible != cba->IsCommandVisible( leftId ) ) + { + // Left softkey visibility has changed, update it + cba->MakeCommandVisible( leftId, visible ); + } + } + + + + +CMemSpyAllowEmptyDataDialog::CMemSpyAllowEmptyDataDialog( TDes& aText, const TTone& aTone ) + : CAknTextQueryDialog( aText, aTone ) + { + } + + +void CMemSpyAllowEmptyDataDialog::UpdateLeftSoftKeyL() + { + MakeLeftSoftkeyVisible( ETrue ); + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewKernel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewKernel.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewKernel.h" + +// System includes +#include +#ifdef __EPOC32__ +#include +#endif + +// Engine includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" +#include "MemSpyViewKernelHeap.h" +#include "MemSpyViewKernelContainers.h" + +/* +CMemSpyViewKernel::CMemSpyViewKernel( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } +*/ + +CMemSpyViewKernel::CMemSpyViewKernel( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ) + { + } + + +CMemSpyViewKernel::~CMemSpyViewKernel() + { + } + + +void CMemSpyViewKernel::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Kernel" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Make sure the correct item is selected + const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); + const TInt index = IndexByViewType( viewType ); + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + +void CMemSpyViewKernel::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewKernel::ViewType() const + { + return EMemSpyViewTypeKernel; + } + + +CMemSpyViewBase* CMemSpyViewKernel::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewKernel::PrepareChildViewL() + { + + CMemSpyViewBase* child = NULL; + const TInt index = iListBox->CurrentItemIndex(); + // + if ( index == 0 ) + { + child = new(ELeave) CMemSpyViewKernelContainers( iMemSpySession, iObserver ); + } + else if ( index == 1 ) + { + child = new(ELeave) CMemSpyViewKernelHeap( iMemSpySession, iObserver ); + } + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewKernel::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf item; + + // 1st item = Processes + _LIT( KItem1Format, "\tObjects" ); + item.Format( KItem1Format ); + model->AppendL( item ); + + // 2nd item = System Config + _LIT( KItem2Format, "\tHeap" ); + model->AppendL( KItem2Format ); + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + + +TInt CMemSpyViewKernel::IndexByViewType( TMemSpyViewType aType ) + { + TInt index = 0; + // + switch( aType ) + { + default: + case EMemSpyViewTypeKernelContainers: + index = 0; + break; + + case EMemSpyViewTypeKernelHeap: + index = 1; + break; + } + + // + return index; + } + + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewKernelContainers.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewKernel.h" +#include "MemSpyContainerObserver.h" +#include "MemSpyViewKernelObjects.h" + +// Literal constants + + + +CMemSpyViewKernelContainers::CMemSpyViewKernelContainers( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ) + { + } + + +CMemSpyViewKernelContainers::~CMemSpyViewKernelContainers() + { + //delete iModel; + } + + +void CMemSpyViewKernelContainers::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Kernel Objects" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewKernelContainers::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewKernelContainers::ViewType() const + { + return EMemSpyViewTypeKernelContainers; + } + + +CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareParentViewL() + { + CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + const TInt index = iListBox->CurrentItemIndex(); + //child = new(ELeave) CMemSpyViewKernelObjects( iEngine, iObserver, iModel->At( index ).Type() ); + child = new(ELeave) CMemSpyViewKernelObjects( iMemSpySession, iObserver, iKernelObjects[index]->Type() ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewKernelContainers::SetListBoxModelL() + { + iMemSpySession.GetKernelObjects( iKernelObjects ); + + CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( iKernelObjects.Count() ); //array for formated items + + for( TInt i=0 ; iCount(); + TInt size = iKernelObjects[i]->Size(); + const TMemSpySizeText sizeText( MemSpyUiUtils::FormatSizeText( size, 0 ) ); + + HBufC* tempName = HBufC::NewL( iKernelObjects[i]->Name().Length() + 32 ); + + CleanupStack::PushL( tempName ); + TPtr tempNamePtr( tempName->Des() ); + tempNamePtr.Copy( iKernelObjects[i]->Name() ); + + _LIT(KNameFormat, "\t%S\t\t%d item"); + TPtr pName( tempName->Des() ); + // + const TPtrC pType( MemSpyUiUtils::TypeAsString( iKernelObjects[i]->Type() ) ); + // + pName.Format( KNameFormat, &pType, count ); + // + if ( count == 0 || count > 1 ) + { + pName.Append( _L("s") ); + } + + pName.AppendFormat( _L(", %S"), &sizeText ); + + model->AppendL( pName ); + + CleanupStack::PopAndDestroy( tempName); //--- + } + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +TBool CMemSpyViewKernelContainers::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdKernelContainersOutput: + OnCmdOutputAllContainerContentsL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL() + { + iMemSpySession.OutputAllContainerContents(); + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,432 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewKernelHeap.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewKernel.h" +#include "MemSpyContainerObserver.h" + +// Constants +const TInt KMemSpyBufferSize = 20; + +// Literal constants +_LIT(KMemSpyHexFormat, "0x%08x"); +_LIT(KMemSpyUnsignedFormat, "%u"); +_LIT(KMemSpyDecFormat, "%d"); +_LIT(KMemSpyLongFormat, "%Ld"); +_LIT(KMemSpyCaptionYes, "Yes"); +_LIT(KMemSpyCaptionNo, "No"); + + +CMemSpyViewKernelHeap::CMemSpyViewKernelHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) //cigasto: remember to uncomment from MMP! +: CMemSpyViewBase( aSession, aObserver ) + { + } + +CMemSpyViewKernelHeap::~CMemSpyViewKernelHeap() + { + } + + +void CMemSpyViewKernelHeap::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Kernel Heap" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewKernelHeap::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewKernelHeap::ViewType() const + { + return EMemSpyViewTypeKernelHeap; + } + + +CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareParentViewL() + { + CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewKernelHeap::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + return child; + } + + +void CMemSpyViewKernelHeap::SetListBoxModelL() + { + CMemSpyApiHeap* iHeap; + iHeap = iMemSpySession.GetHeap( ); + + CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 22 ); + + model = FormatModel( iHeap ); + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + } + + +TBool CMemSpyViewKernelHeap::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdKernelHeapDump: + OnCmdDumpKernelHeapL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewKernelHeap::OnCmdDumpKernelHeapL() + { + iMemSpySession.DumpKernelHeap(); + } + + +//CDesCArrayFlat* CMemSpyViewKernelHeap::FormatModel( RArray &aHeap ) +CDesCArrayFlat* CMemSpyViewKernelHeap::FormatModel( CMemSpyApiHeap* aHeap ) + { + CDesCArrayFlat* model = new (ELeave) CDesC16ArrayFlat( 2 ); + + if (aHeap) + { + _LIT( KItem0, "Heap type" ); + _LIT( KItem1, "Heap size" ); + _LIT( KItem8b, "Heap base address" ); + _LIT( KItem1b, "Shared" ); + _LIT( KItem2, "Chunk size" ); + _LIT( KItem3, "Alloc. count" ); + _LIT( KItem4, "Free. count" ); + _LIT( KItem5, "Biggest alloc." ); + _LIT( KItem6, "Biggest free" ); + _LIT( KItem6a, "Total alloc." ); + _LIT( KItem6b, "Total free" ); + _LIT( KItem7, "Slack free space" ); + _LIT( KItem8a, "Fragmentation" ); + _LIT( KItem13, "Header size (A)" ); + _LIT( KItem14, "Header size (F)" ); + _LIT( KItem9a, "Overhead (alloc)" ); + _LIT( KItem9b, "Overhead (free)" ); + _LIT( KItem9c, "Overhead (total)" ); + _LIT( KItem9d, "Overhead" ); + _LIT( KItem10, "Min. length" ); + _LIT( KItem11, "Max. length" ); + _LIT( KItem12, "Debug Allocator Library" ); + + HBufC* hItem = FormatItem( KItem0, aHeap->Type() ); + TPtr pItem(hItem->Des()); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem1, aHeap->Size() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + TUint address( aHeap->BaseAddress() ); + hItem = FormatItem( KItem8b, address ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + if(aHeap->Shared()) //Yes / No value formatting + hItem = FormatItem( KItem1b, KMemSpyCaptionYes ); + else + hItem = FormatItem( KItem1b, KMemSpyCaptionNo ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem2, aHeap->ChunkSize() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem3, aHeap->AllocationsCount() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem4, aHeap->FreeCount() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem5, aHeap->BiggestAllocation() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem6, aHeap->BiggestFree() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem6a, aHeap->TotalAllocations() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem6b, aHeap->TotalFree() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem7, aHeap->SlackFreeSpace() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + TReal iOneHundred( aHeap->Size() ); + TReal iValue( aHeap->Fragmentation() ); + hItem = FormatPercentageItem( KItem8a, iOneHundred, iValue ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem13, aHeap->HeaderSizeA() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem14, aHeap->HeaderSizeF() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem9a, aHeap->AllocationOverhead() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem9b, aHeap->FreeOverhead() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem9c, aHeap->TotalOverhead() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + TReal iOverhead( aHeap->Overhead() ); + hItem = FormatPercentageItem( KItem9d, iOneHundred, iOverhead ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem10, aHeap->MinLength() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + hItem = FormatItem( KItem11, aHeap->MaxLength() ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + + if( aHeap->DebugAllocatorLibrary() ) + hItem = FormatItem( KItem12, KMemSpyCaptionYes ); + else + hItem = FormatItem( KItem12, KMemSpyCaptionNo ); + pItem = hItem->Des(); + model->AppendL( pItem ); + pItem.Zero(); + } + else + { + HBufC* hItem = FormatItem( _L("Not Found"), _L("") ); + TPtr pItem(hItem->Des()); + model->AppendL( pItem ); + pItem.Zero(); + } + + return model; + } + +HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, const TDesC& aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( aValue ); + return retBuf; + } + +HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TInt aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + + TBuf val; + val.Format( KMemSpyDecFormat, aValue ); + + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( val ); + + return retBuf; + } + +HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + + TBuf val; + //val.Format( KMemSpyDecFormat, aValue ); + val.Format( KMemSpyHexFormat, aValue ); + + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( val ); + + return retBuf; + } + +HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, const TInt64& aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + + TBuf val; + val.Format( KMemSpyLongFormat, aValue ); + + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( val ); + + return retBuf; + } + +HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TAny* aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + + TBuf val; + val.Format( KMemSpyHexFormat, aValue ); + + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( val ); + + return retBuf; + } + +HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint* aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + + TBuf val; + val.Format( KMemSpyHexFormat, aValue ); + + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( val ); + + return retBuf; + } + +HBufC* CMemSpyViewKernelHeap::FormatItem( const TDesC& aCaption, TUint8* aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + + TBuf val; + val.Format( KMemSpyHexFormat, aValue ); + + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( val ); + + return retBuf; + } + +HBufC* CMemSpyViewKernelHeap::FormatPercentageItem( const TDesC& aCaption, TReal aOneHundredPercentValue, TReal aValue ) + { + HBufC* retBuf = HBufC::NewL( KMaxName ); //buffer for formatted item + TPtr pRetBuf( retBuf->Des() ); + pRetBuf.Zero(); + + const TReal value = (TInt) (( aValue / aOneHundredPercentValue) * 100.0); // percentage value calculation + _LIT(KPercentFormat, "%3.2f %%"); + TMemSpyPercentText val; + val.Format( KPercentFormat, value ); + + pRetBuf.Append( _L("\t") ); + pRetBuf.Append( aCaption ); + pRetBuf.Append( _L("\t\t") ); + pRetBuf.Append( val ); + + return retBuf; + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,875 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewKernelObjects.h" + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewKernel.h" +#include "MemSpyContainerObserver.h" +#include "MemSpyViewKernelContainers.h" + +const TInt KMaxInfoLength = 128; + +/* +CMemSpyViewKernelObjects::CMemSpyViewKernelObjects( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType ) +: CMemSpyViewBase( aEngine, aObserver ), + iObjectType( aObjectType ), + iCurrItemIndex( KErrNotFound ) + { + } +*/ +CMemSpyViewKernelObjects::CMemSpyViewKernelObjects( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TMemSpyDriverContainerType aObjectType ) +: CMemSpyViewBase( aSession, aObserver ), + iObjectType( aObjectType ), + iCurrItemIndex( KErrNotFound ) + { + } + + +CMemSpyViewKernelObjects::~CMemSpyViewKernelObjects() + { + if ( iNavContainer && iNavDecorator ) + { + iNavContainer->Pop( iNavDecorator ); + delete iNavDecorator; + } + delete iModel; + delete iItems; + delete iObjectList; + } + + +void CMemSpyViewKernelObjects::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Kernel Objects" ); + SetTitleL( KTitle ); + iItems = new(ELeave) CDesCArrayFlat(5); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + CreateTabsL(); + } + + +CEikListBox* CMemSpyViewKernelObjects::ConstructListBoxL() + { + delete iListBox; + iListBox = NULL; + CAknSingleStyleListBox* listbox = new (ELeave) CAknSingleStyleListBox(); + iListBox = listbox; + listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); + listbox->SetContainerWindowL( *this ); + listbox->CreateScrollBarFrameL( ETrue ); + SetListBoxModelL(); + listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + listbox->SetListBoxObserver( this ); + listbox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + listbox->SetObserver( this ); + return listbox; + } + + +void CMemSpyViewKernelObjects::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewKernelObjects::ViewType() const + { + return EMemSpyViewTypeKernelObjects; + } + + +CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareParentViewL() + { + if ( iNaviPane && iNavDecorator ) + { + iNaviPane->Pop( iNavDecorator ); + delete iNavDecorator; + iNavDecorator = NULL; + } + //CMemSpyViewBase* parent = new(ELeave) CMemSpyViewKernelContainers( iEngine, iObserver ); + CMemSpyViewBase* parent = new(ELeave) CMemSpyViewKernelContainers( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewKernelObjects::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + if ( iListBox && + iListBox->Model()->NumberOfItems() && + iListBox->CurrentItemIndex() > KErrNotFound ) + { + DetailsL(); + } + return child; + } + + +void CMemSpyViewKernelObjects::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == R_MEMSPY_MENUPANE ) + { + if ( iObjectType > EMemSpyDriverContainerTypeProcess ) + { + // Display Terminate, Switch to, End and Panic + // commands only for Threads and processes + aMenuPane->SetItemDimmed( EMemSpyCmdKernelObjects, ETrue ); + } + } + } + + +void CMemSpyViewKernelObjects::SetListBoxModelL() + { + //_LIT( KLineFormatSpec, "\t%S" ); + _LIT( KTab, "\t" ); + + iMemSpySession.GetKernelObjectItems( iKernelObjectItems, iObjectType ); + + iModel = new (ELeave) CDesC16ArrayFlat( iKernelObjectItems.Count() + 1 ); //array for formated items, +1 added there for 0 case - creating 0-sized array panics + + for ( TInt i = 0; i < iKernelObjectItems.Count(); i++ ) + { + HBufC* tempName = HBufC::NewL( iKernelObjectItems[i]->Name().Length() + 16 ); + CleanupStack::PushL( tempName ); + TPtr tempNamePtr( tempName->Des() ); + tempNamePtr.Copy( KTab ); + + TBuf temp; + temp.Copy(iKernelObjectItems[i]->Name()); + tempNamePtr.Append( temp ); + iModel->AppendL( tempNamePtr ); + + CleanupStack::PopAndDestroy( tempName ); + } + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iModel ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +TBool CMemSpyViewKernelObjects::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdKernelObjectTerminate: + { + TRAPD( err, OnCmdTerminateL() ); + if ( err ) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + note->ExecuteLD( _L("Cannot terminate task") ); + } + break; + } + case EMemSpyCmdKernelObjectSwitchTo: + { + TRAPD( err, OnCmdSwitchToL() ); + if ( err ) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + note->ExecuteLD( _L("Cannot bring to foreground") ); + } + break; + } + case EMemSpyCmdKernelObjectEnd: + { + TRAPD( err, OnCmdEndL() ); + if ( err ) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + note->ExecuteLD( _L("Cannot end task") ); + } + break; + } + case EMemSpyCmdKernelObjectPanic: + { + TRAPD( err, OnCmdPanicL() ); + if ( err ) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + note->ExecuteLD( _L("Cannot panic task") ); + } + break; + } + default: + { + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + } + // + return handled; + } + + +TKeyResponse CMemSpyViewKernelObjects::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse resp = EKeyWasNotConsumed; + resp = CMemSpyViewBase::OfferKeyEventL( aKeyEvent, aType ); + //} + return resp; + } + +void CMemSpyViewKernelObjects::TabChangedL( TInt /*aIndex*/ ) + { + } + + +void CMemSpyViewKernelObjects::OnCmdTerminateL() + { + switch ( iObjectType ) + { + case EMemSpyDriverContainerTypeThread: + { + TBool err = EFalse; + TBool doTerminate = ETrue; + + TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread + + iMemSpySession.ThreadSystemPermanentOrCritical( id, err ); + + if( err ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + + if ( doTerminate ) + { + iMemSpySession.EndThreadL( id, ETerminate ); + RefreshL(); + } + } + break; + } + case EMemSpyDriverContainerTypeProcess: + { + TBool err = EFalse; + TBool doTerminate = ETrue; + TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); + iMemSpySession.ProcessSystemPermanentOrCritical( id, err ); + + if( err ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + + if( doTerminate ) + { + iMemSpySession.EndProcessL( id, ETerminate ); + RefreshL(); + } + } + break; + } + default: + { + // Programming error + __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); + } + } + } + + +void CMemSpyViewKernelObjects::OnCmdSwitchToL() + { + TBool brought = EFalse; + /* + TInt wgCount; + RWsSession wsSession; + User::LeaveIfError( wsSession.Connect() ); + CleanupClosePushL( wsSession ); + User::LeaveIfError( wgCount = wsSession.NumWindowGroups() ); + RArray wgArray; + CleanupClosePushL( wgArray ); + User::LeaveIfError( wsSession.WindowGroupList( &wgArray ) ); + TApaTask task( wsSession ); + TBool brought( EFalse ); + TInt wgId( KErrNotFound ); + TThreadId threadId; + */ + switch ( iObjectType ) + { + case EMemSpyDriverContainerTypeThread: + { + TThreadId currentThreadId( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); + TInt error = iMemSpySession.SwitchToThread( currentThreadId, brought ); + /* + TThreadId currentThreadId( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); + + // loop trough all window groups and see if a thread id matches + while( !brought && wgCount-- ) + { + wgId = wgArray[wgCount].iId; + User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) ); + if ( threadId == currentThreadId ) + { + CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId ); + task.SetWgId( wgId ); + if ( !wgName->Hidden() && task.Exists() ) + { + task.BringToForeground(); + brought = ETrue; + } + CleanupStack::PopAndDestroy( wgName ); + } + } + */ + break; + } + case EMemSpyDriverContainerTypeProcess: + { + TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); + TInt error = iMemSpySession.SwitchToProcess( id, brought ); + /* + //CMemSpyEngineObjectContainer& container = iEngine.Container(); + //TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); + //CMemSpyProcess& process = container.ProcessByIdL( id ); + + TProcessId id( iKernelObjectItems[iListBox->CurrentItemIndex()]->Id() ); + + + // loop trough threads in a process + for ( TInt i = 0; i < process.MdcaCount(); i++ ) + { + TInt wgCountLocal = wgCount; + + // loop trough all window groups and see if a thread id matches + while( !brought && wgCountLocal-- ) + { + wgId = wgArray[wgCountLocal].iId; + User::LeaveIfError( wsSession.GetWindowGroupClientThreadId( wgId, threadId ) ); + if ( threadId == process.At( i ).Id() ) + { + CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, wgId ); + task.SetWgId( wgId ); + if ( !wgName->Hidden() && task.Exists() ) + { + task.BringToForeground(); + brought = ETrue; + } + CleanupStack::PopAndDestroy( wgName ); + } + } + } + */ + break; + } + default: + { + // Programming error + __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); + } + } + if ( !brought ) + { + // Error handling in HandleCommandL + User::Leave( KErrGeneral ); + } + CleanupStack::PopAndDestroy( 2 ); //wgArray,wsSession + } + + +void CMemSpyViewKernelObjects::OnCmdEndL() + { + switch ( iObjectType ) + { + case EMemSpyDriverContainerTypeThread: + { + TBool err = EFalse; + TBool doTerminate = ETrue; + + TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread + iMemSpySession.ThreadSystemPermanentOrCritical( id, err ); + + if( err ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + + if ( doTerminate ) + { + iMemSpySession.EndThreadL( id, EKill ); + RefreshL(); + } + } + + + /* + CMemSpyEngineObjectContainer& container = iEngine.Container(); + TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); + + // Try to find the thread in question... + CMemSpyProcess* process = NULL; + CMemSpyThread* thread = NULL; + User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); + + if ( thread ) + { + // + if ( thread->IsSystemPermanent() || thread->IsSystemCritical() ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + // + if ( doTerminate ) + { + thread->KillL(); + } + } + + RefreshL(); + */ + break; + } + case EMemSpyDriverContainerTypeProcess: + { + TBool err = EFalse; + TBool doTerminate = ETrue; + TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); + iMemSpySession.ProcessSystemPermanentOrCritical( id, err ); + + if( err ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + + if( doTerminate ) + { + iMemSpySession.EndProcessL( id, EKill); + RefreshL(); + } + } + + /* + TBool doTerminate = ETrue; + // Obtain the process that corresponds to the selected item + CMemSpyEngineObjectContainer& container = iEngine.Container(); + TProcessId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); + CMemSpyProcess& process = container.ProcessByIdL( id ); + + if ( process.IsSystemPermanent() || process.IsSystemCritical() ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + if ( doTerminate ) + { + process.KillL(); + RefreshL(); + } + */ + break; + } + default: + { + // Programming error + __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); + } + } + } + + +void CMemSpyViewKernelObjects::OnCmdPanicL() + { + switch ( iObjectType ) + { + case EMemSpyDriverContainerTypeThread: + { + TBool err = EFalse; + TBool doTerminate = ETrue; + + TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread + iMemSpySession.ThreadSystemPermanentOrCritical( id, err ); + + if( err ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + + if ( doTerminate ) + { + iMemSpySession.EndThreadL( id, EPanic ); + RefreshL(); + } + } + + break; + } + case EMemSpyDriverContainerTypeProcess: + { + TBool err = EFalse; + TBool doTerminate = ETrue; + TProcessId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); + iMemSpySession.ProcessSystemPermanentOrCritical( id, err ); + + if( err ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + + if( doTerminate ) + { + iMemSpySession.EndProcessL( id, EPanic ); + RefreshL(); + } + } + + break; + } + default: + { + // Programming error + __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); + } + } + } + + +void CMemSpyViewKernelObjects::CreateTabsL() + { + TMemSpyDriverContainerType type = iObjectType; + const TPtrC pType( MemSpyUiUtils::TypeAsString( type ) ); + + CEikStatusPane* statusPane = static_cast ( iEikonEnv->EikAppUi() )->StatusPane(); + TUid uid; + uid.iUid = EEikStatusPaneUidNavi; + iNaviPane = ( CAknNavigationControlContainer * ) statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); + iNavDecorator=iNaviPane->CreateMessageLabelL( pType ); + iNaviPane->PushL(*iNavDecorator); + } + + +void CMemSpyViewKernelObjects::DetailsL() + { + HBufC* messageBuf = HBufC::NewLC( 40960 ); + TPtr messagePtr = messageBuf->Des(); + + //const TMemSpyDriverHandleInfoGeneric& selectedObject = iObjectList->At( iListBox->CurrentItemIndex() ); + //iKernelObjectItems[iListBox->CurrentItemIndex]; + + // General attributes: + TFullName name; + name.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameDetail() ); + AppendFormatString( messagePtr, _L("Name: %S\n"), &name ); + name.Zero(); + name.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->Name() ); + AppendFormatString( messagePtr, _L("FullName: %S\n"), &name ); + name.Zero(); + AppendFormatString( messagePtr, _L("AccessCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AccessCount() ); + AppendFormatString( messagePtr, _L("UniqueID: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->UniqueID() ); + AppendFormatString( messagePtr, _L("Protection: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Protection() ); + AppendFormatString( messagePtr, _L("OwnrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfKernelOwner() ); + AppendFormatString( messagePtr, _L("KernelAddr: 0x%08X"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Handle() ); + + // Object type specific attributes: + switch ( iKernelObjectItems[iListBox->CurrentItemIndex()]->Type() ) + { + case EMemSpyDriverContainerTypeUnknown: + { + break; + } + case EMemSpyDriverContainerTypeThread: + { + AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningProcess() ); + AppendFormatString( messagePtr, _L("ThreadID: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Id() ); + AppendFormatString( messagePtr, _L("Priority: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Priority() ); + TFullName procName; + procName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() ); + AppendFormatString( messagePtr, _L("Proc: %S"), &procName ); + procName.Zero(); + break; + } + case EMemSpyDriverContainerTypeProcess: + { + AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningProcess() ); + AppendFormatString( messagePtr, _L("CreatorId: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->CreatorId() ); + AppendFormatString( messagePtr, _L("Attributes: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Attributes() ); + AppendFormatString( messagePtr, _L("StckChnk: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfDataBssStackChunk() ); + AppendFormatString( messagePtr, _L("ProcessID: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Id() ); + AppendFormatString( messagePtr, _L("Priority: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Priority() ); + AppendFormatString( messagePtr, _L("SecurityZone: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SecurityZone() ); + /* TODO: to solve process details + CMemSpyEngineObjectContainer& container = iEngine.Container(); + TProcessId id( iKernelObjectItems[iListBox->CurrentItemIndex().iId ); + TRAP_IGNORE( + CMemSpyProcess& process = container.ProcessByIdL( id ); + AppendFormatString( messagePtr, _L("\nSID: 0x%08X\n"), process.SID() ); + AppendFormatString( messagePtr, _L("VID: 0x%08X\n"), process.VID() ); + AppendFormatString( messagePtr, _L("UID1: 0x%08X\n"), process.UIDs()[0].iUid ); + AppendFormatString( messagePtr, _L("UID2: 0x%08X\n"), process.UIDs()[1].iUid ); + AppendFormatString( messagePtr, _L("UID3: 0x%08X\n"), process.UIDs()[2].iUid ); + AppendFormatString( messagePtr, _L("Caps: 0x%08X%08X"), process.Capabilities().iCaps[0], process.Capabilities().iCaps[1]); + ); + */ + break; + } + case EMemSpyDriverContainerTypeChunk: + { + AppendFormatString( messagePtr, _L("\nOwnrPrAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningProcess() ); + AppendFormatString( messagePtr, _L("Size: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Size() ); + AppendFormatString( messagePtr, _L("MaxSize: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MaxSize() ); + AppendFormatString( messagePtr, _L("Bottom: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Bottom() ); + AppendFormatString( messagePtr, _L("Top: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Top() ); + AppendFormatString( messagePtr, _L("Attr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Attributes() ); + AppendFormatString( messagePtr, _L("Start: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->StartPos() ); + AppendFormatString( messagePtr, _L("CntrlID: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->ControllingOwner() ); + AppendFormatString( messagePtr, _L("Restrictions: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Restrictions() ); + AppendFormatString( messagePtr, _L("MapAttr: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MapAttr() ); + AppendFormatString( messagePtr, _L("Type: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->ChunkType() ); + TFullName procName; + procName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() ); + AppendFormatString( messagePtr, _L("Proc: %S"), &procName ); + procName.Zero(); + // OwnerAddr iAddressOfKernelOwner already listed + // ProcAddr iAddressOfOwningProcess already listed + break; + } + case EMemSpyDriverContainerTypeLibrary: + { + AppendFormatString( messagePtr, _L("\nMapCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MapCount() ); + AppendFormatString( messagePtr, _L("State: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->State() ); + AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfCodeSeg() ); + break; + } + case EMemSpyDriverContainerTypeSemaphore: + { + AppendFormatString( messagePtr, _L("\nCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Count() ); + AppendFormatString( messagePtr, _L("Resetting: %u"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Resetting() ); + break; + } + case EMemSpyDriverContainerTypeMutex: + { + AppendFormatString( messagePtr, _L("\nHoldCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Count() ); + AppendFormatString( messagePtr, _L("WaitCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->WaitCount() ); + AppendFormatString( messagePtr, _L("Resetting: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Resetting() ); + AppendFormatString( messagePtr, _L("Order: %u"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Order() ); + break; + } + case EMemSpyDriverContainerTypeTimer: + { + AppendFormatString( messagePtr, _L("\nState: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->TimerState() ); + AppendFormatString( messagePtr, _L("Type: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->TimerType() ); + break; + } + case EMemSpyDriverContainerTypeServer: + { + // Owner == ThrdAddr + AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() ); + TFullName thrName; + thrName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() ); + AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName ); + thrName.Zero(); + AppendFormatString( messagePtr, _L("Type: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SessionType() ); + TBuf8<55>buf; + /* + RArray sessions; + CleanupClosePushL( sessions ); + iEngine.HelperServer().GetServerSessionsL( iKernelObjectItems[iListBox->CurrentItemIndex(), sessions ); + const TInt count = sessions.Count(); + for ( TInt i = 0; i < count; i++ ) + { + const TMemSpyDriverServerSessionInfo& session = sessions[ i ]; + AppendFormatString( messagePtr, _L("SessAddr: 0x%08X\n"), session.iAddress ); + TFullName sessName; + sessName.Copy( session.iName ); + AppendFormatString( messagePtr, _L("Sess: %S\n"), &sessName ); + } + CleanupStack::PopAndDestroy( &sessions ); + */ + break; + } + case EMemSpyDriverContainerTypeSession: + { + // Server == SvrAddr + AppendFormatString( messagePtr, _L("\nServer: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfServer() ); + TFullName srvName; + srvName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->Name() ); + AppendFormatString( messagePtr, _L("Srv: %S\n"), &srvName ); + srvName.Zero(); + // Session: not supported + AppendFormatString( messagePtr, _L("AccCount: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->TotalAccessCount() ); + AppendFormatString( messagePtr, _L("SesType: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SessionType() ); + AppendFormatString( messagePtr, _L("SvrType: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->SvrSessionType() ); + AppendFormatString( messagePtr, _L("MsgCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MsgCount() ); + AppendFormatString( messagePtr, _L("MsgLimit: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->MsgLimit() ); + break; + } + case EMemSpyDriverContainerTypeLogicalDevice: + { + AppendFormatString( messagePtr, + _L("\nVersion: %d.%d.%d\n"), + /* + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version.iMajor, TODO: To solve this + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version.iMinor, + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version.iBuild ); + */ + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(), + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(), + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version() ); + AppendFormatString( messagePtr, _L("ParseMask: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->ParseMask() ); + AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->UnitsMask() ); + AppendFormatString( messagePtr, _L("Open channels: %d"), iKernelObjectItems[iListBox->CurrentItemIndex()]->OpenChannels() ); + break; + } + case EMemSpyDriverContainerTypePhysicalDevice: + { + AppendFormatString( messagePtr, + _L("\nVersion: %d.%d.%d\n"), + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(), + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version(), + iKernelObjectItems[iListBox->CurrentItemIndex()]->Version() ); + AppendFormatString( messagePtr, _L("UnitsMask: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->UnitsMask() ); + AppendFormatString( messagePtr, _L("CodeSeg: 0x%08X"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfCodeSeg() ); + break; + } + case EMemSpyDriverContainerTypeLogicalChannel: + { + // No other details + break; + } + case EMemSpyDriverContainerTypeChangeNotifier: + { + AppendFormatString( messagePtr, _L("\nChanges: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Changes() ); + // Thread == ThrdAddr + AppendFormatString( messagePtr, _L("ThrdAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() ); + TFullName thrName; + thrName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() ); + AppendFormatString( messagePtr, _L("Thr: %S"), &thrName ); + thrName.Zero(); + break; + } + case EMemSpyDriverContainerTypeUndertaker: + { + // Thread == ThrdAddr + AppendFormatString( messagePtr, _L("\nThrdAddr: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() ); + TFullName thrName; + thrName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() ); + AppendFormatString( messagePtr, _L("Thr: %S"), &thrName ); + thrName.Zero(); + break; + } + case EMemSpyDriverContainerTypeMsgQueue: + { + // No other details + break; + } + case EMemSpyDriverContainerTypePropertyRef: + { + /* + Not listing details here, as propertyRef is not listed in TaskMgr. + Following propertyRef attributes are available at engine side. + + IsReady + Type + Category + Key + RefCount + ThreadId + CreatorSID + */ + break; + } + case EMemSpyDriverContainerTypeCondVar: + { + AppendFormatString( messagePtr, _L("\nResetting: %u\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->Resetting() ); + // Using iAddressOfOwningThread for mutex + AppendFormatString( messagePtr, _L("Mutex: 0x%08X\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->AddressOfOwningThread() ); + // Using iNameOfOwner for mutex + TFullName mtxName; + mtxName.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->NameOfOwner() ); + AppendFormatString( messagePtr, _L("Mtx: %S\n"), &mtxName ); + mtxName.Zero(); + AppendFormatString( messagePtr, _L("WaitCount: %d\n"), iKernelObjectItems[iListBox->CurrentItemIndex()]->WaitCount() ); + /* + RArray threads; + CleanupClosePushL( threads ); + iEngine.HelperCondVar().GetCondVarSuspendedThreadsL( iKernelObjectItems[iListBox->CurrentItemIndex(), threads ); + const TInt count = threads.Count(); + for ( TInt i = 0; i < count; i++ ) + { + const TMemSpyDriverCondVarSuspendedThreadInfo& thr = threads[ i ]; + AppendFormatString( messagePtr, _L("SuspThrdAddr: 0x%08X\n"), thr.iAddress ); + TFullName thrName; + thrName.Copy( thr.iName ); + AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName ); + } + CleanupStack::PopAndDestroy( &threads ); + */ + break; + } + default: + { + // Programming error + __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); + } + } + + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); + dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG ); + TFileName headerText; + headerText.Copy( iKernelObjectItems[iListBox->CurrentItemIndex()]->Name() ); + dialog->SetHeaderTextL( headerText ); + dialog->SetMessageTextL(messagePtr); + dialog->RunLD(); + CleanupStack::PopAndDestroy( messageBuf ); + } + + +void CMemSpyViewKernelObjects::AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ) + { + TBuf infoString; + VA_LIST list; + VA_START ( list, aFmt ); + infoString.FormatList( aFmt, list ); + aPtr.Append( infoString ); + } + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewMainMenu.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewMainMenu.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,329 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewMainMenu.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewProcesses.h" +#include "MemSpyViewRAMInfo.h" +#include "MemSpyViewROMInfo.h" +#include "MemSpyViewServerList.h" +#include "MemSpyViewOpenFiles.h" +#include "MemSpyViewFBServBitmaps.h" +#include "MemSpyViewSystemConfig.h" +#include "MemSpyViewCodeSegList.h" +#include "MemSpyViewChunkList.h" +#include "MemSpyViewKernel.h" +#include "MemSpyViewHeapTracking.h" +#include "MemSpyViewDriveInfo.h" +#include "MemSpyViewECom.h" +#include "MemSpyViewMemoryTrackingAutoStartConfig.h" +#include "MemSpyViewWindowGroups.h" + +// System includes +#include + +/* +CMemSpyViewMainMenu::CMemSpyViewMainMenu( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } +*/ +CMemSpyViewMainMenu::CMemSpyViewMainMenu( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ) + { + } + +void CMemSpyViewMainMenu::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "MemSpy" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // Make sure the correct item is selected + const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune); + const TInt index = IndexByViewType( viewType ); + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + +void CMemSpyViewMainMenu::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewMainMenu::ViewType() const + { + return EMemSpyViewTypeMainMenu; + } + + +CMemSpyViewBase* CMemSpyViewMainMenu::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + const TInt index = iListBox->CurrentItemIndex(); + +#ifdef __WINS__ + // threads & process view is not supported in the emulator environment + if ( index == 0 ) + { + CAknInformationNote* note = new (ELeave) CAknInformationNote; + note->ExecuteLD(_L("Not supported in the emulator, try Kernel -> Objects view")); + return NULL; + } +#endif + + if ( index == 0 ) + { + child = new(ELeave) CMemSpyViewProcesses( iMemSpySession, iObserver ); + } + else if ( index == 1 ) + { + //child = new(ELeave) CMemSpyViewRAMInfo( iEngine, iObserver ); + child = new(ELeave) CMemSpyViewKernel( iMemSpySession, iObserver ); + } + else if ( index == 2 ) + { + child = new(ELeave) CMemSpyViewHeapTracking( iMemSpySession, iObserver ); + } + else if ( index == 3 ) + { + child = new(ELeave) CMemSpyViewServerList( iMemSpySession, iObserver ); + } + + /* + else if ( index == 2 ) + { + child = new(ELeave) CMemSpyViewROMInfo( iEngine, iObserver ); + } + else if ( index == 3 ) + { + child = new(ELeave) CMemSpyViewFBServBitmaps( iEngine, iObserver ); + } + else if ( index == 4 ) + { + child = new(ELeave) CMemSpyViewServerList( iEngine, iObserver ); + } + else if ( index == 5 ) + { + child = new(ELeave) CMemSpyViewChunkList( iEngine, iObserver ); + } + else if ( index == 6 ) + { + child = new(ELeave) CMemSpyViewCodeSegList( iEngine, iObserver ); + } + else if ( index == 7 ) + { + child = new(ELeave) CMemSpyViewOpenFiles( iEngine, iObserver ); + } + else if ( index == 8 ) + { + child = new(ELeave) CMemSpyViewSystemConfig( iEngine, iObserver ); + } + else if ( index == 9 ) + { + child = new(ELeave) CMemSpyViewKernel( iEngine, iObserver ); + } + else if ( index == 10 ) + { + child = new(ELeave) CMemSpyViewHeapTracking( iEngine, iObserver ); + } + */ + /* + else if ( index == 11 ) + { + child = new(ELeave) CMemSpyViewMemoryTrackingAutoStartConfig( iEngine, iObserver ); + } + else if ( index == 12 ) + { + child = new(ELeave) CMemSpyViewDriveList( iEngine, iObserver ); + } + else if ( index == 13 ) + { + child = new(ELeave) CMemSpyViewECom( iEngine, iObserver ); + } + else if ( index == 14 ) + { + child = new(ELeave) CMemSpyViewWindowGroups( iEngine, iObserver ); + } + */ + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewMainMenu::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf item; + + + // 1st item = Processes + _LIT(KItem1Format, "\tProcesses & Threads"); + item.Format( KItem1Format ); + model->AppendL( item ); + + //some main view items temporary removed + /* + // 2nd item = RAM info + _LIT(KItem2Format, "\tRAM Info"); + model->AppendL( KItem2Format ); + + // 3rd item = ROM info + _LIT(KItem3Format, "\tROM Info"); + model->AppendL( KItem3Format ); + + // 4th item = FBServ Bitmaps + _LIT(KItem4Format, "\tFont & Bitmap\nServer"); + model->AppendL( KItem4Format ); + */ + + /* + // 6th item = Chunks + _LIT(KItem6Format, "\tChunks"); + model->AppendL( KItem6Format ); + + // 7th item = Code Segments + _LIT(KItem7Format, "\tCode Segments"); + model->AppendL( KItem7Format ); + + // 8th item = Open Files + _LIT(KItem8Format, "\tOpen Files"); + model->AppendL( KItem8Format ); + + // 9th item = System Config + _LIT(KItem9Format, "\tSystem\nConfiguration"); + model->AppendL( KItem9Format ); + */ + + // 10th item = Kernel + _LIT(KItem2Format, "\tKernel"); + model->AppendL( KItem2Format ); + + // 11th item = Heap Tracking + _LIT(KItem3Format, "\tSystem-Wide Memory Tracking"); + model->AppendL( KItem3Format ); + + // 5th item = Servers + _LIT(KItem4Format, "\tServers"); + model->AppendL( KItem4Format ); + /* + // 12th item = Process-specific Tracking + _LIT(KItem12Format, "\tProcess-Specific Memory Tracking"); + model->AppendL( KItem12Format ); + + // 13th item = Drive Info + _LIT(KItem13Format, "\tDrive Summary"); + model->AppendL( KItem13Format ); + + // 14th item = ECOM + _LIT(KItem14Format, "\tECom"); + model->AppendL( KItem14Format ); + + // 15th item = Window Groups + _LIT(KItem15Format, "\tWindow Groups"); + model->AppendL( KItem15Format ); + */ + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + + +TInt CMemSpyViewMainMenu::IndexByViewType( TMemSpyViewType aType ) + { + TInt index = 0; + // + switch( aType ) + { + default: + + case EMemSpyViewTypeProcesses: + index = 0; + break; +/* case EMemSpyViewTypeRAMInfo: + index = 1; + break; + case EMemSpyViewTypeROMInfo: + index = 2; + break; + case EMemSpyViewTypeFBServBitmaps: + index = 3; + break; + */ + /* + case EMemSpyViewTypeChunkList: + index = 5; + break; + case EMemSpyViewTypeCodeSegmentList: + index = 6; + break; + case EMemSpyViewTypeOpenFiles: + index = 7; + break; + case EMemSpyViewTypeSystemConfig: + index = 8; + break;*/ + + case EMemSpyViewTypeKernel: + index = 1 ; + break; + case EMemSpyViewTypeHeapTracking: + index = 2; + break; + case EMemSpyViewTypeServerList: + index = 3; + break; + + + /*case EMemSpyViewTypeThreadInfoItemMemoryTrackingAutoStartConfig: + index = 11; + break; + case EMemSpyViewTypeDriveSummary: + index = 12; + break; + case EMemSpyViewTypeECom: + index = 13; + break; + case EMemSpyViewTypeWindowGroups: + index = 14; + break;*/ + } + // + return index; + } + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewMemoryTrackingAutoStartConfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewMemoryTrackingAutoStartConfig.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,570 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewMemoryTrackingAutoStartConfig.h" + +// System includes +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + +// Literal constants +_LIT8( KMemSpyProcessMemoryTrackerXmlFileMimeType, "text/xml" ); +_LIT8( KMemSpyXmlSpec_MasterSection, "memspy_process_memory_tracking" ); +_LIT8( KMemSpyXmlSpec_EntryProcess, "process" ); +_LIT8( KMemSpyXmlSpec_EntryProcess_SID, "sid" ); +_LIT8( KMemSpyXmlSpec_HexPrefix, "0x" ); + + + +CMemSpyViewMemoryTrackingAutoStartConfig::CMemSpyViewMemoryTrackingAutoStartConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +CMemSpyViewMemoryTrackingAutoStartConfig::~CMemSpyViewMemoryTrackingAutoStartConfig() + { + iProcessUids.Close(); + // + delete iParser; + delete iConverter; + // + delete iXMLFileNameInstallTime; + delete iXMLFileNameUserSupplied; + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + + // We only convert from UTF-8 to UTF-16 + iParser = CParser::NewL( KMemSpyProcessMemoryTrackerXmlFileMimeType, *this ); + iConverter = CCnvCharacterSetConverter::NewL(); + if ( iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierUtf8, iEngine.FsSession() ) == CCnvCharacterSetConverter::ENotAvailable ) + { + User::Leave(KErrNotFound); + } + + // Search for standard files + FindXmlInstallTimeL(); + FindXmlUserSuppliedL(); + + // Copy items to our own temporary list... + const RArray& list = iEngine.HelperProcess().MemoryTrackingAutoStartProcessList(); + for( TInt i=0; iConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + + return parent; + } + + +TBool CMemSpyViewMemoryTrackingAutoStartConfig::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdMemoryTrackingAutoStartItemAdd: + OnCmdItemAddL(); + break; + case EMemSpyCmdMemoryTrackingAutoStartItemEdit: + OnCmdItemEditL(); + break; + case EMemSpyCmdMemoryTrackingAutoStartItemDelete: + OnCmdItemDeleteL(); + break; + case EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll: + OnCmdItemDeleteAllL(); + break; + case EMemSpyCmdMemoryTrackingAutoStartItemImport: + OnCmdItemImportL(); + break; + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::HandleListBoxItemActionedL( TInt /*aIndex*/ ) + { + OnCmdItemEditL(); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf<128> buf; + _LIT( KProcUidFormatSpec, "\t0x%08x" ); + + const TInt count = iProcessUids.Count(); + for( TInt i=0; iAppendL( buf ); + } + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == MenuCascadeResourceId() ) + { + const TInt count = iProcessUids.Count(); + const TInt index = iListBox->CurrentItemIndex(); + + // We cannot edit an item if none exists + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemEdit, ( count == 0 || index < 0 || index > count - 1 ) ); + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDelete, ( count == 0 || index < 0 || index > count - 1 ) ); + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll, ( count <= 1 || index > count - 1 ) ); + + // We can only import items if an XML file is available + const TBool xmlAvailable = ( iXMLFileNameInstallTime->Length() || iXMLFileNameUserSupplied->Length() ); + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStartItemImport, !xmlAvailable ); + } + } + + +TUint CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeResourceId() const + { + return R_MEMSPY_MENUPANE_MEMORY_TRACKING_AUTOSTART; + } + + +TInt CMemSpyViewMemoryTrackingAutoStartConfig::MenuCascadeCommandId() const + { + return EMemSpyCmdMemoryTrackingAutoStart; + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemAddL() + { + const TUid uid = ShowDialogL( KNullUid ); + if ( uid != KNullUid ) + { + User::LeaveIfError( iProcessUids.Append( uid ) ); + SaveChangesL(); + RefreshL(); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); + } + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemEditL() + { + const TInt index = iListBox->CurrentItemIndex(); + if ( index >= 0 && index < iProcessUids.Count() ) + { + TUid processUid = iProcessUids[ index ]; + processUid = ShowDialogL( processUid ); + // + if ( processUid != KNullUid ) + { + iProcessUids[ index ] = processUid; + SaveChangesL(); + RefreshL(); + iListBox->HandleItemAdditionL(); + iListBox->DrawDeferred(); + } + } + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteL() + { + const TInt index = iListBox->CurrentItemIndex(); + if ( index >= 0 && index < iProcessUids.Count() ) + { + iProcessUids.Remove( index ); + SaveChangesL(); + RefreshL(); + iListBox->HandleItemRemovalL(); + iListBox->DrawDeferred(); + + const TInt newIndex = index - 1; + const TInt count = iProcessUids.Count(); + if ( newIndex >=0 && newIndex < count ) + { + iListBox->SetCurrentItemIndex( index ); + } + } + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemDeleteAllL() + { + iProcessUids.Reset(); + SaveChangesL(); + RefreshL(); + iListBox->HandleItemRemovalL(); + iListBox->DrawDeferred(); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnCmdItemImportL() + { + if ( iXMLFileNameInstallTime->Length() ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_INSTALLED_XML_DIALOG ) ) + { + TRAP_IGNORE( ParseL( *iXMLFileNameInstallTime ) ); + } + } + if ( iXMLFileNameUserSupplied->Length() ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + if ( importDialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_IMPORT_FROM_USERDEFINED_XML_DIALOG ) ) + { + TRAP_IGNORE( ParseL( *iXMLFileNameUserSupplied ) ); + } + } + + SaveChangesL(); + RefreshL(); + iListBox->HandleItemRemovalL(); + iListBox->DrawDeferred(); + } + + +TUid CMemSpyViewMemoryTrackingAutoStartConfig::ShowDialogL( TUid aUid ) + { + TUid uid = KNullUid; + // + _LIT( KProcessUidFormat, "%x" ); + TBuf<128> buf; + buf.Format( KProcessUidFormat, aUid ); + // + CAknTextQueryDialog* dialog = new(ELeave) CAknTextQueryDialog( buf ); + const TBool dialogActioned = ( dialog->ExecuteLD( R_MEMSPY_MEMORY_TRACKING_PROCESS_UID_DIALOG ) ); + // + if ( dialogActioned ) + { + // Validate the text + uid = ValidateProcessUid( buf ); + } + // + return uid; + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::SaveChangesL() + { + iEngine.HelperProcess().SetMemoryTrackingAutoStartProcessListL( iProcessUids ); + Settings().StoreSettingsL(); + } + + +TUid CMemSpyViewMemoryTrackingAutoStartConfig::ValidateProcessUid( const TDesC& aUid ) + { + TUid ret = KNullUid; + TBool isValid = ETrue; + // + const TInt length = aUid.Length(); + for( TInt i=0; i= 8 ) + { + TRadix radix = EDecimal; + TPtrC8 pValue( value ); + // + if ( value.Length() == 10 && value.Left( 2 ) == KMemSpyXmlSpec_HexPrefix ) + { + pValue.Set( value.Mid( 2 ) ); + radix = EHex; + } + // + TUint32 uidVal = 0; + TLex8 lexer( pValue ); + const TInt err = lexer.Val( uidVal, radix ); + User::LeaveIfError( err ); + uid.iUid = uidVal; + gotSID = ETrue; + } + } + } + } + // + if ( gotSID ) + { + User::LeaveIfError( iProcessUids.Append( uid ) ); + } + else + { + User::Leave( KErrCorrupt ); + } + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartDocumentL( const RDocumentParameters& /*aDocParam*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndDocumentL( TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartElementL( const RTagInfo& aElement, const RAttributeArray& aAttributes, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + // + const TPtrC8 name( aElement.LocalName().DesC() ); + // + if ( name.CompareF( KMemSpyXmlSpec_MasterSection ) == 0 ) + { + iSeenMasterSection = ETrue; + } + else if ( iSeenMasterSection && name.CompareF( KMemSpyXmlSpec_EntryProcess ) == 0 ) + { + OnSectionProcessL( aAttributes ); + } + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndElementL( const RTagInfo& /*aElement*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnContentL( const TDesC8& /*aBytes*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnStartPrefixMappingL( const RString& /*aPrefix*/, const RString& /*aUri*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnEndPrefixMappingL( const RString& /*aPrefix*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnSkippedEntityL( const RString& /*aName*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnProcessingInstructionL( const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, TInt aErrorCode ) + { + User::LeaveIfError( aErrorCode ); + } + + +void CMemSpyViewMemoryTrackingAutoStartConfig::OnError( TInt aErrorCode ) + { + iParserErrorCode = aErrorCode; + } + + +TAny* CMemSpyViewMemoryTrackingAutoStartConfig::GetExtendedInterface( const TInt32 /*aUid*/ ) + { + return NULL; + } + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewOpenFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewOpenFiles.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,274 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewOpenFiles.h" + +// System includes +#include +#include +#include +#include +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewThreads.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + + + + +CMemSpyViewOpenFiles::CMemSpyViewOpenFiles( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +CMemSpyViewOpenFiles::~CMemSpyViewOpenFiles() + { + iThreadIds.Close(); + iFileNames.Close(); + } + + +void CMemSpyViewOpenFiles::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Open Files" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +CEikListBox* CMemSpyViewOpenFiles::ConstructListBoxL() + { + delete iListBox; + iListBox = NULL; + CAknDoubleGraphicStyleListBox* listbox = new (ELeave) CAknDoubleGraphicStyleListBox(); + iListBox = listbox; + // + listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); + listbox->SetContainerWindowL( *this ); + listbox->CreateScrollBarFrameL( ETrue ); + SetListBoxModelL(); + listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + listbox->SetListBoxObserver( this ); + listbox->SetObserver( this ); + + // Create icon array + CAknIconArray* iconArray = new (ELeave) CAknIconArray(1); + CleanupStack::PushL( iconArray ); + + // Create bitmap + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap(); + CleanupStack::PushL( bitmap ); + const TInt error1 = bitmap->Create( TSize(10,10), EColor16M ); + User::LeaveIfError( error1 ); + + // Create mask + CFbsBitmap* mask = new(ELeave) CFbsBitmap(); + CleanupStack::PushL( mask ); + const TInt error2 = mask->Create( TSize(10,10), EColor16M ); + User::LeaveIfError( error2 ); + + // Create icon & transfer bitmap + CGulIcon* icon = CGulIcon::NewL( bitmap, mask ); + CleanupStack::Pop( 2, bitmap ); + CleanupStack::PushL( icon ); + + // Transfer icon to array + iconArray->AppendL( icon ); + CleanupStack::Pop( icon ); + + // Give icon array to listbox + static_cast(iListBox)->ItemDrawer()->FormattedCellData()->SetIconArrayL(iconArray); + CleanupStack::Pop( iconArray ); + // + return listbox; + } + + +void CMemSpyViewOpenFiles::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewOpenFiles::ViewType() const + { + return EMemSpyViewTypeOpenFiles; + } + + +TBool CMemSpyViewOpenFiles::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdToolsListOpenFiles: + OnCmdListOpenFilesL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewOpenFiles::OnCmdListOpenFilesL() + { + iEngine.ListOpenFilesL(); + } + + +CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewOpenFiles::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + + // First, try to find the selected thread + if ( iActionedThreadId ) + { + // Try to create a view of the thread in question + CMemSpyProcess* process = NULL; + CMemSpyThread* thread = NULL; + const TInt error = iEngine.Container().ProcessAndThreadByThreadId( *iActionedThreadId, process, thread ); + if ( error == KErrNone && thread != NULL ) + { + child = new(ELeave) CMemSpyViewThreads( iEngine, iObserver, thread->Process() ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent(), thread ); + CleanupStack::Pop( child ); + } + } + // + return child; + } + + +void CMemSpyViewOpenFiles::SetListBoxModelL() + { + _LIT(KLineFormatSpec, "%d\t%S\t%S %S"); + + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf item; + TMemSpySizeText valueBuf; + TBuf<64> timeBuf; + + iFileNames.Reset(); + iThreadIds.Reset(); + iActionedThreadId = NULL; + + RFs& fsSession = iCoeEnv->FsSession(); + TOpenFileScan scanner( fsSession ); + + CFileList* list = NULL; + scanner.NextL( list ); + + TIdentityRelation comparer( CompareTEntryObjects ); + + while( list != NULL ) + { + CleanupStack::PushL( list ); + + const TInt entryCount = list->Count(); + for(TInt i=0; iAppendL( item ); + iThreadIds.AppendL( scanner.ThreadId() ); + iFileNames.AppendL( entry ); + } + } + + CleanupStack::PopAndDestroy( list ); + list = NULL; + scanner.NextL( list ); + } + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + + +void CMemSpyViewOpenFiles::HandleListBoxItemActionedL( TInt aCurrentIndex ) + { + if ( aCurrentIndex >= 0 && aCurrentIndex < iThreadIds.Count() ) + { + iActionedThreadId = &iThreadIds[ aCurrentIndex ]; + } + else + { + iActionedThreadId = NULL; + } + + // Notify observer about an item being 'fired' + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +TBool CMemSpyViewOpenFiles::CompareTEntryObjects( const TEntry& aLeft, const TEntry& aRight ) + { + return ( aLeft.iName.CompareF( aRight.iName ) == 0 ); + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewProcesses.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,604 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewProcesses.h" + +// System includes +#include +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyViewThreads.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" +#include "MemSpyUiUtils.h" + +// Constants +const TInt KMemSpyMaxSearchTextLength = 30; +const TInt KMemSpyMaxSearchTextLengthWithWildcards = KMemSpyMaxSearchTextLength + 4; + + +CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ) + { + } + +CMemSpyViewProcesses::CMemSpyViewProcesses( RMemSpySession& aEngine, MMemSpyViewObserver& aObserver, TProcessId aId ) +: CMemSpyViewBase( aEngine, aObserver ), iCurrentProcessId( aId ) + { + } + +CMemSpyViewProcesses::~CMemSpyViewProcesses() + { + iProcesses.Close(); + //delete iSearchField; + delete iMatcherBuffer; + } + + +//void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) +void CMemSpyViewProcesses::ConstructL( const TRect& aRect, CCoeControl& aContainer, TProcessId aSelectionRune ) + { + iMemSpySession.GetProcessesL(iProcesses); // get processes array; + + _LIT( KTitle, "Processes\n& Threads" ); + SetTitleL( KTitle ); + // + //CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + CMemSpyViewBase::ConstructL( aRect, aContainer ); + // + iMatcherBuffer = HBufC::NewL( KMemSpyMaxSearchTextLengthWithWildcards ); + // + /* TODO: to restore the Search field functionality + iSearchField = CAknSearchField::NewL( *this, CAknSearchField::ESearch, NULL, KMemSpyMaxSearchTextLength ); + + iSearchField->SetObserver( this ); + iSearchField->SetFocus( ETrue ); + iSearchField->SetComponentsToInheritVisibility( ETrue ); + */ + // + if ( iCurrentProcessId > 0 ) + { + TInt index = 0; + // TProcessId selectedItem = aSelectionRune; //static_cast< TProcessId >( *aSelectionRune ); + for( TInt i=0; iId() == iCurrentProcessId ) + { + index = i; + } + } + + if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + } + else if ( iProcesses.Count() > 0 ) + { + iListBox->SetCurrentItemIndex( 0 ); + HandleListBoxItemSelectedL( 0 ); + } + // + SizeChanged(); + ActivateL(); + } + + +CMemSpyProcess& CMemSpyViewProcesses::CurrentProcess() const + { + /* + __ASSERT_ALWAYS( iCurrentProcess != NULL, User::Invariant() ); + return *iCurrentProcess; + */ + } + + +void CMemSpyViewProcesses::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewProcesses::ViewType() const + { + return EMemSpyViewTypeProcesses; + } + + +CMemSpyViewBase* CMemSpyViewProcesses::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewProcesses::PrepareChildViewL() + { + CMemSpyViewThreads* child = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iProcesses[iListBox->CurrentItemIndex()]->Id(), 0 ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + + return 0; + } + + +void CMemSpyViewProcesses::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == MenuCascadeResourceId() ) + { + TInt index = iListBox->CurrentItemIndex( ); + const TBool hide = iProcesses[index]->IsDead() || iProcesses[index]->ThreadCount() == 0; + + //aMenuPane->SetItemDimmed( EMemSpyCmdProcessInfo, hide ); //to be added into API + aMenuPane->SetItemDimmed( EMemSpyCmdProcessEnd, hide ); + } + } + + +TBool CMemSpyViewProcesses::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + // Sorting + case EMemSpyCmdProcessSortById: + OnCmdSortByIdL(); + break; + case EMemSpyCmdProcessSortByName: + OnCmdSortByNameL(); + break; + case EMemSpyCmdProcessSortByThreadCount: + OnCmdSortByThreadCountL(); + break; + case EMemSpyCmdProcessSortByCodeSegs: + OnCmdSortByCodeSegsL(); + break; + case EMemSpyCmdProcessSortByHeapUsage: + OnCmdSortByHeapUsageL(); + break; + case EMemSpyCmdProcessSortByStackUsage: + OnCmdSortByStackUsageL(); + break; + // End + case EMemSpyCmdProcessEndTerminate: + OnCmdEndTerminateL(); + break; + case EMemSpyCmdProcessEndKill: + OnCmdEndKillL(); + break; + case EMemSpyCmdProcessEndPanic: + OnCmdEndPanicL(); + break; + // Info + case EMemSpyCmdProcessInfoSummary: + OnCmdInfoSummaryL(); + break; + case EMemSpyCmdProcessInfoHandles: + OnCmdInfoHandlesL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewProcesses::OnCmdSortByIdL() + { + //iEngine.Container().SortById(); + RefreshL(); + } + + +void CMemSpyViewProcesses::OnCmdSortByNameL() + { + //iEngine.Container().SortByName(); + RefreshL(); + } + + +void CMemSpyViewProcesses::OnCmdSortByThreadCountL() + { + //iEngine.Container().SortByThreadCount(); + RefreshL(); + } + + +void CMemSpyViewProcesses::OnCmdSortByCodeSegsL() + { + //iEngine.Container().SortByCodeSegs(); + RefreshL(); + } + + +void CMemSpyViewProcesses::OnCmdSortByHeapUsageL() + { + //iEngine.Container().SortByHeapUsage(); + RefreshL(); + } + + +void CMemSpyViewProcesses::OnCmdSortByStackUsageL() + { + // iEngine.Container().SortByStackUsage(); + RefreshL(); + } + + +void CMemSpyViewProcesses::OnCmdInfoSummaryL() + { + //CMemSpyProcess& process = CurrentProcess(); + //iEngine.HelperProcess().OutputProcessInfoL( process ); + } + + +void CMemSpyViewProcesses::OnCmdInfoHandlesL() + { + /* + CMemSpyProcess& process = CurrentProcess(); + // + const TInt threadCount = process.Count(); + for( TInt i=0; iExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + + if ( doTerminate ) + { + TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, ETerminate ) ); + if( err = KErrNone ) + RefreshL(); + } + } + + +void CMemSpyViewProcesses::OnCmdEndPanicL() + { + TBool system = ETrue; + TBool doTerminate = ETrue; + TInt err = KErrNone; + + iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system ); + + if ( system ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + + if ( doTerminate ) + { + TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EPanic ) ); + if( err == KErrNone ) + RefreshL(); + } + } + + +void CMemSpyViewProcesses::OnCmdEndKillL() + { + TBool system = ETrue; + TBool doTerminate = ETrue; + TInt err = KErrNone; + + iMemSpySession.ProcessSystemPermanentOrCritical( iCurrentProcessId, system ); + + if ( system ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + + if ( doTerminate ) + { + TRAP( err, iMemSpySession.EndProcessL( iCurrentProcessId, EKill ) ) + if( err == KErrNone ) + RefreshL(); + } + } + + + + +void CMemSpyViewProcesses::SetListBoxModelL() + { + if( iProcesses.Count() > 0 ) + { + iProcesses.Close(); + } + + iMemSpySession.GetProcessesL(iProcesses); // get processes array; + iModel = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 1); //array for formated items + + _LIT( KTab, "\t" ); + iModel = FormatModel( iProcesses ); //TODO Format model method with advanced formatting + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + //listbox->Model()->SetItemTextArray( &iEngine.Container() ); + listbox->Model()->SetItemTextArray( iModel ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewProcesses::HandleListBoxItemActionedL( TInt /*aIndex*/ ) + { + // Notify observer about an item being 'fired' + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewProcesses::HandleListBoxItemSelectedL( TInt aIndex ) + { + iCurrentProcessId = iProcesses[aIndex]->Id(); + /* + if ( iCurrentProcess ) + { + iCurrentProcess->Close(); + } + + // Obtain the process that corresponds to the selected item + CMemSpyEngineObjectContainer& container = iEngine.Container(); + CMemSpyProcess& process = container.At( aIndex ); + iCurrentProcess = &process; + + // Notify observer about item selection + */ + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + +void CMemSpyViewProcesses::SizeChanged() + { + const TRect rect( Rect() ); + CMemSpyViewBase::SizeChanged(); + /* + if ( iListBox && iSearchField ) + { + const TInt lafIndex_H = 1; + AknLayoutUtils::LayoutControl( iListBox, rect, AknLayout::list_gen_pane( lafIndex_H ) ); + AknLayoutUtils::LayoutControl( iSearchField, rect, AknLayout::find_pane() ); + } + else + { + CMemSpyViewBase::SizeChanged(); + } + */ + +/* + // Search field + TSize searchFieldSize( iSearchField->MinimumSize() ); // BALLS: search field doesn't implement minimum size correctly?!?!? + searchFieldSize.SetWidth( rect.Width() ); + const TRect searchFieldRect( TPoint( rect.iTl.iX, rect.iBr.iY ), searchFieldSize ); + iSearchField->SetRect( searchFieldRect ); + + // Listbox + TSize listBoxSize( rect.Size() - TSize( 0, searchFieldSize.iHeight ) ); + iListBox->SetRect( rect.iTl, listBoxSize ); +*/ + } + + +TInt CMemSpyViewProcesses::CountComponentControls() const + { + TInt count = 0; + // + if ( iListBox != NULL ) + { + ++count; + } + /*if ( iSearchField != NULL ) + { + ++count; + }*/ + // + return count; + } + + +CCoeControl* CMemSpyViewProcesses::ComponentControl( TInt aIndex ) const + { + CCoeControl* ret = iListBox; + // + if ( aIndex == 1 ) + { + //ret = iSearchField; + } + // + return ret; + } + + +TKeyResponse CMemSpyViewProcesses::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) + { + TKeyResponse resp = EKeyWasNotConsumed; + // + if ( aType == EEventKey ) + { + switch( aKeyEvent.iCode ) + { + case EKeyUpArrow: + case EKeyDownArrow: + case EKeyEnter: + case EKeyOK: + if ( iListBox ) + { + resp = iListBox->OfferKeyEventL( aKeyEvent, aType ); + } + break; + default: + break; + } + // + if ( resp == EKeyWasNotConsumed ) + { + // Do we need to show the find field? + //resp = iSearchField->OfferKeyEventL( aKeyEvent, aType ); + } + } + // + return resp; + } + + +void CMemSpyViewProcesses::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) + { + CMemSpyViewBase::HandleControlEventL( aControl, aEventType ); + // + if ( aEventType == MCoeControlObserver::EEventStateChanged ) + { + /* + if ( aControl == iSearchField ) + { + SelectListBoxItemByFindTextL(); + } + */ + } + } + + +void CMemSpyViewProcesses::FocusChanged( TDrawNow /*aDrawNow*/ ) + { + if ( iListBox ) + { + iListBox->SetFocus( IsFocused() ); + } + /*if ( iSearchField ) + { + iSearchField->SetFocus( IsFocused() ); + } + */ + } + + +void CMemSpyViewProcesses::SelectListBoxItemByFindTextL() + { + /* + _LIT( KMemSpyWildcardCharacter, "*" ); + + TPtr pBuffer( iMatcherBuffer->Des() ); + iSearchField->GetSearchText( pBuffer ); + //pBuffer.Insert( 0, KMemSpyWildcardCharacter ); + pBuffer.Append( KMemSpyWildcardCharacter ); + + CMemSpyEngineObjectContainer& container = iEngine.Container(); + const TInt count = container.Count(); + // + TInt index = 0; + while( index < count ) + { + CMemSpyProcess& process = container.At( index ); + const TPtrC processName( process.Name() ); + // + if ( processName.MatchF( pBuffer ) >= 0 ) + { + HandleListBoxItemSelectedL( index ); + iListBox->ScrollToMakeItemVisible( index ); + iListBox->SetCurrentItemIndexAndDraw( index ); + return; + } + + ++index; + } + */ + } + +//Model formating methods +//TODO: to be debbuged + +CDesCArrayFlat* CMemSpyViewProcesses::FormatModel( RArray aProcesses ) + { + model = new (ELeave) CDesC16ArrayFlat( iProcesses.Count() + 16 ); //array for formated items + _LIT( KMemSpyProcessNameFormatSpecBasicName, " \t%S\t\t%8x, " ); + + for( TInt i=0; i < aProcesses.Count(); i++ ) + { + HBufC* tempName = HBufC::NewL( KMaxFullName ); //aProcesses[i]->Name().Length() + 16 + CleanupStack::PushL( tempName ); + TPtr tempNamePtr( tempName->Des() ); + tempNamePtr.Copy( aProcesses[i]->Name() ); + + TBuf<10> priority; + TProcessPriority tempPriority = aProcesses[i]->Priority(); + MemSpyUiUtils::AppendPriority( priority, tempPriority ); + + // Convert the full name to the format we want in the UI + TBuf name; + TMemSpyTruncateOverflow overflow; //included from EngineUtils TODO: to consider if this is needed to be removed or left there + TUint32 tempSID = aProcesses[i]->SID(); + name.AppendFormat( KMemSpyProcessNameFormatSpecBasicName, &overflow, tempName, tempSID ); //tempNamePtr + + if( aProcesses[i]->ExitType() != EExitPending ) // instead of IsDead() method + { + MemSpyUiUtils::AppendExitInfo( name, aProcesses[i]->ExitType(), aProcesses[i]->ExitReason(), aProcesses[i]->ExitCategory() ); + } + else + { + _LIT( KMemSpyProcessNameFormatSpecAlive, "%2d thr, %S" ); + name.AppendFormat( KMemSpyProcessNameFormatSpecAlive, &overflow, aProcesses[i]->ThreadCount(), &priority ); + } + + model->AppendL( name ); + + CleanupStack::PopAndDestroy( tempName ); + } + + return model; + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewRAMInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewRAMInfo.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,211 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewRAMInfo.h" + +// System includes +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + + + + + + +CMemSpyViewRAMInfo::CMemSpyViewRAMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +void CMemSpyViewRAMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "RAM Info" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewRAMInfo::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewRAMInfo::ViewType() const + { + return EMemSpyViewTypeRAMInfo; + } + + +CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewRAMInfo::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + return child; + } + + +void CMemSpyViewRAMInfo::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf item; + + TInt value; + TMemSpySizeText size; + TMemoryInfoV1Buf memInfoBuf; + UserHal::MemoryInfo( memInfoBuf ); + const TMemoryInfoV1 memInfo( memInfoBuf() ); + + // 1st item = Total RAM + _LIT(KItem1Format, "\tTotal RAM\t\t%S"); + size = MemSpyUiUtils::FormatSizeText( memInfo.iTotalRamInBytes ); + item.Format( KItem1Format, &size ); + model->AppendL( item ); + + // 2nd item = Max free RAM + _LIT(KItem2Format, "\tMax Free RAM\t\t%S"); + size = MemSpyUiUtils::FormatSizeText( memInfo.iMaxFreeRamInBytes ); + item.Format( KItem2Format, &size ); + model->AppendL( item ); + + // 3rd item = Free RAM + _LIT(KItem3Format, "\tFree RAM\t\t%S (%S)"); + const TMemSpyPercentText freeRamPercentage( MemSpyEngineUtils::FormatPercentage( TReal( memInfo.iTotalRamInBytes ), TReal( memInfo.iFreeRamInBytes ) ) ); + size = MemSpyUiUtils::FormatSizeText( memInfo.iFreeRamInBytes ); + item.Format( KItem3Format, &size, &freeRamPercentage ); + model->AppendL( item ); + + // 4th item = RAM disk info + _LIT(KItem4Format, "\tRAM Disk Size\t\t%S"); + size = MemSpyUiUtils::FormatSizeText( memInfo.iInternalDiskRamInBytes ); + item.Format( KItem4Format, &size ); + model->AppendL( item ); + + // 5th item = Max RAM disk size + _LIT(KItem5Format, "\tMax RAM Disk Size\t\t%S"); + HAL::Get( HALData::EMaxRAMDriveSize, value ); + size = MemSpyUiUtils::FormatSizeText( value ); + item.Format( KItem5Format, &size ); + model->AppendL( item ); + + // 6th item = RAM page size + _LIT(KItem6Format, "\tMemory Page Size\t\t%S"); + HAL::Get( HALData::EMemoryPageSize, value ); + size = MemSpyUiUtils::FormatSizeText( value ); + item.Format( KItem6Format, &size ); + model->AppendL( item ); + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + + +TBool CMemSpyViewRAMInfo::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + if ( iEngine.HelperRAM().IsAknIconCacheConfigurable() ) + { + switch ( aCommand ) + { + case EMemSpyCmdRAMAvkonIconCacheDisabled: + OnCmdSetIconCacheStatusL( EFalse ); + break; + case EMemSpyCmdRAMAvkonIconCacheEnabled: + OnCmdSetIconCacheStatusL( ETrue ); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + } + else + { + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + } + // + return handled; + } + + +void CMemSpyViewRAMInfo::OnCmdSetIconCacheStatusL( TBool aEnabled ) + { + ASSERT( iEngine.HelperRAM().IsAknIconCacheConfigurable() ); + // + const TInt64 savedAmount = iEngine.HelperRAM().SetAknIconCacheStatusL( aEnabled ); + if ( !aEnabled ) + { + TBuf<128> buf; + // + if ( savedAmount != 0 ) + { + _LIT(KSavedAmountFormatBuffer, "Saved %S of RAM"); + const TMemSpySizeText savedAmountString( MemSpyEngineUtils::FormatSizeText( savedAmount, 0, EFalse ) ); + buf.Format( KSavedAmountFormatBuffer, &savedAmountString ); + } + else + { + _LIT(KDidNotSaveAnyRAM, "Operation did not save any RAM"); + buf.Copy( KDidNotSaveAnyRAM ); + } + + // Show dialog + CAknNoteDialog* note = new( ELeave ) CAknNoteDialog( CAknNoteDialog::ENoTone ); + CleanupStack::PushL( note ); + note->SetTextWrapping( ETrue ); + note->PrepareLC( R_MEMSPY_RAM_MEMORY_DELTA_DIALOG ); + note->SetTextL( buf ); + CleanupStack::Pop( note ); + note->RunLD(); + } + // + RefreshL(); + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewROMInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewROMInfo.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,270 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewROMInfo.h" + +// System includes +#include +#ifdef __EPOC32__ +#include +#endif + +// Engine includes +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + +// Remap of E32 DP constants, needed so MemSpy can still build on v9.1 +enum TMemSpyDemandPagingKernelConfigFlags + { + EMemSpyKernelConfigPagingPolicyMask = 3<<5, + EMemSpyKernelConfigPagingPolicyNoPaging = 0<<5, + EMemSpyKernelConfigPagingPolicyAlwaysPage = 1<<5, + EMemSpyKernelConfigPagingPolicyDefaultUnpaged = 2<<5, + EMemSpyKernelConfigPagingPolicyDefaultPaged = 3<<5, + }; + + + +CMemSpyViewROMInfo::CMemSpyViewROMInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +void CMemSpyViewROMInfo::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "ROM Info" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewROMInfo::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewROMInfo::ViewType() const + { + return EMemSpyViewTypeROMInfo; + } + + +CMemSpyViewBase* CMemSpyViewROMInfo::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewROMInfo::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + return child; + } + + +void CMemSpyViewROMInfo::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + CleanupStack::PushL( model ); + + TBuf item; + + TInt value = 0; + TMemSpySizeText valueBuf; + TMemSpySizeText valueBuf2; + + // 1st item = Total RAM + _LIT(KItem1Format, "\tROM Size (HAL)\t\t%S"); + HAL::Get( HALData::EMemoryROM, value ); + valueBuf = MemSpyUiUtils::FormatSizeText( value ); + item.Format( KItem1Format, &valueBuf ); + model->AppendL( item ); + +#ifdef __EPOC32__ + TBuf<128> buf2; + _LIT( KTimeFormatSpecLocal, "%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B" ); + const TUint main_start = UserSvr::RomHeaderAddress(); + TRomHeader* romHeader = (TRomHeader*) main_start; + + _LIT(KItem2Format, "\tROM Size (Header)\t\t%S"); + valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iRomSize ) ); + item.Format( KItem2Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem2aFormat, "\tROM Page Size\t\t%S"); + HAL::Get( HALData::EMemoryPageSize, value ); + valueBuf = MemSpyUiUtils::FormatSizeText( value ); + item.Format( KItem2aFormat, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem10Format, "\tVersion\t\tv%2d.%02d.%06d"); + item.Format( KItem10Format, romHeader->iVersion.iMajor, romHeader->iVersion.iMinor, romHeader->iVersion.iBuild ); + model->AppendL( item ); + + _LIT(KItem3Format, "\tTimestamp\t\t%S"); + TTime time( romHeader->iTime ); + time.FormatL( buf2, KTimeFormatSpecLocal ); + item.Format( KItem3Format, &buf2 ); + model->AppendL( item ); + + _LIT(KItem4Format, "\tAddress Range\t\t%S - %S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomBase ); + MemSpyUiUtils::FormatHex( valueBuf2, (romHeader->iRomBase + romHeader->iRomSize )); + item.Format( KItem4Format, &valueBuf, &valueBuf2 ); + model->AppendL( item ); + + _LIT(KItem5Format, "\tPrimary File Address\t\t%S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iPrimaryFile ); + item.Format( KItem5Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem6Format, "\tSecondary File Address\t\t%S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iSecondaryFile ); + item.Format( KItem6Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem7Format, "\tChecksum\t\t%S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iCheckSum ); + item.Format( KItem7Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem8Format, "\tKernel Config Flags\t\t%S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iKernelConfigFlags ); + item.Format( KItem8Format, &valueBuf ); + model->AppendL( item ); + + if ( romHeader->iKernelConfigFlags & EKernelConfigIpcV1Available ) + { + _LIT(KItem8aFormat, "\tIPC v1 Available\t\tYes"); + item.Copy( KItem8aFormat ); + model->AppendL( item ); + } + if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforcement ) + { + _LIT(KItem8bFormat, "\tPlatSec Enforcement\t\tYes"); + item.Copy( KItem8bFormat ); + model->AppendL( item ); + } + if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecDiagnostics ) + { + _LIT(KItem8cFormat, "\tPlatSec Diagnostics\t\tYes"); + item.Copy( KItem8cFormat ); + model->AppendL( item ); + } + if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecProcessIsolation ) + { + _LIT(KItem8dFormat, "\tPlatSec Process Isolation\t\tYes"); + item.Copy( KItem8dFormat ); + model->AppendL( item ); + } + if ( romHeader->iKernelConfigFlags & EKernelConfigPlatSecEnforceSysBin ) + { + _LIT(KItem8eFormat, "\tEnforce \\Sys\\Bin\\\t\tYes"); + item.Copy( KItem8eFormat ); + model->AppendL( item ); + } + + const TUint32 pagingPolicy = ( romHeader->iKernelConfigFlags & EMemSpyKernelConfigPagingPolicyMask ); +#ifdef _DEBUG + RDebug::Printf( "pagingPolicy: %u (0x%08x)", pagingPolicy, pagingPolicy ); +#endif + _LIT(KItem8eFormat, "\tDemand Paging\t\t%S"); + // + if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyNoPaging ) + { + _LIT( KDemandPagingPolicyNoPaging, "No Paging" ); + item.Format( KItem8eFormat, &KDemandPagingPolicyNoPaging ); + } + else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyAlwaysPage ) + { + _LIT( KDemandPagingPolicyAlwaysPage, "Always Paging" ); + item.Format( KItem8eFormat, &KDemandPagingPolicyAlwaysPage); + } + else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultUnpaged ) + { + _LIT( KDemandPagingPolicyDefaultUnpaged, "Default Unpaged" ); + item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultUnpaged); + } + else if ( pagingPolicy & EMemSpyKernelConfigPagingPolicyDefaultPaged ) + { + _LIT( KDemandPagingPolicyDefaultPaged, "Default Paged" ); + item.Format( KItem8eFormat, &KDemandPagingPolicyDefaultPaged ); + } + // + model->AppendL( item ); + + _LIT(KItem9Format, "\tSection Header Address\t\t%S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iRomSectionHeader ); + item.Format( KItem9Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem11Format, "\tCompressed Size\t\t%S"); + valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iCompressedSize ) ); + item.Format( KItem11Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem12Format, "\tUncompressed Size\t\t%S"); + valueBuf = MemSpyUiUtils::FormatSizeText( TInt64( romHeader->iUncompressedSize ) ); + item.Format( KItem12Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem13Format, "\tDisabled Caps. #1\t\t%S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[0] ); + item.Format( KItem13Format, &valueBuf ); + model->AppendL( item ); + + _LIT(KItem14Format, "\tDisabled Caps. #2\t\t%S"); + MemSpyUiUtils::FormatHex( valueBuf, romHeader->iDisabledCapabilities[1] ); + item.Format( KItem14Format, &valueBuf ); + model->AppendL( item ); + + for(TInt i=0; iiTraceMask[i] ); + item.Format( KItem15Format, i+1, &valueBuf ); + model->AppendL( item ); + } + +#endif + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewServerList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewServerList.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,239 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewServerList.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyViewProcesses.h" +#include "MemSpyContainerObserver.h" + + + +/* +CMemSpyViewServerList::CMemSpyViewServerList( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } +*/ +CMemSpyViewServerList::CMemSpyViewServerList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aSession, aObserver ) + { + } + + + +CMemSpyViewServerList::~CMemSpyViewServerList() + { + delete iList; + } + + +void CMemSpyViewServerList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + iSort = ESortServByName; + _LIT( KTitle, "Running Servers" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +TBool CMemSpyViewServerList::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdServerListSortByName: + OnCmdServerListSortByNameL(); + break; + case EMemSpyCmdServerListSortBySessionCount: + OnCmdServerListSortBySessionCountL(); + break; + case EMemSpyCmdServerListOutputListCSV: + OnCmdServerListOutputSummaryL(); + break; + case EMemSpyCmdServerListOutputListDetailed: + OnCmdServerListOutputDetailedL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewServerList::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewServerList::ViewType() const + { + return EMemSpyViewTypeServerList; + } + + +CMemSpyViewBase* CMemSpyViewServerList::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iMemSpySession, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewServerList::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + + if ( iActionedItemIndex ) + { + child = new(ELeave) CMemSpyViewProcesses( iMemSpySession, iObserver, iServers[iActionedItemIndex]->Id() ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + } + // + + return child; + } + +void CMemSpyViewServerList::SetListBoxModelL() + { + TInt err = KErrNone; + iModel = NULL; + + TRAP( err, iMemSpySession.GetServersL( iServers, iSort ) ); + + if ( err == KErrNone ) + { + iModel = new (ELeave) CDesC16ArrayFlat( iServers.Count() ); //array for formated items + _LIT(KSession, "session"); + + for( TInt i = 0; i < iServers.Count(); i++ ) + { + HBufC* combined = HBufC::NewLC( iServers[i]->Name().Length() + 128 ); + + TPtr pCombined( combined->Des() ); + pCombined.Zero(); + pCombined.Copy( _L("\t") ); + + if( iServers[i]->Name() != KNullDesC ) + { + pCombined.Append( iServers[i]->Name() ); + } + + pCombined.Append( _L("\t\t") ); + TBuf<16> count; + _LIT( KCount, "%d session"); + + count.Format( KCount, iServers[i]->SessionCount() ); + pCombined.Append( count ); + + if( iServers[i]->SessionCount() != 1 ) + { + _LIT( KS, "s" ); + pCombined.Append( KS ); + } + + iModel->AppendL( pCombined ); + + CleanupStack::PopAndDestroy(combined); + } + } + + // + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iModel ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewServerList::HandleListBoxItemActionedL( TInt aCurrentIndex ) + { + if ( aCurrentIndex >= 0 && aCurrentIndex < iServers.Count() ) + { + iActionedItemIndex = aCurrentIndex; + } + else + { + iActionedItem = NULL; + } + + // Notify observer about an item being 'fired' + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewServerList::OnCmdServerListSortByNameL() + { + iSort = ESortServByName; + RefreshL(); + } + + +void CMemSpyViewServerList::OnCmdServerListSortBySessionCountL() + { + iSort = ESortServBySessionCount; + RefreshL(); + } + + +void CMemSpyViewServerList::OnCmdServerListOutputSummaryL() + { + OnCmdServerListOutputGenericL( EFalse ); + } + + +void CMemSpyViewServerList::OnCmdServerListOutputDetailedL() + { + OnCmdServerListOutputGenericL( ETrue ); + } + + +void CMemSpyViewServerList::OnCmdServerListOutputGenericL( TBool aDetailed ) + { + iMemSpySession.ServerListOutputGenericL( aDetailed ); + } + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewSystemConfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewSystemConfig.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,883 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewSystemConfig.h" + +// System includes +#include +#include +#include +#ifdef __EPOC32__ +#include +#endif + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + +// Literal constants +_LIT( KMemSpyItemValueNotKnown, "Unknown" ); + + + +CMemSpyViewSystemConfig::CMemSpyViewSystemConfig( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +CMemSpyViewSystemConfig::~CMemSpyViewSystemConfig() + { + delete iModel; + } + + +void CMemSpyViewSystemConfig::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "System Configuration" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +void CMemSpyViewSystemConfig::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewSystemConfig::ViewType() const + { + return EMemSpyViewTypeSystemConfig; + } + + +CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewSystemConfig::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + return child; + } + + +void CMemSpyViewSystemConfig::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(5); + delete iModel; + iModel = model; + + TBuf<128> valueBuf; + TInt value = 0; + TInt value2 = 0; + TMemSpySizeText sizeBuf; + + // + _LIT(KItem1Format, "Manufacturer"); + GetManufacturer( valueBuf ); + AddItemL( KItem1Format, valueBuf ); + + // + _LIT(KItem2Format, "Machine Uid"); + GetMachineUid( valueBuf ); + AddItemL( KItem2Format, valueBuf ); + + // + _LIT(KItem1aFormat, "Model Uid"); + GetHALValueAsHexL( HALData::EModel, KItem1aFormat ); + + // + _LIT(KItem2aFormat, "Device Family"); + GetDeviceFamily( valueBuf ); + AddItemL( KItem2aFormat, valueBuf ); + + // + _LIT(KItem2bFormat, "Device Family Rev."); + GetHALValueAsNumericL( HALData::EDeviceFamilyRev, KItem2bFormat ); + + // + _LIT(KItem3Format, "Hardware Rev."); + GetHALValueAsNumericL( HALData::EManufacturerHardwareRev, KItem3Format ); + + // + _LIT(KItem4Format, "Software Rev."); + GetHALValueAsNumericL( HALData::EManufacturerSoftwareRev, KItem4Format ); + + // + _LIT(KItem5Format, "Software Build"); + GetHALValueAsNumericL( HALData::EManufacturerSoftwareBuild, KItem5Format ); + + // + _LIT(KItem6Format, "CPU"); + GetCPU( valueBuf ); + AddItemL( KItem6Format, valueBuf ); + + // + _LIT(KItem7Format, "CPU ABI"); + GetCPUABI( valueBuf ); + AddItemL( KItem7Format, valueBuf ); + + // + _LIT(KItem8Format, "CPU Speed"); + _LIT(KItem8Suffix, "KHz"); + GetHALValueAsNumericL( HALData::ECPUSpeed, KItem8Format, &KItem8Suffix ); + + // + _LIT(KItem8aFormat, "Floating Point Support"); + GetHALValueAsYesNoL( HALData::EHardwareFloatingPoint, KItem8aFormat ); + + // + _LIT(KItem8bFormat, "System Tick Period"); + _LIT(KItem8bSuffix, "ms"); + GetHALValueAsNumericL( HALData::ESystemTickPeriod, KItem8bFormat, &KItem8bSuffix ); + + // + _LIT(KItem8cFormat, "Nano Tick Period"); + _LIT(KItem8cSuffix, "us"); + GetHALValueAsNumericL( HALData::ENanoTickPeriod, KItem8cFormat, &KItem8cSuffix ); + + // + _LIT(KItem9Format, "Startup Reason"); + GetStartupReason( valueBuf ); + AddItemL( KItem9Format, valueBuf ); + + // + _LIT(KItem10Format, "Language"); + GetHALValueAsNumericL( HALData::ELanguageIndex, KItem10Format, NULL, 4 ); + + // + _LIT(KItem10aFormat, "Locale"); + GetHALValueAsNumericL( HALData::ELocaleLoaded, KItem10aFormat, NULL, 4 ); + + // + _LIT(KItem11aFormat, "Clipboard Drive"); + GetHALValueAsDriveLetterL( HALData::EClipboardDrive, KItem11aFormat ); + + // + _LIT(KItem11bFormat, "System Drive (Hal)"); + GetHALValueAsDriveLetterL( HALData::ESystemDrive, KItem11bFormat ); + + // + _LIT(KItem11cFormat, "System Drive (F32)"); + TDriveNumber systemDrive = CMemSpyEngineHelperFileSystem::GetSystemDrive(); + AddItemL( systemDrive, KItem11cFormat ); + + // + _LIT(KItem11dFormat, "System Drive (Bafl)"); + value = BaflUtils::GetSystemDrive( systemDrive ); + if ( value == KErrNone ) + { + AddItemL( systemDrive, KItem11dFormat ); + } + else + { + MemSpyUiUtils::GetErrorText( valueBuf, value ); + AddItemL( KItem11dFormat, valueBuf ); + } + + // + _LIT(KItem12Format, "Display Type"); + GetDisplayType( valueBuf ); + AddItemL( KItem12Format, valueBuf ); + // + _LIT(KItem12aCaption, "Display Size"); + _LIT(KItem12aFormat, "%d x %d"); + value = value2 = 0; + GetHALValue( HALData::EDisplayXPixels, value ); + GetHALValue( HALData::EDisplayYPixels, value2 ); + valueBuf.Format( KItem12aFormat, value, value2 ); + AddItemL( KItem12aCaption, valueBuf ); + + // + _LIT(KItem13Format, "Display Depth"); + _LIT(KItem13Suffix, "bpp"); + GetHALValueAsNumericL( HALData::EDisplayBitsPerPixel, KItem13Format, &KItem13Suffix ); + + // + _LIT(KItem14Format, "Display Mode Count"); + GetHALValueAsNumericL( HALData::EDisplayNumModes, KItem14Format ); + + // + _LIT(KItem14aFormat, "Current Mode"); + GetHALValueAsNumericL( HALData::EDisplayMode, KItem14aFormat ); + + // + _LIT(KItem15Format, "Display Address"); + GetHALValueAsHexL( HALData::EDisplayMemoryAddress, KItem15Format ); + + // + _LIT(KItem16Format, "Screen Count"); + GetHALValueAsNumericL( HALData::EDisplayNumberOfScreens, KItem16Format ); + + // + _LIT(KItem17Format, "Eikon Def. Disp. Mode"); + GetDisplayMode( valueBuf, static_cast( CEikonEnv::Static()->DefaultDisplayMode() ) ); + AddItemL( KItem17Format, valueBuf ); + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + iModel = NULL; + } + + +void CMemSpyViewSystemConfig::GetManufacturer( TDes& aBuf ) + { + TInt value = KErrGeneral; + GetHALValue( HALData::EManufacturer, value ); + // + switch( value ) + { + case HALData::EManufacturer_Ericsson: + { + _LIT( KName, "Ericsson" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Motorola: + { + _LIT( KName, "Motorola" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Nokia: + { + _LIT( KName, "Nokia" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Panasonic: + { + _LIT( KName, "Panasonic" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Psion: + { + _LIT( KName, "Psion" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Intel: + { + _LIT( KName, "Intel" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Cogent: + { + _LIT( KName, "Cogent" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Cirrus: + { + _LIT( KName, "Cirrus" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_Linkup: + { + _LIT( KName, "Linkup" ); + aBuf.Copy( KName ); + } + break; + case HALData::EManufacturer_TexasInstruments: + { + _LIT( KName, "Texas Instruments" ); + aBuf.Copy( KName ); + } + break; + default: + aBuf.Copy( KMemSpyItemValueNotKnown ); + break; + } + } + + +void CMemSpyViewSystemConfig::GetDisplayMode( TDes& aBuf, TMemSpyDisplayMode aMode ) + { + switch( aMode ) + { + case ENone: + { + _LIT( KName, "ENone" ); + aBuf.Copy( KName ); + } + case EGray2: + { + _LIT( KName, "EGray2" ); + aBuf.Copy( KName ); + } + case EGray4: + { + _LIT( KName, "EGray4" ); + aBuf.Copy( KName ); + } + case EGray16: + { + _LIT( KName, "EGray16" ); + aBuf.Copy( KName ); + } + case EGray256: + { + _LIT( KName, "EGray256" ); + aBuf.Copy( KName ); + } + case EColor16: + { + _LIT( KName, "EColor16" ); + aBuf.Copy( KName ); + } + case EColor256: + { + _LIT( KName, "EColor256" ); + aBuf.Copy( KName ); + } + case EColor64K: + { + _LIT( KName, "EColor64K" ); + aBuf.Copy( KName ); + } + case EColor16M: + { + _LIT( KName, "EColor16M" ); + aBuf.Copy( KName ); + } + case ERgb: + { + _LIT( KName, "ERgb" ); + aBuf.Copy( KName ); + } + break; + case EColor4K: + { + _LIT( KName, "EColor4K" ); + aBuf.Copy( KName ); + } + break; + case EColor16MU: + { + _LIT( KName, "EColor16MU" ); + aBuf.Copy( KName ); + } + break; + case EColor16MA: + { + _LIT( KName, "EColor16MA" ); + aBuf.Copy( KName ); + } + break; + case EColor16MAP: + { + _LIT( KName, "EColor16MAP" ); + aBuf.Copy( KName ); + } + break; + default: + aBuf.Copy( KMemSpyItemValueNotKnown ); + break; + } + } + + +void CMemSpyViewSystemConfig::GetDeviceFamily( TDes& aBuf ) + { + TInt value = KErrGeneral; + GetHALValue( HALData::EDeviceFamily, value ); + // + switch( value ) + { + case HALData::EDeviceFamily_Crystal: + { + _LIT( KName, "Crystal" ); + aBuf.Copy( KName ); + } + break; + case HALData::EDeviceFamily_Pearl: + { + _LIT( KName, "Pearl" ); + aBuf.Copy( KName ); + } + break; + case HALData::EDeviceFamily_Quartz: + { + _LIT( KName, "Quartz" ); + aBuf.Copy( KName ); + } + break; + default: + aBuf.Copy( KMemSpyItemValueNotKnown ); + break; + } + } + + +void CMemSpyViewSystemConfig::GetCPU( TDes& aBuf ) + { + TInt value = KErrGeneral; + GetHALValue( HALData::ECPU, value ); + // + switch( value ) + { + case HALData::ECPU_ARM: + { + _LIT( KName, "ARM" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPU_MCORE: + { + _LIT( KName, "mCORE" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPU_X86: + { + _LIT( KName, "X86" ); + aBuf.Copy( KName ); + } + break; + default: + aBuf.Copy( KMemSpyItemValueNotKnown ); + break; + } + } + + +void CMemSpyViewSystemConfig::GetCPUABI( TDes& aBuf ) + { + TInt value = KErrGeneral; + GetHALValue( HALData::ECPUABI, value ); + // + switch( value ) + { + case HALData::ECPUABI_ARM4: + { + _LIT( KName, "ARM4" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPUABI_ARMI: + { + _LIT( KName, "ARMI" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPUABI_THUMB: + { + _LIT( KName, "ARM4" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPUABI_MCORE: + { + _LIT( KName, "mCORE" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPUABI_MSVC: + { + _LIT( KName, "MSVC" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPUABI_ARM5T: + { + _LIT( KName, "ARM5T" ); + aBuf.Copy( KName ); + } + break; + case HALData::ECPUABI_X86: + { + _LIT( KName, "X86" ); + aBuf.Copy( KName ); + } + break; + default: + aBuf.Copy( KMemSpyItemValueNotKnown ); + break; + } + } + + +void CMemSpyViewSystemConfig::GetStartupReason( TDes& aBuf ) + { + TInt value = KErrGeneral; + GetHALValue( HALData::ESystemStartupReason, value ); + // + switch( value ) + { + case HALData::ESystemStartupReason_Cold: + { + _LIT( KName, "Cold" ); + aBuf.Copy( KName ); + } + break; + case HALData::ESystemStartupReason_Warm: + { + _LIT( KName, "Warm" ); + aBuf.Copy( KName ); + } + break; + case HALData::ESystemStartupReason_Fault: + { + _LIT( KName, "Fault" ); + aBuf.Copy( KName ); + } + break; + default: + aBuf.Copy( KMemSpyItemValueNotKnown ); + break; + } + } + + +void CMemSpyViewSystemConfig::GetKeyboard( TDes& aBuf ) + { + _LIT(KComma, ", "); + TInt value = KErrGeneral; + GetHALValue( HALData::EKeyboard, value ); + // + aBuf.Zero(); + if ( value & EKeyboard_Keypad ) + { + _LIT( KName, "Keypad" ); + aBuf.Copy( KName ); + } + + + if ( value & EKeyboard_Full ) + { + if ( aBuf.Length() ) + { + aBuf.Append( KComma ); + } + + _LIT( KName, "Full Keyboard" ); + aBuf.Copy( KName ); + } + + if ( !aBuf.Length() ) + { + aBuf.Copy( KMemSpyItemValueNotKnown ); + } + } + + +void CMemSpyViewSystemConfig::GetMachineUid( TDes& aBuf ) + { + TInt value = KErrGeneral; + GetHALValue( HALData::EMachineUid, value ); + // + switch( value ) + { + case HALData::EMachineUid_Series5mx: + { + _LIT( KName, "Series 5mx" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_Brutus: + { + _LIT( KName, "Brutus" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_Cogent: + { + _LIT( KName, "Cogent" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_Win32Emulator: + { + _LIT( KName, "Win32 Emulator" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_WinC: + { + _LIT( KName, "WINC" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_CL7211_Eval: + { + _LIT( KName, "CL7211" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_LinkUp: + { + _LIT( KName, "LinkUp" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_Assabet: + { + _LIT( KName, "Assabet" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_IQ80310: + { + _LIT( KName, "IQ80310" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_Lubbock: + { + _LIT( KName, "Lubbock" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_Integrator: + { + _LIT( KName, "Integrator" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_Helen: + { + _LIT( KName, "Helen" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_X86PC: + { + _LIT( KName, "X86PC" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_OmapH2: + { + _LIT( KName, "OmapH2" ); + aBuf.Copy( KName ); + } + break; + case HALData::EMachineUid_OmapH4: + { + _LIT( KName, "OmapH4" ); + aBuf.Copy( KName ); + } + break; + default: + { + _LIT( KName, "0x%08x" ); + aBuf.Format( KName, value ); + } + break; + } + } + + +void CMemSpyViewSystemConfig::GetDisplayType( TDes& aBuf ) + { + TInt value = KErrGeneral; + GetHALValue( HALData::EDisplayIsMono, value ); + // + if ( value == 0 ) + { + _LIT( KName, "Colour" ); + aBuf.Copy( KName ); + } + else if ( value == 1 ) + { + _LIT( KName, "Mono" ); + aBuf.Copy( KName ); + } + else + { + MemSpyUiUtils::GetErrorText( aBuf, value ); + } + } + + +TInt CMemSpyViewSystemConfig::GetHALValue( HALData::TAttribute aAttribute, TInt& aValue ) + { + aValue = KErrGeneral; + const TInt error = HAL::Get( aAttribute, aValue ); + +#ifdef _DEBUG + if ( error != KErrNone ) + { + RDebug::Printf("CMemSpyViewSystemConfig::GetHALValue() - aAttribute: %3d, error: %d, value: %d", aAttribute, error, aValue); + } +#endif + + return error; + } + + +TInt CMemSpyViewSystemConfig::GetHALValueAsNumericL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix, TInt aWidth ) + { + TBuf<20> valueBuf; + TInt value = 0; + // + const TInt error = GetHALValue( aAttribute, value ); + if ( error == KErrNone ) + { + if ( aWidth > 0 && aWidth < 12 ) + { + valueBuf.NumFixedWidthUC( (TUint) value, EDecimal, aWidth ); + } + else + { + valueBuf.Num( value ); + } + + AddItemL( aCaption, valueBuf, aSuffix ); + } + else + { + MemSpyUiUtils::GetErrorText( valueBuf, error ); + AddItemL( aCaption, valueBuf ); + } + // + return error; + } + + +TInt CMemSpyViewSystemConfig::GetHALValueAsHexL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix ) + { + TBuf<20> valueBuf; + TInt value = 0; + // + const TInt error = GetHALValue( aAttribute, value ); + if ( error == KErrNone ) + { + MemSpyEngineUtils::FormatHex( valueBuf, value ); + AddItemL( aCaption, valueBuf, aSuffix ); + } + else + { + MemSpyUiUtils::GetErrorText( valueBuf, error ); + AddItemL( aCaption, valueBuf ); + } + // + return error; + } + + +TInt CMemSpyViewSystemConfig::GetHALValueAsYesNoL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix ) + { + TBuf<20> valueBuf; + TInt value = 0; + // + const TInt error = GetHALValue( aAttribute, value ); + if ( error == KErrNone || error == KErrNotSupported ) + { + _LIT(KYes, "Yes"); + _LIT(KNo, "No"); + _LIT(KError, "Error: %d"); + + if ( error < KErrNone ) + { + valueBuf.Format( KError, error ); + } + else if ( value == EFalse ) + { + valueBuf.Copy( KNo ); + } + else if ( error == KErrNone ) + { + valueBuf.Copy( KYes ); + } + + AddItemL( aCaption, valueBuf, aSuffix ); + } + else + { + MemSpyUiUtils::GetErrorText( valueBuf, error ); + AddItemL( aCaption, valueBuf ); + } + // + return error; + } + + +TInt CMemSpyViewSystemConfig::GetHALValueAsDriveLetterL( HALData::TAttribute aAttribute, const TDesC& aCaption, const TDesC* aSuffix ) + { + TInt value = 0; + const TInt error = GetHALValue( aAttribute, value ); + // + if ( error == KErrNone && ( value >= EDriveA && value <= EDriveZ ) ) + { + AddItemL( (TDriveNumber) value, aCaption, aSuffix ); + } + else + { + _LIT( KItemNotSet, "Not Defined"); + AddItemL( aCaption, KItemNotSet ); + } + // + return error; + } + + +void CMemSpyViewSystemConfig::AddItemL( const TDesC& aCaption, const TDesC& aValue, const TDesC* aSuffix ) + { + _LIT(KItemFormat, "\t%S\t\t%S"); + // + TBuf item; + item.Format( KItemFormat, &aCaption, &aValue ); + if ( aSuffix ) + { + _LIT(KSpace, " "); + item.Append( KSpace ); + item.Append( *aSuffix ); + } + // + iModel->AppendL( item ); + } + + +void CMemSpyViewSystemConfig::AddItemL( TDriveNumber aDrive, const TDesC& aCaption, const TDesC* aSuffix ) + { + TBuf<20> valueBuf; + // + const TDriveUnit drive( aDrive ); + valueBuf.Copy( drive.Name() ); + // + AddItemL( aCaption, valueBuf, aSuffix ); + } + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,248 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemActiveObject.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" + + +CMemSpyViewThreadInfoItemActiveObjectBase::CMemSpyViewThreadInfoItemActiveObjectBase(RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeActiveObject ) + { + } + + +TBool CMemSpyViewThreadInfoItemActiveObjectBase::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + /* + // + switch ( aCommand ) + { + case EMemSpyCmdActiveObjectListing: + OnCmdWriteAOListingL(); + break; + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + * */ + return handled; + } + + +void CMemSpyViewThreadInfoItemActiveObjectBase::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == R_MEMSPY_MENUPANE ) + { + // aMenuPane->SetItemDimmed( EMemSpyCmdActiveObject, Thread().IsDead() ); + } + } + + +CMemSpyEngineActiveObjectArray& CMemSpyViewThreadInfoItemActiveObjectBase::ActiveObjectArray() const + { + // CMemSpyThreadInfoActiveObjects* activeObjectArray = static_cast< CMemSpyThreadInfoActiveObjects* >( iInfoItem ); + // return activeObjectArray->Array(); + } + + +void CMemSpyViewThreadInfoItemActiveObjectBase::OnCmdWriteAOListingL() + { + iMemSpySession.OutputAOListL( ThreadId(), EMemSpyThreadInfoItemTypeActiveObject ); + + /* + CMemSpyEngineActiveObjectArray& objects = ActiveObjectArray(); + + // Begin a new data stream + _LIT( KMemSpyContext, "Active Object List - " ); + _LIT( KMemSpyFolder, "Active Objects" ); + iEngine.Sink().DataStreamBeginL( KMemSpyContext, KMemSpyFolder ); + + // Set prefix for overall listing + iEngine.Sink().OutputPrefixSetLC( KMemSpyContext ); + + // Create header + CMemSpyEngineActiveObjectArray::OutputDataColumnsL( iEngine ); + + // List items + const TInt count = objects.Count(); + for(TInt i=0; i( iInfoItem ); + TInt selectedIndex = 0; + if ( aSelectionRune ) + { + CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray(); + const TInt index = activeObjectArray.ObjectIndexByAddress( aSelectionRune ); + if ( index >= 0 && index < activeObjectArray.Count() ) + { + selectedIndex = index + 1; + } + } + + // Select item + if ( infoItem->DetailsCount() > 0 ) + { + */ + iListBox->SetCurrentItemIndex( 0 ); //selectedIndex + HandleListBoxItemSelectedL( 0 ); //selectedIndex + /* + } + */ + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemActiveObject::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemActiveObject; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObject::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + /* + // Get current entry address + TInt index = iListBox->CurrentItemIndex(); + if ( index > 0 ) + { + --index; + CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray(); + // + if ( index >= 0 && index < activeObjectArray.MdcaCount() ) + { + CMemSpyEngineActiveObject& object = activeObjectArray.At( index ); + TAny* aoAddress = object.Address(); + // + child = new(ELeave) CMemSpyViewThreadInfoItemActiveObjectDetails( iEngine, iObserver, iInfoItem->Container(), aoAddress ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent(), NULL ); + CleanupStack::Pop( child ); + } + } + // + * + */ + return child; + } + + + + + + + + + + +/* +CMemSpyViewThreadInfoItemActiveObjectDetails::CMemSpyViewThreadInfoItemActiveObjectDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, TAny* aObjectAddress ) +: CMemSpyViewThreadInfoItemActiveObjectBase( aEngine, aObserver, aContainer ), iObjectAddress( aObjectAddress ) + { + } + + +void CMemSpyViewThreadInfoItemActiveObjectDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + CMemSpyViewThreadInfoItemActiveObjectBase::ConstructL( aRect, aContainer, aSelectionRune ); + + _LIT( KTitle, "Active Object Details" ); + SetTitleL( KTitle ); + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemActiveObjectDetails::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemActiveObjectDetails; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemActiveObjectDetails::PrepareParentViewL() + { + CMemSpyViewThreadInfoItemActiveObject* parent = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iEngine, iObserver, iInfoItem->Container() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), iObjectAddress ); + CleanupStack::Pop( parent ); + return parent; + } + + +void CMemSpyViewThreadInfoItemActiveObjectDetails::SetListBoxModelL() + { + // Try to find the right entry + CMemSpyEngineActiveObjectArray& activeObjectArray = ActiveObjectArray(); + const TInt index = activeObjectArray.ObjectIndexByAddress( iObjectAddress ); + User::LeaveIfError( index ); + CMemSpyEngineActiveObject& object = activeObjectArray.At( index ); + // + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( &object ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } +*/ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemChunk.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewChunkList.h" + + + +CMemSpyViewThreadInfoItemChunk::CMemSpyViewThreadInfoItemChunk( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeChunk ) + { + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemChunk::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + /* TODO + // Get the code segment list + CMemSpyThreadInfoChunk* chunkInfoItem = static_cast< CMemSpyThreadInfoChunk* >( iInfoItem ); + CMemSpyEngineChunkList* list = &chunkInfoItem->List(); + + // Get the current code segment that corresponds to our currently focused list item. + const TInt index = iListBox->CurrentItemIndex(); + if ( index >= 0 && index < list->Count() ) + { + CMemSpyEngineChunkEntry& entry = list->At( index ); + child = new(ELeave) CMemSpyViewChunkDetails( iEngine, iObserver, *list, entry ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + chunkInfoItem->NullifyList(); + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + } + */ + return child; + } + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemCodeSeg.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewCodeSegList.h" + + + +CMemSpyViewThreadInfoItemCodeSeg::CMemSpyViewThreadInfoItemCodeSeg( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeCodeSeg ) + { + } + + +TBool CMemSpyViewThreadInfoItemCodeSeg::HandleCommandL( TInt aCommand ) + { + TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); + return handled; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemCodeSeg::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + /* TODO + // Get the code segment list + CMemSpyThreadInfoCodeSeg* codeSegInfoItem = static_cast< CMemSpyThreadInfoCodeSeg* >( iInfoItem ); + CMemSpyEngineCodeSegList* list = &codeSegInfoItem->List(); + + // Get the current code segment that corresponds to our currently focused list item. + const TInt index = iListBox->CurrentItemIndex(); + if ( index >= 0 && index < list->Count() ) + { + CMemSpyEngineCodeSegEntry& entry = list->At( index ); + child = new(ELeave) CMemSpyViewCodeSegDetails( iEngine, iObserver, *list, entry ); + + // Ownership is transferred to child. Cleanupstack guarantees it will be destroyed now. + // This object is about to die in any case. + codeSegInfoItem->NullifyList(); + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + } + */ + return child; + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemGeneralInfo.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewThreads.h" +#include "MemSpyViewThreadInfoItemHeap.h" + + +/* +CMemSpyViewThreadInfoItemGeneralInfo::CMemSpyViewThreadInfoItemGeneralInfo( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeGeneralInfo ) + { + } +*/ +CMemSpyViewThreadInfoItemGeneralInfo::CMemSpyViewThreadInfoItemGeneralInfo( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeGeneralInfo ) + { + } + + +TBool CMemSpyViewThreadInfoItemGeneralInfo::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + + + +void CMemSpyViewThreadInfoItemGeneralInfo::HandleListBoxItemActionedL( TInt /*aIndex*/ ) + { + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemGeneric.h" + +// System includes +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewThreadInfoItemList.h" +#include "MemSpyUiUtils.h" + +// Constants +const TInt KMemSpyConstructionCheckerTimerPeriod = 500000; // 1/2 second + +CMemSpyViewThreadInfoItemGeneric::CMemSpyViewThreadInfoItemGeneric( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcessId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewBase( aSession, aObserver )//, iThreadId( aId ), iType( aType ) //iContainer( aInfoContainer ) + { + iParentProcessId = aProcessId; + iThreadId = aId; + iType = aType; + } + + +CMemSpyViewThreadInfoItemGeneric::~CMemSpyViewThreadInfoItemGeneric() + {/* TODO: + if ( iInfoItem ) + { + iInfoItem->Close(); + } + DestroyWaitNote(); + */ + } + + +void CMemSpyViewThreadInfoItemGeneric::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + const TPtrC pTitle( MemSpyUiUtils::ThreadInfoItemNameByType( iType ) ); + SetTitleL( pTitle ); + + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +CMemSpyProcess& CMemSpyViewThreadInfoItemGeneric::Process() const + { + // return iContainer.Thread().Process(); + } + + +CMemSpyThread& CMemSpyViewThreadInfoItemGeneric::Thread() const + { + // return iContainer.Thread(); + } + + +CMemSpyThreadInfoContainer& CMemSpyViewThreadInfoItemGeneric::Container() const + { + // return iContainer; + } + + +CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemGeneric::InfoItem() const + { + // __ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); + // return *iInfoItem; + } + + +void CMemSpyViewThreadInfoItemGeneric::RefreshL() + { + // iInfoItem->RebuildL(); //TODO + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemGeneric::ViewType() const + { + TMemSpyViewType type = EMemSpyViewTypeNone; + // + //switch( iInfoItem->Type() ) + switch( iType ) + { + case EMemSpyThreadInfoItemTypeHeap: + type = EMemSpyViewTypeThreadInfoItemHeap; + break; + case EMemSpyThreadInfoItemTypeStack: + type = EMemSpyViewTypeThreadInfoItemStack; + break; + case EMemSpyThreadInfoItemTypeChunk: + type = EMemSpyViewTypeThreadInfoItemChunk; + break; + case EMemSpyThreadInfoItemTypeCodeSeg: + type = EMemSpyViewTypeThreadInfoItemCodeSeg; + break; + case EMemSpyThreadInfoItemTypeServer: + type = EMemSpyViewTypeThreadInfoItemServer; + break; + case EMemSpyThreadInfoItemTypeSession: + type = EMemSpyViewTypeThreadInfoItemSession; + break; + case EMemSpyThreadInfoItemTypeSemaphore: + type = EMemSpyViewTypeThreadInfoItemSemaphore; + break; + case EMemSpyThreadInfoItemTypeMutex: + type = EMemSpyViewTypeThreadInfoItemMutex; + break; + case EMemSpyThreadInfoItemTypeTimer: + type = EMemSpyViewTypeThreadInfoItemTimer; + break; + case EMemSpyThreadInfoItemTypeLDD: + type = EMemSpyViewTypeThreadInfoItemLDD; + break; + case EMemSpyThreadInfoItemTypePDD: + type = EMemSpyViewTypeThreadInfoItemPDD; + break; + case EMemSpyThreadInfoItemTypeLogicalChannel: + type = EMemSpyViewTypeThreadInfoItemLogicalChannel; + break; + case EMemSpyThreadInfoItemTypeChangeNotifier: + type = EMemSpyViewTypeThreadInfoItemChangeNotifier; + break; + case EMemSpyThreadInfoItemTypeUndertaker: + type = EMemSpyViewTypeThreadInfoItemUndertaker; + break; + case EMemSpyThreadInfoItemTypeMessageQueue: + type = EMemSpyViewTypeThreadInfoItemMessageQueue; + break; + case EMemSpyThreadInfoItemTypeConditionalVariable: + type = EMemSpyViewTypeThreadInfoItemConditionalVariable; + break; + case EMemSpyThreadInfoItemTypeOpenFiles: + type = EMemSpyViewTypeThreadInfoItemOpenFiles; + break; + case EMemSpyThreadInfoItemTypeActiveObject: + type = EMemSpyViewTypeThreadInfoItemActiveObject; + break; + case EMemSpyThreadInfoItemTypeGeneralInfo: + type = EMemSpyViewTypeThreadInfoItemGeneralInfo; + break; + case EMemSpyThreadInfoItemTypeOtherThreads: + type = EMemSpyViewTypeThreadInfoItemOtherThreads; + break; + case EMemSpyThreadInfoItemTypeOtherProcesses: + type = EMemSpyViewTypeThreadInfoItemOtherProcesses; + break; + case EMemSpyThreadInfoItemTypeOwnedThreadHandles: + type = EMemSpyViewTypeThreadInfoItemOwnedThreadHandles; + break; + case EMemSpyThreadInfoItemTypeOwnedProcessHandles: + type = EMemSpyViewTypeThreadInfoItemOwnedProcessHandles; + break; + + default: + //__ASSERT_DEBUG( EFalse, User::Invariant() ); + break; + } + // + return type; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL() + { + CMemSpyViewThreadInfoItemList* parent = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iThreadId ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), iType ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemGeneric::PrepareChildViewL() + { + //__ASSERT_ALWAYS( iInfoItem != NULL, User::Invariant() ); + CMemSpyViewBase* child = NULL; + // + return child; + } + + +TBool CMemSpyViewThreadInfoItemGeneric::HandleCommandL( TInt aCommand ) + { + TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); + return handled; + } + + +void CMemSpyViewThreadInfoItemGeneric::SetListBoxModelL() + { + iMemSpySession.GetThreadInfoItems( iThreadInfoItems, iThreadId, iType ); // TODO don't ignore error! + + iModel = new (ELeave) CDesC16ArrayFlat( iThreadInfoItems.Count() + 10 ); + + for( TInt i=0; iCaption().Length() + iThreadInfoItems[i]->Value().Length() + 30 ); + + TPtr pCombined( combined->Des() ); + pCombined.Zero(); + pCombined.Copy( _L("\t") ); + if( iThreadInfoItems[i]->Caption() != KNullDesC ) + pCombined.Append( iThreadInfoItems[i]->Caption() ); + if( iType != EMemSpyThreadInfoItemTypeChunk ) + { + pCombined.Append( _L("\t\t") ); + pCombined.Append( iThreadInfoItems[i]->Value() ); + } + + iModel->AppendL( pCombined ); + + CleanupStack::PopAndDestroy(combined); + } + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + //listbox->Model()->SetItemTextArray( iInfoItem ); + listbox->Model()->SetItemTextArray( iModel ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemActionedL( TInt /*aIndex*/ ) + { + // Notify observer about an item being 'fired' + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewThreadInfoItemGeneric::HandleListBoxItemSelectedL( TInt /*aIndex*/ ) + { + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + + +void CMemSpyViewThreadInfoItemGeneric::ShowWaitNoteL() + { + // Ugly, but I'm not adding an observer mechanism just for this wait dialog. + // __ASSERT_ALWAYS( iWaitConstructionChecker == NULL, User::Invariant() ); + iWaitConstructionChecker = CPeriodic::NewL( CActive::EPriorityLow ); + iWaitConstructionChecker->Start( KMemSpyConstructionCheckerTimerPeriod, + KMemSpyConstructionCheckerTimerPeriod, + TCallBack( CheckForItemConstructionComplete, this ) ); + + if ( !iWaitNote ) + { + iWaitNote = new ( ELeave ) CAknWaitDialog( reinterpret_cast ( &iWaitNote ), ETrue ); + iWaitNote->ExecuteDlgLD( CAknNoteDialog::ENoTone, R_MEMSPY_PREPARING_INFO_ITEM_CONTAINER_WAIT_NOTE ); + } + } + + +void CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() + { +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - START" ); +#endif + // + delete iWaitConstructionChecker; + iWaitConstructionChecker = NULL; + // + if ( iWaitNote ) + { + TRAP_IGNORE( iWaitNote->ProcessFinishedL() ); // deletes the dialog + iWaitNote = NULL; + } + // +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::DestroyWaitNote() - END" ); +#endif + } + + +TInt CMemSpyViewThreadInfoItemGeneric::CheckForItemConstructionComplete( TAny* aSelf ) + { + /* + CMemSpyViewThreadInfoItemGeneric& self = *reinterpret_cast< CMemSpyViewThreadInfoItemGeneric* >( aSelf ); + */ + // +#ifdef _DEBUG +/* RDebug::Printf( "CMemSpyViewThreadInfoItemGeneric::CheckForItemConstructionComplete() - ready status: %d, iType: %d", self.iInfoItem->IsReady(), self.iInfoItem->Type() );*/ +#endif + // + /* + TBool callAgain = ETrue; + if ( self.iInfoItem->IsReady() ) + { + self.DestroyWaitNote(); + callAgain = EFalse; + } + // + return callAgain; + */ + } + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemHeap.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewThreads.h" +#include "MemSpyViewThreadInfoItemHeap.h" +#include "MemSpyAppUi.h" + + +/* +CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeHeap ) + { + } +*/ +CMemSpyViewThreadInfoItemHeap::CMemSpyViewThreadInfoItemHeap( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId , EMemSpyThreadInfoItemTypeHeap ) + { + } + + +TBool CMemSpyViewThreadInfoItemHeap::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { +#ifndef __WINS__ + case EMemSpyCmdHeapDataDump: + OnCmdHeapDataL(); + break; +#endif + case EMemSpyCmdHeapCellListing: + OnCmdHeapCellListingL(); + break; + case EMemSpyCmdHeapInfoThread: + OnCmdHeapInfoL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewThreadInfoItemHeap::OnCmdHeapDataL() + { + iMemSpySession.OutputThreadHeapDataL( ThreadId() ); + } + + +void CMemSpyViewThreadInfoItemHeap::OnCmdHeapCellListingL() + { + iMemSpySession.OutputThreadCellListL( ThreadId() ); + } + + +void CMemSpyViewThreadInfoItemHeap::OnCmdHeapInfoL() + { + iMemSpySession.OutputHeapInfoUserL( ThreadId() ); + } + + +void CMemSpyViewThreadInfoItemHeap::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == R_MEMSPY_MENUPANE ) + { + //aMenuPane->SetItemDimmed( EMemSpyCmdHeap, Thread().IsDead() ); //TODO + } + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,435 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemList.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// UI Utils include +#include "MemSpyUiUtils.h" + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewThreads.h" +#include "MemSpyViewThreadInfoItemHeap.h" +#include "MemSpyViewThreadInfoItemStack.h" +#include "MemSpyViewThreadInfoItemChunk.h" +#include "MemSpyViewThreadInfoItemCodeSeg.h" +#include "MemSpyViewThreadInfoItemServer.h" +#include "MemSpyViewThreadInfoItemActiveObject.h" +#include "MemSpyViewThreadInfoItemGeneralInfo.h" +#include "MemSpyViewThreadInfoItemMemoryTracking.h" + +// Constants +const TInt KMemSpyIdleResetListboxTimerPeriod = 250000; + + +CMemSpyViewThreadInfoItemList::CMemSpyViewThreadInfoItemList( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcess, TThreadId aThread ) +: CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aProcess ), iThreadId( aThread ) + { + } + + +CMemSpyViewThreadInfoItemList::~CMemSpyViewThreadInfoItemList() + { + /* TODO: + TRAP_IGNORE( + CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); + container.ObserverRemove( *this ); + ); + */ + } + + + +void CMemSpyViewThreadInfoItemList::ConstructL( const TRect& aRect, CCoeControl& aContainer, TMemSpyThreadInfoItemType aType ) + { + _LIT( KTitle, "Thread Objects" ); + SetTitleL( KTitle ); + // + //iIdleResetListboxTimer = CPeriodic::NewL( CActive::EPriorityIdle ); + /* TODO: to solve observer + CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); + container.ObserverAddL( *this ); + */ + CMemSpyViewBase::ConstructL( aRect, aContainer ); + // + if( aType > EMemSpyThreadInfoItemTypeFirst || aType < EMemSpyThreadInfoItemTypeLast ) + { + TInt index(aType); + if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + } + else + { + iListBox->SetCurrentItemIndex( 0 ); + HandleListBoxItemSelectedL( 0 ); + } + /*if ( aSelectionRune ) + { + CMemSpyThreadInfoItemBase* selectedItem = reinterpret_cast< CMemSpyThreadInfoItemBase* >( aSelectionRune ); + const TInt index = container.InfoItemIndexByType( selectedItem->Type() ); + if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + } + else if ( container.MdcaCount() > 0 ) + {*/ + //iListBox->SetCurrentItemIndex( 0 ); + //HandleListBoxItemSelectedL( 0 ); + //} + } + +const CMemSpyThreadInfoItemBase& CMemSpyViewThreadInfoItemList::CurrentInfoItem() const + { + //__ASSERT_ALWAYS( iCurrentInfoItem != NULL, User::Invariant() ); + return *iCurrentInfoItem; + } + +void CMemSpyViewThreadInfoItemList::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemList::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemList; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareParentViewL() + { + CMemSpyViewBase* parent = new(ELeave) CMemSpyViewThreads( iMemSpySession, iObserver, iParentProcessId, iThreadId ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemList::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + + TMemSpyThreadInfoItemType type; + iMemSpySession.GetInfoItemType( iCurrentInfoItemId, iThreadId, type ); + + switch( type ) + { + case EMemSpyThreadInfoItemTypeHeap: + child = new(ELeave) CMemSpyViewThreadInfoItemHeap( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + case EMemSpyThreadInfoItemTypeStack: + child = new(ELeave) CMemSpyViewThreadInfoItemStack( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + case EMemSpyThreadInfoItemTypeChunk: + child = new(ELeave) CMemSpyViewThreadInfoItemChunk( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + case EMemSpyThreadInfoItemTypeCodeSeg: + child = new(ELeave) CMemSpyViewThreadInfoItemCodeSeg( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + case EMemSpyThreadInfoItemTypeServer: + child = new(ELeave) CMemSpyViewThreadInfoItemServer( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + case EMemSpyThreadInfoItemTypeActiveObject: + child = new(ELeave) CMemSpyViewThreadInfoItemActiveObject( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + case EMemSpyThreadInfoItemTypeGeneralInfo: + child = new(ELeave) CMemSpyViewThreadInfoItemGeneralInfo( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + /* + * This subview is permanently removed from Thread Info Item subview. + * + case EMemSpyThreadInfoItemTypeMemoryTracking: + child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, iThread.InfoContainerL() ); + break; + */ + case EMemSpyThreadInfoItemTypeSession: + case EMemSpyThreadInfoItemTypeSemaphore: + case EMemSpyThreadInfoItemTypeMutex: + case EMemSpyThreadInfoItemTypeTimer: + case EMemSpyThreadInfoItemTypeLDD: + case EMemSpyThreadInfoItemTypePDD: + case EMemSpyThreadInfoItemTypeLogicalChannel: + case EMemSpyThreadInfoItemTypeChangeNotifier: + case EMemSpyThreadInfoItemTypeUndertaker: + case EMemSpyThreadInfoItemTypeMessageQueue: + case EMemSpyThreadInfoItemTypeConditionalVariable: + case EMemSpyThreadInfoItemTypeOpenFiles: + case EMemSpyThreadInfoItemTypeOtherThreads: + case EMemSpyThreadInfoItemTypeOtherProcesses: + case EMemSpyThreadInfoItemTypeOwnedThreadHandles: + case EMemSpyThreadInfoItemTypeOwnedProcessHandles: + child = new(ELeave) CMemSpyViewThreadInfoItemGeneric( iMemSpySession, iObserver, iParentProcessId, iThreadId, type ); + break; + + default: + // __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0) ); + break; + } + + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + } + + +TBool CMemSpyViewThreadInfoItemList::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdThreadInfoHandles: + OnCmdInfoHandlesL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewThreadInfoItemList::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == R_MEMSPY_MENUPANE ) + { + // aMenuPane->SetItemDimmed( EMemSpyCmdThread, iThread.IsDead() ); //TODO + } + else if ( aResourceId == MenuCascadeResourceId() ) + { + // Always remove these items - they are only shown in the master thread view + aMenuPane->SetItemDimmed( EMemSpyCmdThreadSetPriority, ETrue ); + aMenuPane->SetItemDimmed( EMemSpyCmdThreadEnd, ETrue ); + } + } + + +void CMemSpyViewThreadInfoItemList::OnCmdInfoHandlesL() + { + iMemSpySession.OutputThreadInfoHandlesL( iThreadId ); + } + + +void CMemSpyViewThreadInfoItemList::HandleMemSpyEngineInfoContainerEventL( TEvent aEvent, TMemSpyThreadInfoItemType aType ) + {/* + if ( aEvent == EInfoItemChanged ) + { + } + else if ( aEvent == EInfoItemDestroyed ) + { + if ( iCurrentInfoItem && iCurrentInfoItem->Type() == aType ) + { + iCurrentInfoItem->Close(); + iCurrentInfoItem = NULL; + } + } + + iIdleResetListboxTimer->Cancel(); + iIdleResetListboxTimer->Start( KMemSpyIdleResetListboxTimerPeriod, KMemSpyIdleResetListboxTimerPeriod, TCallBack( IdleUpdateListBoxModel, this ) ); + */ + } + + +void CMemSpyViewThreadInfoItemList::SetListBoxModelL() + { + CDesC16ArrayFlat* iModel = new (ELeave) CDesC16ArrayFlat( 32 ); + + HBufC* iItem = HBufC::NewL( 32 ); + + iItem = MemSpyUiUtils::FormatItem( KGeneral ); + TPtr pItem( iItem->Des() ); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KHeap ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KStack ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KChunks ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KCodeSegs ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KOpenFiles ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KActiveObjects ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KThreadHandlers ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KProcessHandlers ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KServers ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KConnections ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KSemaphores ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KThreadReferences ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KProcessReferences ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KMutexes ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KTimers ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KDD ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KChangeNotif ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KUndertakers ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KLogicalDrivers ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + iItem = MemSpyUiUtils::FormatItem( KPhysicalDrivers ); + pItem = iItem->Des(); + iModel->AppendL( pItem ); + pItem.Zero(); + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iModel ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewThreadInfoItemList::HandleListBoxItemActionedL( TInt /*aIndex*/ ) + { + // Notify observer about an item being 'fired' + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewThreadInfoItemList::HandleListBoxItemSelectedL( TInt aIndex ) + { + iCurrentInfoItemId = aIndex; + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + +TInt CMemSpyViewThreadInfoItemList::IdleUpdateListBoxModel( TAny* aSelf ) + { + CMemSpyViewThreadInfoItemList* self = reinterpret_cast< CMemSpyViewThreadInfoItemList* >( aSelf ); + TRAP_IGNORE( self->DoIdleUpdateListBoxModelL() ); + return EFalse; + } + + +void CMemSpyViewThreadInfoItemList::DoIdleUpdateListBoxModelL() + { + /* + CMemSpyThreadInfoContainer& container = iThread.InfoContainerL(); + + // Try to maintain current item selection if at all possible. + TMemSpyThreadInfoItemType type = EMemSpyThreadInfoItemTypeHeap; + if ( iCurrentInfoItem ) + { + type = iCurrentInfoItem->Type(); + } + + // Update list box & model + SetListBoxModelL(); + iListBox->HandleItemAdditionL(); + RefreshL(); + + // Try to select previous item if it is still available + const TInt index = container.InfoItemIndexByType( type ); + if ( index >= 0 && index < container.MdcaCount() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + + iIdleResetListboxTimer->Cancel(); + */ + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,664 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemMemoryTracking.h" + +// System includes +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" + + +CMemSpyViewThreadInfoItemMemoryTracking::CMemSpyViewThreadInfoItemMemoryTracking( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) + { + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverAddL( *this ); + + // Reset the title + _LIT( KCustomTitle, "Memory Statistics" ); + SetTitleL( KCustomTitle ); + + // Select the appropriate view + const TMemSpyViewType viewType = (TMemSpyViewType) ((TInt) aSelectionRune ); + const TInt index = IndexByViewType( viewType ); + // +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::ConstructL() - aSelectionRune: 0x%08x, viewType: %d, index: %d", aSelectionRune, viewType, index ); +#endif + // + if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTracking::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatistics; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareParentViewL() + { + CMemSpyViewBase* parent = CMemSpyViewThreadInfoItemGeneric::PrepareParentViewL(); + + // Stop observing changes + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverRemove( *this ); + + return parent; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTracking::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + // + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + const TInt index = iListBox->CurrentItemIndex(); + if ( index == 1 ) + { + child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingCurrent( iEngine, iObserver, Container() ); + } + else if ( index == 2 ) + { + child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingHWM( iEngine, iObserver, Container() ); + } + else if ( index == 3 ) + { + child = new(ELeave) CMemSpyViewThreadInfoItemMemoryTrackingPeak( iEngine, iObserver, Container() ); + } + // + if ( child ) + { + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + + // Stop observing changes + item->TrackingObserverRemove( *this ); + } + // + return child; + } + + +TBool CMemSpyViewThreadInfoItemMemoryTracking::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdMemoryTrackingStart: + OnCmdTrackingStartL(); + break; + case EMemSpyCmdMemoryTrackingStop: + OnCmdTrackingStopL(); + break; + case EMemSpyCmdMemoryTrackingHWMReset: + OnCmdHWMResetL(); + break; + case EMemSpyCmdMemoryTrackingTotalWithSharedMem: + OnCmdTotalWithSharedMemL(); + break; + case EMemSpyCmdMemoryTrackingTotalWithoutSharedMem: + OnCmdTotalWithoutSharedMemL(); + break; + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +TInt CMemSpyViewThreadInfoItemMemoryTracking::IndexByViewType( TMemSpyViewType aType ) + { + TInt index = 0; + // + switch( aType ) + { + default: + case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent: + index = 1; + break; + case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM: + index = 2; + break; + case EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak: + index = 3; + break; + } + // + return index; + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::HandleListBoxItemActionedL( TInt aIndex ) + { + if ( aIndex == 0 ) + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + if ( item->TrackingActive() ) + { + OnCmdTrackingStopL(); + } + else + { + OnCmdTrackingStartL(); + } + } + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + + // Ensure we refresh the listbox content + iListBox->DrawDeferred(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + iListBox->DrawDeferred(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == MenuCascadeResourceId() ) + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + // + if ( !item->TrackerExists() || item->TrackingActive() ) + { + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStart, ETrue ); + } + else + { + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingStop, ETrue ); + } + // + if ( item->TotalIncludesSharedMemory() ) + { + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithSharedMem, ETrue ); + } + else + { + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingTotalWithoutSharedMem, ETrue ); + } + + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingHWMReset, Thread().IsDead() ); + } + else if ( aResourceId == R_MEMSPY_MENUPANE ) + { + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTracking, Thread().IsDead() ); + aMenuPane->SetItemDimmed( EMemSpyCmdMemoryTrackingAutoStart, Thread().IsDead() ); + } + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStartedL() + { + RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryTrackingStoppedL() + { + RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) + { +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - START - this: 0x%08x", this ); +#endif + + CMemSpyViewBase::RefreshL(); + iListBox->DrawDeferred(); + +#ifdef _DEBUG + RDebug::Printf( "[MemSpy] CMemSpyViewThreadInfoItemMemoryTracking::HandleMemoryChangedL() - END - this: 0x%08x", this ); +#endif + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStartL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingStartL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTrackingStopL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingStopL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdHWMResetL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingResetHWML(); + RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithSharedMemL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingSetTotalIncludesSharedMemoryL( ETrue ); + RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTracking::OnCmdTotalWithoutSharedMemL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingSetTotalIncludesSharedMemoryL( EFalse ); + RefreshL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewThreadInfoItemMemoryTrackingCurrent::CMemSpyViewThreadInfoItemMemoryTrackingCurrent( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) + { + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); + + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverAddL( *this ); + + // Reset the title + _LIT( KCustomTitle, "Current Statistics" ); + SetTitleL( KCustomTitle ); + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingCurrent::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsCurrent; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingCurrent::PrepareParentViewL() + { + CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + + // Stop observing changes + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverRemove( *this ); + + return parent; + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::SetListBoxModelL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + MDesCArray* model = &item->InfoCurrent(); + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingCurrent::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) + { + CMemSpyViewBase::RefreshL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewThreadInfoItemMemoryTrackingHWM::CMemSpyViewThreadInfoItemMemoryTrackingHWM( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) + { + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingHWM::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); + + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverAddL( *this ); + + // Reset the title + _LIT( KCustomTitle, "HWM Statistics" ); + SetTitleL( KCustomTitle ); + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingHWM::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsHWM; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingHWM::PrepareParentViewL() + { + CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + + // Stop observing changes + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverRemove( *this ); + + return parent; + } + + +TBool CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdMemoryTrackingHWMReset: + OnCmdHWMResetL(); + break; + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingHWM::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingHWM::SetListBoxModelL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + MDesCArray* model = &item->InfoHWM(); + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingHWM::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) + { + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingHWM::OnCmdHWMResetL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingResetHWML(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + +CMemSpyViewThreadInfoItemMemoryTrackingPeak::CMemSpyViewThreadInfoItemMemoryTrackingPeak( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeMemoryTracking ) + { + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingPeak::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); + + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverAddL( *this ); + + // Reset the title + _LIT( KCustomTitle, "Peak Statistics" ); + SetTitleL( KCustomTitle ); + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemMemoryTrackingPeak::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemMemoryTrackingStatisticsPeak; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemMemoryTrackingPeak::PrepareParentViewL() + { + CMemSpyViewThreadInfoItemMemoryTracking* parent = new(ELeave) CMemSpyViewThreadInfoItemMemoryTracking( iEngine, iObserver, Container() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + + // Stop observing changes + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + item->TrackingObserverRemove( *this ); + + return parent; + } + + +TBool CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingPeak::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingPeak::SetListBoxModelL() + { + CMemSpyThreadInfoMemoryTracking* item = static_cast< CMemSpyThreadInfoMemoryTracking* >( iInfoItem ); + MDesCArray* model = &item->InfoPeak(); + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewThreadInfoItemMemoryTrackingPeak::HandleMemoryChangedL( const TProcessId& /*aPid*/, const TMemSpyDriverProcessInspectionInfo& /*aCurrentInfo*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoIncShared*/, const TMemSpyDriverProcessInspectionInfo& /*aHWMInfoExcShared*/ ) + { + CMemSpyViewBase::RefreshL(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,394 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemServer.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" + +// Constants +const TInt KMemSpyServerSessionsIndex = 2; + + + +CMemSpyViewThreadInfoItemServer::CMemSpyViewThreadInfoItemServer( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeServer ) + { + } + + +void CMemSpyViewThreadInfoItemServer::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + // Causes list of server's to be prepared + CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); + + _LIT( KTitle, "Server List" ); + SetTitleL( KTitle ); + +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewThreadInfoItemServer::ConstructL() - aSelectionRune: 0x%08x", aSelectionRune ); +#endif + /* TODO + // Try to select the correct server + CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem ); + */ + TInt selectedIndex = 0; + /*if ( aSelectionRune ) + { + // Treat the rune as a handle, and try to look it up + selectedIndex = infoItem->DetailsIndexByHandle( aSelectionRune ); + } + + // Select item + if ( infoItem->DetailsCount() > 0 ) + {*/ + iListBox->SetCurrentItemIndex( selectedIndex ); + HandleListBoxItemSelectedL( selectedIndex ); + /*}*/ + } + + +TBool CMemSpyViewThreadInfoItemServer::HandleCommandL( TInt aCommand ) + { + TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); + return handled; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemServer::PrepareChildViewL() + { + /* + CMemSpyViewThreadInfoItemServerDetails* child = new(ELeave) CMemSpyViewThreadInfoItemServerDetails( iEngine, iObserver, iContainer, iCurrentInfoItemDetails ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( child ); + return child; + */ + } + + +void CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL( TInt aIndex ) + {/* TODO + // Identify the type of item to display... + CMemSpyThreadInfoHandleObjectBase* infoItem = static_cast< CMemSpyThreadInfoHandleObjectBase* >( iInfoItem ); + iCurrentInfoItemDetails = infoItem->DetailsAt( aIndex ); + +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewThreadInfoItemServer::HandleListBoxItemSelectedL() - iCurrentInfoItemDetails.iHandle: 0x%08x", iCurrentInfoItemDetails.iHandle ); +#endif +*/ + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + + + + + + + + + + + + + + + + + + + + + + + + +/* +CMemSpyViewThreadInfoItemServerDetails::CMemSpyViewThreadInfoItemServerDetails( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails ) + { + } + + +void CMemSpyViewThreadInfoItemServerDetails::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + // Causes list of server's to be prepared + CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); + + _LIT( KTitle, "Server Details" ); + SetTitleL( KTitle ); + + // Try to select the correct server + TInt selectedIndex = 0; + if ( aSelectionRune ) + { + // Presence of non-null item means that we came from the "Server sessions" list + selectedIndex = KMemSpyServerSessionsIndex; + } + + // Select item + iListBox->SetCurrentItemIndex( selectedIndex ); + HandleListBoxItemSelectedL( selectedIndex ); + } + + +TBool CMemSpyViewThreadInfoItemServerDetails::HandleCommandL( TInt aCommand ) + { + TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); + return handled; + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemServerDetails::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemServerDetails; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + const TInt currentIndex = iListBox->CurrentItemIndex(); + // + if ( currentIndex == KMemSpyServerSessionsIndex ) + { + CMemSpyViewThreadInfoItemServerSessions* serverSessions = new(ELeave) CMemSpyViewThreadInfoItemServerSessions( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails ); + CleanupStack::PushL( serverSessions ); + serverSessions->ConstructL( Rect(), *Parent(), NULL ); + CleanupStack::Pop( serverSessions ); + child = serverSessions; + } + // + return child; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemServerDetails::PrepareParentViewL() + { + CMemSpyViewThreadInfoItemServer* parent = new(ELeave) CMemSpyViewThreadInfoItemServer( iEngine, iObserver, iInfoItem->Container() ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), iInfoItemDetails.iHandle ); + CleanupStack::Pop( parent ); + return parent; + } + + +void CMemSpyViewThreadInfoItemServerDetails::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4); + CleanupStack::PushL( model ); + + TBuf item; + + // 1st item = session type + const TPtrC pServerSessionType = CMemSpyThreadInfoServer::SessionType( iInfoItemDetails.iSessionType ); + _LIT(KItem1Format, "\tServer Type\t\t%S"); + item.Format( KItem1Format, &pServerSessionType ); + model->AppendL( item ); + + // 2nd item = session count + _LIT(KItem2Format, "\tConnected Sessions\t\t%d"); + item.Format( KItem2Format, iInfoItemDetails.iCount ); + model->AppendL( item ); + + // 3rd item = view sessions + if ( iInfoItem->Container().MdcaCount() > 0 ) + { + _LIT(KItem3Format, "\tView Sessions"); + model->AppendL( KItem3Format ); + } + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + +*/ +/* +void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemActionedL( TInt /*aIndex*/ /*) +*/ +/* + { + // Notify observer about an item being 'fired' + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewThreadInfoItemServerDetails::HandleListBoxItemSelectedL( TInt /*aIndex*/ /*) +*/ +/* + { + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } +*/ + + + + + + + + + + + + + + + + + + + + + + + + +/* + + +CMemSpyViewThreadInfoItemServerSessions::CMemSpyViewThreadInfoItemServerSessions( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver, CMemSpyThreadInfoContainer& aContainer, const TMemSpyDriverHandleInfoGeneric& aInfoItemDetails ) +: CMemSpyViewThreadInfoItemGeneric( aEngine, aObserver, aContainer, EMemSpyThreadInfoItemTypeServer ), iInfoItemDetails( aInfoItemDetails ) + { + } + + +void CMemSpyViewThreadInfoItemServerSessions::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + CMemSpyViewThreadInfoItemGeneric::ConstructL( aRect, aContainer, aSelectionRune ); + // + _LIT( KTitle, "Connected Session List" ); + SetTitleL( KTitle ); + } + + +TBool CMemSpyViewThreadInfoItemServerSessions::HandleCommandL( TInt aCommand ) + { + TBool handled = CMemSpyViewBase::HandleCommandL( aCommand ); + return handled; + } + + +TMemSpyViewType CMemSpyViewThreadInfoItemServerSessions::ViewType() const + { + return EMemSpyViewTypeThreadInfoItemServerSessions; + } + + +CMemSpyViewBase* CMemSpyViewThreadInfoItemServerSessions::PrepareParentViewL() + { + CMemSpyViewThreadInfoItemServerDetails* parent = new(ELeave) CMemSpyViewThreadInfoItemServerDetails( iEngine, iObserver, iInfoItem->Container(), iInfoItemDetails ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), this ); + CleanupStack::Pop( parent ); + return parent; + } + + +void CMemSpyViewThreadInfoItemServerSessions::SetListBoxModelL() + { + CDesCArrayFlat* model = new(ELeave) CDesCArrayFlat(4); + CleanupStack::PushL( model ); + + // Get handles + RArray sessions; + CleanupClosePushL( sessions ); + iEngine.HelperServer().GetServerSessionsL( iInfoItemDetails, sessions ); + + // Prepare items + TBuf item; + const TInt count = sessions.Count(); + for( TInt i=0; iName() ); + item.Append( KInsertTab ); + item.Append( KInsertTab ); + item.Append( thread->Name() ); + } + } + else if ( session.iOwnerType == TMemSpyDriverServerSessionInfo::EOwnerProcess ) + { + // Find the process object + CMemSpyProcess* process = NULL; + TRAPD( error, process = &iEngine.Container().ProcessByIdL( session.iOwnerId ) ); + if ( error == KErrNone ) + { + item.Append( process->Name() ); + } + } + + if ( !item.Length() ) + { + // Fall-back case + item.Copy( session.iName ); + } + + // Add item + item.Insert( 0, KInsertTab ); + model->AppendL( item ); + } + CleanupStack::PopAndDestroy( &sessions ); + + // Set up list box + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( model ); + listbox->Model()->SetOwnershipType( ELbmOwnsItemArray ); + CleanupStack::Pop( model ); + } + +*/ + + + + + + + + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreadInfoItemStack.h" + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewThreads.h" +#include "MemSpyViewThreadInfoItemHeap.h" +#include "MemSpyAppUi.h" + + + +CMemSpyViewThreadInfoItemStack::CMemSpyViewThreadInfoItemStack( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aProcId, TThreadId aId, TMemSpyThreadInfoItemType aType ) +: CMemSpyViewThreadInfoItemGeneric( aSession, aObserver, aProcId, aId, EMemSpyThreadInfoItemTypeStack ) + { + } + + +TBool CMemSpyViewThreadInfoItemStack::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { +#ifndef __WINS__ + case EMemSpyCmdStackDataUser: + OnCmdStackDataUserL(); + break; + case EMemSpyCmdStackDataKernel: + OnCmdStackDataKernelL(); + break; +#endif + case EMemSpyCmdStackInfoThread: + OnCmdStackInfoL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewThreadInfoItemStack::OnCmdStackInfoL() + { + iMemSpySession.OutputStackInfoL( ThreadId() ); + } + + +void CMemSpyViewThreadInfoItemStack::OnCmdStackDataUserL() + { + iMemSpySession.OutputStackDataL( ThreadId(), EMemSpyDriverDomainUser ); + } + + +void CMemSpyViewThreadInfoItemStack::OnCmdStackDataKernelL() + { + iMemSpySession.OutputStackDataL( ThreadId(), EMemSpyDriverDomainKernel ); + } + + +void CMemSpyViewThreadInfoItemStack::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == R_MEMSPY_MENUPANE ) + { + //TODO aMenuPane->SetItemDimmed( EMemSpyCmdStack, Thread().IsDead() ); + } + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewThreads.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewThreads.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,464 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewThreads.h" + +// System includes +#include +#include + +// Engine includes +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "MemSpyContainerObserver.h" +#include "MemSpyViewProcesses.h" +#include "MemSpyViewThreadInfoItemList.h" + + + +CMemSpyViewThreads::CMemSpyViewThreads( RMemSpySession& aSession, MMemSpyViewObserver& aObserver, TProcessId aId, TThreadId aThreadId ) +: CMemSpyViewBase( aSession, aObserver ), iParentProcessId( aId ), iCurrentThreadId( aThreadId ) + { + } + + +CMemSpyViewThreads::~CMemSpyViewThreads() + { + } + + +void CMemSpyViewThreads::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + TInt error = KErrNone; + TRAP( error, iMemSpySession.GetThreadsL( iParentProcessId, iThreads ) ); + + if( error == KErrNone ) + { + _LIT( KTitle, "Threads" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + // + if( iCurrentThreadId > 0 ) + { + for( TInt i = 0; i < iThreads.Count() ; i++ ) + { + if( iThreads[i]->Id() == iCurrentThreadId ) + { + const TInt index = i; + if ( index >= 0 && index < iListBox->Model()->NumberOfItems() ) + { + iListBox->SetCurrentItemIndex( index ); + HandleListBoxItemSelectedL( index ); + } + } + } + } + else if( iThreads.Count() > 0 ) + { + iListBox->SetCurrentItemIndex( 0 ); + HandleListBoxItemSelectedL( 0 ); + } + } + } + + +TProcessId CMemSpyViewThreads::Process() const + { + return iParentProcessId; + } + + +TThreadId CMemSpyViewThreads::CurrentThread() + { + return iCurrentThreadId; + } + + +void CMemSpyViewThreads::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewThreads::ViewType() const + { + return EMemSpyViewTypeThreads; + } + + +CMemSpyViewBase* CMemSpyViewThreads::PrepareParentViewL() + { + CMemSpyViewProcesses* parent = new(ELeave) CMemSpyViewProcesses( iMemSpySession, iObserver, iParentProcessId ); + CleanupStack::PushL( parent ); + //parent->ConstructL( Rect(), *Parent(), &iParentProcessId ); + parent->ConstructL( Rect(), *Parent() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewThreads::PrepareChildViewL() + { + CMemSpyViewThreadInfoItemList* child = new(ELeave) CMemSpyViewThreadInfoItemList( iMemSpySession, iObserver, iParentProcessId, iCurrentThreadId ); + CleanupStack::PushL( child ); + child->ConstructL( Rect(), *Parent(), EMemSpyThreadInfoItemTypeFirst ); + CleanupStack::Pop( child ); + return child; + } + + +void CMemSpyViewThreads::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) + { + if ( aResourceId == R_MEMSPY_MENUPANE ) + { + /* + CMemSpyThread& thread = CurrentThread(); + aMenuPane->SetItemDimmed( EMemSpyCmdThread, thread.IsDead() ); + */ + //aMenuPane->SetItemDimmed( EMemSpyCmdThread, (iThreads[iListBox->CurrentItemIndex()]->ExitType() != EExitPending )); + } + } + + +TBool CMemSpyViewThreads::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdThreadEndKill: + OnCmdEndKillL(); + break; + case EMemSpyCmdThreadEndTerminate: + OnCmdEndTerminateL(); + break; + case EMemSpyCmdThreadEndPanic: + OnCmdEndPanicL(); + break; + case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow: + case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal: + case EMemSpyCmdThreadSetPriorityAbsoluteLow: + case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal: + case EMemSpyCmdThreadSetPriorityAbsoluteBackground: + case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal: + case EMemSpyCmdThreadSetPriorityAbsoluteForeground: + case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal: + case EMemSpyCmdThreadSetPriorityAbsoluteHigh: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7: + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8: + OnCmdSetPriorityL( aCommand ); + break; + + case EMemSpyCmdThreadInfoHandles: + OnCmdInfoHandlesL(); + break; + + default: + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + // + return handled; + } + + +void CMemSpyViewThreads::OnCmdEndKillL() + { + TBool system = ETrue; + TBool doTerminate = ETrue; + TInt err = KErrNone; + + iMemSpySession.ThreadSystemPermanentOrCritical( iCurrentThreadId, system ); + + if ( system ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + // + if ( doTerminate ) + { + TRAP( err, iMemSpySession.EndThreadL( iCurrentThreadId, EKill ) ); + if ( err == KErrNone ) + RefreshL(); + } + } + + +void CMemSpyViewThreads::OnCmdEndTerminateL() + { + TBool system = ETrue; + TBool doTerminate = ETrue; + TInt err = KErrNone; + + iMemSpySession.ThreadSystemPermanentOrCritical( iCurrentThreadId, system ); + + if ( system ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + // + if ( doTerminate ) + { + TRAP( err, iMemSpySession.EndThreadL( iCurrentThreadId, ETerminate ) ); + if( err == KErrNone ) + RefreshL(); + } + } + + +void CMemSpyViewThreads::OnCmdEndPanicL() + { + TBool system = ETrue; + TBool doTerminate = ETrue; + TInt err = KErrNone; + + iMemSpySession.ThreadSystemPermanentOrCritical( iCurrentThreadId, system ); + + if ( system ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + // + if ( doTerminate ) + { + TRAP( err, iMemSpySession.EndThreadL( iCurrentThreadId, EPanic ) ); + if( err == KErrNone ) + RefreshL(); + } + } + + +void CMemSpyViewThreads::OnCmdSetPriorityL( TInt aCommand ) + { + TThreadPriority pri = EPriorityAbsoluteBackground; + switch( aCommand ) + { + case EMemSpyCmdThreadSetPriorityAbsoluteVeryLow: + pri = EPriorityAbsoluteVeryLow; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteLowNormal: + pri = EPriorityAbsoluteLowNormal; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteLow: + pri = EPriorityAbsoluteLow; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal: + pri = EPriorityAbsoluteBackgroundNormal; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteBackground: + pri = EPriorityAbsoluteBackground; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal: + pri = EPriorityAbsoluteForegroundNormal; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteForeground: + pri = EPriorityAbsoluteForeground; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteHighNormal: + pri = EPriorityAbsoluteHighNormal; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteHigh: + pri = EPriorityAbsoluteHigh; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime1: + pri = EPriorityAbsoluteRealTime1; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime2: + pri = EPriorityAbsoluteRealTime2; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime3: + pri = EPriorityAbsoluteRealTime3; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime4: + pri = EPriorityAbsoluteRealTime4; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime5: + pri = EPriorityAbsoluteRealTime5; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime6: + pri = EPriorityAbsoluteRealTime6; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime7: + pri = EPriorityAbsoluteRealTime7; + break; + case EMemSpyCmdThreadSetPriorityAbsoluteRealTime8: + pri = EPriorityAbsoluteRealTime8; + break; + } + +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - pri: %d", pri ); +#endif + TInt err = KErrNone; + TRAP( err , iMemSpySession.SetThreadPriorityL( iCurrentThreadId, pri ) ); + if( err == KErrNone ) + { + RefreshL(); + } + else + { + #ifdef _DEBUG + RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - set priority failed" ); + #endif + } + +#ifdef _DEBUG + RDebug::Printf( "CMemSpyViewThreads::OnCmdSetPriorityL() - END" ); +#endif + + } + + +void CMemSpyViewThreads::OnCmdInfoHandlesL() + { + iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId ); + } + + +void CMemSpyViewThreads::SetListBoxModelL() + { + iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items + + _LIT( KTab, "\t" ); + _LIT( KTTab, "\t\t" ); + + for( TInt i=0; i < iThreads.Count(); i++ ) + { + HBufC* tempName = HBufC::NewL( iThreads[i]->Name().Length() + 16 ); + CleanupStack::PushL( tempName ); + TPtr tempNamePtr( tempName->Des() ); + tempNamePtr.Copy( KTab ); + tempNamePtr.Append( iThreads[i]->Name() ); + tempNamePtr.Append( KTTab ); + + AppendPriority( tempNamePtr, iThreads[i]->ThreadPriority() ); + + iModel->AppendL( tempNamePtr ); + + CleanupStack::PopAndDestroy( tempName ); + } + + CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iModel ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +void CMemSpyViewThreads::HandleListBoxItemActionedL( TInt /*aIndex*/ ) + { + // Notify observer about an item being 'fired' + ReportEventL( MMemSpyViewObserver::EEventItemActioned ); + } + + +void CMemSpyViewThreads::HandleListBoxItemSelectedL( TInt aIndex ) + { + iCurrentThreadId = iThreads[ aIndex ]->Id(); + + // Notify observer about item selection + ReportEventL( MMemSpyViewObserver::EEventItemSelected ); + } + + +void CMemSpyViewThreads::AppendPriority( TDes& aDes, TThreadPriority aPriority ) + { + switch( aPriority ) + { + case EPriorityNull: + aDes += _L("[Null]"); + break; + case EPriorityMuchLess: + aDes += _L("[Much Less]"); + break; + case EPriorityLess: + aDes += _L("[Less]"); + break; + case EPriorityNormal: + aDes += _L("[Normal]"); + break; + case EPriorityMore: + aDes += _L("[More]"); + break; + case EPriorityMuchMore: + aDes += _L("[Much More]"); + break; + case EPriorityRealTime: + aDes += _L("[Real Time]"); + break; + + // Absolute values + case EPriorityAbsoluteVeryLow: + aDes += _L("[Abs Very Low]"); + break; + case EPriorityAbsoluteLowNormal: + aDes += _L("[Abs Low Norm]"); + break; + case EPriorityAbsoluteLow: + aDes += _L("[Abs Low]"); + break; + case EPriorityAbsoluteBackground: + aDes += _L("[Abs Bgnd]"); + break; + case EPriorityAbsoluteBackgroundNormal: + aDes += _L("[Abs Bgnd Norm]"); + break; + case EPriorityAbsoluteForeground: + aDes += _L("[Abs Fgnd]"); + break; + case EPriorityAbsoluteForegroundNormal: + aDes += _L("[Abs Fgnd Norm]"); + break; + case EPriorityAbsoluteHigh: + aDes += _L("[Abs High]"); + break; + case EPriorityAbsoluteHighNormal: + aDes += _L("[Abs High Norm]"); + break; + case EPriorityAbsoluteRealTime1: + case EPriorityAbsoluteRealTime2: + case EPriorityAbsoluteRealTime3: + case EPriorityAbsoluteRealTime4: + case EPriorityAbsoluteRealTime5: + case EPriorityAbsoluteRealTime6: + case EPriorityAbsoluteRealTime7: + case EPriorityAbsoluteRealTime8: + aDes.AppendFormat( _L("[Abs RT %d]"), ( aPriority - EPriorityAbsoluteRealTime1 ) + 1 ); + break; + default: + aDes += _L("[Unknown Pri.]"); + break; + } + } diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewType.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewType.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewType.h" + + + + +TBool MemSpyViewTypeUtils::IsOpenableItem( TMemSpyViewType aType ) + { + TBool openable = EFalse; + // + switch( aType ) + { + case EMemSpyViewTypeMainMenu: + case EMemSpyViewTypeProcesses: + case EMemSpyViewTypeServerList: + case EMemSpyViewTypeThreads: + case EMemSpyViewTypeThreadInfoItemList: + case EMemSpyViewTypeThreadInfoItemServer: + case EMemSpyViewTypeThreadInfoItemSession: + openable = ETrue; + break; + default: + break; + } + // + return openable; + } + + +TBool MemSpyViewTypeUtils::IsThreadInfoItem( TMemSpyViewType aType ) + { + TBool infoItem = ETrue; + // + switch( aType ) + { + case EMemSpyViewTypeMainMenu: + case EMemSpyViewTypeRAMInfo: + case EMemSpyViewTypeROMInfo: + case EMemSpyViewTypeServerList: + case EMemSpyViewTypeOpenFiles: + case EMemSpyViewTypeProcesses: + case EMemSpyViewTypeThreads: + case EMemSpyViewTypeThreadInfoItemList: + infoItem = EFalse; + break; + default: + break; + } + // + return infoItem; + } + + +TBool MemSpyViewTypeUtils::IsExitableView( TMemSpyViewType aType ) + { + TBool ret = EFalse; + // + switch( aType ) + { + case EMemSpyViewTypeMainMenu: + ret = ETrue; + break; + default: + break; + } + // + return ret; + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,315 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MemSpyViewWindowGroups.h" + +// System includes +#include +#include +#include + +// Engine includes +#include +#include +#include + +// User includes +#include "MemSpyUiUtils.h" +#include "MemSpyViewMainMenu.h" +#include "MemSpyContainerObserver.h" + +// Literal constants +const TInt KMaxInfoLength = 128; + + +CMemSpyViewWindowGroups::CMemSpyViewWindowGroups( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver ) +: CMemSpyViewBase( aEngine, aObserver ) + { + } + + +CMemSpyViewWindowGroups::~CMemSpyViewWindowGroups() + { + delete iWindowGroupList; + } + + +void CMemSpyViewWindowGroups::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune ) + { + _LIT( KTitle, "Window Groups" ); + SetTitleL( KTitle ); + // + CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune ); + } + + +CEikListBox* CMemSpyViewWindowGroups::ConstructListBoxL() + { + delete iListBox; + iListBox = NULL; + CAknSingleNumberStyleListBox* listbox = new (ELeave) CAknSingleNumberStyleListBox(); + iListBox = listbox; + listbox->ConstructL( this, EAknListBoxSelectionList | EAknListBoxLoopScrolling ); + listbox->SetContainerWindowL( *this ); + listbox->CreateScrollBarFrameL( ETrue ); + SetListBoxModelL(); + listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); + listbox->SetListBoxObserver( this ); + listbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue ); + listbox->SetObserver( this ); + return listbox; + } + +void CMemSpyViewWindowGroups::RefreshL() + { + SetListBoxModelL(); + CMemSpyViewBase::RefreshL(); + } + + +TMemSpyViewType CMemSpyViewWindowGroups::ViewType() const + { + return EMemSpyViewTypeWindowGroups; + } + + +CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareParentViewL() + { + CMemSpyViewMainMenu* parent = new(ELeave) CMemSpyViewMainMenu( iEngine, iObserver ); + CleanupStack::PushL( parent ); + parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() ); + CleanupStack::Pop( parent ); + return parent; + } + + +CMemSpyViewBase* CMemSpyViewWindowGroups::PrepareChildViewL() + { + CMemSpyViewBase* child = NULL; + if ( iListBox && + iListBox->Model()->NumberOfItems() && + iListBox->CurrentItemIndex() > KErrNotFound ) + { + DetailsL(); + } + return child; + } + + +void CMemSpyViewWindowGroups::SetListBoxModelL() + { + // Take ownership of new model + MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer(); + MMemSpyEngineWindowGroupList* windowGroupList = windowServerManager.WindowGroupListL(); + delete iWindowGroupList; + iWindowGroupList = windowGroupList; + + // Set up list box + CAknSingleNumberStyleListBox* listbox = static_cast< CAknSingleNumberStyleListBox* >( iListBox ); + listbox->Model()->SetItemTextArray( iWindowGroupList ); + listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + } + + +TBool CMemSpyViewWindowGroups::HandleCommandL( TInt aCommand ) + { + TBool handled = ETrue; + // + switch ( aCommand ) + { + case EMemSpyCmdWindowGroupTerminate: + { + TRAPD( err, OnCmdEndL( aCommand ) ); + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + if ( err ) + { + note->ExecuteLD( _L("Cannot terminate task") ); + } + else + { + note->ExecuteLD( _L("Task terminated") ); + } + break; + } + case EMemSpyCmdWindowGroupSwitchTo: + { + TRAPD( err, OnCmdSwitchToL() ); + if ( err ) + { + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + note->ExecuteLD( _L("Cannot bring to foreground") ); + } + break; + } + case EMemSpyCmdWindowGroupEnd: + { + TRAPD( err, OnCmdEndL( aCommand ) ); + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + if ( err ) + { + note->ExecuteLD( _L("Cannot end task") ); + } + else + { + note->ExecuteLD( _L("Task exited") ); + } + break; + } + case EMemSpyCmdWindowGroupPanic: + { + TRAPD( err, OnCmdEndL( aCommand ) ); + CAknConfirmationNote* note = new(ELeave) CAknConfirmationNote( ETrue ); + if ( err ) + { + note->ExecuteLD( _L("Cannot panic task") ); + } + else + { + note->ExecuteLD( _L("Task panic'ed") ); + } + break; + } + default: + { + handled = CMemSpyViewBase::HandleCommandL( aCommand ); + break; + } + } + // + return handled; + } + + +void CMemSpyViewWindowGroups::OnCmdSwitchToL() + { + MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer(); + TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId; + windowServerManager.SwitchToL( id ); + } + + +void CMemSpyViewWindowGroups::OnCmdEndL( TInt aCommand ) + { + /* + TBool doTerminate = ETrue; + + CMemSpyEngineObjectContainer& container = iEngine.Container(); + TThreadId id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iThreadId; + + // Try to find the thread in question... + CMemSpyProcess* process = NULL; + CMemSpyThread* thread = NULL; + User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); + + if ( thread ) + { + // + if ( thread->IsSystemPermanent() || thread->IsSystemCritical() ) + { + CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); + doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); + } + // + if ( doTerminate ) + { + switch ( aCommand ) + { + case EMemSpyCmdWindowGroupTerminate: + { + thread->TerminateL(); + break; + } + case EMemSpyCmdWindowGroupEnd: + { + thread->KillL(); + break; + } + case EMemSpyCmdWindowGroupPanic: + { + thread->PanicL(); + break; + } + default: + { + // Programming error + __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); + } + } + } + } + RefreshL(); + */ + } + + +void CMemSpyViewWindowGroups::DetailsL() + { + HBufC* messageBuf = HBufC::NewLC( 4096 ); + TPtr messagePtr = messageBuf->Des(); + + // Fetch data from helper + TMemSpyEngineWindowGroupDetails selectedObject; + MMemSpyEngineHelperWindowServer& windowServerManager = iEngine.HelperWindowServer(); + TInt id = iWindowGroupList->At( iListBox->CurrentItemIndex() ).iId; + windowServerManager.GetWindowGroupDetailsL( id, selectedObject ); + + // Append info to string buffer + AppendFormatString( messagePtr, _L("WG ID: %d\n"), selectedObject.iId ); + AppendFormatString( messagePtr, _L("Client ThreadId: %Lu\n"), selectedObject.iThreadId.Id() ); + TFullName name; + name.Copy( selectedObject.iFullName ); + AppendFormatString( messagePtr, _L("Thr: %S\n"), &name ); + name.Zero(); + AppendFormatString( messagePtr, _L("Priority: %d\n"), selectedObject.iPriority ); + AppendFormatString( messagePtr, _L("Handle: 0x%08X\n"), selectedObject.iWindowGroupHandle ); + name.Copy( selectedObject.iName ); + AppendFormatString( messagePtr, _L("Name: %S\n"), &name ); + name.Zero(); + AppendFormatString( messagePtr, _L("UID: 0x%08X\n"), selectedObject.iUID ); + AppendFormatString( messagePtr, _L("IsBusy: %d\n"), selectedObject.iIsBusy ); + AppendFormatString( messagePtr, _L("IsSystem: %d\n"), selectedObject.iIsSystem ); + AppendFormatString( messagePtr, _L("IsHidden: %d\n"), selectedObject.iIsHidden ); + name.Copy( selectedObject.iCaption ); + AppendFormatString( messagePtr, _L("Caption: %S\n"), &name ); + name.Zero(); + name.Copy( selectedObject.iDocName ); + AppendFormatString( messagePtr, _L("Docname: %S"), &name ); + name.Zero(); + + // Display the buffer on a dialog + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog( CAknQueryDialog::ENoTone ); + dialog->PrepareLC( R_MEMSPY_KERNEL_OBJECT_DETAILS_DIALOG ); + TFileName headerText; + headerText.Copy( selectedObject.iFullName ); + dialog->SetHeaderTextL( headerText ); + dialog->SetMessageTextL( messagePtr ); + dialog->RunLD(); + + CleanupStack::PopAndDestroy( messageBuf ); + } + + +void CMemSpyViewWindowGroups::AppendFormatString( TPtr& aPtr, TRefByValue aFmt, ... ) + { + TBuf infoString; + VA_LIST list; + VA_START ( list, aFmt ); + infoString.FormatList( aFmt, list ); + aPtr.Append( infoString ); + } + + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/hb.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/hb.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,95 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = app +TARGET = MemSpyUI +DEPENDPATH += . +INCLUDEPATH += /epoc32/include/platform/memspy/api +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + +load(hb.prf) +symbian:CONFIG -= symbian_i18n + +HEADERS += inc/enginewrapper.h \ + inc/viewmanager.h \ + inc/memspyview.h \ + inc/memspylistview.h \ + inc/memspymainview.h \ + inc/memspyprocessview.h \ + inc/memspythreadview.h \ + inc/memspythreaddetailindexview.h \ + inc/memspythreaddetailview.h \ + inc/memspykernelobjecttypeview.h \ + inc/memspykernelobjectview.h \ + inc/memspykernelobjectdetailview.h \ + inc/memspytrackingview.h \ + inc/memspyswmtview.h \ + inc/memspyheapdumpsview.h \ + inc/memspysettingsview.h \ + inc/memspyserverview.h \ + inc/memspyecomcategoryview.h \ + inc/memspyecominterfaceview.h \ + inc/memspyecomimplementationview.h \ + inc/memspyecomimplementationdetailview.h + +SOURCES += src/main.cpp \ + src/enginewrapper.cpp \ + src/viewmanager.cpp \ + src/memspyview.cpp \ + src/memspylistview.cpp \ + src/memspymainview.cpp \ + src/memspyprocessview.cpp \ + src/memspythreadview.cpp \ + src/memspythreaddetailindexview.cpp \ + src/memspythreaddetailview.cpp \ + src/memspykernelobjecttypeview.cpp \ + src/memspykernelobjectview.cpp \ + src/memspykernelobjectdetailview.cpp \ + src/memspytrackingview.cpp \ + src/memspyswmtview.cpp \ + src/memspyheapdumpsview.cpp \ + src/memspysettingsview.cpp \ + src/memspyserverview.cpp \ + src/memspyecomcategoryview.cpp \ + src/memspyecominterfaceview.cpp \ + src/memspyecomimplementationview.cpp \ + src/memspyecomimplementationdetailview.cpp + +RESOURCES += + +symbian: { + LIBS += -lestor \ + -lbafl \ + -lMemSpyClient \ + -lefsrv + + + TARGET.CAPABILITY = ReadUserData WriteUserData ReadDeviceData WriteDeviceData SwEvent PowerMgmt + + TARGET.UID2 = 0x100039CE + TARGET.UID3 = 0x2002129F + TARGET.SID = 0x2002129F + TARGET.VID = 0x101FB657 // Nokia + + TARGET.EPOCHEAPSIZE = 0x10000 0x2000000 // Min 64Kb, Max 32Mb + + ICON = ../../icons/qgn_menu_memspyui.svg + + RSS_RULES += "group_name = \"RnD Tools\""; +} else { + error("Only Symbian supported") +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/enginewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/enginewrapper.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,636 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ENGINEWRAPPER_H_ +#define ENGINEWRAPPER_H_ + +#include +#include +#include + +#include + +typedef quint64 ProcessId; +typedef quint64 ThreadId; + +enum ThreadPriority +{ + ThreadPriorityNull=(-30), + ThreadPriorityMuchLess=(-20), + ThreadPriorityLess=(-10), + ThreadPriorityNormal=0, + ThreadPriorityMore=10, + ThreadPriorityMuchMore=20, + ThreadPriorityRealTime=30, + ThreadPriorityAbsoluteVeryLow=100, + ThreadPriorityAbsoluteLowNormal=150, + ThreadPriorityAbsoluteLow=200, + ThreadPriorityAbsoluteBackgroundNormal=250, + ThreadPriorityAbsoluteBackground=300, + ThreadPriorityAbsoluteForegroundNormal=350, + ThreadPriorityAbsoluteForeground=400, + ThreadPriorityAbsoluteHighNormal=450, + ThreadPriorityAbsoluteHigh=500, + ThreadPriorityAbsoluteRealTime1=810, + ThreadPriorityAbsoluteRealTime2=820, + ThreadPriorityAbsoluteRealTime3=830, + ThreadPriorityAbsoluteRealTime4=840, + ThreadPriorityAbsoluteRealTime5=850, + ThreadPriorityAbsoluteRealTime6=860, + ThreadPriorityAbsoluteRealTime7=870, + ThreadPriorityAbsoluteRealTime8=880 +}; + +enum KernelObjectType +{ + KernelObjectTypeUnknown = -1, + KernelObjectTypeThread = 0, + KernelObjectTypeProcess, + KernelObjectTypeChunk, + KernelObjectTypeLibrary, + KernelObjectTypeSemaphore, + KernelObjectTypeMutex, + KernelObjectTypeTimer, + KernelObjectTypeServer, + KernelObjectTypeSession, + KernelObjectTypeLogicalDevice, + KernelObjectTypePhysicalDevice, + KernelObjectTypeLogicalChannel, + KernelObjectTypeChangeNotifier, + KernelObjectTypeUndertaker, + KernelObjectTypeMsgQueue, + KernelObjectTypePropertyRef, + KernelObjectTypeCondVar +}; + +enum ThreadInfoType +{ + ThreadInfoTypeGeneral = EMemSpyThreadInfoItemTypeGeneralInfo, + ThreadInfoTypeHeap = EMemSpyThreadInfoItemTypeHeap, + ThreadInfoTypeStack = EMemSpyThreadInfoItemTypeStack, + ThreadInfoTypeChunk = EMemSpyThreadInfoItemTypeChunk, + ThreadInfoTypeCodeSeg = EMemSpyThreadInfoItemTypeCodeSeg, + ThreadInfoTypeOpenFiles = EMemSpyThreadInfoItemTypeOpenFiles, + ThreadInfoTypeActiveObjects = EMemSpyThreadInfoItemTypeActiveObject, + ThreadInfoTypeOwnedThreadHandles = EMemSpyThreadInfoItemTypeOwnedThreadHandles, + ThreadInfoTypeOwnedProcessHandles = EMemSpyThreadInfoItemTypeOwnedProcessHandles, + ThreadInfoTypeServer = EMemSpyThreadInfoItemTypeServer, + ThreadInfoTypeSession = EMemSpyThreadInfoItemTypeSession, + ThreadInfoTypeSemaphore = EMemSpyThreadInfoItemTypeSemaphore, + ThreadInfoTypeOtherThreads = EMemSpyThreadInfoItemTypeOtherThreads, + ThreadInfoTypeOtherProcesses = EMemSpyThreadInfoItemTypeOtherProcesses, + ThreadInfoTypeMutex = EMemSpyThreadInfoItemTypeMutex, + ThreadInfoTypeTimer = EMemSpyThreadInfoItemTypeTimer, + ThreadInfoTypeChannel = EMemSpyThreadInfoItemTypeLogicalChannel, + ThreadInfoTypeChangeNotifier = EMemSpyThreadInfoItemTypeChangeNotifier, + ThreadInfoTypeUndertaker = EMemSpyThreadInfoItemTypeUndertaker, + ThreadInfoTypeMessageQueue = EMemSpyThreadInfoItemTypeMessageQueue, + ThreadInfoTypeConditionalVariable = EMemSpyThreadInfoItemTypeConditionalVariable, + ThreadInfoTypeLDD = EMemSpyThreadInfoItemTypeLDD, + ThreadInfoTypePDD = EMemSpyThreadInfoItemTypePDD, +}; + +enum DeviceWideOperation +{ + OutputPhoneInfo = 0, + + OutputDetailedPhoneInfo, + + OutputHeapInfo, + + OutputCompactHeapInfo, + + OutputHeapCellListing, + + OutputHeapData, + + OutputStackInfo, + + OutputCompactStackInfo, + + OutputUserStackData, + + OutputKernelStackData +}; + +enum SwmtMode +{ + SwmtModeBasic = 0, + SwmtModeFull, + SwmtModeCustom +}; + +enum HeapDumpsMode +{ + HeapDumpsModeKernel = 0, + HeapDumpsModeUser, + HeapDumpsModeBoth +}; + +enum OutputMode +{ + OutputModeTrace = 0, + OutputModeFile +}; + +class MemSpyProcess +{ +public: + MemSpyProcess(CMemSpyApiProcess* process) + : mProcess(process) + {} + + virtual ~MemSpyProcess() { delete mProcess; } + + ProcessId id() const { return mProcess->Id(); } + + QString name() const { return QString((QChar*) mProcess->Name().Ptr(), mProcess->Name().Length()); } + + QString exitInfo() const; + + int priority() const { return mProcess->Priority(); } + + int threadCount() const { return mProcess->ThreadCount(); } + + int sid() const { return mProcess->SID(); } + + int vid() const { return mProcess->VID(); } + + bool isDead() const { return mProcess->IsDead(); } + +private: + CMemSpyApiProcess *mProcess; +}; + +class MemSpyThread +{ +public: + MemSpyThread(CMemSpyApiThread* thread) + : mThread(thread) + {} + + virtual ~MemSpyThread() { delete mThread; } + + ThreadId id() const { return mThread->Id(); } + + QString name() const { return QString((QChar*) mThread->Name().Ptr(), mThread->Name().Length()); } + + int priority() const { return mThread->ThreadPriority(); } + + +private: + CMemSpyApiThread *mThread; +}; + +class MemSpyKernelObjectType +{ +public: + MemSpyKernelObjectType(CMemSpyApiKernelObject* type) + : mType(type) + {} + + virtual ~MemSpyKernelObjectType() { delete mType; } + + int id() const { return mType->Type(); } + + QString name() const { return QString((QChar*) mType->Name().Ptr(), mType->Name().Length()); } + + int count() const { return mType->Count(); } + + qint64 size() const { return mType->Size(); } + +private: + CMemSpyApiKernelObject *mType; +}; + +class MemSpyKernelObject +{ +public: + MemSpyKernelObject(CMemSpyApiKernelObjectItem* object) + : mObject(object) + {} + + virtual ~MemSpyKernelObject() { delete mObject; } + + int type() const { return mObject->Type(); } + + QString name() const { return QString::fromLatin1((char*)mObject->Name().Ptr(), mObject->Name().Length()); } + + QString nameDetail() const { return QString::fromLatin1((char*)mObject->NameDetail().Ptr(), mObject->NameDetail().Length()); } + + int accessCount() const { return mObject->AccessCount(); } + + int uniqueId() const { return mObject->UniqueID(); } + + unsigned int protection() const { return mObject->Protection(); } + + unsigned int addressOfKernelOwner() const { return reinterpret_cast(mObject->AddressOfKernelOwner()); } + + unsigned int kernelAddress() const { return reinterpret_cast(mObject->Handle()); } + + unsigned int addressOfOwningProcess() const { return reinterpret_cast(mObject->AddressOfOwningProcess()); } + + int id() const { return mObject->Id(); } + + int priority() const { return mObject->Priority(); } + + QString nameOfOwner() const { return QString::fromLatin1((char*)mObject->NameOfOwner().Ptr(), mObject->NameOfOwner().Length()); } + + unsigned int creatorId() const { return mObject->CreatorId(); } + + int attributes() const { return mObject->Attributes(); } + + unsigned int addressOfDataBssStackChunk() const { return reinterpret_cast(mObject->AddressOfDataBssStackChunk()); } + + unsigned int securityZone() const { return mObject->SecurityZone(); } + + unsigned int size() const { return mObject->Size(); } + + unsigned int maxSize() const { return mObject->MaxSize(); } + + unsigned int bottom() const { return mObject->Bottom(); } + + unsigned int top() const { return mObject->Top(); } + + unsigned int startPos() const { return mObject->StartPos(); } + + unsigned int controllingOwner() const { return mObject->ControllingOwner(); } + + unsigned int restrictions() const { return mObject->Restrictions(); } + + unsigned int mapAttr() const { return mObject->Restrictions(); } + + unsigned int chunkType() const { return mObject->ChunkType(); } + + int mapCount() const { return mObject->MapCount(); } + + unsigned int state() const { return mObject->State(); } + + unsigned int addressOfCodeSeg() const { return reinterpret_cast(mObject->AddressOfCodeSeg()); } + + unsigned int resetting() const { return mObject->Resetting(); } + + unsigned int order() const { return mObject->Order(); } + + QString version() const { return QString((QChar*) mObject->Version().Name().Ptr(), mObject->Version().Name().Length()); } + + unsigned int parseMask() const { return mObject->ParseMask(); } + + unsigned int unitsMask() const { return mObject->UnitsMask(); } + + unsigned int changes() const { return mObject->Changes(); } + + int count() const { return mObject->Count(); } + + int waitCount() const { return mObject->WaitCount(); } + + int sessionType() const { return mObject->SessionType(); } + + int timerType() const { return mObject->TimerType(); } + + int timerState() const { return mObject->TimerState(); } + + unsigned int addressOfOwningThread() const { return reinterpret_cast(mObject->AddressOfOwningThread()); } + + unsigned int addressOfServer() const { return reinterpret_cast(mObject->AddressOfServer()); } + + unsigned int svrSessionType() const { return mObject->SvrSessionType(); } + + int msgCount() const { return mObject->MsgCount(); } + + int msgLimit() const { return mObject->MsgLimit(); } + + unsigned int totalAccessCount() const { return mObject->TotalAccessCount(); } + + int openChannels() const { return mObject->OpenChannels(); } + +private: + CMemSpyApiKernelObjectItem *mObject; +}; + +class MemSpyThreadInfoItem +{ +public: + MemSpyThreadInfoItem(CMemSpyApiThreadInfoItem *item) + : mItem(item) + {} + + virtual ~MemSpyThreadInfoItem() { delete mItem; } + + QString caption() const { return QString((QChar*) mItem->Caption().Ptr(), mItem->Caption().Length()); } + + QString value() const { return QString((QChar*) mItem->Value().Ptr(), mItem->Value().Length()); } + +private: + CMemSpyApiThreadInfoItem* mItem; +}; + +class MemSpyServer +{ +public: + MemSpyServer(CMemSpyApiServer* server) + : mServer(server) + {} + + virtual ~MemSpyServer() { delete mServer; } + + ProcessId id() const { return mServer->Id(); } + + QString name() const { return QString((QChar*) mServer->Name().Ptr(), mServer->Name().Length()); } + + int sessionCount() const { return mServer->SessionCount(); } + +private: + CMemSpyApiServer *mServer; +}; + +class MemSpyEComCategory +{ +public: + MemSpyEComCategory(CMemSpyApiEComCategory* category) + : mData(category) + {} + + virtual ~MemSpyEComCategory() { delete mData; } + + int id() const { return mData->Id().iUid; } + + QString name() const { return QString((QChar*) mData->Name().Ptr(), mData->Name().Length()); } + + int interfaceCount() const { return mData->InterfaceCount(); } + +private: + CMemSpyApiEComCategory *mData; +}; + +class MemSpyEComInterface +{ +public: + MemSpyEComInterface(CMemSpyApiEComInterface* interface) + : mData(interface) + {} + + virtual ~MemSpyEComInterface() { delete mData; } + + int id() const { return mData->Id().iUid; } + + int categoryId() const { return mData->CategoryId().iUid; } + + QString name() const { return QString((QChar*) mData->Name().Ptr(), mData->Name().Length()); } + + int implementationCount() const { return mData->ImplementationCount(); } + +private: + CMemSpyApiEComInterface *mData; +}; + +class MemSpyEComImplementation +{ +public: + MemSpyEComImplementation(CMemSpyApiEComImplementation* interface) + : mData(interface) + {} + + virtual ~MemSpyEComImplementation() { delete mData; } + + int id() const { return mData->ImplementationUid().iUid; } + + QString name() const { return QString((QChar*) mData->Name().Ptr(), mData->Name().Length()); } + + int version() const { return mData->Version(); } + + QString dataType() const { return QString((QChar*) mData->DataType().Ptr(), mData->DataType().Length()); } + + QString opaqueData() const { return QString((QChar*) mData->OpaqueData().Ptr(), mData->OpaqueData().Length()); } + + QString drive() const { return QString((QChar*) mData->Drive().Name().Ptr(), mData->Drive().Name().Length()); } + + bool romOnly() const { return mData->RomOnly(); } + + bool romBased() const { return mData->RomBased(); } + + int vendorId() const { return mData->VendorId(); } + + bool disabled() const { return mData->Disabled(); } + +private: + CMemSpyApiEComImplementation *mData; +}; + + +class MemSpyDwoProgressTracker : public QObject, public CActive +{ + Q_OBJECT + +public: + MemSpyDwoProgressTracker(RMemSpySession &session); + virtual ~MemSpyDwoProgressTracker(); + +public slots: + + void start(); + + void cancel(); + +protected: // from CActive + + virtual void RunL(); + + virtual void DoCancel(); + + virtual TInt RunError(TInt aError); + +signals: + void progress(int progress, const QString& processName); + +private: + TMemSpyDeviceWideOperationProgress mProgress; + RMemSpySession mSession; +}; + +class MemSpyDwoTracker : public QObject, public CActive +{ + Q_OBJECT + +public: + MemSpyDwoTracker(RMemSpySession &session, DeviceWideOperation operation); + virtual ~MemSpyDwoTracker(); + +public slots: + + void start(); + + void cancel(); + +protected: // from CActive + + virtual void RunL(); + + virtual void DoCancel(); + + virtual TInt RunError(TInt aError); + +signals: + void finished(int errorCode); + void progress(int progress, const QString& processName); + +private: + RMemSpySession mSession; + MemSpyDwoProgressTracker *mProgressTracker; + DeviceWideOperation mOperation; +}; + +class MemSpyAsyncTracker : public QObject, public CActive +{ + Q_OBJECT + +public: + + MemSpyAsyncTracker(RMemSpySession& session, void (RMemSpySession::*function)(TRequestStatus&)); + + void start(); + + virtual void RunL(); + + virtual void DoCancel(); + + virtual TInt RunError(TInt aError); + +signals: + + void finished(int errorCode); + +private: + void (RMemSpySession::*mFunction)(TRequestStatus&); + RMemSpySession& mSession; +}; + +class MemSpySwmtDumpTracker : public MemSpyAsyncTracker +{ +public: + MemSpySwmtDumpTracker(RMemSpySession& session) : + MemSpyAsyncTracker(session, &RMemSpySession::ForceSwmtUpdate) + {} +}; + +class MemSpyKernelHeapDumpTracker : public MemSpyAsyncTracker +{ +public: + MemSpyKernelHeapDumpTracker(RMemSpySession& session) : + MemSpyAsyncTracker(session, &RMemSpySession::OutputKernelHeapData) + {} +}; + +class MemSpySettings : private QSettings +{ +public: + + MemSpySettings(); + + OutputMode outputMode() const; + void setOutputMode(OutputMode mode); + + QString outputPath() const; + void setOutputPath(const QString& path); + + int swmtTimerPeriod() const; + void setSwmtTimerPeriod(int period); + + SwmtMode swmtMode() const; + void setSwmtMode(SwmtMode mode); + + QVariantList swmtCategories() const; + void setSwmtCategories(const QVariantList& categories); + + HeapDumpsMode heapDumpsMode() const; + void setHeapDumpsMode(HeapDumpsMode mode); +}; + +class EngineWrapper : public QObject +{ + Q_OBJECT + +public: + EngineWrapper(); + + virtual ~EngineWrapper(); + + bool initialize(); + + MemSpySettings& settings(); + + const MemSpySettings& settings() const; + + + + QList getProcesses(); + + QList getThreads(ProcessId processId); + + QList getThreadInfo(ThreadId threadId, ThreadInfoType type); + + void setThreadPriority(ThreadId threadId, ThreadPriority priority); + + QList getKernelObjectTypes(); + + QList getKernelObjects(int type); + + QList getServers(); + + QList getEComCategories(); + + QList getEComInterfaces(int categoryId); + + QList getEComImplementations(int interfaceId); + + MemSpyDwoTracker* createDeviceWideOperation(DeviceWideOperation operation); + + MemSpyKernelHeapDumpTracker* createKernelHeapDumpTracker(); + + MemSpySwmtDumpTracker* createSwmtDumpTracker(); + + void setSwmtSettings(SwmtMode mode, const QVariantList& categories); + + bool isSwmtRunning(); + + void startSwmt(int period); + + void stopSwmt(); + + void forceSwmtDump(); + + void outputKernelHeapData(); + + int outputThreadHeapData(const QString& filter); + + void updateOutputSettings(); + + void killProcess(ProcessId process); + + void panicProcess(ProcessId process); + + void terminateProcess(ProcessId process); + +private: + RMemSpySession mSession; + + bool mSwmtRunning; + + MemSpySettings mSettings; +}; + +#endif /* ENGINEWRAPPER_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyecomcategoryview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyecomcategoryview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYECOMCATEGORYVIEW_H_ +#define MEMSPYECOMCATEGORYVIEW_H_ + +#include + +#include "memspylistview.h" +#include "enginewrapper.h" + + +class MemSpyEComCategoryModel : public QAbstractListModel +{ +public: + MemSpyEComCategoryModel(EngineWrapper &engine, QObject *parent = 0); + + ~MemSpyEComCategoryModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + void refresh(); + +private: + EngineWrapper& mEngine; + + QList mData; +}; + +class MemSpyEComCategoryView : public MemSpyListView +{ + + Q_OBJECT + +public: + MemSpyEComCategoryView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyListView(engine, viewManager), + mModel(0) + {} + +public slots: + virtual void refresh(); + +protected: + void initialize(const QVariantMap& params); + +protected: + virtual bool isRefreshable() const { return true; } + +private slots: + void itemClicked(const QModelIndex& index); + +private: + MemSpyEComCategoryModel* mModel; +}; + +#endif /* MEMSPYECOMCATEGORYVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyecomimplementationdetailview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyecomimplementationdetailview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYECOMIMPLEMENTATIONDETAILVIEW_H_ +#define MEMSPYECOMIMPLEMENTATIONDETAILVIEW_H_ + +#include + +#include "memspylistview.h" +#include "enginewrapper.h" + + +class MemSpyEComImplementationDetailModel : public QAbstractListModel +{ +public: + MemSpyEComImplementationDetailModel(MemSpyEComImplementation* implementation, QObject *parent = 0); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +private: + QVariantList mData; +}; + +class MemSpyEComImplementationDetailView : public MemSpyListView +{ + + Q_OBJECT + +public: + MemSpyEComImplementationDetailView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyListView(engine, viewManager), + mModel(0) + {} + +protected: + void initialize(const QVariantMap& params); + +private: + MemSpyEComImplementationDetailModel* mModel; +}; + +#endif /* MEMSPYECOMIMPLEMENTATIONDETAILVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyecomimplementationview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyecomimplementationview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYECOMIMPLEMENTATIONVIEW_H_ +#define MEMSPYECOMIMPLEMENTATIONVIEW_H_ + +#include + +#include "memspylistview.h" +#include "enginewrapper.h" + + +class MemSpyEComImplementationModel : public QAbstractListModel +{ +public: + MemSpyEComImplementationModel(EngineWrapper &engine, int interfaceId, QObject *parent = 0); + + ~MemSpyEComImplementationModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + void refresh(); + +private: + int mInterfaceId; + + EngineWrapper& mEngine; + + QList mData; +}; + +class MemSpyEComImplementationView : public MemSpyListView +{ + + Q_OBJECT + +public: + MemSpyEComImplementationView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyListView(engine, viewManager), + mModel(0) + {} + +public slots: + virtual void refresh(); + +protected: + void initialize(const QVariantMap& params); + +protected: + virtual bool isRefreshable() const { return true; } + +private slots: + void itemClicked(const QModelIndex& index); + +private: + MemSpyEComImplementationModel* mModel; + + int mParentId; + + QString mParentName; +}; + +#endif /* MEMSPYECOMIMPLEMENTATIONVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyecominterfaceview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyecominterfaceview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYECOMINTERFACEVIEW_H_ +#define MEMSPYECOMINTERFACEVIEW_H_ + +#include + +#include "memspylistview.h" +#include "enginewrapper.h" + + +class MemSpyEComInterfaceModel : public QAbstractListModel +{ +public: + MemSpyEComInterfaceModel(EngineWrapper &engine, int categoryId, QObject *parent = 0); + + ~MemSpyEComInterfaceModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + void refresh(); + +private: + int mCategoryId; + + EngineWrapper& mEngine; + + QList mData; +}; + +class MemSpyEComInterfaceView : public MemSpyListView +{ + + Q_OBJECT + +public: + MemSpyEComInterfaceView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyListView(engine, viewManager), + mModel(0) + {} + +public slots: + virtual void refresh(); + +protected: + void initialize(const QVariantMap& params); + +protected: + virtual bool isRefreshable() const { return true; } + +private slots: + void itemClicked(const QModelIndex& index); + +private: + MemSpyEComInterfaceModel* mModel; + + int mParentId; + + QString mParentName; +}; + +#endif /* MEMSPYECOMINTERFACEVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyheapdumpsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyheapdumpsview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYHEAPDUMPSVIEW_H_ +#define MEMSPYHEAPDUMPSVIEW_H_ + +#include "memspyview.h" + +class HbDataFormModel; +class HbDataFormModelItem; + +class MemSpyHeapDumpsView : public MemSpyView +{ + Q_OBJECT + +public: + MemSpyHeapDumpsView(EngineWrapper &engine, ViewManager &viewManager); + virtual ~MemSpyHeapDumpsView(); + + void initialize(const QVariantMap& params); + +protected: + HbToolBar* createToolBar(); + + HbWidget* createCentralWidget(); + +private slots: + void modeChanged(int mode); + void dump(); + + void updateDwoProgress(int progress, const QString& processName); + void asyncOperationFinished(int errorCode); + + +private: + void removeFilterItem(); + void createFilterItem(); + +private: + HbDataFormModel* mModel; + HbDataFormModelItem* mModeItem; + HbDataFormModelItem* mFilterItem; + + HbProgressDialog* mDwoProgressDialog; +}; + +#endif /* MEMSPYHEAPDUMPSVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspykernelobjectdetailview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspykernelobjectdetailview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYKERNELOBJECTDETAILVIEW_H_ +#define MEMSPYKERNELOBJECTDETAILVIEW_H_ + +#include "memspylistview.h" + +class MemSpyKernelObjectDetailModel : public QAbstractListModel +{ +public: + MemSpyKernelObjectDetailModel(const QStringList& details, QObject *parent = 0); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +private: + QStringList mDetails; +}; + +class MemSpyKernelObjectDetailView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyKernelObjectDetailView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyListView(engine, viewManager) {} + +protected: + virtual void initialize(const QVariantMap& params); + + virtual bool isBreadCrumbVisible() const; + + virtual QString getBreadCrumbText() const; + +private: + QString mTypeName; + QString mObjectName; +}; + +#endif /* MEMSPYKERNELOBJECTDETAILVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspykernelobjecttypeview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspykernelobjecttypeview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYKERNELOBJECTTYPESVIEW_H_ +#define MEMSPYKERNELOBJECTTYPESVIEW_H_ + +#include "memspylistview.h" +#include "enginewrapper.h" + +class MemSpyKernelObjectTypeModel : public QAbstractListModel +{ +public: + MemSpyKernelObjectTypeModel(EngineWrapper &engine, QObject *parent = 0); + + virtual ~MemSpyKernelObjectTypeModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +private: + QString formatSize(qint64 size) const; + +private: + QList mObjectTypes; + + QStringList mKernelObjectNames; +}; + +class MemSpyKernelObjectTypeView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyKernelObjectTypeView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyListView(engine, viewManager) {} + +protected: + virtual void initialize(const QVariantMap& params); + +private slots: + void itemClicked(const QModelIndex& index); +}; + +#endif /* MEMSPYKERNELOBJECTTYPESVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspykernelobjectview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspykernelobjectview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYKERNELOBJECTVIEW_H_ +#define MEMSPYKERNELOBJECTVIEW_H_ + +#include "memspylistview.h" +#include "enginewrapper.h" + +class MemSpyKernelObjectModel : public QAbstractListModel +{ +public: + MemSpyKernelObjectModel(EngineWrapper &engine, int objectType, QObject *parent = 0); + + ~MemSpyKernelObjectModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +private: + QList mObjects; +}; + + +class MemSpyKernelObjectView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyKernelObjectView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyListView(engine, viewManager) {} + +protected: + virtual void initialize(const QVariantMap& params); + + virtual bool isBreadCrumbVisible() const; + + virtual QString getBreadCrumbText() const; + +private slots: + void itemClicked(const QModelIndex& index); + +private: + QStringList getDetails(MemSpyKernelObject *object); +}; + +#endif /* MEMSPYKERNELOBJECTVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspylistview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspylistview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYLISTVIEW_H_ +#define MEMSPYLISTVIEW_H_ + +#include + +#include "memspyview.h" + +class MemSpyListView : public MemSpyView + { +public: + MemSpyListView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyView(engine, viewManager) {} + +protected: + virtual HbWidget* createCentralWidget(); + +protected: + HbListView mListView; + }; + +#endif /* MEMSPYLISTVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspymainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspymainview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYMAINVIEW_H_ +#define MEMSPYMAINVIEW_H_ + +#include "memspylistview.h" + +class MemSpyMainView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyMainView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyListView(engine, viewManager) {} +protected: + virtual void initialize(const QVariantMap& params); + virtual bool isBreadCrumbVisible() const; + +public slots: + void itemClicked(const QModelIndex& index); +}; + +#endif /* MEMSPYMAINVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyprocessview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyprocessview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYPROCESSVIEW_H_ +#define MEMSPYPROCESSVIEW_H_ + +#include + +#include "memspylistview.h" +#include "enginewrapper.h" + + +class MemSpyProcessModel : public QAbstractListModel +{ +public: + MemSpyProcessModel(EngineWrapper &engine, QObject *parent = 0); + + ~MemSpyProcessModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + void refresh(); + +private: + EngineWrapper& mEngine; + + QList mProcesses; + + QMap mPriorityMap; +}; + +class MemSpyProcessView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyProcessView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyListView(engine, viewManager), + mModel(0) + {} + +public slots: + virtual void refresh(); + +protected: + void initialize(const QVariantMap& params); + +protected: + virtual bool isRefreshable() const { return true; } + +private slots: + void itemClicked(const QModelIndex& index); + void catchLongPress(HbAbstractViewItem *item, const QPointF &coords); + + void kill(); + void panic(); + void terminate(); + +private: + MemSpyProcessModel* mModel; + + HbMenu* mContextMenu; + HbMenu* mEndMenu; + + ProcessId mProcessId; +}; + +#endif /* MEMSPYPROCESSVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyserverview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyserverview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYSERVERVIEW_H_ +#define MEMSPYSERVERVIEW_H_ + +#include + +#include "memspylistview.h" +#include "enginewrapper.h" + + +class MemSpyServerModel : public QAbstractListModel +{ +public: + MemSpyServerModel(EngineWrapper &engine, QObject *parent = 0); + + ~MemSpyServerModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + void refresh(); + +private: + EngineWrapper& mEngine; + + QList mServers; +}; + +class MemSpyServerView : public MemSpyListView +{ + + Q_OBJECT + +public: + MemSpyServerView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyListView(engine, viewManager), + mModel(0) + {} + +public slots: + virtual void refresh(); + +protected: + void initialize(const QVariantMap& params); + +protected: + virtual bool isRefreshable() const { return true; } + +private slots: + void itemClicked(const QModelIndex& index); + +private: + MemSpyServerModel* mModel; +}; + +#endif /* MEMSPYSERVERVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspysettingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspysettingsview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYSETTINGSVIEW_H_ +#define MEMSPYSETTINGSVIEW_H_ + +#include + +class HbDataForm; +class HbDataFormModel; +class HbDataFormModelItem; +class EngineWrapper; + +class MemSpySettingsView : public HbView +{ + Q_OBJECT + +public: + MemSpySettingsView(EngineWrapper &engine); + virtual ~MemSpySettingsView(); + + void initialize(const QVariantMap& params); + +private slots: + void updateModel(); + void accept(); + void reject(); + +signals: + void finished(bool ok); + +private: + HbDataForm* mForm; + HbDataFormModel* mModel; + HbDataFormModelItem* mModeItem; + HbDataFormModelItem* mPathItem; + HbDataFormModelItem* mCustomPathItem; + + EngineWrapper& mEngine; +}; + +#endif /* MEMSPYSETTINGSVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyswmtview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyswmtview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYSWMTVIEW_H_ +#define MEMSPYSWMTVIEW_H_ + +#include "memspyview.h" + +class HbDataFormModel; +class HbDataFormModelItem; +class HbProgressDialog; + +class MemSpySwmtView : public MemSpyView +{ + Q_OBJECT + +public: + MemSpySwmtView(EngineWrapper &engine, ViewManager &viewManager); + virtual ~MemSpySwmtView(); + + void initialize(const QVariantMap& params); + +protected: + HbToolBar* createToolBar(); + + HbWidget* createCentralWidget(); + +private slots: + void toggleTimer(); + void forceDump(); + void modeChanged(int mode); + void asyncOperationFinished(int errorCode); + +private: + void updateTimerAction(bool isRunning); + void removeCategoriesItem(); + void createCategoriesItem(); + void updateSettings(); + +private: + HbAction* mToggleTimerAction; + + HbDataFormModel* mModel; + HbDataFormModelItem* mTimerItem; + HbDataFormModelItem* mModeItem; + HbDataFormModelItem* mCategoriesItem; + + HbProgressDialog* mProgressDialog; +}; + +#endif /* MEMSPYSWMTVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspythreaddetailindexview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspythreaddetailindexview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYTHREADDETAILINDEXVIEW_H_ +#define MEMSPYTHREADDETAILINDEXVIEW_H_ + +#include "memspylistview.h" +#include "enginewrapper.h" + +class HbMenu; + +class MemSpyThreadDetailIndexView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyThreadDetailIndexView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyListView(engine, viewManager) {} +protected: + virtual void initialize(const QVariantMap& params); + + virtual HbMenu* createToolMenu(); + + virtual bool isBreadCrumbVisible() const; + + virtual QString getBreadCrumbText() const; + +private slots: + void changePriority(); + void itemClicked(const QModelIndex& index); + +private: + ThreadId mThreadId; + HbMenu *mPriorityMenu; + QString mProcessName; + QString mThreadName; +}; + +#endif /* MEMSPYTHREADDETAILINDEXVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspythreaddetailview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspythreaddetailview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYTHREADDETAILVIEW_H_ +#define MEMSPYTHREADDETAILVIEW_H_ + +#include "memspylistview.h" +#include "enginewrapper.h" + +class HbMenu; + +class MemSpyThreadDetailModel : public QAbstractListModel +{ +public: + MemSpyThreadDetailModel(EngineWrapper &engine, ThreadId threadId, ThreadInfoType type, QObject *parent = 0); + + ~MemSpyThreadDetailModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + +private: + QList mThreadInfo; +}; + + +class MemSpyThreadDetailView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyThreadDetailView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyListView(engine, viewManager) {} +protected: + virtual void initialize(const QVariantMap& params); + + virtual bool isBreadCrumbVisible() const; + + virtual QString getBreadCrumbText() const; + +private: + ThreadId mThreadId; + HbMenu *mPriorityMenu; + QString mProcessName; + QString mThreadName; +}; + +#endif /* MEMSPYTHREADDETAILVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspythreadview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspythreadview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYTHREADVIEW_H_ +#define MEMSPYTHREADVIEW_H_ + +#include "memspylistview.h" +#include "enginewrapper.h" + +class MemSpyThreadModel : public QAbstractListModel +{ +public: + MemSpyThreadModel(EngineWrapper &engine, ProcessId threadId, QObject *parent = 0); + + ~MemSpyThreadModel(); + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + void refresh(); + +private: + ProcessId mProcessId; + + EngineWrapper& mEngine; + + QList mThreads; + + QMap mPriorityMap; +}; + + +class MemSpyThreadView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyThreadView(EngineWrapper &engine, ViewManager &viewManager); + ~MemSpyThreadView(); + +public slots: + virtual void refresh(); + +protected: + void initialize(const QVariantMap& params); + +protected: + virtual bool isRefreshable() const { return true; } + + virtual bool isBreadCrumbVisible() const; + + QString getBreadCrumbText() const; + + HbMenu* createToolMenu(); + +private slots: + void itemClicked(const QModelIndex& index); + void catchLongPress(HbAbstractViewItem *item, const QPointF &coords); + void changePriority(); + + void kill(); + void panic(); + void terminate(); + +private: + HbMenu* mContextMenu; + HbMenu* mPriorityMenu; + ProcessId mProcessId; + ThreadId mThreadId; + QString mProcessName; + + MemSpyThreadModel* mModel; +}; + +#endif /* MEMSPYTHREADVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspytrackingview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspytrackingview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef MEMSPYTRACKINGVIEW_H_ +#define MEMSPYTRACKINGVIEW_H_ + +#include "memspylistview.h" + +class MemSpyTrackingView : public MemSpyListView +{ + Q_OBJECT + +public: + MemSpyTrackingView(EngineWrapper &engine, ViewManager &viewManager) + : MemSpyListView(engine, viewManager) {} +protected: + virtual void initialize(const QVariantMap& params); + virtual bool isBreadCrumbVisible() const; + +public slots: + void itemClicked(const QModelIndex& index); +}; + +#endif /* MEMSPYTRACKINGVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/memspyview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/memspyview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMSPYVIEW_H_ +#define MEMSPYVIEW_H_ + +#include +#include +#include + +class HbLabel; +class HbProgressDialog; +class EngineWrapper; +class ViewManager; + + +class MemSpyView : public HbView +{ + Q_OBJECT + +public: + MemSpyView(EngineWrapper &engine, ViewManager &viewManager); + + virtual ~MemSpyView(); + +protected: + + virtual QList createOutputActions(); + + virtual HbMenu* createToolMenu(); + + virtual HbToolBar* createToolBar(); + + virtual bool isRefreshable() const; + + virtual bool isBreadCrumbVisible() const; + + virtual QString getBreadCrumbText() const; + + virtual HbWidget* createCentralWidget() = 0; + +public slots: + + virtual void initialize(const QVariantMap& params); + + virtual void refresh(); + + void showSettings(); + + void showAbout(); + +private slots: + + void closeSettings(); + +protected: + + EngineWrapper &mEngine; + + ViewManager &mViewManager; + + +private: + HbMenu* mOutputMenu; + HbMenu* mOutputGenInfoMenu; + HbMenu* mOutputHeapInfoMenu; + HbMenu* mOutputStackInfoMenu; + HbToolBar* mToolBar; + + HbLabel* mBreadCrumb; +}; + +#endif /* MEMSPYVIEW_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/inc/viewmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/inc/viewmanager.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef VIEWMANAGER_H_ +#define VIEWMANAGER_H_ + + +#include +#include + +enum ViewIndex { + MainView, + ProcessView, + ThreadView, + ThreadDetailIndexView, + ThreadDetailView, + KernelObjectTypeView, + KernelObjectView, + KernelObjectDetailView, + TrackingView, + SwmtView, + HeapDumpsView, + ServerView, + EComCategoryView, + EComInterfaceView, + EComImplementationView, + EComImplementationDetailView, +}; + +class HbMainWindow; +class HbView; +class EngineWrapper; + + +class ViewManager : public QObject +{ + Q_OBJECT + +public: + ViewManager(HbMainWindow &window, EngineWrapper &engine, QObject *parent = 0); + +public slots: + void showView(ViewIndex index, const QVariantMap ¶ms); + + void showView(ViewIndex index); + + void goBack(); + +private slots: + void viewChanged(HbView *view); + +private: + HbMainWindow &mWindow; + EngineWrapper &mEngine; +}; + +#endif /* VIEWMANAGER_H_ */ diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/enginewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/enginewrapper.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,578 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include + +#include "enginewrapper.h" + +// CONSTANTS + +const QString OUTPUT_MODE = "output/mode"; +const QString OUTPUT_PATH = "output/path"; +const QString SWMT_PERIOD = "swmt/period"; +const QString SWMT_MODE = "swmt/mode"; +const QString SWMT_CATEGORIES = "swmt/categories"; +const QString HEAP_DUMPS_MODE = "heapdumps/mode"; + +QString MemSpyProcess::exitInfo() const +{ + QChar exitType[] = {'K', 'T', 'P', 'R'}; + QString result = QString("[%1]").arg(exitType[mProcess->ExitType()]); + + if (mProcess->ExitType() != EExitKill && mProcess->ExitType() != EExitPending) { + + QString exitCategory = QString((QChar*) mProcess->ExitCategory().Ptr(), mProcess->ExitCategory().Length()); + result.append(QString(" %1-%2").arg(exitCategory).arg(mProcess->ExitReason())); + } + + return result; +} + + +MemSpyDwoProgressTracker::MemSpyDwoProgressTracker(RMemSpySession &session) : + CActive(EPriorityStandard), mSession(session) +{ + CActiveScheduler::Add(this); +} + +MemSpyDwoProgressTracker::~MemSpyDwoProgressTracker() +{ + Cancel(); +} + +void MemSpyDwoProgressTracker::start() +{ + mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus); + + SetActive(); +} + +void MemSpyDwoProgressTracker::cancel() +{ + Cancel(); +} + +// Event handler method. + +void MemSpyDwoProgressTracker::RunL() + { + + // If an error occurred handle it in RunError(). + User::LeaveIfError(iStatus.Int()); + + // Resubmit the request immediately + + mSession.NotifyDeviceWideOperationProgress(mProgress, iStatus); + + SetActive(); + + emit progress(mProgress.Progress(), QString((QChar*) mProgress.Description().Ptr(), mProgress.Description().Length())); + } + +void MemSpyDwoProgressTracker::DoCancel() +{ + // this is not yet implemented, as it is not required in current use cases +} + +TInt MemSpyDwoProgressTracker::RunError(TInt aError) +{ + // KErrNotReady and KErrCancel errors are OK, they just notify + // us about the outstanding notification request that won't be + // processed. + Q_UNUSED(aError); + + return KErrNone; +} + +MemSpyDwoTracker::MemSpyDwoTracker(RMemSpySession &session, DeviceWideOperation operation) : + CActive(EPriorityStandard), + mSession(session), + mProgressTracker(new MemSpyDwoProgressTracker(session)), + mOperation(operation) +{ + CActiveScheduler::Add(this); + connect(mProgressTracker, SIGNAL(progress(int,QString)), this, SIGNAL(progress(int,QString))); +} + +MemSpyDwoTracker::~MemSpyDwoTracker() +{ + Cancel(); + + delete mProgressTracker; +} + +void MemSpyDwoTracker::start() +{ + void (RMemSpySession::*functions[])(TRequestStatus&) = { + &RMemSpySession::OutputPhoneInfo, + &RMemSpySession::OutputDetailedPhoneInfo, + &RMemSpySession::OutputHeapInfo, + &RMemSpySession::OutputCompactHeapInfo, + &RMemSpySession::OutputHeapCellListing, + &RMemSpySession::OutputHeapData, + &RMemSpySession::OutputStackInfo, + &RMemSpySession::OutputCompactStackInfo, + &RMemSpySession::OutputUserStackData, + &RMemSpySession::OutputKernelStackData }; + + (mSession.*functions[mOperation])(iStatus); + + mProgressTracker->start(); + + SetActive(); +} + +void MemSpyDwoTracker::cancel() +{ + Cancel(); +} + +// Event handler method. + +void MemSpyDwoTracker::RunL() + { + + // If an error occurred handle it in RunError(). + User::LeaveIfError(iStatus.Int()); + + // Operation has finished successfully + emit finished(0); + } + +void MemSpyDwoTracker::DoCancel() +{ + // Cancel progress tracker + mProgressTracker->cancel(); + + mSession.CancelDeviceWideOperationL(); +} + +TInt MemSpyDwoTracker::RunError(TInt aError) +{ + // Emit the finished signal to notify user + // operation was canceled + emit finished(aError); + + return KErrNone; +} + +MemSpyAsyncTracker::MemSpyAsyncTracker(RMemSpySession& session, void (RMemSpySession::*function)(TRequestStatus&)) : + CActive(EPriorityStandard), + mFunction(function), + mSession(session) +{ + CActiveScheduler::Add(this); +} + +void MemSpyAsyncTracker::RunL() +{ + // If an error occurred handle it in RunError(). + User::LeaveIfError(iStatus.Int()); + + // Operation has finished successfully + emit finished(0); +} + +void MemSpyAsyncTracker::DoCancel() +{ + // nothing to do here +} + +TInt MemSpyAsyncTracker::RunError(TInt aError) +{ + // Emit the finished signal to notify user + // that operation was canceled + emit finished(aError); + + return KErrNone; +} + +void MemSpyAsyncTracker::start() +{ + (mSession.*mFunction)(iStatus); + + SetActive(); +} + +MemSpySettings::MemSpySettings() : + QSettings("Nokia", "MemSpy") +{ +} + +OutputMode MemSpySettings::outputMode() const +{ + return static_cast(value(OUTPUT_MODE, 0).toInt()); +} + +void MemSpySettings::setOutputMode(OutputMode mode) +{ + setValue(OUTPUT_MODE, mode); +} + +QString MemSpySettings::outputPath() const +{ + return value(OUTPUT_PATH).toString(); +} + +void MemSpySettings::setOutputPath(const QString& path) +{ + setValue(OUTPUT_PATH, path); +} + +int MemSpySettings::swmtTimerPeriod() const +{ + return value(SWMT_PERIOD, 30).toInt(); +} + +void MemSpySettings::setSwmtMode(SwmtMode mode) +{ + setValue(SWMT_MODE, mode); +} + +SwmtMode MemSpySettings::swmtMode() const +{ + return static_cast(value(SWMT_MODE, 0).toInt()); +} + +void MemSpySettings::setSwmtTimerPeriod(int period) +{ + setValue(SWMT_PERIOD, period); +} + + +QVariantList MemSpySettings::swmtCategories() const +{ + return value(SWMT_CATEGORIES).toList(); +} + +void MemSpySettings::setSwmtCategories(const QVariantList& categories) +{ + setValue(SWMT_CATEGORIES, categories); +} + +HeapDumpsMode MemSpySettings::heapDumpsMode() const +{ + return static_cast(value(HEAP_DUMPS_MODE).toInt()); +} + +void MemSpySettings::setHeapDumpsMode(HeapDumpsMode mode) +{ + setValue(HEAP_DUMPS_MODE, mode); +} + + +EngineWrapper::EngineWrapper() : + mSwmtRunning(false) +{ +} + +EngineWrapper::~EngineWrapper() +{ + mSession.Close(); +} + +bool EngineWrapper::initialize() +{ + return mSession.Connect() == KErrNone; +} + +MemSpySettings& EngineWrapper::settings() +{ + return mSettings; +} + +const MemSpySettings& EngineWrapper::settings() const +{ + return mSettings; +} + + + +QList EngineWrapper::getProcesses() +{ + QList result; + + RArray proc; + + QT_TRAP_THROWING(mSession.GetProcessesL(proc)); + + for (TInt i=0; i EngineWrapper::getThreads(ProcessId processId) +{ + QList result; + + RArray proc; + + QT_TRAP_THROWING(mSession.GetThreadsL(processId, proc)); + + for (TInt i=0; i EngineWrapper::getThreadInfo(ThreadId threadId, ThreadInfoType type) +{ + QList result; + RArray threadInfo; + qt_symbian_throwIfError(mSession.GetThreadInfoItems(threadInfo, threadId, + static_cast(type))); + + for (TInt i=0; i EngineWrapper::getKernelObjectTypes() +{ + QList result; + + RArray types; + qt_symbian_throwIfError(mSession.GetKernelObjects(types)); + + for(TInt i=0; i EngineWrapper::getKernelObjects(int type) +{ + QList result; + + RArray objects; + qt_symbian_throwIfError(mSession.GetKernelObjectItems(objects, + static_cast(type))); + + for (TInt i=0; i EngineWrapper::getServers() +{ + QList result; + + RArray proc; + + QT_TRAP_THROWING(mSession.GetServersL(proc)); + + for (TInt i=0; i EngineWrapper::getEComCategories() +{ + QList result; + + RArray cat; + + QT_TRAP_THROWING(mSession.GetEComCategoriesL(cat)); + + for (TInt i=0; i EngineWrapper::getEComInterfaces(int categoryId) +{ + QList result; + + RArray interfaces; + + QT_TRAP_THROWING(mSession.GetEComInterfacesL(TUid::Uid(categoryId), interfaces)); + + for (TInt i=0; i EngineWrapper::getEComImplementations(int interfaceId) +{ + QList result; + + RArray implementations; + + QT_TRAP_THROWING(mSession.GetEComImplementationsL(TUid::Uid(interfaceId), implementations)); + + for (TInt i=0; i(filter.utf16()), filter.length()); + + TRAPD(err, mSession.OutputThreadHeapDataL(customFilterDesc)); + + return err; +} + +void EngineWrapper::updateOutputSettings() +{ + switch (mSettings.outputMode()) { + case OutputModeTrace: + TRAP_IGNORE(mSession.SwitchOutputToTraceL()); + break; + + case OutputModeFile: + + if (mSettings.outputPath().isEmpty()) { + TRAP_IGNORE(mSession.SwitchOutputToFileL(KNullDesC)); + + } else { + + QString root = mSettings.outputPath(); + TPtrC rootDesc (static_cast(root.utf16()), root.length()); + + TRAP_IGNORE(mSession.SwitchOutputToFileL(rootDesc)); + } + + } +} + +void EngineWrapper::killProcess(ProcessId process) +{ + TRAP_IGNORE(mSession.EndProcessL(process, EKill)); +} + +void EngineWrapper::panicProcess(ProcessId process) +{ + TRAP_IGNORE(mSession.EndProcessL(process, EPanic)); +} + +void EngineWrapper::terminateProcess(ProcessId process) +{ + TRAP_IGNORE(mSession.EndProcessL(process, ETerminate)); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/main.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include + +#include "enginewrapper.h" +#include "memspyview.h" +#include "memspyprocessview.h" +#include "viewmanager.h" + +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + + EngineWrapper engine; + if (!engine.initialize()) { + QMessageBox::critical(0, "Error", "Engine failed to initialize. Closing."); + return 1; + } + + HbMainWindow window; + ViewManager viewManager(window, engine); + viewManager.showView(MainView); + + window.show(); + return app.exec(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyecomcategoryview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyecomcategoryview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspyecomcategoryview.h" +#include "viewmanager.h" + +MemSpyEComCategoryModel::MemSpyEComCategoryModel(EngineWrapper &engine, QObject *parent) : + QAbstractListModel(parent), + mEngine(engine), + mData(engine.getEComCategories()) +{ +} + +MemSpyEComCategoryModel::~MemSpyEComCategoryModel() +{ + qDeleteAll(mData); +} + +int MemSpyEComCategoryModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mData.count(); +} + +QVariant MemSpyEComCategoryModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + const MemSpyEComCategory* cat = mData.at(index.row()); + + QStringList lines; + lines << cat->name(); + lines << QString("%1 interface(s)").arg(cat->interfaceCount()); + + return lines; + } + + if (role == Qt::UserRole) + return mData.at(index.row())->id(); + + return QVariant(); +} + +void MemSpyEComCategoryModel::refresh() +{ + beginResetModel(); + QList data = mEngine.getEComCategories(); + qDeleteAll(mData); + mData = data; + endResetModel(); +} + + +void MemSpyEComCategoryView::initialize(const QVariantMap& params) +{ + setTitle(tr("ECom Categories")); + MemSpyView::initialize(params); + + mModel = new MemSpyEComCategoryModel(mEngine, this); + mListView.setModel(mModel); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +void MemSpyEComCategoryView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map.insert("pid", index.data(Qt::UserRole)); + map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0)); + mViewManager.showView(EComInterfaceView, map); +} + +void MemSpyEComCategoryView::refresh() +{ + mModel->refresh(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyecomimplementationdetailview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyecomimplementationdetailview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspyecomimplementationdetailview.h" +#include "viewmanager.h" + +MemSpyEComImplementationDetailModel::MemSpyEComImplementationDetailModel(MemSpyEComImplementation* impl, QObject *parent) : + QAbstractListModel(parent) +{ + mData << (QStringList() << tr("Impl. Uid") << QString("0x%1").arg(impl->id(), 0, 16)); + mData << (QStringList() << tr("Display Name") << impl->name()); + mData << (QStringList() << tr("Opaque Data") << impl->opaqueData()); + mData << (QStringList() << tr("Data Type") << impl->dataType()); + mData << (QStringList() << tr("Drive") << impl->drive()); + mData << (QStringList() << tr("Is Disabled") << (impl->disabled() ? tr("Yes") : tr("No"))); + mData << (QStringList() << tr("ROM-Only") << (impl->romOnly() ? tr("Yes") : tr("No"))); + mData << (QStringList() << tr("ROM-Based") << (impl->romBased() ? tr("Yes") : tr("No"))); +} + +int MemSpyEComImplementationDetailModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mData.count(); +} + +QVariant MemSpyEComImplementationDetailModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) + return mData.at(index.row()); + + return QVariant(); +} + +void MemSpyEComImplementationDetailView::initialize(const QVariantMap& params) +{ + setTitle(tr("ECom Implementation Detail")); + MemSpyView::initialize(params); + + MemSpyEComImplementation* implementation = static_cast( + qVariantValue(params["implementation"])); + + mModel = new MemSpyEComImplementationDetailModel(implementation); + mListView.setModel(mModel); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyecomimplementationview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyecomimplementationview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspyecomimplementationview.h" +#include "viewmanager.h" + +MemSpyEComImplementationModel::MemSpyEComImplementationModel(EngineWrapper &engine, int interfaceId, QObject *parent) : + QAbstractListModel(parent), + mInterfaceId(interfaceId), + mEngine(engine), + mData(engine.getEComImplementations(interfaceId)) +{ +} + +MemSpyEComImplementationModel::~MemSpyEComImplementationModel() +{ + qDeleteAll(mData); +} + +int MemSpyEComImplementationModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mData.count(); +} + +QVariant MemSpyEComImplementationModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + const MemSpyEComImplementation* impl = mData.at(index.row()); + + QStringList lines; + lines << QString("0x%1").arg(impl->id(), 0, 16); + lines << impl->name(); + + return lines; + } + + if (role == Qt::UserRole) + return qVariantFromValue(mData.at(index.row())); + + return QVariant(); +} + +void MemSpyEComImplementationModel::refresh() +{ + beginResetModel(); + QList data = mEngine.getEComImplementations(mInterfaceId); + qDeleteAll(mData); + mData = data; + endResetModel(); +} + + +void MemSpyEComImplementationView::initialize(const QVariantMap& params) +{ + setTitle(tr("ECom Implementations")); + + mParentId = params["pid"].toInt(); + mParentName = params["pname"].toString(); + + MemSpyView::initialize(params); + + mModel = new MemSpyEComImplementationModel(mEngine, mParentId, this); + mListView.setModel(mModel); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +void MemSpyEComImplementationView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map.insert("implementation", index.data(Qt::UserRole)); + mViewManager.showView(EComImplementationDetailView, map); +} + +void MemSpyEComImplementationView::refresh() +{ + mModel->refresh(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyecominterfaceview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyecominterfaceview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspyecominterfaceview.h" +#include "viewmanager.h" + +MemSpyEComInterfaceModel::MemSpyEComInterfaceModel(EngineWrapper &engine, int categoryId, QObject *parent) : + QAbstractListModel(parent), + mCategoryId(categoryId), + mEngine(engine), + mData(engine.getEComInterfaces(categoryId)) +{ +} + +MemSpyEComInterfaceModel::~MemSpyEComInterfaceModel() +{ + qDeleteAll(mData); +} + +int MemSpyEComInterfaceModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mData.count(); +} + +QVariant MemSpyEComInterfaceModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + const MemSpyEComInterface* interface = mData.at(index.row()); + + QStringList lines; + lines << interface->name(); + lines << QString("%1 implementation(s)").arg(interface->implementationCount()); + + return lines; + } + + if (role == Qt::UserRole) + return mData.at(index.row())->id(); + + return QVariant(); +} + +void MemSpyEComInterfaceModel::refresh() +{ + beginResetModel(); + QList data = mEngine.getEComInterfaces(mCategoryId); + qDeleteAll(mData); + mData = data; + endResetModel(); +} + + +void MemSpyEComInterfaceView::initialize(const QVariantMap& params) +{ + setTitle(tr("ECom Interfaces")); + + mParentId = params["pid"].toInt(); + mParentName = params["pname"].toString(); + + MemSpyView::initialize(params); + + mModel = new MemSpyEComInterfaceModel(mEngine, mParentId, this); + mListView.setModel(mModel); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +void MemSpyEComInterfaceView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map.insert("pid", index.data(Qt::UserRole)); + map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0)); + mViewManager.showView(EComImplementationView, map); +} + +void MemSpyEComInterfaceView::refresh() +{ + mModel->refresh(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyheapdumpsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyheapdumpsview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "memspyheapdumpsview.h" +#include "enginewrapper.h" + +const QStringList MODE_ITEMS = QStringList() << + MemSpyHeapDumpsView::tr("Kernel") << + MemSpyHeapDumpsView::tr("User") << + MemSpyHeapDumpsView::tr("Both"); + +MemSpyHeapDumpsView::MemSpyHeapDumpsView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyView(engine, viewManager), + mModel(0), + mModeItem(0), + mFilterItem(0), + mDwoProgressDialog(0) +{ +} + +MemSpyHeapDumpsView::~MemSpyHeapDumpsView() +{ + delete mDwoProgressDialog; +} + +void MemSpyHeapDumpsView::initialize(const QVariantMap& params) +{ + setTitle(tr("Heap Dumps")); + + MemSpyView::initialize(params); +} + +HbToolBar* MemSpyHeapDumpsView::createToolBar() +{ + HbToolBar* toolBar = new HbToolBar(); + toolBar->addAction(tr("Dump Now"), this, SLOT(dump())); + return toolBar; +} + +HbWidget* MemSpyHeapDumpsView::createCentralWidget() +{ + mModel = new HbDataFormModel(this); + + //TODO: uncomment after kernel heap dumps are implemented +// mModeItem = mModel->appendDataFormItem( +// HbDataFormModelItem::ComboBoxItem, tr("Heap Dump")); +// mModeItem->setContentWidgetData("items", MODE_ITEMS); +// mModeItem->setContentWidgetData("currentIndex", mEngine.settings().heapDumpsMode()); +// modeChanged(mEngine.settings().heapDumpsMode()); + + //TODO: remove after kernel heap dumps are implemented + createFilterItem(); + + HbDataForm* form = new HbDataForm(this); + form->setModel(mModel); + + //TODO: uncomment after kernel heap dumps are implemented +// form->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged(int))); + + return form; +} + +void MemSpyHeapDumpsView::modeChanged(int mode) +{ + if (mode == HeapDumpsModeKernel && mFilterItem) + removeFilterItem(); + else if (mode != HeapDumpsModeKernel && !mFilterItem) + createFilterItem(); +} + +void MemSpyHeapDumpsView::createFilterItem() +{ + mFilterItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, tr("Filter")); +} + +void MemSpyHeapDumpsView::removeFilterItem() +{ + mModel->removeItem(mFilterItem); + mFilterItem = 0; +} + +void MemSpyHeapDumpsView::dump() +{ + mEngine.updateOutputSettings(); + + HeapDumpsMode mode = HeapDumpsModeUser; + //TODO: uncomment after kernel heap dumps are implemented + //static_cast(mModeItem->contentWidgetData("currentIndex").toInt()); + + // save settings + //TODO: uncomment after kernel heap dumps are implemented + //mEngine.settings().setHeapDumpsMode(mode); + + if (mode == HeapDumpsModeKernel || mode == HeapDumpsModeBoth) { + // dump kernel heap + mDwoProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog); + mDwoProgressDialog->setText(tr("Please wait...")); + mDwoProgressDialog->show(); + + MemSpyKernelHeapDumpTracker* tracker = mEngine.createKernelHeapDumpTracker(); + connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int))); + tracker->start(); + } + + if (mode == HeapDumpsModeUser || mode == HeapDumpsModeBoth) { + // dump user heap + + QString filter = mFilterItem->contentWidgetData("text").toString(); + if (!filter.isEmpty()) { + + int errorCode = mEngine.outputThreadHeapData(filter); + if (errorCode == KErrNotFound) { + HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); + messageBox->setText(tr("No thread matches your filter")); + HbLabel *header = new HbLabel(tr("No such thread"), messageBox); + messageBox->setHeadingWidget(header); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setTimeout(HbPopup::StandardTimeout); + messageBox->open(); + } + + + } else { + mDwoProgressDialog = new HbProgressDialog(HbProgressDialog::ProgressDialog); + mDwoProgressDialog->setMinimum(0); + mDwoProgressDialog->setMaximum(100); + mDwoProgressDialog->show(); + + MemSpyDwoTracker* tracker = mEngine.createDeviceWideOperation(OutputHeapData); + connect(tracker, SIGNAL(progress(int,QString)), this, SLOT(updateDwoProgress(int,QString))); + connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int))); + connect(mDwoProgressDialog, SIGNAL(cancelled()), tracker, SLOT(cancel())); + tracker->start(); + } + } +} + +void MemSpyHeapDumpsView::updateDwoProgress(int progress, const QString& processName) +{ + mDwoProgressDialog->setText(processName); + mDwoProgressDialog->setProgressValue(progress); +} + +void MemSpyHeapDumpsView::asyncOperationFinished(int errorCode) +{ + mDwoProgressDialog->hide(); + delete mDwoProgressDialog; + mDwoProgressDialog = 0; + + delete sender(); + + if (errorCode != KErrNone && errorCode != KErrCancel) { + HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning); + messageBox->setText(tr("An error occured during the operation. Error code: %1").arg(errorCode)); + HbLabel *header = new HbLabel(tr("Error"), messageBox); + messageBox->setHeadingWidget(header); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setTimeout(HbPopup::StandardTimeout); + messageBox->open(); + } +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspykernelobjectdetailview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspykernelobjectdetailview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include + +#include "memspykernelobjectdetailview.h" + +MemSpyKernelObjectDetailModel::MemSpyKernelObjectDetailModel(const QStringList& details, QObject *parent) : + QAbstractListModel(parent), + mDetails(details) +{ + +} + +int MemSpyKernelObjectDetailModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mDetails.count(); +} + +QVariant MemSpyKernelObjectDetailModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + + // convert from semicolon delimited line to two lines + return mDetails.at(index.row()).split(": "); + } + + return QVariant(); +} + + +void MemSpyKernelObjectDetailView::initialize(const QVariantMap& params) +{ + setTitle("Details"); + + mTypeName = params["typeName"].toString(); + mObjectName = params["objectName"].toString(); + MemSpyView::initialize(params); + + QStringList items = params.value("details").toStringList(); + mListView.setModel(new MemSpyKernelObjectDetailModel(items, this)); +} + +bool MemSpyKernelObjectDetailView::isBreadCrumbVisible() const +{ + return true; +} + +QString MemSpyKernelObjectDetailView::getBreadCrumbText() const +{ + return tr("Kernel Objects > %1 > %2").arg(mTypeName).arg(mObjectName); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspykernelobjecttypeview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include + +#include "memspykernelobjecttypeview.h" +#include "viewmanager.h" + +MemSpyKernelObjectTypeModel::MemSpyKernelObjectTypeModel(EngineWrapper &engine, QObject *parent) : + QAbstractListModel(parent), + mObjectTypes(engine.getKernelObjectTypes()) +{ + mKernelObjectNames << "Threads" << "Processes" << "Chunks" << "Libraries" << + "Semaphores" << "Mutexes" << "Timers" << "Servers" << "Sessions" << "Logical Devices" << + "Physical Devices" << "Logical Channels" << "Change Notifiers" << "Undertakers" << + "Message Queues" << "Property Refs." << "Conditional Vars."; +} + +MemSpyKernelObjectTypeModel::~MemSpyKernelObjectTypeModel() +{ + qDeleteAll(mObjectTypes); +} + +int MemSpyKernelObjectTypeModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mObjectTypes.count(); +} + +QVariant MemSpyKernelObjectTypeModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + QStringList lines; + lines << mKernelObjectNames.at(index.row()); + lines << QString("%1, %2"). + arg(tr("%n item(s)", "", mObjectTypes.at(index.row())->count())). + arg(formatSize(mObjectTypes.at(index.row())->size())); + + return lines; + } + + if (role == Qt::UserRole) + return mObjectTypes.at(index.row())->id(); + + return QVariant(); +} + +QString MemSpyKernelObjectTypeModel::formatSize(qint64 size) const +{ + // If < 1000K + if (size < 1024000) + return QString("%1K").arg(size ? qBound(1, (size + 512) >> 10, 999) : 0); + + // larger than 1M + double sizeInM = size / 1048576.; + return sizeInM >= 1000 ? + QString("%1G").arg(qMax(1, sizeInM / 1024), 0, 'f', 1) : + QString("%1M").arg(qBound(1, sizeInM, 999.9), 0, 'f', 1); +} + +void MemSpyKernelObjectTypeView::initialize(const QVariantMap& params) +{ + setTitle(tr("Kernel Objects")); + + MemSpyView::initialize(params); + + mListView.setModel(new MemSpyKernelObjectTypeModel(mEngine, this)); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +void MemSpyKernelObjectTypeView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map.insert("type", index.row()); + mViewManager.showView(KernelObjectView, map); +} + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspykernelobjectview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspykernelobjectview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include + +#include "memspykernelobjectview.h" +#include "viewmanager.h" + +MemSpyKernelObjectModel::MemSpyKernelObjectModel(EngineWrapper &engine, int objectType, QObject *parent) : + QAbstractListModel(parent), + mObjects(engine.getKernelObjects(objectType)) +{ +} + +MemSpyKernelObjectModel::~MemSpyKernelObjectModel() +{ + qDeleteAll(mObjects); +} + +int MemSpyKernelObjectModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mObjects.count(); +} + +QVariant MemSpyKernelObjectModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + QStringList lines; + lines << mObjects.at(index.row())->name(); + + return lines; + } + + if (role == Qt::UserRole) { + return qVariantFromValue(mObjects.at(index.row())); + } + + return QVariant(); +} + +void MemSpyKernelObjectView::initialize(const QVariantMap& params) +{ + QStringList list = QStringList() << "Threads" << "Processes" << "Chunks" << "Libraries" << + "Semaphores" << "Mutexes" << "Timers" << "Servers" << "Sessions" << "Logical Devices" << + "Physical Devices" << "Logical Channels" << "Change Notifiers" << "Undertakers" << + "Message Queues" << "Property Refs." << "Conditional Vars."; + + int type = params.value("type").toInt(); + + setTitle(list.at(type)); + + MemSpyView::initialize(params); + + //mListView.setModel(new MemSpyKernelObjectTypeModel(mEngine, this)); + mListView.setModel(new MemSpyKernelObjectModel(mEngine, type, this)); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +bool MemSpyKernelObjectView::isBreadCrumbVisible() const +{ + return true; +} + +QString MemSpyKernelObjectView::getBreadCrumbText() const +{ + return tr("Kernel Objects"); +} + + +void MemSpyKernelObjectView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map.insert("details", getDetails(static_cast(qVariantValue(index.data(Qt::UserRole))))); + map.insert("typeName", title()); + map.insert("objectName", static_cast(qVariantValue(index.data(Qt::UserRole)))->nameDetail()); + mViewManager.showView(KernelObjectDetailView, map); +} + +QStringList MemSpyKernelObjectView::getDetails(MemSpyKernelObject *object) +{ + QStringList result; + + result << QString("%1: %2").arg(tr("Name")).arg(object->nameDetail()); + result << QString("%1: %2").arg(tr("Full Name")).arg(object->name()); + result << QString("%1: %2").arg(tr("AccessCount")).arg(object->accessCount()); + result << QString("%1: %2").arg(tr("UniqueID")).arg(object->uniqueId()); + result << QString("%1: %2").arg(tr("Protection")).arg(object->protection()); + result << QString("%1: %2").arg(tr("OwnrAddr")).arg(object->addressOfKernelOwner()); + result << QString("%1: %2").arg(tr("KernelAddr")).arg(object->kernelAddress()); + + // Object type specific attributes: + switch (object->type()) + { + case KernelObjectTypeUnknown: + { + break; + } + case KernelObjectTypeThread: + { + result << QString("%1: %2").arg(tr("OwnrPrAddr")).arg(object->addressOfOwningProcess()); + result << QString("%1: %2").arg(tr("ThreadID")).arg(object->id()); + result << QString("%1: %2").arg(tr("Priority")).arg(object->priority()); + result << QString("%1: %2").arg(tr("Proc")).arg(object->nameOfOwner()); + break; + } + case KernelObjectTypeProcess: + { + result << QString("%1: %2").arg(tr("OwnrPrAddr")).arg(object->addressOfOwningProcess()); + result << QString("%1: %2").arg(tr("CreatorId")).arg(object->creatorId()); + result << QString("%1: %2").arg(tr("Attributes")).arg(object->attributes()); + result << QString("%1: %2").arg(tr("StckChnk")).arg(object->addressOfDataBssStackChunk()); + result << QString("%1: %2").arg(tr("ProcessID")).arg(object->id()); + result << QString("%1: %2").arg(tr("Priority")).arg(object->priority()); + result << QString("%1: %2").arg(tr("SecurityZone")).arg(object->securityZone()); + + /* TODO: to solve process details + CMemSpyEngineObjectContainer& container = iEngine.Container(); + TProcessId id( iKernelObjectItems[iListBox->CurrentItemIndex().iId ); + TRAP_IGNORE( + CMemSpyProcess& process = container.ProcessByIdL( id ); + AppendFormatString( messagePtr, _L("\nSID: 0x%08X\n"), process.SID() ); + AppendFormatString( messagePtr, _L("VID: 0x%08X\n"), process.VID() ); + AppendFormatString( messagePtr, _L("UID1: 0x%08X\n"), process.UIDs()[0].iUid ); + AppendFormatString( messagePtr, _L("UID2: 0x%08X\n"), process.UIDs()[1].iUid ); + AppendFormatString( messagePtr, _L("UID3: 0x%08X\n"), process.UIDs()[2].iUid ); + AppendFormatString( messagePtr, _L("Caps: 0x%08X%08X"), process.Capabilities().iCaps[0], process.Capabilities().iCaps[1]); + ); + */ + break; + } + case KernelObjectTypeChunk: + { + result << QString("%1: %2").arg(tr("OwnrPrAddr")).arg(object->addressOfOwningProcess()); + result << QString("%1: %2").arg(tr("Size")).arg(object->size()); + result << QString("%1: %2").arg(tr("MaxSize")).arg(object->maxSize()); + result << QString("%1: %2").arg(tr("Bottom")).arg(object->bottom()); + result << QString("%1: %2").arg(tr("Top")).arg(object->top()); + result << QString("%1: %2").arg(tr("Attr")).arg(object->attributes()); + result << QString("%1: %2").arg(tr("Start")).arg(object->startPos()); + result << QString("%1: %2").arg(tr("CntrlID")).arg(object->controllingOwner()); + result << QString("%1: %2").arg(tr("Restrictions")).arg(object->restrictions()); + result << QString("%1: %2").arg(tr("MapAttr")).arg(object->mapAttr()); + result << QString("%1: %2").arg(tr("Type")).arg(object->chunkType()); + result << QString("%1: %2").arg(tr("Proc")).arg(object->nameOfOwner()); + break; + } + case KernelObjectTypeLibrary: + { + result << QString("%1: %2").arg(tr("MapCount")).arg(object->mapCount()); + result << QString("%1: %2").arg(tr("State")).arg(object->state()); + result << QString("%1: %2").arg(tr("CodeSeg")).arg(object->addressOfCodeSeg()); + break; + } + case KernelObjectTypeSemaphore: + { + result << QString("%1: %2").arg(tr("Count")).arg(object->count()); + result << QString("%1: %2").arg(tr("Resetting")).arg(object->resetting()); + break; + } + case KernelObjectTypeMutex: + { + result << QString("%1: %2").arg(tr("HoldCount")).arg(object->count()); + result << QString("%1: %2").arg(tr("WaitCount")).arg(object->waitCount()); + result << QString("%1: %2").arg(tr("Resetting")).arg(object->resetting()); + result << QString("%1: %2").arg(tr("Order")).arg(object->order()); + break; + } + case KernelObjectTypeTimer: + { + result << QString("%1: %2").arg(tr("State")).arg(object->timerState()); + result << QString("%1: %2").arg(tr("Type")).arg(object->timerType()); + break; + } + case KernelObjectTypeServer: + { + result << QString("%1: %2").arg(tr("ThrdAddr")).arg(object->addressOfOwningThread()); + result << QString("%1: %2").arg(tr("Thr")).arg(object->nameOfOwner()); + result << QString("%1: %2").arg(tr("Type")).arg(object->sessionType()); +// RArray sessions; +// CleanupClosePushL( sessions ); + /* TODO: to solve server sessions + iEngine.HelperServer().GetServerSessionsL( iKernelObjectItems[iListBox->CurrentItemIndex(), sessions ); + const TInt count = sessions.Count(); + for ( TInt i = 0; i < count; i++ ) + { + const TMemSpyDriverServerSessionInfo& session = sessions[ i ]; + AppendFormatString( messagePtr, _L("SessAddr: 0x%08X\n"), session.iAddress ); + TFullName sessName; + sessName.Copy( session.iName ); + AppendFormatString( messagePtr, _L("Sess: %S\n"), &sessName ); + } + CleanupStack::PopAndDestroy( &sessions ); + */ + break; + } + case KernelObjectTypeSession: + { + result << QString("%1: %2").arg(tr("Server")).arg(object->addressOfServer()); + result << QString("%1: %2").arg(tr("Srv")).arg(object->name()); + result << QString("%1: %2").arg(tr("AccCount")).arg(object->totalAccessCount()); + result << QString("%1: %2").arg(tr("SesType")).arg(object->sessionType()); + result << QString("%1: %2").arg(tr("SvrType")).arg(object->svrSessionType()); + result << QString("%1: %2").arg(tr("MsgCount")).arg(object->msgCount()); + result << QString("%1: %2").arg(tr("MsgLimit")).arg(object->msgLimit()); + + break; + } + case KernelObjectTypeLogicalDevice: + { + result << QString("%1: %2").arg(tr("Version")).arg(object->version()); + result << QString("%1: %2").arg(tr("ParseMask")).arg(object->parseMask()); + result << QString("%1: %2").arg(tr("UnitsMask")).arg(object->unitsMask()); + result << QString("%1: %2").arg(tr("Open channels")).arg(object->openChannels()); + break; + } + case KernelObjectTypePhysicalDevice: + { + result << QString("%1: %2").arg(tr("Version")).arg(object->version()); + result << QString("%1: %2").arg(tr("UnitsMask")).arg(object->unitsMask()); + result << QString("%1: %2").arg(tr("CodeSeg")).arg(object->addressOfCodeSeg()); + break; + } + case KernelObjectTypeLogicalChannel: + { + // No other details + break; + } + case KernelObjectTypeChangeNotifier: + { + result << QString("%1: %2").arg(tr("Changes")).arg(object->changes()); + result << QString("%1: %2").arg(tr("ThrdAddr")).arg(object->addressOfOwningThread()); + result << QString("%1: %2").arg(tr("Thr")).arg(object->nameOfOwner()); + break; + } + case KernelObjectTypeUndertaker: + { + result << QString("%1: %2").arg(tr("ThrdAddr")).arg(object->addressOfOwningThread()); + result << QString("%1: %2").arg(tr("Thr")).arg(object->nameOfOwner()); + break; + } + case KernelObjectTypeMsgQueue: + { + // No other details + break; + } + case KernelObjectTypePropertyRef: + { + /* + Not listing details here, as propertyRef is not listed in TaskMgr. + Following propertyRef attributes are available at engine side. + + IsReady + Type + Category + Key + RefCount + ThreadId + CreatorSID + */ + break; + } + case KernelObjectTypeCondVar: + { + result << QString("%1: %2").arg(tr("Resetting")).arg(object->resetting()); + result << QString("%1: %2").arg(tr("Mutex")).arg(object->addressOfOwningThread()); + result << QString("%1: %2").arg(tr("Mtx")).arg(object->nameOfOwner()); + result << QString("%1: %2").arg(tr("WaitCount")).arg(object->waitCount()); + +// RArray threads; +// CleanupClosePushL( threads ); + /* TODO: to solve thread cond. vars. + iEngine.HelperCondVar().GetCondVarSuspendedThreadsL( iKernelObjectItems[iListBox->CurrentItemIndex(), threads ); + const TInt count = threads.Count(); + for ( TInt i = 0; i < count; i++ ) + { + const TMemSpyDriverCondVarSuspendedThreadInfo& thr = threads[ i ]; + AppendFormatString( messagePtr, _L("SuspThrdAddr: 0x%08X\n"), thr.iAddress ); + TFullName thrName; + thrName.Copy( thr.iName ); + AppendFormatString( messagePtr, _L("Thr: %S\n"), &thrName ); + } + CleanupStack::PopAndDestroy( &threads ); + */ + break; + } +// default: +// { +// // Programming error +// __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); +// } + } + + return result; +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspylistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspylistview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspylistview.h" + +HbWidget* MemSpyListView::createCentralWidget() +{ + return &mListView; +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspymainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspymainview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspymainview.h" +#include "viewmanager.h" + +#include +#include + +void MemSpyMainView::initialize(const QVariantMap& params) +{ + setTitle("MemSpy"); + + MemSpyView::initialize(params); + + QStringList items = QStringList() + << tr("Processes & Threads") + << tr("Kernel Objects") + << tr("Tracking") + << tr("Servers") + << tr("ECom"); + mListView.setModel(new QStringListModel(items, this)); + + QObject::connect(&mListView, SIGNAL(released(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +void MemSpyMainView::itemClicked(const QModelIndex& index) +{ + Q_UNUSED(index); + ViewIndex indexes[] = { ProcessView, KernelObjectTypeView, TrackingView, ServerView, EComCategoryView }; + mViewManager.showView(indexes[index.row()]); +} + +bool MemSpyMainView::isBreadCrumbVisible() const +{ + return false; +} + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyprocessview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyprocessview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "memspyprocessview.h" + +#include +#include +#include + +#include "viewmanager.h" + +MemSpyProcessModel::MemSpyProcessModel(EngineWrapper &engine, QObject *parent) : + QAbstractListModel(parent), + mEngine(engine), + mProcesses(engine.getProcesses()) +{ + mPriorityMap.insert(EPriorityLow, tr("[L]")); + mPriorityMap.insert(EPriorityBackground, tr("[B]")); + mPriorityMap.insert(EPriorityForeground, tr("[F]")); + mPriorityMap.insert(EPriorityHigh, tr("[H]")); + mPriorityMap.insert(EPriorityWindowServer, tr("[WS]")); + mPriorityMap.insert(EPriorityFileServer, tr("[FS]")); + mPriorityMap.insert(EPriorityRealTimeServer, tr("[RTS]")); + mPriorityMap.insert(EPrioritySupervisor, tr("[SUP]")); +} + +MemSpyProcessModel::~MemSpyProcessModel() +{ + qDeleteAll(mProcesses); +} + +int MemSpyProcessModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mProcesses.count(); +} + +QVariant MemSpyProcessModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + const MemSpyProcess* process = mProcesses.at(index.row()); + + QStringList lines; + lines << process->name(); + + lines << (process->isDead() ? + process->exitInfo() : + QString("%1, %2 thr, %3"). + arg(process->sid(), 0, 16). + arg(process->threadCount()). + arg(mPriorityMap.value(process->priority(), tr("[?]")))); + + return lines; + } + + if (role == Qt::UserRole) + return mProcesses.at(index.row())->id(); + + return QVariant(); +} + +void MemSpyProcessModel::refresh() +{ + beginResetModel(); + QList data = mEngine.getProcesses(); + qDeleteAll(mProcesses); + mProcesses = data; + endResetModel(); +} + + +void MemSpyProcessView::initialize(const QVariantMap& params) +{ + setTitle(tr("Processes")); + MemSpyView::initialize(params); + + mModel = new MemSpyProcessModel(mEngine, this); + mListView.setModel(mModel); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); + connect(&mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)), + this, SLOT(catchLongPress(HbAbstractViewItem*,QPointF))); + + mContextMenu = new HbMenu; + mEndMenu = mContextMenu->addMenu("End"); + + mEndMenu->addAction(tr("Kill"), this, SLOT(kill())); + mEndMenu->addAction(tr("Panic"), this, SLOT(panic())); + mEndMenu->addAction(tr("Terminate"), this, SLOT(terminate())); +} + +void MemSpyProcessView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map.insert("pid", index.data(Qt::UserRole)); + map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0)); + mViewManager.showView(ThreadView, map); +} + +void MemSpyProcessView::catchLongPress(HbAbstractViewItem *item, const QPointF &coords) +{ + mProcessId = qVariantValue(item->modelIndex().data(Qt::UserRole)); + mContextMenu->setPreferredPos(coords); + mContextMenu->open(); +} + +void MemSpyProcessView::kill() +{ + mEngine.killProcess(mProcessId); + refresh(); +} + +void MemSpyProcessView::panic() +{ + mEngine.panicProcess(mProcessId); + refresh(); +} + +void MemSpyProcessView::terminate() +{ + mEngine.terminateProcess(mProcessId); + refresh(); +} + +void MemSpyProcessView::refresh() +{ + mModel->refresh(); +} + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyserverview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyserverview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspyserverview.h" +#include "viewmanager.h" + +MemSpyServerModel::MemSpyServerModel(EngineWrapper &engine, QObject *parent) : + QAbstractListModel(parent), + mEngine(engine), + mServers(engine.getServers()) +{ +} + +MemSpyServerModel::~MemSpyServerModel() +{ + qDeleteAll(mServers); +} + +int MemSpyServerModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mServers.count(); +} + +QVariant MemSpyServerModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + const MemSpyServer* server = mServers.at(index.row()); + + QStringList lines; + lines << server->name(); + lines << QString("%1 session(s)").arg(server->sessionCount()); + + return lines; + } + + if (role == Qt::UserRole) + return mServers.at(index.row())->id(); + + return QVariant(); +} + +void MemSpyServerModel::refresh() +{ + beginResetModel(); + QList data = mEngine.getServers(); + qDeleteAll(mServers); + mServers = data; + endResetModel(); +} + + +void MemSpyServerView::initialize(const QVariantMap& params) +{ + setTitle(tr("Servers")); + MemSpyView::initialize(params); + + mModel = new MemSpyServerModel(mEngine, this); + mListView.setModel(mModel); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +void MemSpyServerView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map.insert("pid", index.data(Qt::UserRole)); + map.insert("pname", index.data(Qt::DisplayRole).toStringList().at(0)); + mViewManager.showView(ThreadView, map); +} + +void MemSpyServerView::refresh() +{ + mModel->refresh(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspysettingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspysettingsview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include +#include + +#include "memspysettingsview.h" +#include "enginewrapper.h" + +const QStringList MODE_ITEMS = QStringList() << + MemSpySettingsView::tr("RDebug") << + MemSpySettingsView::tr("File"); + +MemSpySettingsView::MemSpySettingsView(EngineWrapper &engine) : + mForm(new HbDataForm(this)), + mModel(0), + mModeItem(0), + mPathItem(0), + mCustomPathItem(0), + mEngine(engine) +{ + setTitle(tr("Settings")); + + toolBar()->addAction(tr("OK"), this, SLOT(accept())); + toolBar()->addAction(tr("Cancel"), this, SLOT(reject())); + + mModel = new HbDataFormModel(this); + + mModeItem = mModel->appendDataFormItem( + HbDataFormModelItem::ComboBoxItem, tr("Output")); + mModeItem->setContentWidgetData("items", MODE_ITEMS); + mModeItem->setContentWidgetData("currentIndex", mEngine.settings().outputMode()); + + updateModel(); + + + mForm->setModel(mModel); + mForm->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(updateModel())); + setWidget(mForm); + + // change navigation action + HbAction* action = new HbAction(Hb::BackNaviAction, this); + connect(action, SIGNAL(triggered()), this, SLOT(reject())); + setNavigationAction(action); +} + +MemSpySettingsView::~MemSpySettingsView() +{ +} + +void MemSpySettingsView::updateModel() +{ + OutputMode mode = static_cast(mModeItem->contentWidgetData("currentIndex").toInt()); + if (mode == OutputModeTrace) { + // remove both path item and custom path item + if (mPathItem) + mModel->removeItem(mPathItem); + if (mCustomPathItem) + mModel->removeItem(mCustomPathItem); + + mPathItem = mCustomPathItem = 0; + } else if (mode == OutputModeFile) { + if (!mPathItem) { + // create path item + mPathItem = mModel->appendDataFormItem( + HbDataFormModelItem::CheckBoxItem, tr("Path")); + mPathItem->setContentWidgetData("text", tr("Use Default Path (\\MemSpy)")); + mPathItem->setContentWidgetData("checkState", + mEngine.settings().outputPath().isEmpty() ? Qt::Checked : Qt::Unchecked); + + mForm->addConnection(mPathItem, SIGNAL(stateChanged(int)), + this, SLOT(updateModel())); + } + + if (mPathItem->contentWidgetData("checkState").toInt() == Qt::Unchecked && !mCustomPathItem) { + // create custom path item + mCustomPathItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, tr("Custom Path")); + mCustomPathItem->setContentWidgetData("text", + mEngine.settings().outputPath().isEmpty() ? "\\MemSpy" : mEngine.settings().outputPath()); + } + + if (mPathItem->contentWidgetData("checkState").toInt() == Qt::Checked && mCustomPathItem) { + // remove cusom path item + mModel->removeItem(mCustomPathItem); + mCustomPathItem = 0; + } + } +} + +void MemSpySettingsView::accept() +{ + OutputMode mode = static_cast(mModeItem->contentWidgetData("currentIndex").toInt()); + + mEngine.settings().setOutputMode(mode); + + if (mode == OutputModeFile) { + QString path = mPathItem->contentWidgetData("checkState").toInt() == Qt::Checked ? + "" : + mCustomPathItem->contentWidgetData("text").toString(); + mEngine.settings().setOutputPath(path); + } + emit finished(true); +} + +void MemSpySettingsView::reject() +{ + emit finished(false); +} + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyswmtview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyswmtview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include +#include + +#include "memspyswmtview.h" +#include "enginewrapper.h" + +const QStringList MODE_ITEMS = QStringList() << + MemSpySwmtView::tr("Basic") << + MemSpySwmtView::tr("Full") << + MemSpySwmtView::tr("Custom"); + +const QStringList CATEGORIES_ITEMS = QStringList() << + MemSpySwmtView::tr("FileServer Cache") << + //MemSpySwmtView::tr("Bitmap Handles") << + MemSpySwmtView::tr("User Heap") << + //MemSpySwmtView::tr("Kernel Heap") << + MemSpySwmtView::tr("Local Chunks") << + MemSpySwmtView::tr("Global Chunks") << + MemSpySwmtView::tr("RAM Drive") << + //MemSpySwmtView::tr("User Stacks") << + //MemSpySwmtView::tr("Global Data") << + MemSpySwmtView::tr("RAM-loaded Code") << + MemSpySwmtView::tr("Kernel Handles") << + MemSpySwmtView::tr("Open Files") << + MemSpySwmtView::tr("Disk Usage") << + MemSpySwmtView::tr("System Memory") << + MemSpySwmtView::tr("Windows Groups"); + +MemSpySwmtView::MemSpySwmtView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyView(engine, viewManager), + mToggleTimerAction(0), + mCategoriesItem(0), + mProgressDialog(0) +{ +} + +MemSpySwmtView::~MemSpySwmtView() +{ +} + +void MemSpySwmtView::initialize(const QVariantMap& params) +{ + setTitle(tr("SWMT")); + + MemSpyView::initialize(params); +} + +HbToolBar* MemSpySwmtView::createToolBar() +{ + HbToolBar* toolBar = new HbToolBar(); + mToggleTimerAction = toolBar->addAction("", this, SLOT(toggleTimer())); + toolBar->addAction(tr("Dump Now"), this, SLOT(forceDump())); + + updateTimerAction(mEngine.isSwmtRunning()); + + return toolBar; +} + +HbWidget* MemSpySwmtView::createCentralWidget() +{ + mModel = new HbDataFormModel(this); + + mTimerItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, tr("Timer (sec.)")); + mTimerItem->setContentWidgetData("maxLength", 2); + mTimerItem->setContentWidgetData("text", mEngine.settings().swmtTimerPeriod()); + + mModeItem = mModel->appendDataFormItem( + HbDataFormModelItem::ComboBoxItem, tr("Tracking mode")); + mModeItem->setContentWidgetData("items", MODE_ITEMS); + mModeItem->setContentWidgetData("currentIndex", mEngine.settings().swmtMode()); + + modeChanged(mEngine.settings().swmtMode()); + + HbDataForm* form = new HbDataForm(this); + form->setModel(mModel); + + form->addConnection(mModeItem, SIGNAL(currentIndexChanged(int)), this, SLOT(modeChanged(int))); + + return form; +} + +void MemSpySwmtView::updateTimerAction(bool isRunning) +{ + mToggleTimerAction->setText(isRunning ? tr("Stop Timer") : tr("Start Timer")); +} + +void MemSpySwmtView::toggleTimer() +{ + bool wasRunning = mEngine.isSwmtRunning(); + if (wasRunning) + mEngine.stopSwmt(); + else + { + updateSettings(); + mEngine.startSwmt(qBound(5, mTimerItem->contentWidgetData("text").toInt(), 60)); + } + + updateTimerAction(!wasRunning); +} + +void MemSpySwmtView::forceDump() +{ + updateSettings(); + mEngine.updateOutputSettings(); + + MemSpySwmtDumpTracker* tracker = mEngine.createSwmtDumpTracker(); + connect(tracker, SIGNAL(finished(int)), this, SLOT(asyncOperationFinished(int))); + + mProgressDialog = new HbProgressDialog(HbProgressDialog::WaitDialog); + mProgressDialog->setText(tr("Please wait...")); + mProgressDialog->setPrimaryAction(0); + mProgressDialog->show(); + + tracker->start(); +} + +void MemSpySwmtView::updateSettings() +{ + mEngine.settings().setSwmtTimerPeriod(mTimerItem->contentWidgetData("text").toInt()); + mEngine.settings().setSwmtMode(static_cast( + mModeItem->contentWidgetData("currentIndex").toInt())); + if (mCategoriesItem) + mEngine.settings().setSwmtCategories(mCategoriesItem->contentWidgetData("selectedItems").toList()); + + mEngine.setSwmtSettings(static_cast(mEngine.settings().swmtMode()), + mEngine.settings().swmtCategories()); +} + +void MemSpySwmtView::modeChanged(int mode) +{ + if (mode != SwmtModeCustom && mCategoriesItem) + removeCategoriesItem(); + else if (mode == SwmtModeCustom && !mCategoriesItem) + createCategoriesItem(); +} + +void MemSpySwmtView::asyncOperationFinished(int errorCode) +{ + Q_UNUSED(errorCode); + + mProgressDialog->hide(); + delete mProgressDialog; + mProgressDialog = 0; + + delete sender(); +} + +void MemSpySwmtView::createCategoriesItem() +{ + mCategoriesItem = mModel->appendDataFormItem( + HbDataFormModelItem::MultiselectionItem, tr("Categories")); + mCategoriesItem->setContentWidgetData("items", CATEGORIES_ITEMS); + mCategoriesItem->setContentWidgetData("selectedItems", mEngine.settings().swmtCategories()); +} + +void MemSpySwmtView::removeCategoriesItem() +{ + mModel->removeItem(mCategoriesItem); + mCategoriesItem = 0; +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspythreaddetailindexview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspythreaddetailindexview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include + +#include "memspythreaddetailindexview.h" +#include "viewmanager.cpp" + +void MemSpyThreadDetailIndexView::initialize(const QVariantMap& params) +{ + setTitle(tr("Details")); + + mProcessName = params["pname"].toString(); + mThreadName = params["tname"].toString(); + + MemSpyView::initialize(params); + + mThreadId = qVariantValue(params["tid"]); + + QStringList lines = QStringList() << tr("General") << tr("Heap") << tr("Stack") + << tr("Chunks") << tr("Code Segments") << tr("Open Files") << tr("Active Objects") + << tr("Handles to other Threads") << tr("Handles to other Processes") + << tr("Servers Running in Thread") << tr("Client <-> Server connections") + << tr("Semaphores") << tr("References this Thread") << tr("References this Process") + << tr("Mutexes") << tr("Timers") << tr("Logical DD Channels") + << tr("Change Notifiers") << tr("Undertakers") << tr("Logical Device Drivers") + << tr("Physical Device Drivers"); + + mListView.setModel(new QStringListModel(lines, this)); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +HbMenu* MemSpyThreadDetailIndexView::createToolMenu() +{ + HbMenu* menu = new HbMenu(tr("Thread")); + mPriorityMenu = menu->addMenu("Change Priority"); + + mPriorityMenu->addAction(tr("Abs. Very Low"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Low Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Low"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Background Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Background"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Foreground Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Foreground"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. High Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. High"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 1"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 2"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 3"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 4"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 5"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 6"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 7"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 8"), this, SLOT(changePriority())); + + return menu; +} + +bool MemSpyThreadDetailIndexView::isBreadCrumbVisible() const +{ + return true; +} + +QString MemSpyThreadDetailIndexView::getBreadCrumbText() const +{ + return tr("Processes > %1 > Threads > %2").arg(mProcessName).arg(mThreadName); +} + +void MemSpyThreadDetailIndexView::changePriority() +{ + QAction *s = qobject_cast(sender()); + int index = mPriorityMenu->actions().indexOf(s); + + ThreadPriority priorities[] = { + ThreadPriorityAbsoluteVeryLow, + ThreadPriorityAbsoluteLowNormal, + ThreadPriorityAbsoluteLow, + ThreadPriorityAbsoluteBackgroundNormal, + ThreadPriorityAbsoluteBackground, + ThreadPriorityAbsoluteForegroundNormal, + ThreadPriorityAbsoluteForeground, + ThreadPriorityAbsoluteHighNormal, + ThreadPriorityAbsoluteHigh, + ThreadPriorityAbsoluteRealTime1, + ThreadPriorityAbsoluteRealTime2, + ThreadPriorityAbsoluteRealTime3, + ThreadPriorityAbsoluteRealTime4, + ThreadPriorityAbsoluteRealTime5, + ThreadPriorityAbsoluteRealTime6, + ThreadPriorityAbsoluteRealTime7, + ThreadPriorityAbsoluteRealTime8 }; + + if (index >= 0) + mEngine.setThreadPriority(mThreadId, priorities[index]); +} + +void MemSpyThreadDetailIndexView::itemClicked(const QModelIndex& index) +{ + ThreadInfoType types[] = { ThreadInfoTypeGeneral, ThreadInfoTypeHeap, + ThreadInfoTypeStack, ThreadInfoTypeChunk, ThreadInfoTypeCodeSeg, + ThreadInfoTypeOpenFiles, ThreadInfoTypeActiveObjects, ThreadInfoTypeOwnedThreadHandles, + ThreadInfoTypeOwnedProcessHandles, ThreadInfoTypeServer, ThreadInfoTypeSession, + ThreadInfoTypeSemaphore, ThreadInfoTypeOtherThreads, ThreadInfoTypeOtherProcesses, + ThreadInfoTypeMutex, ThreadInfoTypeTimer, ThreadInfoTypeChannel, + ThreadInfoTypeChangeNotifier, ThreadInfoTypeUndertaker, + ThreadInfoTypeLDD, ThreadInfoTypePDD }; + + QVariantMap map; + map.insert("tid", mThreadId); + map.insert("type", types[index.row()]); + map.insert("pname", mProcessName); + map.insert("tname", mThreadName); + mViewManager.showView(ThreadDetailView, map); +} + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspythreaddetailview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspythreaddetailview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include + +#include "memspythreaddetailview.h" + +MemSpyThreadDetailModel::MemSpyThreadDetailModel(EngineWrapper &engine, ThreadId threadId, ThreadInfoType type, QObject *parent) : + QAbstractListModel(parent), + mThreadInfo(engine.getThreadInfo(threadId, type)) +{ +} + +MemSpyThreadDetailModel::~MemSpyThreadDetailModel() +{ + qDeleteAll(mThreadInfo); +} + +int MemSpyThreadDetailModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return qMax(mThreadInfo.count(), 1); +} + +QVariant MemSpyThreadDetailModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + + if (mThreadInfo.count()) { + QStringList lines; + lines << mThreadInfo.at(index.row())->caption(); + lines << mThreadInfo.at(index.row())->value(); + return lines; + } + + return tr("(no items found)"); + } + + if (role == Qt::TextAlignmentRole && mThreadInfo.count() == 0) { + + return Qt::AlignHCenter; + } + + return QVariant(); +} + +void MemSpyThreadDetailView::initialize(const QVariantMap& params) +{ + mProcessName = params["pname"].toString(); + mThreadName = params["tname"].toString(); + + // TODO: Remove duplicates with memspythreaddetailindexview + QMap titleMap; + titleMap[ThreadInfoTypeGeneral] = tr("General"); + titleMap[ThreadInfoTypeHeap] = tr("Heap"); + titleMap[ThreadInfoTypeStack] = tr("Stack"); + titleMap[ThreadInfoTypeChunk] = tr("Chunks"); + titleMap[ThreadInfoTypeCodeSeg] = tr("Code Segments"); + titleMap[ThreadInfoTypeOpenFiles] = tr("Open Files"); + titleMap[ThreadInfoTypeActiveObjects] = tr("Active Objects"); + titleMap[ThreadInfoTypeOwnedThreadHandles] = tr("Handles to other Threads"); + titleMap[ThreadInfoTypeOwnedProcessHandles] = tr("Handles to other Processes"); + titleMap[ThreadInfoTypeServer] = tr("Servers Running in Thread"); + titleMap[ThreadInfoTypeSession] = tr("Client <-> Server connections"); + titleMap[ThreadInfoTypeSemaphore] = tr("Semaphores"); + titleMap[ThreadInfoTypeOtherThreads] = tr("References this Thread"); + titleMap[ThreadInfoTypeOtherProcesses] = tr("References this Process"); + titleMap[ThreadInfoTypeMutex] = tr("Mutexes"); + titleMap[ThreadInfoTypeTimer] = tr("Timers"); + titleMap[ThreadInfoTypeChannel] = tr("Logical DD Channels"); + titleMap[ThreadInfoTypeChangeNotifier] = tr("Change Notifiers"); + titleMap[ThreadInfoTypeUndertaker] = tr("Undertakers"); + titleMap[ThreadInfoTypeLDD] = tr("Logical Device Drivers"); + titleMap[ThreadInfoTypePDD] = tr("Physical Device Drivers"); + + setTitle(titleMap.value(params["type"].toInt())); + + MemSpyView::initialize(params); + + ThreadId threadId = qVariantValue(params["tid"]); + ThreadInfoType type = static_cast(qVariantValue(params["type"])); + + mListView.setModel(new MemSpyThreadDetailModel(mEngine, threadId, type, this)); +} + +bool MemSpyThreadDetailView::isBreadCrumbVisible() const +{ + return true; +} + +QString MemSpyThreadDetailView::getBreadCrumbText() const +{ + return tr("Processes > %1 > Threads > %2").arg(mProcessName).arg(mThreadName); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspythreadview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspythreadview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include + +#include "memspythreadview.h" +#include "viewmanager.h" + +MemSpyThreadModel::MemSpyThreadModel(EngineWrapper &engine, ProcessId processId, QObject *parent) : + QAbstractListModel(parent), + mProcessId(processId), + mEngine(engine), + mThreads(engine.getThreads(processId)) +{ + mPriorityMap.insert(ThreadPriorityNull, tr("[Null]")); + mPriorityMap.insert(ThreadPriorityMuchLess, tr("[Much Less]")); + mPriorityMap.insert(ThreadPriorityLess, tr("[Less]")); + mPriorityMap.insert(ThreadPriorityNormal, tr("[Normal]")); + mPriorityMap.insert(ThreadPriorityMore, tr("[More]")); + mPriorityMap.insert(ThreadPriorityMuchMore, tr("[Much More]")); + mPriorityMap.insert(ThreadPriorityRealTime, tr("[Real Time]")); + mPriorityMap.insert(ThreadPriorityAbsoluteVeryLow, tr("[Abs. Very Low]")); + mPriorityMap.insert(ThreadPriorityAbsoluteLowNormal, tr("[Abs. Low Normal]")); + mPriorityMap.insert(ThreadPriorityAbsoluteLow, tr("[Abs. Low]")); + mPriorityMap.insert(ThreadPriorityAbsoluteBackgroundNormal, tr("[Abs. Background Normal]")); + mPriorityMap.insert(ThreadPriorityAbsoluteBackground, tr("[Abs. Background]")); + mPriorityMap.insert(ThreadPriorityAbsoluteForegroundNormal, tr("[Abs. Foreground Normal]")); + mPriorityMap.insert(ThreadPriorityAbsoluteForeground, tr("[Abs. Foreground]")); + mPriorityMap.insert(ThreadPriorityAbsoluteHighNormal, tr("[Abs. Hight Normal]")); + mPriorityMap.insert(ThreadPriorityAbsoluteHigh, tr("[Abs. High]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime1, tr("[Abs. RT 1]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime2, tr("[Abs. RT 2]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime3, tr("[Abs. RT 3]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime4, tr("[Abs. RT 4]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime5, tr("[Abs. RT 5]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime6, tr("[Abs. RT 6]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime7, tr("[Abs. RT 7]")); + mPriorityMap.insert(ThreadPriorityAbsoluteRealTime8, tr("[Abs. RT 8]")); +} + +MemSpyThreadModel::~MemSpyThreadModel() +{ + qDeleteAll(mThreads); +} + +int MemSpyThreadModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent); + return mThreads.count(); +} + +QVariant MemSpyThreadModel::data(const QModelIndex &index, int role) const +{ + if (role == Qt::DisplayRole) { + QStringList lines; + lines << mThreads.at(index.row())->name(); + lines << mPriorityMap.value(mThreads.at(index.row())->priority(), tr("[Unknown]")); + return lines; + } + + if (role == Qt::UserRole) + return mThreads.at(index.row())->id(); + + return QVariant(); +} + +void MemSpyThreadModel::refresh() +{ + beginResetModel(); + QList data = mEngine.getThreads(mProcessId); + qDeleteAll(mThreads); + mThreads = data; + endResetModel(); +} + +MemSpyThreadView::MemSpyThreadView(EngineWrapper &engine, ViewManager &viewManager) : + MemSpyListView(engine, viewManager), + mContextMenu(0), + mPriorityMenu(0), + mThreadId(0), + mModel(0) +{ +} + +MemSpyThreadView::~MemSpyThreadView() +{ + delete mContextMenu; + delete mPriorityMenu; +} + +void MemSpyThreadView::initialize(const QVariantMap& params) +{ + setTitle(tr("Threads")); + + mProcessId = qVariantValue(params["pid"]); + mProcessName = params["pname"].toString(); + + MemSpyView::initialize(params); + + mModel = new MemSpyThreadModel(mEngine, mProcessId, this); + mListView.setModel(mModel); + + connect(&mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); + connect(&mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)), + this, SLOT(catchLongPress(HbAbstractViewItem*,QPointF))); + + mContextMenu = new HbMenu; + mPriorityMenu = mContextMenu->addMenu("Change Priority"); + + mPriorityMenu->addAction(tr("Abs. Very Low"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Low Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Low"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Background Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Background"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Foreground Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Foreground"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. High Normal"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. High"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 1"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 2"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 3"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 4"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 5"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 6"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 7"), this, SLOT(changePriority())); + mPriorityMenu->addAction(tr("Abs. Real Time 8"), this, SLOT(changePriority())); +} + + +bool MemSpyThreadView::isBreadCrumbVisible() const +{ + return true; +} + +QString MemSpyThreadView::getBreadCrumbText() const +{ + return tr("Processes > %1").arg(mProcessName); +} + +HbMenu* MemSpyThreadView::createToolMenu() +{ + HbMenu* menu = new HbMenu(tr("Process")); + menu->addAction("Kill", this, SLOT(kill())); + menu->addAction("Panic", this, SLOT(panic())); + menu->addAction("Terminate", this, SLOT(terminate())); + return menu; +} + +void MemSpyThreadView::itemClicked(const QModelIndex& index) +{ + QVariantMap map; + map["tid"] = index.data(Qt::UserRole); + map.insert("pname", mProcessName); + map.insert("tname", index.data(Qt::DisplayRole).toStringList().at(0)); + + mViewManager.showView(ThreadDetailIndexView, map); +} + +void MemSpyThreadView::catchLongPress(HbAbstractViewItem *item, const QPointF &coords) +{ + mThreadId = qVariantValue(item->modelIndex().data(Qt::UserRole)); + mContextMenu->setPreferredPos(coords); + mContextMenu->open(); +} + +void MemSpyThreadView::changePriority() +{ + QAction *s = qobject_cast(sender()); + int index = mPriorityMenu->actions().indexOf(s); + + ThreadPriority priorities[] = { + ThreadPriorityAbsoluteVeryLow, + ThreadPriorityAbsoluteLowNormal, + ThreadPriorityAbsoluteLow, + ThreadPriorityAbsoluteBackgroundNormal, + ThreadPriorityAbsoluteBackground, + ThreadPriorityAbsoluteForegroundNormal, + ThreadPriorityAbsoluteForeground, + ThreadPriorityAbsoluteHighNormal, + ThreadPriorityAbsoluteHigh, + ThreadPriorityAbsoluteRealTime1, + ThreadPriorityAbsoluteRealTime2, + ThreadPriorityAbsoluteRealTime3, + ThreadPriorityAbsoluteRealTime4, + ThreadPriorityAbsoluteRealTime5, + ThreadPriorityAbsoluteRealTime6, + ThreadPriorityAbsoluteRealTime7, + ThreadPriorityAbsoluteRealTime8 }; + + if (index >= 0) { + mEngine.setThreadPriority(mThreadId, priorities[index]); + refresh(); + } +} + +void MemSpyThreadView::kill() +{ + mEngine.killProcess(mProcessId); + refresh(); +} + +void MemSpyThreadView::panic() +{ + mEngine.panicProcess(mProcessId); + refresh(); +} + +void MemSpyThreadView::terminate() +{ + mEngine.terminateProcess(mProcessId); + refresh(); +} + + +void MemSpyThreadView::refresh() +{ + mModel->refresh(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspytrackingview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspytrackingview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "memspytrackingview.h" +#include "viewmanager.h" + +#include +#include + +void MemSpyTrackingView::initialize(const QVariantMap& params) +{ + setTitle("MemSpy"); + + MemSpyView::initialize(params); + + QStringList items = QStringList() + << tr("System Wide Memory Tracking") + << tr("Heap Dumps"); + mListView.setModel(new QStringListModel(items, this)); + + QObject::connect(&mListView, SIGNAL(released(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); +} + +void MemSpyTrackingView::itemClicked(const QModelIndex& index) +{ + Q_UNUSED(index); + ViewIndex indexes[] = { SwmtView, HeapDumpsView }; + mViewManager.showView(indexes[index.row()]); +} + +bool MemSpyTrackingView::isBreadCrumbVisible() const +{ + return false; +} + diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/memspyview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/memspyview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,157 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "memspyview.h" +#include "enginewrapper.h" + +#include "memspysettingsview.h" + +MemSpyView::MemSpyView(EngineWrapper &engine, ViewManager &viewManager) : + HbView(), + mEngine(engine), + mViewManager(viewManager), + mOutputMenu(0), + mOutputGenInfoMenu(0), + mOutputHeapInfoMenu(0), + mOutputStackInfoMenu(0), + mToolBar(0), + mBreadCrumb(0) +{ +} + +MemSpyView::~MemSpyView() +{ + delete mBreadCrumb; + delete mToolBar; + delete mOutputStackInfoMenu; + delete mOutputHeapInfoMenu; + delete mOutputGenInfoMenu; + delete mOutputMenu; +} + +void MemSpyView::initialize(const QVariantMap& params) +{ + Q_UNUSED(params); + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, this); + + if (isBreadCrumbVisible()) { + mBreadCrumb = new HbLabel(this); + mBreadCrumb->setTextWrapping(Hb::TextWordWrap); + mBreadCrumb->setElideMode(Qt::ElideLeft); + mBreadCrumb->setPlainText(getBreadCrumbText()); + HbFontSpec spec(HbFontSpec::PrimarySmall); + mBreadCrumb->setFontSpec(spec); + layout->addItem(mBreadCrumb); + } + layout->addItem(createCentralWidget()); + setLayout(layout); + + if (isRefreshable()) + menu()->addAction(tr("Refresh"), this, SLOT(refresh())); + + HbMenu* toolMenu = createToolMenu(); + if (toolMenu) + menu()->addMenu(toolMenu); + + menu()->addAction(tr("Settings ..."), this, SLOT(showSettings())); + menu()->addAction(tr("About ..."), this, SLOT(showAbout())); + menu()->addAction(tr("Exit"), qApp, SLOT(quit())); + + mToolBar = createToolBar(); + if (mToolBar) + setToolBar(mToolBar); +} + +QList MemSpyView::createOutputActions() +{ + return QList(); +} + +HbMenu* MemSpyView::createToolMenu() +{ + return 0; +} + +HbToolBar* MemSpyView::createToolBar() +{ + return 0; +} + +bool MemSpyView::isRefreshable() const +{ + return false; +} + +bool MemSpyView::isBreadCrumbVisible() const +{ + return false; +} + +QString MemSpyView::getBreadCrumbText() const +{ + QStringList views; + for (int i=1; iviews().count() - 1; i++) { + const HbView *view = mainWindow()->views().at(i); + if (view == this) + break; + views.append(view->title()); + } + views.append(title()); + + return views.join(" > "); +} + +void MemSpyView::refresh() +{ + // Empty default implementation +} + +void MemSpyView::showSettings() +{ + MemSpySettingsView* settings = new MemSpySettingsView(mEngine); + connect(settings, SIGNAL(finished(bool)), this, SLOT(closeSettings())); + mainWindow()->addView(settings); + mainWindow()->setCurrentView(settings); +} + +void MemSpyView::showAbout() +{ + HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); + messageBox->setText("Version 2.2.0 - 24th August 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."); + HbLabel *header = new HbLabel("About MemSpy", messageBox); + messageBox->setHeadingWidget(header); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setTimeout(HbPopup::NoTimeout); + messageBox->open(); +} + +void MemSpyView::closeSettings() +{ + sender()->deleteLater(); + mainWindow()->setCurrentView(this); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e memspyui/ui/hb/src/viewmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memspyui/ui/hb/src/viewmanager.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include +#include +#include +#include + +#include "viewmanager.h" + +#include "enginewrapper.h" +#include "memspyview.h" +#include "memspymainview.h" +#include "memspyprocessview.h" +#include "memspythreadview.h" +#include "memspythreaddetailindexview.h" +#include "memspythreaddetailview.h" +#include "memspykernelobjecttypeview.h" +#include "memspykernelobjectview.h" +#include "memspykernelobjectdetailview.h" +#include "memspytrackingview.h" +#include "memspyswmtview.h" +#include "memspyheapdumpsview.h" +#include "memspyserverview.h" +#include "memspyecomcategoryview.h" +#include "memspyecominterfaceview.h" +#include "memspyecomimplementationview.h" +#include "memspyecomimplementationdetailview.h" + +template +static MemSpyView* factory(EngineWrapper &engine, ViewManager &viewManager) +{ + return new T(engine, viewManager); +} +// This array needs to be in sync with view enum +MemSpyView* (*sFactories[])(EngineWrapper&, ViewManager&) = { + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, + &factory, +}; + + +ViewManager::ViewManager(HbMainWindow &window, EngineWrapper &engine, QObject *parent) : + QObject(parent), + mWindow(window), + mEngine(engine) +{ + connect(&mWindow, SIGNAL(currentViewChanged(HbView *)), this, SLOT(viewChanged(HbView *))); +} + +void ViewManager::showView(ViewIndex viewIndex, const QVariantMap ¶ms) +{ + MemSpyView* view; + try { + view = sFactories[viewIndex](mEngine, *this); + view->initialize(params); + } + catch (std::exception& ex) + { + // show message box with exception + // TODO: qt_symbian_exception2Error shouldn't probably be here + QString error = tr("An error occured during the operation. Error code: %1").arg( + qt_symbian_exception2Error(ex)); + + HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeWarning); + messageBox->setText(error); + HbLabel *header = new HbLabel(tr("Error"), messageBox); + messageBox->setHeadingWidget(header); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setTimeout(HbPopup::StandardTimeout); + messageBox->open(); + + delete view; + return; + } + + if (viewIndex != MainView) { + HbAction* action = new HbAction(Hb::BackNaviAction, this); + connect(action, SIGNAL(triggered()), this, SLOT(goBack())); + view->setNavigationAction(action); + } + + mWindow.addView(view); + mWindow.setCurrentView(view); +} + +void ViewManager::showView(ViewIndex viewIndex) +{ + showView(viewIndex, QVariantMap()); +} + +void ViewManager::goBack() +{ + const QList views = mWindow.views(); + int index = views.indexOf(mWindow.currentView()); + mWindow.setCurrentView(views.at(index-1), true, Hb::ViewSwitchUseBackAnim); +} + +void ViewManager::viewChanged(HbView *view) +{ + const QList views = mWindow.views(); + int index = views.indexOf(view); + for (int i=views.count()-1; i>index; i--) + mWindow.removeView(views.at(i)); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/data/perfmon.rss --- a/perfmon/data/perfmon.rss Tue Sep 14 21:20:12 2010 +0300 +++ b/perfmon/data/perfmon.rss Wed Sep 15 12:13:45 2010 +0300 @@ -416,6 +416,15 @@ // +// resources for enablepowermonitoring selections +// +RESOURCE TBUF r_powermonitoringenabled_setting_title + { + buf = "Enable power monitoring"; + } + + +// // resources for datapopupvisibility selection // RESOURCE TBUF r_datapopupvisibility_setting_title @@ -585,7 +594,7 @@ id = EAknMessageQueryContentId; control = AVKON_MESSAGE_QUERY { - message = "Version 1.0.0 - 6th March 2008. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; + message = "Version 1.2.0 - 26th August 2010. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; }; } }; diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/engine/inc/perfmon.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/engine/inc/perfmon.hrh Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_HRH +#define PERFMON_HRH + +enum TPerfMonCommandIds + { + EPerfMonCmdEnableLogging = 1, + EPerfMonCmdDisableLogging, + EPerfMonCmdSettings, + EPerfMonCmdAbout, + + EPerfMonCmdSettingsChange, + EPerfMonCmdSettingsExit, + EPerfMonCmdSettingsBack, + + EPerfMonSettingItemList = 1000 + }; + +enum TPerfMonMainViewTabs + { + ETabMainViewValues = 1, + ETabMainViewGraphs + }; + +enum TPerfMonSettingListTabs + { + ETabSettingsGeneral = 0, + ETabSettingsDataPopup, + ETabSettingsGraphs, + ETabSettingsLogging + }; + +enum TPerfMonSettingListIds + { + ESettingListItemHeartBeat = 0, + ESettingListItemMaxSamples, + ESettingListItemPriority, + ESettingListItemCPUMode, + ESettingListItemKeepBackLightOn, + ESettingListItemPowerMonitoringEnabled, + + ESettingListItemDataPopupVisbility, + ESettingListItemDataPopupLocation, + ESettingListItemDataPopupSources, + + ESettingListItemGraphsVerticalBarPeriod, + ESettingListItemGraphsSources, + + ESettingListItemLoggingMode, + ESettingListItemLoggingFilePath, + ESettingListItemLoggingSources + }; + +enum TPerfMonSettingThreadPriorityTypes + { + EThreadPriorityTypeMuchLess = 0, + EThreadPriorityTypeLess, + EThreadPriorityTypeNormal, + EThreadPriorityTypeMore, + EThreadPriorityTypeMuchMore, + EThreadPriorityTypeRealTime, + EThreadPriorityTypeAbsoluteVeryLow, + EThreadPriorityTypeAbsoluteLow, + EThreadPriorityTypeAbsoluteBackground, + EThreadPriorityTypeAbsoluteForeground, + EThreadPriorityTypeAbsoluteHigh + }; + +enum TPerfMonSettingCPUModes + { + ECPUModeNotSet = -1, + ECPUModeCPUTime, + ECPUModeNOPs + }; + +enum TPerfMonSettingDataPopupVisbilities + { + EDataPopupVisbilityAlwaysOn = 0, + EDataPopupVisbilityBackgroundOnly, + EDataPopupVisbilityAlwaysAlwaysOff + }; + +enum TPerfMonSettingDataPopupLocations + { + EDataPopupLocationTopRight = 0, + EDataPopupLocationBottomMiddle + }; + +enum TPerfMonSettingSources + { + ESourceCPU = 0, + ESourceRAM, + ESourceC, + ESourceD, + ESourceE, + ESourceF, + ESourceG, + ESourceH, + ESourceI, + ESourcePwr, + ESourcesLength // this should be always the last! + }; + +enum TPerfMonSettingLoggingMode + { + ELoggingModeRDebug = 0, + ELoggingModeLogFile, + ELoggingModeRDebugLogFile + }; + +#endif // PERFMON_HRH diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/engine/inc/perfmon_engine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/engine/inc/perfmon_engine.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,259 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_ENGINE_H +#define PERFMON_ENGINE_H + +// INCLUDES +#include +#include +#include +#include + +#include "perfmon.hrh" +#include "perfmon_powerlistener.h" + +const TUint KMaxCPUs = 4; + + +// setting keys (do not change uids of existing keys to maintain compatibility to older versions!) +const TUid KPMSettingHeartBeat = { 0x00 }; +const TUid KPMSettingMaxSamples = { 0x01 }; +const TUid KPMSettingPriority = { 0x02 }; +const TUid KPMSettingCPUMode = { 0x03 }; +const TUid KPMSettingKeepBackLightOn = { 0x04 }; + +const TUid KPMSettingDataPopupVisbility = { 0x05 }; +const TUid KPMSettingDataPopupLocation = { 0x06 }; +const TUid KPMSettingDataPopupSources = { 0x07 }; + +const TUid KPMSettingGraphsVerticalBarPeriod = { 0x08 }; +const TUid KPMSettingGraphsSources = { 0x09 }; + +const TUid KPMSettingLoggingMode = { 0x0A }; +const TUid KPMSettingLoggingFilePath = { 0x0B }; +const TUid KPMSettingLoggingSources = { 0x0C }; + +const TUid KPMSettingPowerMonitoringEnabled = { 0x0D }; + +// FORWARD DECLARATIONS +class CPerfMonValuesContainer; +class CPerfMonGraphsContainer; +class CPerfMonDataPopupContainer; +class CEikonEnv; +class CCoeControl; +class CDictionaryFileStore; + + +// CLASS DECLARATIONS + +class TPerfMonNOPCounter + { +public: + TInt64 iCounterValue; + TInt iCPUNumber; + TInt iAmountOfCPUs; + }; + +class TPerfMonSources + { +public: + TBool iSrcEnabled[ESourcesLength]; + +public: + inline void SetDefaults1() + { + iSrcEnabled[ESourceCPU] = ETrue; + iSrcEnabled[ESourceRAM] = ETrue; + iSrcEnabled[ESourceC] = ETrue; + iSrcEnabled[ESourceD] = EFalse; + iSrcEnabled[ESourceE] = EFalse; + iSrcEnabled[ESourceF] = EFalse; + iSrcEnabled[ESourceG] = EFalse; + iSrcEnabled[ESourceH] = EFalse; + iSrcEnabled[ESourceI] = EFalse; + iSrcEnabled[ESourcePwr] = EFalse; + } + inline void SetDefaults2() + { + iSrcEnabled[ESourceCPU] = ETrue; + iSrcEnabled[ESourceRAM] = ETrue; + iSrcEnabled[ESourceC] = EFalse; + iSrcEnabled[ESourceD] = EFalse; + iSrcEnabled[ESourceE] = EFalse; + iSrcEnabled[ESourceF] = EFalse; + iSrcEnabled[ESourceG] = EFalse; + iSrcEnabled[ESourceH] = EFalse; + iSrcEnabled[ESourceI] = EFalse; + iSrcEnabled[ESourcePwr] = EFalse; + } + TInt EnabledSourcesCount() + { + TInt srcCount(0); + + for (TInt i=0; i CSampleDataArray; + + +class TSampleEntry + { +public: + TBuf<16> iDescription; + TBuf<16> iUnitTypeShort; //eg. b + TBuf<16> iUnitTypeLong; //eg. bytes + TInt iDriveNumber; //used only for disk drives + TRgb iGraphColor; + CSampleDataArray* iSampleDataArray; + }; + +typedef CArrayFixSeg CSampleEntryArray; + + + +class CPerfMonEngine : public CActive + { +public: + ~CPerfMonEngine(); + void ActivateEngineL(); + void DeActivateEngineL(); + void EnableLogging(TBool aEnable); + +private: + void RunL(); + void DoCancel(); + + void LoadSettingsL(); + void OpenLogFile(TBool aOpen); + void CreateSamplesDataArrayL(); + void UpdateSamplesDataL(); + void AppendLatestSamplesToLogsL(); + void ActivateCPUMonitoringL(); + TBool OpenHandleToNullThread(); + void DeActivateCPUMonitoring(); + TBool CPUTimeSupported(); + TInt GetAmountOfCPUs(); + TThreadPriority SettingItemToThreadPriority(TInt aIndex); + void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue); + void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue); + void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TPerfMonSources& aValue); + void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue); + void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue); + void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TPerfMonSources& aValue); + void ActivatePowerMonitoringL(); + void DeActivatePowerMonitoring(); + + TInt SampleEntryPosToSettingPos(TInt aSampleEntryPos); + +protected: + CPerfMonEngine(); + void ConstructL(); + void SaveSettingsL(); + virtual void SendDrawEventToContainersL() = 0; + virtual void HandleSettingsChangeL(); + +public: + inline TPerfMonSettings& Settings() { return iSettings; } + inline CEikonEnv* EikonEnv() { return iEnv; } + inline RApaLsSession& LsSession() { return iLs; } + + inline CSampleEntryArray* SampleEntryArray() { return iSampleEntryArray; } + inline TInt CPU0PositionInSamples() { return iCPU0PositionInSamples; } + inline TInt RAMPositionInSamples() { return iRAMPositionInSamples; } + inline TInt CDrivePositionInSamples() { return iCDrivePositionInSamples; } + inline TInt PowerPositionInSamples() { return iPowerPositionInSamples; } + inline TInt AmountOfCPUs() { return iAmountOfCPUs; } + inline TBool PowerMonitoringSupported() { return iPowerClient->IsSupported(); } + +protected: + RTimer iTimer; + CEikonEnv* iEnv; + TPerfMonSettings iSettings; + RApaLsSession iLs; + CSampleEntryArray* iSampleEntryArray; + TTime iStartTime; + + TInt iCurrentCPUMode; + + RThread iCPULoadNOPThread[KMaxCPUs]; + TPerfMonNOPCounter iCPULoadNOPCounter[KMaxCPUs]; + + RThread iNullThreads[KMaxCPUs]; + TBool iCPULoadCalibrating; + TInt iCPULoadCalibrationCounter; + TInt64 iCPULoadMaxValue; + TInt64 iCPULoadPreviousValue[KMaxCPUs]; + TInt iAmountOfCPUs; + TTime iPreviousTime; + + TInt iCPU0PositionInSamples; + TInt iRAMPositionInSamples; + TInt iCDrivePositionInSamples; + TInt iPowerPositionInSamples; + + TBool iLogFileInitialized; + RFile iLogFile; + + CPerfMonPowerListener* iPowerClient; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/engine/inc/perfmon_powerlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/engine/inc/perfmon_powerlistener.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_POWERLISTENER_H +#define PERFMON_POWERLISTENER_H + +// INCLUDES +#include + +#include "perfmon.hrh" + +// HWRM reporting interval multiplier +const TInt KSampleIntervalMultiple = 1; +const TInt KReportingDuration = 0; // Infinite duration + +class CPerfMonPowerListener : public CBase, public MHWRMBatteryPowerObserver + { +public: + static CPerfMonPowerListener* NewL(); + ~CPerfMonPowerListener(); + +private: + CPerfMonPowerListener(); + void ConstructL(); + + // Handling central repository max reporting period key + void GetReportingPeriodL(); + void SetReportingPeriodL(TInt aDuration); + +public: + static TBool IsSupported(); + + // Start monitoring power values + TInt Activate(); + // Stop monitoring power values + void DeActivate(); + + // Get average power since last read. + TInt GetPower(); + // Maximum power value since measurement started + inline TInt GetMaxPower() { return iMaxPower; } + + virtual void PowerMeasurement(TInt aErrCode, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement); + +private: + CHWRMPower* iHWRMPower; + RArray iPowerBuffer; + TInt iLastPowerAvg; + TInt iMaxPower; + + TInt iOriginalMaxReportingPeriod; + }; + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/engine/src/perfmon_engine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/engine/src/perfmon_engine.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,1128 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ +// INCLUDE FILES +#include "perfmon_engine.h" +#include "perfmon_powerlistener.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +_LIT(KDefaultLogFilePath, "c:\\data\\PerfMon.log"); + +const TInt KCalibrationLength = 2; +const TInt KMinimumSamplesLength = 16; +const TInt KCPUTimeMultiplier = 1000000; // used to avoid TReal conversions + +const TInt KSettingsDrive = EDriveC; +_LIT(KSettingsFileName, "perfmon_settings.ini"); + +// -------------------------------------------------------------------------------------------- + +TInt CPULoadCount(TAny* aPtr) + { + TPerfMonNOPCounter& atts = *((TPerfMonNOPCounter*) aPtr); + + // increase the counter + atts.iCounterValue++; + return 1; + } + +TInt CPULoadNOPThread(TAny* aPtr) + { + // set the thread running in correct CPU + TPerfMonNOPCounter& atts = *((TPerfMonNOPCounter*) aPtr); + + if (atts.iAmountOfCPUs > 1) + { + // request via HAL that the current thread will run in CPU defined in atts.iCPUNumber + TInt err = UserSvr::HalFunction(EHalGroupKernel, 19 /*EKernelHalLockThreadToCpu*/, (TAny*) atts.iCPUNumber, 0); + + if (err != KErrNone) + { + // error, stop this thread + return err; + } + } + + // init trap clean and install active scheduler + CTrapCleanup* pC = CTrapCleanup::New(); + CActiveScheduler* pS = new CActiveScheduler; + CActiveScheduler::Install(pS); + + // call the counter to simulate polling the null thread for cpu time + CIdle* idle = CIdle::NewL(CActive::EPriorityStandard); + TCallBack cb(CPULoadCount, aPtr); + idle->Start(cb); + + pS->Start(); + + delete idle; + delete pS; + delete pC; + + return KErrNone; + } + +// ===================================== MEMBER FUNCTIONS ===================================== + +CPerfMonEngine::CPerfMonEngine() : + CActive(EPriorityUserInput) + { + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::ConstructL() + { + iCurrentCPUMode = ECPUModeNotSet; + iLogFileInitialized = EFalse; + iAmountOfCPUs = 1; + + iEnv = CEikonEnv::Static(); + User::LeaveIfError(iLs.Connect()); + + User::LeaveIfError(iTimer.CreateLocal()); + CActiveScheduler::Add(this); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::ActivateEngineL() + { + // load settings + TRAP_IGNORE(LoadSettingsL()); + + // create data storages for the samples + CreateSamplesDataArrayL(); + + // set default modes + HandleSettingsChangeL(); + + // start sampling data immediately (jump to RunL) + iTimer.After(iStatus, 100); + SetActive(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::DeActivateEngineL() + { + Cancel(); + + DeActivatePowerMonitoring(); + DeActivateCPUMonitoring(); + + // close log file + OpenLogFile(EFalse); + } + +// -------------------------------------------------------------------------------------------- + +CPerfMonEngine::~CPerfMonEngine() + { + DeActivatePowerMonitoring(); + + if (iPowerClient != 0) + { + delete iPowerClient; + iPowerClient = 0; + } + + iTimer.Close(); + + // clear data storages + if (iSampleEntryArray) + { + for (TInt i = 0; i < iSampleEntryArray->Count(); i++) + { + delete iSampleEntryArray->At(i).iSampleDataArray; + } + + delete iSampleEntryArray; + } + + iLs.Close(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::DoCancel() + { + iTimer.Cancel(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::RunL() + { + // calculate new values + UpdateSamplesDataL(); + + // log changes + AppendLatestSamplesToLogsL(); + + // redraw views + SendDrawEventToContainersL(); + + // continue + iTimer.After(iStatus, iSettings.iHeartBeat * 1000); // convert from milliseconds to microseconds + SetActive(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::HandleSettingsChangeL() + { + // set priority of the thread + RThread().SetPriority(SettingItemToThreadPriority(iSettings.iPriority)); + + // init cpu monitor if setting has been changed + if (iCurrentCPUMode != iSettings.iCPUMode) + { + DeActivateCPUMonitoring(); + ActivateCPUMonitoringL(); + } + + // Check for power setting changes every time + if (iSettings.iPowerMonitoringEnabled == true) + { + ActivatePowerMonitoringL(); + } + else + { + DeActivatePowerMonitoring(); + } + + // close log file + OpenLogFile(EFalse); + + // enable log file + if (iSettings.iLoggingEnabled && (iSettings.iLoggingMode + == ELoggingModeLogFile || iSettings.iLoggingMode + == ELoggingModeRDebugLogFile)) + OpenLogFile(ETrue); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::EnableLogging(TBool aEnable) + { + if (aEnable) + { + if (iSettings.iLoggingMode == ELoggingModeLogFile + || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) + OpenLogFile(ETrue); + + iSettings.iLoggingEnabled = ETrue; + } + else // disable + { + iSettings.iLoggingEnabled = EFalse; + OpenLogFile(EFalse); + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::OpenLogFile(TBool aOpen) + { + // open log file for writing + if (aOpen) + { + if (!iLogFileInitialized) + { + TInt err(KErrNone); + + // open the log file for writing + if (iLogFile.Open(iEnv->FsSession(), iSettings.iLoggingFilePath, + EFileWrite) != KErrNone) + { + iEnv->FsSession().MkDirAll(iSettings.iLoggingFilePath); + err = iLogFile.Replace(iEnv->FsSession(), + iSettings.iLoggingFilePath, EFileWrite); + } + else + { + // file opens correctly, seek to the end + TInt fileSize = 0; + iLogFile.Size(fileSize); + err = iLogFile.Seek(ESeekCurrent, fileSize); + } + + if (err == KErrNone) + { + iLogFileInitialized = ETrue; + } + else + { + // show error + CAknErrorNote* note = new (ELeave) CAknErrorNote(); + note->ExecuteLD(_L("Unable to create log file, check settings")); + } + } + } + + // close handle to log file + else + { + if (iLogFileInitialized) + { + iLogFile.Flush(); + iLogFile.Close(); + + iLogFileInitialized = EFalse; + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::ActivateCPUMonitoringL() + { + // reset counter variables + iCPULoadCalibrating = ETrue; + iCPULoadCalibrationCounter = 0; + iCPULoadMaxValue = 999999999; + + for (TInt i=0; iExecuteLD( + _L("CPU Time not supported in this system, using NOPs sampling")); + } + + // get the amount of CPUs + iAmountOfCPUs = GetAmountOfCPUs(); + + // create a thread for CPU load monitoring + for (TInt i=0; i= 1) // add identifier for CPUs higher than zero + nullThreadName.AppendNum(i); + + TFindThread ft(nullThreadName); + TFullName threadName; + + if (ft.Next(threadName) == KErrNone) + { + if (iNullThreads[i].Open(threadName) != KErrNone) + return EFalse; + + iAmountOfCPUs++; + } + else + { + break; // break the loop, no more matches can be found + } + } + } + + // process not found + else + return EFalse; + + // success! + return ETrue; + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::DeActivateCPUMonitoring() + { + if (iCurrentCPUMode == ECPUModeCPUTime) + { + // close handles to null threads + for (TInt i=0;i 0) + return ETrue; + else + return EFalse; + } + +// -------------------------------------------------------------------------------------------- + +TInt CPerfMonEngine::GetAmountOfCPUs() + { + // query from HAL the amount of CPUs and then check it returns a valid value + TInt amountOfCPUs = UserSvr::HalFunction(EHalGroupKernel, 16 /*EKernelHalNumLogicalCpus*/, 0, 0); + + if (amountOfCPUs >= 1 && amountOfCPUs <= KMaxCPUs) + return amountOfCPUs; + else + return 1; // HAL may not support this feature, so just return one CPU + } + +// -------------------------------------------------------------------------------------------- + +TThreadPriority CPerfMonEngine::SettingItemToThreadPriority(TInt aIndex) + { + TThreadPriority threadPriority = EPriorityNull; + + switch (aIndex) + { + case EThreadPriorityTypeMuchLess: + { + threadPriority = EPriorityMuchLess; + break; + } + case EThreadPriorityTypeLess: + { + threadPriority = EPriorityLess; + break; + } + case EThreadPriorityTypeNormal: + { + threadPriority = EPriorityNormal; + break; + } + case EThreadPriorityTypeMore: + { + threadPriority = EPriorityMore; + break; + } + case EThreadPriorityTypeMuchMore: + { + threadPriority = EPriorityMuchMore; + break; + } + case EThreadPriorityTypeRealTime: + { + threadPriority = EPriorityRealTime; + break; + } + case EThreadPriorityTypeAbsoluteVeryLow: + { + threadPriority = EPriorityAbsoluteVeryLow; + break; + } + case EThreadPriorityTypeAbsoluteLow: + { + threadPriority = EPriorityAbsoluteLow; + break; + } + case EThreadPriorityTypeAbsoluteBackground: + { + threadPriority = EPriorityAbsoluteBackground; + break; + } + case EThreadPriorityTypeAbsoluteForeground: + { + threadPriority = EPriorityAbsoluteForeground; + break; + } + case EThreadPriorityTypeAbsoluteHigh: + { + threadPriority = EPriorityAbsoluteHigh; + break; + } + + default: + { + User::Panic(_L("Wrong tp index"), 276); + break; + } + } + + return threadPriority; + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::CreateSamplesDataArrayL() + { + TInt maxSamples = + iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples + : KMinimumSamplesLength; + + // create the data structure to store all samples + iSampleEntryArray = new (ELeave) CSampleEntryArray(16); + + // set sample data array positions for each type + iCPU0PositionInSamples = 0; + iRAMPositionInSamples = KMaxCPUs; + iCDrivePositionInSamples = KMaxCPUs+1; + iPowerPositionInSamples = iCDrivePositionInSamples + ( ESourceI - ESourceC ) + 1; + + // add all CPU source entries + for (TInt i=0; iAppendL(newSampleEntry); + } + + // add RAM entry + { + TSampleEntry newSampleEntry; + + newSampleEntry.iDescription.Copy(_L("RAM")); + newSampleEntry.iUnitTypeShort.Copy(_L("b")); + newSampleEntry.iUnitTypeLong.Copy(_L("bytes")); + newSampleEntry.iDriveNumber = -1; + newSampleEntry.iGraphColor = KRgbGreen; + + newSampleEntry.iSampleDataArray = new(ELeave) CSampleDataArray(maxSamples); + iSampleEntryArray->AppendL(newSampleEntry); + } + + // add all disk drives + for (TInt i=0; iFsSession().CharToDrive(driveLetter, + newSampleEntry.iDriveNumber); + + newSampleEntry.iGraphColor = KRgbCyan; + newSampleEntry.iGraphColor.SetGreen(255 - (i - ESourceC) * 30); + newSampleEntry.iGraphColor.SetRed(i * 30); + + newSampleEntry.iSampleDataArray = new (ELeave) CSampleDataArray( + maxSamples); + + iSampleEntryArray->AppendL(newSampleEntry); + } + + // add power entry + { + TSampleEntry newSampleEntry; + + newSampleEntry.iDescription.Copy(_L("Power")); + newSampleEntry.iUnitTypeShort.Copy(_L("mW")); + newSampleEntry.iUnitTypeLong.Copy(_L("milliwatts")); + newSampleEntry.iDriveNumber = -1; + newSampleEntry.iGraphColor = KRgbRed; + + newSampleEntry.iSampleDataArray = new(ELeave) CSampleDataArray(maxSamples); + iSampleEntryArray->AppendL(newSampleEntry); + } + + // save current time as start time + iStartTime.HomeTime(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::UpdateSamplesDataL() + { + // reset inactivity timers + if (iSettings.iKeepBacklightOn) + User::ResetInactivityTime(); + + // get current time + TTime currentTime; + currentTime.HomeTime(); + + // calculate time difference + TTimeIntervalMicroSeconds timeDeltaFromPreviousSample = + currentTime.MicroSecondsFrom(iPreviousTime); + + // remember current time as previous + iPreviousTime = currentTime; + + // get CPU load value for each CPU + for (TInt i=0;i iCPULoadMaxValue) + { + iCPULoadMaxValue = cpuLoadFree; + } + } + + // save cpu sample data + TSampleData cpuSample; + cpuSample.iFree = cpuLoadFree; + cpuSample.iSize = iCPULoadCalibrating ? cpuLoadFree : iCPULoadMaxValue; // if calibrating, size==free, otherwise store the correct size value + cpuSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime); + + iSampleEntryArray->At(i).iSampleDataArray->InsertL(0, cpuSample); + } + + // check calibration status, the calibration will be only done against CPU0 + if (iCPULoadCalibrating) + { + iCPULoadCalibrationCounter++; + TInt64 cpuLoadSize = iSampleEntryArray->At(iCPU0PositionInSamples).iSampleDataArray->At(0).iSize; + + // check if need to calibrate anymore + if (iCPULoadCalibrationCounter > KCalibrationLength) + { + iCPULoadCalibrating = EFalse; + + // from the samples, get the minimum value, and let it be the max value + for (TInt i=0; iAt(0).iSampleDataArray->Count(); i++) + { + TInt64 newCPULoadMaxValue = iCPULoadMaxValue; + + if (iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree < newCPULoadMaxValue) + { + newCPULoadMaxValue = iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree; + } + + iCPULoadMaxValue = newCPULoadMaxValue; + } + + // adjust priority of the poller thread + if (iCurrentCPUMode == ECPUModeNOPs) + { + for (TInt i=0; iAt(iRAMPositionInSamples).iSampleDataArray->InsertL(0, memorySample); + + // all drives + for (TInt i = iCDrivePositionInSamples; i < iPowerPositionInSamples; i++) + { + TSampleData driveSample; + + // get volume info from RFs + TVolumeInfo volumeInfo; + if (iEnv->FsSession().Volume(volumeInfo, + iSampleEntryArray->At(i).iDriveNumber) == KErrNone) + { + driveSample.iFree = volumeInfo.iFree; + driveSample.iSize = volumeInfo.iSize; + } + else + { + driveSample.iFree = 0; + driveSample.iSize = 0; + } + + driveSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime); + + iSampleEntryArray->At(i).iSampleDataArray->InsertL(0, driveSample); + } + + // Power data + TSampleData powerSample; + if (iSettings.iPowerMonitoringEnabled) + { + // Values in milliwatts + powerSample.iFree = ( iPowerClient->GetMaxPower() - iPowerClient->GetPower() ) / 1000; + powerSample.iSize = iPowerClient->GetMaxPower() / 1000; + } + else + { + powerSample.iFree = 0; + powerSample.iSize = 0; + } + + powerSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime); + + iSampleEntryArray->At(iPowerPositionInSamples).iSampleDataArray->InsertL(0, powerSample); + + // compress sample data arrays to save memory + TInt curLength(iSampleEntryArray->At(0).iSampleDataArray->Count()); + + TInt maxSamples = + iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples + : KMinimumSamplesLength; + + if (curLength > maxSamples && curLength % 5 == 0) + { + for (TInt i = 0; i < iSampleEntryArray->Count(); i++) + { + if (SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) + { + iSampleEntryArray->At(i).iSampleDataArray->ResizeL(maxSamples); // looses old samples + iSampleEntryArray->At(i).iSampleDataArray->Compress(); + } + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::AppendLatestSamplesToLogsL() + { + if (iSettings.iLoggingEnabled && SampleEntryArray()) + { + // loop all sources + for (TInt i = 0; i < SampleEntryArray()->Count(); i++) + { + // check if this setting has been enabled and it has some data + if (iSettings.iLoggingSources.iSrcEnabled[SampleEntryPosToSettingPos(i)] + && SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) + { + // get current sample + TSampleData& currentSample = + SampleEntryArray()->At(i).iSampleDataArray->At(0); + + TBuf<128> buf; + buf.Append(_L("PERFMON;")); + buf.Append(SampleEntryArray()->At(i).iDescription); + buf.Append(_L(";")); + buf.AppendNum(currentSample.iTimeFromStart.Int64()); + buf.Append(_L(";")); + buf.AppendNum(currentSample.iFree); + buf.Append(_L(";")); + buf.AppendNum(currentSample.iSize); + + // print to RDebug + if (iSettings.iLoggingMode == ELoggingModeRDebug + || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) + { + RDebug::Print(buf); + } + + // print to log file + if (iSettings.iLoggingMode == ELoggingModeLogFile + || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) + { + buf.Append(_L("\r\n")); + + TBuf8<128> buf8; + buf8.Copy(buf); + + iLogFile.Write(buf8); + } + } + } + } + } + +void CPerfMonEngine::LoadSettingsL() + { + // set defaults + iSettings.iHeartBeat = 600; + iSettings.iMaxSamples = 64; + iSettings.iPriority = EThreadPriorityTypeNormal; + iSettings.iCPUMode = ECPUModeCPUTime; + iSettings.iKeepBacklightOn = ETrue; + + iSettings.iDataPopupVisibility = EDataPopupVisbilityAlwaysOn; + iSettings.iDataPopupLocation = EDataPopupLocationTopRight; + iSettings.iDataPopupSources.SetDefaults1(); + + iSettings.iGraphsVerticalBarPeriod = 5; + iSettings.iGraphsSources.SetDefaults2(); + + iSettings.iLoggingMode = ELoggingModeRDebug; + iSettings.iLoggingFilePath.Copy(KDefaultLogFilePath); + iSettings.iLoggingSources.SetDefaults2(); + + iSettings.iLoggingEnabled = EFalse; + + iSettings.iPowerMonitoringEnabled = ETrue; + + // make sure that the private path of this app in c-drive exists + iEnv->FsSession().CreatePrivatePath(KSettingsDrive); // c:\\private\\20011385\\ + + // handle settings always in the private directory + if (iEnv->FsSession().SetSessionToPrivate(KSettingsDrive) == KErrNone) + { + const TUid KUidPerfMon = + { + 0x20011385 + }; + // open or create a dictionary file store + CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC( + iEnv->FsSession(), KSettingsFileName, KUidPerfMon); + + LoadDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat); + LoadDFSValueL(settingsStore, KPMSettingMaxSamples, + iSettings.iMaxSamples); + LoadDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority); + + LoadDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode); + + LoadDFSValueL(settingsStore, KPMSettingKeepBackLightOn, + iSettings.iKeepBacklightOn); + + LoadDFSValueL(settingsStore, KPMSettingDataPopupVisbility, + iSettings.iDataPopupVisibility); + LoadDFSValueL(settingsStore, KPMSettingDataPopupLocation, + iSettings.iDataPopupLocation); + LoadDFSValueL(settingsStore, KPMSettingDataPopupSources, + iSettings.iDataPopupSources); + + LoadDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod, + iSettings.iGraphsVerticalBarPeriod); + LoadDFSValueL(settingsStore, KPMSettingGraphsSources, + iSettings.iGraphsSources); + + LoadDFSValueL(settingsStore, KPMSettingLoggingMode, + iSettings.iLoggingMode); + LoadDFSValueL(settingsStore, KPMSettingLoggingFilePath, + iSettings.iLoggingFilePath); + LoadDFSValueL(settingsStore, KPMSettingLoggingSources, + iSettings.iLoggingSources); + + LoadDFSValueL(settingsStore, KPMSettingPowerMonitoringEnabled, + iSettings.iPowerMonitoringEnabled); + + CleanupStack::PopAndDestroy(); // settingsStore + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonEngine::SaveSettingsL() + { + // handle settings always in c:\\private\\20011385\\ + if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone) + { + // delete existing store to make sure that it is clean and not eg corrupted + if (BaflUtils::FileExists(iEnv->FsSession(), KSettingsFileName)) + { + iEnv->FsSession().Delete(KSettingsFileName); + } + const TUid KUidPerfMon = + { + 0x20011385 + }; + // create a dictionary file store + CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC( + iEnv->FsSession(), KSettingsFileName, KUidPerfMon); + + SaveDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat); + SaveDFSValueL(settingsStore, KPMSettingMaxSamples, + iSettings.iMaxSamples); + SaveDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority); + SaveDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode); + SaveDFSValueL(settingsStore, KPMSettingKeepBackLightOn, + iSettings.iKeepBacklightOn); + + SaveDFSValueL(settingsStore, KPMSettingDataPopupVisbility, + iSettings.iDataPopupVisibility); + SaveDFSValueL(settingsStore, KPMSettingDataPopupLocation, + iSettings.iDataPopupLocation); + SaveDFSValueL(settingsStore, KPMSettingDataPopupSources, + iSettings.iDataPopupSources); + + SaveDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod, + iSettings.iGraphsVerticalBarPeriod); + SaveDFSValueL(settingsStore, KPMSettingGraphsSources, + iSettings.iGraphsSources); + + SaveDFSValueL(settingsStore, KPMSettingLoggingMode, + iSettings.iLoggingMode); + SaveDFSValueL(settingsStore, KPMSettingLoggingFilePath, + iSettings.iLoggingFilePath); + SaveDFSValueL(settingsStore, KPMSettingLoggingSources, + iSettings.iLoggingSources); + + SaveDFSValueL(settingsStore, KPMSettingPowerMonitoringEnabled, + iSettings.iPowerMonitoringEnabled); + + settingsStore->CommitL(); + CleanupStack::PopAndDestroy(); // settingsStore + } + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::LoadDFSValueL(CDictionaryFileStore* aDicFS, + const TUid& aUid, TInt& aValue) + { + if (aDicFS->IsPresentL(aUid)) + { + RDictionaryReadStream in; + in.OpenLC(*aDicFS, aUid); + aValue = in.ReadInt16L(); + CleanupStack::PopAndDestroy(); // in + } + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::LoadDFSValueL(CDictionaryFileStore* aDicFS, + const TUid& aUid, TDes& aValue) + { + if (aDicFS->IsPresentL(aUid)) + { + RDictionaryReadStream in; + in.OpenLC(*aDicFS, aUid); + TInt bufLength = in.ReadInt16L(); // get length of descriptor + in.ReadL(aValue, bufLength); // get the descriptor itself + CleanupStack::PopAndDestroy(); // in + } + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::LoadDFSValueL(CDictionaryFileStore* aDicFS, + const TUid& aUid, TPerfMonSources& aValue) + { + if (aDicFS->IsPresentL(aUid)) + { + RDictionaryReadStream in; + in.OpenLC(*aDicFS, aUid); + TInt bufLength = in.ReadInt16L(); // get length of the array + + if (bufLength < 0 || bufLength > ESourcesLength) // check for validaty + User::Leave(KErrNotSupported); + + for (TInt i = 0; i < bufLength; i++) // get all items + aValue.iSrcEnabled[i] = in.ReadInt16L(); + + CleanupStack::PopAndDestroy(); // in + } + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::SaveDFSValueL(CDictionaryFileStore* aDicFS, + const TUid& aUid, const TInt& aValue) + { + RDictionaryWriteStream out; + out.AssignLC(*aDicFS, aUid); + out.WriteInt16L(aValue); + out.CommitL(); + CleanupStack::PopAndDestroy(); // out + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::SaveDFSValueL(CDictionaryFileStore* aDicFS, + const TUid& aUid, const TDes& aValue) + { + RDictionaryWriteStream out; + out.AssignLC(*aDicFS, aUid); + out.WriteInt16L(aValue.Length()); // write length of the descriptor + out.WriteL(aValue, aValue.Length()); // write the descriptor itself + out.CommitL(); + CleanupStack::PopAndDestroy(); // out + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::SaveDFSValueL(CDictionaryFileStore* aDicFS, + const TUid& aUid, const TPerfMonSources& aValue) + { + RDictionaryWriteStream out; + out.AssignLC(*aDicFS, aUid); + + out.WriteInt16L(ESourcesLength); // write length of the array + + for (TInt i = 0; i < ESourcesLength; i++) // write all items + out.WriteInt16L(aValue.iSrcEnabled[i]); + + out.CommitL(); + CleanupStack::PopAndDestroy(); // out + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::ActivatePowerMonitoringL() + { + if (iPowerClient == 0) + { + iPowerClient = CPerfMonPowerListener::NewL(); + } + + // disable power monitoring if initialization fails + TInt err = iPowerClient->Activate(); + if (err != KErrNone ) + { + DeActivatePowerMonitoring(); + + iSettings.iPowerMonitoringEnabled = EFalse; + } + } + +// --------------------------------------------------------------------------- + +void CPerfMonEngine::DeActivatePowerMonitoring() + { + if (iPowerClient != 0) + { + iPowerClient->DeActivate(); + } + } + +// --------------------------------------------------------------------------- + +TInt CPerfMonEngine::SampleEntryPosToSettingPos(TInt aSampleEntryPos) + { + TInt settingPos(0); // return position of aSampleEntryPos in settings + + if (aSampleEntryPos >= iCPU0PositionInSamples && aSampleEntryPos < iRAMPositionInSamples) + { + settingPos = ESourceCPU; + } + else if (aSampleEntryPos == iRAMPositionInSamples) + { + settingPos = ESourceRAM; + } + else + { + settingPos = ESourceC + (aSampleEntryPos-iCDrivePositionInSamples); + } + + return settingPos; + } + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/engine/src/perfmon_powerlistener.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/engine/src/perfmon_powerlistener.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +// INCLUDE FILES +#include "perfmon_powerlistener.h" +#include "../../symbian_version.hrh" + +#include +#include + + +#if (SYMBIAN_VERSION_SUPPORT == SYMBIAN_3) + + CPerfMonPowerListener* CPerfMonPowerListener::NewL() + { + CPerfMonPowerListener* self = new (ELeave) CPerfMonPowerListener(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + // -------------------------------------------------------------------------------------------- + + CPerfMonPowerListener::CPerfMonPowerListener() : + iHWRMPower(0), + iLastPowerAvg(0), + iMaxPower(0), + iOriginalMaxReportingPeriod(0) + { + } + + // -------------------------------------------------------------------------------------------- + + void CPerfMonPowerListener::ConstructL() + { + } + + // -------------------------------------------------------------------------------------------- + + CPerfMonPowerListener::~CPerfMonPowerListener() + { + DeActivate(); + + if (iHWRMPower != 0) + { + delete iHWRMPower; + iHWRMPower = 0; + } + } + + // -------------------------------------------------------------------------------------------- + + TBool CPerfMonPowerListener::IsSupported() + { + return ETrue; + } + + // -------------------------------------------------------------------------------------------- + + TInt CPerfMonPowerListener::Activate() + { + if (iHWRMPower == 0) + { + TRAPD(err, iHWRMPower = CHWRMPower::NewL()); + if (err != KErrNone) + { + return err; + } + + // Callbacks to this object + err = iHWRMPower->SetPowerReportObserver(this); + if (err != KErrNone) + { + return err; + } + + TRAP_IGNORE(GetReportingPeriodL()); + } + + // Set infinite reporting period + TRAPD(err, SetReportingPeriodL(KReportingDuration)); + if (err != KErrNone) + { + return err; + } + + TRequestStatus status(KRequestPending); + + // Start the power consumption notification + iHWRMPower->StartAveragePowerReporting(status, KSampleIntervalMultiple); + User::WaitForRequest(status); + + // Check if monitoring was succesfully started or already ongoing. + if ((status.Int() != KErrNone) && (status.Int() != KErrAlreadyExists)) + { + return status.Int(); + } + + return KErrNone; + } + + // --------------------------------------------------------------------------- + + void CPerfMonPowerListener::DeActivate() + { + if (iHWRMPower != 0) + { + TRAP_IGNORE(iHWRMPower->StopAveragePowerReportingL()); + } + + // Restore original value to max sampling duration + TRAP_IGNORE(SetReportingPeriodL(iOriginalMaxReportingPeriod)); + + iPowerBuffer.Reset(); + iLastPowerAvg = 0; + } + + // --------------------------------------------------------------------------- + + TInt CPerfMonPowerListener::GetPower() + { + TInt avgPower = 0; + TInt newValueCount = iPowerBuffer.Count(); + + if (newValueCount > 0) + { + // Read all new values from buffer and calculate average from them. + for (int i = 0; i < newValueCount; i++) + { + avgPower += iPowerBuffer[i]; + } + avgPower = avgPower / newValueCount; + + iPowerBuffer.Reset(); + iLastPowerAvg = avgPower; + } + else + { + avgPower = iLastPowerAvg; + } + + return avgPower; + } + + // --------------------------------------------------------------------------- + + void CPerfMonPowerListener::PowerMeasurement(TInt aErrCode, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement) + { + if (aErrCode == KErrNone) + { + // Store new value to buffer to wait for reading + TInt value = aMeasurement.iAverageVoltage * aMeasurement.iAverageCurrent; + + // If charger is connected, reported values may be negative. + if (value < 0) + { + value = 0; + } + + iPowerBuffer.Append(value); + + if ( value > iMaxPower ) + { + iMaxPower = value; + } + } + // Ignore any errors + } + + void CPerfMonPowerListener::GetReportingPeriodL() + { + CRepository* cenRep = CRepository::NewL(KCRUidPowerSettings); + + CleanupStack::PushL(cenRep); + User::LeaveIfError(cenRep->Get(KPowerMaxReportingPeriod, iOriginalMaxReportingPeriod)); + CleanupStack::Pop(); + + delete cenRep; + } + + void CPerfMonPowerListener::SetReportingPeriodL(TInt aDuration) + { + CRepository* cenRep = CRepository::NewL(KCRUidPowerSettings); + + CleanupStack::PushL(cenRep); + User::LeaveIfError(cenRep->Set(KPowerMaxReportingPeriod, aDuration)); + CleanupStack::Pop(); + + delete cenRep; + } + +// SYMBIAN_VERSION_SUPPORT < SYMBIAN_3 +#else + + // Stub implementation for older Symbian versions + + CPerfMonPowerListener* CPerfMonPowerListener::NewL() + { + CPerfMonPowerListener* self = new (ELeave) CPerfMonPowerListener(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + CPerfMonPowerListener::CPerfMonPowerListener() : + iHWRMPower(0), + iLastPowerAvg(0), + iMaxPower(0) + { + } + + void CPerfMonPowerListener::ConstructL() + { + } + + CPerfMonPowerListener::~CPerfMonPowerListener() + { + DeActivate(); + } + + TBool CPerfMonPowerListener::IsSupported() + { + return EFalse; + } + + TInt CPerfMonPowerListener::Activate() + { + return KErrNotSupported; + } + + void CPerfMonPowerListener::DeActivate() + { + } + + TInt CPerfMonPowerListener::GetPower() + { + return 0; + } + + void CPerfMonPowerListener::PowerMeasurement(TInt aErrCode, CHWRMPower::TBatteryPowerMeasurementData& aMeasurement) + { + } + +#endif + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/group/ReleaseNotes_PerfMon.txt --- a/perfmon/group/ReleaseNotes_PerfMon.txt Tue Sep 14 21:20:12 2010 +0300 +++ b/perfmon/group/ReleaseNotes_PerfMon.txt Wed Sep 15 12:13:45 2010 +0300 @@ -1,9 +1,9 @@ =============================================================================== -RELEASE NOTES - PERFORMANCE MONITOR v1.0.0 -RELEASED 6th March 2008 +RELEASE NOTES - PERFORMANCE MONITOR v1.2.0 +RELEASED 26th August 2010 -SUPPORTS S60 3.0+ +SUPPORTS S60 5.2+ =============================================================================== @@ -26,9 +26,11 @@ =============================================================================== -What's New in v1.0.0 +What's New in v1.2.0 ==================== -- Initial version +- SMP support +- Added power usage statistics +- Error corrections =============================================================================== @@ -72,6 +74,11 @@ Version History: ================ +Version 1.1.1 - 26th August 2010 +==================== +- Improved Orbit UI +- Error corrections + Version 1.0.0 - 6th March 2008 ------------------------------ - Initial version diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/group/bld.inf --- a/perfmon/group/bld.inf Tue Sep 14 21:20:12 2010 +0300 +++ b/perfmon/group/bld.inf Wed Sep 15 12:13:45 2010 +0300 @@ -15,38 +15,16 @@ * */ - #include -PRJ_EXPORTS -../group/backup_registration.xml Z:/private/20011385/backup_registration.xml -../rom/perfmon.iby CORE_IBY_EXPORT_PATH(tools,perfmon.iby) - +prj_platforms -PRJ_MMPFILES -#if defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__S60_32__) - gnumakefile perfmon_icons_aif.mk +WINSCW GCCE ARMV5 ARMV6 - #ifdef MARM - gnumakefile perfmon_stub_sis.mk - #endif -#endif - -perfmon.mmp +#include "bld_generic.inf" +#include "../ui/avkon/group/bld.inf" -#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) - PRJ_EXTENSIONS - START EXTENSION s60/mifconv - OPTION TARGETFILE perfmon_aif.mif - OPTION SOURCEDIR ../icons - OPTION SOURCES -c8,8 qgn_menu_perfmon - END +prj_mmpfiles - #ifdef MARM - START EXTENSION app-services/buildstubsis - OPTION SRCDIR ../sis - OPTION SISNAME PerfMon_stub - END - #endif -#endif +prj_extensions \ No newline at end of file diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/group/bld_generic.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/group/bld_generic.inf Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +PRJ_EXPORTS +../group/backup_registration.xml Z:/private/20011385/backup_registration.xml +../rom/perfmon.iby CORE_IBY_EXPORT_PATH(tools,perfmon.iby) + +PRJ_MMPFILES +#if defined(__SERIES60_30__) || defined(__SERIES60_31__) || defined(__S60_32__) + gnumakefile perfmon_icons_aif.mk + + #ifdef MARM + gnumakefile perfmon_stub_sis.mk + #endif +#endif + +#if(!defined __SERIES60_30__ && !defined __SERIES60_31__ && !defined __S60_32__) + PRJ_EXTENSIONS + START EXTENSION s60/mifconv + OPTION TARGETFILE perfmon_aif.mif + OPTION SOURCEDIR ../icons + OPTION SOURCES -c8,8 qgn_menu_perfmon + END + + #ifdef MARM + START EXTENSION app-services/buildstubsis + OPTION SRCDIR ../sis + OPTION SISNAME PerfMon_stub + END + #endif +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/group/group.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/group/group.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,22 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = subdirs + +BLD_INF_RULES.prj_platforms += "$${LITERAL_HASH}include \"bld_generic.inf\"" +#TODO: Functionality broken +#BLD_INF_RULES.prj_exports += "../rom/perfmon_datapopup.iby CORE_IBY_EXPORT_PATH(tools,perfmon_datapopup.iby)" \ No newline at end of file diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/group/perfmon.mmp --- a/perfmon/group/perfmon.mmp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include -#include - - -TARGET PerfMon.exe -TARGETTYPE exe -EPOCSTACKSIZE 0x5000 -EPOCHEAPSIZE 0x10000 0x1000000 // Min 64Kb, Max 16Mb - -UID 0x100039CE 0x20011385 - -VENDORID VID_DEFAULT -CAPABILITY WriteDeviceData - -SMPSAFE - -LANG SC - - -START RESOURCE ../data/perfmon.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -END - -START RESOURCE ../data/perfmon_reg.rss -DEPENDS perfmon.rsg -TARGETPATH /private/10003a3f/apps -END - -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE ../inc -SOURCEPATH ../src - - -SOURCE perfmon_app.cpp -SOURCE perfmon_document.cpp -SOURCE perfmon_appui.cpp -SOURCE perfmon_model.cpp -SOURCE perfmon_valuesview.cpp -SOURCE perfmon_valuescontainer.cpp -SOURCE perfmon_graphsview.cpp -SOURCE perfmon_graphscontainer.cpp -SOURCE perfmon_settingsviewdlg.cpp -SOURCE perfmon_datapopupcontainer.cpp - -LIBRARY euser.lib -LIBRARY commonengine.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY eikdlg.lib -LIBRARY avkon.lib -LIBRARY ws32.lib -LIBRARY apgrfx.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY gdi.lib -LIBRARY estor.lib - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon.hrh --- a/perfmon/inc/perfmon.hrh Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_HRH -#define PERFMON_HRH - -enum TPerfMonCommandIds - { - EPerfMonCmdEnableLogging = 1, - EPerfMonCmdDisableLogging, - EPerfMonCmdSettings, - EPerfMonCmdAbout, - - EPerfMonCmdSettingsChange, - EPerfMonCmdSettingsExit, - EPerfMonCmdSettingsBack, - - EPerfMonSettingItemList = 1000 - }; - -enum TPerfMonMainViewTabs - { - ETabMainViewValues = 1, - ETabMainViewGraphs - }; - -enum TPerfMonSettingListTabs - { - ETabSettingsGeneral = 0, - ETabSettingsDataPopup, - ETabSettingsGraphs, - ETabSettingsLogging - }; - -enum TPerfMonSettingListIds - { - ESettingListItemHeartBeat = 0, - ESettingListItemMaxSamples, - ESettingListItemPriority, - ESettingListItemCPUMode, - ESettingListItemKeepBackLightOn, - - ESettingListItemDataPopupVisbility, - ESettingListItemDataPopupLocation, - ESettingListItemDataPopupSources, - - ESettingListItemGraphsVerticalBarPeriod, - ESettingListItemGraphsSources, - - ESettingListItemLoggingMode, - ESettingListItemLoggingFilePath, - ESettingListItemLoggingSources - }; - -enum TPerfMonSettingThreadPriorityTypes - { - EThreadPriorityTypeMuchLess = 0, - EThreadPriorityTypeLess, - EThreadPriorityTypeNormal, - EThreadPriorityTypeMore, - EThreadPriorityTypeMuchMore, - EThreadPriorityTypeRealTime, - EThreadPriorityTypeAbsoluteVeryLow, - EThreadPriorityTypeAbsoluteLow, - EThreadPriorityTypeAbsoluteBackground, - EThreadPriorityTypeAbsoluteForeground, - EThreadPriorityTypeAbsoluteHigh - }; - -enum TPerfMonSettingCPUModes - { - ECPUModeNotSet = -1, - ECPUModeCPUTime, - ECPUModeNOPs - }; - -enum TPerfMonSettingDataPopupVisbilities - { - EDataPopupVisbilityAlwaysOn = 0, - EDataPopupVisbilityBackgroundOnly, - EDataPopupVisbilityAlwaysAlwaysOff - }; - -enum TPerfMonSettingDataPopupLocations - { - EDataPopupLocationTopRight = 0, - EDataPopupLocationBottomMiddle - }; - -enum TPerfMonSettingSources - { - ESourceCPU = 0, - ESourceRAM, - ESourceC, - ESourceD, - ESourceE, - ESourceF, - ESourceG, - ESourceH, - ESourceI, - ESourcesLength // this should be always the last! - }; - -enum TPerfMonSettingLoggingMode - { - ELoggingModeRDebug = 0, - ELoggingModeLogFile, - ELoggingModeRDebugLogFile - }; - -#endif // PERFMON_HRH diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_app.h --- a/perfmon/inc/perfmon_app.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_APP_H -#define PERFMON_APP_H - - -// INCLUDES -#include - -// CONSTANTS -// UID of the application -const TUid KUidPerfMon = { 0x20011385 }; - -// CLASS DECLARATION - -/** -* CPerfMonApp application class. -* Provides factory to create concrete document object. -* -*/ -class CPerfMonApp : public CAknApplication - { - - public: // Functions from base classes - /** - * From CApaApplication, overridden to enable INI file support. - * @return A pointer to the dictionary store - */ - CDictionaryStore* OpenIniFileLC(RFs& aFs) const; - private: - - /** - * From CApaApplication, creates CPerfMonDocument document object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication, returns application's UID (KUidPerfMon). - * @return The value of KUidPerfMon. - */ - TUid AppDllUid() const; - }; - -#endif - -// End of File - diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_appui.h --- a/perfmon/inc/perfmon_appui.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_APPUI_H -#define PERFMON_APPUI_H - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include "perfmon_std.h" - -// FORWARD DECLARATIONS -class CPerfMonModel; -class CAknNavigationControlContainer; -class CAknTabGroup; -class CAknNavigationDecorator; - - -// CLASS DECLARATIONS - -class CPerfMonAppUi : public CAknViewAppUi - { - public: // // Constructors and destructor - - void ConstructL(); - - ~CPerfMonAppUi(); - - public: // New functions - - private: - // From MEikMenuObserver - void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); - - private: - void HandleForegroundEventL(TBool aForeground); - - void HandleCommandL(TInt aCommand); - - void HandleResourceChangeL(TInt aType); - - virtual TKeyResponse HandleKeyEventL( - const TKeyEvent& aKeyEvent,TEventCode aType); - - private: //Data - CPerfMonModel* iModel; - CAknNavigationControlContainer* iNaviPane; - CAknTabGroup* iTabGroup; - CAknNavigationDecorator* iDecoratedTabGroup; - }; - -#endif - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_datapopupcontainer.h --- a/perfmon/inc/perfmon_datapopupcontainer.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_DATAPOPUPCONTAINER_H -#define PERFMON_DATAPOPUPCONTAINER_H - -// INCLUDES -#include - -#include "perfmon_drawcallback.h" - - -// FORWARD DECLARATIONS -class CPerfMonModel; - - -// CLASS DECLARATIONS - -class CPerfMonDataPopupContainer : public CCoeControl, public MDrawUpdateCallback - { -public: - void ConstructL(const TRect& aRect); - ~CPerfMonDataPopupContainer(); - -protected: - void Draw(const TRect& aRect) const; - virtual void SizeChanged(); - -public: - void SetPositionAndSize(); - void UpdateVisibility(TBool aForeground=ETrue); - -public: // from MDrawUpdateCallback - void DrawUpdate(); - -private: - CPerfMonModel* iModel; - RWindowGroup iWindowGroup; - const CFont* iFont; - TInt iFontSize; - }; - -#endif - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_document.h --- a/perfmon/inc/perfmon_document.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_DOCUMENT_H -#define PERFMON_DOCUMENT_H - -// INCLUDES -#include - -// CONSTANTS - -// FORWARD DECLARATIONS -class CEikAppUi; -class CPerfMonModel; - - -// CLASS DECLARATION - -/** -* CPerfMonDocument application class. -*/ -class CPerfMonDocument : public CAknDocument - { - public: // Constructors and destructor - static CPerfMonDocument* NewL(CEikApplication& aApp); - virtual ~CPerfMonDocument(); - - public: // New functions - - public: // from CEikDocument - CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs); - protected: // New functions - - protected: // Functions from base classes - - private: - - /** - * EPOC default constructor. - */ - CPerfMonDocument(CEikApplication& aApp); - void ConstructL(); - - private: - - /** - * From CEikDocument, create CPerfMonAppUi "App UI" object. - */ - CEikAppUi* CreateAppUiL(); - - public: - inline CPerfMonModel* Model() { return iModel; } - - private: - CPerfMonModel* iModel; - - }; - -#endif - -// End of File - diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_drawcallback.h --- a/perfmon/inc/perfmon_drawcallback.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_DRAWCALLBACK_H -#define PERFMON_DRAWCALLBACK_H - -class MDrawUpdateCallback - { -public: - virtual void DrawUpdate() = 0; - }; - -#endif - -// End of File - diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_graphscontainer.h --- a/perfmon/inc/perfmon_graphscontainer.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_GRAPHSCONTAINER_H -#define PERFMON_GRAPHSCONTAINER_H - -// INCLUDES -#include - -#include "perfmon_drawcallback.h" - - -// FORWARD DECLARATIONS -class CPerfMonModel; - - -// CLASS DECLARATIONS - -class CPerfMonGraphsContainer : public CCoeControl, public MDrawUpdateCallback - { -public: - void ConstructL(const TRect& aRect); - ~CPerfMonGraphsContainer(); - -private: - void Draw(const TRect& aRect) const; - void HandleResourceChange(TInt aType); - -public: - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/); - -public: // from MDrawUpdateCallback - void DrawUpdate(); - -private: - CPerfMonModel* iModel; - const CFont* iFont; - }; - -#endif - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_graphsview.h --- a/perfmon/inc/perfmon_graphsview.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_GRAPHSVIEW_H -#define PERFMON_GRAPHSVIEW_H - -// INCLUDES -#include - -#include "perfmon_std.h" - - - -// CONSTANTS -// UID of view -const TUid KGraphsViewUID = {2}; - - -// FORWARD DECLARATIONS -class CPerfMonGraphsContainer; -class CPerfMonModel; - - -// CLASS DECLARATION - -/** -* CPerfMonGraphsView view class. -* -*/ -class CPerfMonGraphsView : public CAknView - { - public: // Constructors and destructor - void ConstructL(); - ~CPerfMonGraphsView(); - - public: // Functions from base classes - TUid Id() const; - void HandleCommandL(TInt aCommand); - void HandleClientRectChange(); - - private: // From MEikMenuObserver - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - - private: // From AknView - void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); - void DoDeactivate(); - - private: // Data - CPerfMonGraphsContainer* iContainer; - CPerfMonModel* iModel; - }; - -#endif - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_model.h --- a/perfmon/inc/perfmon_model.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_MODEL_H -#define PERFMON_MODEL_H - -// INCLUDES -#include -#include -#include -#include - -#include "perfmon.hrh" - - -// setting keys (do not change uids of existing keys to maintain compatibility to older versions!) -const TUid KPMSettingHeartBeat = { 0x00 }; -const TUid KPMSettingMaxSamples = { 0x01 }; -const TUid KPMSettingPriority = { 0x02 }; -const TUid KPMSettingCPUMode = { 0x03 }; -const TUid KPMSettingKeepBackLightOn = { 0x04 }; - -const TUid KPMSettingDataPopupVisbility = { 0x05 }; -const TUid KPMSettingDataPopupLocation = { 0x06 }; -const TUid KPMSettingDataPopupSources = { 0x07 }; - -const TUid KPMSettingGraphsVerticalBarPeriod = { 0x08 }; -const TUid KPMSettingGraphsSources = { 0x09 }; - -const TUid KPMSettingLoggingMode = { 0x0A }; -const TUid KPMSettingLoggingFilePath = { 0x0B }; -const TUid KPMSettingLoggingSources = { 0x0C }; - - - -// FORWARD DECLARATIONS -class CPerfMonValuesContainer; -class CPerfMonGraphsContainer; -class CPerfMonDataPopupContainer; -class CEikonEnv; -class CCoeControl; -class CDictionaryFileStore; - - -// CLASS DECLARATIONS - - -class TPerfMonSources - { -public: - TBool iSrcEnabled[ESourcesLength]; - -public: - inline void SetDefaults1() - { - iSrcEnabled[ESourceCPU] = ETrue; - iSrcEnabled[ESourceRAM] = ETrue; - iSrcEnabled[ESourceC] = ETrue; - iSrcEnabled[ESourceD] = EFalse; - iSrcEnabled[ESourceE] = EFalse; - iSrcEnabled[ESourceF] = EFalse; - iSrcEnabled[ESourceG] = EFalse; - iSrcEnabled[ESourceH] = EFalse; - iSrcEnabled[ESourceI] = EFalse; - } - inline void SetDefaults2() - { - iSrcEnabled[ESourceCPU] = ETrue; - iSrcEnabled[ESourceRAM] = ETrue; - iSrcEnabled[ESourceC] = EFalse; - iSrcEnabled[ESourceD] = EFalse; - iSrcEnabled[ESourceE] = EFalse; - iSrcEnabled[ESourceF] = EFalse; - iSrcEnabled[ESourceG] = EFalse; - iSrcEnabled[ESourceH] = EFalse; - iSrcEnabled[ESourceI] = EFalse; - } - TInt EnabledSourcesCount() - { - TInt srcCount(0); - - for (TInt i=0; i CSampleDataArray; - - -class TSampleEntry - { -public: - TBuf<16> iDescription; - TBuf<16> iUnitTypeShort; //eg. b - TBuf<16> iUnitTypeLong; //eg. bytes - TInt iDriveNumber; //used only for disk drives - TRgb iGraphColor; - CSampleDataArray* iSampleDataArray; - }; - -typedef CArrayFixSeg CSampleEntryArray; - - - -class CPerfMonModel : public CActive - { -private: - enum TContainerDrawState - { - EDrawStateInvalid = -1, - EDrawStateValues, - EDrawStateGraphs - }; - -public: - static CPerfMonModel* NewL(); - ~CPerfMonModel(); - void ActivateModelL(); - void DeActivateModelL(); - void EnableLogging(TBool aEnable); - -private: - void RunL(); - void DoCancel(); - -private: - CPerfMonModel(); - void ConstructL(); - void LoadSettingsL(); - void SaveSettingsL(); - void HandleSettingsChangeL(); - void OpenLogFile(TBool aOpen); - void SendDrawEventToContainersL(); - void CreateSamplesDataArrayL(); - void UpdateSamplesDataL(); - void AppendLatestSamplesToLogsL(); - void ActivateCPUMonitoringL(); - TBool OpenHandleToNullThread(); - void DeActivateCPUMonitoring(); - TBool CPUTimeSupported(); - TThreadPriority SettingItemToThreadPriority(TInt aIndex); - void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue); - void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue); - void LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TPerfMonSources& aValue); - void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TInt& aValue); - void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TDes& aValue); - void SaveDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, const TPerfMonSources& aValue); - -public: - void SetValuesContainer(CPerfMonValuesContainer* aValuesContainer); - void SetGraphsContainer(CPerfMonGraphsContainer* aGraphsContainer); - TInt LaunchSettingsDialogL(); - - inline TPerfMonSettings& Settings() { return iSettings; } - inline CEikonEnv* EikonEnv() { return iEnv; } - inline RApaLsSession& LsSession() { return iLs; } - - inline CPerfMonValuesContainer* ValuesContainer() { return iValuesContainer; } - inline CPerfMonGraphsContainer* GraphsContainer() { return iGraphsContainer; } - inline CPerfMonDataPopupContainer* DataPopupContainer() { return iDataPopupContainer; } - - - inline CSampleEntryArray* SampleEntryArray() { return iSampleEntryArray; } - -private: - RTimer iTimer; - CPerfMonValuesContainer* iValuesContainer; - CPerfMonGraphsContainer* iGraphsContainer; - CPerfMonDataPopupContainer* iDataPopupContainer; - CEikonEnv* iEnv; - TPerfMonSettings iSettings; - RApaLsSession iLs; - TInt iDrawState; - CSampleEntryArray* iSampleEntryArray; - TTime iStartTime; - - TInt iCurrentCPUMode; - - RThread iNullThread; - RThread iCPULoadThread; - TBool iCPULoadCalibrating; - TInt iCPULoadCalibrationCounter; - TInt64 iCPULoadMaxValue; - TInt64 iCPULoadPreviousValue; - TInt64 iCPULoadCounter; - TTime iPreviousTime; - - TBool iLogFileInitialized; - RFile iLogFile; - }; - - -#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_settingsviewdlg.h --- a/perfmon/inc/perfmon_settingsviewdlg.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_SETTINGSVIEWDLG_H -#define PERFMON_SETTINGSVIEWDLG_H - -// INCLUDES -#include -#include -#include -#include -#include -#include - -#include "perfmon_model.h" - - -// FORWARD DECLARATIONS -class CAknSettingItemArray; -class CAknSettingStyleListBox; -class CAknNavigationControlContainer; -class CAknNavigationDecorator; -class CAknTabGroup; -class TPerfMonSettings; -class CSelectionItemList; - - -// CLASS DEFINITIONS - -class CPerfMonSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver - { -public: - static CPerfMonSettingsViewDlg* NewL(TPerfMonSettings& aSettings); - virtual ~CPerfMonSettingsViewDlg(); - -public: // From MEikListBoxObserver - void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); - -public: // From MAknTabObserver - void TabChangedL(TInt aIndex); - -public: // From CAknDialog - void ProcessCommandL(TInt aCommandId); - -protected: // From CEikDialog - TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); - void PreLayoutDynInitL(); - TBool OkToExitL(TInt aButtonId); - -private: // New methods - void ShowSettingPageL(TBool aCalledFromMenu); - void SetVisibilitiesOfSettingItemsL(); - void UpdateListBoxL(); - void AddSettingItemL(TInt aId, TInt aTitleResource, TInt aSettingPageResource, TInt aAssociatedResource, TInt aOrdinal); - -private: // Constructors - CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings); - void ConstructL(); - -private: // Data - CAknSettingItemArray* iSettingItemArray; - CAknSettingStyleListBox* iListBox; - CAknNavigationControlContainer* iNaviContainer; - CAknNavigationDecorator* iDecoratedTabGroup; - CAknTabGroup* iTabGroup; - TPerfMonSettings& iSettings; - }; - - -class CSourceSelectionCheckBoxSettingItem : public CAknSettingItem - { -public: - CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse ); - virtual ~CSourceSelectionCheckBoxSettingItem(); - -protected: - void CompleteConstructionL(); - void StoreL(); - void LoadL(); - const TDesC& SettingTextL(); - void EditItemL( TBool aCalledFromMenu ); - void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ); - -private: - void AddNewItemToArrayL(const TDesC& aLabel); - -private: - CSelectionItemList* iItemArray; - HBufC* iSettingText; - TPerfMonSources& iExternalSources; - }; - - -class CSourceSelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage - { - public: - CSourceSelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray ); - public: // New functions - void UpdateCba(); - }; - - -#endif - -// End of File - diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_std.h --- a/perfmon/inc/perfmon_std.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_STD_H -#define PERFMON_STD_H - - - -#endif - -// End of File - diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_valuescontainer.h --- a/perfmon/inc/perfmon_valuescontainer.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_VALUESCONTAINER_H -#define PERFMON_VALUESCONTAINER_H - -// INCLUDES -#include - -#include "perfmon_drawcallback.h" - - -// FORWARD DECLARATIONS -class CPerfMonModel; - - -// CLASS DECLARATIONS - -class CPerfMonValuesContainer : public CCoeControl, public MDrawUpdateCallback - { -public: - void ConstructL(const TRect& aRect); - ~CPerfMonValuesContainer(); - -private: - void Draw(const TRect& aRect) const; - void HandleResourceChange(TInt aType); - -public: - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/); - -public: // from MDrawUpdateCallback - void DrawUpdate(); - -private: - CPerfMonModel* iModel; - const CFont* iFont; - }; - -#endif - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/inc/perfmon_valuesview.h --- a/perfmon/inc/perfmon_valuesview.h Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef PERFMON_VALUESVIEW_H -#define PERFMON_VALUESVIEW_H - -// INCLUDES -#include - -#include "perfmon_std.h" - - - -// CONSTANTS -// UID of view -const TUid KValuesViewUID = {1}; - - -// FORWARD DECLARATIONS -class CPerfMonValuesContainer; -class CPerfMonModel; - - -// CLASS DECLARATION - -/** -* CPerfMonValuesView view class. -* -*/ -class CPerfMonValuesView : public CAknView - { - public: // Constructors and destructor - void ConstructL(); - ~CPerfMonValuesView(); - - public: // Functions from base classes - TUid Id() const; - void HandleCommandL(TInt aCommand); - void HandleClientRectChange(); - - private: // From MEikMenuObserver - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - - private: // From AknView - void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); - void DoDeactivate(); - - private: // Data - CPerfMonValuesContainer* iContainer; - CPerfMonModel* iModel; - }; - -#endif - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/perfmon.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/perfmon.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,25 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = subdirs + +DEFINES += QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT QT_NO_DEBUG + +SUBDIRS = group \ + #TODO: Functionality broken + #ui/hb/datapopup \ + ui/hb/app diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/rom/perfmon.iby --- a/perfmon/rom/perfmon.iby Tue Sep 14 21:20:12 2010 +0300 +++ b/perfmon/rom/perfmon.iby Wed Sep 15 12:13:45 2010 +0300 @@ -22,11 +22,8 @@ S60_APP_EXE(PerfMon) S60_APP_AIF_ICONS(PerfMon) S60_APP_RESOURCE(PerfMon) -#ifdef S60_UPGRADABLE_APP_REG_RSC - S60_UPGRADABLE_APP_REG_RSC(PerfMon) -#else - S60_APP_AIF_RSC(PerfMon) -#endif +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,PerfMon) +data=ZPRIVATE\10003a3f\import\APPS\PerfMon_reg.RSC Private\10003a3f\import\Apps\PerfMon_reg.rsc data=ZPRIVATE\20011385\backup_registration.xml private\20011385\backup_registration.xml data=ZSYSTEM\Install\PerfMon_stub.sis \system\install\PerfMon_stub.sis diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/rom/perfmon_datapopup.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/rom/perfmon_datapopup.iby Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef __PERFMON_DATAPOPUP_IBY__ +#define __PERFMON_DATAPOPUP_IBY__ + +file=ABI_DIR\BUILD_DIR\PerfMonDataPopupPlugin.dll SHARED_LIB_DIR\PerfMonDataPopupPlugin.dll +data=DATAZ_\resource\plugins\devicedialogs\PerfMonDataPopupPlugin.qtplugin resource\plugins\devicedialogs\PerfMonDataPopupPlugin.qtplugin + +#endif // __PERFMON_DATAPOPUP_IBY__ diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_app.cpp --- a/perfmon/src/perfmon_app.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon_app.h" -#include "perfmon_document.h" - -#include - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CPerfMonApp::AppDllUid() -// Returns application UID -// --------------------------------------------------------- -// -TUid CPerfMonApp::AppDllUid() const - { - return KUidPerfMon; - } - -// --------------------------------------------------------- -// CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const -// overrides CAknApplication::OpenIniFileLC to enable INI file support -// --------------------------------------------------------- -// -CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const - { - return CEikApplication::OpenIniFileLC(aFs); - } - -// --------------------------------------------------------- -// CPerfMonApp::CreateDocumentL() -// Creates CPerfMonDocument object -// --------------------------------------------------------- -// -CApaDocument* CPerfMonApp::CreateDocumentL() - { - return CPerfMonDocument::NewL( *this ); - } - -// ================= OTHER EXPORTED FUNCTIONS ============== - -LOCAL_C CApaApplication* NewApplication() - { - return new CPerfMonApp; - } - - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - - -// End of File - diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_appui.cpp --- a/perfmon/src/perfmon_appui.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,228 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon_appui.h" -#include "perfmon_valuesview.h" -#include "perfmon_graphsview.h" -#include "perfmon_datapopupcontainer.h" -#include "perfmon.hrh" -#include "perfmon_model.h" -#include "perfmon_document.h" -#include - -#include -#include -#include - - -// ================= MEMBER FUNCTIONS ======================= - -// -------------------------------------------------------------------------------------------- - -void CPerfMonAppUi::ConstructL() - { - // disable window server priority control for this application - iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); - - // set as system application to prevent getting shut down events - iEikonEnv->SetSystem(ETrue); - - BaseConstructL(EAknEnableSkin); - - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - - // Show tabs for main views from resources - CEikStatusPane* sp = StatusPane(); - - // Fetch pointer to the default navi pane control - iNaviPane = (CAknNavigationControlContainer*)sp->ControlL( - TUid::Uid(EEikStatusPaneUidNavi)); - - // Tabgroup has been read from resource and it were pushed to the navi pane. - // Get pointer to the navigation decorator with the ResourceDecorator() function. - // Application owns the decorator and it has responsibility to delete the object. - iDecoratedTabGroup = iNaviPane->ResourceDecorator(); - if (iDecoratedTabGroup) - { - iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl(); - } - - CPerfMonValuesView* valuesView = new(ELeave) CPerfMonValuesView; - CleanupStack::PushL(valuesView); - valuesView->ConstructL(); - AddViewL(valuesView); // transfer ownership to CAknViewAppUi - CleanupStack::Pop(); // valuesView - - CPerfMonGraphsView* graphsView = new(ELeave) CPerfMonGraphsView; - CleanupStack::PushL(graphsView); - graphsView->ConstructL(); - AddViewL(graphsView); // transfer ownership to CAknViewAppUi - CleanupStack::Pop(); // graphsView - - // set the default view - SetDefaultViewL(*valuesView); - - // notify the model that everything has been constructed - iModel->ActivateModelL(); - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonAppUi::~CPerfMonAppUi() - { - // notify the model that the application is closing - if (iModel) - TRAP_IGNORE(iModel->DeActivateModelL()); - - delete iDecoratedTabGroup; - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) - { - if (aResourceId == R_PERFMON_APP_MENU) - { - aMenuPane->SetItemDimmed(EPerfMonCmdEnableLogging, iModel->Settings().iLoggingEnabled); - aMenuPane->SetItemDimmed(EPerfMonCmdDisableLogging, !iModel->Settings().iLoggingEnabled); - } - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CPerfMonAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/) - { - if ( iTabGroup == NULL ) - { - return EKeyWasNotConsumed; - } - - TInt active = iTabGroup->ActiveTabIndex(); - TInt count = iTabGroup->TabCount(); - - switch ( aKeyEvent.iCode ) - { - case EKeyLeftArrow: - if (active > 0) - { - active--; - iTabGroup->SetActiveTabByIndex( active ); - ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active))); - } - break; - case EKeyRightArrow: - if((active + 1) < count) - { - active++; - iTabGroup->SetActiveTabByIndex( active ); - ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active))); - } - break; - default: - return EKeyWasNotConsumed; - } - - return EKeyWasConsumed; - } - - -// -------------------------------------------------------------------------------------------- - -void CPerfMonAppUi::HandleCommandL(TInt aCommand) - { - switch ( aCommand ) - { - case EPerfMonCmdEnableLogging: - { - iModel->EnableLogging(ETrue); - break; - } - - case EPerfMonCmdDisableLogging: - { - iModel->EnableLogging(EFalse); - break; - } - - case EPerfMonCmdSettings: - { - if (iModel->LaunchSettingsDialogL() == EAknCmdExit) - Exit(); - break; - } - - case EPerfMonCmdAbout: - { - CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; - dialog->ExecuteLD(R_PERFMON_ABOUT_DIALOG); - } - break; - - // a normal way to close an application - case EAknCmdExit: - case EEikCmdExit: - case EAknSoftkeyExit: - { - Exit(); - } - break; - - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonAppUi::HandleForegroundEventL(TBool aForeground) - { - // handle visibility of the data popup container - if (iModel && iModel->DataPopupContainer()) - { - iModel->DataPopupContainer()->UpdateVisibility(aForeground); - } - - // call the base class - CAknAppUi::HandleForegroundEventL(aForeground); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonAppUi::HandleResourceChangeL(TInt aType) - { - CAknAppUi::HandleResourceChangeL(aType); - - // update size of the data popup container (implemented here because data popup container - // does not get HandleResourceChangeL events) - if (aType == KEikDynamicLayoutVariantSwitch) - { - if (iModel) - { - if (iModel->DataPopupContainer()) - { - iModel->DataPopupContainer()->SetPositionAndSize(); - } - - } - } - } - -// -------------------------------------------------------------------------------------------- - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_datapopupcontainer.cpp --- a/perfmon/src/perfmon_datapopupcontainer.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon_datapopupcontainer.h" -#include "perfmon.hrh" -#include "perfmon_document.h" -#include "perfmon_appui.h" -#include "perfmon_model.h" - -#include - -_LIT(KPercentageFormat,"%S %d%%"); -_LIT(KFreeFormat,"%S free %S%S"); - -const TInt KLeftMargin = 2; - - -// ===================================== MEMBER FUNCTIONS ===================================== - -void CPerfMonDataPopupContainer::ConstructL(const TRect& /*aRect*/) - { - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - iFont = LatinPlain12(); - iFontSize = iFont->FontMaxHeight(); - - // set windowgroup so that it always on top and does not receive focus - iWindowGroup = RWindowGroup(iCoeEnv->WsSession()); - User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup)); - iWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); - iWindowGroup.EnableReceiptOfFocus(EFalse); - - CreateWindowL(&iWindowGroup); - //SetRect(aRect); - SetPositionAndSize(); - SetBlank(); - - ActivateL(); - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonDataPopupContainer::~CPerfMonDataPopupContainer() - { - iWindowGroup.Close(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonDataPopupContainer::Draw(const TRect& aRect) const - { - CWindowGc& gc = SystemGc(); - gc.SetBrushColor(KRgbWhite); - gc.Clear(aRect); - - // check if sample array has been constructed - if (iModel->SampleEntryArray()) - { - // init font - gc.SetPenColor(KRgbBlack); - gc.UseFont( iFont ); - - // draw a rect around the popup - gc.DrawRect(aRect); - - TInt posCounter(1); - - for (TInt i=0; iSampleEntryArray()->Count(); i++) - { - // check if this setting has been enabled and it has some data - if (iModel->Settings().iDataPopupSources.iSrcEnabled[i] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) - { - TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0); - TBuf<32> buf; - - // for CPU draw %, other amount of free memory - if (i == ESourceCPU) - { - buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 ); - gc.DrawText(buf, TPoint(KLeftMargin, iFontSize*posCounter)); - } - else - { - TBuf<32> freeBuf; - freeBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0)); - - TBuf<32> buf; - buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &freeBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort); - gc.DrawText(buf, TPoint(KLeftMargin, iFontSize*posCounter)); - } - - posCounter++; - } - } - - gc.DiscardFont(); - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonDataPopupContainer::SizeChanged() - { - DrawNow(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonDataPopupContainer::SetPositionAndSize() - { - CWsScreenDevice* screenDevice = iEikonEnv->ScreenDevice(); - - // top right - if (iModel->Settings().iDataPopupLocation == EDataPopupLocationTopRight) - { - // screen orientation is landscape with softkeys on right - if (AknLayoutUtils::CbaLocation()==AknLayoutUtils::EAknCbaLocationRight) - { - SetRect( - TRect( - screenDevice->SizeInPixels().iWidth-102-15, - 0, - screenDevice->SizeInPixels().iWidth-15, - iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + 3 - )); - } - - // any other orientation - else - { - SetRect( - TRect( - screenDevice->SizeInPixels().iWidth-102, - 0, - screenDevice->SizeInPixels().iWidth, - iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + 3 - )); - } - } - - // bottom middle - else if (iModel->Settings().iDataPopupLocation == EDataPopupLocationBottomMiddle) - { - SetRect( - TRect( - screenDevice->SizeInPixels().iWidth/2-102/2, - screenDevice->SizeInPixels().iHeight - iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize - 3, - screenDevice->SizeInPixels().iWidth/2+102/2, - screenDevice->SizeInPixels().iHeight - )); - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonDataPopupContainer::UpdateVisibility(TBool aForeground) - { - // application has been brought to foregound - if (aForeground) - { - if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn) - { - MakeVisible(ETrue); - } - else - { - MakeVisible(EFalse); - } - } - - // application has been sent to background - else - { - if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn - || iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityBackgroundOnly) - { - MakeVisible(ETrue); - } - else - { - MakeVisible(EFalse); - } - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonDataPopupContainer::DrawUpdate() - { - DrawDeferred(); - } - -// -------------------------------------------------------------------------------------------- - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_document.cpp --- a/perfmon/src/perfmon_document.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon_document.h" -#include "perfmon_appui.h" -#include "perfmon_model.h" - -// ================= MEMBER FUNCTIONS ======================= - -// constructor -CPerfMonDocument::CPerfMonDocument(CEikApplication& aApp) -: CAknDocument(aApp) - { - } - -// ---------------------------------------------------- - -// destructor -CPerfMonDocument::~CPerfMonDocument() - { - delete iModel; - } - -// ---------------------------------------------------- - -// EPOC default constructor can leave. -void CPerfMonDocument::ConstructL() - { - iModel = CPerfMonModel::NewL(); - } - -// ---------------------------------------------------- - -// Two-phased constructor. -CPerfMonDocument* CPerfMonDocument::NewL(CEikApplication& aApp) - { - CPerfMonDocument* self = new(ELeave) CPerfMonDocument(aApp); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - } - -// ---------------------------------------------------- -// CPerfMonDocument::CreateAppUiL() -// constructs CPerfMonAppUi -// ---------------------------------------------------- -// -CEikAppUi* CPerfMonDocument::CreateAppUiL() - { - return new (ELeave) CPerfMonAppUi; - } - -// ---------------------------------------------------- -// CPerfMonDocument::OpenFileL -// Overrides CAknDocument::OpenFileL to support document file -// ---------------------------------------------------- -// -CFileStore* CPerfMonDocument::OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs) - { - return CEikDocument::OpenFileL(aDoOpen, aFilename, aFs); - } - -// ---------------------------------------------------- - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_graphscontainer.cpp --- a/perfmon/src/perfmon_graphscontainer.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,233 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon_graphscontainer.h" -#include "perfmon.hrh" -#include "perfmon_document.h" -#include "perfmon_appui.h" -#include "perfmon_model.h" - -#include - -const TInt KAmountOfMicroSecondsFitsScreen = 20 * 1000000; -#define KRgbCustomGrey TRgb(0x808080) - -_LIT(K100p, "100%"); -_LIT(K50p, "50%"); -_LIT(K0p, "0%"); - -_LIT(KPercentageFormat,"%S %d%%"); - -const TInt KMicroToSecondMultiplier = 1000000; - -// ===================================== MEMBER FUNCTIONS ===================================== - -void CPerfMonGraphsContainer::ConstructL(const TRect& aRect) - { - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - //iFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont); - iFont = LatinBold12(); - - CreateWindowL(); - SetRect(aRect); - SetBlank(); - - ActivateL(); - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonGraphsContainer::~CPerfMonGraphsContainer() - { - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonGraphsContainer::Draw(const TRect& aRect) const - { - // draw black background - CWindowGc& gc = SystemGc(); - gc.SetBrushColor(KRgbBlack); - gc.Clear(aRect); - - // activate font and get size - gc.UseFont(iFont); - TUint fontSize = iFont->FontMaxHeight(); - //TInt fontBaseOffset = iFont->DescentInPixels(); - - - // calculate time factor - TReal scaleFactor = (TReal) aRect.Width() / (TReal) KAmountOfMicroSecondsFitsScreen; - - // calculate area height which is used to draw the grpahs - TInt drawAreaHeight = aRect.Height() - fontSize - fontSize; - - - // check if sample array has been constructed - if (iModel->SampleEntryArray()) - { - - // draw vertical time lines first - TInt verticalBarPeriodInSecs = iModel->Settings().iGraphsVerticalBarPeriod; - - if (verticalBarPeriodInSecs >= 1 && iModel->SampleEntryArray()->At(0).iSampleDataArray->Count() > 0) - { - // get time from the first sample - TSampleData& firstSample = iModel->SampleEntryArray()->At(0).iSampleDataArray->At(0); - TInt64 currentMicroSeconds = firstSample.iTimeFromStart.Int64(); - - // calculate amount of microseconds exceeding value by using the modulo operator - TInt remainderInMicroSeconds = currentMicroSeconds % (verticalBarPeriodInSecs * 1000000); - - // calculate first x pos - TInt vbarXpos = aRect.Width() - (remainderInMicroSeconds * scaleFactor); - - // calculate the amount in seconds - TInt barSeconds = (currentMicroSeconds - remainderInMicroSeconds) / KMicroToSecondMultiplier; - - - // continue drawing periodically the vertical lines - while (vbarXpos >= 0 && barSeconds >= 0) - { - // draw vertical line - gc.SetPenColor(KRgbDarkRed); - gc.DrawLine(TPoint(vbarXpos,fontSize+1), TPoint(vbarXpos,aRect.Height()-fontSize)); - - // draw seconds value - gc.SetPenColor(KRgbCustomGrey); - TBuf<16> secsBuf; - secsBuf.AppendNum(barSeconds); - secsBuf.Append(_L("s")); - gc.DrawText(secsBuf, TPoint(vbarXpos-(iFont->TextWidthInPixels(secsBuf)/2), aRect.Height())); - - // calculate new position - vbarXpos -= verticalBarPeriodInSecs * 1000000 * scaleFactor; - barSeconds -= verticalBarPeriodInSecs; - } - } - - // draw the basic grid - gc.SetPenColor(KRgbCustomGrey); - - gc.DrawLine(TPoint(0,fontSize), TPoint(aRect.Width(),fontSize)); // upper line - gc.DrawText(K100p, TPoint(0,fontSize)); - - gc.DrawLine(TPoint(0,aRect.Height()/2), TPoint(aRect.Width(),aRect.Height()/2)); // mid line - gc.DrawText(K50p, TPoint(0,aRect.Height()/2)); - - gc.DrawLine(TPoint(0,aRect.Height()-fontSize), TPoint(aRect.Width(),aRect.Height()-fontSize)); // bottom line - gc.DrawText(K0p, TPoint(0,aRect.Height()-fontSize)); - - TInt c(0); - - // draw graphs for each sampled type - for (TInt i=0; iSampleEntryArray()->Count(); i++) - { - // check if this setting has been enabled and it has some data - if (iModel->Settings().iGraphsSources.iSrcEnabled[i] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) - { - // set pen color for the graph - gc.SetPenColor(iModel->SampleEntryArray()->At(i).iGraphColor); - - // remember the position where drawing started - /*TReal*/TInt currentXPos(aRect.Width()); // start drawing from right - /*TReal*/TInt currentYPos(0); - - // draw samples - for (TInt j=0; jSampleEntryArray()->At(i).iSampleDataArray->Count() - 1; j++) - { - TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j); - TSampleData& previousSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j+1); - - // calculate X position for previous (j+1) - /*TReal*/TInt previousXPos = currentXPos - - ( (Abs(previousSample.iTimeFromStart.Int64() - currentSample.iTimeFromStart.Int64())) * scaleFactor ); - - - // calculate initial Y position - if (j==0) - { - currentYPos = currentSample.iSize > 0 ? (TReal)(currentSample.iFree) / (TReal)currentSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize; - } - - // calculate Y position for previous (j+1) - /*TReal*/TInt previousYPos = previousSample.iSize > 0 ? (TReal)(previousSample.iFree) / (TReal)previousSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize; - - - // draw a line between the previous and current - gc.DrawLine(TPoint((TInt)previousXPos,(TInt)previousYPos), TPoint((TInt)currentXPos,(TInt)currentYPos)); - - - // draw current value in % - if (j==0) // draw the value of first sample - { - TBuf<16> buf; - buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 ); - - gc.DrawText(buf, TPoint(0,fontSize+fontSize+c*fontSize)); - c++; - } - - - // stop drawing if we have run out of space - if (previousXPos < 0) - break; - - // remeber previous values - currentXPos = previousXPos; - currentYPos = previousYPos; - } - } - } - } - - gc.DiscardFont(); - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CPerfMonGraphsContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) - { - return CCoeControl::OfferKeyEventL(aKeyEvent, aType); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonGraphsContainer::HandleResourceChange(TInt aType) - { - if (aType == KEikDynamicLayoutVariantSwitch) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); - SetRect(mainPaneRect); - } - else - CCoeControl::HandleResourceChange(aType); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonGraphsContainer::DrawUpdate() - { - DrawDeferred(); - } - -// -------------------------------------------------------------------------------------------- - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_graphsview.cpp --- a/perfmon/src/perfmon_graphsview.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon.hrh" -#include "perfmon_graphsview.h" -#include "perfmon_graphscontainer.h" -#include "perfmon_document.h" -#include "perfmon_model.h" -#include - -#include -#include - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CPerfMonGraphsView::ConstructL(const TRect& aRect) -// EPOC two-phased constructor -// --------------------------------------------------------- -// -void CPerfMonGraphsView::ConstructL() - { - BaseConstructL( R_PERFMON_VIEW_GRAPHS ); - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - } - -// --------------------------------------------------------- -// CPerfMonGraphsView::~CPerfMonGraphsView() -// --------------------------------------------------------- -// -CPerfMonGraphsView::~CPerfMonGraphsView() - { - if (iContainer) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -// --------------------------------------------------------- -// TUid CPerfMonGraphsView::Id() -// --------------------------------------------------------- -// -TUid CPerfMonGraphsView::Id() const - { - return KGraphsViewUID; - } - -// --------------------------------------------------------- -// TUid CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) -// --------------------------------------------------------- -// -void CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) - { - AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane); - } - - -// --------------------------------------------------------- -// CPerfMonGraphsView::HandleCommandL(TInt aCommand) -// --------------------------------------------------------- -// -void CPerfMonGraphsView::HandleCommandL(TInt aCommand) - { -/* - switch ( aCommand ) - { - case EPerfMonCmdFileBack: - { - iModel->FileUtils()->MoveUpOneLevelL(); - break; - } - - default: - { -*/ - AppUi()->HandleCommandL( aCommand ); -/* - break; - } - } -*/ - } - -// --------------------------------------------------------- -// CPerfMonGraphsView::HandleClientRectChange() -// --------------------------------------------------------- -// -void CPerfMonGraphsView::HandleClientRectChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -// --------------------------------------------------------- -// CPerfMonGraphsView::DoActivateL(...) -// --------------------------------------------------------- -// -void CPerfMonGraphsView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - if (!iContainer) - { - iContainer = new (ELeave) CPerfMonGraphsContainer; - iModel->SetGraphsContainer(iContainer); - iContainer->SetMopParent(this); - iContainer->ConstructL( ClientRect() ); - AppUi()->AddToStackL( *this, iContainer ); - } - } - -// --------------------------------------------------------- -// CPerfMonGraphsView::DoDeactivate() -// --------------------------------------------------------- -// -void CPerfMonGraphsView::DoDeactivate() - { - if (iContainer) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_model.cpp --- a/perfmon/src/perfmon_model.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,951 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES - -#include "perfmon_model.h" -#include "perfmon_app.h" -#include "perfmon_settingsviewdlg.h" -#include "perfmon.hrh" -#include "perfmon_valuescontainer.h" -#include "perfmon_graphscontainer.h" -#include "perfmon_datapopupcontainer.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -_LIT(KAppName, "PerfMon"); -_LIT(KDefaultLogFilePath, "c:\\data\\PerfMon.log"); - -const TInt KCalibrationLength = 2; -const TInt KMinimumSamplesLength = 16; -const TInt KCPUTimeMultiplier = 1000000; // used to avoid TReal conversions - -const TInt KSettingsDrive = EDriveC; -_LIT(KSettingsFileName, "perfmon_settings.ini"); - - -// -------------------------------------------------------------------------------------------- - -TInt CPULoadCount(TAny* aInt) - { - // increase the counter - (*(TUint*)aInt)++; - return 1; - } - -TInt CPULoadNOPThread(TAny* aParam) - { - CTrapCleanup* pC = CTrapCleanup::New(); - CActiveScheduler* pS = new CActiveScheduler; - CActiveScheduler::Install(pS); - - CIdle* idle = CIdle::NewL(CActive::EPriorityStandard); - TCallBack cb(CPULoadCount, aParam); - idle->Start(cb); - - pS->Start(); - - delete idle; - delete pS; - delete pC; - - return 0; - } - -// ===================================== MEMBER FUNCTIONS ===================================== - -CPerfMonModel* CPerfMonModel::NewL() - { - CPerfMonModel* self = new(ELeave) CPerfMonModel; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonModel::CPerfMonModel() : CActive(EPriorityUserInput) - { - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::ConstructL() - { - iDrawState = EDrawStateInvalid; - iCurrentCPUMode = ECPUModeNotSet; - iLogFileInitialized = EFalse; - - iEnv = CEikonEnv::Static(); - User::LeaveIfError(iLs.Connect()); - - User::LeaveIfError(iTimer.CreateLocal()); - CActiveScheduler::Add(this); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::ActivateModelL() - { - // load settings - TRAP_IGNORE(LoadSettingsL()); - - // create data storages for the samples - CreateSamplesDataArrayL(); - - // initialize the data popup container in top-right corner - iDataPopupContainer = new(ELeave) CPerfMonDataPopupContainer; - iDataPopupContainer->ConstructL(TRect(0,0,1,1)); - - // set default modes - HandleSettingsChangeL(); - - // start sampling data immediately (jump to RunL) - iTimer.After(iStatus, 100); - SetActive(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::DeActivateModelL() - { - Cancel(); - - DeActivateCPUMonitoring(); - - if (iDataPopupContainer) - { - delete iDataPopupContainer; - iDataPopupContainer = NULL; - } - - // close log file - OpenLogFile(EFalse); - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonModel::~CPerfMonModel() - { - iTimer.Close(); - - // clear data storages - if (iSampleEntryArray) - { - for (TInt i=0; iCount(); i++) - { - delete iSampleEntryArray->At(i).iSampleDataArray; - } - - delete iSampleEntryArray; - } - - - iLs.Close(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::DoCancel() - { - iTimer.Cancel(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::RunL() - { - // calculate new values - UpdateSamplesDataL(); - - // log changes - AppendLatestSamplesToLogsL(); - - // redraw views - SendDrawEventToContainersL(); - - // continue - iTimer.After(iStatus, iSettings.iHeartBeat * 1000); // convert from milliseconds to microseconds - SetActive(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::HandleSettingsChangeL() - { - // set priority of the thread - RThread().SetPriority(SettingItemToThreadPriority(iSettings.iPriority)); - - // set visibility and location of the data popup - iDataPopupContainer->UpdateVisibility(); - iDataPopupContainer->SetPositionAndSize(); - - // init cpu monitor if setting has been changed - if (iCurrentCPUMode != iSettings.iCPUMode) - { - DeActivateCPUMonitoring(); - ActivateCPUMonitoringL(); - } - - // close log file - OpenLogFile(EFalse); - - // enable log file - if (iSettings.iLoggingEnabled && (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile)) - OpenLogFile(ETrue); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::EnableLogging(TBool aEnable) - { - if (aEnable) - { - if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) - OpenLogFile(ETrue); - - iSettings.iLoggingEnabled = ETrue; - } - else // disable - { - iSettings.iLoggingEnabled = EFalse; - OpenLogFile(EFalse); - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::OpenLogFile(TBool aOpen) - { - // open log file for writing - if (aOpen) - { - if (!iLogFileInitialized) - { - TInt err(KErrNone); - - // open the log file for writing - if (iLogFile.Open(iEnv->FsSession(), iSettings.iLoggingFilePath, EFileWrite) != KErrNone) - { - iEnv->FsSession().MkDirAll(iSettings.iLoggingFilePath); - err = iLogFile.Replace(iEnv->FsSession(), iSettings.iLoggingFilePath, EFileWrite); - } - else - { - // file opens correctly, seek to the end - TInt fileSize=0; - iLogFile.Size(fileSize); - err = iLogFile.Seek(ESeekCurrent, fileSize); - } - - if (err == KErrNone) - { - iLogFileInitialized = ETrue; - } - else - { - // show error - CAknErrorNote* note = new(ELeave) CAknErrorNote(); - note->ExecuteLD(_L("Unable to create log file, check settings")); - } - } - } - - // close handle to log file - else - { - if (iLogFileInitialized) - { - iLogFile.Flush(); - iLogFile.Close(); - - iLogFileInitialized = EFalse; - } - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::ActivateCPUMonitoringL() - { - // reset counter variables - iCPULoadCalibrating = ETrue; - iCPULoadCalibrationCounter = 0; - iCPULoadMaxValue = 999999999; - iCPULoadPreviousValue = 1; - iCPULoadCounter = 0; - - // use null thread is cpu time is supported and the setting is on - if (CPUTimeSupported() && iSettings.iCPUMode == ECPUModeCPUTime) - { - // try to open handle to null thread - if (OpenHandleToNullThread()) - { - // handle is open, get initial value - TTimeIntervalMicroSeconds time; - iNullThread.GetCpuTime(time); - iCPULoadPreviousValue = time.Int64(); - iPreviousTime.HomeTime(); - - iCurrentCPUMode = ECPUModeCPUTime; - return; // cpu time is succesfully in use - } - } - - // otherwise use normal sampling with nops - iCurrentCPUMode = ECPUModeNotSet; - - // show a warning if cpu time cannot be taken in use - if (iSettings.iCPUMode == ECPUModeCPUTime) - { - CAknInformationNote* note = new(ELeave) CAknInformationNote(); - note->ExecuteLD(_L("CPU Time not supported in this system, using NOPs sampling")); - } - - // create a thread for CPU load monitoring - User::LeaveIfError(iCPULoadThread.Create(_L("PerfMonCPULoad"), CPULoadNOPThread, 0x1000, 0x1000, 0x100000, &iCPULoadCounter)); - iCPULoadThread.SetPriority(EPriorityLess); - iCPULoadThread.Resume(); - - iCurrentCPUMode = ECPUModeNOPs; // NOPs taken succesfully in use - } - -// -------------------------------------------------------------------------------------------- - -TBool CPerfMonModel::OpenHandleToNullThread() - { - // find the kernel process and then the null thread - TFindProcess fp(_L("ekern.exe*")); - - TFullName kernelName; - if (fp.Next(kernelName) == KErrNone) - { - // process found, append null thread identifier - kernelName.Append(_L("::Null")); - - // find the thread - TFindThread ft(kernelName); - - TFullName threadName; - if (ft.Next(threadName) == KErrNone) - { - // open instance to the thread - if (iNullThread.Open(threadName) != KErrNone) - return EFalse; - } - } - - // process not found - else - return EFalse; - - // success! - return ETrue; - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::DeActivateCPUMonitoring() - { - if (iCurrentCPUMode == ECPUModeCPUTime) - { - iNullThread.Close(); - } - - else if (iCurrentCPUMode == ECPUModeNOPs) - { - // kill the cpu load thread - iCPULoadThread.Kill(0); - iCPULoadThread.Close(); - } - } - -// -------------------------------------------------------------------------------------------- - -TBool CPerfMonModel::CPUTimeSupported() - { - TTimeIntervalMicroSeconds time; - TInt err = RThread().GetCpuTime(time); - - if (err == KErrNone && time.Int64() > 0) - return ETrue; - else - return EFalse; - } - -// -------------------------------------------------------------------------------------------- - -TThreadPriority CPerfMonModel::SettingItemToThreadPriority(TInt aIndex) - { - TThreadPriority threadPriority = EPriorityNull; - - switch ( aIndex ) - { - case EThreadPriorityTypeMuchLess: - { - threadPriority = EPriorityMuchLess; break; - } - case EThreadPriorityTypeLess: - { - threadPriority = EPriorityLess; break; - } - case EThreadPriorityTypeNormal: - { - threadPriority = EPriorityNormal; break; - } - case EThreadPriorityTypeMore: - { - threadPriority = EPriorityMore; break; - } - case EThreadPriorityTypeMuchMore: - { - threadPriority = EPriorityMuchMore; break; - } - case EThreadPriorityTypeRealTime: - { - threadPriority = EPriorityRealTime; break; - } - case EThreadPriorityTypeAbsoluteVeryLow: - { - threadPriority = EPriorityAbsoluteVeryLow; break; - } - case EThreadPriorityTypeAbsoluteLow: - { - threadPriority = EPriorityAbsoluteLow; break; - } - case EThreadPriorityTypeAbsoluteBackground: - { - threadPriority = EPriorityAbsoluteBackground; break; - } - case EThreadPriorityTypeAbsoluteForeground: - { - threadPriority = EPriorityAbsoluteForeground; break; - } - case EThreadPriorityTypeAbsoluteHigh: - { - threadPriority = EPriorityAbsoluteHigh; break; - } - - default: - { - User::Panic(_L("Wrong tp index"), 276); - break; - } - } - - return threadPriority; - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::CreateSamplesDataArrayL() - { - TInt maxSamples = iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples : KMinimumSamplesLength; - - // create the data structure to store all samples - iSampleEntryArray = new(ELeave) CSampleEntryArray(16); - - // add all source entries - for (TInt i=0; iFsSession().CharToDrive(driveLetter, newSampleEntry.iDriveNumber); - - newSampleEntry.iGraphColor = KRgbCyan; - newSampleEntry.iGraphColor.SetGreen(255-(i-ESourceC)*30); - newSampleEntry.iGraphColor.SetRed(i*30); - } - - newSampleEntry.iSampleDataArray = new(ELeave) CSampleDataArray(maxSamples); - - iSampleEntryArray->AppendL(newSampleEntry); - } - - // save current time as start time - iStartTime.HomeTime(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::UpdateSamplesDataL() - { - // reset inactivity timers - if (iSettings.iKeepBacklightOn) - User::ResetInactivityTime(); - - // get current time - TTime currentTime; - currentTime.HomeTime(); - - // calculate time difference - TTimeIntervalMicroSeconds timeDeltaFromPreviousSample = currentTime.MicroSecondsFrom(iPreviousTime); - - // remember current time as previous - iPreviousTime = currentTime; - - - // get CPU - TInt64 cpuLoadDelta(0); - TInt64 cpuLoadFree(0); - TInt64 cpuLoadSize(0); - TInt64 currentCPUValue(0); - - if (iCurrentCPUMode == ECPUModeCPUTime || iCurrentCPUMode == ECPUModeNOPs) - { - if (iCurrentCPUMode == ECPUModeCPUTime) - { - TTimeIntervalMicroSeconds time; - iNullThread.GetCpuTime(time); - currentCPUValue = time.Int64(); - } - else if (iCurrentCPUMode == ECPUModeNOPs) - { - currentCPUValue = iCPULoadCounter; - } - - // get delta and store the previous value - cpuLoadDelta = currentCPUValue - iCPULoadPreviousValue; - iCPULoadPreviousValue = currentCPUValue; - - // velocity = distance / time - cpuLoadFree = cpuLoadDelta * KCPUTimeMultiplier / timeDeltaFromPreviousSample.Int64(); - - - // detect maximum value - if (cpuLoadFree > iCPULoadMaxValue) - iCPULoadMaxValue = cpuLoadFree; - - - // check calibration status - if (iCPULoadCalibrating) - { - iCPULoadCalibrationCounter++; - cpuLoadSize = cpuLoadFree; - - // check if need to calibrate anymore - if (iCPULoadCalibrationCounter > KCalibrationLength) - { - iCPULoadCalibrating = EFalse; - - // from the samples, get the minimum value, and let it be the max value - for (TInt i=0; iAt(0).iSampleDataArray->Count(); i++) - { - TInt64 newCPULoadMaxValue = iCPULoadMaxValue; - - if (iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree < newCPULoadMaxValue) - { - newCPULoadMaxValue = iSampleEntryArray->At(0).iSampleDataArray->At(i).iFree; - } - - iCPULoadMaxValue = newCPULoadMaxValue; - } - - // adjust priority of the poller thread - if (iCurrentCPUMode == ECPUModeNOPs) - { - iCPULoadThread.SetPriority(EPriorityAbsoluteVeryLow); - } - } - - } - else - { - cpuLoadSize = iCPULoadMaxValue; - } - } - - - // save cpu sample data - TSampleData cpuSample; - cpuSample.iFree = cpuLoadFree; - cpuSample.iSize = cpuLoadSize; - cpuSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime); - - iSampleEntryArray->At(0).iSampleDataArray->InsertL(0, cpuSample); - - - - // get ram memory - TMemoryInfoV1Buf ramMemory; - UserHal::MemoryInfo(ramMemory); - - TSampleData memorySample; - memorySample.iFree = ramMemory().iFreeRamInBytes; - memorySample.iSize = ramMemory().iMaxFreeRamInBytes; - memorySample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime); - - iSampleEntryArray->At(1).iSampleDataArray->InsertL(0, memorySample); - - - // all drives - for (TInt i=2; iCount(); i++) - { - TSampleData driveSample; - - // get volume info from RFs - TVolumeInfo volumeInfo; - if (iEnv->FsSession().Volume(volumeInfo, iSampleEntryArray->At(i).iDriveNumber) == KErrNone) - { - driveSample.iFree = volumeInfo.iFree; - driveSample.iSize = volumeInfo.iSize; - } - else - { - driveSample.iFree = 0; - driveSample.iSize = 0; - } - - driveSample.iTimeFromStart = currentTime.MicroSecondsFrom(iStartTime); - - iSampleEntryArray->At(i).iSampleDataArray->InsertL(0, driveSample); - } - - - // compress sample data arrays to save memory - TInt curLength(iSampleEntryArray->At(0).iSampleDataArray->Count()); - - TInt maxSamples = iSettings.iMaxSamples >= KMinimumSamplesLength ? iSettings.iMaxSamples : KMinimumSamplesLength; - - if (curLength > maxSamples && curLength % 5 == 0) - { - for (TInt i=0; iCount(); i++) - { - iSampleEntryArray->At(i).iSampleDataArray->ResizeL(maxSamples); // looses old samples - iSampleEntryArray->At(i).iSampleDataArray->Compress(); - } - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::AppendLatestSamplesToLogsL() - { - if (iSettings.iLoggingEnabled && SampleEntryArray()) - { - // loop all sources - for (TInt i=0; iCount(); i++) - { - // check if this setting has been enabled and it has some data - if (iSettings.iLoggingSources.iSrcEnabled[i] && SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) - { - // get current sample - TSampleData& currentSample = SampleEntryArray()->At(i).iSampleDataArray->At(0); - - TBuf<128> buf; - buf.Append(_L("PERFMON;")); - buf.Append(SampleEntryArray()->At(i).iDescription); - buf.Append(_L(";")); - buf.AppendNum(currentSample.iTimeFromStart.Int64()); - buf.Append(_L(";")); - buf.AppendNum(currentSample.iFree); - buf.Append(_L(";")); - buf.AppendNum(currentSample.iSize); - - // print to RDebug - if (iSettings.iLoggingMode == ELoggingModeRDebug || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) - { - RDebug::Print(buf); - } - - // print to log file - if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) - { - buf.Append(_L("\r\n")); - - TBuf8<128> buf8; - buf8.Copy(buf); - - iLogFile.Write(buf8); - } - } - } - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::SetValuesContainer(CPerfMonValuesContainer* aContainer) - { - iValuesContainer = aContainer; - iDrawState = EDrawStateValues; - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::SetGraphsContainer(CPerfMonGraphsContainer* aContainer) - { - iGraphsContainer = aContainer; - iDrawState = EDrawStateGraphs; - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::SendDrawEventToContainersL() - { - if (iDrawState == EDrawStateValues && iValuesContainer) - iValuesContainer->DrawUpdate(); - else if (iDrawState == EDrawStateGraphs && iGraphsContainer) - iGraphsContainer->DrawUpdate(); - - if (iDataPopupContainer) - iDataPopupContainer->DrawUpdate(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::LoadSettingsL() - { - // set defaults - iSettings.iHeartBeat = 600; - iSettings.iMaxSamples = 64; - iSettings.iPriority = EThreadPriorityTypeNormal; - iSettings.iCPUMode = ECPUModeCPUTime; - iSettings.iKeepBacklightOn = ETrue; - - iSettings.iDataPopupVisibility = EDataPopupVisbilityAlwaysOn; - iSettings.iDataPopupLocation = EDataPopupLocationTopRight; - iSettings.iDataPopupSources.SetDefaults1(); - - iSettings.iGraphsVerticalBarPeriod = 5; - iSettings.iGraphsSources.SetDefaults2(); - - iSettings.iLoggingMode = ELoggingModeRDebug; - iSettings.iLoggingFilePath.Copy(KDefaultLogFilePath); - iSettings.iLoggingSources.SetDefaults2(); - - iSettings.iLoggingEnabled = EFalse; - - - // make sure that the private path of this app in c-drive exists - iEnv->FsSession().CreatePrivatePath( KSettingsDrive ); // c:\\private\\20011385\\ - - // handle settings always in the private directory - if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone) - { - // open or create a dictionary file store - CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(iEnv->FsSession(), KSettingsFileName, KUidPerfMon); - - LoadDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat); - LoadDFSValueL(settingsStore, KPMSettingMaxSamples, iSettings.iMaxSamples); - LoadDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority); - LoadDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode); - LoadDFSValueL(settingsStore, KPMSettingKeepBackLightOn, iSettings.iKeepBacklightOn); - - LoadDFSValueL(settingsStore, KPMSettingDataPopupVisbility, iSettings.iDataPopupVisibility); - LoadDFSValueL(settingsStore, KPMSettingDataPopupLocation, iSettings.iDataPopupLocation); - LoadDFSValueL(settingsStore, KPMSettingDataPopupSources, iSettings.iDataPopupSources); - - LoadDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod, iSettings.iGraphsVerticalBarPeriod); - LoadDFSValueL(settingsStore, KPMSettingGraphsSources, iSettings.iGraphsSources); - - LoadDFSValueL(settingsStore, KPMSettingLoggingMode, iSettings.iLoggingMode); - LoadDFSValueL(settingsStore, KPMSettingLoggingFilePath, iSettings.iLoggingFilePath); - LoadDFSValueL(settingsStore, KPMSettingLoggingSources, iSettings.iLoggingSources); - - CleanupStack::PopAndDestroy(); // settingsStore - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonModel::SaveSettingsL() - { - // handle settings always in c:\\private\\20011385\\ - if (iEnv->FsSession().SetSessionToPrivate( KSettingsDrive ) == KErrNone) - { - // delete existing store to make sure that it is clean and not eg corrupted - if (BaflUtils::FileExists(iEnv->FsSession(), KSettingsFileName)) - { - iEnv->FsSession().Delete(KSettingsFileName); - } - - // create a dictionary file store - CDictionaryFileStore* settingsStore = CDictionaryFileStore::OpenLC(iEnv->FsSession(), KSettingsFileName, KUidPerfMon); - - SaveDFSValueL(settingsStore, KPMSettingHeartBeat, iSettings.iHeartBeat); - SaveDFSValueL(settingsStore, KPMSettingMaxSamples, iSettings.iMaxSamples); - SaveDFSValueL(settingsStore, KPMSettingPriority, iSettings.iPriority); - SaveDFSValueL(settingsStore, KPMSettingCPUMode, iSettings.iCPUMode); - SaveDFSValueL(settingsStore, KPMSettingKeepBackLightOn, iSettings.iKeepBacklightOn); - - SaveDFSValueL(settingsStore, KPMSettingDataPopupVisbility, iSettings.iDataPopupVisibility); - SaveDFSValueL(settingsStore, KPMSettingDataPopupLocation, iSettings.iDataPopupLocation); - SaveDFSValueL(settingsStore, KPMSettingDataPopupSources, iSettings.iDataPopupSources); - - SaveDFSValueL(settingsStore, KPMSettingGraphsVerticalBarPeriod, iSettings.iGraphsVerticalBarPeriod); - SaveDFSValueL(settingsStore, KPMSettingGraphsSources, iSettings.iGraphsSources); - - SaveDFSValueL(settingsStore, KPMSettingLoggingMode, iSettings.iLoggingMode); - SaveDFSValueL(settingsStore, KPMSettingLoggingFilePath, iSettings.iLoggingFilePath); - SaveDFSValueL(settingsStore, KPMSettingLoggingSources, iSettings.iLoggingSources); - - settingsStore->CommitL(); - CleanupStack::PopAndDestroy(); // settingsStore - } - } - -// -------------------------------------------------------------------------------------------- - -TInt CPerfMonModel::LaunchSettingsDialogL() - { - // launch the settings dialog - TPerfMonSettings newSettings = iSettings; - - CPerfMonSettingsViewDlg* dlg = CPerfMonSettingsViewDlg::NewL(newSettings); - TInt returnValue = dlg->ExecuteLD(R_PERFMON_SETTINGS_DIALOG); - - // always save settings since the settings dialog does not provide a possibility to cancel - iSettings = newSettings; - SaveSettingsL(); - HandleSettingsChangeL(); - - // make sure that the title of the application is correct - CEikStatusPane* sp = iEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - tp->SetTextL(KAppName); - - return returnValue; - } - -// --------------------------------------------------------------------------- - -void CPerfMonModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TInt& aValue) - { - if (aDicFS->IsPresentL(aUid)) - { - RDictionaryReadStream in; - in.OpenLC(*aDicFS, aUid); - aValue = in.ReadInt16L(); - CleanupStack::PopAndDestroy(); // in - } - } - -// --------------------------------------------------------------------------- - -void CPerfMonModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TDes& aValue) - { - if (aDicFS->IsPresentL(aUid)) - { - RDictionaryReadStream in; - in.OpenLC(*aDicFS, aUid); - TInt bufLength = in.ReadInt16L(); // get length of descriptor - in.ReadL(aValue, bufLength); // get the descriptor itself - CleanupStack::PopAndDestroy(); // in - } - } - -// --------------------------------------------------------------------------- - -void CPerfMonModel::LoadDFSValueL(CDictionaryFileStore* aDicFS, const TUid& aUid, TPerfMonSources& aValue) - { - if (aDicFS->IsPresentL(aUid)) - { - RDictionaryReadStream in; - in.OpenLC(*aDicFS, aUid); - TInt bufLength = in.ReadInt16L(); // get length of the array - - if (bufLength < 0 || bufLength > ESourcesLength) // check for validaty - User::Leave(KErrNotSupported); - - for (TInt i=0; i - -#include -#include -#include -#include -#include -#include -#include -#include - -// ===================================== MEMBER FUNCTIONS ===================================== - -CPerfMonSettingsViewDlg* CPerfMonSettingsViewDlg::NewL(TPerfMonSettings& aSettings) - { - CPerfMonSettingsViewDlg* self = new(ELeave) CPerfMonSettingsViewDlg(aSettings); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonSettingsViewDlg::~CPerfMonSettingsViewDlg() - { - // restore default navi pane by popping the tab group from stack - if (iNaviContainer) - iNaviContainer->Pop(); - - if (iSettingItemArray) - { - iSettingItemArray->ResetAndDestroy(); - delete iSettingItemArray; - } - - delete iDecoratedTabGroup; - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonSettingsViewDlg::CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings) : iSettings(aSettings) - { - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::ConstructL() - { - // construct a menu bar - CAknDialog::ConstructL(R_PERFMON_SETTINGS_MENUBAR); - - // get pointer to status pane - CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); - - // set title text - CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - tp->SetTextL( _L("Settings") ); - - // create a new tab group - iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); - iDecoratedTabGroup = iNaviContainer->CreateTabGroupL(this); - iTabGroup = static_cast(iDecoratedTabGroup->DecoratedControl()); - iTabGroup->SetTabFixedWidthL(KTabWidthWithTwoLongTabs); - - // add tabs - iTabGroup->AddTabL(ETabSettingsGeneral, _L("General")); - iTabGroup->AddTabL(ETabSettingsDataPopup, _L("Data popup")); - iTabGroup->AddTabL(ETabSettingsGraphs, _L("Graphs")); - iTabGroup->AddTabL(ETabSettingsLogging, _L("Logging")); - iTabGroup->SetActiveTabByIndex(ETabSettingsGeneral); - - // add new tab group to stack - iNaviContainer->PushL( *iDecoratedTabGroup ); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) - { - switch (aEventType) - { - case EEventEnterKeyPressed: - case EEventItemDoubleClicked: - ShowSettingPageL(EFalse); - break; - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::TabChangedL(TInt /*aIndex*/) - { - iListBox->SetCurrentItemIndex(0); - - SetVisibilitiesOfSettingItemsL(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::ProcessCommandL(TInt aCommandId) - { - CAknDialog::ProcessCommandL(aCommandId); - - switch (aCommandId) - { - case EPerfMonCmdSettingsChange: - ShowSettingPageL(ETrue); - break; - case EPerfMonCmdSettingsExit: - TryExitL(EAknCmdExit); - break; - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CPerfMonSettingsViewDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) - { - if (iTabGroup == NULL) - { - return EKeyWasNotConsumed; - } - - TInt active = iTabGroup->ActiveTabIndex(); - TInt count = iTabGroup->TabCount(); - - switch ( aKeyEvent.iCode ) - { - case EKeyLeftArrow: - if (active > 0) - { - active--; - iTabGroup->SetActiveTabByIndex(active); - TabChangedL(active); - } - break; - - case EKeyRightArrow: - if((active + 1) < count) - { - active++; - iTabGroup->SetActiveTabByIndex(active); - TabChangedL(active); - } - break; - } - - return CAknDialog::OfferKeyEventL(aKeyEvent, aType); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::PreLayoutDynInitL() - { - iListBox = static_cast( Control(EPerfMonSettingItemList) ); - iListBox->SetMopParent(this); - iListBox->CreateScrollBarFrameL(ETrue); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); - iListBox->SetListBoxObserver(this); - - iSettingItemArray = new(ELeave) CAknSettingItemArray(16, EFalse, 0); - - CTextListBoxModel* model = iListBox->Model(); - model->SetItemTextArray(iSettingItemArray); - model->SetOwnershipType(ELbmDoesNotOwnItemArray); - - UpdateListBoxL(); - } - -// -------------------------------------------------------------------------------------------- - -TBool CPerfMonSettingsViewDlg::OkToExitL(TInt aButtonId) - { - return CAknDialog::OkToExitL(aButtonId); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::ShowSettingPageL(TInt aCalledFromMenu) - { - TInt listIndex = iListBox->CurrentItemIndex(); - TInt realIndex = iSettingItemArray->ItemIndexFromVisibleIndex(listIndex); - CAknSettingItem* item = iSettingItemArray->At(realIndex); - item->EditItemL(aCalledFromMenu); - item->StoreL(); - SetVisibilitiesOfSettingItemsL(); - DrawNow(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::SetVisibilitiesOfSettingItemsL() - { - if (iSettingItemArray->Count() > 0) - { - switch (iTabGroup->ActiveTabIndex()) - { - case ETabSettingsGeneral: - { - ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(EFalse); - - ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue); - - break; - } - - case ETabSettingsDataPopup: - { - ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(EFalse); - - ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue); - - break; - } - - case ETabSettingsGraphs: - { - ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(EFalse); - - ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue); - - break; - } - - case ETabSettingsLogging: - { - ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(EFalse); - - if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) - ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(EFalse); - else - ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); - - ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(EFalse); - - break; - } - - default: - User::Panic(_L("TabIOOB"), 50); - break; - } - - iSettingItemArray->RecalculateVisibleIndicesL(); - iListBox->HandleItemAdditionL(); - iListBox->UpdateScrollBarsL(); - } - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::UpdateListBoxL() - { - iSettingItemArray->ResetAndDestroy(); - - // create items - TInt ordinal(0); - - AddSettingItemL(ESettingListItemHeartBeat, - R_HEARTBEAT_SETTING_TITLE, - R_HEARTBEAT_SETTING_PAGE, - NULL, - ordinal++); - - AddSettingItemL(ESettingListItemMaxSamples, - R_MAXSAMPLES_SETTING_TITLE, - R_MAXSAMPLES_SETTING_PAGE, - NULL, - ordinal++); - - AddSettingItemL(ESettingListItemPriority, - R_PRIORITY_SETTING_TITLE, - R_PRIORITY_SETTING_PAGE, - R_PRIORITY_SETTING_TEXTS, - ordinal++); - - AddSettingItemL(ESettingListItemCPUMode, - R_CPUMODE_SETTING_TITLE, - R_CPUMODE_SETTING_PAGE, - R_CPUMODE_SETTING_TEXTS, - ordinal++); - - AddSettingItemL(ESettingListItemKeepBackLightOn, - R_KEEPBACKLIGHTON_SETTING_TITLE, - R_BINARY_SETTING_PAGE, - R_YESNO_BINARYSELECTION_TEXTS, - ordinal++); -// - AddSettingItemL(ESettingListItemDataPopupVisbility, - R_DATAPOPUPVISIBILITY_SETTING_TITLE, - R_DATAPOPUPVISIBILITY_SETTING_PAGE, - R_DATAPOPUPVISIBILITY_SETTING_TEXTS, - ordinal++); - - AddSettingItemL(ESettingListItemDataPopupLocation, - R_DATAPOPUPLOCATION_SETTING_TITLE, - R_DATAPOPUPLOCATION_SETTING_PAGE, - R_DATAPOPUPLOCATION_SETTING_TEXTS, - ordinal++); - - AddSettingItemL(ESettingListItemDataPopupSources, - R_SOURCES_SETTING_TITLE, - R_SOURCES_SETTING_PAGE, - NULL, - ordinal++); -// - AddSettingItemL(ESettingListItemGraphsVerticalBarPeriod, - R_GRAPHSVERTICALBAR_SETTING_TITLE, - R_GRAPHSVERTICALBAR_SETTING_PAGE, - NULL, - ordinal++); - - AddSettingItemL(ESettingListItemGraphsSources, - R_SOURCES_SETTING_TITLE, - R_SOURCES_SETTING_PAGE, - NULL, - ordinal++); -// - AddSettingItemL(ESettingListItemLoggingMode, - R_LOGGINGMODE_SETTING_TITLE, - R_LOGGINGMODE_SETTING_PAGE, - R_LOGGINGMODE_SETTING_TEXTS, - ordinal++); - - AddSettingItemL(ESettingListItemLoggingFilePath, - R_LOGGINGFILEPATH_SETTING_TITLE, - R_LOGGINGFILEPATH_SETTING_PAGE, - NULL, - ordinal++); - - AddSettingItemL(ESettingListItemLoggingSources, - R_SOURCES_SETTING_TITLE, - R_SOURCES_SETTING_PAGE, - NULL, - ordinal++); - - SetVisibilitiesOfSettingItemsL(); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonSettingsViewDlg::AddSettingItemL(TInt aId, - TInt aTitleResource, - TInt aSettingPageResource, - TInt aAssociatedResource, - TInt aOrdinal) - { - // create a setting item - CAknSettingItem* settingItem = NULL; - - switch (aId) - { - case ESettingListItemHeartBeat: - settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iHeartBeat); - break; - - case ESettingListItemMaxSamples: - settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iMaxSamples); - break; - - case ESettingListItemPriority: - settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iPriority); - break; - - case ESettingListItemCPUMode: - settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iCPUMode); - break; - - case ESettingListItemKeepBackLightOn: - settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iKeepBacklightOn); - break; - - case ESettingListItemDataPopupVisbility: - settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupVisibility); - break; - - case ESettingListItemDataPopupLocation: - settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupLocation); - break; - - case ESettingListItemDataPopupSources: - settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iDataPopupSources); - break; - - case ESettingListItemGraphsVerticalBarPeriod: - settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iGraphsVerticalBarPeriod); - break; - - case ESettingListItemGraphsSources: - settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iGraphsSources); - break; - - case ESettingListItemLoggingMode: - settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iLoggingMode); - break; - - case ESettingListItemLoggingFilePath: - settingItem = new(ELeave) CAknTextSettingItem(aId, iSettings.iLoggingFilePath); - break; - - case ESettingListItemLoggingSources: - settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iLoggingSources); - break; - - default: - User::Panic(_L("NotSetItem"), 50); - break; - } - - CleanupStack::PushL(settingItem); - - // get title text - HBufC* itemTitle = StringLoader::LoadLC(aTitleResource); - - // construct the setting item - settingItem->ConstructL(EFalse, aOrdinal, *itemTitle, NULL, aSettingPageResource, - EAknCtPopupSettingList, NULL, aAssociatedResource); - - // append the setting item to settingitem array - iSettingItemArray->InsertL(aOrdinal, settingItem); - - CleanupStack::PopAndDestroy(); //itemTitle - CleanupStack::Pop(); //settingItem - } - - -// -------------------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------------------- - -CSourceSelectionCheckBoxSettingItem::CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse ): - CAknSettingItem(aIdentifier), iExternalSources( aMemoryInUse ) - { - } - -CSourceSelectionCheckBoxSettingItem::~CSourceSelectionCheckBoxSettingItem() - { - delete iSettingText; - - if( iItemArray ) - { - iItemArray->ResetAndDestroy(); - delete iItemArray; - } - } - -void CSourceSelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel) - { - TBuf<64> buf; - buf.Copy(aLabel); - - CSelectableItem* item = new(ELeave) CSelectableItem(buf, EFalse); - CleanupStack::PushL(item); - item->ConstructL(); - iItemArray->AppendL(item); // Ownership is transferred - CleanupStack::Pop(); // item - } - -void CSourceSelectionCheckBoxSettingItem::CompleteConstructionL() - { - SetEmptyItemTextL(_L("Nothing selected")); - - iItemArray = new(ELeave) CSelectionItemList(16); - AddNewItemToArrayL(_L("CPU")); - AddNewItemToArrayL(_L("RAM")); - AddNewItemToArrayL(_L("C:")); - AddNewItemToArrayL(_L("D:")); - AddNewItemToArrayL(_L("E:")); - AddNewItemToArrayL(_L("F:")); - AddNewItemToArrayL(_L("G:")); - AddNewItemToArrayL(_L("H:")); - AddNewItemToArrayL(_L("I:")); - - __ASSERT_ALWAYS(ESourcesLength==iItemArray->Count(), User::Panic(_L("Src.mismatch"),443)); - } - -// transfer settings to the variables defined in the constructor -void CSourceSelectionCheckBoxSettingItem::StoreL() - { - for (TInt i=0; iAt(i)->SelectionStatus(); - } - } - -// load settings from the variables defined in the constructor to our internal variables -void CSourceSelectionCheckBoxSettingItem::LoadL() - { - for (TInt i=0; iAt(i)->SetSelectionStatus( iExternalSources.iSrcEnabled[i] ); - } - } - -// returns the text shown in the setting item list -const TDesC& CSourceSelectionCheckBoxSettingItem::SettingTextL() - { - TBuf<32> settingText; - - if (iItemArray->At(ESourceCPU)->SelectionStatus()) - settingText.Append(_L("CPU ")); - if (iItemArray->At(ESourceRAM)->SelectionStatus()) - settingText.Append(_L("RAM ")); - if (iItemArray->At(ESourceC)->SelectionStatus()) - settingText.Append(_L("C: ")); - if (iItemArray->At(ESourceD)->SelectionStatus()) - settingText.Append(_L("D: ")); - if (iItemArray->At(ESourceE)->SelectionStatus()) - settingText.Append(_L("E: ")); - if (iItemArray->At(ESourceF)->SelectionStatus()) - settingText.Append(_L("F: ")); - if (iItemArray->At(ESourceG)->SelectionStatus()) - settingText.Append(_L("G: ")); - if (iItemArray->At(ESourceH)->SelectionStatus()) - settingText.Append(_L("H: ")); - if (iItemArray->At(ESourceI)->SelectionStatus()) - settingText.Append(_L("I: ")); - settingText.TrimAll(); - - if (iSettingText) - { - delete iSettingText; - iSettingText = NULL; - } - - iSettingText = HBufC::NewL(settingText.Length()); - iSettingText->Des().Copy(settingText); - - if ( iSettingText->Length() > 0 ) - return *iSettingText; - else - return EmptyItemText(); - } - - -// launches the setting page -void CSourceSelectionCheckBoxSettingItem::EditItemL(TBool /*aCalledFromMenu*/) - { - CSourceSelectionCheckBoxSettingPage* dlg = new(ELeave) CSourceSelectionCheckBoxSettingPage(SettingPageResourceId(), iItemArray); - - SetSettingPage( dlg ); - SettingPage()->SetSettingPageObserver(this); - - SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged); - SetSettingPage(0); // it is deleted now - } - - -// handles setting page events -void CSourceSelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ) - { - switch( aEventType ) - { - case EEventSettingCancelled: - { - // If setting is cancelled, load old values - LoadL(); - break; - } - case EEventSettingChanged: - { - // If setting has changed, update CBA visibility - static_cast( aSettingPage )->UpdateCba(); - break; - } - default: - { - break; - } - } - CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType ); - } - -// -------------------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------------------- - -CSourceSelectionCheckBoxSettingPage::CSourceSelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray ) - : CAknCheckBoxSettingPage( aResourceID, aItemArray ) - { - } - -void CSourceSelectionCheckBoxSettingPage::UpdateCba() - { - // Cache the pointer to button group container - CEikButtonGroupContainer* cba = Cba(); - // Left softkey should be visible if there are items selected, - // i.e. the selection index array has items. - TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 ); - // Resolve left softkey command id - TInt leftId( cba->ButtonGroup()->CommandId( 0 ) ); - // Check if left softkey visibility has changed - if( visible != cba->IsCommandVisible( leftId ) ) - { - // Left softkey visibility has changed, update it - cba->MakeCommandVisible( leftId, visible ); - } - } - -// -------------------------------------------------------------------------------------------- -// -------------------------------------------------------------------------------------------- - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_valuescontainer.cpp --- a/perfmon/src/perfmon_valuescontainer.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon_valuescontainer.h" -#include "perfmon.hrh" -#include "perfmon_document.h" -#include "perfmon_appui.h" -#include "perfmon_model.h" - -#include - -_LIT(KPercentageFormat,"%S %d%%"); -_LIT(KFreeFormat,"%S free %S%S"); -_LIT(KSizeFormat,"%S size %S%S"); - -const TInt KLeftMargin = 2; - - -// ===================================== MEMBER FUNCTIONS ===================================== - -void CPerfMonValuesContainer::ConstructL(const TRect& aRect) - { - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - iFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont); - - CreateWindowL(); - SetRect(aRect); - SetBlank(); - - ActivateL(); - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonValuesContainer::~CPerfMonValuesContainer() - { - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonValuesContainer::Draw(const TRect& aRect) const - { - CWindowGc& gc = SystemGc(); - gc.SetBrushColor(KRgbWhite); - gc.Clear(aRect); - - // check if sample array has been constructed - if (iModel->SampleEntryArray()) - { - // init font - gc.SetPenColor(KRgbBlack); - gc.UseFont( iFont ); - TUint separator = iFont->HeightInPixels()-2; - - TInt c(1); - - // draw all entries - for (TInt i=0; iSampleEntryArray()->Count(); i++) - { - // check if data available - if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) - { - TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0); - - if (i == ESourceCPU) // for CPU draw % - { - TBuf<16> buf; - buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 ); - gc.DrawText(buf, TPoint(KLeftMargin,separator*c)); - c++; - } - - else if (currentSample.iSize > 0) // ram+drives, ignore absent drives - { - TBuf<32> amountBuf; - amountBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0)); - - TBuf<32> buf; - buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort); - gc.DrawText(buf, TPoint(KLeftMargin,separator*c)); - c++; - - amountBuf.Copy(KNullDesC); - amountBuf.AppendNum(currentSample.iSize, TRealFormat(KDefaultRealWidth, 0)); - - buf.Format(KSizeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort); - gc.DrawText(buf, TPoint(KLeftMargin,separator*c)); - c++; - } - } - } - - gc.DiscardFont(); - } - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CPerfMonValuesContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) - { - return CCoeControl::OfferKeyEventL(aKeyEvent, aType); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonValuesContainer::HandleResourceChange(TInt aType) - { - if (aType == KEikDynamicLayoutVariantSwitch) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); - SetRect(mainPaneRect); - } - else - CCoeControl::HandleResourceChange(aType); - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonValuesContainer::DrawUpdate() - { - DrawDeferred(); - } - -// -------------------------------------------------------------------------------------------- - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/src/perfmon_valuesview.cpp --- a/perfmon/src/perfmon_valuesview.cpp Tue Sep 14 21:20:12 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,147 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "perfmon.hrh" -#include "perfmon_valuesview.h" -#include "perfmon_valuescontainer.h" -#include "perfmon_document.h" -#include "perfmon_model.h" -#include - -#include -#include - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CPerfMonValuesView::ConstructL(const TRect& aRect) -// EPOC two-phased constructor -// --------------------------------------------------------- -// -void CPerfMonValuesView::ConstructL() - { - BaseConstructL( R_PERFMON_VIEW_VALUES ); - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - } - -// --------------------------------------------------------- -// CPerfMonValuesView::~CPerfMonValuesView() -// --------------------------------------------------------- -// -CPerfMonValuesView::~CPerfMonValuesView() - { - if (iContainer) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -// --------------------------------------------------------- -// TUid CPerfMonValuesView::Id() -// --------------------------------------------------------- -// -TUid CPerfMonValuesView::Id() const - { - return KValuesViewUID; - } - -// --------------------------------------------------------- -// TUid CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) -// --------------------------------------------------------- -// -void CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) - { - AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane); - } - - -// --------------------------------------------------------- -// CPerfMonValuesView::HandleCommandL(TInt aCommand) -// --------------------------------------------------------- -// -void CPerfMonValuesView::HandleCommandL(TInt aCommand) - { -/* - switch ( aCommand ) - { - case EPerfMonCmdFileBack: - { - iModel->FileUtils()->MoveUpOneLevelL(); - break; - } - - default: - { -*/ - AppUi()->HandleCommandL( aCommand ); -/* - break; - } - } -*/ - } - -// --------------------------------------------------------- -// CPerfMonValuesView::HandleClientRectChange() -// --------------------------------------------------------- -// -void CPerfMonValuesView::HandleClientRectChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -// --------------------------------------------------------- -// CPerfMonValuesView::DoActivateL(...) -// --------------------------------------------------------- -// -void CPerfMonValuesView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - if (!iContainer) - { - iContainer = new (ELeave) CPerfMonValuesContainer; - iModel->SetValuesContainer(iContainer); - iContainer->SetMopParent(this); - iContainer->ConstructL( ClientRect() ); - AppUi()->AddToStackL( *this, iContainer ); - } - } - -// --------------------------------------------------------- -// CPerfMonValuesView::DoDeactivate() -// --------------------------------------------------------- -// -void CPerfMonValuesView::DoDeactivate() - { - if (iContainer) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/symbian_version.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/symbian_version.hrh Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Symbian version configuration file +* +*/ + +#ifndef __SYMBIAN_VERSION_HRH +#define __SYMBIAN_VERSION_HRH + +// S60 and Symbian version number enumeration definitions + +#define S60_30 30 +#define S60_31 31 +#define S60_32 32 +#define S60_50 50 +#define S60_51 91 +#define S60_52 92 +#define SYMBIAN_1 50 +#define SYMBIAN_2 91 +#define SYMBIAN_3 92 +#define SYMBIAN_4 101 + + +/** + * Defines the S60 or Symbian version used by this component. This flag can be + * used to variate the source code based on the SDK in use. The value of the + * flag should be always changed to reflect the current build environment. + */ +#define SYMBIAN_VERSION_SUPPORT SYMBIAN_3 + + +#endif // __SYMBIAN_VERSION_HRH diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/group/bld.inf Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,21 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +PRJ_MMPFILES +perfmon.mmp diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/group/perfmon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/group/perfmon.mmp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include + + +TARGET PerfMon.exe +TARGETTYPE exe +EPOCSTACKSIZE 0x5000 +EPOCHEAPSIZE 0x10000 0x1000000 // Min 64Kb, Max 16Mb + +UID 0x100039CE 0x20011385 + +VENDORID VID_DEFAULT +CAPABILITY WriteDeviceData + +SMPSAFE + +LANG SC + + +START RESOURCE ../../../data/perfmon.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +END + +START RESOURCE ../../../data/perfmon_reg.rss +DEPENDS perfmon.rsg +TARGETPATH /private/10003a3f/import/apps +END + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc +SOURCEPATH ../src + +SOURCE perfmon_app.cpp +SOURCE perfmon_document.cpp +SOURCE perfmon_appui.cpp +SOURCE perfmon_model.cpp +SOURCE perfmon_valuesview.cpp +SOURCE perfmon_valuescontainer.cpp +SOURCE perfmon_graphsview.cpp +SOURCE perfmon_graphscontainer.cpp +SOURCE perfmon_settingsviewdlg.cpp +SOURCE perfmon_datapopupcontainer.cpp + +USERINCLUDE ../../../engine/inc +SOURCEPATH ../../../engine/src +SOURCE perfmon_engine.cpp +SOURCE perfmon_powerlistener.cpp + +LIBRARY euser.lib +LIBRARY commonengine.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY eikdlg.lib +LIBRARY avkon.lib +LIBRARY ws32.lib +LIBRARY apgrfx.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY gdi.lib +LIBRARY estor.lib +LIBRARY centralrepository.lib +LIBRARY HWRMPowerClient.lib + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_app.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_APP_H +#define PERFMON_APP_H + + +// INCLUDES +#include + +// CONSTANTS +// UID of the application +const TUid KUidPerfMon = { 0x20011385 }; + +// CLASS DECLARATION + +/** +* CPerfMonApp application class. +* Provides factory to create concrete document object. +* +*/ +class CPerfMonApp : public CAknApplication + { + + public: // Functions from base classes + /** + * From CApaApplication, overridden to enable INI file support. + * @return A pointer to the dictionary store + */ + CDictionaryStore* OpenIniFileLC(RFs& aFs) const; + private: + + /** + * From CApaApplication, creates CPerfMonDocument document object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CApaApplication, returns application's UID (KUidPerfMon). + * @return The value of KUidPerfMon. + */ + TUid AppDllUid() const; + }; + +#endif + +// End of File + diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_appui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_appui.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_APPUI_H +#define PERFMON_APPUI_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include "perfmon_std.h" + +// FORWARD DECLARATIONS +class CPerfMonModel; +class CAknNavigationControlContainer; +class CAknTabGroup; +class CAknNavigationDecorator; + + +// CLASS DECLARATIONS + +class CPerfMonAppUi : public CAknViewAppUi + { + public: // // Constructors and destructor + + void ConstructL(); + + ~CPerfMonAppUi(); + + public: // New functions + + private: + // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); + + private: + void HandleForegroundEventL(TBool aForeground); + + void HandleCommandL(TInt aCommand); + + void HandleResourceChangeL(TInt aType); + + virtual TKeyResponse HandleKeyEventL( + const TKeyEvent& aKeyEvent,TEventCode aType); + + private: //Data + CPerfMonModel* iModel; + CAknNavigationControlContainer* iNaviPane; + CAknTabGroup* iTabGroup; + CAknNavigationDecorator* iDecoratedTabGroup; + }; + +#endif + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_datapopupcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_datapopupcontainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_DATAPOPUPCONTAINER_H +#define PERFMON_DATAPOPUPCONTAINER_H + +// INCLUDES +#include + +#include "perfmon_drawcallback.h" + + +// FORWARD DECLARATIONS +class CPerfMonModel; + + +// CLASS DECLARATIONS + +class CPerfMonDataPopupContainer : public CCoeControl, public MDrawUpdateCallback + { +public: + void ConstructL(const TRect& aRect); + ~CPerfMonDataPopupContainer(); + +protected: + void Draw(const TRect& aRect) const; + virtual void SizeChanged(); + +public: + void SetPositionAndSize(); + void UpdateVisibility(TBool aForeground=ETrue); + +public: // from MDrawUpdateCallback + void DrawUpdate(); + +private: + CPerfMonModel* iModel; + RWindowGroup iWindowGroup; + const CFont* iFont; + TInt iFontSize; + }; + +#endif + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_document.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_document.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_DOCUMENT_H +#define PERFMON_DOCUMENT_H + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CEikAppUi; +class CPerfMonModel; + + +// CLASS DECLARATION + +/** +* CPerfMonDocument application class. +*/ +class CPerfMonDocument : public CAknDocument + { + public: // Constructors and destructor + static CPerfMonDocument* NewL(CEikApplication& aApp); + virtual ~CPerfMonDocument(); + + public: // New functions + + public: // from CEikDocument + CFileStore* OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs); + protected: // New functions + + protected: // Functions from base classes + + private: + + /** + * EPOC default constructor. + */ + CPerfMonDocument(CEikApplication& aApp); + void ConstructL(); + + private: + + /** + * From CEikDocument, create CPerfMonAppUi "App UI" object. + */ + CEikAppUi* CreateAppUiL(); + + public: + inline CPerfMonModel* Model() { return iModel; } + + private: + CPerfMonModel* iModel; + + }; + +#endif + +// End of File + diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_drawcallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_drawcallback.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_DRAWCALLBACK_H +#define PERFMON_DRAWCALLBACK_H + +class MDrawUpdateCallback + { +public: + virtual void DrawUpdate() = 0; + }; + +#endif + +// End of File + diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_graphscontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_graphscontainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_GRAPHSCONTAINER_H +#define PERFMON_GRAPHSCONTAINER_H + +// INCLUDES +#include + +#include "perfmon_drawcallback.h" + + +// FORWARD DECLARATIONS +class CPerfMonModel; + + +// CLASS DECLARATIONS + +class CPerfMonGraphsContainer : public CCoeControl, public MDrawUpdateCallback + { +public: + void ConstructL(const TRect& aRect); + ~CPerfMonGraphsContainer(); + +private: + void Draw(const TRect& aRect) const; + void HandleResourceChange(TInt aType); + +public: + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/); + +public: // from MDrawUpdateCallback + void DrawUpdate(); + +private: + CPerfMonModel* iModel; + const CFont* iFont; + }; + +#endif + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_graphsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_graphsview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_GRAPHSVIEW_H +#define PERFMON_GRAPHSVIEW_H + +// INCLUDES +#include + +#include "perfmon_std.h" + + + +// CONSTANTS +// UID of view +const TUid KGraphsViewUID = {2}; + + +// FORWARD DECLARATIONS +class CPerfMonGraphsContainer; +class CPerfMonModel; + + +// CLASS DECLARATION + +/** +* CPerfMonGraphsView view class. +* +*/ +class CPerfMonGraphsView : public CAknView + { + public: // Constructors and destructor + void ConstructL(); + ~CPerfMonGraphsView(); + + public: // Functions from base classes + TUid Id() const; + void HandleCommandL(TInt aCommand); + void HandleClientRectChange(); + + private: // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + private: // From AknView + void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); + void DoDeactivate(); + + private: // Data + CPerfMonGraphsContainer* iContainer; + CPerfMonModel* iModel; + }; + +#endif + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_model.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_model.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_MODEL_H +#define PERFMON_MODEL_H + +// INCLUDES +#include +#include +#include +#include + +#include "perfmon_engine.h" + +// FORWARD DECLARATIONS +class CPerfMonValuesContainer; +class CPerfMonGraphsContainer; +class CPerfMonDataPopupContainer; + +class CPerfMonModel : public CPerfMonEngine + { +private: + enum TContainerDrawState + { + EDrawStateInvalid = -1, + EDrawStateValues, + EDrawStateGraphs + }; + +public: + static CPerfMonModel* NewL(); + void ActivateModelL(); + void DeActivateModelL(); + +private: + void ConstructL(); + void SendDrawEventToContainersL(); + void HandleSettingsChangeL(); + +public: + void SetValuesContainer(CPerfMonValuesContainer* aValuesContainer); + void SetGraphsContainer(CPerfMonGraphsContainer* aGraphsContainer); + TInt LaunchSettingsDialogL(); + TInt SampleEntryPosToSettingPos(TInt aSampleEntryPos); + + inline CPerfMonValuesContainer* ValuesContainer() { return iValuesContainer; } + inline CPerfMonGraphsContainer* GraphsContainer() { return iGraphsContainer; } + inline CPerfMonDataPopupContainer* DataPopupContainer() { return iDataPopupContainer; } + +private: + CPerfMonValuesContainer* iValuesContainer; + CPerfMonGraphsContainer* iGraphsContainer; + CPerfMonDataPopupContainer* iDataPopupContainer; + TInt iDrawState; + }; + + +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_settingsviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_settingsviewdlg.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_SETTINGSVIEWDLG_H +#define PERFMON_SETTINGSVIEWDLG_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#include "perfmon_model.h" + + +// FORWARD DECLARATIONS +class CAknSettingItemArray; +class CAknSettingStyleListBox; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; +class CAknTabGroup; +class TPerfMonSettings; +class CSelectionItemList; + + +// CLASS DEFINITIONS + +class CPerfMonSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver + { +public: + static CPerfMonSettingsViewDlg* NewL(TPerfMonSettings& aSettings); + virtual ~CPerfMonSettingsViewDlg(); + +public: // From MEikListBoxObserver + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + +public: // From MAknTabObserver + void TabChangedL(TInt aIndex); + +public: // From CAknDialog + void ProcessCommandL(TInt aCommandId); + +protected: // From CEikDialog + TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); + void PreLayoutDynInitL(); + TBool OkToExitL(TInt aButtonId); + +private: // New methods + void ShowSettingPageL(TBool aCalledFromMenu); + void SetVisibilitiesOfSettingItemsL(); + void UpdateListBoxL(); + void AddSettingItemL(TInt aId, TInt aTitleResource, TInt aSettingPageResource, TInt aAssociatedResource, TInt aOrdinal); + +private: // Constructors + CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings); + void ConstructL(); + +private: // Data + CAknSettingItemArray* iSettingItemArray; + CAknSettingStyleListBox* iListBox; + CAknNavigationControlContainer* iNaviContainer; + CAknNavigationDecorator* iDecoratedTabGroup; + CAknTabGroup* iTabGroup; + TPerfMonSettings& iSettings; + }; + + +class CSourceSelectionCheckBoxSettingItem : public CAknSettingItem + { +public: + CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse ); + virtual ~CSourceSelectionCheckBoxSettingItem(); + +protected: + void CompleteConstructionL(); + void StoreL(); + void LoadL(); + const TDesC& SettingTextL(); + void EditItemL( TBool aCalledFromMenu ); + void HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ); + +private: + void AddNewItemToArrayL(const TDesC& aLabel); + +private: + CSelectionItemList* iItemArray; + HBufC* iSettingText; + TPerfMonSources& iExternalSources; + }; + + +class CSourceSelectionCheckBoxSettingPage : public CAknCheckBoxSettingPage + { + public: + CSourceSelectionCheckBoxSettingPage( TInt aResourceID, CSelectionItemList* aItemArray ); + public: // New functions + void UpdateCba(); + }; + + +#endif + +// End of File + diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_std.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_std.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_STD_H +#define PERFMON_STD_H + + + +#endif + +// End of File + diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_valuescontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_valuescontainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_VALUESCONTAINER_H +#define PERFMON_VALUESCONTAINER_H + +// INCLUDES +#include + +#include "perfmon_drawcallback.h" + + +// FORWARD DECLARATIONS +class CPerfMonModel; + + +// CLASS DECLARATIONS + +class CPerfMonValuesContainer : public CCoeControl, public MDrawUpdateCallback + { +public: + void ConstructL(const TRect& aRect); + ~CPerfMonValuesContainer(); + +private: + void Draw(const TRect& aRect) const; + void HandleResourceChange(TInt aType); + +public: + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/); + +public: // from MDrawUpdateCallback + void DrawUpdate(); + +private: + CPerfMonModel* iModel; + const CFont* iFont; + }; + +#endif + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/inc/perfmon_valuesview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/inc/perfmon_valuesview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,70 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef PERFMON_VALUESVIEW_H +#define PERFMON_VALUESVIEW_H + +// INCLUDES +#include + +#include "perfmon_std.h" + + + +// CONSTANTS +// UID of view +const TUid KValuesViewUID = {1}; + + +// FORWARD DECLARATIONS +class CPerfMonValuesContainer; +class CPerfMonModel; + + +// CLASS DECLARATION + +/** +* CPerfMonValuesView view class. +* +*/ +class CPerfMonValuesView : public CAknView + { + public: // Constructors and destructor + void ConstructL(); + ~CPerfMonValuesView(); + + public: // Functions from base classes + TUid Id() const; + void HandleCommandL(TInt aCommand); + void HandleClientRectChange(); + + private: // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + private: // From AknView + void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); + void DoDeactivate(); + + private: // Data + CPerfMonValuesContainer* iContainer; + CPerfMonModel* iModel; + }; + +#endif + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_app.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_app.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon_app.h" +#include "perfmon_document.h" + +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPerfMonApp::AppDllUid() +// Returns application UID +// --------------------------------------------------------- +// +TUid CPerfMonApp::AppDllUid() const + { + return KUidPerfMon; + } + +// --------------------------------------------------------- +// CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const +// overrides CAknApplication::OpenIniFileLC to enable INI file support +// --------------------------------------------------------- +// +CDictionaryStore* CPerfMonApp::OpenIniFileLC(RFs& aFs) const + { + return CEikApplication::OpenIniFileLC(aFs); + } + +// --------------------------------------------------------- +// CPerfMonApp::CreateDocumentL() +// Creates CPerfMonDocument object +// --------------------------------------------------------- +// +CApaDocument* CPerfMonApp::CreateDocumentL() + { + return CPerfMonDocument::NewL( *this ); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +LOCAL_C CApaApplication* NewApplication() + { + return new CPerfMonApp; + } + + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + + +// End of File + diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_appui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_appui.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,228 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon_appui.h" +#include "perfmon_valuesview.h" +#include "perfmon_graphsview.h" +#include "perfmon_datapopupcontainer.h" +#include "perfmon.hrh" +#include "perfmon_model.h" +#include "perfmon_document.h" +#include + +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// -------------------------------------------------------------------------------------------- + +void CPerfMonAppUi::ConstructL() + { + // disable window server priority control for this application + iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); + + // set as system application to prevent getting shut down events + iEikonEnv->SetSystem(ETrue); + + BaseConstructL(EAknEnableSkin); + + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + + // Show tabs for main views from resources + CEikStatusPane* sp = StatusPane(); + + // Fetch pointer to the default navi pane control + iNaviPane = (CAknNavigationControlContainer*)sp->ControlL( + TUid::Uid(EEikStatusPaneUidNavi)); + + // Tabgroup has been read from resource and it were pushed to the navi pane. + // Get pointer to the navigation decorator with the ResourceDecorator() function. + // Application owns the decorator and it has responsibility to delete the object. + iDecoratedTabGroup = iNaviPane->ResourceDecorator(); + if (iDecoratedTabGroup) + { + iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl(); + } + + CPerfMonValuesView* valuesView = new(ELeave) CPerfMonValuesView; + CleanupStack::PushL(valuesView); + valuesView->ConstructL(); + AddViewL(valuesView); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // valuesView + + CPerfMonGraphsView* graphsView = new(ELeave) CPerfMonGraphsView; + CleanupStack::PushL(graphsView); + graphsView->ConstructL(); + AddViewL(graphsView); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // graphsView + + // set the default view + SetDefaultViewL(*valuesView); + + // notify the model that everything has been constructed + iModel->ActivateModelL(); + } + +// -------------------------------------------------------------------------------------------- + +CPerfMonAppUi::~CPerfMonAppUi() + { + // notify the model that the application is closing + if (iModel) + TRAP_IGNORE(iModel->DeActivateModelL()); + + delete iDecoratedTabGroup; + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + if (aResourceId == R_PERFMON_APP_MENU) + { + aMenuPane->SetItemDimmed(EPerfMonCmdEnableLogging, iModel->Settings().iLoggingEnabled); + aMenuPane->SetItemDimmed(EPerfMonCmdDisableLogging, !iModel->Settings().iLoggingEnabled); + } + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CPerfMonAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/) + { + if ( iTabGroup == NULL ) + { + return EKeyWasNotConsumed; + } + + TInt active = iTabGroup->ActiveTabIndex(); + TInt count = iTabGroup->TabCount(); + + switch ( aKeyEvent.iCode ) + { + case EKeyLeftArrow: + if (active > 0) + { + active--; + iTabGroup->SetActiveTabByIndex( active ); + ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active))); + } + break; + case EKeyRightArrow: + if((active + 1) < count) + { + active++; + iTabGroup->SetActiveTabByIndex( active ); + ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active))); + } + break; + default: + return EKeyWasNotConsumed; + } + + return EKeyWasConsumed; + } + + +// -------------------------------------------------------------------------------------------- + +void CPerfMonAppUi::HandleCommandL(TInt aCommand) + { + switch ( aCommand ) + { + case EPerfMonCmdEnableLogging: + { + iModel->EnableLogging(ETrue); + break; + } + + case EPerfMonCmdDisableLogging: + { + iModel->EnableLogging(EFalse); + break; + } + + case EPerfMonCmdSettings: + { + if (iModel->LaunchSettingsDialogL() == EAknCmdExit) + Exit(); + break; + } + + case EPerfMonCmdAbout: + { + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; + dialog->ExecuteLD(R_PERFMON_ABOUT_DIALOG); + } + break; + + // a normal way to close an application + case EAknCmdExit: + case EEikCmdExit: + case EAknSoftkeyExit: + { + Exit(); + } + break; + + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonAppUi::HandleForegroundEventL(TBool aForeground) + { + // handle visibility of the data popup container + if (iModel && iModel->DataPopupContainer()) + { + iModel->DataPopupContainer()->UpdateVisibility(aForeground); + } + + // call the base class + CAknAppUi::HandleForegroundEventL(aForeground); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonAppUi::HandleResourceChangeL(TInt aType) + { + CAknAppUi::HandleResourceChangeL(aType); + + // update size of the data popup container (implemented here because data popup container + // does not get HandleResourceChangeL events) + if (aType == KEikDynamicLayoutVariantSwitch) + { + if (iModel) + { + if (iModel->DataPopupContainer()) + { + iModel->DataPopupContainer()->SetPositionAndSize(); + } + + } + } + } + +// -------------------------------------------------------------------------------------------- + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_datapopupcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_datapopupcontainer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,247 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon_datapopupcontainer.h" +#include "perfmon.hrh" +#include "perfmon_document.h" +#include "perfmon_appui.h" +#include "perfmon_model.h" + +#include + +_LIT(KFreeFormat,"%S free %S%S"); + +const TInt KLeftMargin = 2; +const TInt KPopupWidth = 94; +const TInt KCPUExtraLength = 8; +const TInt KPopupExtraSpaceBig = 15; +const TInt KPopupExtraSpace = 3; + + +// ===================================== MEMBER FUNCTIONS ===================================== + +void CPerfMonDataPopupContainer::ConstructL(const TRect& /*aRect*/) + { + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + iFont = LatinPlain12(); + iFontSize = iFont->FontMaxHeight(); + + // set windowgroup so that it always on top and does not receive focus + iWindowGroup = RWindowGroup(iCoeEnv->WsSession()); + User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup)); + iWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); + iWindowGroup.EnableReceiptOfFocus(EFalse); + + CreateWindowL(&iWindowGroup); + //SetRect(aRect); + SetPositionAndSize(); + SetBlank(); + + ActivateL(); + } + +// -------------------------------------------------------------------------------------------- + +CPerfMonDataPopupContainer::~CPerfMonDataPopupContainer() + { + iWindowGroup.Close(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonDataPopupContainer::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + gc.SetBrushColor(KRgbWhite); + gc.Clear(aRect); + + // check if sample array has been constructed + if (iModel->SampleEntryArray()) + { + // init font + gc.SetPenColor(KRgbBlack); + gc.UseFont( iFont ); + + // draw a rect around the popup + gc.DrawRect(aRect); + + TInt posCounter(1); + + // draw CPU % if enabled + if (iModel->Settings().iDataPopupSources.iSrcEnabled[ESourceCPU]) + { + TBuf<64> cpuText; + cpuText.Copy(_L("CPU: ")); + + // loop all CPUs + for (TInt i=iModel->CPU0PositionInSamples(); iCPU0PositionInSamples()+iModel->AmountOfCPUs(); i++) + { + // check samples available + if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) + { + TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0); + + // append % value + cpuText.AppendNum( currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 ); + cpuText.Append(_L("% ")); + } + } + + gc.DrawText(cpuText, TPoint(KLeftMargin, iFontSize*posCounter)); + posCounter++; + } + + // draw RAM and Drive values + for (TInt i=iModel->RAMPositionInSamples(); iPowerPositionInSamples(); i++) + { + // check if this setting has been enabled and it has some data + if (iModel->Settings().iDataPopupSources.iSrcEnabled[ESourceRAM + i - iModel->RAMPositionInSamples()] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) + { + TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0); + + TBuf<32> freeBuf; + freeBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0)); + + TBuf<32> buf; + buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &freeBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort); + gc.DrawText(buf, TPoint(KLeftMargin, iFontSize*posCounter)); + + posCounter++; + } + } + + // draw power value + // check if this setting has been enabled and it has some data + if (iModel->Settings().iDataPopupSources.iSrcEnabled[ESourcePwr] && iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->Count() > 0) + { + TSampleData& currentSample = iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->At(0); + + TBuf<32> powerText; + powerText.Copy(_L("Power ")); + + powerText.AppendNum(currentSample.iSize - currentSample.iFree, TRealFormat(KDefaultRealWidth, 0)); + powerText.AppendFormat(_L("%S"), &iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iUnitTypeShort); + + gc.DrawText(powerText, TPoint(KLeftMargin,iFontSize*posCounter)); + + posCounter++; + } + + gc.DiscardFont(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonDataPopupContainer::SizeChanged() + { + DrawNow(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonDataPopupContainer::SetPositionAndSize() + { + CWsScreenDevice* screenDevice = iEikonEnv->ScreenDevice(); + + const TInt popupWidth = iModel->AmountOfCPUs() * KCPUExtraLength + KPopupWidth; + + // top right + if (iModel->Settings().iDataPopupLocation == EDataPopupLocationTopRight) + { + // screen orientation is landscape with softkeys on right + if (AknLayoutUtils::CbaLocation()==AknLayoutUtils::EAknCbaLocationRight) + { + SetRect( + TRect( + screenDevice->SizeInPixels().iWidth-popupWidth-KPopupExtraSpaceBig, + 0, + screenDevice->SizeInPixels().iWidth-KPopupExtraSpaceBig, + iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + KPopupExtraSpace + )); + } + + // any other orientation + else + { + SetRect( + TRect( + screenDevice->SizeInPixels().iWidth-popupWidth, + 0, + screenDevice->SizeInPixels().iWidth, + iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize + KPopupExtraSpace + )); + } + } + + // bottom middle + else if (iModel->Settings().iDataPopupLocation == EDataPopupLocationBottomMiddle) + { + SetRect( + TRect( + screenDevice->SizeInPixels().iWidth/2-popupWidth/2, + screenDevice->SizeInPixels().iHeight - iModel->Settings().iDataPopupSources.EnabledSourcesCount()*iFontSize - KPopupExtraSpace, + screenDevice->SizeInPixels().iWidth/2+popupWidth/2, + screenDevice->SizeInPixels().iHeight + )); + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonDataPopupContainer::UpdateVisibility(TBool aForeground) + { + // application has been brought to foregound + if (aForeground) + { + if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn) + { + MakeVisible(ETrue); + } + else + { + MakeVisible(EFalse); + } + } + + // application has been sent to background + else + { + if (iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityAlwaysOn + || iModel->Settings().iDataPopupVisibility==EDataPopupVisbilityBackgroundOnly) + { + MakeVisible(ETrue); + } + else + { + MakeVisible(EFalse); + } + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonDataPopupContainer::DrawUpdate() + { + DrawDeferred(); + } + +// -------------------------------------------------------------------------------------------- + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_document.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_document.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon_document.h" +#include "perfmon_appui.h" +#include "perfmon_model.h" + +// ================= MEMBER FUNCTIONS ======================= + +// constructor +CPerfMonDocument::CPerfMonDocument(CEikApplication& aApp) +: CAknDocument(aApp) + { + } + +// ---------------------------------------------------- + +// destructor +CPerfMonDocument::~CPerfMonDocument() + { + delete iModel; + } + +// ---------------------------------------------------- + +// EPOC default constructor can leave. +void CPerfMonDocument::ConstructL() + { + iModel = CPerfMonModel::NewL(); + } + +// ---------------------------------------------------- + +// Two-phased constructor. +CPerfMonDocument* CPerfMonDocument::NewL(CEikApplication& aApp) + { + CPerfMonDocument* self = new(ELeave) CPerfMonDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ---------------------------------------------------- +// CPerfMonDocument::CreateAppUiL() +// constructs CPerfMonAppUi +// ---------------------------------------------------- +// +CEikAppUi* CPerfMonDocument::CreateAppUiL() + { + return new (ELeave) CPerfMonAppUi; + } + +// ---------------------------------------------------- +// CPerfMonDocument::OpenFileL +// Overrides CAknDocument::OpenFileL to support document file +// ---------------------------------------------------- +// +CFileStore* CPerfMonDocument::OpenFileL(TBool aDoOpen,const TDesC& aFilename,RFs& aFs) + { + return CEikDocument::OpenFileL(aDoOpen, aFilename, aFs); + } + +// ---------------------------------------------------- + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_graphscontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_graphscontainer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon_graphscontainer.h" +#include "perfmon.hrh" +#include "perfmon_document.h" +#include "perfmon_appui.h" +#include "perfmon_model.h" + +#include + +const TInt KAmountOfMicroSecondsFitsScreen = 20 * 1000000; +#define KRgbCustomGrey TRgb(0x808080) + +_LIT(K100p, "100%"); +_LIT(K50p, "50%"); +_LIT(K0p, "0%"); + +_LIT(KPercentageFormat,"%S %d%%"); + +const TInt KMicroToSecondMultiplier = 1000000; + +// ===================================== MEMBER FUNCTIONS ===================================== + +void CPerfMonGraphsContainer::ConstructL(const TRect& aRect) + { + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + //iFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont); + iFont = LatinBold12(); + + CreateWindowL(); + SetRect(aRect); + SetBlank(); + + ActivateL(); + } + +// -------------------------------------------------------------------------------------------- + +CPerfMonGraphsContainer::~CPerfMonGraphsContainer() + { + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonGraphsContainer::Draw(const TRect& aRect) const + { + // draw black background + CWindowGc& gc = SystemGc(); + gc.SetBrushColor(KRgbBlack); + gc.Clear(aRect); + + // activate font and get size + gc.UseFont(iFont); + TUint fontSize = iFont->FontMaxHeight(); + //TInt fontBaseOffset = iFont->DescentInPixels(); + + + // calculate time factor + TReal scaleFactor = (TReal) aRect.Width() / (TReal) KAmountOfMicroSecondsFitsScreen; + + // calculate area height which is used to draw the grpahs + TInt drawAreaHeight = aRect.Height() - fontSize - fontSize; + + + // check if sample array has been constructed + if (iModel->SampleEntryArray()) + { + + // draw vertical time lines first + TInt verticalBarPeriodInSecs = iModel->Settings().iGraphsVerticalBarPeriod; + + if (verticalBarPeriodInSecs >= 1 && iModel->SampleEntryArray()->At(0).iSampleDataArray->Count() > 0) + { + // get time from the first sample + TSampleData& firstSample = iModel->SampleEntryArray()->At(0).iSampleDataArray->At(0); + TInt64 currentMicroSeconds = firstSample.iTimeFromStart.Int64(); + + // calculate amount of microseconds exceeding value by using the modulo operator + TInt remainderInMicroSeconds = currentMicroSeconds % (verticalBarPeriodInSecs * 1000000); + + // calculate first x pos + TInt vbarXpos = aRect.Width() - (remainderInMicroSeconds * scaleFactor); + + // calculate the amount in seconds + TInt barSeconds = (currentMicroSeconds - remainderInMicroSeconds) / KMicroToSecondMultiplier; + + + // continue drawing periodically the vertical lines + while (vbarXpos >= 0 && barSeconds >= 0) + { + // draw vertical line + gc.SetPenColor(KRgbDarkRed); + gc.DrawLine(TPoint(vbarXpos,fontSize+1), TPoint(vbarXpos,aRect.Height()-fontSize)); + + // draw seconds value + gc.SetPenColor(KRgbCustomGrey); + TBuf<16> secsBuf; + secsBuf.AppendNum(barSeconds); + secsBuf.Append(_L("s")); + gc.DrawText(secsBuf, TPoint(vbarXpos-(iFont->TextWidthInPixels(secsBuf)/2), aRect.Height())); + + // calculate new position + vbarXpos -= verticalBarPeriodInSecs * 1000000 * scaleFactor; + barSeconds -= verticalBarPeriodInSecs; + } + } + + // draw the basic grid + gc.SetPenColor(KRgbCustomGrey); + + gc.DrawLine(TPoint(0,fontSize), TPoint(aRect.Width(),fontSize)); // upper line + gc.DrawText(K100p, TPoint(0,fontSize)); + + gc.DrawLine(TPoint(0,aRect.Height()/2), TPoint(aRect.Width(),aRect.Height()/2)); // mid line + gc.DrawText(K50p, TPoint(0,aRect.Height()/2)); + + gc.DrawLine(TPoint(0,aRect.Height()-fontSize), TPoint(aRect.Width(),aRect.Height()-fontSize)); // bottom line + gc.DrawText(K0p, TPoint(0,aRect.Height()-fontSize)); + + TInt c(0); + + // draw graphs for each sampled type + for (TInt i=0; iSampleEntryArray()->Count(); i++) + { + // check if this setting has been enabled and it has some data + if (iModel->Settings().iGraphsSources.iSrcEnabled[iModel->SampleEntryPosToSettingPos(i)] && iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) + { + // set pen color for the graph + gc.SetPenColor(iModel->SampleEntryArray()->At(i).iGraphColor); + + // remember the position where drawing started + /*TReal*/TInt currentXPos(aRect.Width()); // start drawing from right + /*TReal*/TInt currentYPos(0); + + // draw samples + for (TInt j=0; jSampleEntryArray()->At(i).iSampleDataArray->Count() - 1; j++) + { + TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j); + TSampleData& previousSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(j+1); + + // calculate X position for previous (j+1) + /*TReal*/TInt previousXPos = currentXPos - + ( (Abs(previousSample.iTimeFromStart.Int64() - currentSample.iTimeFromStart.Int64())) * scaleFactor ); + + + // calculate initial Y position + if (j==0) + { + currentYPos = currentSample.iSize > 0 ? (TReal)(currentSample.iFree) / (TReal)currentSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize; + } + + // calculate Y position for previous (j+1) + /*TReal*/TInt previousYPos = previousSample.iSize > 0 ? (TReal)(previousSample.iFree) / (TReal)previousSample.iSize * drawAreaHeight + fontSize : aRect.Height()-fontSize; + + + // draw a line between the previous and current + gc.DrawLine(TPoint((TInt)previousXPos,(TInt)previousYPos), TPoint((TInt)currentXPos,(TInt)currentYPos)); + + + // draw current value in % + if (j==0) // draw the value of first sample + { + TBuf<16> buf; + buf.Format(KPercentageFormat, &iModel->SampleEntryArray()->At(i).iDescription, currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 ); + + gc.DrawText(buf, TPoint(0,fontSize+fontSize+c*fontSize)); + c++; + } + + + // stop drawing if we have run out of space + if (previousXPos < 0) + break; + + // remeber previous values + currentXPos = previousXPos; + currentYPos = previousYPos; + } + } + } + } + + gc.DiscardFont(); + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CPerfMonGraphsContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + return CCoeControl::OfferKeyEventL(aKeyEvent, aType); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonGraphsContainer::HandleResourceChange(TInt aType) + { + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + SetRect(mainPaneRect); + } + else + CCoeControl::HandleResourceChange(aType); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonGraphsContainer::DrawUpdate() + { + DrawDeferred(); + } + +// -------------------------------------------------------------------------------------------- + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_graphsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_graphsview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon.hrh" +#include "perfmon_graphsview.h" +#include "perfmon_graphscontainer.h" +#include "perfmon_document.h" +#include "perfmon_model.h" +#include + +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPerfMonGraphsView::ConstructL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +// +void CPerfMonGraphsView::ConstructL() + { + BaseConstructL( R_PERFMON_VIEW_GRAPHS ); + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + } + +// --------------------------------------------------------- +// CPerfMonGraphsView::~CPerfMonGraphsView() +// --------------------------------------------------------- +// +CPerfMonGraphsView::~CPerfMonGraphsView() + { + if (iContainer) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + } + +// --------------------------------------------------------- +// TUid CPerfMonGraphsView::Id() +// --------------------------------------------------------- +// +TUid CPerfMonGraphsView::Id() const + { + return KGraphsViewUID; + } + +// --------------------------------------------------------- +// TUid CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) +// --------------------------------------------------------- +// +void CPerfMonGraphsView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane); + } + + +// --------------------------------------------------------- +// CPerfMonGraphsView::HandleCommandL(TInt aCommand) +// --------------------------------------------------------- +// +void CPerfMonGraphsView::HandleCommandL(TInt aCommand) + { +/* + switch ( aCommand ) + { + case EPerfMonCmdFileBack: + { + iModel->FileUtils()->MoveUpOneLevelL(); + break; + } + + default: + { +*/ + AppUi()->HandleCommandL( aCommand ); +/* + break; + } + } +*/ + } + +// --------------------------------------------------------- +// CPerfMonGraphsView::HandleClientRectChange() +// --------------------------------------------------------- +// +void CPerfMonGraphsView::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------- +// CPerfMonGraphsView::DoActivateL(...) +// --------------------------------------------------------- +// +void CPerfMonGraphsView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + if (!iContainer) + { + iContainer = new (ELeave) CPerfMonGraphsContainer; + iModel->SetGraphsContainer(iContainer); + iContainer->SetMopParent(this); + iContainer->ConstructL( ClientRect() ); + AppUi()->AddToStackL( *this, iContainer ); + } + } + +// --------------------------------------------------------- +// CPerfMonGraphsView::DoDeactivate() +// --------------------------------------------------------- +// +void CPerfMonGraphsView::DoDeactivate() + { + if (iContainer) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + } + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_model.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_model.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES + +#include "perfmon_model.h" +#include "perfmon_app.h" +#include "perfmon_settingsviewdlg.h" +#include "perfmon.hrh" +#include "perfmon_valuescontainer.h" +#include "perfmon_graphscontainer.h" +#include "perfmon_datapopupcontainer.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +_LIT(KAppName, "PerfMon"); + +// ===================================== MEMBER FUNCTIONS ===================================== + +CPerfMonModel* CPerfMonModel::NewL() + { + CPerfMonModel* self = new(ELeave) CPerfMonModel; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonModel::ConstructL() + { + iDrawState = EDrawStateInvalid; + CPerfMonEngine::ConstructL(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonModel::ActivateModelL() + { + // initialize the data popup container in top-right corner + iDataPopupContainer = new(ELeave) CPerfMonDataPopupContainer; + iDataPopupContainer->ConstructL(TRect(0,0,1,1)); + + ActivateEngineL(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonModel::DeActivateModelL() + { + DeActivateEngineL(); + + if (iDataPopupContainer) + { + delete iDataPopupContainer; + iDataPopupContainer = NULL; + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonModel::SetValuesContainer(CPerfMonValuesContainer* aContainer) + { + iValuesContainer = aContainer; + iDrawState = EDrawStateValues; + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonModel::SetGraphsContainer(CPerfMonGraphsContainer* aContainer) + { + iGraphsContainer = aContainer; + iDrawState = EDrawStateGraphs; + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonModel::SendDrawEventToContainersL() + { + if (iDrawState == EDrawStateValues && iValuesContainer) + iValuesContainer->DrawUpdate(); + else if (iDrawState == EDrawStateGraphs && iGraphsContainer) + iGraphsContainer->DrawUpdate(); + + if (iDataPopupContainer) + iDataPopupContainer->DrawUpdate(); + } + +void CPerfMonModel::HandleSettingsChangeL() + { + // set visibility and location of the data popup + iDataPopupContainer->UpdateVisibility(); + iDataPopupContainer->SetPositionAndSize(); + CPerfMonEngine::HandleSettingsChangeL(); + } + +// -------------------------------------------------------------------------------------------- + +TInt CPerfMonModel::LaunchSettingsDialogL() + { + // launch the settings dialog + TPerfMonSettings newSettings = iSettings; + + CPerfMonSettingsViewDlg* dlg = CPerfMonSettingsViewDlg::NewL(newSettings); + TInt returnValue = dlg->ExecuteLD(R_PERFMON_SETTINGS_DIALOG); + + // always save settings since the settings dialog does not provide a possibility to cancel + iSettings = newSettings; + SaveSettingsL(); + HandleSettingsChangeL(); + + // make sure that the title of the application is correct + CEikStatusPane* sp = iEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL(KAppName); + + return returnValue; + } + +// --------------------------------------------------------------------------- + +TInt CPerfMonModel::SampleEntryPosToSettingPos(TInt aSampleEntryPos) + { + TInt settingPos(0); // return position of aSampleEntryPos in settings + + if (aSampleEntryPos >= iCPU0PositionInSamples && aSampleEntryPos < iRAMPositionInSamples) + { + settingPos = ESourceCPU; + } + else if (aSampleEntryPos == iRAMPositionInSamples) + { + settingPos = ESourceRAM; + } + else + { + settingPos = ESourceC + (aSampleEntryPos-iCDrivePositionInSamples); + } + + return settingPos; + } + +// --------------------------------------------------------------------------- + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_settingsviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_settingsviewdlg.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,702 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon_settingsviewdlg.h" +#include "perfmon_model.h" +#include "perfmon.hrh" +#include "perfmon_std.h" +#include "perfmon_powerlistener.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// ===================================== MEMBER FUNCTIONS ===================================== + +CPerfMonSettingsViewDlg* CPerfMonSettingsViewDlg::NewL(TPerfMonSettings& aSettings) + { + CPerfMonSettingsViewDlg* self = new(ELeave) CPerfMonSettingsViewDlg(aSettings); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CPerfMonSettingsViewDlg::~CPerfMonSettingsViewDlg() + { + // restore default navi pane by popping the tab group from stack + if (iNaviContainer) + iNaviContainer->Pop(); + + if (iSettingItemArray) + { + iSettingItemArray->ResetAndDestroy(); + delete iSettingItemArray; + } + + delete iDecoratedTabGroup; + } + +// -------------------------------------------------------------------------------------------- + +CPerfMonSettingsViewDlg::CPerfMonSettingsViewDlg(TPerfMonSettings& aSettings) : iSettings(aSettings) + { + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::ConstructL() + { + // construct a menu bar + CAknDialog::ConstructL(R_PERFMON_SETTINGS_MENUBAR); + + // get pointer to status pane + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + + // set title text + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("Settings") ); + + // create a new tab group + iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); + iDecoratedTabGroup = iNaviContainer->CreateTabGroupL(this); + iTabGroup = static_cast(iDecoratedTabGroup->DecoratedControl()); + iTabGroup->SetTabFixedWidthL(KTabWidthWithTwoLongTabs); + + // add tabs + iTabGroup->AddTabL(ETabSettingsGeneral, _L("General")); + iTabGroup->AddTabL(ETabSettingsDataPopup, _L("Data popup")); + iTabGroup->AddTabL(ETabSettingsGraphs, _L("Graphs")); + iTabGroup->AddTabL(ETabSettingsLogging, _L("Logging")); + iTabGroup->SetActiveTabByIndex(ETabSettingsGeneral); + + // add new tab group to stack + iNaviContainer->PushL( *iDecoratedTabGroup ); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + switch (aEventType) + { + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + ShowSettingPageL(EFalse); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::TabChangedL(TInt /*aIndex*/) + { + iListBox->SetCurrentItemIndex(0); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::ProcessCommandL(TInt aCommandId) + { + CAknDialog::ProcessCommandL(aCommandId); + + switch (aCommandId) + { + case EPerfMonCmdSettingsChange: + ShowSettingPageL(ETrue); + break; + case EPerfMonCmdSettingsExit: + TryExitL(EAknCmdExit); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CPerfMonSettingsViewDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + if (iTabGroup == NULL) + { + return EKeyWasNotConsumed; + } + + TInt active = iTabGroup->ActiveTabIndex(); + TInt count = iTabGroup->TabCount(); + + switch ( aKeyEvent.iCode ) + { + case EKeyLeftArrow: + if (active > 0) + { + active--; + iTabGroup->SetActiveTabByIndex(active); + TabChangedL(active); + } + break; + + case EKeyRightArrow: + if((active + 1) < count) + { + active++; + iTabGroup->SetActiveTabByIndex(active); + TabChangedL(active); + } + break; + } + + return CAknDialog::OfferKeyEventL(aKeyEvent, aType); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::PreLayoutDynInitL() + { + iListBox = static_cast( Control(EPerfMonSettingItemList) ); + iListBox->SetMopParent(this); + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + iListBox->SetListBoxObserver(this); + + iSettingItemArray = new(ELeave) CAknSettingItemArray(16, EFalse, 0); + + CTextListBoxModel* model = iListBox->Model(); + model->SetItemTextArray(iSettingItemArray); + model->SetOwnershipType(ELbmDoesNotOwnItemArray); + + UpdateListBoxL(); + } + +// -------------------------------------------------------------------------------------------- + +TBool CPerfMonSettingsViewDlg::OkToExitL(TInt aButtonId) + { + return CAknDialog::OkToExitL(aButtonId); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::ShowSettingPageL(TInt aCalledFromMenu) + { + TInt listIndex = iListBox->CurrentItemIndex(); + TInt realIndex = iSettingItemArray->ItemIndexFromVisibleIndex(listIndex); + CAknSettingItem* item = iSettingItemArray->At(realIndex); + item->EditItemL(aCalledFromMenu); + item->StoreL(); + SetVisibilitiesOfSettingItemsL(); + DrawNow(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::SetVisibilitiesOfSettingItemsL() + { + if (iSettingItemArray->Count() > 0) + { + switch (iTabGroup->ActiveTabIndex()) + { + case ETabSettingsGeneral: + { + ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(EFalse); + if (CPerfMonPowerListener::IsSupported()) + ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(EFalse); + else + ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue); + + break; + } + + case ETabSettingsDataPopup: + { + ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(EFalse); + + ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue); + + break; + } + + case ETabSettingsGraphs: + { + ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(EFalse); + + ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(ETrue); + + break; + } + + case ETabSettingsLogging: + { + ((*iSettingItemArray)[ESettingListItemHeartBeat])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemMaxSamples])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPriority])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemCPUMode])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemKeepBackLightOn])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPowerMonitoringEnabled])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemDataPopupVisbility])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemDataPopupLocation])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemDataPopupSources])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemGraphsVerticalBarPeriod])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemGraphsSources])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemLoggingMode])->SetHidden(EFalse); + + if (iSettings.iLoggingMode == ELoggingModeLogFile || iSettings.iLoggingMode == ELoggingModeRDebugLogFile) + ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(EFalse); + else + ((*iSettingItemArray)[ESettingListItemLoggingFilePath])->SetHidden(ETrue); + + ((*iSettingItemArray)[ESettingListItemLoggingSources])->SetHidden(EFalse); + + break; + } + + default: + User::Panic(_L("TabIOOB"), 50); + break; + } + + iSettingItemArray->RecalculateVisibleIndicesL(); + iListBox->HandleItemAdditionL(); + iListBox->UpdateScrollBarsL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::UpdateListBoxL() + { + iSettingItemArray->ResetAndDestroy(); + + // create items + TInt ordinal(0); + + AddSettingItemL(ESettingListItemHeartBeat, + R_HEARTBEAT_SETTING_TITLE, + R_HEARTBEAT_SETTING_PAGE, + NULL, + ordinal++); + + AddSettingItemL(ESettingListItemMaxSamples, + R_MAXSAMPLES_SETTING_TITLE, + R_MAXSAMPLES_SETTING_PAGE, + NULL, + ordinal++); + + AddSettingItemL(ESettingListItemPriority, + R_PRIORITY_SETTING_TITLE, + R_PRIORITY_SETTING_PAGE, + R_PRIORITY_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemCPUMode, + R_CPUMODE_SETTING_TITLE, + R_CPUMODE_SETTING_PAGE, + R_CPUMODE_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemKeepBackLightOn, + R_KEEPBACKLIGHTON_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemPowerMonitoringEnabled, + R_POWERMONITORINGENABLED_SETTING_TITLE, + R_BINARY_SETTING_PAGE, + R_YESNO_BINARYSELECTION_TEXTS, + ordinal++); +// + AddSettingItemL(ESettingListItemDataPopupVisbility, + R_DATAPOPUPVISIBILITY_SETTING_TITLE, + R_DATAPOPUPVISIBILITY_SETTING_PAGE, + R_DATAPOPUPVISIBILITY_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemDataPopupLocation, + R_DATAPOPUPLOCATION_SETTING_TITLE, + R_DATAPOPUPLOCATION_SETTING_PAGE, + R_DATAPOPUPLOCATION_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemDataPopupSources, + R_SOURCES_SETTING_TITLE, + R_SOURCES_SETTING_PAGE, + NULL, + ordinal++); +// + AddSettingItemL(ESettingListItemGraphsVerticalBarPeriod, + R_GRAPHSVERTICALBAR_SETTING_TITLE, + R_GRAPHSVERTICALBAR_SETTING_PAGE, + NULL, + ordinal++); + + AddSettingItemL(ESettingListItemGraphsSources, + R_SOURCES_SETTING_TITLE, + R_SOURCES_SETTING_PAGE, + NULL, + ordinal++); +// + AddSettingItemL(ESettingListItemLoggingMode, + R_LOGGINGMODE_SETTING_TITLE, + R_LOGGINGMODE_SETTING_PAGE, + R_LOGGINGMODE_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemLoggingFilePath, + R_LOGGINGFILEPATH_SETTING_TITLE, + R_LOGGINGFILEPATH_SETTING_PAGE, + NULL, + ordinal++); + + AddSettingItemL(ESettingListItemLoggingSources, + R_SOURCES_SETTING_TITLE, + R_SOURCES_SETTING_PAGE, + NULL, + ordinal++); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonSettingsViewDlg::AddSettingItemL(TInt aId, + TInt aTitleResource, + TInt aSettingPageResource, + TInt aAssociatedResource, + TInt aOrdinal) + { + // create a setting item + CAknSettingItem* settingItem = NULL; + + switch (aId) + { + case ESettingListItemHeartBeat: + settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iHeartBeat); + break; + + case ESettingListItemMaxSamples: + settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iMaxSamples); + break; + + case ESettingListItemPriority: + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iPriority); + break; + + case ESettingListItemCPUMode: + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iCPUMode); + break; + + case ESettingListItemKeepBackLightOn: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iKeepBacklightOn); + break; + + case ESettingListItemPowerMonitoringEnabled: + settingItem = new(ELeave) CAknBinaryPopupSettingItem(aId, iSettings.iPowerMonitoringEnabled); + break; + + case ESettingListItemDataPopupVisbility: + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupVisibility); + break; + + case ESettingListItemDataPopupLocation: + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iDataPopupLocation); + break; + + case ESettingListItemDataPopupSources: + settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iDataPopupSources); + break; + + case ESettingListItemGraphsVerticalBarPeriod: + settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iGraphsVerticalBarPeriod); + break; + + case ESettingListItemGraphsSources: + settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iGraphsSources); + break; + + case ESettingListItemLoggingMode: + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iSettings.iLoggingMode); + break; + + case ESettingListItemLoggingFilePath: + settingItem = new(ELeave) CAknTextSettingItem(aId, iSettings.iLoggingFilePath); + break; + + case ESettingListItemLoggingSources: + settingItem = new(ELeave) CSourceSelectionCheckBoxSettingItem(aId, iSettings.iLoggingSources); + break; + + default: + User::Panic(_L("NotSetItem"), 50); + break; + } + + CleanupStack::PushL(settingItem); + + // get title text + HBufC* itemTitle = StringLoader::LoadLC(aTitleResource); + + // construct the setting item + settingItem->ConstructL(EFalse, aOrdinal, *itemTitle, NULL, aSettingPageResource, + EAknCtPopupSettingList, NULL, aAssociatedResource); + + // append the setting item to settingitem array + iSettingItemArray->InsertL(aOrdinal, settingItem); + + CleanupStack::PopAndDestroy(); //itemTitle + CleanupStack::Pop(); //settingItem + } + + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +CSourceSelectionCheckBoxSettingItem::CSourceSelectionCheckBoxSettingItem( TInt aIdentifier, TPerfMonSources& aMemoryInUse ): + CAknSettingItem(aIdentifier), iExternalSources( aMemoryInUse ) + { + } + +CSourceSelectionCheckBoxSettingItem::~CSourceSelectionCheckBoxSettingItem() + { + delete iSettingText; + + if( iItemArray ) + { + iItemArray->ResetAndDestroy(); + delete iItemArray; + } + } + +void CSourceSelectionCheckBoxSettingItem::AddNewItemToArrayL(const TDesC& aLabel) + { + TBuf<64> buf; + buf.Copy(aLabel); + + CSelectableItem* item = new(ELeave) CSelectableItem(buf, EFalse); + CleanupStack::PushL(item); + item->ConstructL(); + iItemArray->AppendL(item); // Ownership is transferred + CleanupStack::Pop(); // item + } + +void CSourceSelectionCheckBoxSettingItem::CompleteConstructionL() + { + SetEmptyItemTextL(_L("Nothing selected")); + + iItemArray = new(ELeave) CSelectionItemList(16); + AddNewItemToArrayL(_L("CPU")); + AddNewItemToArrayL(_L("RAM")); + AddNewItemToArrayL(_L("C:")); + AddNewItemToArrayL(_L("D:")); + AddNewItemToArrayL(_L("E:")); + AddNewItemToArrayL(_L("F:")); + AddNewItemToArrayL(_L("G:")); + AddNewItemToArrayL(_L("H:")); + AddNewItemToArrayL(_L("I:")); + AddNewItemToArrayL(_L("Power")); + + __ASSERT_ALWAYS(ESourcesLength==iItemArray->Count(), User::Panic(_L("Src.mismatch"),443)); + } + +// transfer settings to the variables defined in the constructor +void CSourceSelectionCheckBoxSettingItem::StoreL() + { + for (TInt i=0; iAt(i)->SelectionStatus(); + } + } + +// load settings from the variables defined in the constructor to our internal variables +void CSourceSelectionCheckBoxSettingItem::LoadL() + { + for (TInt i=0; iAt(i)->SetSelectionStatus( iExternalSources.iSrcEnabled[i] ); + } + } + +// returns the text shown in the setting item list +const TDesC& CSourceSelectionCheckBoxSettingItem::SettingTextL() + { + TBuf<32> settingText; + + if (iItemArray->At(ESourceCPU)->SelectionStatus()) + settingText.Append(_L("CPU ")); + if (iItemArray->At(ESourceRAM)->SelectionStatus()) + settingText.Append(_L("RAM ")); + if (iItemArray->At(ESourceC)->SelectionStatus()) + settingText.Append(_L("C: ")); + if (iItemArray->At(ESourceD)->SelectionStatus()) + settingText.Append(_L("D: ")); + if (iItemArray->At(ESourceE)->SelectionStatus()) + settingText.Append(_L("E: ")); + if (iItemArray->At(ESourceF)->SelectionStatus()) + settingText.Append(_L("F: ")); + if (iItemArray->At(ESourceG)->SelectionStatus()) + settingText.Append(_L("G: ")); + if (iItemArray->At(ESourceH)->SelectionStatus()) + settingText.Append(_L("H: ")); + if (iItemArray->At(ESourceI)->SelectionStatus()) + settingText.Append(_L("I: ")); + if (iItemArray->At(ESourcePwr)->SelectionStatus()) + settingText.Append(_L("Power ")); + settingText.TrimAll(); + + if (iSettingText) + { + delete iSettingText; + iSettingText = NULL; + } + + iSettingText = HBufC::NewL(settingText.Length()); + iSettingText->Des().Copy(settingText); + + if ( iSettingText->Length() > 0 ) + return *iSettingText; + else + return EmptyItemText(); + } + + +// launches the setting page +void CSourceSelectionCheckBoxSettingItem::EditItemL(TBool /*aCalledFromMenu*/) + { + CSourceSelectionCheckBoxSettingPage* dlg = new(ELeave) CSourceSelectionCheckBoxSettingPage(SettingPageResourceId(), iItemArray); + + SetSettingPage( dlg ); + SettingPage()->SetSettingPageObserver(this); + + SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged); + SetSettingPage(0); // it is deleted now + } + + +// handles setting page events +void CSourceSelectionCheckBoxSettingItem::HandleSettingPageEventL( CAknSettingPage* aSettingPage, TAknSettingPageEvent aEventType ) + { + switch( aEventType ) + { + case EEventSettingCancelled: + { + // If setting is cancelled, load old values + LoadL(); + break; + } + case EEventSettingChanged: + { + // If setting has changed, update CBA visibility + static_cast( aSettingPage )->UpdateCba(); + break; + } + default: + { + break; + } + } + CAknSettingItem::HandleSettingPageEventL( aSettingPage, aEventType ); + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +CSourceSelectionCheckBoxSettingPage::CSourceSelectionCheckBoxSettingPage(TInt aResourceID, CSelectionItemList* aItemArray ) + : CAknCheckBoxSettingPage( aResourceID, aItemArray ) + { + } + +void CSourceSelectionCheckBoxSettingPage::UpdateCba() + { + // Cache the pointer to button group container + CEikButtonGroupContainer* cba = Cba(); + // Left softkey should be visible if there are items selected, + // i.e. the selection index array has items. + TBool visible( ListBoxControl()->View()->SelectionIndexes()->Count() > 0 ); + // Resolve left softkey command id + TInt leftId( cba->ButtonGroup()->CommandId( 0 ) ); + // Check if left softkey visibility has changed + if( visible != cba->IsCommandVisible( leftId ) ) + { + // Left softkey visibility has changed, update it + cba->MakeCommandVisible( leftId, visible ); + } + } + +// -------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_valuescontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_valuescontainer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon_valuescontainer.h" +#include "perfmon.hrh" +#include "perfmon_document.h" +#include "perfmon_appui.h" +#include "perfmon_model.h" + +#include + +_LIT(KFreeFormat,"%S free %S%S"); +_LIT(KSizeFormat,"%S size %S%S"); + +const TInt KLeftMargin = 2; + + +// ===================================== MEMBER FUNCTIONS ===================================== + +void CPerfMonValuesContainer::ConstructL(const TRect& aRect) + { + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + iFont = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont); + + CreateWindowL(); + SetRect(aRect); + SetBlank(); + + ActivateL(); + } + +// -------------------------------------------------------------------------------------------- + +CPerfMonValuesContainer::~CPerfMonValuesContainer() + { + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonValuesContainer::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + gc.SetBrushColor(KRgbWhite); + gc.Clear(aRect); + + // check if sample array has been constructed + if (iModel->SampleEntryArray()) + { + // init font + gc.SetPenColor(KRgbBlack); + gc.UseFont( iFont ); + TUint separator = iFont->HeightInPixels()-2; + + // draw CPU % + TBuf<64> cpuText; + cpuText.Copy(_L("CPU: ")); + + for (TInt i=iModel->CPU0PositionInSamples(); iCPU0PositionInSamples()+iModel->AmountOfCPUs(); i++) + { + // check if data available + if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) + { + TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0); + + cpuText.AppendNum( currentSample.iSize > 0 ? TInt( (1 - ((TReal)(currentSample.iFree) / (TReal)currentSample.iSize)) * 100) : 0 ); + cpuText.Append(_L("% ")); + } + + } + gc.DrawText(cpuText, TPoint(KLeftMargin,separator)); + + TInt c(2); // line counter + + // draw RAM and Drive values + for (TInt i=iModel->RAMPositionInSamples(); iPowerPositionInSamples(); i++) + { + // check if data available + if (iModel->SampleEntryArray()->At(i).iSampleDataArray->Count() > 0) + { + TSampleData& currentSample = iModel->SampleEntryArray()->At(i).iSampleDataArray->At(0); + + if (currentSample.iSize > 0) // draw only when size is known, this should ignore absent drives + { + TBuf<32> amountBuf; + amountBuf.AppendNum(currentSample.iFree, TRealFormat(KDefaultRealWidth, 0)); + + TBuf<32> buf; + buf.Format(KFreeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort); + gc.DrawText(buf, TPoint(KLeftMargin,separator*c)); + c++; + + amountBuf.Copy(KNullDesC); + amountBuf.AppendNum(currentSample.iSize, TRealFormat(KDefaultRealWidth, 0)); + + buf.Format(KSizeFormat, &iModel->SampleEntryArray()->At(i).iDescription, &amountBuf, &iModel->SampleEntryArray()->At(i).iUnitTypeShort); + gc.DrawText(buf, TPoint(KLeftMargin,separator*c)); + c++; + } + } + } + + // draw power value + if (iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->Count() > 0) + { + TSampleData& currentSample = iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iSampleDataArray->At(0); + + if (currentSample.iSize > 0) + { + TBuf<32> powerText; + powerText.Copy(_L("Power ")); + + powerText.AppendNum(currentSample.iSize - currentSample.iFree, TRealFormat(KDefaultRealWidth, 0)); + powerText.AppendFormat(_L("%S"), &iModel->SampleEntryArray()->At(iModel->PowerPositionInSamples()).iUnitTypeShort); + + gc.DrawText(powerText, TPoint(KLeftMargin,separator*c)); + } + } + + gc.DiscardFont(); + } + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CPerfMonValuesContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + return CCoeControl::OfferKeyEventL(aKeyEvent, aType); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonValuesContainer::HandleResourceChange(TInt aType) + { + if (aType == KEikDynamicLayoutVariantSwitch) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + SetRect(mainPaneRect); + } + else + CCoeControl::HandleResourceChange(aType); + } + +// -------------------------------------------------------------------------------------------- + +void CPerfMonValuesContainer::DrawUpdate() + { + DrawDeferred(); + } + +// -------------------------------------------------------------------------------------------- + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/avkon/src/perfmon_valuesview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/avkon/src/perfmon_valuesview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "perfmon.hrh" +#include "perfmon_valuesview.h" +#include "perfmon_valuescontainer.h" +#include "perfmon_document.h" +#include "perfmon_model.h" +#include + +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CPerfMonValuesView::ConstructL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +// +void CPerfMonValuesView::ConstructL() + { + BaseConstructL( R_PERFMON_VIEW_VALUES ); + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + } + +// --------------------------------------------------------- +// CPerfMonValuesView::~CPerfMonValuesView() +// --------------------------------------------------------- +// +CPerfMonValuesView::~CPerfMonValuesView() + { + if (iContainer) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + } + +// --------------------------------------------------------- +// TUid CPerfMonValuesView::Id() +// --------------------------------------------------------- +// +TUid CPerfMonValuesView::Id() const + { + return KValuesViewUID; + } + +// --------------------------------------------------------- +// TUid CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) +// --------------------------------------------------------- +// +void CPerfMonValuesView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane); + } + + +// --------------------------------------------------------- +// CPerfMonValuesView::HandleCommandL(TInt aCommand) +// --------------------------------------------------------- +// +void CPerfMonValuesView::HandleCommandL(TInt aCommand) + { +/* + switch ( aCommand ) + { + case EPerfMonCmdFileBack: + { + iModel->FileUtils()->MoveUpOneLevelL(); + break; + } + + default: + { +*/ + AppUi()->HandleCommandL( aCommand ); +/* + break; + } + } +*/ + } + +// --------------------------------------------------------- +// CPerfMonValuesView::HandleClientRectChange() +// --------------------------------------------------------- +// +void CPerfMonValuesView::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------- +// CPerfMonValuesView::DoActivateL(...) +// --------------------------------------------------------- +// +void CPerfMonValuesView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + if (!iContainer) + { + iContainer = new (ELeave) CPerfMonValuesContainer; + iModel->SetValuesContainer(iContainer); + iContainer->SetMopParent(this); + iContainer->ConstructL( ClientRect() ); + AppUi()->AddToStackL( *this, iContainer ); + } + } + +// --------------------------------------------------------- +// CPerfMonValuesView::DoDeactivate() +// --------------------------------------------------------- +// +void CPerfMonValuesView::DoDeactivate() + { + if (iContainer) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + } + +// End of File diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/app.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/app.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,80 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = app +TARGET = PerfMon +DEPENDPATH += . +INCLUDEPATH += inc + +load(hb.prf) +symbian:CONFIG -= symbian_i18n + +HEADERS += inc/application.h \ + inc/mainwindow.h \ + inc/mainview.h \ + inc/datacontainer.h \ + inc/valuedatacontainer.h \ + inc/graphdatacontainer.h \ + inc/settingsview.h \ +# inc/datapopup.h \ + inc/enginewrapper.h + +SOURCES += src/main.cpp \ + src/application.cpp \ + src/mainwindow.cpp \ + src/mainview.cpp \ + src/valuedatacontainer.cpp \ + src/graphdatacontainer.cpp \ + src/settingsview.cpp \ +# src/datapopup.cpp \ + src/enginewrapper.cpp + +RESOURCES += + +symbian: { + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += ../../../engine/inc + HEADERS += ../../../engine/inc/perfmon_engine.h \ + ../../../engine/inc/perfmon_powerlistener.h + + SOURCES += ../../../engine/src/perfmon_engine.cpp \ + ../../../engine/src/perfmon_powerlistener.cpp + + LIBS += -lestor \ + -lbafl \ + -lefsrv \ + -lavkon \ + -lapparc \ + -lapgrfx \ + -lgdi \ + -lcone \ + -lcentralrepository \ + -lHWRMPowerClient + + TARGET.CAPABILITY = WriteDeviceData + + TARGET.UID2 = 0x100039CE + TARGET.UID3 = 0x20011385 + TARGET.SID = 0x20011385 + TARGET.VID = 0x101FB657 // Nokia + + TARGET.EPOCHEAPSIZE = 0x10000 0x2000000 // Min 64Kb, Max 32Mb + + ICON = ../../../icons/qgn_menu_perfmon.svg + + RSS_RULES += "group_name = \"RnD Tools\""; +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/application.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/application.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef APPLICATION_H +#define APPLICATION_H + +#include + + +class QSymbianEvent; + +class Application : public HbApplication +{ + Q_OBJECT + +public: + Application(int &argc, char *argv[]); + +signals: + void foregroundEvent(bool foreground); + +protected: +#ifdef Q_OS_SYMBIAN + bool symbianEventFilter(const QSymbianEvent * event); +#endif +}; + +#endif // APPLICATION_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/datacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/datacontainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef DATACONTAINER_H +#define DATACONTAINER_H + +#include +#include + +class DataContainer : public HbWidget +{ + Q_OBJECT + +public: + DataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0) : + HbWidget(parent), + mEngine(engine) + { + } + + void hideContainer() + { + disconnect(&mEngine, SIGNAL(samplesUpdated()), this, SLOT(samplesUpdated())); + hide(); + } + + void showContainer() + { + connect(&mEngine, SIGNAL(samplesUpdated()),this, SLOT(samplesUpdated())); + show(); + } + + inline const EngineWrapper& engine() const { return mEngine; } + +public slots: + virtual void samplesUpdated() + { + update(); + } + +private: + const EngineWrapper& mEngine; +}; + +#endif // DATACONTAINER_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/datapopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/datapopup.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef DATAPOPUP_H +#define DATAPOPUP_H + +#include +#include + +class EngineWrapper; + +class DataPopup : public HbDeviceDialog +{ + Q_OBJECT + +public: + DataPopup(EngineWrapper &engine); + +public slots: + void show(); + void hide(); + void updateSamples(); + void updateSettings(); + void updateVisibility(bool foreground); + +signals: + void clicked(); + +private slots: + void triggerAction(QVariantMap data); + +private: + QVariantMap collectParams() const; + void updateData(); + +private: + EngineWrapper &mEngine; + + bool mPopupCreated; + + bool mPopupVisible; +}; + +#endif // DATAPOPUP_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/enginewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/enginewrapper.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ENGINEWRAPPER_H +#define ENGINEWRAPPER_H + +#include "perfmon_engine.h" + +#include +#include +#include +#include + +struct SampleData +{ + qint64 mFree; + qint64 mSize; + qint64 mTimeFromStart; +}; + +class SampleEntry +{ +public: + SampleEntry(const TSampleEntry& sampleEntry) : mEntry(&sampleEntry) {} + + QString description() const { return QString((QChar*)mEntry->iDescription.Ptr(), mEntry->iDescription.Length()); } + QString unitShort() const { return QString((QChar*)mEntry->iUnitTypeShort.Ptr(), mEntry->iUnitTypeShort.Length()); } + QString unitLong() const { return QString((QChar*)mEntry->iUnitTypeLong.Ptr(), mEntry->iUnitTypeLong.Length()); } + int driveNumber() const { return mEntry->iDriveNumber; } + QColor graphColor() const { return QColor(mEntry->iGraphColor.Red(), mEntry->iGraphColor.Green(), mEntry->iGraphColor.Blue()); } + + int sampleCount() const { return mEntry->iSampleDataArray->Count(); } + inline const SampleData& sample(int index) const { return reinterpret_cast(mEntry->iSampleDataArray->At(index)); } +private: + const TSampleEntry *mEntry; + +friend class EngineWrapper; +}; + +class PerfMonSources +{ +public: + int count() const { return ESourcesLength; } + int isEnabled (int index) const { return mSources.iSrcEnabled[index]; } + void setEnabled(int index, bool enabled) { mSources.iSrcEnabled[index] = enabled; } + QList enabledIndexes() const { + QList indexes; + for(int i=0; i &indexes) + { + for (int i=0; i& sampleEntries() const { return mEntries; } + + PerfMonSettings &settings() { return mSettings; } + const PerfMonSettings &settings() const { return mSettings; } + + int SampleEntryPosToSettingPos(int entryPos) const; + +public slots: + + bool updateSettings(); + bool initialize(); + void finalize(); + void setLoggingEnabled(bool enabled); + +signals: + + void samplesUpdated(); + void settingsUpdated(); + +protected: + void SendDrawEventToContainersL(); + +private: + QList mEntries; + + void createSampleEntriesArray(); + + PerfMonSettings mSettings; +}; + +#endif //ENGINEWRAPPER_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/graphdatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/graphdatacontainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef GRAPHDATACONTAINER_H +#define GRAPHDATACONTAINER_H + +#include "datacontainer.h" + +#include + +class GraphDataContainer : public DataContainer +{ + Q_OBJECT +public: + GraphDataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0); + +protected: + void paint (QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget = 0); + +private: + QFont mFont; +}; + +#endif // GRAPHDATACONTAINER_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/mainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/mainview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MAINVIEW_H +#define MAINVIEW_H + +#include + +#include "valuedatacontainer.h" +#include "graphdatacontainer.h" + +class HbAction; +class EngineWrapper; + +class MainView : public HbView +{ + Q_OBJECT + +public: + MainView(EngineWrapper &engine); + ~MainView(); + +private: + void createMenu(); + +public slots: + void showValues(); + void showGraphs(); + void toggleLogging(); + void showAbout(); + +signals: + void settingsCommandInvoked(); + +private: + void updateLoggingAction(); + +private: + EngineWrapper &mEngine; + + ValueDataContainer *mValueDataContainer; + GraphDataContainer *mGraphDataContainer; + + HbAction *mValuesAction; + HbAction *mGraphAction; + HbAction *mSwitchViewAction; + HbAction *mLoggingAction; +}; + +#endif // MAINVIEW_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/mainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/mainwindow.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class EngineWrapper; +class MainView; +class SettingsView; + +class MainWindow : public HbMainWindow +{ + Q_OBJECT +public: + MainWindow(EngineWrapper &engine, QWidget *parent = 0); + +public slots: + void showMainView(); + void showSettings(); + +private: + void clearViews(); + +private: + EngineWrapper &mEngine; + MainView* mMainView; + SettingsView* mSettingsView; +}; + +#endif // MAINWINDOW_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/popupdatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/popupdatacontainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef POPUPDATACONTAINER_H +#define POPUPDATACONTAINER_H + +#include "datacontainer.h" + +#include + +class PopupDataContainer : public DataContainer +{ + Q_OBJECT +public: + PopupDataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0); + +public slots: + virtual void samplesUpdated(); + +protected: + void paint (QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget = 0); + +private: + QFont mFont; +}; + +#endif // POPUPDATACONTAINER_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/settingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/settingsview.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef SETTINGSVIEW_H +#define SETTINGSVIEW_H + +#include + +class HbDataForm; +class HbDataFormModel; +class HbDataFormModelItem; + +class EngineWrapper; +class PerfMonSettings; +class PerfMonSources; + +class SettingsView : public HbView +{ + Q_OBJECT + +signals: + void finished(bool ok); + +public: + SettingsView(EngineWrapper &engine); + +private slots: + void dataItemDisplayed(const QModelIndex &index); + void logModeChanged(int index); + void accept(); + void reject(); + +private: + void createModel(HbDataFormModel &model); + void load(const PerfMonSettings& settings); + void save(PerfMonSettings& settings); + void createLogFilePathItem(); + void removeLogFilePathItem(); + +private: + EngineWrapper &mEngine; + HbDataForm *mSettingsForm; + HbDataFormModel *mModel; + + HbDataFormModelItem* mHeartBeatItem; + HbDataFormModelItem* mMaxSamplesItem; + HbDataFormModelItem* mPriorityItem; + HbDataFormModelItem* mCpuSamplingItem; + HbDataFormModelItem* mKeepBacklightItem; + HbDataFormModelItem* mPowerMonitoringEnabledItem; + HbDataFormModelItem* mPopupVisibilityItem; + HbDataFormModelItem* mPopupLocationItem; + HbDataFormModelItem* mPopupSourcesItem; + HbDataFormModelItem* mVerticalBarPeriodItem; + HbDataFormModelItem* mGraphSourcesItem; + + HbDataFormModelItem* mLogPage; + HbDataFormModelItem* mLogModeItem; + HbDataFormModelItem* mLogFilePathItem; + HbDataFormModelItem* mLogSourcesItem; + + QString mLogFilePath; +}; + +#endif // SETTINGSVIEW_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/inc/valuedatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/inc/valuedatacontainer.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef VALUEDATACONTAINER_H +#define VALUEDATACONTAINER_H + +#include "datacontainer.h" + +#include + +class ValueDataContainer : public DataContainer +{ + Q_OBJECT +public: + ValueDataContainer(const EngineWrapper& engine, QGraphicsItem *parent = 0); + +protected: + void paint (QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget = 0); + +private: + QFont mFont; +}; + +#endif // VALUEDATACONTAINER_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/application.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/application.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include "application.h" + +#ifdef Q_OS_SYMBIAN +#include + +#endif + +Application::Application(int &argc, char *argv[]) : + HbApplication(argc, argv) +{ +} + +#ifdef Q_OS_SYMBIAN +bool Application::symbianEventFilter(const QSymbianEvent * event) +{ + if (event->type() == QSymbianEvent::WindowServerEvent) + { + const TWsEvent *aEvent = event->windowServerEvent(); + + if (aEvent->Type() == EEventFocusLost) { + emit foregroundEvent(false); + } + + if (aEvent->Type() == EEventFocusGained) { + emit foregroundEvent(true); + } + } + return HbApplication::symbianEventFilter(event); +} +#endif diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/datapopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/datapopup.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,177 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include + +#include "datapopup.h" +#include "enginewrapper.h" +#include "popupdatacontainer.h" + +DataPopup::DataPopup(EngineWrapper &engine) : + mEngine(engine), + mPopupCreated(false), + mPopupVisible(false) +{ + connect(&mEngine, SIGNAL(samplesUpdated()), this, SLOT(updateSamples())); + connect(&mEngine, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); + connect(this, SIGNAL(dataReceived(QVariantMap)), this, SLOT(triggerAction(QVariantMap))); +} + +void DataPopup::show() +{ + mPopupVisible = true; + if (!mPopupCreated && + mEngine.sampleEntries().length() && + mEngine.settings().dataPopupSources().enabledIndexes().length()) + { + bool anyData = false; + foreach (QVariant index, mEngine.settings().dataPopupSources().enabledIndexes()) + anyData = anyData || mEngine.sampleEntries().at(index.toInt()).sampleCount(); + + if (anyData) { + mPopupCreated = HbDeviceDialog::show("com.nokia.rnd.perfmondatapopup/1.0", + collectParams()); + } + } +} + +void DataPopup::hide() +{ + mPopupVisible = false; + if (mPopupCreated) { + mPopupCreated = !cancel(); + } +} + +void DataPopup::updateSamples() +{ + updateData(); +} + +void DataPopup::updateSettings() +{ + // mEngine.settings().dataPopupVisibility can only be changed from + // main window, so we may assume the window is in foreground + updateVisibility(true); + updateData(); +} + +void DataPopup::updateVisibility(bool foreground) +{ + if (mEngine.settings().dataPopupVisibility() == EDataPopupVisbilityAlwaysOn || + (mEngine.settings().dataPopupVisibility() == EDataPopupVisbilityBackgroundOnly && !foreground)) { + + show(); + } else { + hide(); + } +} + +void DataPopup::triggerAction(QVariantMap data) +{ + if (data.contains("mouseEvent") && data["mouseEvent"].toString() == "press") { + emit clicked(); + + // data popup was clicked, move it to other position + mEngine.settings().setDataPopupLocation( + EDataPopupLocationBottomMiddle - mEngine.settings().dataPopupLocation()); + mEngine.updateSettings(); + } +} + +QVariantMap DataPopup::collectParams() const +{ + QVariantMap result; + + // add location param + result["location"] = mEngine.settings().dataPopupLocation(); + + // add lines param + QStringList lines; + QList entries = mEngine.sampleEntries(); + int posCounter(ESourceCPU); + + if (mEngine.settings().dataPopupSources().isEnabled(posCounter)) + { + // loop all CPUs + for (TInt i = mEngine.CPU0PositionInSamples(); i < mEngine.CPU0PositionInSamples() + mEngine.AmountOfCPUs(); i++) + { + // check samples available + if (entries.at(i).sampleCount() > 0) + { + const SampleEntry &entry = entries.at(i); + const SampleData &sample = entry.sample(0); + + double perc = sample.mSize > 0 ? + 100. - 100. * sample.mFree / sample.mSize : 0; + + QString text = tr("%1 %2%").arg(entry.description()). + arg(perc, 0, 'f', 0); + lines.append(text); + } + } + } + + posCounter++; + + // draw RAM and Drive values + for (TInt i = mEngine.RAMPositionInSamples(); i < mEngine.PowerPositionInSamples(); i++) + { + // check if this setting has been enabled and it has some data + if (mEngine.settings().dataPopupSources().isEnabled(posCounter) && entries.at(i).sampleCount() > 0) + { + const SampleEntry &entry = entries.at(i); + const SampleData &sample = entry.sample(0); + + QString text = tr("%1 free %L2%3").arg(entry.description()). + arg(sample.mFree).arg(entry.unitShort()); + lines.append(text); + } + + posCounter++; + } + + // draw power value + // check if this setting has been enabled and it has some data + if (mEngine.settings().dataPopupSources().isEnabled(posCounter) && entries.at(mEngine.PowerPositionInSamples()).sampleCount() > 0) + { + const SampleEntry &entry = entries.at(mEngine.PowerPositionInSamples()); + const SampleData &sample = entry.sample(0); + + QString text = tr("%1 %L2%3").arg(entry.description()). + arg(sample.mSize - sample.mFree).arg(entry.unitShort()); + lines.append(text); + } + + result["lines"] = lines; + + return result; +} + +void DataPopup::updateData() +{ + if (!mPopupVisible) + return; + + if (!mPopupCreated) { + show(); + } else { + HbDeviceDialog::update(collectParams()); + } +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/enginewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/enginewrapper.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include + +#include "enginewrapper.h" + + +// --------------------------------------------------------------------------- + +EngineWrapper::EngineWrapper() : mSettings(iSettings) +{ +} + +// --------------------------------------------------------------------------- + +EngineWrapper::~EngineWrapper() +{ + finalize(); +} + +// --------------------------------------------------------------------------- + +bool EngineWrapper::initialize() +{ + TInt err = KErrNone; + + TRAP(err, ConstructL()); + if (err != KErrNone) + return false; + + TRAP(err, ActivateEngineL()); + if (err != KErrNone) + return false; + + createSampleEntriesArray(); + + return true; +} + +// --------------------------------------------------------------------------- + +int EngineWrapper::SampleEntryPosToSettingPos(int entryPos) const +{ + int settingPos(0); // return position of aSampleEntryPos in settings + + if (entryPos >= iCPU0PositionInSamples && entryPos < iRAMPositionInSamples) + { + settingPos = ESourceCPU; + } + else if (entryPos == iRAMPositionInSamples) + { + settingPos = ESourceRAM; + } + else + { + settingPos = ESourceC + (entryPos - iCDrivePositionInSamples); + } + + return settingPos; +} + +// --------------------------------------------------------------------------- + +void EngineWrapper::createSampleEntriesArray() +{ + for (TInt i=0; i < iSampleEntryArray->Count(); i++) + { + mEntries.append(iSampleEntryArray->At(i)); + } +} + +// --------------------------------------------------------------------------- + +void EngineWrapper::finalize() +{ + TRAP_IGNORE(DeActivateEngineL()); +} + +// --------------------------------------------------------------------------- + +bool EngineWrapper::updateSettings() +{ + TInt err = KErrNone; + + TRAP(err, SaveSettingsL()); + if (err != KErrNone) + return false; + + TRAP(err, HandleSettingsChangeL()); + if (err != KErrNone) + return false; + + emit settingsUpdated(); + return true; +} + +// --------------------------------------------------------------------------- + +void EngineWrapper::setLoggingEnabled(bool enabled) +{ + EnableLogging(enabled); +} + +// --------------------------------------------------------------------------- + +void EngineWrapper::SendDrawEventToContainersL() +{ + emit samplesUpdated(); +} + +// --------------------------------------------------------------------------- diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/graphdatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/graphdatacontainer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "graphdatacontainer.h" +#include "enginewrapper.h" + +#include +#include + +const int amountOfMicroSecondsFitsScreen = 20 * 1000000; +const int microToSecondMultiplier = 1000000; + +GraphDataContainer::GraphDataContainer(const EngineWrapper& engine, QGraphicsItem *parent) : + DataContainer(engine, parent) +{ + HbFontSpec spec(HbFontSpec::Secondary); + mFont = spec.font(); + mFont.setPixelSize(12); +} + +void GraphDataContainer::paint (QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + // set proper font and prepare font metrics for text width / height calculation + painter->setFont(mFont); + QFontMetricsF metrics(mFont); + + // fill background with black color + painter->fillRect(rect(), Qt::black); + + // calculate time factor + qreal scaleFactor = rect().width() / (qreal) amountOfMicroSecondsFitsScreen; + + // calculate area height which is used to draw the grpahs + qreal drawAreaHeight = rect().height() - 2 * metrics.height(); + + + const QList sampleEntries = engine().sampleEntries(); + + // check if sample array has been constructed + if (sampleEntries.length()) + { + // draw vertical time lines first + int verticalBarPeriodInSecs = engine().settings().graphVerticalBarPeriod(); + + if (verticalBarPeriodInSecs >= 1 && sampleEntries.first().sampleCount() > 0) + { + // get time from the first sample + const SampleData& firstSample = sampleEntries.first().sample(0); + qint64 currentMicroSeconds = firstSample.mTimeFromStart; + + // calculate amount of microseconds exceeding value by using the modulo operator + int remainderInMicroSeconds = currentMicroSeconds % (verticalBarPeriodInSecs * 1000000); + + // calculate first x pos + qreal vbarXpos = rect().width() - (remainderInMicroSeconds * scaleFactor); + + // calculate the amount in seconds + int barSeconds = (currentMicroSeconds - remainderInMicroSeconds) / microToSecondMultiplier; + + // continue drawing periodically the vertical lines + while (vbarXpos >= 0 && barSeconds >= 0) + { + // draw vertical line + painter->setPen(Qt::darkRed); + painter->drawLine(QPointF(vbarXpos, metrics.height() + 1), + QPointF(vbarXpos, rect().height() - metrics.height())); + + // draw seconds value + painter->setPen(Qt::darkGray); + QString secsText = QString("%1s").arg(barSeconds); + QPointF secsPos(vbarXpos - metrics.width(secsText) / 2, + rect().height()); + painter->drawText(secsPos, secsText); + + // calculate new position + vbarXpos -= verticalBarPeriodInSecs * 1000000 * scaleFactor; + barSeconds -= verticalBarPeriodInSecs; + } + } + + // draw the basic grid + painter->setPen(Qt::darkGray); + + qreal axisY = metrics.height(); + painter->drawLine(QPointF(0, axisY), QPointF(rect().width(), axisY)); // upper line + painter->drawText(QPointF(0, axisY), tr("100%")); + + axisY = rect().height() / 2; + painter->drawLine(QPointF(0, axisY), QPointF(rect().width(), axisY)); // mid line + painter->drawText(QPointF(0, axisY), tr("50%")); + + axisY = rect().height() - metrics.height(); + painter->drawLine(QPointF(0, axisY), QPointF(rect().width(), axisY)); // bottom line + painter->drawText(QPointF(0, axisY), tr("0%")); + + int c = 0; + // draw graphs for each sampled type + for (int i=0; i 0) + { + // set pen color for the graph + painter->setPen(sampleEntries.at(i).graphColor()); + + // remember the position where drawing started + qreal currentXPos(rect().width()); // start drawing from right + qreal currentYPos(0.); + + // draw samples + for (int j=0; j 0 ? + drawAreaHeight * currentSample.mFree / currentSample.mSize + metrics.height() : + rect().height() - metrics.height(); + } + + // calculate Y position for previous (j+1) + qreal previousYPos = previousSample.mSize > 0 ? + drawAreaHeight * previousSample.mFree / previousSample.mSize + metrics.height() : + rect().height() - metrics.height(); + + + // draw a line between the previous and current + painter->drawLine(QPointF(previousXPos, previousYPos), + QPointF(currentXPos, currentYPos)); + + // draw current value in % + if (j==0) // draw the value of first sample + { + qreal perc = currentSample.mSize > 0 ? + 100. - 100. * currentSample.mFree / currentSample.mSize : 0; + QString percText = QString ("%1 %2%"). + arg(sampleEntries.at(i).description()). + arg(perc, 0, 'f', 0); + + painter->drawText(QPointF(0, metrics.height() * (c + 2)), + percText); + c++; + } + + + // stop drawing if we have run out of space + if (previousXPos < 0) + break; + + // remeber previous values + currentXPos = previousXPos; + currentYPos = previousYPos; + } + + + } + } + + } +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/main.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include "application.h" +#include "enginewrapper.h" +#include "mainwindow.h" +#include "datapopup.h" + +int main(int argc, char *argv[]) +{ + Application app(argc, argv); + + EngineWrapper engine; + if (!engine.initialize()) + { + QMessageBox::critical(0, QObject::tr("Error"), QObject::tr("Unable to initialize engine. Application will now quit.")); + return 1; + } + + MainWindow window(engine); + window.show(); +// TODO: functionality broken + /* + DataPopup dataPopup(engine); + + QObject::connect(&app, SIGNAL(foregroundEvent(bool)), + &dataPopup, SLOT(updateVisibility(bool))); + + // TODO: pass false if run in background + dataPopup.updateVisibility(true); +*/ + return app.exec(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/mainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/mainview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "mainview.h" +#include "enginewrapper.h" + + +// --------------------------------------------------------------------------- + +MainView::MainView(EngineWrapper &engine) : + mEngine(engine), + mValueDataContainer(0), + mGraphDataContainer(0) +{ + setTitle(tr("Perf. Monitor")); + mValueDataContainer = new ValueDataContainer(mEngine, this); + mGraphDataContainer = new GraphDataContainer(mEngine, this); + createMenu(); + showValues(); +} + +// --------------------------------------------------------------------------- + +MainView::~MainView() +{ +} + +// --------------------------------------------------------------------------- + +void MainView::createMenu() +{ + HbMenu *menu = this->menu(); + HbToolBar *toolbar = this->toolBar(); + + if (menu && toolbar) { + mSwitchViewAction = new HbAction(toolbar); + toolbar->addAction(mSwitchViewAction); + + QActionGroup *viewGroup = new QActionGroup(this); + HbMenu *viewSubmenu = menu->addMenu(tr("View")); + mValuesAction = viewSubmenu->addAction(tr("Values"), this, SLOT(showValues())); + mValuesAction->setCheckable(true); + mValuesAction->setChecked(true); + viewGroup->addAction(mValuesAction); + + mGraphAction = viewSubmenu->addAction(tr("Graphs"), this, SLOT(showGraphs())); + mGraphAction->setCheckable(true); + viewGroup->addAction(mGraphAction); + + mLoggingAction = menu->addAction(QString(), this, SLOT(toggleLogging())); + toolbar->addAction(mLoggingAction); + updateLoggingAction(); + + menu->addAction(tr("Settings..."), this, SIGNAL(settingsCommandInvoked())); + menu->addAction(tr("About..."), this, SLOT(showAbout())); + menu->addAction(tr("Exit"), qApp, SLOT(quit())); + + } +} + +void MainView::showValues() +{ + // remove old widget & take ownership + takeWidget(); + mGraphDataContainer->hideContainer(); + mValueDataContainer->showContainer(); + // set new widget + this->setWidget(mValueDataContainer); + + mValuesAction->setChecked(true); + + mSwitchViewAction->setText(tr("View Graphs")); + disconnect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showValues())); + connect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showGraphs())); +} + +void MainView::showGraphs() +{ + // remove old widget & take ownership + takeWidget(); + mValueDataContainer->hideContainer(); + mGraphDataContainer->showContainer(); + // set new widget + this->setWidget(mGraphDataContainer); + + mGraphAction->setChecked(true); + + mSwitchViewAction->setText(tr("View Values")); + disconnect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showGraphs())); + connect(mSwitchViewAction, SIGNAL(triggered(bool)), this, SLOT(showValues())); +} + +void MainView::updateLoggingAction() +{ + mLoggingAction->setText(mEngine.settings().loggingEnabled() ? + tr("Stop Logging") : + tr("Start Logging")); +} + +void MainView::toggleLogging() +{ + mEngine.setLoggingEnabled(!mEngine.settings().loggingEnabled()); + updateLoggingAction(); +} + +void MainView::showAbout() +{ + HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); + messageBox->setText("Version 1.2.0 - 26th August 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."); + HbLabel *header = new HbLabel("About PerfMon", messageBox); + messageBox->setHeadingWidget(header); + messageBox->setAttribute(Qt::WA_DeleteOnClose); + messageBox->setTimeout(HbPopup::NoTimeout); + messageBox->open(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/mainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/mainwindow.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include "mainwindow.h" + +#include "enginewrapper.h" +#include "mainview.h" +#include "settingsview.h" + +MainWindow::MainWindow(EngineWrapper &engine, QWidget *parent) + : HbMainWindow(parent) + , mEngine(engine) +{ + mMainView = new MainView(mEngine); + connect(mMainView, SIGNAL(settingsCommandInvoked()), this, SLOT(showSettings())); + + addView(mMainView); + + mSettingsView = new SettingsView(mEngine); + connect(mSettingsView, SIGNAL(finished(bool)), this, SLOT(showMainView())); + + HbAction *action = new HbAction(Hb::BackNaviAction, mSettingsView); + connect(action, SIGNAL(triggered()), mSettingsView, SLOT(reject())); + mSettingsView->setNavigationAction(action); + + addView(mSettingsView); + + showMainView(); +} + +void MainWindow::showMainView() +{ + setCurrentView( mMainView ); +} + +void MainWindow::showSettings() +{ + setCurrentView( mSettingsView ); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/popupdatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/popupdatacontainer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "popupdatacontainer.h" +#include "enginewrapper.h" + +#include +#include +#include + +const int leftMargin = 2; + +PopupDataContainer::PopupDataContainer(const EngineWrapper& engine, QGraphicsItem *parent) : + DataContainer(engine, parent) +{ + connect(&engine, SIGNAL(samplesUpdated()), this, SLOT(samplesUpdated())); + + HbFontSpec spec(HbFontSpec::Secondary); + mFont = spec.font(); + mFont.setPixelSize(12); + +} + +void PopupDataContainer::samplesUpdated() +{ + update(); +} + +void PopupDataContainer::paint (QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + // set proper font and prepare font metrics for text height calculation + painter->setFont(mFont); + QFontMetricsF metrics(mFont); + + QList entries = engine().sampleEntries(); + qreal verticalPos = metrics.height(); + + for (int i=0; i 0) + { + const SampleEntry &entry = entries.at(i); + const SampleData &sample = entry.sample(0); + + if (i == ESourceCPU) + { + // CPU + double perc = sample.mSize > 0 ? + 100. - 100. * sample.mFree / sample.mSize : 0; + + + QString text = tr("%1 %2%").arg(entry.description()). + arg(perc, 0, 'f', 2); + painter->drawText(QPointF(leftMargin, verticalPos), text); + } + else if (i == ESourcePwr) + { + // Power + QString text = tr("%1 %L2%3").arg(entry.description()). + arg(sample.mSize - sample.mFree).arg(entry.unitShort()); + painter->drawText(QPointF(leftMargin, verticalPos), text); + } + else + { + // RAM and Drives + QString text = tr("%1 free %L2%3").arg(entry.description()). + arg(sample.mFree).arg(entry.unitShort()); + painter->drawText(QPointF(leftMargin, verticalPos), text); + } + + verticalPos += metrics.height(); + } + } +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/settingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/settingsview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "settingsview.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "enginewrapper.h" + +const QStringList PRIORITY_ITEMS = QStringList() << SettingsView::tr("Much less") << + SettingsView::tr("Less") << SettingsView::tr("Normal") << + SettingsView::tr("More") << SettingsView::tr("Much more") << + SettingsView::tr("Real time") << SettingsView::tr("Abs. very low") << + SettingsView::tr("Abs. low") << SettingsView::tr("Abs background") << + SettingsView::tr("Abs. foreground") << SettingsView::tr("Abs high"); + +const QStringList CPU_SAMPLING = QStringList() << SettingsView::tr("CPU Time") << + SettingsView::tr("NOPs"); + +const QStringList POPUP_LOCATION = QStringList() << SettingsView::tr("Top right") << + SettingsView::tr("Bottom middle"); + +const QStringList POPUP_VISIBILITY = QStringList() << SettingsView::tr("On") << + SettingsView::tr("Backgr. only") << SettingsView::tr("Off"); + +const QStringList SOURCES = QStringList() << SettingsView::tr("CPU") << + SettingsView::tr("Ram") << SettingsView::tr("C:") << SettingsView::tr("D:") << + SettingsView::tr("E:") << SettingsView::tr("F:") << SettingsView::tr("G:") << + SettingsView::tr("H:") << SettingsView::tr("I:") << SettingsView::tr("Power"); + +const QStringList LOG_MODES = QStringList() << SettingsView::tr("RDebug") << + SettingsView::tr("Log file") << SettingsView::tr("RDebug & log file"); + + +SettingsView::SettingsView(EngineWrapper &engine) + : mEngine(engine), mLogFilePathItem(0) +{ + setTitle(tr("Settings")); + + //create toolbar showing launch popup + HbToolBar *toolBar = this->toolBar(); + HbAction *actionOk = new HbAction(tr("Ok"), toolBar); + HbAction *actionCancel = new HbAction(tr("Cancel"), toolBar); + + toolBar->addAction(actionOk); + toolBar->addAction(actionCancel); + + //create setting form + mSettingsForm = new HbDataForm(); + + //create a model class + mModel = new HbDataFormModel(this); + createModel(*mModel); + load(engine.settings()); + + connect(mSettingsForm, SIGNAL(itemShown(const QModelIndex)), + this, SLOT(dataItemDisplayed(const QModelIndex))); + + // Set created model to form + mSettingsForm->setModel(mModel); + setWidget(mSettingsForm); + + + connect(actionOk, SIGNAL(triggered()), this, SLOT(accept())); + connect(actionCancel, SIGNAL(triggered()), this, SLOT(reject())); + connect(this, SIGNAL(aboutToClose()), this, SLOT(accept())); + +} + +void SettingsView::createModel(HbDataFormModel &model) +{ + // General page + HbDataFormModelItem *generalPage = model.appendDataFormPage(tr("General")); + + mHeartBeatItem = model.appendDataFormItem( + HbDataFormModelItem::TextItem, tr("Heart beat (ms)"), generalPage); + mHeartBeatItem->setContentWidgetData("maximum", 99999); + mHeartBeatItem->setContentWidgetData("minimum", 0); + mHeartBeatItem->setContentWidgetData("inputMethodHints", Qt::ImhDigitsOnly); + + mMaxSamplesItem = model.appendDataFormItem( + HbDataFormModelItem::TextItem, tr("Max samples"), generalPage); + mMaxSamplesItem->setContentWidgetData("maximum", 9999); + mMaxSamplesItem->setContentWidgetData("minimum", 0); + mMaxSamplesItem->setContentWidgetData("inputMethodHints", Qt::ImhDigitsOnly); + + mPriorityItem = model.appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, tr("Priority"), generalPage); + mPriorityItem->setContentWidgetData("items", PRIORITY_ITEMS); + + mCpuSamplingItem = model.appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, tr("CPU sampling mode"), generalPage); + mCpuSamplingItem->setContentWidgetData("items", CPU_SAMPLING); + + mKeepBacklightItem = model.appendDataFormItem( + HbDataFormModelItem::CheckBoxItem, tr("Backlight"), generalPage); + mKeepBacklightItem->setContentWidgetData("text", tr("Keep backlight on")); + + mPowerMonitoringEnabledItem = model.appendDataFormItem( + HbDataFormModelItem::CheckBoxItem, tr("Power"), generalPage); + mPowerMonitoringEnabledItem->setContentWidgetData("text", tr("Enable power monitoring")); + + // Gray out selection if feature is not supported. + if (!mEngine.PowerMonitoringSupported()) + { + mPowerMonitoringEnabledItem->setEnabled(false); + } + + // Data popup page + HbDataFormModelItem *dataPopupPage = model.appendDataFormPage(tr("Data popup")); + + mPopupVisibilityItem = model.appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, tr("Visibility"), + dataPopupPage); + mPopupVisibilityItem->setContentWidgetData("items", POPUP_VISIBILITY); + + mPopupLocationItem = model.appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, tr("Location"), dataPopupPage); + mPopupLocationItem->setContentWidgetData("items", POPUP_LOCATION); + + mPopupSourcesItem = model.appendDataFormItem( + HbDataFormModelItem::MultiselectionItem, tr("Sources"), dataPopupPage); + mPopupSourcesItem->setContentWidgetData("items", SOURCES); + + // Graphs page + HbDataFormModelItem *graphsPage = model.appendDataFormPage(tr("Graphs")); + + mVerticalBarPeriodItem = model.appendDataFormItem( + HbDataFormModelItem::TextItem, tr("Vertical bar period (s)"), graphsPage); + mVerticalBarPeriodItem->setContentWidgetData("maximum", 999); + mVerticalBarPeriodItem->setContentWidgetData("minimum", 0); + mVerticalBarPeriodItem->setContentWidgetData("inputMethodHints", Qt::ImhDigitsOnly); + + mGraphSourcesItem = model.appendDataFormItem( + HbDataFormModelItem::MultiselectionItem, tr("Sources"), graphsPage); + mGraphSourcesItem->setContentWidgetData("items", SOURCES); + + // Logging page + mLogPage = model.appendDataFormPage(tr("Logging")); + + mLogModeItem = model.appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem, tr("Mode"), mLogPage); + mLogModeItem->setContentWidgetData("items", LOG_MODES); + mSettingsForm->addConnection(mLogModeItem, SIGNAL(itemSelected(int)), + this, SLOT(logModeChanged(int))); + + mLogSourcesItem = model.appendDataFormItem( + HbDataFormModelItem::MultiselectionItem, tr("Sources"), mLogPage); + mLogSourcesItem->setContentWidgetData("items", SOURCES); +} + +void SettingsView::load(const PerfMonSettings& settings) +{ + mHeartBeatItem->setContentWidgetData("text", settings.heartBeat()); + mMaxSamplesItem->setContentWidgetData("text", settings.maxSamples()); + mPriorityItem->setContentWidgetData("selected", settings.priority()); + mCpuSamplingItem->setContentWidgetData("selected", settings.cpuMode()); + mKeepBacklightItem->setContentWidgetData("checkState", settings.keepBacklightOn() ? Qt::Checked : Qt::Unchecked); + mPowerMonitoringEnabledItem->setContentWidgetData("checkState", settings.powerMonitoringEnabled() ? Qt::Checked : Qt::Unchecked); + + mPopupVisibilityItem->setContentWidgetData("selected", settings.dataPopupVisibility()); + mPopupLocationItem->setContentWidgetData("selected", settings.dataPopupLocation()); + mPopupSourcesItem->setContentWidgetData("selectedItems", + qVariantFromValue(settings.dataPopupSources().enabledIndexes())); + + mVerticalBarPeriodItem->setContentWidgetData("text", settings.graphVerticalBarPeriod()); + mGraphSourcesItem->setContentWidgetData("selectedItems", + qVariantFromValue(settings.graphSources().enabledIndexes())); + + mLogModeItem->setContentWidgetData("selected", settings.loggingMode()); + mLogFilePath = settings.loggingFilePath(); + if (settings.loggingMode() > ELoggingModeRDebug) + createLogFilePathItem(); + mLogSourcesItem->setContentWidgetData("selectedItems", + qVariantFromValue(settings.loggingSources().enabledIndexes())); +} + +void SettingsView::save(PerfMonSettings& settings) +{ + settings.setHeartBeat(mHeartBeatItem->contentWidgetData("text").toInt()); + settings.setMaxSamples(mMaxSamplesItem->contentWidgetData("text").toInt()); + settings.setPriority(mPriorityItem->contentWidgetData("selected").toInt()); + settings.setCpuMode(mCpuSamplingItem->contentWidgetData("selected").toInt()); + settings.setKeepBacklightOn(mKeepBacklightItem->contentWidgetData("checkState").toInt() == Qt::Checked); + settings.setPowerMonitoringEnabled(mPowerMonitoringEnabledItem->contentWidgetData("checkState").toInt() == Qt::Checked); + + settings.setDataPopupVisibility(mPopupVisibilityItem->contentWidgetData("selected").toInt()); + settings.setDataPopupLocation(mPopupLocationItem->contentWidgetData("selected").toInt()); + settings.dataPopupSources().setEnabledIndexes( + qVariantValue >(mPopupSourcesItem->contentWidgetData("selectedItems"))); + + settings.setGraphVerticalBarPeriod(mVerticalBarPeriodItem->contentWidgetData("text").toInt()); + settings.graphSources().setEnabledIndexes( + qVariantValue >(mGraphSourcesItem->contentWidgetData("selectedItems"))); + + settings.setLoggingMode(mLogModeItem->contentWidgetData("selected").toInt()); + + if (mLogFilePathItem) + settings.setLoggingFilePath(mLogFilePathItem->contentWidgetData("text").toString()); + settings.loggingSources().setEnabledIndexes( + qVariantValue >(mLogSourcesItem->contentWidgetData("selectedItems"))); +} + +void SettingsView::dataItemDisplayed(const QModelIndex &index) +{ + HbDataFormModelItem* modelItem = mModel->itemFromIndex(index); + HbDataFormViewItem *viewItem = static_cast(mSettingsForm->itemByIndex(index)); + HbWidget *dataContentWidget = viewItem->dataItemContentWidget(); + + // set input method hint for edits + // TODO: remove once setContentWidgetData works with inputMethodHints + if (modelItem == mHeartBeatItem || + modelItem == mMaxSamplesItem || + modelItem == mVerticalBarPeriodItem) + { + HbLineEdit *edit = static_cast(dataContentWidget); + edit->setInputMethodHints(Qt::ImhDigitsOnly); + } +} + +void SettingsView::logModeChanged(int index) +{ + if (index == ELoggingModeRDebug && mLogFilePathItem) { + removeLogFilePathItem(); + } + else if (index != ELoggingModeRDebug && !mLogFilePathItem) { + createLogFilePathItem(); + } +} + +void SettingsView::createLogFilePathItem() +{ + mLogFilePathItem = mModel->insertDataFormItem(mLogPage->indexOf(mLogModeItem) + 1, + HbDataFormModelItem::TextItem, tr("Log file path"), mLogPage); + mLogFilePathItem->setContentWidgetData("text", mLogFilePath); +} + +void SettingsView::removeLogFilePathItem() +{ + // we need to store current text so that it is not lost when + // user hides and then displays "Log file path" item again. + mLogFilePath = mLogFilePathItem->contentWidgetData("text").toString(); + mModel->removeItem(mLogFilePathItem); + mLogFilePathItem = 0; +} + +void SettingsView::accept() +{ + save(mEngine.settings()); + mEngine.updateSettings(); + emit finished(true); +} + +void SettingsView::reject() +{ + emit finished(false); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/app/src/valuedatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/app/src/valuedatacontainer.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,119 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "valuedatacontainer.h" +#include "enginewrapper.h" + +#include +#include +#include +#include + +const int leftMargin = 2; + +ValueDataContainer::ValueDataContainer(const EngineWrapper& engine, QGraphicsItem *parent) : + DataContainer(engine, parent) +{ + HbFontSpec spec(HbFontSpec::Secondary); + mFont = spec.font(); +} + +void ValueDataContainer::paint (QPainter *painter, + const QStyleOptionGraphicsItem *option, + QWidget *widget) +{ + Q_UNUSED(option); + Q_UNUSED(widget); + + // set proper font and prepare font metrics for text height calculation + painter->setFont(mFont); + + QColor col = HbColorScheme::color("qtc_textedit_normal"); + if(col.isValid()) + painter->setPen(col); + + QFontMetricsF metrics(mFont); + + QList entries = engine().sampleEntries(); + int c = 1; + + // CPUs + for (int i = const_cast( engine() ).CPU0PositionInSamples(); + i < const_cast( engine() ).CPU0PositionInSamples() + + const_cast( engine() ).AmountOfCPUs(); i++) + { + // check if data available + const SampleEntry &entry = entries.at(i); + + if (entry.sampleCount() == 0) + continue; + + const SampleData &sample = entry.sample(0); + + double perc = sample.mSize > 0 ? + 100. - 100. * sample.mFree / sample.mSize : 0; + + QString text = tr("%1 %2%").arg(entry.description()). + arg(perc, 0, 'f', 0); + painter->drawText(QPointF(leftMargin, c * metrics.height()), text); + c++; + } + + // RAM and drives + for (int i = const_cast( engine() ).RAMPositionInSamples(); + i < const_cast( engine() ).PowerPositionInSamples(); i++) + { + // check if data available + const SampleEntry &entry = entries.at(i); + + if (entry.sampleCount() == 0) + continue; + + const SampleData &sample = entry.sample(0); + + if (sample.mSize > 0) + { + // RAM and Drives + QString text = tr("%1 free %L2%3").arg(entry.description()). + arg(sample.mFree).arg(entry.unitShort()); + painter->drawText(QPointF(leftMargin, c * metrics.height()), text); + c++; + + text = tr("%1 size %L2%3").arg(entry.description()). + arg(sample.mSize).arg(entry.unitShort()); + painter->drawText(QPointF(leftMargin, c * metrics.height()), text); + c++; + } + } + + // Power sample + // check if data available + const SampleEntry &entry = entries.at(const_cast( engine() ).PowerPositionInSamples()); + + if (entry.sampleCount() > 0) + { + const SampleData &sample = entry.sample(0); + + if (sample.mSize > 0) + { + QString text = tr("%1 %L2%3").arg(entry.description()). + arg(sample.mSize - sample.mFree).arg(entry.unitShort()); + painter->drawText(QPointF(leftMargin, c * metrics.height()), text); + c++; + } + } +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/datapopup.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/datapopup.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,47 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +TEMPLATE = lib +TARGET = PerfMonDataPopupPlugin +CONFIG += plugin hb + +# directories +INCLUDEPATH += inc +DEPENDPATH += inc + +HEADERS += inc/perfmondatapopupplugin_p.h +HEADERS += inc/perfmondatapopupdialog_p.h +HEADERS += inc/perfmondatapopupwidget_p.h + +SOURCES += src/perfmondatapopupplugin.cpp +SOURCES += src/perfmondatapopupdialog.cpp +SOURCES += src/perfmondatapopupwidget.cpp + +symbian { + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 0x2002E6B0 + + hblib.sources = Hb.dll + hblib.path = /sys/bin + hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}" + + pluginstub.sources = PerfMonDataPopupPlugin.dll + pluginstub.path = /resource/plugins/devicedialogs/ + DEPLOYMENT += pluginstub +} \ No newline at end of file diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/inc/perfmondatapopupdialog_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/inc/perfmondatapopupdialog_p.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PERFMONDATAPOPUPDIALOG_P_H +#define PERFMONDATAPOPUPDIALOG_P_H + +#include +#include + +#include +#include +#include + +class PerfMonDataPopupWidget; + +class PerfMonDataPopupDialog : public HbDialog, public HbDeviceDialogInterface +{ + Q_OBJECT + Q_PROPERTY(Location location READ location WRITE setLocation) + Q_PROPERTY(QStringList lines READ lines WRITE setLines) + + Q_ENUMS(Location) + +public: + enum Location + { + LocationTopRight = 0, + LocationBottomMiddle + }; + +public: + PerfMonDataPopupDialog(const QVariantMap ¶meters); + virtual ~PerfMonDataPopupDialog(); + + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbPopup *deviceDialogWidget() const; + +protected: +// void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, +// QWidget *widget=0); + +protected: + void hideEvent(QHideEvent *event); + void showEvent(QShowEvent *event); + void mousePressEvent(QGraphicsSceneMouseEvent *event); + +signals: + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + +private slots: + void reposition(); + +private: + Location location() const; + void setLocation(Location location); + + QStringList lines() const; + void setLines(const QStringList &lines); + +private: + Q_DISABLE_COPY(PerfMonDataPopupDialog) + + int mLastError; + bool mShowEventReceived; + + Location mLocation; + + PerfMonDataPopupWidget *mWidget; +}; + +#endif // PERFMONDATAPOPUPDIALOG_P_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/inc/perfmondatapopupplugin_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/inc/perfmondatapopupplugin_p.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PERFMONDATAPOPUPPLUGIN_P_H +#define PERFMONDATAPOPUPPLUGIN_P_H + +#include +#include + +#include + +class PerfMonDataPopupPluginPrivate; + +class PerfMonDataPopupPlugin : public HbDeviceDialogPlugin +{ + Q_OBJECT + +public: + friend class PerfMonDataPopupPluginPrivate; + + PerfMonDataPopupPlugin(); + ~PerfMonDataPopupPlugin(); + + bool accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, const QVariantMap &securityInfo) const; + HbDeviceDialogInterface *createDeviceDialog(const QString &deviceDialogType, + const QVariantMap ¶meters); + bool deviceDialogInfo(const QString &deviceDialogType, + const QVariantMap ¶meters, DeviceDialogInfo *info) const; + QStringList deviceDialogTypes() const; + PluginFlags pluginFlags() const; + int error() const; + +private: + Q_DISABLE_COPY(PerfMonDataPopupPlugin) + PerfMonDataPopupPluginPrivate *d; +}; + +#endif // PERFMONDATAPOPUPPLUGIN_P_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/inc/perfmondatapopuppluginerrors_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/inc/perfmondatapopuppluginerrors_p.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PERFMONDATAPOPUPPLUGINERRORS_P_H +#define PERFMONDATAPOPUPPLUGINERRORS_P_H + +#include + +// No error +const int NoError = 0; +// Illegal parameter error +const int ParameterError = HbDeviceDialog::PluginErrors + 1; + +#endif // PERFMONDATAPOPUPPLUGINERRORS_P_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/inc/perfmondatapopupwidget_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/inc/perfmondatapopupwidget_p.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef PERFMONDATAPOPUPWIDGET_P_H +#define PERFMONDATAPOPUPWIDGET_P_H + +#include + +class PerfMonDataPopupWidget : public HbWidget +{ + Q_OBJECT + Q_PROPERTY(QStringList lines READ lines WRITE setLines) + +public: + explicit PerfMonDataPopupWidget(QGraphicsItem *parent = 0); + +public: + QStringList lines() const; + void setLines(const QStringList &lines); + +protected: + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0); + +private: + QStringList mLines; + + QFont mFont; + +}; + +#endif // PERFMONDATAPOPUPWIDGET_P_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/src/perfmondatapopupdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/src/perfmondatapopupdialog.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,181 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include +#include +#include +#include +#include + +#include "perfmondatapopupdialog_p.h" +#include "perfmondatapopuppluginerrors_p.h" +#include "perfmondatapopupwidget_p.h" + +// Constructor +PerfMonDataPopupDialog::PerfMonDataPopupDialog(const QVariantMap ¶meters) : + mLastError(NoError), + mShowEventReceived(false), + mLocation(LocationTopRight), + mWidget(new PerfMonDataPopupWidget(this)) +{ + setTimeout(0); + setModal(false); + setDismissPolicy(HbPopup::NoDismiss); + setBackgroundItem(0); + setContentWidget(mWidget); + setBackgroundFaded(false); + + setDeviceDialogParameters(parameters); +} + +PerfMonDataPopupDialog::~PerfMonDataPopupDialog() +{ +} + +// Set parameters +bool PerfMonDataPopupDialog::setDeviceDialogParameters(const QVariantMap ¶meters) +{ + if (parameters.contains("lines")) + { + QVariant lines = parameters.value("lines"); + if (!lines.canConvert(QVariant::StringList)) { + mLastError = ParameterError; + return false; + } + + setLines(lines.toStringList()); + } + + if (parameters.contains("location")) + { + QVariant location = parameters.value("location"); + if (!location.canConvert()) { + mLastError = ParameterError; + return false; + } + + if (location.toInt() != LocationTopRight && + location.toInt() != LocationBottomMiddle) + { + mLastError = ParameterError; + return false; + } + + setLocation(static_cast(location.toInt())); + } + update(); + return true; +} + +// Get error +int PerfMonDataPopupDialog::deviceDialogError() const +{ + return mLastError; +} + +// Close device dialog +void PerfMonDataPopupDialog::closeDeviceDialog(bool byClient) +{ + Q_UNUSED(byClient); + close(); + // If show event has been received, close is signalled from hide event. If not, + // hide event does not come and close is signalled from here. + if (!mShowEventReceived) { + emit deviceDialogClosed(); + } +} + +// Return display widget +HbPopup *PerfMonDataPopupDialog::deviceDialogWidget() const +{ + return const_cast(this); +} + +// Widget is about to hide. Closing effect has ended. +void PerfMonDataPopupDialog::hideEvent(QHideEvent *event) +{ + if (mainWindow()) { + disconnect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(reposition())); + } + HbPopup::hideEvent(event); + emit deviceDialogClosed(); +} + +// Widget is about to show +void PerfMonDataPopupDialog::showEvent(QShowEvent *event) +{ + if (mainWindow()) { + connect(mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), + this, SLOT(reposition())); + } + reposition(); + HbPopup::showEvent(event); + mShowEventReceived = true; +} + + +void PerfMonDataPopupDialog::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + Q_UNUSED(event); + + QVariantMap data; + data["mouseEvent"] = "press"; + emit deviceDialogData(data); +} + + +PerfMonDataPopupDialog::Location PerfMonDataPopupDialog::location() const +{ + return mLocation; +} + +void PerfMonDataPopupDialog::setLocation(Location location) +{ + if (location != mLocation) { + mLocation = location; + reposition(); + } +} + +QStringList PerfMonDataPopupDialog::lines() const +{ + return mWidget->lines(); +} + +void PerfMonDataPopupDialog::setLines(const QStringList &lines) +{ + mWidget->setLines(lines); +} + +void PerfMonDataPopupDialog::reposition() +{ + if (mainWindow()) { + QSize screenSize = HbDeviceProfile::profile(mainWindow()).logicalSize(); + switch (mLocation) { + case LocationTopRight: + setPreferredPos(QPointF(screenSize.width(), 0), + HbPopup::TopRightCorner); + break; + + case LocationBottomMiddle: + setPreferredPos(QPointF(screenSize.width() / 2, screenSize.height()), + HbPopup::BottomEdgeCenter); + break; + } + } +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/src/perfmondatapopupplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/src/perfmondatapopupplugin.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,125 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include +#include "perfmondatapopupplugin_p.h" +#include "perfmondatapopupdialog_p.h" +#include "perfmondatapopuppluginerrors_p.h" + +Q_EXPORT_PLUGIN2(perfmondatapopupplugin, PerfMonDataPopupPlugin) + +// This plugin implements one device dialog type +static const struct { + const char *mTypeString; +} dialogInfos[] = { + {"com.nokia.rnd.perfmondatapopup/1.0"} +}; + +class PerfMonDataPopupPluginPrivate +{ +public: + PerfMonDataPopupPluginPrivate() {mError = NoError;} + + int mError; +}; + +// Constructor +PerfMonDataPopupPlugin::PerfMonDataPopupPlugin() + : d(new PerfMonDataPopupPluginPrivate) +{ +} + +// Destructor +PerfMonDataPopupPlugin::~PerfMonDataPopupPlugin() +{ + delete d; +} + +// Check if client is allowed to use device dialog widget +bool PerfMonDataPopupPlugin::accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, const QVariantMap &securityInfo) const +{ + Q_UNUSED(deviceDialogType) + Q_UNUSED(parameters) + Q_UNUSED(securityInfo) + + // This plugin doesn't perform operations that may compromise security. All clients + // are allowed to use. + return true; +} + +// Create device dialog widget +HbDeviceDialogInterface *PerfMonDataPopupPlugin::createDeviceDialog( + const QString &deviceDialogType, const QVariantMap ¶meters) +{ + Q_UNUSED(deviceDialogType) + d->mError = NoError; + + HbDeviceDialogInterface *ret(0); + QVariantMap params = parameters; + + PerfMonDataPopupDialog *deviceDialog = + new PerfMonDataPopupDialog(params); + d->mError = deviceDialog->deviceDialogError(); + if (d->mError != NoError) { + delete deviceDialog; + deviceDialog = 0; + } + ret = deviceDialog; + + return ret; +} + +// Return device dialog flags +bool PerfMonDataPopupPlugin::deviceDialogInfo(const QString &deviceDialogType, + const QVariantMap ¶meters, DeviceDialogInfo *info) const +{ + Q_UNUSED(deviceDialogType); + Q_UNUSED(parameters); + + info->group = DeviceNotificationDialogGroup; + //info->group = GenericDeviceDialogGroup; + info->flags = NoDeviceDialogFlags; + info->priority = DefaultPriority; + + return true; +} + +// Return device dialog types this plugin implements +QStringList PerfMonDataPopupPlugin::deviceDialogTypes() const +{ + QStringList types; + const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); + for(int i = 0; i < numTypes; i++) { + types.append(dialogInfos[i].mTypeString); + } + return types; +} + +// Return plugin flags +HbDeviceDialogPlugin::PluginFlags PerfMonDataPopupPlugin::pluginFlags() const +{ + return NoPluginFlags; +} + +// Return last error +int PerfMonDataPopupPlugin::error() const +{ + return d->mError; +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/datapopup/src/perfmondatapopupwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/datapopup/src/perfmondatapopupwidget.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,82 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include + +#include "perfmondatapopupwidget_p.h" + +const qreal popupMargin = 5.; + +PerfMonDataPopupWidget::PerfMonDataPopupWidget(QGraphicsItem *parent) : + HbWidget(parent) +{ + HbFontSpec fontSpec(HbFontSpec::Secondary); + mFont = fontSpec.font(); + mFont.setPixelSize(12); +} + +QStringList PerfMonDataPopupWidget::lines() const +{ + return mLines; +} + +void PerfMonDataPopupWidget::setLines(const QStringList &lines) +{ + mLines = lines; + updateGeometry(); +} + +QSizeF PerfMonDataPopupWidget::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const +{ + if (which == Qt::PreferredSize) + { + QFontMetricsF metrics(mFont); + + qreal width = 0; + foreach (const QString &line, mLines) { + width = qMax(width, metrics.width(line)); + } + qreal height = metrics.height() * mLines.length(); + + return QSizeF(width + 2 * popupMargin, height + 2 * popupMargin); + } + + return HbWidget::sizeHint(which, constraint); +} + +void PerfMonDataPopupWidget::paint(QPainter *painter, + const QStyleOptionGraphicsItem *option, QWidget *widget) +{ + Q_UNUSED(widget); + Q_UNUSED(option); + + QFontMetricsF metrics(mFont); + qreal lineHeight = metrics.height(); + qreal verticalPos = lineHeight + popupMargin; + + // draw background + painter->setBrush(Qt::white); + painter->drawRect(option->rect); + + painter->setFont(mFont); + + foreach (const QString &line, mLines) { + painter->drawText(QPointF(popupMargin, verticalPos), line); + verticalPos += lineHeight; + } + +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/win/enginewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/win/enginewrapper.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "enginewrapper.h" + + +// --------------------------------------------------------------------------- + +EngineWrapper::EngineWrapper() +{ +} + +// --------------------------------------------------------------------------- + +EngineWrapper::~EngineWrapper() +{ + finalize(); +} + +// --------------------------------------------------------------------------- + +bool EngineWrapper::initialize() +{ + + SampleEntry cpu; + cpu.mDescription = "CPU"; + cpu.mDriveNumber = -1; + cpu.mGraphColor.setNamedColor("yellow"); + + SampleEntry ram; + ram.mDescription = "RAM"; + ram.mUnitShort = "b"; + ram.mUnitLong = "bytes"; + ram.mDriveNumber = -1; + ram.mGraphColor.setNamedColor("green"); + + SampleEntry cdrive; + cdrive.mDescription = "C:"; + cdrive.mUnitShort = "b"; + cdrive.mUnitLong = "bytes"; + cdrive.mDriveNumber = 0; + cdrive.mGraphColor.setNamedColor("cyan"); + + SampleEntry ddrive; + ddrive.mDescription = "D:"; + ddrive.mUnitShort = "b"; + ddrive.mUnitLong = "bytes"; + ddrive.mDriveNumber = 0; + ddrive.mGraphColor.setNamedColor("blue"); + + mEntries << cpu << ram << cdrive << ddrive; + + connect(&mTimer, SIGNAL(timeout()), this, SLOT(update())); + mStartTime = QTime::currentTime(); + mTimer.start(600); + + return true; +} + +// --------------------------------------------------------------------------- + +void EngineWrapper::finalize() +{ +} + +// --------------------------------------------------------------------------- + +bool EngineWrapper::updateSettings() +{ + emit settingsUpdated(); + return true; +} + +void EngineWrapper::update() +{ + // do some updates :) + for (int i=0; i 0) + { + SampleData data = entry.mSampleData.at(0); + data.mFree += 10000 * (qrand() % 1000 - 500); + data.mTimeFromStart = mStartTime.msecsTo(QTime::currentTime()) * 1000; + entry.mSampleData.prepend(data); + } + else + { + SampleData data = {100000000L, 200000000L, mStartTime.msecsTo(QTime::currentTime()) * 1000}; + entry.mSampleData.prepend(data); + } + + if (entry.mSampleData.length() > 64) + { + entry.mSampleData.removeLast(); + } + } + + emit samplesUpdated(); +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/win/enginewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/win/enginewrapper.h Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,270 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef ENGINEWRAPPER_H +#define ENGINEWRAPPER_H + +#include +#include +#include +#include +#include + +enum SettingThreadPriorityTypes +{ + EThreadPriorityTypeMuchLess = 0, + EThreadPriorityTypeLess, + EThreadPriorityTypeNormal, + EThreadPriorityTypeMore, + EThreadPriorityTypeMuchMore, + EThreadPriorityTypeRealTime, + EThreadPriorityTypeAbsoluteVeryLow, + EThreadPriorityTypeAbsoluteLow, + EThreadPriorityTypeAbsoluteBackground, + EThreadPriorityTypeAbsoluteForeground, + EThreadPriorityTypeAbsoluteHigh +}; + +enum SettingCPUModes +{ + ECPUModeNotSet = -1, + ECPUModeCPUTime, + ECPUModeNOPs +}; + +enum SettingDataPopupVisbilities +{ + EDataPopupVisbilityAlwaysOn = 0, + EDataPopupVisbilityBackgroundOnly, + EDataPopupVisbilityAlwaysAlwaysOff +}; + +enum SettingDataPopupLocations +{ + EDataPopupLocationTopRight = 0, + EDataPopupLocationBottomMiddle +}; + +enum SettingSources +{ + ESourceCPU = 0, + ESourceRAM, + ESourceC, + ESourceD, + ESourceE, + ESourceF, + ESourceG, + ESourceH, + ESourceI, + ESourcesLength // this should be always the last! +}; + +enum SettingLoggingMode +{ + ELoggingModeRDebug = 0, + ELoggingModeLogFile, + ELoggingModeRDebugLogFile +}; + + +struct SampleData +{ + qint64 mFree; + qint64 mSize; + qint64 mTimeFromStart; +}; + +class SampleEntry +{ +public: + QString description() const { return mDescription; } + QString unitShort() const { return mUnitShort; } + QString unitLong() const { return mUnitLong; } + int driveNumber() const { return mDriveNumber; } + QColor graphColor() const { return mGraphColor; } + + int sampleCount() const { return mSampleData.length(); } + const SampleData &sample(int index) const { return mSampleData[index]; } +private: + QString mDescription; + QString mUnitShort; + QString mUnitLong; + int mDriveNumber; + QColor mGraphColor; + + QList mSampleData; + +friend class EngineWrapper; +}; + +class PerfMonSources +{ +public: + int count() const { return 9; } + int isEnabled (int index) const { return mSources[index]; } + void setEnabled(int index, bool enabled) { mSources[index] = enabled; } + QList enabledIndexes() const + { + QList indexes; + for(int i=0; i &indexes) + { + for(int i=0; i& sampleEntries() const { return mEntries; } + + PerfMonSettings &settings() { return mSettings; } + const PerfMonSettings &settings() const { return mSettings; } + + void setLoggingEnabled(bool enabled) { mSettings.setLoggingEnabled(enabled); } + +public slots: + + bool updateSettings(); + bool initialize(); + void finalize(); + +signals: + + void samplesUpdated(); + void settingsUpdated(); + +private slots: + + void update(); + +private: + + QList mEntries; + + QTimer mTimer; + + QTime mStartTime; + + PerfMonSettings mSettings; +}; + +#endif //ENGINEWRAPPER_H diff -r f8280f3bfeb7 -r 9b2cffad4b5e perfmon/ui/hb/win/win.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfmon/ui/hb/win/win.pro Wed Sep 15 12:13:45 2010 +0300 @@ -0,0 +1,27 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +# + +win32 { + TEMPLATE = subdirs + + SUBDIRS = ../app ../datapopup + + system($$QMAKE_COPY enginewrapper.cpp ..\app\src\enginewrapper.cpp) + system($$QMAKE_COPY enginewrapper.h ..\app\inc\enginewrapper.h) +} else { + error("Only Windows supported") +} diff -r f8280f3bfeb7 -r 9b2cffad4b5e piprofilerui/ui/avkon/data/piprofilerui.rss --- a/piprofilerui/ui/avkon/data/piprofilerui.rss Tue Sep 14 21:20:12 2010 +0300 +++ b/piprofilerui/ui/avkon/data/piprofilerui.rss Wed Sep 15 12:13:45 2010 +0300 @@ -480,7 +480,7 @@ id = EAknMessageQueryContentId; control = AVKON_MESSAGE_QUERY { - message = "Version 2.2.1 - 10th August 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved."; + message = "Version 2.2.2 - 23rd August 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved."; }; } }; diff -r f8280f3bfeb7 -r 9b2cffad4b5e piprofilerui/ui/hb/src/pimainview.cpp --- a/piprofilerui/ui/hb/src/pimainview.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/piprofilerui/ui/hb/src/pimainview.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -186,7 +186,7 @@ void PIMainView::showAboutPopup() { - Notifications::showMessageBox("Version 2.2.1 - 10th August 2010. \n" + Notifications::showMessageBox("Version 2.2.2 - 23rd August 2010. \n" "Copyright © 2010 Nokia Corporation " "and/or its subsidiary(-ies). " "All rights reserved."); diff -r f8280f3bfeb7 -r 9b2cffad4b5e piprofilerui/ui/hb/src/piprofilerengineprivate.cpp --- a/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp Tue Sep 14 21:20:12 2010 +0300 +++ b/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp Wed Sep 15 12:13:45 2010 +0300 @@ -181,7 +181,10 @@ // check now if a second appearance exists in process list, // i.e. engine started from eshell => two engine processes appear in normal case - procName.Next(aResult2); + err = procName.Next(aResult2); + if (err != KErrNone) { + return err; + } // check if aResult2 contained the second appearance of profiler engine if(aResult2.CompareF(aResult) > 0)