# HG changeset patch # User hgs # Date 1283523081 -10800 # Node ID b048e15729d63f652346bcc67dc24b9b2adfcc1e # Parent 5db69f4c3d0638de605f8d43c45e86a193fb8545 201035 diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/inc/creator.hrh --- a/creator/engine/inc/creator.hrh Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/inc/creator.hrh Fri Sep 03 17:11:21 2010 +0300 @@ -24,7 +24,14 @@ enum TCreatorIds { - ECmdCreateFromFile=1, + + // Phonebook entries shuld be the first, bacause some other entries references them + ECmdCreatePhoneBookEntries = 1, + ECmdCreatePhoneBookEntryContacts, + ECmdCreatePhoneBookEntryGroups, + ECmdCreatePhoneBookEntrySubscribedContacts, + + ECmdCreateFromFile, ECmdCreateCalendarEntries, ECmdCreateCalendarEntryAppointments, @@ -129,11 +136,6 @@ ECmdCreateMiscEntrySyncSettings, ECmdCreateMiscEntryLandmarks, - ECmdCreatePhoneBookEntries, - ECmdCreatePhoneBookEntryContacts, - ECmdCreatePhoneBookEntryGroups, - ECmdCreatePhoneBookEntrySubscribedContacts, - ECmdDeleteEntries, ECmdDeleteAllEntries, ECmdDeleteAllCreatorEntries, diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/inc/creator_file.h --- a/creator/engine/inc/creator_file.h Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/inc/creator_file.h Fri Sep 03 17:11:21 2010 +0300 @@ -25,8 +25,9 @@ #include "engine.h" #include "creator_modulebase.h" -#include +#include using namespace ContentAccess; +#include #include #include diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/inc/creator_phonebook.h --- a/creator/engine/inc/creator_phonebook.h Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/inc/creator_phonebook.h Fri Sep 03 17:11:21 2010 +0300 @@ -56,7 +56,7 @@ void DeleteAllGroupsCreatedByCreatorL(); void TestPrintOut(CPhonebookParameters* aParam); - + inline CCreatorPhonebookWrapper* GetPhonebookWrapper(){ return iPhonebookWrapper; }; private: void InitializeContactParamsL(); diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/inc/creator_phonebookapi.h --- a/creator/engine/inc/creator_phonebookapi.h Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/inc/creator_phonebookapi.h Fri Sep 03 17:11:21 2010 +0300 @@ -42,6 +42,9 @@ bool deleteContacts( const QList& list ); QContact contact( const QContactLocalId& contactId ); + QString phoneNumber( const QContactLocalId& contactId ); + bool contactDetails( const QContactLocalId& contactId, QString& name, QString& phoneNumber, QString& email ); + private: bool IsContactGroupL( const QContact& contact ); diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/inc/creator_phonebookwrapper.h --- a/creator/engine/inc/creator_phonebookwrapper.h Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/inc/creator_phonebookwrapper.h Fri Sep 03 17:11:21 2010 +0300 @@ -150,6 +150,9 @@ void DeleteAllGroupsL(); void DeleteContactsL( RArray& aContactsToDelete, TUid aStoreUid ); + HBufC* GetPhoneNumberL( TUint32 aContactId ); + TBool GetContactDetailsL( TUint32 aContactId, TDes& aName, TDes& aPhoneNumber, TDes& aEmail ); + private: QList CreateContactDetailsFromParameters( const TCreatorContactFields& Map ); QContactDetail CreateContactDetail( QList& aContactDetailList,QString aDetail, QString aFieldContext, QString aFieldString, QString aData ); diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_calendar.cpp --- a/creator/engine/src/creator_calendar.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_calendar.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -26,6 +26,8 @@ #include #include #include +#include "creator_contactsetcache.h" +#include "creator_phonebook.h" static const TInt KCalendarFieldLength = 128; @@ -815,6 +817,32 @@ CleanupStack::Pop(); // attendee } } + // linked attendees: + for( TInt i = 0; i < parameters->iAttendeeLinkIds.Count(); ++i ) + { + CCreatorPhonebook* phonebook = dynamic_cast(iEngine->GetPhonebook()); + User::LeaveIfNull( phonebook ); + CCreatorPhonebookWrapper* phonebookWrapper = phonebook->GetPhonebookWrapper(); + + TLinkIdParam attendeeLinkId = parameters->iAttendeeLinkIds[i]; + const CCreatorContactSet& set = ContactLinkCache::Instance()->ContactSet(attendeeLinkId.iLinkId); + const RArray links = set.ContactLinks(); + TInt numberOfExplicitLinks = links.Count(); // Number of defined contacts in contact-set + for( TInt j = 0; j < numberOfExplicitLinks; ++j ) + { + TBuf<128> email; + TBuf<128> name; + TBuf<128> phoneNumber; + phonebookWrapper->GetContactDetailsL( links[j], name, phoneNumber, email ); + CCalAttendee* attendee = CCalAttendee::NewL( email ); + CleanupStack::PushL(attendee); + if( name.Length() > 0 ) + attendee->SetCommonNameL( name ); + attendee->SetResponseRequested(ETrue); + aCalEntry.AddAttendeeL(attendee); + CleanupStack::Pop(); // attendee + } + } } //---------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_contactelement.cpp --- a/creator/engine/src/creator_contactelement.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_contactelement.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -196,23 +196,19 @@ for( TInt i = 0; i < fieldList.Count(); ++i ) { TPtrC fieldName = fieldList[i]->Name(); - CCreatorContactField* field = 0; - field = CCreatorContactField::NewL(); - 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() ); - } + //TBool increase( EFalse ); + //if ( increaseAttr ) + // { + // increase = ConvertStrToBooleanL( increaseAttr->Value() ); + // } 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; diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_file.cpp --- a/creator/engine/src/creator_file.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_file.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -16,8 +16,6 @@ */ -#include - #include "engine.h" #include "enginewrapper.h" #include "creator_file.h" diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_message.cpp --- a/creator/engine/src/creator_message.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_message.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -22,6 +22,7 @@ #include "creator_message.h" #include "creator_traces.h" #include "creator_contactsetcache.h" +#include "creator_phonebook.h" #include #include #include @@ -1201,12 +1202,13 @@ header->SetSubjectL( parameters.iMessageSubject->Des() ); if( iSenderArray.Count() == 0 ) { - GetSendersL(iSenderArray, parameters, ETrue, 1 ); + GetSendersL(iSenderArray, parameters, ETrue, KUndef ); } if( iSenderArray.Count() > 0 ) { - header->SetFromL(iSenderArray[0]->Des()); + TInt rndNum = iEngine->RandomNumber( iSenderArray.Count() ); + header->SetFromL(iSenderArray[rndNum]->Des()); } else { @@ -1529,11 +1531,12 @@ // Only one sender allowed: if( iSenderArray.Count() == 0 ) { - GetSendersL(iSenderArray, aParameters, aUseEmailAddress, 1 ); + GetSendersL(iSenderArray, aParameters, aUseEmailAddress, KUndef ); } if( iSenderArray.Count() > 0 ) { - aMsgEntry.iDetails.Set( iSenderArray[0]->Des() ); + TInt rnd = iEngine->RandomNumber( iSenderArray.Count() ); + aMsgEntry.iDetails.Set( iSenderArray[rnd]->Des() ); } else { @@ -1667,9 +1670,29 @@ RPointerArray& aAddressArray, const RArray& aLinkIds, TBool aUseEmailAddress, - TInt aNumOfExistingAddresses ) + TInt /*aNumOfExistingAddresses*/ ) { -} + CCreatorPhonebook* phonebook = dynamic_cast(iEngine->GetPhonebook()); + User::LeaveIfNull( phonebook ); + CCreatorPhonebookWrapper* phonebookWrapper = phonebook->GetPhonebookWrapper(); + + for( TInt i = 0; i < aLinkIds.Count(); ++i ) + { + const CCreatorContactSet& set = ContactLinkCache::Instance()->ContactSet(aLinkIds[i].iLinkId); + const RArray links = set.ContactLinks();//ContactLinkCache::Instance()->ContactSets();//set.ContactLinks(); + TInt numberOfExplicitLinks = links.Count(); // Number of defined contacts in contact-set + for( TInt j = 0; j < numberOfExplicitLinks; ++j ) + { + TBuf<128> name; + TBuf<128> email; + TBuf<128> phoneNumber; + phonebookWrapper->GetContactDetailsL( links[j], name, phoneNumber, email ); + HBufC* address = ( aUseEmailAddress ? email.AllocLC() : phoneNumber.AllocLC() ); + aAddressArray.AppendL( address ); + CleanupStack::Pop( address ); + } + } + } //---------------------------------------------------------------------------- void CCreatorMessages::DeleteAllL() diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_note.cpp --- a/creator/engine/src/creator_note.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_note.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -22,14 +22,6 @@ #include "creator_note.h" #include "creator_traces.h" - -const TInt KCreatorDiskSpaceNeededForSingleDeletion( 8192 ); -_LIT( KCreatorNotepadFile, "c:Notepad.dat" ); - -// @see \s60\app\organizer\notepad\notepad1\LibSrc\NpdCoreModel.cpp KSecureUid.Name() -_LIT( KCreatorNotepadFormat, "SECURE[101F8878]" ); -_LIT( KCreatorNotepadDeleteAllSQL, "DELETE FROM Table1"); - //---------------------------------------------------------------------------- CNotepadParameters::CNotepadParameters() @@ -82,12 +74,13 @@ if (iParameters) { delete iParameters; - iParameters; + iParameters = NULL; } if (iNotepadWrapper) { delete iNotepadWrapper; + iNotepadWrapper = NULL; } } diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_phonebook.cpp --- a/creator/engine/src/creator_phonebook.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_phonebook.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -579,7 +579,7 @@ } // Checks if the link is a group or not -TBool CCreatorPhonebook::IsContactGroupL( TUint32& aLink ) +TBool CCreatorPhonebook::IsContactGroupL( TUint32& /*aLink*/ ) { //not used right now return EFalse; diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_phonebookapi.cpp --- a/creator/engine/src/creator_phonebookapi.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_phonebookapi.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -36,18 +36,17 @@ // create a new contact item QContact store; quint32 id; - bool success = false; for(int i = 0 ; i < list.count() ; i++ ) { QContactDetail cntdetail = list.at(i); - success = store.saveDetail(&cntdetail); + store.saveDetail(&cntdetail); } /*foreach( QContactDetail cntdetail, list ) { - success = store.saveDetail( &cntdetail ); + store.saveDetail( &cntdetail ); } */ - success = mContactMngr->saveContact( &store ); + mContactMngr->saveContact( &store ); id = store.localId(); return id; } @@ -158,4 +157,33 @@ { return mContactMngr->contact( contactId ); } + +QString CCreatorPhonebookAPI::phoneNumber( const QContactLocalId& contactId ) + { + QString strNumber; + QContact contact = mContactMngr->contact( contactId ); + if( !contact.isEmpty() ) + { + QContactPhoneNumber phoneNumber = static_cast( contact.detail( QContactPhoneNumber::DefinitionName ) ); + strNumber = phoneNumber.number(); + } + return strNumber; + } + +bool CCreatorPhonebookAPI::contactDetails( const QContactLocalId& contactId, QString& name, QString& phoneNumber, QString& email ) + { + bool success(false); + QContact contact = mContactMngr->contact( contactId ); + if( !contact.isEmpty() ) + { + QContactPhoneNumber contactPhoneNumber = static_cast( contact.detail( QContactPhoneNumber::DefinitionName ) ); + phoneNumber = contactPhoneNumber.number(); + QContactEmailAddress contactEmailAddress = static_cast( contact.detail( QContactEmailAddress::DefinitionName ) ); + email = contactEmailAddress.emailAddress(); + QContactDisplayLabel contactDisplayLabel = static_cast( contact.detail( QContactDisplayLabel::DefinitionName ) ); + name = contactDisplayLabel.label(); + success = true; + } + return success; + } // End of File diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_phonebookbase.cpp --- a/creator/engine/src/creator_phonebookbase.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_phonebookbase.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -24,7 +24,7 @@ { LOGSTRING("Creator: CCreatorPhonebookBase::QueryDialogClosedL"); - if(aPositiveAction == EFalse && aUserData!=ECreatorPhonebookGetContactFields ) + if(aPositiveAction == EFalse && aUserData!=ECreatorPhonebookGetContactFields && aUserData!=ECreatorPhonebookContactsAllFields ) { iEngine->ShutDownEnginesL(); return; diff -r 5db69f4c3d06 -r b048e15729d6 creator/engine/src/creator_phonebookwrapper.cpp --- a/creator/engine/src/creator_phonebookwrapper.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/engine/src/creator_phonebookwrapper.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -25,8 +25,6 @@ #include -_LIT(KTempPath, "C:\\Data\\Creator\\"); - typedef struct { TInt iFieldCode; QString iDetail; @@ -172,7 +170,6 @@ QContactDetail contactDetail = CreateContactDetail(contDetList, CreatorPbkTextFields[i].iDetail,CreatorPbkTextFields[i].iFieldContext,CreatorPbkTextFields[i].iFieldString, content ); AddFieldToList( contDetList, contactDetail ); } - } arraySize = sizeof(CreatorPhoneNumberFields)/sizeof(PhoneNumInfo); for (TInt i = 0; i < arraySize; i++) @@ -460,23 +457,6 @@ if( aDetail == QContactAvatar::DefinitionName) //--Contact Picture----------------------------- { QContactAvatar contactAvatar; - /*TBuf srcPath; - aEngine->RandomPictureFileL(srcPath); - TBuf destPath(KTempPath); - - if(!BaflUtils::FolderExists( fs, destPath )) - { - BaflUtils::EnsurePathExistsL( fs, destPath ); - } - - TInt err=BaflUtils::CopyFile( fs, srcPath, destPath ); - - TParse temp; - temp.Set( srcPath,NULL,NULL ); - destPath.Append(temp.NameAndExt()); - - QString avatarFile = QString::fromUtf16( destPath.Ptr(),destPath.Length() ); - */ QUrl imageUrl; imageUrl.setUrl(aData); contactAvatar.setImageUrl(imageUrl); @@ -652,3 +632,30 @@ return KErrNotSupported; } + +HBufC* CCreatorPhonebookWrapper::GetPhoneNumberL( TUint32 aContactId ) + { + QContactLocalId contact = QContactLocalId(aContactId); + QString phoneNumber = iPhonebookAPI->phoneNumber(contact); + HBufC *buf = HBufC::NewLC( phoneNumber.length() ); + buf->Des().Copy( phoneNumber.utf16() ); + CleanupStack::Pop( buf ); + return buf; + } + +TBool CCreatorPhonebookWrapper::GetContactDetailsL( TUint32 aContactId, TDes& aName, TDes& aPhoneNumber, TDes& aEmail ) + { + QString name; + QString phoneNumber; + QString email; + + QContactLocalId contact = QContactLocalId(aContactId); + bool success = iPhonebookAPI->contactDetails( contact, name, phoneNumber, email); + if( success ) + { + aName.Copy( name.utf16() ); + aPhoneNumber.Copy( phoneNumber.utf16() ); + aEmail.Copy( email.utf16() ); + } + return success ? ETrue : EFalse ; + } diff -r 5db69f4c3d06 -r b048e15729d6 creator/inc/engine.h --- a/creator/inc/engine.h Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/inc/engine.h Fri Sep 03 17:11:21 2010 +0300 @@ -241,9 +241,10 @@ static CCreatorEngine* NewLC(EngineWrapper *aEngineWrapper); ~CCreatorEngine(); - inline RPointerArray GetMemoryDetailsList(){ return iMemoryDetailsList; }; - inline TMemoryDetails GetMemoryDetails(){ return iMemoryDetails; }; + inline const RPointerArray& GetMemoryDetailsList(){ return iMemoryDetailsList; }; + inline const TMemoryDetails& GetMemoryDetails(){ return iMemoryDetails; }; inline EngineWrapper* GetEngineWrapper(){ return iEngineWrapper; }; + inline CCreatorPhonebookBase* GetPhonebook(){ return iPhonebook; }; private: CCreatorEngine(); diff -r 5db69f4c3d06 -r b048e15729d6 creator/inc/notifications.h --- a/creator/inc/notifications.h Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/inc/notifications.h Fri Sep 03 17:11:21 2010 +0300 @@ -59,7 +59,7 @@ /** * shows global HbGlobalCommonNote type note */ - static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout = HbPopup::ConfirmationNoteTimeout); + static void showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, int timeout = 1000 ); }; class CreatorDialog diff -r 5db69f4c3d06 -r b048e15729d6 creator/src/engine.cpp --- a/creator/src/engine.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/src/engine.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -57,7 +57,6 @@ #include #include -_LIT(KEDriveError, "Not available"); _LIT(KTempPathDrive, "d"); _LIT(KTempPath, ":\\Creator\\"); const TInt KRegisterDrive = EDriveC; @@ -623,7 +622,6 @@ // remove the progress dialog from the screen iEngineWrapper->CloseProgressbar(); - //ProgressDialogCancelledL(); if (iFailedCommands == 0) { @@ -679,12 +677,7 @@ } } - if ( iPhonebook /*&& iPhonebook->IsActive()*/ ) - { - // virtual phonebook is known to require asynchronous - // cancelling of operation - } - else if ( iDecoder ) + if ( iDecoder ) { iDecoder->Cancel(); // CancelComplete() will be called from GenerateSourceImageFileL @@ -1837,7 +1830,7 @@ // --------------------------------------------------------------------------- -TUint32 CCreatorEngine::AccessPointNameToIdL(const TDesC& aAPName, TBool aAnyIfNotFound ) +TUint32 CCreatorEngine::AccessPointNameToIdL(const TDesC& /*aAPName*/, TBool /*aAnyIfNotFound*/ ) { LOGSTRING("Creator: CCreatorEngine::AccessPointNameToIdL"); // Accespoint impl moved from engine to accespoint implementations for supporting 3.0-3.1 and 3.2-> diff -r 5db69f4c3d06 -r b048e15729d6 creator/src/enginewrapper.cpp --- a/creator/src/enginewrapper.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/src/enginewrapper.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -47,9 +47,11 @@ { if (iEngine != 0) { delete iEngine; + iEngine = NULL; } if (iProgressDialog != 0) { delete iProgressDialog; + iProgressDialog = NULL; } } @@ -76,12 +78,12 @@ for(int i=0; iiFree.Ptr(), tMemDetList.operator [](i)->iFree.Length());//QString((QChar*) temp->iFree.Ptr(), temp->iFree.Length()); - QString size = QString::fromUtf16(tMemDetList.operator [](i)->iSize.Ptr(), tMemDetList.operator [](i)->iSize.Length());//QString((QChar*) temp->iSize.Ptr(), temp->iSize.Length()); - QString driveLetter = QString::fromUtf8((const char*) &tMemDetList.operator [](i)->iDriveLetter, (int) sizeof(char) );//QString((QChar*) &temp->iDriveLetter, (int) sizeof( char ) ); + QString free = QString::fromUtf16( temp->iFree.Ptr(), temp->iFree.Length() ); + QString size = QString::fromUtf16( temp->iSize.Ptr(), temp->iSize.Length() ); + QChar drive(temp->iDriveLetter.GetUpperCase()); memDet.mFree = free; //QString((QChar*)tMemDetList[i]->iFree.Ptr(), tMemDetList[i]->iFree.Length()); memDet.mSize = size; //QString((QChar*) tMemDetList[i]->iSize.Ptr(), tMemDetList[i]->iSize.Length()); - memDet.mDriveLetter = driveLetter; + memDet.mDriveLetter = QString(drive); //memDetList[i].mDriveLetter = QString::fromUtf8( (char *) &tMemDetList[i]->iDriveLetter, (int) sizeof( char ) ); memDetList.append( memDet ); @@ -96,8 +98,8 @@ MemoryDetails memoryDetails; // Convert TMemoryDetails to MemoryDetails - memoryDetails.mRamFree = QString((QChar*)tMemoryDetails.iRamFree.Ptr(), tMemoryDetails.iRamFree.Length()); - memoryDetails.mRamSize = QString((QChar*)tMemoryDetails.iRamSize.Ptr(), tMemoryDetails.iRamSize.Length()); + memoryDetails.mRamFree = QString::fromUtf16( tMemoryDetails.iRamFree.Ptr(), tMemoryDetails.iRamFree.Length() ); + memoryDetails.mRamSize = QString::fromUtf16( tMemoryDetails.iRamSize.Ptr(), tMemoryDetails.iRamSize.Length() ); return memoryDetails; } @@ -117,7 +119,7 @@ void EngineWrapper::ShowNote(const TDesC& aNoteMessage, TInt /*aResourceId*/) { QString note((QChar*)aNoteMessage.Ptr(),aNoteMessage.Length()); - Notifications::showGlobalNote(note, HbMessageBox::MessageTypeInformation, HbPopup::ConfirmationNoteTimeout); + Notifications::showGlobalNote(note, HbMessageBox::MessageTypeInformation, 1000); } // --------------------------------------------------------------------------- @@ -125,10 +127,7 @@ void EngineWrapper::ShowProgressBar(const TDesC& aPrompt, int aMax) { QString text((QChar*)aPrompt.Ptr(), aPrompt.Length()); - if(iProgressDialog){ - delete iProgressDialog; - iProgressDialog = NULL; - } + CloseProgressbar(); iProgressDialog = Notifications::showProgressBar(text, aMax); connect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled())); } @@ -275,12 +274,15 @@ void EngineWrapper::ProgressDialogCancelled() { - CloseProgressbar(); TRAPD(err, iEngine->ProgressDialogCancelledL()); // error handling if(err != KErrNone) { Notifications::error("Error in operation cancel."); - } + } + // disconnect & delete iProgressDialog to free memory + disconnect(iProgressDialog, SIGNAL(cancelled()), this, SLOT(ProgressDialogCancelled())); + iProgressDialog->deleteLater(); + iProgressDialog = NULL; } // --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 creator/src/notifications.cpp --- a/creator/src/notifications.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/creator/src/notifications.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -39,6 +39,7 @@ { HbMessageBox *messageBox = new HbMessageBox(type); messageBox->setText(text); + messageBox->setStandardButtons( HbMessageBox::Ok ); if(label.length()) { HbLabel *header = new HbLabel(label, messageBox); @@ -54,7 +55,7 @@ void Notifications::about() { showMessageBox(HbMessageBox::MessageTypeInformation, - "Version 6.1.0 - June 18th 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.", + "Version 6.1.1 - August 27th 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0.", "About Creator", HbPopup::NoTimeout ); @@ -83,7 +84,7 @@ // --------------------------------------------------------------------------- -void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, HbPopup::DefaultTimeout timeout) +void Notifications::showGlobalNote(const QString& text, HbMessageBox::MessageBoxType type, int timeout) { showMessageBox(type, text, QString("Creator"), timeout); } @@ -100,6 +101,7 @@ void CreatorYesNoDialog::launch(const QString& text, const QString& label, MUIObserver* observer, int userData) throw(std::exception) { CreatorYesNoDialog* dlg = new CreatorYesNoDialog(observer, userData); + dlg->setStandardButtons( HbMessageBox::Yes | HbMessageBox::No ); dlg->setText(text); if(label.length()) dlg->setHeadingWidget(new HbLabel(label, dlg)); @@ -143,10 +145,10 @@ HbValidator *validator = new HbValidator(dlg); QString tmp; if (acceptsZero == false) { - tmp.append("[1-9]{1}\\d{1,4}"); + tmp.append("^[1-9]{1}\\d{0,4}"); } else { - tmp.append("^[0-9]{5}"); + tmp.append("^[0-9]{1,5}"); } QRegExp rxBasic(tmp); @@ -213,6 +215,7 @@ dlg->setHeadingWidget(new HbLabel(label, dlg)); dlg->setStringItems(items); dlg->setSelectionMode(HbAbstractItemView::SingleSelection); + dlg->setSelectedItems(QList()); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->open(dlg, SLOT(DialogClosed(HbAction*))); } diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/engine/FB.hrh --- a/filebrowser/engine/FB.hrh Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/engine/FB.hrh Fri Sep 03 17:11:21 2010 +0300 @@ -285,4 +285,10 @@ EMsgAttachmentsOutbox }; +enum TClipBoardMode + { + EClipBoardModeCut = 0, + EClipBoardModeCopy + }; + #endif // FILEBROWSER_HRH diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/engine/FBFileOps.cpp --- a/filebrowser/engine/FBFileOps.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/engine/FBFileOps.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -391,6 +391,8 @@ { TRAP(err, DoFindEntriesRecursiveL(_L("*"), sourcePath)); // recursively under directories of current directory entry } + // ensure that target folder exists in case of copying empty folder + BaflUtils::EnsurePathExistsL(iFs, targetPath); // a path has a trailing backslash so it needs to be removed before the call err = FileOpAttribs(targetPath.Left(targetPath.Length()-1), aSourceEntry.iEntry.iAtt, 0, 0, 0); } diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/engine/FBFileUtils.cpp --- a/filebrowser/engine/FBFileUtils.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/engine/FBFileUtils.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -362,8 +362,8 @@ //LOGSTRING("Creator: CCreatorEngine::CheckForMoreCommandsL"); // update the progress bar - if (iProgressInfo) - iProgressInfo->IncrementAndDraw(1); +// if (iProgressInfo) +// iProgressInfo->IncrementAndDraw(1); // check if we have more commands to be executed if (iCurrentEntry >= CommandArrayCount() - 1) @@ -406,15 +406,15 @@ } else if (iSucceededOperations == 1 && iFailedOperations == 0) { -// _LIT(KMessage, "Operation succeeded"); -// iEngine->FileBrowserUI()->ShowConfirmationNote(KMessage); + _LIT(KMessage, "Operation succeeded"); + iEngine->FileBrowserUI()->ShowConfirmationNote(KMessage); } else if (iSucceededOperations > 0 && iFailedOperations == 0) { -// _LIT(KMessage, "%d operations succeeded"); -// TBuf<128> noteMsg; -// noteMsg.Format(KMessage, iSucceededOperations); -// iEngine->FileBrowserUI()->ShowConfirmationNote(noteMsg); + _LIT(KMessage, "%d operations succeeded"); + TBuf<128> noteMsg; + noteMsg.Format(KMessage, iSucceededOperations); + iEngine->FileBrowserUI()->ShowConfirmationNote(noteMsg); } else if (iSucceededOperations == 0 && iFailedOperations > 1) { @@ -443,6 +443,7 @@ } RefreshViewL(); + iEngine->FileBrowserUI()->NotifyModelHasChanged(); } else @@ -629,16 +630,8 @@ void CFileBrowserFileUtils::RefreshViewL() { - // TODO - // if (iEngine->FileListContainer()) // { -// // create a list box if it doesn't already exist -// if (!iEngine->FileListContainer()->ListBox()) -// iEngine->FileListContainer()->CreateListBoxL(iEngine->Settings().iFileViewMode); -// -// // clear selections if any -// iEngine->FileListContainer()->ListBox()->ClearSelection(); // // // make sure that the search field is disabled // iEngine->FileListContainer()->DisableSearchFieldL(); @@ -651,17 +644,8 @@ // // // set text items // iEngine->FileListContainer()->SetListBoxTextArrayL(GenerateItemTextArrayL()); - -// // make sure that the current item index is not out of array -// if (iEngine->FileListContainer()->CurrentListBoxItemIndex() == -1 && // -1 is a hardcoded value meaning that no current item index -// iEngine->FileListContainer()->ListBox()->Model()->NumberOfItems() > 0) -// iEngine->FileListContainer()->ListBox()->SetCurrentItemIndex( iEngine->FileListContainer()->ListBox()->Model()->NumberOfItems() - 1 ); -// // } - -// iEngine->FileListContainer()->UpdateToolbar(); - - } + } // -------------------------------------------------------------------------------------------- @@ -1537,50 +1521,11 @@ } // -------------------------------------------------------------------------------------------- -//TInt CFileBrowserFileUtils::GetSelectedItemsOrCurrentItemL(CFileEntryList* aFileEntryList) -// { -// aFileEntryList->Reset(); -// -// const CArrayFix* selectionIndexes = iEngine->GetSelectedIndices(); -// // by default use selected items -// if (selectionIndexes && selectionIndexes->Count() > 0) -// { -// TInt ref(0); -// TKeyArrayFix key(0, ECmpTUint16); -// TInt index(0); -// -// for (TInt i=0; iCount(); i++) -// { -// ref = i; -// -// if (selectionIndexes->Find(ref, key, index) == 0) -// { -// aFileEntryList->AppendL(iFileEntryList->At(i)); -// } -// } -// } -// -// // or if none selected, use the current item index -// else -// { -//// TInt currentItemIndex = iEngine->FileListContainer()->CurrentListBoxItemIndex(); -// TInt currentItemIndex = iEngine->QueryCurrentItemIndex(); -// if (iFileEntryList->Count() > currentItemIndex && currentItemIndex >= 0) -// { -// aFileEntryList->AppendL(iFileEntryList->At(currentItemIndex)); -// } -// } -// -// return aFileEntryList->Count(); -// } - -// -------------------------------------------------------------------------------------------- TInt CFileBrowserFileUtils::ClipboardCutL(const CArrayFix* aSelectionIndices) { iClipBoardMode = EClipBoardModeCut; - //TInt operations = GetSelectedItemsOrCurrentItemL(iClipBoardList); TInt operations = SetSelectedItemsOrCurrentItemL(aSelectionIndices, iClipBoardList); return operations; } @@ -1590,7 +1535,6 @@ TInt CFileBrowserFileUtils::ClipboardCopyL(const CArrayFix* aSelectionIndices) { iClipBoardMode = EClipBoardModeCopy; - //TInt operations = GetSelectedItemsOrCurrentItemL(iClipBoardList); TInt operations = SetSelectedItemsOrCurrentItemL(aSelectionIndices, iClipBoardList); return operations; } @@ -1634,17 +1578,10 @@ // run folder selection dialog // CFileBrowserDestinationFolderSelectionDlg* dlg = CFileBrowserDestinationFolderSelectionDlg::NewL(destinationFolder, iDriveEntryList, iconArray); - // get entry list - //CFileEntryList* entryList = new(ELeave) CFileEntryList(32); - //GetSelectedItemsOrCurrentItemL(entryList); - //CleanupStack::PushL(entryList); - // do the file operations //DoCopyToFolderL(entryList, aTargetDir, aOverwriteOptions, aMove); DoCopyToFolderL(iCurrentSelectionList, aTargetDir, aOverwriteOptions, aMove); - //CleanupStack::PopAndDestroy(); // entryList - // CleanupStack::Pop(); //iconArray } @@ -1735,12 +1672,6 @@ } } - - // execute all operations - if (aDeleteSource) - StartExecutingCommandsL(_L("Moving")); - else - StartExecutingCommandsL(_L("Copying")); } } } @@ -1769,9 +1700,6 @@ } } - - // execute all operations - StartExecutingCommandsL(_L("Deleting")); } @@ -1823,15 +1751,12 @@ ); } } - - // execute all operations - StartExecutingCommandsL(_L("Touching")); } TBool CFileBrowserFileUtils::TargetExists(const TInt aIndex, const TFileName &newName) { TBool alreadyExists(EFalse); - if (iDriveEntryList->Count() > aIndex && aIndex >= 0) + if (iFileEntryList->Count() > aIndex && aIndex >= 0) { TFileEntry fileEntry = iFileEntryList->At(aIndex); @@ -1854,7 +1779,7 @@ void CFileBrowserFileUtils::RenameL(const TInt aIndex, const TFileName &newName) { - if (iDriveEntryList->Count() > aIndex && aIndex >= 0) + if (iFileEntryList->Count() > aIndex && aIndex >= 0) { TFileEntry fileEntry = iFileEntryList->At(aIndex); @@ -1866,91 +1791,33 @@ new(ELeave)CCommandParamsRename(fileEntry, targetEntry, CFileMan::EOverWrite) ); } - // execute all operations done from caller - // StartExecutingCommandsL(_L("Renaming")); } // -------------------------------------------------------------------------------------------- -void CFileBrowserFileUtils::SetAttributesL() +void CFileBrowserFileUtils::SetAttributesL(TUint &aSetAttMask, TUint &aClearAttMask, TBool &aRecurse) { -// CFileEntryList* entries = new(ELeave) CFileEntryList(16); -// GetSelectedItemsOrCurrentItemL(entries); -// CleanupStack::PushL(entries); -// -// if (entries->Count() > 0) -// { -// TFileName naviText = _L("Multiple entries"); -// -// TUint setAttMask(0); -// TUint clearAttMask(0); -// //TBool recurse(EFalse); -// -// // set default masks if only one file selected -// if (entries->Count() == 1) -// { -// TFileEntry fileEntry = entries->At(0); -// -// naviText.Copy(fileEntry.iEntry.iName); -// -// if (fileEntry.iEntry.IsArchive()) -// setAttMask |= KEntryAttArchive; -// else -// clearAttMask |= KEntryAttArchive; -// -// if (fileEntry.iEntry.IsHidden()) -// setAttMask |= KEntryAttHidden; -// else -// clearAttMask |= KEntryAttHidden; -// -// if (fileEntry.iEntry.IsReadOnly()) -// setAttMask |= KEntryAttReadOnly; -// else -// clearAttMask |= KEntryAttReadOnly; -// -// if (fileEntry.iEntry.IsSystem()) -// setAttMask |= KEntryAttSystem; -// else -// clearAttMask |= KEntryAttSystem; -// } -// - //iEngine->FileListContainer()->SetScreenLayoutL(EDisplayModeNormal); - //iEngine->FileListContainer()->SetNaviPaneTextL(naviText); - - //CFileBrowserAttributeEditorDlg* dlg = CFileBrowserAttributeEditorDlg::NewL(setAttMask, clearAttMask, recurse); - //TBool dlgResult = dlg->RunEditorLD(); - - //iEngine->FileListContainer()->SetScreenLayoutL(iEngine->Settings().iDisplayMode); - //iEngine->FileListContainer()->SetNaviPaneTextL(iCurrentPath); -// -// if (dlgResult && (setAttMask > 0 || clearAttMask > 0)) -// { -// for (TInt i=0; iCount(); i++) -// { -// TFileEntry fileEntry = entries->At(i); -// -// // append the new command to the command array -// if (fileEntry.iEntry.IsDir() && recurse) -// { -// AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, -// new(ELeave)CCommandParamsAttribs(fileEntry, setAttMask, clearAttMask, fileEntry.iEntry.iModified, CFileMan::ERecurse) -// ); -// } -// else -// { -// AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, -// new(ELeave)CCommandParamsAttribs(fileEntry, setAttMask, clearAttMask, fileEntry.iEntry.iModified, 0) -// ); -// } -// } -// -// // execute all operations -// StartExecutingCommandsL(_L("Changing attributes")); -// } -// -// } -// -// CleanupStack::PopAndDestroy(); //entries + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry = iCurrentSelectionList->At(i); + + // append the new command to the command array + if (fileEntry.iEntry.IsDir() && aRecurse) + { + AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, + new(ELeave)CCommandParamsAttribs(fileEntry, aSetAttMask, aClearAttMask, fileEntry.iEntry.iModified, CFileMan::ERecurse) + ); + } + else + { + AppendToCommandArrayL(EFileBrowserFileOpCommandAttribs, + new(ELeave)CCommandParamsAttribs(fileEntry, aSetAttMask, aClearAttMask, fileEntry.iEntry.iModified, 0) + ); + } + } + + // execute all operations + StartExecutingCommandsL(_L("Changing attributes")); } // -------------------------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/engine/FBFileUtils.h --- a/filebrowser/engine/FBFileUtils.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/engine/FBFileUtils.h Fri Sep 03 17:11:21 2010 +0300 @@ -57,6 +57,7 @@ TTime iMinDate; TTime iMaxDate; TBool iRecurse; + TBool iDefaultWildCard; }; class TDriveEntry @@ -182,11 +183,11 @@ EIdle = 0, // do nothing }; - enum TClipBoardMode - { - EClipBoardModeCut = 0, - EClipBoardModeCopy - }; +// enum TClipBoardMode +// { +// EClipBoardModeCut = 0, +// EClipBoardModeCopy +// }; public: static CFileBrowserFileUtils* NewL(CEngine* aEngine); @@ -261,7 +262,7 @@ TBool SelectionHasDirs(); void TouchL(TBool aRecurse); void RenameL(const TInt aIndex, const TFileName &newName); - void SetAttributesL(); + void SetAttributesL(TUint &aSetAttMask, TUint &aClearAttMask, TBool &aRecurse); void SearchL(); void NewFileL(const TFileName &aNewFileName); void NewDirectoryL(const TFileName &aNewDirectoryName); @@ -330,6 +331,7 @@ inline TSearchResults SearchResults(){ return iFileSearchResults; }; inline CFileEntryList* FoundFiles() { return iFileEntryList; }; inline void SetAllowProcessing(TBool aAllowProcessing) { iAllowProcessing = aAllowProcessing; } + TClipBoardMode GetClipBoardMode() { return iClipBoardMode; } private: TState iState; @@ -339,7 +341,7 @@ TBool isWaitDialog; TBool isProgressDialog; - CEikProgressInfo* iProgressInfo; + //CEikProgressInfo* iProgressInfo; CCommandArray* iCommandArray; TInt iCurrentEntry; TInt iSucceededOperations; @@ -353,7 +355,7 @@ TFileName iCurrentPath; TInt iSortMode; TInt iOrderMode; - TInt iClipboardMode; +// TInt iClipboardMode; CDesCArray* iClipboardPaths; CDriveEntryList* iDriveEntryList; CFileEntryList* iFileEntryList; diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/engine/FBFolderSelector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/engine/FBFolderSelector.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,622 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "FBFolderSelector.h" +#include "FBFileUtils.h" +#include "FB.hrh" +#include "FBStd.h" + +#if (!defined __SERIES60_30__ && !defined __SERIES60_31__) +#include +#endif // !defined __SERIES60_30__ && !defined __SERIES60_31__ + +// ===================================== MEMBER FUNCTIONS ===================================== + +CFileBrowserFolderSelector *CFileBrowserFolderSelector::NewL( + TDes& aReturnPath, + MFolderSelectorUI *aFolderSelectorUI) + { + CFileBrowserFolderSelector* self = new(ELeave) CFileBrowserFolderSelector(aReturnPath, + aFolderSelectorUI); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFolderSelector::~CFileBrowserFolderSelector() + { + delete iFileEntryList; + delete iDriveEntryList; + + iFs.Close(); + + //iEikonEnv->InfoMsgCancel(); + } + +// -------------------------------------------------------------------------------------------- + +CFileBrowserFolderSelector::CFileBrowserFolderSelector(TDes& aReturnPath, MFolderSelectorUI *aFolderSelectorUI) : + iReturnPath(aReturnPath), + iFolderSelectorUI(aFolderSelectorUI) + { + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFolderSelector::ConstructL() + { + User::LeaveIfError( iFs.Connect() ); + iDriveEntryList = new(ELeave) CDriveEntryList(8); + iFileEntryList = new(ELeave) CFileEntryList(32); + iCurrentPath = KNullDesC; + + //iIsDragging = EFalse; + //EnableDragEvents(); + + // get only writeable drives + GetDriveListL(); + } + +// -------------------------------------------------------------------------------------------- + +/* +void CFileBrowserFolderSelector::HandlePointerEventL(const TPointerEvent &aPointerEvent) + { + // detect direction of dragging by comparing the start and finish points + + if (aPointerEvent.iType == TPointerEvent::EButton1Down) + { + iDragStartPoint = aPointerEvent.iPosition; + iIsDragging = EFalse; + } + else if (aPointerEvent.iType == TPointerEvent::EDrag) + { + iIsDragging = ETrue; + + return; + } + else if (aPointerEvent.iType == TPointerEvent::EButton1Up) + { + if (iIsDragging) + { + const TInt KDelta = iDragStartPoint.iX - aPointerEvent.iPosition.iX; + const TInt KThreshold = 30; + + if (KDelta < -KThreshold) // dragging to right + { + // "emulate" right key press + + TKeyEvent keyEvent; + keyEvent.iCode = EKeyRightArrow; + keyEvent.iModifiers = 0; + + TEventCode type = EEventKey; + + OfferKeyEventL(keyEvent, type); + + return; + } + else if (KDelta > KThreshold) // dragging to left + { + // "emulate" left key press + + TKeyEvent keyEvent; + keyEvent.iCode = EKeyLeftArrow; + keyEvent.iModifiers = 0; + + TEventCode type = EEventKey; + + OfferKeyEventL(keyEvent, type); + + return; + } + } + iIsDragging = EFalse; + } + else + { + iIsDragging = EFalse; + } + + CAknListQueryDialog::HandlePointerEventL(aPointerEvent); + } +*/ + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CFileBrowserFolderSelector::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) + { +// if(aType != EEventKey) +// return EKeyWasNotConsumed; + +// if (aKeyEvent.iCode == EKeyLeftArrow && !IsDriveListViewActive()) +// { +// MoveUpOneLevelL(); +// return EKeyWasConsumed; +// } +// else if (aKeyEvent.iCode == EKeyRightArrow && ((ListBox()->CurrentItemIndex() > 0 && !IsDriveListViewActive()) || IsDriveListViewActive())) +// { +// MoveDownToDirectoryL(); +// return EKeyWasConsumed; +// } +// else if (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) +// { +// if (IsDriveListViewActive()) +// { +// MoveDownToDirectoryL(); +// return EKeyWasConsumed; +// } +// else if (ListBox()->CurrentItemIndex() == 0) +// { +// TryExitL(EAknSoftkeyOk); +// return EKeyWasConsumed; +// } +// else if (ListBox()->CurrentItemIndex() > 0) +// { +// MoveDownToDirectoryL(); +// return EKeyWasConsumed; +// } +// } +// +// TKeyResponse result = CAknDialog::OfferKeyEventL(aKeyEvent, aType); +// +// // update LSK label +// if (!IsDriveListViewActive()) +// { +// if (ListBox()->CurrentItemIndex() == 0) +// { +// ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, iLSKActionText); +// ButtonGroupContainer().DrawNow(); +// } +// else +// { +// ButtonGroupContainer().SetCommandL(0, EAknSoftkeyOk, _L("Open dir")); +// ButtonGroupContainer().DrawNow(); +// } +// } +// +// return result; + return TKeyResponse(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFolderSelector::PreLayoutDynInitL() + { +// CAknListQueryDialog::PreLayoutDynInitL(); + +// static_cast(ListBox())->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFolderSelector::PostLayoutDynInitL() + { +// CAknListQueryDialog::PostLayoutDynInitL(); + + //w SetIconArrayL(static_cast*>(iIconArray)); + + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +TBool CFileBrowserFolderSelector::OkToExitL(TInt /*aButtonId*/) + { +// if (aButtonId == GetLeftCBAShortKeyPress()) +// { +// if (IsDriveListViewActive()) +// { +// MoveDownToDirectoryL(); +// return EFalse; +// } +// else if (ListBox()->CurrentItemIndex() == 0) +// { +// // close the dialog +// iReturnPath = iCurrentPath; +// return ETrue; +// } +// else if (ListBox()->CurrentItemIndex() > 0) +// { +// MoveDownToDirectoryL(); +// return EFalse; +// } +// else +// return EFalse; +// } +// else if (aButtonId == GetRightCBAShortKeyPress()) +// { +// return ETrue; +// } +// else +// { +// return EFalse; +// } + return ETrue; + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFolderSelector::MoveUpOneLevelL() + { + if (iCurrentPath.Length() <= 3) + { + // move to drive list view is the current path is already short enough + iCurrentPath = KNullDesC; + } + else + { + // move one directory up + TInt marker(iCurrentPath.Length()); + + // find second last dir marker + for (TInt i=iCurrentPath.Length()-2; i>=0; i--) + { + if (iCurrentPath[i] == '\\') + { + marker = i; + break; + } + + } + iCurrentPath = iCurrentPath.LeftTPtr(marker+1); + } + + // update view + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFolderSelector::MoveDownToDirectoryL(TInt index) + { + if (index >= 0) + { + if (IsDriveListViewActive()) + { + // currently in a drive list view, move to root of selected drive + if (iDriveEntryList->Count() > index) + { + TDriveEntry driveEntry = iDriveEntryList->At(index); + + iCurrentPath.Append(driveEntry.iLetter); + iCurrentPath.Append(_L(":\\")); + } + } + else + { + // this needed because we have an extra item in the listbox + index--; + + // append the new directory + if (iFileEntryList->Count() > index) + { + TFileEntry fileEntry = iFileEntryList->At(index); + + if (fileEntry.iEntry.IsDir()) + { + iCurrentPath.Append(fileEntry.iEntry.iName); + iCurrentPath.Append(_L("\\")); + } + } + } + + // update view + RefreshViewL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFolderSelector::RefreshViewL() + { + if (IsDriveListViewActive()) + { + GetDriveListL(); + } + else + { + GetFileListL(); + } + iFolderSelectorUI->InformFolderSelectionChanged(); + + // TODO +// if (iCurrentPath == KNullDesC) +// iEikonEnv->InfoMsgWithDuration(_L("<- up dir down dir ->"), TTimeIntervalMicroSeconds32(KMaxTInt)); +// else +// iEikonEnv->InfoMsgWithDuration(iCurrentPath, TTimeIntervalMicroSeconds32(KMaxTInt)); + +// SetItemTextArray(textArray); +// SetOwnershipType(ELbmOwnsItemArray); +// ListBox()->HandleItemAdditionL(); +// Layout(); +// ListBox()->SetCurrentItemIndex(0); +// DrawDeferred(); + } + +// -------------------------------------------------------------------------------------------- + +//TBool CFileBrowserFolderSelector::RunCopyDlgLD() +// { +// iLSKActionText.Copy(_L("Copy")); +// return ExecuteLD(1/*R_COPY_TO_FOLDER_SELECTION_QUERY*/); +// } + +//// -------------------------------------------------------------------------------------------- + +//TBool CFileBrowserFolderSelector::RunMoveDlgLD() +// { +// iLSKActionText.Copy(_L("Move")); +// return ExecuteLD(1/*R_MOVE_TO_FOLDER_SELECTION_QUERY*/); +// } + +//// -------------------------------------------------------------------------------------------- + +//TInt CAknQueryDialog::GetLeftCBAShortKeyPress() +// { +// return TInt16(0xffff & TInt16(ButtonGroupContainer().ButtonGroup()->CommandId(0))); +// } + +//// -------------------------------------------------------------------------------------------- + +//TInt CAknQueryDialog::GetRightCBAShortKeyPress() +// { +// return TInt16(0xffff & TInt16(ButtonGroupContainer().ButtonGroup()->CommandId(2))); +// } + +// -------------------------------------------------------------------------------------------- + +void CFileBrowserFolderSelector::GetDriveListL() + { + TDriveList driveList; + + // get drive listing depending of the support for network drives + if (true/*TODO iEngine->Settings().iSupportNetworkDrives*/) + { + #ifndef __SERIES60_30__ + #ifndef __SERIES60_31__ + User::LeaveIfError(iFs.DriveList(driveList, KDriveAttAll)); + #endif + #else + User::LeaveIfError(iFs.DriveList(driveList)); + #endif + } + else + { + User::LeaveIfError(iFs.DriveList(driveList)); + } + + iDriveEntryList->Reset(); + + //TDriveEntry driveEntry; + for (TInt i=0; iCount(); +// } + + if (driveEntry.iVolumeInfo.iDrive.iMediaAtt != KMediaAttWriteProtected + && driveEntry.iVolumeInfo.iDrive.iMediaAtt != KMediaAttLocked + && driveEntry.iVolumeInfo.iDrive.iDriveAtt != KDriveAbsent) + { + iDriveEntryList->AppendL(driveEntry); + } + } + } + } + +void CFileBrowserFolderSelector::GetFileListL() + { + iFileEntryList->Reset(); + + CDir* dir = NULL; + if (iFs.GetDir(iCurrentPath, KEntryAttDir|KEntryAttMatchMask, ESortByName | EAscending | EDirsFirst, dir) == KErrNone) + { + CleanupStack::PushL(dir); + + for (TInt i=0; iCount(); i++) + { + TFileEntry fileEntry; + fileEntry.iPath = iCurrentPath; + fileEntry.iEntry = (*dir)[i]; + fileEntry.iDirEntries = KErrNotFound; + fileEntry.iIconId = EFixedIconEmpty; + + // check for directory entries + if (fileEntry.iEntry.IsDir()) + { + fileEntry.iIconId = EFixedIconFolder; + + TFileName subPath = fileEntry.iPath; + subPath.Append(fileEntry.iEntry.iName); + subPath.Append(_L("\\")); + + // check if any sub directories + CDir* subDir = NULL; + if (iFs.GetDir(subPath, KEntryAttDir|KEntryAttMatchMask, ESortNone | EDirsFirst, subDir) == KErrNone) + { + fileEntry.iDirEntries = subDir->Count(); + + for (TInt j=0; jCount(); j++) + { + TEntry entry = (*subDir)[j]; + + if (entry.IsDir()) + { + fileEntry.iIconId = EFixedIconFolderSub; + break; + } + } + + delete subDir; + } + iFileEntryList->AppendL(fileEntry); + } + } + + CleanupStack::PopAndDestroy(); //dir + } + } + +// -------------------------------------------------------------------------------------------- + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/engine/FBFolderSelector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/engine/FBFolderSelector.h Fri Sep 03 17:11:21 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: +* +*/ + +#ifndef FILEBROWSER_FILEDLGS_H +#define FILEBROWSER_FILEDLGS_H + +#include "FBFileUtils.h" + +#include +#include +#include +#include + +/** + * Interface to communicate UI with + */ +class MFolderSelectorUI +{ +public: + /** + * Shows info message with text +// * @param A aText text to be shown in message body. +// * @param A aTitle text to be shown in message title. + * @return None. + */ + virtual void InformFolderSelectionChanged() = 0; +}; + +/** + * Backend class for destination folder selection dialog + */ +class CFileBrowserFolderSelector + { +public: + static CFileBrowserFolderSelector *NewL(TDes& aReturnPath, MFolderSelectorUI *); + virtual ~CFileBrowserFolderSelector(); + + inline TFileName CurrentPath() const { return iCurrentPath; } + inline TBool IsDriveListViewActive() const { return iCurrentPath==KNullDesC; } + inline const CDriveEntryList *DriveEntryList() { return iDriveEntryList; } + inline const CFileEntryList *FileEntryList() {return iFileEntryList; } + + void MoveDownToDirectoryL(TInt index); + void MoveUpOneLevelL(); + +private: // Constructors + CFileBrowserFolderSelector(TDes& aReturnPath, MFolderSelectorUI *); + void ConstructL(); + +protected: // From CEikDialog + TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); + void PreLayoutDynInitL(); + void PostLayoutDynInitL(); + TBool OkToExitL(TInt aButtonId); + +protected: // From CCoeControl + //void HandlePointerEventL(const TPointerEvent &aPointerEvent); + +private: // New methods + void RefreshViewL(); + + void GetDriveListL(); + void GetFileListL(); + +private: // Data + TInt iSelectedIndex; + TBuf<16> iLSKActionText; + TDes &iReturnPath; + RFs iFs; + CDriveEntryList *iDriveEntryList; + CFileEntryList *iFileEntryList; + TFileName iCurrentPath; + MFolderSelectorUI *iFolderSelectorUI; + }; + +#endif + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/engine/engine.h --- a/filebrowser/engine/engine.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/engine/engine.h Fri Sep 03 17:11:21 2010 +0300 @@ -165,6 +165,11 @@ */ virtual TBool ShowConfirmationQuery(const TDesC& aDescText) = 0; + /** + * Notify wrapping model data has changed + */ + virtual void NotifyModelHasChanged() = 0; + }; class CEngine : public CBase diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/group/ReleaseNotes_FileBrowser.txt --- a/filebrowser/group/ReleaseNotes_FileBrowser.txt Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/group/ReleaseNotes_FileBrowser.txt Fri Sep 03 17:11:21 2010 +0300 @@ -1,7 +1,7 @@ =============================================================================== -RELEASE NOTES - FILEBROWSER v5.1.0 -RELEASED 18th June 2010 +RELEASE NOTES - FILEBROWSER v5.2.0 +RELEASED 27th August 2010 SUPPORTS S60 3.0+ @@ -37,11 +37,10 @@ =============================================================================== -What's New in v5.1.0 +What's New in v5.2.0 ==================== - Error fixes -- File filtering -- Usability improvements +- Destination folder selection dialog =============================================================================== @@ -111,6 +110,17 @@ Version History: ================ +Version 5.1.1 - 26th June 2010 +==================== +- Error fixes +- File attributes + +Version 5.1.0 - 18th June 2010 +==================== +- Error fixes +- File filtering +- Usability improvements + Version 5.0.1 - 21th May 2010 ==================== - Error fixes diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/icons/qtg_indi_status_back.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/icons/qtg_indi_status_back.svg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,17 @@ + + + +]> + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/driveentry.h --- a/filebrowser/ui/inc/driveentry.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* 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 DRIVEENTRY_H -#define DRIVEENTRY_H - -#include "FBFileUtils.h" -#include -#include - - -/** - * class that is used for communicating between Symbian and Qt code. - */ -class DriveEntry { - -public: - - /** - * Constructor - */ - DriveEntry(TDriveEntry aDriveEntry); - - /** - * Destructor - */ - ~DriveEntry(); - - /* Functions that are called from UI */ -public: - QChar driveLetter(); - int number(); - QString mediaTypeString(); - QString attributesString(); - int iconId(); - qint64 volumeInfoFree(); - qint64 volumeInfoSize(); - -private: - TDriveEntry mDriveEntry; - }; - -#endif //DRIVEENTRY_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/editorview.h --- a/filebrowser/ui/inc/editorview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* 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 EDITORVIEW_H -#define EDITORVIEW_H - -#include - -class HbTextEdit; -class HbAction; - -class EditorView : public HbView -{ - Q_OBJECT - -public: - EditorView(); - ~EditorView(); - void open(const QString& fileName, bool flagReadOnly); - -signals: - void finished(bool ok); - -private slots: - void backButtonClicked(); - void displayInText(); - void displayInHex(); - void updateMenu(); - - /* - void newFile(); - bool save(); - bool saveAs(); - void about(); - void documentWasModified(); - */ - - -private: - void loadFile(const QString &fileName); - void createMenu(); - - // editor - HbTextEdit *mTextEdit; - // if flag true, file is currently in hex format - bool mFileHex; - bool mFlagReadOnly; - QString mFileName; - QString mFileContent; - - HbAction* mToTextAction; - HbAction* mToHexAction; - HbAction* mExitAction; -}; - -#endif // EDITORVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/enginewrapper.h --- a/filebrowser/ui/inc/enginewrapper.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/inc/enginewrapper.h Fri Sep 03 17:11:21 2010 +0300 @@ -18,8 +18,8 @@ #ifndef ENGINEWRAPPER_H #define ENGINEWRAPPER_H -#include "driveentry.h" -#include "fileentry.h" +#include "fbdriveentry.h" +#include "fbfileentry.h" #include "filebrowsersettings.h" #include "engine.h" @@ -91,6 +91,7 @@ void ProcessEvents(); TBool ShowConfirmationQuery(const TDesC& aDescText); + void NotifyModelHasChanged(); public: /* Functions that are called from UI */ @@ -122,6 +123,7 @@ void rename(const QModelIndex& aIndex, const QString aNewName); void touch(bool aRecurse); void properties(const QModelIndex &aCurrentItemIndex, QStringList &aPropertyList, QString &aTitleText); + void setAttributes(quint32 &, quint32 &, bool &); bool openAppArc(QString fileName); bool openDocHandler(QString fileName, bool embeddedVal = false); @@ -130,8 +132,8 @@ bool isCurrentDriveReadOnly(); bool isClipBoardListInUse(); int itemCount() const; - DriveEntry getDriveEntry(const QModelIndex& aIndex) const; - FileEntry getFileEntry(const QModelIndex& aIndex) const; + FbDriveEntry getDriveEntry(const QModelIndex& aIndex) const; + FbFileEntry getFileEntry(const QModelIndex& aIndex) const; const CArrayFix *convertSelectionList(const QModelIndexList &aSelectionIndices); void setCurrentSelection(const QModelIndexList &aSelectionIndices); @@ -174,6 +176,11 @@ void showFileCheckSums(const QModelIndex &aIndex, TFileBrowserCmdFileChecksums checksumType); + TClipBoardMode getClipBoardMode() { return mEngine->FileUtils()->GetClipBoardMode(); } + +signals: + void fileSystemDataChanged(); + private slots: void progressDialogCancelled(); void waitDialogCancelled(); diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbattributesview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbattributesview.h Fri Sep 03 17:11:21 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 FBATTRIBUTESVIEW_H +#define FBATTRIBUTESVIEW_H + +#include + +class HbDataForm; +class HbDataFormModelItem; + +class FbAttributesView : public HbView +{ + Q_OBJECT + +public: + FbAttributesView(quint32 &, quint32 &, bool &); + virtual ~FbAttributesView(); + + quint32 &setAttributesMask() { return mSetAttributesMask; } + quint32 &clearAttributesMask() { return mClearAttributesMask; } + bool &recurse() { return mRecurse; } + +signals: + void finished(bool ok); + +public slots: + void accept(); + void reject(); + +private: + void initDataForm(); + void createToolbar(); + void loadSettings(); + void saveSettings(); + +private: + quint32 mSetAttributesMask; + quint32 mClearAttributesMask; + bool mRecurse; + + HbDataForm *mForm; + HbDataFormModelItem *mArchiveItem; + HbDataFormModelItem *mHiddenItem; + HbDataFormModelItem *mReadOnlyItem; + HbDataFormModelItem *mSystemItem; + HbDataFormModelItem *mRecurseItem; +}; + +#endif // FBATTRIBUTESVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbdriveentry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbdriveentry.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,57 @@ +/* +* 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 FBDRIVEENTRY_H +#define FBDRIVEENTRY_H + +#include "FBFileUtils.h" +#include +#include + + +/** + * class that is used for communicating between Symbian and Qt code. + */ +class FbDriveEntry { + +public: + + /** + * Constructor + */ + FbDriveEntry(TDriveEntry aDriveEntry); + + /** + * Destructor + */ + ~FbDriveEntry(); + + /* Functions that are called from UI */ +public: + QChar driveLetter(); + int number(); + QString mediaTypeString(); + QString attributesString(); + int iconId(); + qint64 volumeInfoFree(); + qint64 volumeInfoSize(); + +private: + TDriveEntry mDriveEntry; + }; + +#endif //FBDRIVEENTRY_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbdrivemodel.h --- a/filebrowser/ui/inc/fbdrivemodel.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/inc/fbdrivemodel.h Fri Sep 03 17:11:21 2010 +0300 @@ -18,7 +18,7 @@ #ifndef FBDRIVEMODELH_H_ #define FBDRIVEMODELH_H_ -#include "driveentry.h" +#include "fbdriveentry.h" #include #include @@ -41,7 +41,7 @@ QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - DriveEntry driveEntry(const QModelIndex &index) const; + FbDriveEntry driveEntry(const QModelIndex &index) const; QString driveLetter( const QModelIndex &index ) const; QString mediaTypeString(const QModelIndex &index) const; diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbdriveview.h --- a/filebrowser/ui/inc/fbdriveview.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/inc/fbdriveview.h Fri Sep 03 17:11:21 2010 +0300 @@ -114,18 +114,18 @@ void doDiskAdminClearDrivePassword(HbAction *); void diskAdminEraseDrivePassword(); - void doDiskAdminEraseDrivePassword(HbAction *); + void doDiskAdminEraseDrivePassword(int); void diskAdminFormatDrive(); - void doDiskAdminFormatDrive(HbAction *); + void doDiskAdminFormatDrive(int); void diskAdminQuickFormatDrive(); - void doDiskAdminQuickFormatDrive(HbAction *); + void doDiskAdminQuickFormatDrive(int); void diskAdminCheckDisk(); void diskAdminScanDrive(); - void doDiskAdminScanDrive(HbAction *); + void doDiskAdminScanDrive(int); void diskAdminSetDriveName(); void doDiskAdminSetDriveName(HbAction *); @@ -135,19 +135,19 @@ void diskAdminEjectDrive(); void diskAdminDismountDrive(); - void doDiskAdminDismountDrive(HbAction *); + void doDiskAdminDismountDrive(int); void diskAdminEraseMBR(); - void doDiskAdminEraseMBR(HbAction *); - void doDiskAdminReallyEraseMBR(HbAction *); - void doDiskAdminNotRemovableReallyEraseMBR(HbAction *); + void doDiskAdminEraseMBR(int); + void doDiskAdminReallyEraseMBR(int); + void doDiskAdminNotRemovableReallyEraseMBR(int); void diskAdminPartitionDrive(); - void diskAdminPartitionDriveProceed(HbAction *); - void diskAdminPartitionDriveReallyProceed(HbAction *); - void diskAdminPartitionDriveIsNotRemovable(HbAction *); - void diskAdminPartitionDriveEraseMbr(HbAction *); - void diskAdminPartitionDriveGetCount(HbAction*); + void diskAdminPartitionDriveProceed(int); + void diskAdminPartitionDriveReallyProceed(int); + void diskAdminPartitionDriveIsNotRemovable(int); + void diskAdminPartitionDriveEraseMbr(int); + void diskAdminPartitionDriveGetCount(HbAction *); // tools menu void toolsAllAppsToTextFile(); diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbeditorview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbeditorview.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,70 @@ +/* +* 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 FBEDITORVIEW_H +#define FBEDITORVIEW_H + +#include + +class HbTextEdit; +class HbAction; + +class FbEditorView : public HbView +{ + Q_OBJECT + +public: + FbEditorView(); + ~FbEditorView(); + void open(const QString& fileName, bool flagReadOnly); + +signals: + void finished(bool ok); + +private slots: + void backButtonClicked(); + void displayInText(); + void displayInHex(); + void updateMenu(); + + /* + void newFile(); + bool save(); + bool saveAs(); + void about(); + void documentWasModified(); + */ + + +private: + void loadFile(const QString &fileName); + void createMenu(); + + // editor + HbTextEdit *mTextEdit; + // if flag true, file is currently in hex format + bool mFileHex; + bool mFlagReadOnly; + QString mFileName; + QString mFileContent; + + HbAction* mToTextAction; + HbAction* mToHexAction; + HbAction* mExitAction; +}; + +#endif // FBEDITORVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbfileentry.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbfileentry.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,72 @@ +/* +* 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 FILEEENTRY_H +#define FILEEENTRY_H + +#include "FBFileUtils.h" +#include +#include +#include + +/** + * class that is used for communicating between Symbian and Qt code. + */ +class FbFileEntry +{ +public: + /** + * Constructor + */ + FbFileEntry(TFileEntry aFileEntry); + + /** + * Destructor + */ + ~FbFileEntry(); + + /* Functions that are called from UI */ +public: + QString fullName(); + QString path(); + + int attributes(); + QString attributesString(); + bool isArchive() { return mFileEntry.iEntry.IsArchive(); } + bool isHidden() { return mFileEntry.iEntry.IsHidden(); } + bool isReadOnly() { return mFileEntry.iEntry.IsReadOnly(); } + bool isSystem() { return mFileEntry.iEntry.IsSystem(); } + + int size(); + QString sizeString(); + +// QDateTime modified(); + QString modifiedString(); +// int Uid(int id); + bool isDir(); + QString name(); + + int dirEntries(); + QString dirEntriesString(); + + int iconId(); + +private: + TFileEntry mFileEntry; + }; + +#endif //FBFILEEENTRY_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbfileview.h --- a/filebrowser/ui/inc/fbfileview.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/inc/fbfileview.h Fri Sep 03 17:11:21 2010 +0300 @@ -42,7 +42,7 @@ class HbMenu; class HbSearchPanel; -class EditorView; +class FbEditorView; class SearchView; class SettingsView; class EngineWrapper; @@ -67,8 +67,8 @@ void openPropertyDialog(const QStringList &propertyList, const QString &title); + void storeSelectedItemsOrCurrentItem(); QModelIndex currentItemIndex(); - void storeSelectedItemsOrCurrentItem(); // Menu related methods void createMenu(); @@ -102,14 +102,14 @@ void doFileNewDirectory(HbAction *); void fileDelete(); - void doFileDelete(HbAction *); + void doFileDelete(int); void fileRename(); void doFileRename(HbAction *); - void doFileRenameFileExist(HbAction *); + void doFileRenameFileExist(int); void fileTouch(); - void doFileTouch(HbAction *); + void doFileTouch(int); void fileProperties(); void fileChecksumsMD5(); @@ -126,10 +126,10 @@ void editPaste(); void editCopyToFolder(); - void doEditCopyToFolder(HbAction *); + void doEditCopyToFolder(int); void editMoveToFolder(); - void doEditMoveToFolder(HbAction *); + void doEditMoveToFolder(int); void editSelect(); void editUnselect(); @@ -187,6 +187,7 @@ void aboutToShowSettingsView(); void aboutToShowEditorView(const QString &, bool); void aboutToShowSearchView(const QString &); + void aboutToShowAttributesView(const QString &, quint32 &, quint32 &, bool &); void aboutToSimulateLeave(int); private slots: @@ -203,6 +204,11 @@ void fileOverwritePostfix(HbAction *); private: + // Internal methods + void proceedFileRename(); + void proceedFileTouch(bool recurse); + +private: EngineWrapper *mEngineWrapper; HbListView *mListView; @@ -222,6 +228,8 @@ ContextMenuActions mContextMenuActions; HbMenu *mContextMenu; HbAction *mToolbarBackAction; + HbAction* mToolbarFilterAction; + HbAction *mToolbarPasteAction; // flags bool mItemHighlighted; diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbfolderselectiondialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbfolderselectiondialog.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,76 @@ +/* +* 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 FBFOLDERSELECTIONDIALOG_H_ +#define FBFOLDERSELECTIONDIALOG_H_ + +#include + +// forward declarations +class FbFolderSelectorWrapper; +class HbListWidget; +class HbListWidgetItem; +class HbLabel; +class QFileIconProvider; + +class FbFolderSelectionDialog : public HbDialog +{ + Q_OBJECT + +public: + explicit FbFolderSelectionDialog(QGraphicsItem *parent = 0); + virtual ~FbFolderSelectionDialog(); + + QString selectedFolder(); + +private: + void init(); + void createHeading(); + void createList(); + void createToolBar(); + +private slots: + void activated(HbListWidgetItem *); + void refreshView(); + void moveUpPressed(); + +protected: + HbLabel *mTitle; + +private: + HbListWidget *mFolderList; + FbFolderSelectorWrapper *mFolderSelectorWrapper; + QFileIconProvider *mFileIconProvider; +}; + +class FbCopyToFolderSelectionDialog : public FbFolderSelectionDialog +{ + Q_OBJECT + +public: + explicit FbCopyToFolderSelectionDialog(QGraphicsItem *parent = 0); +}; + +class FbMoveToFolderSelectionDialog : public FbFolderSelectionDialog +{ + Q_OBJECT + +public: + explicit FbMoveToFolderSelectionDialog(QGraphicsItem *parent = 0); +}; + +#endif // FBFOLDERSELECTIONDIALOG_H_ diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbfolderselectorwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbfolderselectorwrapper.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,71 @@ +/* +* 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 FBFOLDERSELECTORWRAPPER_H_ +#define FBFOLDERSELECTORWRAPPER_H_ + +#include "fbdriveentry.h" +#include "fbfileentry.h" +#include "FBFolderSelector.h" + +#include +#include +#include + +class CEngine; +class SearchAttributes; +class SearchResults; +class FileBrowserView; +class HbProgressDialog; + +class QModelIndex; +class CFileBrowserFolderSelector; +class EngineWrapper; + + +/** + * class that is used for communicating between Symbian and Qt code. + */ +class FbFolderSelectorWrapper : public QObject, public MFolderSelectorUI +{ + Q_OBJECT +public: + FbFolderSelectorWrapper(); + ~FbFolderSelectorWrapper(); + + bool init(); + + QString currentPath() const; + bool isDriveListViewActive() const; + int itemCount() const; + FbDriveEntry getDriveEntry(const int aIndex) const; + FbFileEntry getFileEntry(const int aIndex) const; + + void moveDownToDirectory(int); + void moveUpOneLevel(); + +signals: + void FolderSelectionChanged(); + +public: // From MFolderSelectorUI + virtual void InformFolderSelectionChanged(); + +private: + CFileBrowserFolderSelector *mDestinationFolderSelector; +}; + +#endif // FBFOLDERSELECTORWRAPPER_H_ diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbmainwindow.h --- a/filebrowser/ui/inc/fbmainwindow.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/inc/fbmainwindow.h Fri Sep 03 17:11:21 2010 +0300 @@ -26,9 +26,10 @@ class EngineWrapper; class FbDriveView; class FbFileView; -class SettingsView; -class EditorView; -class SearchView; +class FbSettingsView; +class FbEditorView; +class FbSearchView; +class FbAttributesView; class FbMainWindow : public HbMainWindow { @@ -48,14 +49,18 @@ void openSettingsView(); void openEditorView(const QString &, bool); void openSearchView(const QString &); + + void openAttributesView(const QString &, quint32 &, quint32 &, bool &); + void closeAttributesView(bool); private: EngineWrapper *mEngineWrapper; FbDriveView *mDriveView; FbFileView *mFileView; - SettingsView *mSettingsView; - EditorView *mEditorView; - SearchView *mSearchView; + FbSettingsView *mSettingsView; + FbEditorView *mEditorView; + FbSearchView *mSearchView; + FbAttributesView *mAttributesView; HbView *mPreviousView; }; diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbsearchview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbsearchview.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,106 @@ +/* +* 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 FBSEARCHVIEW_H +#define FBSEARCHVIEW_H + +#include + +#include + +class QStringList; + +class EngineWrapper; +class HbDataForm; +class HbDataFormModelItem; +class HbProgressDialog; + +/** + * Settings class that is used for + */ +class SearchAttributes +{ +public: + QString mSearchDir; + QString mWildCards; + QString mTextInFile; + int mMinSize; + int mMaxSize; + QDate mMinDate; + QDate mMaxDate; + bool mRecurse; + bool mDefaultWildCard; +}; + +/** + * search results class. + */ +class SearchResults +{ +public: + int mNumberOfFoundFiles; + QStringList *mFoundFilesList; +}; + +class FbSearchView : public HbView +{ + Q_OBJECT + +public: + explicit FbSearchView(EngineWrapper &engineWrapper); + ~FbSearchView(); + void open(const QString &path); + +signals: + void finished(bool ok); + +private slots: + void accept(); + void reject(); + +private: + void initDataForm(); + void createToolbar(); + void loadAttributes(); + void readFormItems(); + + void startFileSearch(); + void fileSearchResults(); + +private: + /* EngineWrapper */ + EngineWrapper &mEngineWrapper; + + /* Search attributes */ + SearchAttributes mAttributes; + /* Search results */ + SearchResults mResults; + + HbDataForm *mForm; + HbDataFormModelItem *mSearchFileNameItem; + HbDataFormModelItem *mWildCardItem; + HbDataFormModelItem *mHasString; + HbDataFormModelItem *mRecurse; + HbDataFormModelItem *mMinSize; + HbDataFormModelItem *mMaxSize; + HbDataFormModelItem *mMinDate; + HbDataFormModelItem *mMaxDate; + QString mPath; + HbProgressDialog *mProgressDialog; +}; + +#endif // FBSEARCHVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fbsettingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/inc/fbsettingsview.h Fri Sep 03 17:11:21 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 FBSETTINGSVIEW_H +#define FBSETTINGSVIEW_H + +#include + +class HbDataForm; +class HbDataFormModelItem; +class EngineWrapper; +class FileBrowserSettings; + +class FbSettingsView : public HbView +{ + Q_OBJECT + +public: + FbSettingsView(EngineWrapper &engineWrapper); + virtual ~FbSettingsView(); + + void initDataForm(); +signals: + void finished(bool ok); + +public slots: +// void displayModeChanged(); +// void fileViewChanged(); +// void subDirectoryInfoChanged(); +// void associatedIconsChanged(); +// void rememberFolderOnExitChanged(); +// void rememberLastFolderChanged(); +// void showToolbarChanged(); + +// void toggleChange(QModelIndex, QModelIndex); + void accept(); + void reject(); + +private: + void createToolbar(); + void constructMenu(); + void loadSettings(const FileBrowserSettings &settings); + void saveSettings(FileBrowserSettings &settings); + +private: + EngineWrapper &mEngineWrapper; + + HbDataForm *mForm; + HbDataFormModelItem *mDisplayModeItem; + HbDataFormModelItem *mFileViewItem; + HbDataFormModelItem *mShowDirectoryInfoItem; + HbDataFormModelItem *mShowAssociatedIconsItem; + HbDataFormModelItem *mRememberFolderOnExitItem; + HbDataFormModelItem *mRememberLastFolderItem; + HbDataFormModelItem *mShowToolbarItem; + + HbDataFormModelItem *mSupportNetDrivesItem; //"Support net drives" + HbDataFormModelItem *mBypassPlatformSecurityItem; //"Bypass plat.security" + HbDataFormModelItem *mUnlockFilesViaSBItem; //"Unlock files via SB" + HbDataFormModelItem *mIgnoreProtectionAttributesItem; //"Ign. protection atts" + HbDataFormModelItem *mNoROAttributeCopyFromZItem; //"No RO-att copy from Z:" + +}; + +#endif // FBSETTINGSVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/fileentry.h --- a/filebrowser/ui/inc/fileentry.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* 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 FILEEENTRY_H -#define FILEEENTRY_H - -#include "FBFileUtils.h" -#include -#include -#include - -/** - * class that is used for communicating between Symbian and Qt code. - */ -class FileEntry { - -public: - - /** - * Constructor - */ - FileEntry(TFileEntry aFileEntry); - - /** - * Destructor - */ - ~FileEntry(); - - /* Functions that are called from UI */ -public: - QString fullName(); - QString path(); - - int attributes(); - QString attributesString(); - - int size(); - QString sizeString(); - -// QDateTime modified(); - QString modifiedString(); -// int Uid(int id); - bool isDir(); - QString name(); - - int dirEntries(); - QString dirEntriesString(); - - int iconId(); - -private: - TFileEntry mFileEntry; - }; - -#endif //FILEEENTRY_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/menuaction.h --- a/filebrowser/ui/inc/menuaction.h Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/inc/menuaction.h Fri Sep 03 17:11:21 2010 +0300 @@ -221,6 +221,9 @@ { public: ContextMenuActions() : + mOpenDirectory(0), + mSearch(0), + //File - mFileMenu(0), mFileBackMoveUp(0), mFileOpenDrive(0), @@ -246,10 +249,6 @@ mEditPaste(0), mEditCopyToFolder(0), mEditMoveToFolder(0), -// mEditSelect(0), -// mEditUnselect(0), -// mEditSelectAll(0), -// mEditUnselectAll(0), // View - // mViewMenu(0), // mViewFilterEntries(0), @@ -270,43 +269,14 @@ mDiskAdminDismountDrive(0), mDiskAdminEraseMBR(0), mDiskAdminPartitionDrive(0) - // Tools - -// mToolsMenu(0), -// mToolsAllAppsToTextFile(0), -// mToolsAllFilesToTextFile(0), -// mToolsAvkonIconCacheMenu(0), -// mToolsAvkonIconCacheEnable(0), -// mToolsAvkonIconCacheDisable(0), -// mToolsDisableExtendedErrors(0), -// mToolsDumpMsgStoreWalk(0), -// mToolsEditDataTypes(0), -// mToolsEnableExtendedErrors(0), -// mToolsErrorSimulateMenu(0), -// mToolsErrorSimulateLeave(0), -// mToolsErrorSimulatePanic(0), -// mToolsErrorSimulateException(0), -// mToolsMessageAttachmentsMenu(0), -// mToolsMessageInbox(0), -// mToolsMessageDrafts(0), -// mToolsMessageSentItems(0), -// mToolsMessageOutbox(0), -// // mLocalConnectivityMenu(0), -// // mToolsLocalConnectivityActivateInfrared(0), -// // mToolsLocalConnectivityLaunchBTUI(0), -// // mToolsLocalConnectivityLaunchUSBUI(0), -// mToolsMemoryInfo(0), -// mToolsSecureBackupMenu(0), -// mToolsSecureBackStart(0), -// mToolsSecureBackRestore(0), -// mToolsSecureBackStop(0), -// mToolsSetDebugMask(0), -// mToolsShowOpenFilesHere(0) { } ~ContextMenuActions() { } public: + HbAction *mOpenDirectory; + HbAction *mSearch; //File menu operations HbMenu *mFileMenu; HbAction *mFileBackMoveUp; @@ -334,11 +304,7 @@ HbAction *mEditPaste; HbAction *mEditCopyToFolder; HbAction *mEditMoveToFolder; -// HbAction *mEditSelect; -// HbAction *mEditUnselect; -// HbAction *mEditSelectAll; -// HbAction *mEditUnselectAll; -// + // // View - // HbMenu *mViewMenu; // HbAction *mViewFilterEntries; @@ -360,48 +326,6 @@ HbAction *mDiskAdminDismountDrive; HbAction *mDiskAdminEraseMBR; HbAction *mDiskAdminPartitionDrive; -// -// // Tools - -// HbMenu *mToolsMenu; -// HbAction *mToolsAllAppsToTextFile; -// HbAction *mToolsAllFilesToTextFile; -// -// HbMenu *mToolsAvkonIconCacheMenu; -// HbAction *mToolsAvkonIconCacheEnable; -// HbAction *mToolsAvkonIconCacheDisable; -// -// HbAction *mToolsDisableExtendedErrors; -// HbAction *mToolsDumpMsgStoreWalk; -// HbAction *mToolsEditDataTypes; -// -// HbAction *mToolsEnableExtendedErrors; -// -// HbMenu *mToolsErrorSimulateMenu; -// HbAction *mToolsErrorSimulateLeave; -// HbAction *mToolsErrorSimulatePanic; -// HbAction *mToolsErrorSimulateException; -// -// HbMenu *mToolsMessageAttachmentsMenu; -// HbAction *mToolsMessageInbox; -// HbAction *mToolsMessageDrafts; -// HbAction *mToolsMessageSentItems; -// HbAction *mToolsMessageOutbox; -// -// HbMenu *mToolsLocalConnectivityMenu; -// HbAction *mToolsLocalConnectivityActivateInfrared; -// HbAction *mToolsLocalConnectivityLaunchBTUI; -// HbAction *mToolsLocalConnectivityLaunchUSBUI; -// -// HbAction *mToolsMemoryInfo; -// -// HbMenu *mToolsSecureBackupMenu; -// HbAction *mToolsSecureBackStart; -// HbAction *mToolsSecureBackRestore; -// HbAction *mToolsSecureBackStop; -// -// HbAction *mToolsSetDebugMask; -// HbAction *mToolsShowOpenFilesHere; }; - #endif // MENUACTION_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/searchview.h --- a/filebrowser/ui/inc/searchview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* 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 SEARCHVIEW_H -#define SEARCHVIEW_H - -#include - -#include - -class QStringList; - -class EngineWrapper; -class HbDataForm; -class HbDataFormModelItem; -class HbProgressDialog; - -/** - * Settings class that is used for - */ -class SearchAttributes -{ -public: - QString mSearchDir; - QString mWildCards; - QString mTextInFile; - int mMinSize; - int mMaxSize; - QDate mMinDate; - QDate mMaxDate; - bool mRecurse; -}; - -/** - * search results class. - */ -class SearchResults -{ -public: - int mNumberOfFoundFiles; - QStringList *mFoundFilesList; -}; - -class SearchView : public HbView -{ - Q_OBJECT - -public: - explicit SearchView(EngineWrapper &engineWrapper); - ~SearchView(); - void open(const QString &path); - -signals: - void finished(bool ok); - -private slots: - void accept(); - void reject(); - -private: - void initDataForm(); - void createToolbar(); - void loadAttributes(); - void readFormItems(); - - void startFileSearch(); - void fileSearchResults(); - -private: - /* EngineWrapper */ - EngineWrapper &mEngineWrapper; - - /* Search attributes */ - SearchAttributes mAttributes; - /* Search results */ - SearchResults mResults; - - HbDataForm *mForm; - HbDataFormModelItem *mSearchFileNameItem; - HbDataFormModelItem *mWildCardItem; - HbDataFormModelItem *mHasString; - HbDataFormModelItem *mRecurse; - HbDataFormModelItem *mMinSize; - HbDataFormModelItem *mMaxSize; - HbDataFormModelItem *mMinDate; - HbDataFormModelItem *mMaxDate; - - QString mPath; - - HbProgressDialog *mProgressDialog; -}; - -#endif // SEARCHVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/inc/settingsview.h --- a/filebrowser/ui/inc/settingsview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* 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 HbDataFormModelItem; -class EngineWrapper; -class FileBrowserSettings; - -class SettingsView : public HbView -{ - Q_OBJECT - -public: - SettingsView(EngineWrapper &engineWrapper); - virtual ~SettingsView(); - - void initDataForm(); -signals: - void finished(bool ok); - -public slots: -// void displayModeChanged(); -// void fileViewChanged(); -// void subDirectoryInfoChanged(); -// void associatedIconsChanged(); -// void rememberFolderOnExitChanged(); -// void rememberLastFolderChanged(); -// void showToolbarChanged(); - -// void toggleChange(QModelIndex, QModelIndex); - void accept(); - void reject(); - -private: - void createToolbar(); - void constructMenu(); - void loadSettings(const FileBrowserSettings &settings); - void saveSettings(FileBrowserSettings &settings); - -private: - EngineWrapper &mEngineWrapper; - - HbDataForm *mForm; - HbDataFormModelItem *mDisplayModeItem; - HbDataFormModelItem *mFileViewItem; - HbDataFormModelItem *mShowDirectoryInfoItem; - HbDataFormModelItem *mShowAssociatedIconsItem; - HbDataFormModelItem *mRememberFolderOnExitItem; - HbDataFormModelItem *mRememberLastFolderItem; - HbDataFormModelItem *mShowToolbarItem; - - HbDataFormModelItem *mSupportNetDrivesItem; //"Support net drives" - HbDataFormModelItem *mBypassPlatformSecurityItem; //"Bypass plat.security" - HbDataFormModelItem *mUnlockFilesViaSBItem; //"Unlock files via SB" - HbDataFormModelItem *mIgnoreProtectionAttributesItem; //"Ign. protection atts" - HbDataFormModelItem *mNoROAttributeCopyFromZItem; //"No RO-att copy from Z:" - -}; - -#endif // SETTINGSVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/driveentry.cpp --- a/filebrowser/ui/src/driveentry.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* 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 "driveentry.h" - -// --------------------------------------------------------------------------- - -DriveEntry::DriveEntry(TDriveEntry aDriveEntry) -: mDriveEntry(aDriveEntry) -{ -} - -// --------------------------------------------------------------------------- - -DriveEntry::~DriveEntry() -{ -} - -// --------------------------------------------------------------------------- - -QChar DriveEntry::driveLetter() -{ - return QChar(TUint(mDriveEntry.iLetter)); -} - -// --------------------------------------------------------------------------- - -int DriveEntry::number() -{ - return mDriveEntry.iNumber; -} - -// --------------------------------------------------------------------------- - -QString DriveEntry::mediaTypeString() -{ - return QString::fromUtf16(mDriveEntry.iMediaTypeDesc.Ptr(), mDriveEntry.iMediaTypeDesc.Length()); -} - -// --------------------------------------------------------------------------- - -QString DriveEntry::attributesString() -{ - return QString::fromUtf16(mDriveEntry.iAttributesDesc.Ptr(), mDriveEntry.iAttributesDesc.Length()); -} - -// --------------------------------------------------------------------------- - -int DriveEntry::iconId() -{ - return mDriveEntry.iIconId; -} - -// --------------------------------------------------------------------------- - -qint64 DriveEntry::volumeInfoFree() -{ - return mDriveEntry.iVolumeInfo.iFree; -} - -// --------------------------------------------------------------------------- - -qint64 DriveEntry::volumeInfoSize() -{ - return mDriveEntry.iVolumeInfo.iSize; -} - -// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/editorview.cpp --- a/filebrowser/ui/src/editorview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* 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 -#include -#include -#include -#include - -#include "editorview.h" - -EditorView::EditorView() : - mTextEdit(0), - mFileHex(false), - mFlagReadOnly(), - mFileName(), - mFileContent(), - mToTextAction(0), - mToHexAction(0), - mExitAction(0) -{ - // Override back navigation action - HbAction *backNaviAction = new HbAction(Hb::BackNaviAction, this); - connect(backNaviAction, SIGNAL(triggered()), this, SLOT(backButtonClicked())); - setNavigationAction(backNaviAction); - - createMenu(); - - // text editor -// mTextEdit = new QTextEdit(); -// QGraphicsLinearLayout *editorLayout = new QGraphicsLinearLayout(Qt::Vertical); -// QGraphicsProxyWidget *editorWidget = new QGraphicsProxyWidget(); -// editorWidget->setWidget(mTextEdit); -// editorLayout->addItem(editorWidget); -// setLayout(editorLayout); - - mTextEdit = new HbTextEdit(); - mTextEdit->setAlignment(Qt::AlignTop); - QGraphicsLinearLayout *editorLayout = new QGraphicsLinearLayout(Qt::Vertical, this); - editorLayout->addItem(mTextEdit); - setLayout(editorLayout); -} - -EditorView::~EditorView() -{ -// delete mTextEdit; -// delete mToTextAction; -// delete mToHexAction; -// delete mExitAction; -} - -void EditorView::open(const QString& fileName, bool flagReadOnly) -{ - mFlagReadOnly = flagReadOnly; - - if (!fileName.isEmpty()) { - mTextEdit->setReadOnly(mFlagReadOnly); - loadFile(fileName); - } - else { - // not valid file name - } -} - -void EditorView::loadFile(const QString &fileName) -{ - mFileName = fileName; - QFile file(fileName); - QFileInfo baseName(fileName); - setTitle(baseName.fileName()); - - if (!file.open(QFile::ReadOnly | QFile::Text)) { - // note: cannot be opened. readonly or not text - return; - } - QTextStream in(&file); - in.setAutoDetectUnicode(false); - - mFileContent = in.readAll(); - file.close(); - displayInText(); -} - -void EditorView::displayInText() -{ - mFileHex = false; - QByteArray asciiContent = mFileContent.toAscii(); - mTextEdit->setPlainText(QString(asciiContent)); -} - -void EditorView::displayInHex() -{ - QByteArray asciiContent = mFileContent.toAscii().toHex(); - QString textInHex = QString(asciiContent); - mTextEdit->setPlainText(textInHex); - mFileHex = true; -} - -void EditorView::createMenu() -{ - mToTextAction = menu()->addAction("View as text"); - connect(mToTextAction, SIGNAL(triggered()), this, SLOT(displayInText())); - mToHexAction = menu()->addAction("View as hex"); - connect(mToHexAction, SIGNAL(triggered()), this, SLOT(displayInHex())); -// mExitAction = menu()->addAction("Exit"); -// connect(mExitAction, SIGNAL(triggered()), this, SLOT(backButtonClicked())); - - // update the menus before showing it: - connect(menu(), SIGNAL(aboutToShow()), this, SLOT(updateMenu())); -} - -void EditorView::updateMenu() -{ - mToTextAction->setVisible(mFileHex); - mToHexAction->setVisible(!mFileHex); -} - -void EditorView::backButtonClicked() -{ - emit finished(false); -} - diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/enginewrapper.cpp --- a/filebrowser/ui/src/enginewrapper.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/enginewrapper.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -20,9 +20,9 @@ #include "FBFileUtils.h" #include "notifications.h" #include "fbfileview.h" -#include "searchview.h" +#include "fbsearchview.h" #include "filebrowsersettings.h" -#include "settingsview.h" +//#include "fbsettingsview.h" #include @@ -97,6 +97,7 @@ attributes.mMinSize = tAttributes.iMinSize; attributes.mMaxSize = tAttributes.iMaxSize; attributes.mRecurse = tAttributes.iRecurse; + attributes.mDefaultWildCard = tAttributes.iDefaultWildCard; // TTime to QDate TBuf<20> timeString; @@ -130,6 +131,7 @@ tAttributes.iMinSize = attributes.mMinSize; tAttributes.iMaxSize = attributes.mMaxSize; tAttributes.iRecurse = attributes.mRecurse; + tAttributes.iDefaultWildCard = attributes.mDefaultWildCard; // QDate to TTime for both min- and max Date QString temp = attributes.mMinDate.toString("yyyy-MM-dd"); @@ -403,6 +405,18 @@ delete entryLines; } } + +// --------------------------------------------------------------------------- + +void EngineWrapper::setAttributes(quint32 &setAttributesMask, quint32 &clearAttributesMask, bool &recurse) +{ + if (mEngine->FileUtils()) { + TBool tRecurse = recurse ? ETrue : EFalse; + TRAPD(err, mEngine->FileUtils()->SetAttributesL(setAttributesMask, clearAttributesMask, tRecurse)); + Q_UNUSED(err); //TODO + } +} + // --------------------------------------------------------------------------- bool EngineWrapper::openAppArc(QString fileName) @@ -449,24 +463,24 @@ // --------------------------------------------------------------------------- -DriveEntry EngineWrapper::getDriveEntry(const QModelIndex& aIndex) const +FbDriveEntry EngineWrapper::getDriveEntry(const QModelIndex& aIndex) const { TDriveEntry driveEntry; if (mEngine->FileUtils()->DriveEntries()->Count() > aIndex.row() && aIndex.row() >= 0) { driveEntry = mEngine->FileUtils()->DriveEntries()->At(aIndex.row()); } - return DriveEntry(driveEntry); + return FbDriveEntry(driveEntry); } // --------------------------------------------------------------------------- -FileEntry EngineWrapper::getFileEntry(const QModelIndex& aIndex) const +FbFileEntry EngineWrapper::getFileEntry(const QModelIndex& aIndex) const { TFileEntry fileEntry; if (mEngine->FileUtils()->FileEntries()->Count() > aIndex.row() && aIndex.row() >= 0) { fileEntry = mEngine->FileUtils()->FileEntries()->At(aIndex.row()); } - return FileEntry(fileEntry); + return FbFileEntry(fileEntry); } // --------------------------------------------------------------------------- @@ -501,7 +515,8 @@ bool EngineWrapper::isDestinationEntriesExists(const QModelIndexList &aSelectionIndices, QString aTargetDir) { TFileName targetDir = TFileName(aTargetDir.utf16()); - setCurrentSelection(aSelectionIndices); + //setCurrentSelection(aSelectionIndices); + Q_UNUSED(aSelectionIndices); TBool someEntryExists = mEngine->FileUtils()->IsDestinationEntriesExists(targetDir); return someEntryExists; @@ -805,4 +820,9 @@ return Notifications::showConfirmationQuery(qText); } +void EngineWrapper::NotifyModelHasChanged() +{ + emit fileSystemDataChanged(); +} + // --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbattributesview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbattributesview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,210 @@ +/* +* 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 "fbattributesview.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +const QStringList AttributesChoices = QStringList() << "Skip" << "On" << "Off"; +const QStringList RecurseChoices = QStringList() << "Recursive" << "Non-recursive"; +const QString acceptActionText = "OK"; +const QString rejectActionText = "Cancel"; +const int AttributeOn = 1; +const int AttributeOff = 2; +const int AttributeEnableRecursion = 0; +const int AttributeDisableRecursion = 1; + +FbAttributesView::FbAttributesView(quint32 &aSetAttMask, quint32 &aClearAttMask, bool &aRecurse) : + mSetAttributesMask(aSetAttMask), + mClearAttributesMask(aClearAttMask), + mRecurse(aRecurse), + mForm(0), + mArchiveItem(0), + mHiddenItem(0), + mReadOnlyItem(0), + mSystemItem(0), + mRecurseItem(0) +{ + setTitle("Set attributes"); + + // Override back navigation action + HbAction *leaveViewAction = new HbAction(Hb::BackNaviAction, this); + connect(leaveViewAction, SIGNAL(triggered()), this, SLOT(reject())); + setNavigationAction(leaveViewAction); + + initDataForm(); + createToolbar(); +} + +FbAttributesView::~FbAttributesView() +{ +} + +void FbAttributesView::initDataForm() +{ + mForm = new HbDataForm(this); + HbDataFormModel *model = new HbDataFormModel(); + + // Create Group for sequential image components + //mGroupSeguantialCapture = model->appendDataFormGroup(QString("Archive"), parent); + + mArchiveItem = new HbDataFormModelItem(HbDataFormModelItem::RadioButtonListItem); + mArchiveItem->setLabel("Archive"); + mArchiveItem->setContentWidgetData(QString("items"), AttributesChoices); + mArchiveItem->setContentWidgetData(QString("displayMode"), QString("embedded")); + + mHiddenItem = new HbDataFormModelItem(HbDataFormModelItem::RadioButtonListItem); + mHiddenItem->setLabel("Hidden"); + mHiddenItem->setContentWidgetData(QString("items"), AttributesChoices); + mHiddenItem->setContentWidgetData(QString("displayMode"), QString("embedded")); + + mReadOnlyItem = new HbDataFormModelItem(HbDataFormModelItem::RadioButtonListItem); + mReadOnlyItem->setLabel("Read only"); + mReadOnlyItem->setContentWidgetData(QString("items"), AttributesChoices); + mReadOnlyItem->setContentWidgetData(QString("displayMode"), QString("embedded")); + + mSystemItem = new HbDataFormModelItem(HbDataFormModelItem::RadioButtonListItem); + mSystemItem->setLabel("System"); + mSystemItem->setContentWidgetData(QString("items"), AttributesChoices); + mSystemItem->setContentWidgetData(QString("displayMode"), QString("embedded")); + + mRecurseItem = new HbDataFormModelItem(HbDataFormModelItem::RadioButtonListItem); + mRecurseItem->setLabel("Recurse"); + mRecurseItem->setContentWidgetData(QString("items"), RecurseChoices); + mRecurseItem->setContentWidgetData(QString("displayMode"), QString("embedded")); + + // load file search attribute values from FB engine: + loadSettings(); + + model->appendDataFormItem(mArchiveItem); + model->appendDataFormItem(mHiddenItem); + model->appendDataFormItem(mReadOnlyItem); + model->appendDataFormItem(mSystemItem); + model->appendDataFormItem(mRecurseItem); + + mForm->setModel(model); + + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this); + layout->addItem(mForm); + setLayout(layout); +} + +void FbAttributesView::createToolbar() +{ + HbToolBar *toolBar = new HbToolBar(this); + HbAction *acceptAction = new HbAction(acceptActionText); + connect(acceptAction, SIGNAL(triggered()), this, SLOT(accept())); + toolBar->addAction(acceptAction); + + HbAction *rejectAction = new HbAction(rejectActionText); + connect(rejectAction, SIGNAL(triggered()), this, SLOT(reject())); + toolBar->addAction(rejectAction); + + setToolBar(toolBar); +} + +/** + Set form item values from settings \a settings. + */ +void FbAttributesView::loadSettings() +{ + if (mSetAttributesMask & KEntryAttArchive) + mArchiveItem->setContentWidgetData(QString("selected"), AttributeOn); + else if (mClearAttributesMask & KEntryAttArchive) + mArchiveItem->setContentWidgetData(QString("selected"), AttributeOff); + + if (mSetAttributesMask & KEntryAttHidden) + mHiddenItem->setContentWidgetData(QString("selected"), AttributeOn); + else if (mClearAttributesMask & KEntryAttHidden) + mHiddenItem->setContentWidgetData(QString("selected"), AttributeOff); + + if (mSetAttributesMask & KEntryAttReadOnly) + mReadOnlyItem->setContentWidgetData(QString("selected"), AttributeOn); + else if (mClearAttributesMask & KEntryAttReadOnly) + mReadOnlyItem->setContentWidgetData(QString("selected"), AttributeOff); + + if (mSetAttributesMask & KEntryAttSystem) + mSystemItem->setContentWidgetData(QString("selected"), AttributeOn); + else if (mClearAttributesMask & KEntryAttSystem) + mSystemItem->setContentWidgetData(QString("selected"), AttributeOff); + + if (mRecurse) + mRecurseItem->setContentWidgetData(QString("selected"), AttributeEnableRecursion); + else + mRecurseItem->setContentWidgetData(QString("selected"), AttributeDisableRecursion); +} + +/** + Store form item data into \a settings + */ +void FbAttributesView::saveSettings() +{ + mSetAttributesMask = 0; + mClearAttributesMask = 0; + + int archive = mArchiveItem->contentWidgetData(QString("selected")).toInt(); + if (archive == AttributeOn) + mSetAttributesMask |= KEntryAttArchive; + else if (archive == AttributeOff) + mClearAttributesMask |= KEntryAttArchive; + + int hidden = mHiddenItem->contentWidgetData(QString("selected")).toInt(); + if (hidden == AttributeOn) + mSetAttributesMask |= KEntryAttHidden; + else if (hidden == AttributeOff) + mClearAttributesMask |= KEntryAttHidden; + + int readOnly = mReadOnlyItem->contentWidgetData(QString("selected")).toInt(); + if (readOnly == AttributeOn) + mSetAttributesMask |= KEntryAttReadOnly; + else if (readOnly == AttributeOff) + mClearAttributesMask |= KEntryAttReadOnly; + + int system = mSystemItem->contentWidgetData(QString("selected")).toInt(); + if (system == AttributeOn) + mSetAttributesMask |= KEntryAttSystem; + else if (system == AttributeOff) + mClearAttributesMask |= KEntryAttSystem; + + int recurse = mRecurseItem->contentWidgetData(QString("selected")).toInt(); + if (recurse == AttributeEnableRecursion) + mRecurse = ETrue; + else if (recurse == AttributeDisableRecursion) + mRecurse = EFalse; +} + +void FbAttributesView::accept() +{ + saveSettings(); + emit finished(true); +} + +void FbAttributesView::reject() +{ + emit finished(false); +} + +// End of file diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbdriveentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbdriveentry.cpp Fri Sep 03 17:11:21 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 "fbdriveentry.h" + +// --------------------------------------------------------------------------- + +FbDriveEntry::FbDriveEntry(TDriveEntry aDriveEntry) +: mDriveEntry(aDriveEntry) +{ +} + +// --------------------------------------------------------------------------- + +FbDriveEntry::~FbDriveEntry() +{ +} + +// --------------------------------------------------------------------------- + +QChar FbDriveEntry::driveLetter() +{ + return QChar(TUint(mDriveEntry.iLetter)); +} + +// --------------------------------------------------------------------------- + +int FbDriveEntry::number() +{ + return mDriveEntry.iNumber; +} + +// --------------------------------------------------------------------------- + +QString FbDriveEntry::mediaTypeString() +{ + return QString::fromUtf16(mDriveEntry.iMediaTypeDesc.Ptr(), mDriveEntry.iMediaTypeDesc.Length()); +} + +// --------------------------------------------------------------------------- + +QString FbDriveEntry::attributesString() +{ + return QString::fromUtf16(mDriveEntry.iAttributesDesc.Ptr(), mDriveEntry.iAttributesDesc.Length()); +} + +// --------------------------------------------------------------------------- + +int FbDriveEntry::iconId() +{ + return mDriveEntry.iIconId; +} + +// --------------------------------------------------------------------------- + +qint64 FbDriveEntry::volumeInfoFree() +{ + return mDriveEntry.iVolumeInfo.iFree; +} + +// --------------------------------------------------------------------------- + +qint64 FbDriveEntry::volumeInfoSize() +{ + return mDriveEntry.iVolumeInfo.iSize; +} + +// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbdrivelistviewitem.cpp --- a/filebrowser/ui/src/fbdrivelistviewitem.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/fbdrivelistviewitem.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -16,7 +16,7 @@ */ #include "fbdrivelistviewitem.h" -#include "driveentry.h" +#include "fbdriveentry.h" #include "fbdrivemodel.h" #include @@ -88,7 +88,7 @@ // Get the Drive Entry const FbDriveModel* driveModel= qobject_cast(modelIndex().model()); - DriveEntry driveEntry = driveModel->driveEntry(modelIndex()); + FbDriveEntry driveEntry = driveModel->driveEntry(modelIndex()); const QString SimpleDriveEntry("%1: <%2>"); diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbdrivemodel.cpp --- a/filebrowser/ui/src/fbdrivemodel.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/fbdrivemodel.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -17,8 +17,7 @@ #include "fbdrivemodel.h" #include "enginewrapper.h" -#include "driveentry.h" -#include "settingsview.h" +#include "fbdriveentry.h" #include "filebrowsersettings.h" #include "FB.hrh" @@ -67,7 +66,7 @@ case Qt::EditRole: case Qt::DisplayRole: { QStringList listItem; - DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index)); + FbDriveEntry driveEntry(mEngineWrapper->getDriveEntry(index)); if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple) { const QString SimpleDriveEntry("%1: <%2>"); @@ -112,7 +111,7 @@ } -DriveEntry FbDriveModel::driveEntry(const QModelIndex &index) const +FbDriveEntry FbDriveModel::driveEntry(const QModelIndex &index) const { return mEngineWrapper->getDriveEntry(index); } @@ -121,7 +120,7 @@ { QString diskLetter; if (index.row() >= 0 && index.row() < mEngineWrapper->itemCount()) { - DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index)); + FbDriveEntry driveEntry(mEngineWrapper->getDriveEntry(index)); diskLetter = driveEntry.driveLetter(); } return diskLetter; @@ -131,7 +130,7 @@ { QString mediaTypeString; if (index.row() >= 0 && index.row() < mEngineWrapper->itemCount()) { - DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index)); + FbDriveEntry driveEntry(mEngineWrapper->getDriveEntry(index)); mediaTypeString = driveEntry.mediaTypeString(); } return mediaTypeString; diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbdriveview.cpp --- a/filebrowser/ui/src/fbdriveview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/fbdriveview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -16,9 +16,9 @@ */ #include "fbdriveview.h" -#include "settingsview.h" -#include "editorview.h" -#include "searchview.h" +#include "fbsettingsview.h" +#include "fbeditorview.h" +#include "fbsearchview.h" #include "enginewrapper.h" #include "notifications.h" @@ -160,7 +160,6 @@ { mOptionMenuActions.mFileMenu = menu()->addMenu("File"); -// mOptionMenuActions.mFileOpenDrive = mOptionMenuActions.mFileMenu->addAction("Open drive", this, SLOT(fileOpenDrive())); mOptionMenuActions.mFileSearch = mOptionMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch())); //mOptionMenuActions.mFileSearch->setVisible(false); @@ -311,7 +310,6 @@ mOptionMenuActions.mEditMenu->menuAction()->setVisible(showEditMenu); //aMenuPane->SetItemDimmed(EFileBrowserCmdFileOpen, isFileItemListEmpty || isDriveListViewActive || isCurrentItemDirectory); -// mOptionMenuActions.mFileOpenDrive->setVisible( !(isFileItemListEmpty || !isDriveListViewActive)); //aMenuPane->SetItemDimmed(EFileBrowserCmdFileView, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive); //aMenuPane->SetItemDimmed(EFileBrowserCmdFileEdit, isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory || isDriveListViewActive); @@ -575,7 +573,7 @@ if (contextrMenuAction && contextrMenuAction->text().compare(QString("Search..."), Qt::CaseInsensitive) == 0 && contextrMenuAction == mContextMenuActions.mFileSearch) { - DriveEntry driveEntry(mEngineWrapper->getDriveEntry(currentItemIndex())); + FbDriveEntry driveEntry(mEngineWrapper->getDriveEntry(currentItemIndex())); searchPath = driveEntry.driveLetter() + QString(":\\"); } else { searchPath = mEngineWrapper->currentPath(); @@ -631,10 +629,10 @@ // check if the drive has a password if (mEngineWrapper->hasDrivePassword(currentIndex)) { QString heading = QString("Existing password"); - HbInputDialog::getText(heading, this, SLOT(diskAdminSetDrivePasswordNew(HbAction*)), QString(), scene()); + HbInputDialog::queryText(heading, this, SLOT(diskAdminSetDrivePasswordNew(HbAction*)), QString(), scene()); } else { QString heading = QString("New password"); - HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene()); + HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene()); } } @@ -647,7 +645,7 @@ if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { mOldPassword = dlg->value().toString(); QString heading = QString("New password"); - HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene()); + HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDrivePassword(HbAction*)), mOldPassword, scene()); } } @@ -676,7 +674,7 @@ // check if the drive is locked if (mEngineWrapper->isDriveLocked(currentIndex)) { QString heading = QString("Existing password"); - HbInputDialog::getText(heading, this, SLOT(doDiskAdminUnlockDrive(HbAction*)), QString(), scene()); + HbInputDialog::queryText(heading, this, SLOT(doDiskAdminUnlockDrive(HbAction*)), QString(), scene()); } else { Notifications::showInformationNote(QString("This drive is not locked")); } @@ -705,7 +703,7 @@ // check if the drive has a password if (mEngineWrapper->hasDrivePassword(currentIndex)) { QString heading = QString("Existing password"); - HbInputDialog::getText(heading, this, SLOT(doDiskAdminClearDrivePassword(HbAction*)), QString(), scene()); + HbInputDialog::queryText(heading, this, SLOT(doDiskAdminClearDrivePassword(HbAction*)), QString(), scene()); } else { Notifications::showInformationNote(QString("This drive has no password")); } @@ -734,7 +732,10 @@ // check if the drive has a password QModelIndex currentIndex = currentItemIndex(); if (mEngineWrapper->hasDrivePassword(currentIndex)) { - HbMessageBox::question(QString("Are you sure? All data can be lost!"), this, SLOT(doDiskAdminEraseDrivePassword(HbAction*))); + HbMessageBox::question(QString("Are you sure? All data can be lost!"), + this, + SLOT(doDiskAdminEraseDrivePassword(int)), + HbMessageBox::Yes | HbMessageBox::No); } else { Notifications::showInformationNote(QString("This drive has no password")); } @@ -743,9 +744,9 @@ /** Erase password of the selected drive */ -void FbDriveView::doDiskAdminEraseDrivePassword(HbAction* action) +void FbDriveView::doDiskAdminEraseDrivePassword(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminEraseDrivePassword(currentIndex); refreshList(); @@ -757,15 +758,18 @@ */ void FbDriveView::diskAdminFormatDrive() { - HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminFormatDrive(HbAction*))); + HbMessageBox::question(QString("Are you sure? All data will be lost!"), + this, + SLOT(doDiskAdminFormatDrive(int)), + HbMessageBox::Yes | HbMessageBox::No); } /** Performs format on the selected drive */ -void FbDriveView::doDiskAdminFormatDrive(HbAction* action) +void FbDriveView::doDiskAdminFormatDrive(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminFormatDrive(currentIndex, false); } @@ -776,15 +780,18 @@ */ void FbDriveView::diskAdminQuickFormatDrive() { - HbMessageBox::question(QString("Are you sure? All data will be lost!"), this, SLOT(doDiskAdminQuickFormatDrive(HbAction*))); + HbMessageBox::question(QString("Are you sure? All data will be lost!"), + this, + SLOT(doDiskAdminQuickFormatDrive(int)), + HbMessageBox::Yes | HbMessageBox::No); } /** Performs quick format on the selected drive */ -void FbDriveView::doDiskAdminQuickFormatDrive(HbAction* action) +void FbDriveView::doDiskAdminQuickFormatDrive(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminFormatDrive(currentIndex, true); } @@ -804,15 +811,18 @@ */ void FbDriveView::diskAdminScanDrive() { - HbMessageBox::question(QString("This finds errors on disk and corrects them. Proceed?"), this, SLOT(doDiskAdminScanDrive(HbAction*))); + HbMessageBox::question(QString("This finds errors on disk and corrects them. Proceed?"), + this, + SLOT(doDiskAdminScanDrive(int)), + HbMessageBox::Yes | HbMessageBox::No); } /** Checks the selected drive for errors and corrects them */ -void FbDriveView::doDiskAdminScanDrive(HbAction* action) +void FbDriveView::doDiskAdminScanDrive(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminScanDrive(currentIndex); refreshList(); @@ -831,7 +841,7 @@ mEngineWrapper->GetDriveName(currentIndex, driveName); QString heading = QString("New name"); - HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveName(HbAction*)), driveName, scene()); + HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDriveName(HbAction*)), driveName, scene()); } /** @@ -862,7 +872,7 @@ mEngineWrapper->GetDriveVolumeLabel(currentIndex, volumeLabel); QString heading = QString("New volume label"); - HbInputDialog::getText(heading, this, SLOT(doDiskAdminSetDriveVolumeLabel(HbAction*)), volumeLabel, scene()); + HbInputDialog::queryText(heading, this, SLOT(doDiskAdminSetDriveVolumeLabel(HbAction*)), volumeLabel, scene()); } /** @@ -896,12 +906,15 @@ */ void FbDriveView::diskAdminDismountDrive() { - HbMessageBox::question(QString("Are you sure you know what are you doing?"), this, SLOT(doDiskAdminDismountDrive(HbAction*))); + HbMessageBox::question(QString("Are you sure you know what are you doing?"), + this, + SLOT(doDiskAdminDismountDrive(int)), + HbMessageBox::Yes | HbMessageBox::No); } -void FbDriveView::doDiskAdminDismountDrive(HbAction* action) +void FbDriveView::doDiskAdminDismountDrive(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminDismountDrive(currentIndex); refreshList(); @@ -914,34 +927,43 @@ void FbDriveView::diskAdminEraseMBR() { // TODO What to do with FB LITE macros? - HbMessageBox::question(QString("Are you sure? Your media driver must support this!"), this, SLOT(doDiskAdminEraseMBR(HbAction*))); + HbMessageBox::question(QString("Are you sure? Your media driver must support this!"), + this, + SLOT(doDiskAdminEraseMBR(int)), + HbMessageBox::Yes | HbMessageBox::No); } -void FbDriveView::doDiskAdminEraseMBR(HbAction* action) +void FbDriveView::doDiskAdminEraseMBR(int action) { // TODO What to do with FB LITE macros? - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { - HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"), this, SLOT(doDiskAdminReallyEraseMBR(HbAction*))); + if (action == HbMessageBox::Yes) { + HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"), + this, + SLOT(doDiskAdminReallyEraseMBR(int)), + HbMessageBox::Yes | HbMessageBox::No); } } -void FbDriveView::doDiskAdminReallyEraseMBR(HbAction* action) +void FbDriveView::doDiskAdminReallyEraseMBR(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); // warn if the selected drive is not detected as removable if (mEngineWrapper->isDriveRemovable(currentIndex)) { mEngineWrapper->DiskAdminEraseMBR(currentIndex); refreshList(); } else { - HbMessageBox::question(QString("Selected drive is not removable, really continue?"), this, SLOT(doDiskAdminNotRemovableReallyEraseMBR(HbAction*))); + HbMessageBox::question(QString("Selected drive is not removable, really continue?"), + this, + SLOT(doDiskAdminNotRemovableReallyEraseMBR(int)), + HbMessageBox::Yes | HbMessageBox::No); } } } -void FbDriveView::doDiskAdminNotRemovableReallyEraseMBR(HbAction* action) +void FbDriveView::doDiskAdminNotRemovableReallyEraseMBR(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); mEngineWrapper->DiskAdminEraseMBR(currentIndex); refreshList(); @@ -954,27 +976,31 @@ */ void FbDriveView::diskAdminPartitionDrive() { - const QString message("Are you sure? Your media driver must support this!"); - HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveProceed(HbAction *))); + HbMessageBox::question(QString("Are you sure? Your media driver must support this!"), + this, + SLOT(diskAdminPartitionDriveProceed(int)), + HbMessageBox::Yes | HbMessageBox::No); } /** Partition the selected drive if user is sure */ -void FbDriveView::diskAdminPartitionDriveProceed(HbAction *action) +void FbDriveView::diskAdminPartitionDriveProceed(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { - const QString message("Are you really sure you know what are you doing ?!?"); - HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveReallyProceed(HbAction *))); + if (action == HbMessageBox::Yes) { + HbMessageBox::question(QString("Are you really sure you know what are you doing ?!?"), + this, + SLOT(diskAdminPartitionDriveReallyProceed(int)), + HbMessageBox::Yes | HbMessageBox::No); } } /** Partition the selected drive if user is really sure */ -void FbDriveView::diskAdminPartitionDriveReallyProceed(HbAction *action) +void FbDriveView::diskAdminPartitionDriveReallyProceed(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { QModelIndex currentIndex = currentItemIndex(); mEraseMBR = false; // warn if the selected drive is not detected as removable @@ -982,16 +1008,20 @@ if (mEngineWrapper->isDriveRemovable(currentIndex)) { mProceed = true; } else { - const QString message("Selected drive is not removable, really continue?"); - HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveIsNotRemovable(HbAction *))); + HbMessageBox::question(QString("Selected drive is not removable, really continue?"), + this, + SLOT(diskAdminPartitionDriveIsNotRemovable(int)), + HbMessageBox::Yes | HbMessageBox::No); } if (mProceed) { // query if erase mbr mEraseMBR = false; - QString message("Erase MBR first (normally needed)?"); - HbMessageBox::question(message, this, SLOT(diskAdminPartitionDriveEraseMbr(HbAction *))); + HbMessageBox::question(QString("Erase MBR first (normally needed)?"), + this, + SLOT(diskAdminPartitionDriveEraseMbr(int)), + HbMessageBox::Yes | HbMessageBox::No); // TODO use HbListDialog QStringList list; @@ -1004,9 +1034,9 @@ /** Store result of user query about proceeding when drive is not removable. */ -void FbDriveView::diskAdminPartitionDriveIsNotRemovable(HbAction *action) +void FbDriveView::diskAdminPartitionDriveIsNotRemovable(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { mProceed = true; } else { mProceed = false; @@ -1016,9 +1046,9 @@ /** Store result of user query about erase MBR */ -void FbDriveView::diskAdminPartitionDriveEraseMbr(HbAction *action) +void FbDriveView::diskAdminPartitionDriveEraseMbr(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { mEraseMBR = true; } } @@ -1095,8 +1125,7 @@ { int leaveCode = -6; QString heading = QString("Leave code"); - //HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), leaveCode, scene()); - HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene()); + HbInputDialog::queryText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene()); } @@ -1122,7 +1151,7 @@ { mPanicCategory = QString ("Test Category"); QString heading = QString("Panic category"); - HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene()); + HbInputDialog::queryText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene()); } /** @@ -1135,7 +1164,7 @@ mPanicCategory = dlg->value().toString(); int panicCode(555); QString heading = QString("Panic code"); - HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene()); + HbInputDialog::queryInt(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene()); } } @@ -1161,7 +1190,7 @@ { int exceptionCode = 0; QString heading = QString("Exception code"); - HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene()); + HbInputDialog::queryInt(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene()); } /** @@ -1232,7 +1261,7 @@ quint32 dbgMask = mEngineWrapper->getDebugMask(); QString dbgMaskText = QString("0x").append(QString::number(dbgMask, 16)); QString heading = QString("Kernel debug mask in hex format"); - HbInputDialog::getText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene()); + HbInputDialog::queryText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene()); } /** diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbeditorview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbeditorview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,144 @@ +/* +* 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 "fbeditorview.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +FbEditorView::FbEditorView() : + mTextEdit(0), + mFileHex(false), + mFlagReadOnly(), + mFileName(), + mFileContent(), + mToTextAction(0), + mToHexAction(0), + mExitAction(0) +{ + // Override back navigation action + HbAction *backNaviAction = new HbAction(Hb::BackNaviAction, this); + connect(backNaviAction, SIGNAL(triggered()), this, SLOT(backButtonClicked())); + setNavigationAction(backNaviAction); + + createMenu(); + + // text editor +// mTextEdit = new QTextEdit(); +// QGraphicsLinearLayout *editorLayout = new QGraphicsLinearLayout(Qt::Vertical); +// QGraphicsProxyWidget *editorWidget = new QGraphicsProxyWidget(); +// editorWidget->setWidget(mTextEdit); +// editorLayout->addItem(editorWidget); +// setLayout(editorLayout); + + mTextEdit = new HbTextEdit(); + mTextEdit->setAlignment(Qt::AlignTop); + QGraphicsLinearLayout *editorLayout = new QGraphicsLinearLayout(Qt::Vertical, this); + editorLayout->addItem(mTextEdit); + setLayout(editorLayout); +} + +FbEditorView::~FbEditorView() +{ +// delete mTextEdit; +// delete mToTextAction; +// delete mToHexAction; +// delete mExitAction; +} + +void FbEditorView::open(const QString& fileName, bool flagReadOnly) +{ + mFlagReadOnly = flagReadOnly; + + if (!fileName.isEmpty()) { + mTextEdit->setReadOnly(mFlagReadOnly); + loadFile(fileName); + } + else { + // not valid file name + } +} + +void FbEditorView::loadFile(const QString &fileName) +{ + mFileName = fileName; + QFile file(fileName); + QFileInfo baseName(fileName); + setTitle(baseName.fileName()); + + if (!file.open(QFile::ReadOnly | QFile::Text)) { + // note: cannot be opened. readonly or not text + return; + } + QTextStream in(&file); + in.setAutoDetectUnicode(false); + + mFileContent = in.readAll(); + file.close(); + displayInText(); +} + +void FbEditorView::displayInText() +{ + mFileHex = false; + QByteArray asciiContent = mFileContent.toAscii(); + mTextEdit->setPlainText(QString(asciiContent)); +} + +void FbEditorView::displayInHex() +{ + QByteArray asciiContent = mFileContent.toAscii().toHex(); + QString textInHex = QString(asciiContent); + mTextEdit->setPlainText(textInHex); + mFileHex = true; +} + +void FbEditorView::createMenu() +{ + mToTextAction = menu()->addAction("View as text"); + connect(mToTextAction, SIGNAL(triggered()), this, SLOT(displayInText())); + mToHexAction = menu()->addAction("View as hex"); + connect(mToHexAction, SIGNAL(triggered()), this, SLOT(displayInHex())); +// mExitAction = menu()->addAction("Exit"); +// connect(mExitAction, SIGNAL(triggered()), this, SLOT(backButtonClicked())); + + // update the menus before showing it: + connect(menu(), SIGNAL(aboutToShow()), this, SLOT(updateMenu())); +} + +void FbEditorView::updateMenu() +{ + mToTextAction->setVisible(mFileHex); + mToHexAction->setVisible(!mFileHex); +} + +void FbEditorView::backButtonClicked() +{ + emit finished(false); +} + diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbfileentry.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbfileentry.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,209 @@ +/* +* 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 "fbfileentry.h" + +#include + +// --------------------------------------------------------------------------- + +FbFileEntry::FbFileEntry(TFileEntry aFileEntry) +: mFileEntry(aFileEntry) +{ +} + +// --------------------------------------------------------------------------- + +FbFileEntry::~FbFileEntry() +{ +} + +// --------------------------------------------------------------------------- + +QString FbFileEntry::fullName() +{ + return QString::fromUtf16(mFileEntry.iFullName.Ptr(), mFileEntry.iFullName.Length()); +} + +// --------------------------------------------------------------------------- + +QString FbFileEntry::path() +{ + return QString::fromUtf16(mFileEntry.iPath.Ptr(), mFileEntry.iPath.Length()); +} + +// --------------------------------------------------------------------------- + +int FbFileEntry::attributes() +{ + return mFileEntry.iEntry.iAtt; +} + +QString FbFileEntry::attributesString() +{ + QString attributesString; + if (mFileEntry.iEntry.IsArchive()) { + attributesString.append("A"); + } else { + attributesString.append("-"); + } + if (mFileEntry.iEntry.IsHidden()) { + attributesString.append("H"); + } else { + attributesString.append("-"); + } + if (mFileEntry.iEntry.IsReadOnly()) { + attributesString.append("R"); + } else { + attributesString.append("-"); + } + if (mFileEntry.iEntry.IsSystem()) { + attributesString.append("S"); + } else { + attributesString.append("-"); + } + + return attributesString; +} + +// --------------------------------------------------------------------------- + +int FbFileEntry::size() +{ + return mFileEntry.iEntry.iSize; +} + +// --------------------------------------------------------------------------- + +QString FbFileEntry::sizeString() +{ + QString sizeString; + if (size() < 1024) { + sizeString.append(QString::number(size())); + sizeString.append(" B"); + } else if (size() < 1024*1024) { + qreal sizeKB = static_cast(size() / 1024); + sizeString.append( QString::number(sizeKB, 'f',1)); + sizeString.append(" kB"); + } else { + qreal sizeMB = static_cast(size() / (1024*1024)); + sizeString.append( QString::number(sizeMB, 'f',1)); + sizeString.append(" MB"); + } + return sizeString; +} + +// --------------------------------------------------------------------------- + +//QDateTime FbFileEntry::modified() +//{ +// QDateTime modified; +// TTime time1Jan1970UTC = TTime(_L("19700101:000000.000000")); +// TTimeIntervalSeconds intervalSeconds; +// +// TTime entryModified = mFileEntry.iEntry.iModified; +// +// TInt err = /*mFileEntry.iEntry.iModified*/ entryModified.SecondsFrom(time1Jan1970UTC, intervalSeconds); +// if (err == KErrNone) { +// quint32 secsSince1Jan1970UTC = intervalSeconds.Int(); +// modified = QDateTime::fromTime_t(secsSince1Jan1970UTC); +// qDebug() << "QDateTime:: " << modified.toString(); +// modified.setTimeSpec(Qt::LocalTime); +// qDebug() << "QDateTime:: " << modified.toString() << modified.toLocalTime().toString(); +// } +// return modified; +//} + +// --------------------------------------------------------------------------- + +QString FbFileEntry::modifiedString() +{ + // TODO use HbExtendedLocale to convert date and time +// QDateTime modifiedInLocalTime = modified();//.toLocalTime(); +// HbExtendedLocale locale = HbExtendedLocale::system(); +// QString date = locale.format(modifiedInLocalTime.date(), r_qtn_date_usual); +// QString time = locale.format(modifiedInLocalTime.time(), r_qtn_time_usual); +// +// return date + " " + time; + QString modifiedString; + TTime entryModified = mFileEntry.iEntry.iModified; + RTz Tz; + TInt err = Tz.Connect(); + if ( err == KErrNone && Tz.ConvertToLocalTime( entryModified ) == KErrNone ) + { + entryModified = mFileEntry.iEntry.iModified; + TBuf<128> extraData; + _LIT(KCurrentDate,"%D%M%*Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); + entryModified.FormatL(extraData, KCurrentDate); + modifiedString = QString::fromUtf16(extraData.Ptr(), extraData.Length()); + } + Tz.Close(); + + return modifiedString; +} + +// --------------------------------------------------------------------------- + +//int FbFileEntry::Uid(int id) +//{ +// return id;//mFileEntry.iEntry.iType[id]; +//} + +// --------------------------------------------------------------------------- + +bool FbFileEntry::isDir() +{ + return mFileEntry.iEntry.IsDir(); +} + +// --------------------------------------------------------------------------- + + +QString FbFileEntry::name() +{ + return QString::fromUtf16(mFileEntry.iEntry.iName.Ptr(), mFileEntry.iEntry.iName.Length()); +} + +// --------------------------------------------------------------------------- + +int FbFileEntry::dirEntries() +{ + return mFileEntry.iDirEntries; +} + +// --------------------------------------------------------------------------- + +QString FbFileEntry::dirEntriesString() +{ + QString dirEntriesString; + dirEntriesString.append(QString::number(dirEntries())); + if (dirEntries() == 1) { + dirEntriesString.append(" entry"); + } else { + dirEntriesString.append(" entries"); + } + return dirEntriesString; +} + +// --------------------------------------------------------------------------- + +int FbFileEntry::iconId() +{ + return mFileEntry.iIconId; +} + +// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbfilemodel.cpp --- a/filebrowser/ui/src/fbfilemodel.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/fbfilemodel.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -17,9 +17,7 @@ #include "fbfilemodel.h" #include "enginewrapper.h" -#include "fileentry.h" -#include "driveentry.h" -#include "settingsview.h" +#include "fbfileentry.h" #include "filebrowsersettings.h" #include "FB.hrh" @@ -68,53 +66,30 @@ case Qt::EditRole: case Qt::DisplayRole: { QStringList listItem; -// if (mEngineWrapper->isDriveListViewActive()) { -// DriveEntry driveEntry(mEngineWrapper->getDriveEntry(index)); -// if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple) -// { -// const QString SimpleDriveEntry("%1: <%2>"); -// listItem /*<< driveEntry.IconId() */ -// << SimpleDriveEntry.arg(driveEntry.driveLetter()) -// .arg(driveEntry.mediaTypeString()); -// } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) { -// const QString SimpleDriveEntry("%1: <%2>"); -// const QString ExtendedDriveEntry("%1/%2 kB"); -// listItem /*<< driveEntry.IconId()*/ -// << SimpleDriveEntry.arg(driveEntry.driveLetter()) -// .arg(driveEntry.mediaTypeString()) -// << ExtendedDriveEntry.arg(QString::number(driveEntry.volumeInfoFree()/1024)) -// .arg(QString::number(driveEntry.volumeInfoSize()/1024)); -// -// } -// } else { - FileEntry fileEntry(mEngineWrapper->getFileEntry(index)); - if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple) - { - listItem /*<< fileEntry.IconId()*/ - << fileEntry.name(); - } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) { - QString extraData; - extraData.append(fileEntry.modifiedString()); - if (fileEntry.isDir() && fileEntry.dirEntries() >= 0) { - extraData.append(" - "); - extraData.append(fileEntry.dirEntriesString()); - } else if (!fileEntry.isDir()) { - extraData.append(" - "); - extraData.append(fileEntry.sizeString()); - } - listItem /*<< fileEntry.IconId()*/ - << fileEntry.name() << extraData << fileEntry.attributesString(); + FbFileEntry fileEntry(mEngineWrapper->getFileEntry(index)); + if (mEngineWrapper->settings().fileViewMode() == EFileViewModeSimple) + { + listItem /*<< fileEntry.IconId()*/ + << fileEntry.name(); + } else if (mEngineWrapper->settings().fileViewMode() == EFileViewModeExtended) { + QString extraData; + extraData.append(fileEntry.modifiedString()); + if (fileEntry.isDir() && fileEntry.dirEntries() >= 0) { + extraData.append(" - "); + extraData.append(fileEntry.dirEntriesString()); + } else if (!fileEntry.isDir()) { + extraData.append(" - "); + extraData.append(fileEntry.sizeString()); } -// } + listItem /*<< fileEntry.IconId()*/ + << fileEntry.name() << extraData << fileEntry.attributesString(); + } return listItem; } case Qt::DecorationRole: { if (mEngineWrapper) { QIcon icon; -// if (mEngineWrapper->isDriveListViewActive()) { -// icon = mFileIconProvider->icon(QFileIconProvider::Drive); -// } else { - FileEntry fileEntry(mEngineWrapper->getFileEntry(index)); + FbFileEntry fileEntry(mEngineWrapper->getFileEntry(index)); if (fileEntry.isDir()) { icon = mFileIconProvider->icon(QFileIconProvider::Folder); } else { diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbfileview.cpp --- a/filebrowser/ui/src/fbfileview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/fbfileview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -16,12 +16,12 @@ */ #include "fbfileview.h" -#include "settingsview.h" -#include "editorview.h" -#include "searchview.h" +#include "fbsettingsview.h" +#include "fbeditorview.h" +#include "fbsearchview.h" #include "enginewrapper.h" #include "notifications.h" - +#include "fbfolderselectiondialog.h" #include "fbfilemodel.h" #include "filebrowsersortfilterproxymodel.h" //#include "fbfilelistviewitem.h" @@ -66,6 +66,8 @@ mContextMenuActions(), mContextMenu(0), mToolbarBackAction(0), + mToolbarFilterAction(0), + mToolbarPasteAction(0), mItemHighlighted(false), mLocationChanged(false), mRemoveFileAfterCopied(false), @@ -121,6 +123,7 @@ connect(mListView, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex))); connect(mListView, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)), this, SLOT(onLongPressed(HbAbstractViewItem*, QPointF))); + connect(mEngineWrapper, SIGNAL(fileSystemDataChanged()), this, SLOT(refreshList())); mNaviPane = new HbLabel(this); mNaviPane->setPlainText(QString(" ")); // TODO get from settings or default @@ -182,7 +185,6 @@ mOptionMenuActions.mFileBackMoveUp = mOptionMenuActions.mFileMenu->addAction("Back/Move up", this, SLOT(fileBackMoveUp())); mOptionMenuActions.mFileSearch = mOptionMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch())); - //mOptionMenuActions.mFileSearch->setVisible(false); mOptionMenuActions.mFileNewMenu = mOptionMenuActions.mFileMenu->addMenu("New"); mOptionMenuActions.mFileNewFile = mOptionMenuActions.mFileNewMenu->addAction("File", this, SLOT(fileNewFile())); @@ -192,13 +194,7 @@ mOptionMenuActions.mFileRename = mOptionMenuActions.mFileMenu->addAction("Rename", this, SLOT(fileRename())); mOptionMenuActions.mFileTouch = mOptionMenuActions.mFileMenu->addAction("Touch", this, SLOT(fileTouch())); -// mOptionMenuActions.mFileChecksumsMenu = mOptionMenuActions.mFileMenu->addMenu("Checksums"); -// mOptionMenuActions.mFileChecksumsMD5 = mOptionMenuActions.mFileChecksumsMenu->addAction("MD5", this, SLOT(fileChecksumsMD5())); -// mOptionMenuActions.mFileChecksumsMD2 = mOptionMenuActions.mFileChecksumsMenu->addAction("MD2", this, SLOT(fileChecksumsMD2())); -// mOptionMenuActions.mFileChecksumsSHA1 = mOptionMenuActions.mFileChecksumsMenu->addAction("SHA-1", this, SLOT(fileChecksumsSHA1())); - mOptionMenuActions.mFileSetAttributes = mOptionMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes())); - mOptionMenuActions.mFileSetAttributes->setVisible(false); } /** @@ -347,7 +343,7 @@ bool isFileItemListEmpty = mFbFileModel->rowCount() == 0; bool isNormalModeActive = true; //iModel->FileUtils()->IsNormalModeActive(); bool isCurrentDriveReadOnly = mEngineWrapper->isCurrentDriveReadOnly(); //iModel->FileUtils()->IsCurrentDriveReadOnly(); - bool isCurrentItemDirectory = mEngineWrapper->getFileEntry(currentItemIndex()).isDir(); + // bool isCurrentItemDirectory = mEngineWrapper->getFileEntry(currentItemIndex()).isDir(); // bool currentSelected = true; //iContainer->ListBox()->View()->ItemIsSelected(iContainer->ListBox()->View()->CurrentItemIndex()); bool isAllSelected = mListView->selectionModel()->selection().count() == mFbFileModel->rowCount(); //bool isNoneSelected = mListView->selectionModel()->selection().count() != 0; @@ -372,24 +368,25 @@ mOptionMenuActions.mFileNewMenu->menuAction()->setVisible(!isCurrentDriveReadOnly); mOptionMenuActions.mFileDelete->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems/*isSelectionMode*/); - mOptionMenuActions.mFileRename->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems/*&& isSelectionMode*/); + mOptionMenuActions.mFileRename->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems /*&& !isSelectionMode*/); mOptionMenuActions.mFileTouch->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems); - // TODO mOptionMenuActions.mFileChecksumsMenu->setVisible(!(isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory)); - // TODO mOptionMenuActions.mFileSetAttributes->setVisible(!(isFileItemListEmpty || isCurrentDriveReadOnly)); + mOptionMenuActions.mFileSetAttributes->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && hasSelectedItems); // TODO mOptionMenuActions.mFileCompress->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory)); // TODO mOptionMenuActions.mFileDecompress->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty || !hasSelectedItems || isCurrentItemDirectory)); - mOptionMenuActions.mEditCut->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && isSelectionMode); - mOptionMenuActions.mEditCopy->setVisible(!isFileItemListEmpty && isSelectionMode); - mOptionMenuActions.mEditPaste->setVisible(!(isClipBoardEmpty || isCurrentDriveReadOnly)); - mOptionMenuActions.mEditCopyToFolder->setVisible(!isFileItemListEmpty); - mOptionMenuActions.mEditMoveToFolder->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty)); + mOptionMenuActions.mEditMenu->menuAction()->setVisible( (!isSelectionMode && !isClipBoardEmpty && !isCurrentDriveReadOnly) + || (isSelectionMode)); + mOptionMenuActions.mEditCut->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && isSelectionMode && hasSelectedItems); + mOptionMenuActions.mEditCopy->setVisible(!isFileItemListEmpty && isSelectionMode && hasSelectedItems); + mOptionMenuActions.mEditPaste->setVisible(!isClipBoardEmpty && !isCurrentDriveReadOnly); + mOptionMenuActions.mEditCopyToFolder->setVisible(!isFileItemListEmpty && isSelectionMode && hasSelectedItems); + mOptionMenuActions.mEditMoveToFolder->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && isSelectionMode && hasSelectedItems); mOptionMenuActions.mEditSelect->setVisible(false/*!currentSelected && !isFileItemListEmpty*/); mOptionMenuActions.mEditUnselect->setVisible(false/*currentSelected && !isFileItemListEmpty*/); - mOptionMenuActions.mEditSelectAll->setVisible(isSelectionMode && !isAllSelected && !isFileItemListEmpty); - mOptionMenuActions.mEditUnselectAll->setVisible(hasSelectedItems && !isFileItemListEmpty); + mOptionMenuActions.mEditSelectAll->setVisible(!isFileItemListEmpty && isSelectionMode && !isAllSelected); + mOptionMenuActions.mEditUnselectAll->setVisible(!isFileItemListEmpty && hasSelectedItems); // TODO mOptionMenuActions.mViewSort->setVisible(!(!isNormalModeActive || isFileItemListEmpty)); // TODO mOptionMenuActions.mViewOrder->setVisible(!(!isNormalModeActive || isFileItemListEmpty)); @@ -435,9 +432,10 @@ mContextMenuActions.mFileMenu = mContextMenu->addMenu("File"); //mContextMenuActions.mFileBackMoveUp = mContextMenuActions.mFileMenu->addAction("Back/Move up (<-)", this, SLOT(fileBackMoveUp())); - mContextMenuActions.mFileOpenDirectory = mContextMenuActions.mFileMenu->addAction("Open directory (->)", this, SLOT(fileOpenDirectory())); -// mContextMenuActions.mFileSearch = mContextMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch())); - //mContextMenuActions.mFileSearch->setVisible(false); +// mContextMenuActions.mFileOpenDirectory = mContextMenuActions.mFileMenu->addAction("Open directory (->)", this, SLOT(fileOpenDirectory())); + mContextMenuActions.mFileOpenDirectory = mContextMenu->addAction("Open directory (->)", this, SLOT(fileOpenDirectory())); + mContextMenuActions.mSearch = mContextMenu->addAction("Search...", this, SLOT(fileSearch())); + mContextMenuActions.mFileSearch = mContextMenuActions.mFileMenu->addAction("Search...", this, SLOT(fileSearch())); mContextMenuActions.mFileDelete = mContextMenuActions.mFileMenu->addAction("Delete", this, SLOT(fileDelete())); mContextMenuActions.mFileRename = mContextMenuActions.mFileMenu->addAction("Rename", this, SLOT(fileRename())); @@ -449,8 +447,7 @@ mContextMenuActions.mFileChecksumsMD2 = mContextMenuActions.mFileChecksumsMenu->addAction("MD2", this, SLOT(fileChecksumsMD2())); mContextMenuActions.mFileChecksumsSHA1 = mContextMenuActions.mFileChecksumsMenu->addAction("SHA-1", this, SLOT(fileChecksumsSHA1())); -// mContextMenuActions.mFileSetAttributes = mContextMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes())); -// mContextMenuActions.mFileSetAttributes->setVisible(false); + mContextMenuActions.mFileSetAttributes = mContextMenuActions.mFileMenu->addAction("Set attributes...", this, SLOT(fileSetAttributes())); } void FbFileView::createEditContextMenu() @@ -475,7 +472,6 @@ void FbFileView::updateContextMenu() { bool isFileItemListEmpty = mFbFileModel->rowCount() == 0; - bool isDriveListViewActive = mEngineWrapper->isDriveListViewActive(); // bool isNormalModeActive = true; //iModel->FileUtils()->IsNormalModeActive(); bool isCurrentDriveReadOnly = mEngineWrapper->isCurrentDriveReadOnly(); bool isCurrentItemDirectory = mEngineWrapper->getFileEntry(currentItemIndex()).isDir(); @@ -483,23 +479,27 @@ bool isSelectionMode = mOptionMenuActions.mSelection && mOptionMenuActions.mSelection->isChecked(); bool isClipBoardEmpty = !mEngineWrapper->isClipBoardListInUse(); + mContextMenuActions.mFileOpenDirectory->setVisible(!isFileItemListEmpty && isCurrentItemDirectory && isSelectionMode); + mContextMenuActions.mSearch->setVisible(!isFileItemListEmpty && isSelectionMode && isCurrentItemDirectory); + mContextMenuActions.mFileSearch->setVisible(!isFileItemListEmpty && !isSelectionMode && isCurrentItemDirectory); // File submenu - //mContextMenuActions.mFileBackMoveUp->setVisible( !isDriveListViewActive); - mContextMenuActions.mFileOpenDirectory->setVisible( !isFileItemListEmpty && !isDriveListViewActive && isCurrentItemDirectory); + //mContextMenuActions.mFileBackMoveUp->setVisible(); + mContextMenuActions.mFileMenu->menuAction()->setVisible(!isSelectionMode); - mContextMenuActions.mFileDelete->setVisible(!isFileItemListEmpty && !isDriveListViewActive && !isCurrentDriveReadOnly); - mContextMenuActions.mFileRename->setVisible(!isFileItemListEmpty && !isDriveListViewActive && !isCurrentDriveReadOnly); - mContextMenuActions.mFileTouch->setVisible(!isFileItemListEmpty && !isDriveListViewActive && !isCurrentDriveReadOnly); + mContextMenuActions.mFileDelete->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly); + mContextMenuActions.mFileRename->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly && !isSelectionMode); + mContextMenuActions.mFileTouch->setVisible(!isFileItemListEmpty && !isCurrentDriveReadOnly); mContextMenuActions.mFileProperties->setVisible(!isFileItemListEmpty && !isSelectionMode); - mContextMenuActions.mFileChecksumsMenu->menuAction()->setVisible(!(isFileItemListEmpty || isSelectionMode /*|| !hasSelectedItems*/ || isCurrentItemDirectory || isDriveListViewActive)); + mContextMenuActions.mFileChecksumsMenu->menuAction()->setVisible(!isFileItemListEmpty && !isSelectionMode && !isCurrentItemDirectory); + // Edit submenu - mContextMenuActions.mEditMenu->menuAction()->setVisible(!isDriveListViewActive); - mContextMenuActions.mEditCut->setVisible(!(isDriveListViewActive || isCurrentDriveReadOnly || isFileItemListEmpty)); - mContextMenuActions.mEditCopy->setVisible(!(isDriveListViewActive || isFileItemListEmpty)); - mContextMenuActions.mEditPaste->setVisible(!isDriveListViewActive && !isClipBoardEmpty && !isCurrentDriveReadOnly); - mContextMenuActions.mEditCopyToFolder->setVisible(!(isDriveListViewActive || isFileItemListEmpty)); - mContextMenuActions.mEditMoveToFolder->setVisible(!(isDriveListViewActive || isCurrentDriveReadOnly || isFileItemListEmpty)); + mContextMenuActions.mEditMenu->menuAction()->setVisible(!isSelectionMode); + mContextMenuActions.mEditCut->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty)); + mContextMenuActions.mEditCopy->setVisible(!(isFileItemListEmpty)); + mContextMenuActions.mEditPaste->setVisible(!isClipBoardEmpty && !isCurrentDriveReadOnly); + mContextMenuActions.mEditCopyToFolder->setVisible(!isFileItemListEmpty); + mContextMenuActions.mEditMoveToFolder->setVisible(!(isCurrentDriveReadOnly || isFileItemListEmpty)); } // --------------------------------------------------------------------------- @@ -537,22 +537,25 @@ connect(mSearchPanel, SIGNAL(exitClicked()), this, SLOT(clearFilterCriteria())); filterExtension->setContentWidget(mSearchPanel); - HbAction* mToolbarFilterAction = mToolBar->addExtension(filterExtension); -// mToolbarFilterAction->setText("Filter"); + mToolbarFilterAction = mToolBar->addExtension(filterExtension); mToolbarFilterAction->setToolTip("Filter"); mToolbarFilterAction->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_find.svg"))); //connect(mToolbarFilterAction, SIGNAL(triggered()), this, SLOT(viewFilterEntries())); if (mOptionMenuActions.mSelection) { + // TODO Selection mode icon to be added //mOptionMenuActions.mSelection->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_selection_active.svg"))); mToolBar->addAction(mOptionMenuActions.mSelection); } -// // TODO Paste to be added -// if (mOptionMenuActions.mEditPaste) { -// //mOptionMenuActions.mEditPaste->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_selection_active.svg"))); -// mToolBar->addAction(mOptionMenuActions.mEditPaste); -// } + mToolbarPasteAction = new HbAction(mToolBar); + mToolbarPasteAction->setText("Paste"); + mToolbarPasteAction->setToolTip("Paste"); + // TODO Paste icon to be added + //mToolbarPasteAction->setIcon(HbIcon(QString(":/qgn_indi_tb_filebrowser_folder_parent.svg"))); + connect(mToolbarPasteAction, SIGNAL(triggered()), this, SLOT(editPaste())); + mToolBar->addAction(mToolbarPasteAction); + mToolbarPasteAction->setEnabled(false); } /** @@ -563,7 +566,6 @@ editUnselectAll(); mEngineWrapper->refreshView(); mSearchPanel->setCriteria(QString("")); - mListView->model()->revert(); mListView->reset(); if (mListView->model() && mListView->model()->rowCount() > 0) { @@ -571,6 +573,8 @@ mListView->scrollTo(firstIndex); } + mToolbarPasteAction->setEnabled(mEngineWrapper->isClipBoardListInUse()); + TListingMode listingMode = mEngineWrapper->listingMode(); if (listingMode == ENormalEntries) mNaviPane->setPlainText(QString(mEngineWrapper->currentPath())); @@ -635,7 +639,7 @@ mOverwriteOptions.queryIndex = dlg->selectedItems().at(0).toInt(); if (mOverwriteOptions.queryIndex == EFileActionQueryPostFix) { QString heading = QString("Postfix"); - HbInputDialog::getText(heading, this, SLOT(fileOverwritePostfix(HbAction *)), QString(), scene()); + HbInputDialog::queryText(heading, this, SLOT(fileOverwritePostfix(HbAction *)), QString(), scene()); } else if (mOverwriteOptions.queryIndex == EFileActionSkipAllExisting) { mOverwriteOptions.overWriteFlags = 0; } @@ -721,10 +725,15 @@ // by default use selected items if (selectionIndexes) { - if (selectionIndexes->hasSelection()) { - QItemSelection proxyItemSelection = mListView->selectionModel()->selection(); - QItemSelection itemSelection = mSortFilterProxyModel->mapSelectionToSource(proxyItemSelection); - mSelectionIndexes = itemSelection.indexes(); + bool isSelectionMode = mOptionMenuActions.mSelection && mOptionMenuActions.mSelection->isChecked(); + if (isSelectionMode) { + if (selectionIndexes->hasSelection()) { + QItemSelection proxyItemSelection = mListView->selectionModel()->selection(); + QItemSelection itemSelection = mSortFilterProxyModel->mapSelectionToSource(proxyItemSelection); + mSelectionIndexes = itemSelection.indexes(); + } else { // or if none selected, clear selection + mSelectionIndexes.clear(); + } } else { // or if none selected, use the current item index mSelectionIndexes.clear(); QModelIndex currentIndex = currentItemIndex(); //alreade mapped to source model @@ -776,13 +785,18 @@ void FbFileView::fileSearch() { QString searchPath; -// if (mEngineWrapper->currentPath() != mInitDirPath.path()) { -// searchPath = mDirectory; -// searchPath.replace("/", "\\"); -// searchPath+="\\"; -// } - searchPath = mEngineWrapper->currentPath(); -// mSearch->open(searchPath); + HbAction *contextrMenuAction = static_cast(sender()); + if (contextrMenuAction + && (contextrMenuAction == mContextMenuActions.mSearch + || contextrMenuAction == mContextMenuActions.mFileSearch) + && mEngineWrapper->getFileEntry(currentItemIndex()).isDir()) { + searchPath = mEngineWrapper->currentPath() + + mEngineWrapper->getFileEntry(currentItemIndex()).name() + + QString("\\"); + } else { + searchPath = mEngineWrapper->currentPath(); + } + emit aboutToShowSearchView(searchPath); } @@ -792,7 +806,7 @@ void FbFileView::fileNewFile() { QString heading = QString("Enter filename"); - HbInputDialog::getText(heading, this, SLOT(doFileNewFile(HbAction*)), QString(), scene()); + HbInputDialog::queryText(heading, this, SLOT(doFileNewFile(HbAction*)), QString(), scene()); } /** @@ -814,7 +828,7 @@ void FbFileView::fileNewDirectory() { QString heading = QString("Enter directory name"); - HbInputDialog::getText(heading, this, SLOT(doFileNewDirectory(HbAction*)), QString(), scene()); + HbInputDialog::queryText(heading, this, SLOT(doFileNewDirectory(HbAction*)), QString(), scene()); } /** @@ -838,18 +852,17 @@ storeSelectedItemsOrCurrentItem(); const QString messageFormat = "Delete %1 entries?"; QString message = messageFormat.arg(mSelectionIndexes.count()); - HbMessageBox::question(message, this, SLOT(doFileDelete(HbAction*))); + HbMessageBox::question(message, this, SLOT(doFileDelete(int)), HbMessageBox::Yes | HbMessageBox::No); } /** Delete actually selected files */ -void FbFileView::doFileDelete(HbAction* action) +void FbFileView::doFileDelete(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { - //storeSelectedItemsOrCurrentItem(); + if (action == HbMessageBox::Yes) { mEngineWrapper->deleteItems(mSelectionIndexes); - refreshList(); + mEngineWrapper->startExecutingCommands(QString("Deleting")); } } @@ -864,10 +877,10 @@ for (int i(0), ie(mSelectionIndexes.count()); i < ie; ++i ) { mProceed = (i == ie-1); // if the last item mModelIndex = mSelectionIndexes.at(i); - FileEntry entry = mEngineWrapper->getFileEntry(mModelIndex); + FbFileEntry entry = mEngineWrapper->getFileEntry(mModelIndex); QString heading = QString("Enter new name"); - HbInputDialog::getText(heading, this, SLOT(doFileRename(HbAction*)), entry.name(), scene()); + HbInputDialog::queryText(heading, this, SLOT(doFileRename(HbAction*)), entry.name(), scene()); } } @@ -883,13 +896,9 @@ if (mEngineWrapper->targetExists(mModelIndex, mNewFileName)) { const QString messageTemplate = QString("%1 already exists, overwrite?"); QString message = messageTemplate.arg(mNewFileName); - HbMessageBox::question(message, this, SLOT(doFileRenameFileExist(HbAction *))); + HbMessageBox::question(message, this, SLOT(doFileRenameFileExist(int)), HbMessageBox::Yes | HbMessageBox::No); } else { - mEngineWrapper->rename(mModelIndex, mNewFileName); - if (mProceed) { - mEngineWrapper->startExecutingCommands(QString("Renaming")); - refreshList(); - } + proceedFileRename(); } } } @@ -897,14 +906,20 @@ /** Rename actually selected files */ -void FbFileView::doFileRenameFileExist(HbAction *action) +void FbFileView::doFileRenameFileExist(int action) { - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { - mEngineWrapper->rename(mModelIndex, mNewFileName); - if (mProceed) { - mEngineWrapper->startExecutingCommands(QString("Renaming")); - refreshList(); - } + if (action == HbMessageBox::Yes) { + proceedFileRename(); + } +} + + +void FbFileView::proceedFileRename() +{ + mEngineWrapper->rename(mModelIndex, mNewFileName); + if (mProceed) { + mEngineWrapper->startExecutingCommands(QString("Renaming")); + refreshList(); } } @@ -918,24 +933,28 @@ if (mEngineWrapper->selectionHasDirs()) { const QString message = "Recurse touch for all selected dirs?"; - HbMessageBox::question(message, this, SLOT(doFileTouch(HbAction*))); - } - else{ - mEngineWrapper->touch(false); - refreshList(); + HbMessageBox::question(message, this, SLOT(doFileTouch(int)), HbMessageBox::Yes | HbMessageBox::No); + } else { + proceedFileTouch(false); } } /** Touch actually selected files */ -void FbFileView::doFileTouch(HbAction* action) +void FbFileView::doFileTouch(int action) { bool recurse = false; - if (action && action->text().compare(QString("Yes"), Qt::CaseInsensitive) == 0) { + if (action == HbMessageBox::Yes) { recurse = true; } + proceedFileTouch(recurse); +} + +void FbFileView::proceedFileTouch(bool recurse) +{ mEngineWrapper->touch(recurse); + mEngineWrapper->startExecutingCommands(QString("Touching")); refreshList(); } @@ -973,7 +992,45 @@ void FbFileView::fileSetAttributes() { + storeSelectedItemsOrCurrentItem(); + mEngineWrapper->setCurrentSelection(mSelectionIndexes); + QString attributesViewTitle("Multiple entries"); + + quint32 setAttributesMask(0); + quint32 clearAttributesMask(0); + bool recurse(false); + + // set default masks if only one file selected + if (mSelectionIndexes.count() == 1) + { + mModelIndex = mSelectionIndexes.at(0); + FbFileEntry fileEntry = mEngineWrapper->getFileEntry(mModelIndex); + + attributesViewTitle = fileEntry.name(); + + if (fileEntry.isArchive()) + setAttributesMask |= KEntryAttArchive; + else + clearAttributesMask |= KEntryAttArchive; + + if (fileEntry.isHidden()) + setAttributesMask |= KEntryAttHidden; + else + clearAttributesMask |= KEntryAttHidden; + + if (fileEntry.isReadOnly()) + setAttributesMask |= KEntryAttReadOnly; + else + clearAttributesMask |= KEntryAttReadOnly; + + if (fileEntry.isSystem()) + setAttributesMask |= KEntryAttSystem; + else + clearAttributesMask |= KEntryAttSystem; + } + + emit aboutToShowAttributesView(attributesViewTitle, setAttributesMask, clearAttributesMask, recurse); } // edit menu @@ -997,11 +1054,13 @@ } mEngineWrapper->clipboardCut(mClipboardIndexes); + mEngineWrapper->setCurrentSelection(mClipboardIndexes); int operations = mClipboardIndexes.count(); const QString message = QString ("%1 entries cut to clipboard"); QString noteMsg = message.arg(operations); + mToolbarPasteAction->setEnabled(true); Notifications::showInformationNote(noteMsg); } @@ -1020,12 +1079,14 @@ } mEngineWrapper->clipboardCopy(mClipboardIndexes); + mEngineWrapper->setCurrentSelection(mClipboardIndexes); int operations = mClipboardIndexes.count(); const QString message = QString ("%1 entries copied to clipboard"); QString noteMsg = message.arg(operations); + mToolbarPasteAction->setEnabled(true); Notifications::showInformationNote(noteMsg); } @@ -1037,14 +1098,14 @@ { bool someEntryExists(false); - // TODO Set entry items here - someEntryExists = mEngineWrapper->isDestinationEntriesExists(mClipboardIndexes, mEngineWrapper->currentPath()); if (someEntryExists) { fileOverwriteDialog(); } mEngineWrapper->clipboardPaste(mOverwriteOptions); + mEngineWrapper->startExecutingCommands(mEngineWrapper->getClipBoardMode() == EClipBoardModeCut ? + QString("Moving") : QString("Copying") ); } /** @@ -1053,17 +1114,19 @@ void FbFileView::editCopyToFolder() { QString heading = QString("Enter new name"); - HbInputDialog::getText(heading, this, SLOT(doEditCopyToFolder(HbAction*)), mEngineWrapper->currentPath(), scene()); + FbCopyToFolderSelectionDialog *folderSelectionDialog = new FbCopyToFolderSelectionDialog(); + folderSelectionDialog->open(this, SLOT(doEditCopyToFolder(int))); } /** Copies current file selection to a queried directory. */ -void FbFileView::doEditCopyToFolder(HbAction *action) +void FbFileView::doEditCopyToFolder(int action) { - HbInputDialog *dlg = static_cast(sender()); - if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { - QString targetDir = dlg->value().toString(); + FbCopyToFolderSelectionDialog *dlg = qobject_cast(sender()); + if (dlg && action == HbDialog::Accepted) { + QString targetDir = dlg->selectedFolder(); + bool someEntryExists(false); // TODO Set entry items here @@ -1075,7 +1138,7 @@ fileOverwriteDialog(); } mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, false); - refreshList(); + mEngineWrapper->startExecutingCommands(QString("Copying")); } } @@ -1085,17 +1148,19 @@ void FbFileView::editMoveToFolder() { QString heading = QString("Enter new name"); - HbInputDialog::getText(heading, this, SLOT(doEditMoveToFolder(HbAction*)), mEngineWrapper->currentPath(), scene()); + FbMoveToFolderSelectionDialog *folderSelectionDialog = new FbMoveToFolderSelectionDialog(); + folderSelectionDialog->open(this, SLOT(doEditMoveToFolder(int))); } /** Moves current file selection to a queried directory. */ -void FbFileView::doEditMoveToFolder(HbAction *action) +void FbFileView::doEditMoveToFolder(int action) { - HbInputDialog *dlg = static_cast(sender()); - if (dlg && action && action->text().compare(QString("Ok"), Qt::CaseInsensitive) == 0) { - QString targetDir = dlg->value().toString(); + FbMoveToFolderSelectionDialog *dlg = qobject_cast(sender()); + if (dlg && action == HbDialog::Accepted) { + QString targetDir = dlg->selectedFolder(); + bool someEntryExists(false); // TODO Set entry items here @@ -1107,7 +1172,7 @@ fileOverwriteDialog(); } mEngineWrapper->copyToFolder(targetDir, mOverwriteOptions, true); - refreshList(); + mEngineWrapper->startExecutingCommands(QString("Moving")); } } @@ -1120,7 +1185,6 @@ if (selectionModel) { selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::SelectCurrent); selectionModel->select(selectionModel->currentIndex(), QItemSelectionModel::Select); -// itemHighlighted(selectionModel->currentIndex()); refreshList(); } } @@ -1173,9 +1237,8 @@ void FbFileView::viewFilterEntries() { if (mToolBar && mToolBar->actions().count() > 1 && mToolBar->actions().at(1)) { - HbAction* tbeFilterAction = qobject_cast(mToolBar->actions().at(1)); - if (tbeFilterAction && tbeFilterAction->toolBarExtension()) { - HbToolBarExtension *tbeFilter = tbeFilterAction->toolBarExtension(); + if (mToolbarFilterAction && mToolbarFilterAction->toolBarExtension()) { + HbToolBarExtension *tbeFilter = mToolbarFilterAction->toolBarExtension(); tbeFilter->open(); } } @@ -1262,8 +1325,8 @@ { int leaveCode = -6; QString heading = QString("Leave code"); - //HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), leaveCode, scene()); - HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene()); + //HbInputDialog::queryInt(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), leaveCode, scene()); + HbInputDialog::queryText(heading, this, SLOT(doToolsErrorSimulateLeave(HbAction*)), QString::number(leaveCode), scene()); } @@ -1289,7 +1352,7 @@ { mPanicCategory = QString ("Test Category"); QString heading = QString("Panic category"); - HbInputDialog::getText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene()); + HbInputDialog::queryText(heading, this, SLOT(doToolsErrorSimulatePanicCode(HbAction*)), mPanicCategory, scene()); } /** @@ -1302,7 +1365,7 @@ mPanicCategory = dlg->value().toString(); int panicCode(555); QString heading = QString("Panic code"); - HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene()); + HbInputDialog::queryInt(heading, this, SLOT(doToolsErrorSimulatePanic(HbAction*)), panicCode, scene()); } } @@ -1328,7 +1391,7 @@ { int exceptionCode = 0; QString heading = QString("Exception code"); - HbInputDialog::getInteger(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene()); + HbInputDialog::queryInt(heading, this, SLOT(doToolsErrorSimulateException(HbAction*)), exceptionCode, scene()); } /** @@ -1399,7 +1462,7 @@ quint32 dbgMask = mEngineWrapper->getDebugMask(); QString dbgMaskText = QString("0x").append(QString::number(dbgMask, 16)); QString heading = QString("Kernel debug mask in hex format"); - HbInputDialog::getText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene()); + HbInputDialog::queryText(heading, this, SLOT(toolsSetDebugMask(HbAction*)), dbgMaskText, scene()); } /** @@ -1483,7 +1546,7 @@ refreshList(); } else { // file item // mSelectedFilePath = filePath; - FileEntry fileEntry = mEngineWrapper->getFileEntry(activatedIndex); + FbFileEntry fileEntry = mEngineWrapper->getFileEntry(activatedIndex); mAbsoluteFilePath = fileEntry.path() + fileEntry.name(); // open user-dialog to select: view as text/hex, open w/AppArc or open w/DocH. embed diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbfolderselectiondialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbfolderselectiondialog.cpp Fri Sep 03 17:11:21 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 "fbfolderselectiondialog.h" +#include "fbfolderselectorwrapper.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +FbFolderSelectionDialog::FbFolderSelectionDialog(QGraphicsItem *parent) : + HbDialog(parent), + mTitle(0), + mFolderList(0), + mFolderSelectorWrapper(0), + mFileIconProvider(0) +{ + init(); +} + +FbFolderSelectionDialog::~FbFolderSelectionDialog() +{ + if (mFileIconProvider) + delete mFileIconProvider; +} + +QString FbFolderSelectionDialog::selectedFolder() +{ + return mFolderSelectorWrapper->currentPath(); +} + +void FbFolderSelectionDialog::init() +{ + setAttribute(Qt::WA_DeleteOnClose); + + mFileIconProvider = new QFileIconProvider(); + + createHeading(); + createList(); + createToolBar(); +} + +void FbFolderSelectionDialog::createHeading() +{ + HbWidget *headingWidget = new HbWidget(this); + QGraphicsLinearLayout *headingLayout = new QGraphicsLinearLayout(Qt::Horizontal, headingWidget); + headingWidget->setLayout(headingLayout); + + mTitle = new HbLabel(this); + mTitle->setElideMode(Qt::ElideRight); + + HbPushButton *upButton = new HbPushButton(this); + upButton->setIcon(HbIcon(QString(":/qtg_indi_status_back.svg"))); + connect(upButton, SIGNAL(pressed()), + this, SLOT(moveUpPressed())); + + headingLayout->addItem(mTitle); + headingLayout->addItem(upButton); + headingLayout->setAlignment(upButton, Qt::AlignRight); + + setHeadingWidget(headingWidget); +} + +void FbFolderSelectionDialog::createList() +{ + mFolderList = new HbListWidget(this); + mFolderSelectorWrapper = new FbFolderSelectorWrapper(); + mFolderSelectorWrapper->init(); + + refreshView(); + + setContentWidget(mFolderList); + connect(mFolderList, SIGNAL(activated(HbListWidgetItem *)), + this, SLOT(activated(HbListWidgetItem *))); + + connect(mFolderSelectorWrapper, SIGNAL(FolderSelectionChanged()), + this, SLOT(refreshView())); +} + +void FbFolderSelectionDialog::createToolBar() +{ + HbAction *rejectAction = new HbAction(QString("Cancel"), this); + addAction(rejectAction); +} + +void FbFolderSelectionDialog::refreshView() +{ + mFolderList->clear(); + QIcon icon; + if (mFolderSelectorWrapper->isDriveListViewActive()) + { + const QString KSimpleDriveEntry("%d\t%c: <%S>\t\t"); + //TODO icon = mFileIconProvider->icon(QFileIconProvider::Drive); + icon = mFileIconProvider->icon(QFileIconProvider::File); + + for (TInt i=0; iitemCount(); i++) { + FbDriveEntry driveEntry = mFolderSelectorWrapper->getDriveEntry(i); + + const QString SimpleDriveEntry("%1: <%2>"); + QString diskName = SimpleDriveEntry.arg(driveEntry.driveLetter()).arg(driveEntry.mediaTypeString()); + + mFolderList->addItem(icon, diskName); + } + } else { + const QString SimpleFileEntry("%1"); + icon = mFileIconProvider->icon(QFileIconProvider::Folder); + + // append current folder item + QString currentAbsolutePath = mFolderSelectorWrapper->currentPath().left(mFolderSelectorWrapper->currentPath().length()-1); + QFileInfo fileInfo(currentAbsolutePath); + QString currentFolderName = fileInfo.fileName(); + if (currentFolderName.isEmpty()) { + currentFolderName = QString("[root level]"); + } + + QString currentDirTextEntry = SimpleFileEntry.arg(currentFolderName); ///*<< fileEntry.IconId()*/ + mFolderList->addItem(icon, currentDirTextEntry); + + for (TInt i=0; iitemCount(); i++) { + FbFileEntry fileEntry = mFolderSelectorWrapper->getFileEntry(i); + + QString fileName = SimpleFileEntry.arg(fileEntry.name()); ///*<< fileEntry.IconId()*/ + + mFolderList->addItem(icon, fileName); + } + } +} + +void FbFolderSelectionDialog::activated(HbListWidgetItem * item) +{ + int row = mFolderList->row(item); + if (mFolderSelectorWrapper->isDriveListViewActive()) { + mFolderSelectorWrapper->moveDownToDirectory(row); + } else if (row == 0) { + if (this->actions().count() > 0) { + accept(); + } + } else if (row > 0) { + mFolderSelectorWrapper->moveDownToDirectory(row); + } +} + +void FbFolderSelectionDialog::moveUpPressed() +{ + mFolderSelectorWrapper->moveUpOneLevel(); +} + +// --------------------------------------------------------------------------- + +FbCopyToFolderSelectionDialog::FbCopyToFolderSelectionDialog(QGraphicsItem *parent) : + FbFolderSelectionDialog(parent) +{ + if (headingWidget()) { + mTitle->setPlainText(QString("Copy To")); + } +} + +// --------------------------------------------------------------------------- + +FbMoveToFolderSelectionDialog::FbMoveToFolderSelectionDialog(QGraphicsItem *parent) : + FbFolderSelectionDialog(parent) +{ + if (headingWidget()) { + mTitle->setPlainText(QString("Move To")); + } +} + +// End of file diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbfolderselectorwrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbfolderselectorwrapper.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,134 @@ +/* +* 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 "fbfolderselectorwrapper.h" +#include "FBFolderSelector.h" + +#include + +// --------------------------------------------------------------------------- + +/** + * Constructor + */ +FbFolderSelectorWrapper::FbFolderSelectorWrapper() + : mDestinationFolderSelector(0) +{ +} + +/** + * Destructor + */ +FbFolderSelectorWrapper::~FbFolderSelectorWrapper() +{ + if (mDestinationFolderSelector) + delete mDestinationFolderSelector; +} + +/** + * Initializes Engine Wrapper + * @return true if engine was started successfully + */ +bool FbFolderSelectorWrapper::init() +{ + TFileName destinationFolder; + + TRAPD(err, mDestinationFolderSelector = CFileBrowserFolderSelector::NewL(destinationFolder, this)); + if (err != KErrNone) { + return false; + } else { + //TRAP_IGNORE(mEngine->ActivateEngineL()); + //mSettings = FileBrowserSettings(&mEngine->Settings()); + return true; + } +} + +/** + * Return current path + */ +QString FbFolderSelectorWrapper::currentPath() const +{ + return QString::fromUtf16(mDestinationFolderSelector->CurrentPath().Ptr(), + mDestinationFolderSelector->CurrentPath().Length()); +} + +/** + * Return whether drive list view is active + */ +bool FbFolderSelectorWrapper::isDriveListViewActive() const +{ + return mDestinationFolderSelector->IsDriveListViewActive(); +} + +/** + * Returns number of either drives or files depending on current view + */ +int FbFolderSelectorWrapper::itemCount() const +{ + if (isDriveListViewActive()) { + return mDestinationFolderSelector->DriveEntryList()->Count(); + } else { + return mDestinationFolderSelector->FileEntryList()->Count(); + } +} + +/** + * Returns drive entry for given \a index + */ +FbDriveEntry FbFolderSelectorWrapper::getDriveEntry(const int index) const +{ + TDriveEntry driveEntry; + if (mDestinationFolderSelector->DriveEntryList()->Count() > index && index >= 0) { + driveEntry = mDestinationFolderSelector->DriveEntryList()->At(index); + } + return FbDriveEntry(driveEntry); +} + +/** + * Returns file entry for given \a index + */ +FbFileEntry FbFolderSelectorWrapper::getFileEntry(const int index) const +{ + TFileEntry fileEntry; + if (mDestinationFolderSelector->FileEntryList()->Count() > index && index >= 0) { + fileEntry = mDestinationFolderSelector->FileEntryList()->At(index); + } + return FbFileEntry(fileEntry); +} + +/** + * Move down to selected item by \a index + */ +void FbFolderSelectorWrapper::moveDownToDirectory(int index) +{ + mDestinationFolderSelector->MoveDownToDirectoryL(index); +} + +/** + * Move up from folder + */ +void FbFolderSelectorWrapper::moveUpOneLevel() +{ + mDestinationFolderSelector->MoveUpOneLevelL(); +} + +void FbFolderSelectorWrapper::InformFolderSelectionChanged() +{ + emit FolderSelectionChanged(); +} + +// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbmainwindow.cpp --- a/filebrowser/ui/src/fbmainwindow.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/fbmainwindow.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -21,9 +21,10 @@ #include "enginewrapper.h" #include "fbfileview.h" #include "fbdriveview.h" -#include "settingsview.h" -#include "editorview.h" -#include "searchview.h" +#include "fbsettingsview.h" +#include "fbeditorview.h" +#include "fbsearchview.h" +#include "fbattributesview.h" FbMainWindow::FbMainWindow(QWidget *parent) : HbMainWindow(parent), @@ -33,6 +34,7 @@ mSettingsView(0), mEditorView(0), mSearchView(0), + mAttributesView(0), mPreviousView(0) { } @@ -66,23 +68,26 @@ addView(mFileView); // Create settings view - mSettingsView = new SettingsView(*mEngineWrapper); + mSettingsView = new FbSettingsView(*mEngineWrapper); connect(mSettingsView, SIGNAL(finished(bool)), this, SLOT(openPreviousBrowserView())); addView(mSettingsView); // Create editor view - mEditorView = new EditorView(); + mEditorView = new FbEditorView(); connect(mFileView, SIGNAL(aboutToShowEditorView(const QString &, bool)), this, SLOT(openEditorView(const QString &, bool))); connect(mEditorView, SIGNAL(finished(bool)), this, SLOT(openFileView())); addView(mEditorView); // Create Search view - mSearchView = new SearchView(*mEngineWrapper); + mSearchView = new FbSearchView(*mEngineWrapper); connect(mDriveView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString))); connect(mFileView, SIGNAL(aboutToShowSearchView(QString)), this, SLOT(openSearchView(QString))); connect(mSearchView, SIGNAL(finished(bool)), this, SLOT(openFileBrowserView(bool))); addView(mSearchView); + connect(mFileView, SIGNAL(aboutToShowAttributesView(const QString &, quint32 &, quint32 &, bool &)), + this, SLOT(openAttributesView(const QString &, quint32 &, quint32 &, bool &))); + // Show ApplicationView at startup setCurrentView(mDriveView); mPreviousView = mDriveView; @@ -143,3 +148,31 @@ mSearchView->open(path); setCurrentView(mSearchView); } + +void FbMainWindow::openAttributesView(const QString &attributesViewTitle, + quint32 &setAttributesMask, + quint32 &clearAttributesMask, + bool &recurse) +{ + if (!mAttributesView) { + // Create attributes view + mAttributesView = new FbAttributesView(setAttributesMask, clearAttributesMask, recurse); + connect(mAttributesView, SIGNAL(finished(bool)), this, SLOT(closeAttributesView(bool))); + mAttributesView->setTitle(attributesViewTitle); + addView(mAttributesView); + setCurrentView(mAttributesView); + } +} + +void FbMainWindow::closeAttributesView(bool accepted) +{ + if (accepted) { + mEngineWrapper->setAttributes(mAttributesView->setAttributesMask(), mAttributesView->clearAttributesMask(), mAttributesView->recurse()); + } + openFileView(); + removeView(mAttributesView); + mAttributesView->deleteLater(); + mAttributesView = 0; +} + +// End of file diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbsearchview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbsearchview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,213 @@ +/* +* 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 "fbsearchview.h" +#include "enginewrapper.h" +#include "notifications.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +const QStringList RECURSEMODES = (QStringList() << "Non-recursive" << "Recursive"); +const QString acceptActionText = "Search"; +const QString rejectActionText = "Cancel"; + + +FbSearchView::FbSearchView(EngineWrapper &engineWrapper) + : mEngineWrapper(engineWrapper), + mAttributes(), + mResults(), + mForm(0), + mSearchFileNameItem(0), + mWildCardItem(0), + mHasString(0), + mRecurse(0), + mMinSize(0), + mMaxSize(0), + mMinDate(0), + mMaxDate(0), + mPath(), + mProgressDialog(0) +{ + // Set title and add this view to main window + setTitle("Search"); + + // Override back navigation action + HbAction *leaveViewAction = new HbAction(Hb::BackNaviAction, this); + connect(leaveViewAction, SIGNAL(triggered()), this, SLOT(reject())); + setNavigationAction(leaveViewAction); + + initDataForm(); + createToolbar(); +} + +FbSearchView::~FbSearchView() +{ +} + +void FbSearchView::initDataForm() { + mForm = new HbDataForm(/*HbFormView::ModeEdit,*/ this); + HbDataFormModel *model = new HbDataFormModel(); + + mSearchFileNameItem = new HbDataFormModelItem(HbDataFormModelItem::TextItem); + mSearchFileNameItem->setLabel("Search dir: "); + + mWildCardItem = new HbDataFormModelItem(HbDataFormModelItem::TextItem); + mWildCardItem->setLabel("Wildcards: "); + + mHasString = new HbDataFormModelItem(HbDataFormModelItem::TextItem); + mHasString->setLabel("Has string: "); + + mRecurse = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem); + mRecurse->setLabel("Recurse: "); + mRecurse->setContentWidgetData("items", RECURSEMODES); + + mMinSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem); + mMinSize->setLabel("Min size: "); + + mMaxSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem); + mMaxSize->setLabel("Max size: "); + + mMinDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem); + mMinDate->setLabel("Min date: "); + mMinDate->setContentWidgetData("text", "01/01/1980"); + + mMaxDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem); + mMaxDate->setLabel("Max date: "); + mMaxDate->setContentWidgetData("text", "31/12/2060"); + + model->appendDataFormItem(mSearchFileNameItem); + model->appendDataFormItem(mWildCardItem); + model->appendDataFormItem(mHasString); + model->appendDataFormItem(mRecurse); + model->appendDataFormItem(mMinSize); + model->appendDataFormItem(mMaxSize); + model->appendDataFormItem(mMinDate); + model->appendDataFormItem(mMaxDate); + mForm->setModel(model); + + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this); + layout->addItem(mForm); + setLayout(layout); +} + +void FbSearchView::createToolbar() +{ + HbToolBar *toolBar = new HbToolBar(this); + HbAction *acceptAction = new HbAction(acceptActionText); + connect(acceptAction, SIGNAL(triggered()), this, SLOT(accept())); + toolBar->addAction(acceptAction); + + HbAction *rejectAction = new HbAction(rejectActionText); + connect(rejectAction, SIGNAL(triggered()), this, SLOT(reject())); + toolBar->addAction(rejectAction); + + setToolBar(toolBar); +} + +void FbSearchView::loadAttributes() +{ + // get settings from engine; + mAttributes = mEngineWrapper.getFileSearchAttributes(); + + // set data: + mSearchFileNameItem->setContentWidgetData("text", mPath); +// mSearchFileNameItem->setContentWidgetData("text", mAttributes.mSearchDir); + if (!mAttributes.mDefaultWildCard) { + mWildCardItem->setContentWidgetData("text", mAttributes.mWildCards); + } + mHasString->setContentWidgetData("text", mAttributes.mTextInFile); + + mRecurse->setContentWidgetData("selected", mAttributes.mRecurse); + + mMinSize->setContentWidgetData("text", mAttributes.mMinSize); + mMaxSize->setContentWidgetData("text", mAttributes.mMaxSize); + + mMinDate->setContentWidgetData("text", mAttributes.mMinDate); + mMaxDate->setContentWidgetData("text", mAttributes.mMaxDate); +} + +/** + * Reads form items and saves values of them into member variable mAttributes + */ +void FbSearchView::readFormItems() +{ + mAttributes.mSearchDir = mSearchFileNameItem->contentWidgetData("text").toString(); + + mAttributes.mDefaultWildCard = false; + QString wildCard = mWildCardItem->contentWidgetData("text").toString(); + if (wildCard.trimmed().isEmpty()) { + wildCard = QString("*"); + mAttributes.mDefaultWildCard = true; + } + mAttributes.mWildCards = wildCard; + mAttributes.mTextInFile = mHasString->contentWidgetData("text").toString(); + mAttributes.mMinSize = mMinSize->contentWidgetData("text").toInt(); + mAttributes.mMaxSize = mMaxSize->contentWidgetData("text").toInt(); + mAttributes.mMinDate = mMinDate->contentWidgetData("text").toDate(); + mAttributes.mMaxDate = mMaxDate->contentWidgetData("text").toDate(); + mAttributes.mRecurse = mRecurse->contentWidgetData("selected").toBool(); +} + +void FbSearchView::open(const QString &path) +{ + mPath = path; + // load file search attribute values from FB engine: + loadAttributes(); +} + +void FbSearchView::startFileSearch() +{ + // save form data values and set them as search attributes into FB engine. + readFormItems(); + mEngineWrapper.setFileSearchAttributes(mAttributes); + + bool err = mEngineWrapper.searchFiles(); + + // show results of file search: + mResults = mEngineWrapper.getSearchResults(); + fileSearchResults(); +} + +void FbSearchView::fileSearchResults() +{ + QString noteMsg("%1 entries found"); + Notifications::showInformationNote(noteMsg.arg(mEngineWrapper.itemCount()), QString("")); +} + +void FbSearchView::accept() +{ + startFileSearch(); + emit finished(true); +} + +void FbSearchView::reject() +{ + emit finished(false); +} diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fbsettingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/fbsettingsview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,243 @@ +/* +* 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 "fbsettingsview.h" +#include "enginewrapper.h" +#include "filebrowsersettings.h" + +#include +#include +#include +#include +#include +#include + +#include + +const QStringList DisplayModeModes = (QStringList() << "Full screen" << "Normal"); +const QStringList FileViewModes = (QStringList() << "Simple" << "Extended"); +const QStringList Modes = (QStringList() << "Yes" << "No"); +const QString YesText = QString("Yes"); +const QString NoText = QString("No"); +const QString acceptActionText = "OK"; +const QString rejectActionText = "Cancel"; + +FbSettingsView::FbSettingsView(EngineWrapper &engineWrapper) : + mEngineWrapper(engineWrapper), + mForm(0), + mDisplayModeItem(0), + mFileViewItem(0), + mShowDirectoryInfoItem(0), + mShowAssociatedIconsItem(0), + mRememberFolderOnExitItem(0), + mRememberLastFolderItem(0), + mShowToolbarItem(0), + mSupportNetDrivesItem(0), + mBypassPlatformSecurityItem(0), + mUnlockFilesViaSBItem(0), + mIgnoreProtectionAttributesItem(0), + mNoROAttributeCopyFromZItem(0) +{ + setTitle("Settings"); + + // Override back navigation action + HbAction *leaveViewAction = new HbAction(Hb::BackNaviAction, this); + connect(leaveViewAction, SIGNAL(triggered()), this, SLOT(reject())); + setNavigationAction(leaveViewAction); + + initDataForm(); + createToolbar(); +} + +FbSettingsView::~FbSettingsView() +{ +} + +void FbSettingsView::initDataForm() +{ + mForm = new HbDataForm(this); + HbDataFormModel *model = new HbDataFormModel(); + +// connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), +// this, SLOT(toggleChange(QModelIndex, QModelIndex))); + + + // TODO to be done +// mDisplayModeItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem); +// mDisplayModeItem->setLabel("Display mode: "); +// mDisplayModeItem->setContentWidgetData("items", DisplayModeModes); +// +// mFileViewItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem); +// mFileViewItem->setLabel("File view: "); +// mFileViewItem->setContentWidgetData("items", FileViewModes); +// +// mShowDirectoryInfoItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); +// mShowDirectoryInfoItem->setLabel("Show directory info: "); +// mShowDirectoryInfoItem->setContentWidgetData(QString("text"), YesText); +// mShowDirectoryInfoItem->setContentWidgetData(QString("additionalText"), NoText); +// +// mShowAssociatedIconsItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); +// mShowAssociatedIconsItem->setLabel("Show associated icons: "); +// mShowAssociatedIconsItem->setContentWidgetData(QString("text"), YesText); +// mShowAssociatedIconsItem->setContentWidgetData(QString("additionalText"), NoText); +// +// mRememberFolderOnExitItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); +// mRememberFolderOnExitItem->setLabel("Remember folder on exit: "); +// mRememberFolderOnExitItem->setContentWidgetData(QString("text"), YesText); +// mRememberFolderOnExitItem->setContentWidgetData(QString("additionalText"), NoText); +// +// mRememberLastFolderItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); +// mRememberLastFolderItem->setLabel("Remember last folder: "); +// mRememberLastFolderItem->setContentWidgetData(QString("text"), YesText); +// mRememberLastFolderItem->setContentWidgetData(QString("additionalText"), NoText); +// +// mShowToolbarItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); +// mShowToolbarItem->setLabel("Show toolbar: "); +// mShowToolbarItem->setContentWidgetData(QString("text"), YesText); +// mShowToolbarItem->setContentWidgetData(QString("additionalText"), NoText); + + mSupportNetDrivesItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); + mSupportNetDrivesItem->setLabel("Support net drives: "); + mSupportNetDrivesItem->setContentWidgetData(QString("text"), YesText); + mSupportNetDrivesItem->setContentWidgetData(QString("additionalText"), NoText); + + mBypassPlatformSecurityItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); + mBypassPlatformSecurityItem->setLabel("Bypass plat.security: "); + mBypassPlatformSecurityItem->setContentWidgetData(QString("text"), YesText); + mBypassPlatformSecurityItem->setContentWidgetData(QString("additionalText"), NoText); + + mUnlockFilesViaSBItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); + mUnlockFilesViaSBItem->setLabel("Unlock files via SB: "); + mUnlockFilesViaSBItem->setContentWidgetData(QString("text"), YesText); + mUnlockFilesViaSBItem->setContentWidgetData(QString("additionalText"), NoText); + + mIgnoreProtectionAttributesItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); + mIgnoreProtectionAttributesItem->setLabel("Ign. protection atts: "); + mIgnoreProtectionAttributesItem->setContentWidgetData(QString("text"), YesText); + mIgnoreProtectionAttributesItem->setContentWidgetData(QString("additionalText"), NoText); + + mNoROAttributeCopyFromZItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); + mNoROAttributeCopyFromZItem->setLabel("No RO-att copy from Z: "); + mNoROAttributeCopyFromZItem->setContentWidgetData(QString("text"), YesText); + mNoROAttributeCopyFromZItem->setContentWidgetData(QString("additionalText"), NoText); + + // load file search attribute values from FB engine: + loadSettings(mEngineWrapper.settings()); + +// model->appendDataFormItem(mDisplayModeItem); +// model->appendDataFormItem(mFileViewItem); +// model->appendDataFormItem(mShowDirectoryInfoItem); +// model->appendDataFormItem(mShowAssociatedIconsItem); +// model->appendDataFormItem(mRememberFolderOnExitItem); +// model->appendDataFormItem(mRememberLastFolderItem); +// model->appendDataFormItem(mShowToolbarItem); + + model->appendDataFormItem(mSupportNetDrivesItem); + model->appendDataFormItem(mBypassPlatformSecurityItem); + model->appendDataFormItem(mUnlockFilesViaSBItem); + model->appendDataFormItem(mIgnoreProtectionAttributesItem); + model->appendDataFormItem(mNoROAttributeCopyFromZItem); + + mForm->setModel(model); + + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this); + layout->addItem(mForm); + setLayout(layout); +} + +void FbSettingsView::createToolbar() +{ + HbToolBar *toolBar = new HbToolBar(this); + HbAction *acceptAction = new HbAction(acceptActionText); + connect(acceptAction, SIGNAL(triggered()), this, SLOT(accept())); + toolBar->addAction(acceptAction); + + HbAction *rejectAction = new HbAction(rejectActionText); + connect(rejectAction, SIGNAL(triggered()), this, SLOT(reject())); + toolBar->addAction(rejectAction); + + setToolBar(toolBar); +} + +/** + Set form item values from settings \a settings. + */ +void FbSettingsView::loadSettings(const FileBrowserSettings &settings) +{ +// mDisplayModeItem->setContentWidgetData("text", settings.displayMode()); +// mFileViewItem->setContentWidgetData("text", settings.fileViewMode()); +// mShowDirectoryInfoItem->setContentWidgetData("text", settings.showSubDirectoryInfo()); +// mShowAssociatedIconsItem->setContentWidgetData("text", settings.showAssociatedIcons()); +// mRememberFolderOnExitItem->setContentWidgetData("text", settings.rememberFolderSelection()); +// mRememberLastFolderItem->setContentWidgetData("text", settings.rememberLastPath()); +// mShowToolbarItem->setContentWidgetData("text", settings.enableToolbar()); + + mSupportNetDrivesItem->setContentWidgetData("text", settings.supportNetworkDrives() ? YesText : NoText); + mSupportNetDrivesItem->setContentWidgetData("additionalText", !settings.supportNetworkDrives() ? YesText : NoText); + + mBypassPlatformSecurityItem->setContentWidgetData("text", settings.bypassPlatformSecurity() ? YesText : NoText); + mBypassPlatformSecurityItem->setContentWidgetData("additionalText", !settings.bypassPlatformSecurity() ? YesText : NoText); + + mUnlockFilesViaSBItem->setContentWidgetData("text", settings.removeFileLocks() ? YesText : NoText); + mUnlockFilesViaSBItem->setContentWidgetData("additionalText", !settings.removeFileLocks() ? YesText : NoText); + + mIgnoreProtectionAttributesItem->setContentWidgetData("text", settings.ignoreProtectionsAttributes() ? YesText : NoText); + mIgnoreProtectionAttributesItem->setContentWidgetData("additionalText", !settings.ignoreProtectionsAttributes() ? YesText : NoText); + + mNoROAttributeCopyFromZItem->setContentWidgetData("text", settings.removeROMWriteProrection() ? YesText : NoText); + mNoROAttributeCopyFromZItem->setContentWidgetData("additionalText", !settings.removeROMWriteProrection() ? YesText : NoText); +} + +/** + Store form item data into \a settings + */ +void FbSettingsView::saveSettings(FileBrowserSettings &settings) +{ +// settings.setDisplayMode(mDisplayModeItem->contentWidgetData("text").toInt()); +// settings.setFileViewMode(mFileViewItem->contentWidgetData("text").toInt()); +// settings.setShowSubDirectoryInfo(mShowDirectoryInfoItem->contentWidgetData("text").toBool()); +// settings.setShowAssociatedIcons(mShowAssociatedIconsItem->contentWidgetData("text").toBool()); +// settings.setRememberLastPath(mRememberFolderOnExitItem->contentWidgetData("text").toBool()); +// //settings.setLastPath(mRememberLastFolderItem->contentWidgetData("text").toString()); +// settings.setRememberFolderSelection(mRememberLastFolderItem->contentWidgetData("text").toBool()); +// settings.setEnableToolbar(mShowToolbarItem->contentWidgetData("text").toBool()); + + settings.setSupportNetworkDrives(mSupportNetDrivesItem->contentWidgetData("text").toString() == YesText); + settings.setBypassPlatformSecurity(mBypassPlatformSecurityItem->contentWidgetData("text").toString() == YesText); + settings.setRemoveFileLocks(mUnlockFilesViaSBItem->contentWidgetData("text").toString() == YesText); + settings.setIgnoreProtectionsAttributes(mIgnoreProtectionAttributesItem->contentWidgetData("text").toString() == YesText); + settings.setRemoveROMWriteProrection(mNoROAttributeCopyFromZItem->contentWidgetData("text").toString() == YesText); +} + +void FbSettingsView::constructMenu() +{ + +} + +void FbSettingsView::accept() +{ + saveSettings(mEngineWrapper.settings()); + mEngineWrapper.saveSettings(); + emit finished(true); +} + +void FbSettingsView::reject() +{ + emit finished(false); +} + +// End of file diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/filebrowser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filebrowser/ui/src/filebrowser.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,32 @@ +/* +* 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 "fbmainwindow.h" + + +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + FbMainWindow window; + window.init(); + int result = app.exec(); + + return result; +} diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/fileentry.cpp --- a/filebrowser/ui/src/fileentry.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -/* -* 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 "fileentry.h" - -#include - -// --------------------------------------------------------------------------- - -FileEntry::FileEntry(TFileEntry aFileEntry) -: mFileEntry(aFileEntry) -{ -} - -// --------------------------------------------------------------------------- - -FileEntry::~FileEntry() -{ -} - -// --------------------------------------------------------------------------- - -QString FileEntry::fullName() -{ - return QString::fromUtf16(mFileEntry.iFullName.Ptr(), mFileEntry.iFullName.Length()); -} - -// --------------------------------------------------------------------------- - -QString FileEntry::path() -{ - return QString::fromUtf16(mFileEntry.iPath.Ptr(), mFileEntry.iPath.Length()); -} - -// --------------------------------------------------------------------------- - -int FileEntry::attributes() -{ - return mFileEntry.iEntry.iAtt; -} - -QString FileEntry::attributesString() -{ - QString attributesString; - if (mFileEntry.iEntry.IsArchive()) { - attributesString.append("A"); - } else { - attributesString.append("-"); - } - if (mFileEntry.iEntry.IsHidden()) { - attributesString.append("H"); - } else { - attributesString.append("-"); - } - if (mFileEntry.iEntry.IsReadOnly()) { - attributesString.append("R"); - } else { - attributesString.append("-"); - } - if (mFileEntry.iEntry.IsSystem()) { - attributesString.append("S"); - } else { - attributesString.append("-"); - } - - return attributesString; -} - -// --------------------------------------------------------------------------- - -int FileEntry::size() -{ - return mFileEntry.iEntry.iSize; -} - -// --------------------------------------------------------------------------- - -QString FileEntry::sizeString() -{ - QString sizeString; - if (size() < 1024) { - sizeString.append(QString::number(size())); - sizeString.append(" B"); - } else if (size() < 1024*1024) { - qreal sizeKB = static_cast(size() / 1024); - sizeString.append( QString::number(sizeKB, 'f',1)); - sizeString.append(" kB"); - } else { - qreal sizeMB = static_cast(size() / (1024*1024)); - sizeString.append( QString::number(sizeMB, 'f',1)); - sizeString.append(" MB"); - } - return sizeString; -} - -// --------------------------------------------------------------------------- - -//QDateTime FileEntry::modified() -//{ -// QDateTime modified; -// TTime time1Jan1970UTC = TTime(_L("19700101:000000.000000")); -// TTimeIntervalSeconds intervalSeconds; -// -// TTime entryModified = mFileEntry.iEntry.iModified; -// -// TInt err = /*mFileEntry.iEntry.iModified*/ entryModified.SecondsFrom(time1Jan1970UTC, intervalSeconds); -// if (err == KErrNone) { -// quint32 secsSince1Jan1970UTC = intervalSeconds.Int(); -// modified = QDateTime::fromTime_t(secsSince1Jan1970UTC); -// qDebug() << "QDateTime:: " << modified.toString(); -// modified.setTimeSpec(Qt::LocalTime); -// qDebug() << "QDateTime:: " << modified.toString() << modified.toLocalTime().toString(); -// } -// return modified; -//} - -// --------------------------------------------------------------------------- - -QString FileEntry::modifiedString() -{ - // TODO use HbExtendedLocale to convert date and time -// QDateTime modifiedInLocalTime = modified();//.toLocalTime(); -// HbExtendedLocale locale = HbExtendedLocale::system(); -// QString date = locale.format(modifiedInLocalTime.date(), r_qtn_date_usual); -// QString time = locale.format(modifiedInLocalTime.time(), r_qtn_time_usual); -// -// return date + " " + time; - QString modifiedString; - TTime entryModified = mFileEntry.iEntry.iModified; - RTz Tz; - TInt err = Tz.Connect(); - if ( err == KErrNone && Tz.ConvertToLocalTime( entryModified ) == KErrNone ) - { - entryModified = mFileEntry.iEntry.iModified; - TBuf<128> extraData; - _LIT(KCurrentDate,"%D%M%*Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B"); - entryModified.FormatL(extraData, KCurrentDate); - modifiedString = QString::fromUtf16(extraData.Ptr(), extraData.Length()); - } - Tz.Close(); - - return modifiedString; -} - -// --------------------------------------------------------------------------- - -//int FileEntry::Uid(int id) -//{ -// return id;//mFileEntry.iEntry.iType[id]; -//} - -// --------------------------------------------------------------------------- - -bool FileEntry::isDir() -{ - return mFileEntry.iEntry.IsDir(); -} - -// --------------------------------------------------------------------------- - - -QString FileEntry::name() -{ - return QString::fromUtf16(mFileEntry.iEntry.iName.Ptr(), mFileEntry.iEntry.iName.Length()); -} - -// --------------------------------------------------------------------------- - -int FileEntry::dirEntries() -{ - return mFileEntry.iDirEntries; -} - -// --------------------------------------------------------------------------- - -QString FileEntry::dirEntriesString() -{ - QString dirEntriesString; - dirEntriesString.append(QString::number(dirEntries())); - if (dirEntries() == 1) { - dirEntriesString.append(" entry"); - } else { - dirEntriesString.append(" entries"); - } - return dirEntriesString; -} - -// --------------------------------------------------------------------------- - -int FileEntry::iconId() -{ - return mFileEntry.iIconId; -} - -// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/main.cpp --- a/filebrowser/ui/src/main.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* 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 "fbmainwindow.h" - - -int main(int argc, char *argv[]) -{ - HbApplication app(argc, argv); - FbMainWindow window; - window.init(); - int result = app.exec(); - - return result; -} diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/notifications.cpp --- a/filebrowser/ui/src/notifications.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/src/notifications.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -38,7 +38,7 @@ void Notifications::showAboutNote() { showMessageBox(HbMessageBox::MessageTypeInformation, - "Version 5.1.0 - 18th June 2010. Copyright © 2010 Nokia Corporation" + "Version 5.1.1 - 26th July 2010. Copyright © 2010 Nokia Corporation" "and/or its subsidiary(-ies). All rights reserved." "Licensed under Eclipse Public License v1.0.", "About File Browser" diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/searchview.cpp --- a/filebrowser/ui/src/searchview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +0,0 @@ -/* -* 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 "searchview.h" -#include "enginewrapper.h" -#include "notifications.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -const QStringList RECURSEMODES = (QStringList() << "Non-recursive" << "Recursive"); -const QString acceptActionText = "Search"; -const QString rejectActionText = "Cancel"; - - -SearchView::SearchView(EngineWrapper &engineWrapper) - : mEngineWrapper(engineWrapper), - mAttributes(), - mResults(), - mForm(0), - mSearchFileNameItem(0), - mWildCardItem(0), - mHasString(0), - mRecurse(0), - mMinSize(0), - mMaxSize(0), - mMinDate(0), - mMaxDate(0), - mPath(), - mProgressDialog(0) -{ - // Set title and add this view to main window - setTitle("Search"); - - // Override back navigation action - HbAction *leaveViewAction = new HbAction(Hb::BackNaviAction, this); - connect(leaveViewAction, SIGNAL(triggered()), this, SLOT(reject())); - setNavigationAction(leaveViewAction); - - initDataForm(); - createToolbar(); -} - -SearchView::~SearchView() -{ -} - -void SearchView::initDataForm() { - mForm = new HbDataForm(/*HbFormView::ModeEdit,*/ this); - HbDataFormModel *model = new HbDataFormModel(); - - mSearchFileNameItem = new HbDataFormModelItem(HbDataFormModelItem::TextItem); - mSearchFileNameItem->setLabel("Search dir: "); - - mWildCardItem = new HbDataFormModelItem(HbDataFormModelItem::TextItem); - mWildCardItem->setLabel("Wildcards: "); - - mHasString = new HbDataFormModelItem(HbDataFormModelItem::TextItem); - mHasString->setLabel("Has string: "); - - mRecurse = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem); - mRecurse->setLabel("Recurse: "); - mRecurse->setContentWidgetData("items", RECURSEMODES); - - mMinSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem); - mMinSize->setLabel("Min size: "); - - mMaxSize = new HbDataFormModelItem(HbDataFormModelItem::TextItem); - mMaxSize->setLabel("Max size: "); - - mMinDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem); - mMinDate->setLabel("Min date: "); - mMinDate->setContentWidgetData("text", "01/01/1980"); - - mMaxDate = new HbDataFormModelItem(HbDataFormModelItem::TextItem); - mMaxDate->setLabel("Max date: "); - mMaxDate->setContentWidgetData("text", "31/12/2060"); - - model->appendDataFormItem(mSearchFileNameItem); - model->appendDataFormItem(mWildCardItem); - model->appendDataFormItem(mHasString); - model->appendDataFormItem(mRecurse); - model->appendDataFormItem(mMinSize); - model->appendDataFormItem(mMaxSize); - model->appendDataFormItem(mMinDate); - model->appendDataFormItem(mMaxDate); - mForm->setModel(model); - - QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this); - layout->addItem(mForm); - setLayout(layout); -} - -void SearchView::createToolbar() -{ - HbToolBar *toolBar = new HbToolBar(this); - HbAction *acceptAction = new HbAction(acceptActionText); - connect(acceptAction, SIGNAL(triggered()), this, SLOT(accept())); - toolBar->addAction(acceptAction); - - HbAction *rejectAction = new HbAction(rejectActionText); - connect(rejectAction, SIGNAL(triggered()), this, SLOT(reject())); - toolBar->addAction(rejectAction); - - setToolBar(toolBar); -} - -void SearchView::loadAttributes() -{ - // get settings from engine; - mAttributes = mEngineWrapper.getFileSearchAttributes(); - - // set data: - mSearchFileNameItem->setContentWidgetData("text", mPath); -// mSearchFileNameItem->setContentWidgetData("text", mAttributes.mSearchDir); - mWildCardItem->setContentWidgetData("text",mAttributes.mWildCards); - mHasString->setContentWidgetData("text", mAttributes.mTextInFile); - - mRecurse->setContentWidgetData("selected",mAttributes.mRecurse); - - mMinSize->setContentWidgetData("text",mAttributes.mMinSize); - mMaxSize->setContentWidgetData("text", mAttributes.mMaxSize); - - mMinDate->setContentWidgetData("text", mAttributes.mMinDate); - mMaxDate->setContentWidgetData("text", mAttributes.mMaxDate); -} - -/** - * Reads form items and saves values of them into member variable mAttributes - */ -void SearchView::readFormItems() -{ - mAttributes.mSearchDir = mSearchFileNameItem->contentWidgetData("text").toString(); - mAttributes.mWildCards = mWildCardItem->contentWidgetData("text").toString(); - mAttributes.mTextInFile = mHasString->contentWidgetData("text").toString(); - mAttributes.mMinSize = mMinSize->contentWidgetData("text").toInt(); - mAttributes.mMaxSize = mMaxSize->contentWidgetData("text").toInt(); - mAttributes.mMinDate = mMinDate->contentWidgetData("text").toDate(); - mAttributes.mMaxDate = mMaxDate->contentWidgetData("text").toDate(); - mAttributes.mRecurse = mRecurse->contentWidgetData("selected").toBool(); -} - -void SearchView::open(const QString &path) -{ - mPath = path; - // load file search attribute values from FB engine: - loadAttributes(); -} - -void SearchView::startFileSearch() -{ - // save form data values and set them as search attributes into FB engine. - readFormItems(); - mEngineWrapper.setFileSearchAttributes(mAttributes); - - bool err = mEngineWrapper.searchFiles(); - - // show results of file search: - mResults = mEngineWrapper.getSearchResults(); - fileSearchResults(); -} - -void SearchView::fileSearchResults() -{ - QString noteMsg("%1 entries found"); - Notifications::showInformationNote(noteMsg.arg(mEngineWrapper.itemCount()), QString("")); -} - -void SearchView::accept() -{ - startFileSearch(); - emit finished(true); -} - -void SearchView::reject() -{ - emit finished(false); -} diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/src/settingsview.cpp --- a/filebrowser/ui/src/settingsview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,243 +0,0 @@ -/* -* 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 "enginewrapper.h" -#include "filebrowsersettings.h" - -#include -#include -#include -#include -#include -#include - -#include - -const QStringList DisplayModeModes = (QStringList() << "Full screen" << "Normal"); -const QStringList FileViewModes = (QStringList() << "Simple" << "Extended"); -const QStringList Modes = (QStringList() << "Yes" << "No"); -const QString YesText = QString("Yes"); -const QString NoText = QString("No"); -const QString acceptActionText = "OK"; -const QString rejectActionText = "Cancel"; - -SettingsView::SettingsView(EngineWrapper &engineWrapper) : - mEngineWrapper(engineWrapper), - mForm(0), - mDisplayModeItem(0), - mFileViewItem(0), - mShowDirectoryInfoItem(0), - mShowAssociatedIconsItem(0), - mRememberFolderOnExitItem(0), - mRememberLastFolderItem(0), - mShowToolbarItem(0), - mSupportNetDrivesItem(0), - mBypassPlatformSecurityItem(0), - mUnlockFilesViaSBItem(0), - mIgnoreProtectionAttributesItem(0), - mNoROAttributeCopyFromZItem(0) -{ - setTitle("Settings"); - - // Override back navigation action - HbAction *leaveViewAction = new HbAction(Hb::BackNaviAction, this); - connect(leaveViewAction, SIGNAL(triggered()), this, SLOT(reject())); - setNavigationAction(leaveViewAction); - - initDataForm(); - createToolbar(); -} - -SettingsView::~SettingsView() -{ -} - -void SettingsView::initDataForm() -{ - mForm = new HbDataForm(this); - HbDataFormModel *model = new HbDataFormModel(); - -// connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), -// this, SLOT(toggleChange(QModelIndex, QModelIndex))); - - - // TODO to be done -// mDisplayModeItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem); -// mDisplayModeItem->setLabel("Display mode: "); -// mDisplayModeItem->setContentWidgetData("items", DisplayModeModes); -// -// mFileViewItem = new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem); -// mFileViewItem->setLabel("File view: "); -// mFileViewItem->setContentWidgetData("items", FileViewModes); -// -// mShowDirectoryInfoItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); -// mShowDirectoryInfoItem->setLabel("Show directory info: "); -// mShowDirectoryInfoItem->setContentWidgetData(QString("text"), YesText); -// mShowDirectoryInfoItem->setContentWidgetData(QString("additionalText"), NoText); -// -// mShowAssociatedIconsItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); -// mShowAssociatedIconsItem->setLabel("Show associated icons: "); -// mShowAssociatedIconsItem->setContentWidgetData(QString("text"), YesText); -// mShowAssociatedIconsItem->setContentWidgetData(QString("additionalText"), NoText); -// -// mRememberFolderOnExitItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); -// mRememberFolderOnExitItem->setLabel("Remember folder on exit: "); -// mRememberFolderOnExitItem->setContentWidgetData(QString("text"), YesText); -// mRememberFolderOnExitItem->setContentWidgetData(QString("additionalText"), NoText); -// -// mRememberLastFolderItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); -// mRememberLastFolderItem->setLabel("Remember last folder: "); -// mRememberLastFolderItem->setContentWidgetData(QString("text"), YesText); -// mRememberLastFolderItem->setContentWidgetData(QString("additionalText"), NoText); -// -// mShowToolbarItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); -// mShowToolbarItem->setLabel("Show toolbar: "); -// mShowToolbarItem->setContentWidgetData(QString("text"), YesText); -// mShowToolbarItem->setContentWidgetData(QString("additionalText"), NoText); - - mSupportNetDrivesItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); - mSupportNetDrivesItem->setLabel("Support net drives: "); - mSupportNetDrivesItem->setContentWidgetData(QString("text"), YesText); - mSupportNetDrivesItem->setContentWidgetData(QString("additionalText"), NoText); - - mBypassPlatformSecurityItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); - mBypassPlatformSecurityItem->setLabel("Bypass plat.security: "); - mBypassPlatformSecurityItem->setContentWidgetData(QString("text"), YesText); - mBypassPlatformSecurityItem->setContentWidgetData(QString("additionalText"), NoText); - - mUnlockFilesViaSBItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); - mUnlockFilesViaSBItem->setLabel("Unlock files via SB: "); - mUnlockFilesViaSBItem->setContentWidgetData(QString("text"), YesText); - mUnlockFilesViaSBItem->setContentWidgetData(QString("additionalText"), NoText); - - mIgnoreProtectionAttributesItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); - mIgnoreProtectionAttributesItem->setLabel("Ign. protection atts: "); - mIgnoreProtectionAttributesItem->setContentWidgetData(QString("text"), YesText); - mIgnoreProtectionAttributesItem->setContentWidgetData(QString("additionalText"), NoText); - - mNoROAttributeCopyFromZItem = new HbDataFormModelItem(HbDataFormModelItem::ToggleValueItem); - mNoROAttributeCopyFromZItem->setLabel("No RO-att copy from Z: "); - mNoROAttributeCopyFromZItem->setContentWidgetData(QString("text"), YesText); - mNoROAttributeCopyFromZItem->setContentWidgetData(QString("additionalText"), NoText); - - // load file search attribute values from FB engine: - loadSettings(mEngineWrapper.settings()); - -// model->appendDataFormItem(mDisplayModeItem); -// model->appendDataFormItem(mFileViewItem); -// model->appendDataFormItem(mShowDirectoryInfoItem); -// model->appendDataFormItem(mShowAssociatedIconsItem); -// model->appendDataFormItem(mRememberFolderOnExitItem); -// model->appendDataFormItem(mRememberLastFolderItem); -// model->appendDataFormItem(mShowToolbarItem); - - model->appendDataFormItem(mSupportNetDrivesItem); - model->appendDataFormItem(mBypassPlatformSecurityItem); - model->appendDataFormItem(mUnlockFilesViaSBItem); - model->appendDataFormItem(mIgnoreProtectionAttributesItem); - model->appendDataFormItem(mNoROAttributeCopyFromZItem); - - mForm->setModel(model); - - QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this); - layout->addItem(mForm); - setLayout(layout); -} - -void SettingsView::createToolbar() -{ - HbToolBar *toolBar = new HbToolBar(this); - HbAction *acceptAction = new HbAction(acceptActionText); - connect(acceptAction, SIGNAL(triggered()), this, SLOT(accept())); - toolBar->addAction(acceptAction); - - HbAction *rejectAction = new HbAction(rejectActionText); - connect(rejectAction, SIGNAL(triggered()), this, SLOT(reject())); - toolBar->addAction(rejectAction); - - setToolBar(toolBar); -} - -/** - Set form item values from settings \a settings. - */ -void SettingsView::loadSettings(const FileBrowserSettings &settings) -{ -// mDisplayModeItem->setContentWidgetData("text", settings.displayMode()); -// mFileViewItem->setContentWidgetData("text", settings.fileViewMode()); -// mShowDirectoryInfoItem->setContentWidgetData("text", settings.showSubDirectoryInfo()); -// mShowAssociatedIconsItem->setContentWidgetData("text", settings.showAssociatedIcons()); -// mRememberFolderOnExitItem->setContentWidgetData("text", settings.rememberFolderSelection()); -// mRememberLastFolderItem->setContentWidgetData("text", settings.rememberLastPath()); -// mShowToolbarItem->setContentWidgetData("text", settings.enableToolbar()); - - mSupportNetDrivesItem->setContentWidgetData("text", settings.supportNetworkDrives() ? YesText : NoText); - mSupportNetDrivesItem->setContentWidgetData("additionalText", !settings.supportNetworkDrives() ? YesText : NoText); - - mBypassPlatformSecurityItem->setContentWidgetData("text", settings.bypassPlatformSecurity() ? YesText : NoText); - mBypassPlatformSecurityItem->setContentWidgetData("additionalText", !settings.bypassPlatformSecurity() ? YesText : NoText); - - mUnlockFilesViaSBItem->setContentWidgetData("text", settings.removeFileLocks() ? YesText : NoText); - mUnlockFilesViaSBItem->setContentWidgetData("additionalText", !settings.removeFileLocks() ? YesText : NoText); - - mIgnoreProtectionAttributesItem->setContentWidgetData("text", settings.ignoreProtectionsAttributes() ? YesText : NoText); - mIgnoreProtectionAttributesItem->setContentWidgetData("additionalText", !settings.ignoreProtectionsAttributes() ? YesText : NoText); - - mNoROAttributeCopyFromZItem->setContentWidgetData("text", settings.removeROMWriteProrection() ? YesText : NoText); - mNoROAttributeCopyFromZItem->setContentWidgetData("additionalText", !settings.removeROMWriteProrection() ? YesText : NoText); -} - -/** - Store form item data into \a settings - */ -void SettingsView::saveSettings(FileBrowserSettings &settings) -{ -// settings.setDisplayMode(mDisplayModeItem->contentWidgetData("text").toInt()); -// settings.setFileViewMode(mFileViewItem->contentWidgetData("text").toInt()); -// settings.setShowSubDirectoryInfo(mShowDirectoryInfoItem->contentWidgetData("text").toBool()); -// settings.setShowAssociatedIcons(mShowAssociatedIconsItem->contentWidgetData("text").toBool()); -// settings.setRememberLastPath(mRememberFolderOnExitItem->contentWidgetData("text").toBool()); -// //settings.setLastPath(mRememberLastFolderItem->contentWidgetData("text").toString()); -// settings.setRememberFolderSelection(mRememberLastFolderItem->contentWidgetData("text").toBool()); -// settings.setEnableToolbar(mShowToolbarItem->contentWidgetData("text").toBool()); - - settings.setSupportNetworkDrives(mSupportNetDrivesItem->contentWidgetData("text").toString() == YesText); - settings.setBypassPlatformSecurity(mBypassPlatformSecurityItem->contentWidgetData("text").toString() == YesText); - settings.setRemoveFileLocks(mUnlockFilesViaSBItem->contentWidgetData("text").toString() == YesText); - settings.setIgnoreProtectionsAttributes(mIgnoreProtectionAttributesItem->contentWidgetData("text").toString() == YesText); - settings.setRemoveROMWriteProrection(mNoROAttributeCopyFromZItem->contentWidgetData("text").toString() == YesText); -} - -void SettingsView::constructMenu() -{ - -} - -void SettingsView::accept() -{ - saveSettings(mEngineWrapper.settings()); - mEngineWrapper.saveSettings(); - emit finished(true); -} - -void SettingsView::reject() -{ - emit finished(false); -} - -// End of file diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/ui.pro --- a/filebrowser/ui/ui.pro Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/ui.pro Fri Sep 03 17:11:21 2010 +0300 @@ -21,39 +21,45 @@ load(hb.prf) symbian:CONFIG -= symbian_i18n -HEADERS += ./inc/fbmainwindow.h \ +HEADERS += ./inc/menuaction.h \ + ./inc/enginewrapper.h \ + ./inc/fbmainwindow.h \ ./inc/fbdrivelistviewitem.h \ ./inc/fbdrivemodel.h \ + ./inc/fbdriveentry.h \ ./inc/fbdriveview.h \ ./inc/fbfilelistviewitem.h \ ./inc/fbfilemodel.h \ + ./inc/fbfileentry.h \ ./inc/fbfileview.h \ ./inc/filebrowsersortfilterproxymodel.h \ - ./inc/menuaction.h \ ./inc/filebrowsersettings.h \ - ./inc/settingsview.h \ - ./inc/editorview.h \ - ./inc/searchview.h \ - ./inc/enginewrapper.h \ - ./inc/notifications.h \ - ./inc/fileentry.h \ - ./inc/driveentry.h -SOURCES += ./src/main.cpp \ + ./inc/fbsettingsview.h \ + ./inc/fbeditorview.h \ + ./inc/fbsearchview.h \ + ./inc/fbattributesview.h \ + ./inc/fbfolderselectiondialog.h \ + ./inc/fbfolderselectorwrapper.h \ + ./inc/notifications.h +SOURCES += ./src/filebrowser.cpp \ + ./src/enginewrapper.cpp \ ./src/fbmainwindow.cpp \ ./src/fbdrivelistviewitem.cpp \ ./src/fbdrivemodel.cpp \ + ./src/fbdriveentry.cpp \ ./src/fbdriveview.cpp \ ./src/fbfilelistviewitem.cpp \ ./src/fbfilemodel.cpp \ + ./src/fbfileentry.cpp \ ./src/fbfileview.cpp \ ./src/filebrowsersortfilterproxymodel.cpp \ - ./src/settingsview.cpp \ - ./src/editorview.cpp \ - ./src/searchview.cpp \ - ./src/enginewrapper.cpp \ - ./src/notifications.cpp \ - ./src/fileentry.cpp \ - ./src/driveentry.cpp + ./src/fbsettingsview.cpp \ + ./src/fbeditorview.cpp \ + ./src/fbsearchview.cpp \ + ./src/fbattributesview.cpp \ + ./src/fbfolderselectiondialog.cpp \ + ./src/fbfolderselectorwrapper.cpp \ + ./src/notifications.cpp RESOURCES += ./ui.qrc symbian { @@ -70,7 +76,6 @@ -lfbscli \ -lImageConversion \ -lPlatformEnv \ - -leikcoctl \ -lapgrfx \ -lefsrv \ -lbafl \ @@ -78,9 +83,6 @@ -lmediaclientaudio \ -lestor \ -lgdi \ - -leikctl \ - -leikcdlg \ - -leikdlg \ -legul \ -lsendui \ -lmsgs \ @@ -104,12 +106,14 @@ ../engine/FB.hrh \ ../engine/FBStd.h \ ../engine/FBTraces.h \ + ../engine/FBFolderSelector.h \ #ifndef FILEBROWSER_LITE - ../fileopclient\inc\FBFileOpClient.h + ../fileopclient/inc/FBFileOpClient.h #endif SOURCES += ../engine/engine.cpp \ ../engine/FBFileUtils.cpp \ - ../engine/FBFileOps.cpp + ../engine/FBFileOps.cpp \ + ../engine/FBFolderSelector.cpp RSS_RULES += "group_name = \"RnD Tools\";" TARGET.CAPABILITY = NetworkServices LocalServices CAP_APPLICATION AllFiles DiskAdmin TARGET.UID3 = 0xE85157B0 diff -r 5db69f4c3d06 -r b048e15729d6 filebrowser/ui/ui.qrc --- a/filebrowser/ui/ui.qrc Mon Aug 23 15:50:54 2010 +0300 +++ b/filebrowser/ui/ui.qrc Fri Sep 03 17:11:21 2010 +0300 @@ -3,5 +3,6 @@ ../icons/qgn_indi_tb_filebrowser_folder_parent.svg ../icons/qgn_indi_tb_filebrowser_find.svg ../icons/qgn_indi_tb_filebrowser_selection_active.svg + ../icons/qtg_indi_status_back.svg diff -r 5db69f4c3d06 -r b048e15729d6 layers.sysdef.xml --- a/layers.sysdef.xml Mon Aug 23 15:50:54 2010 +0300 +++ b/layers.sysdef.xml Fri Sep 03 17:11:21 2010 +0300 @@ -10,7 +10,7 @@ - + @@ -25,10 +25,10 @@ - + - + diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_applications.h --- a/loadgen/engine/inc/loadgen_applications.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_applications.h Fri Sep 03 17:11:21 2010 +0300 @@ -53,7 +53,7 @@ virtual void Close(); virtual TPtrC Description(); inline TApplicationsAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TApplicationsAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TApplicationsAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_bluetooth.h --- a/loadgen/engine/inc/loadgen_bluetooth.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_bluetooth.h Fri Sep 03 17:11:21 2010 +0300 @@ -50,7 +50,7 @@ virtual void Close(); virtual TPtrC Description(); inline TBluetoothAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TBluetoothAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TBluetoothAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction(TAny* aThreadArg); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_cpuload.h --- a/loadgen/engine/inc/loadgen_cpuload.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_cpuload.h Fri Sep 03 17:11:21 2010 +0300 @@ -51,7 +51,7 @@ virtual void Close(); virtual TPtrC Description(); inline TCPULoadAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TCPULoadAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TCPULoadAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction(TAny* aThreadArg); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_httpreceiver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loadgen/engine/inc/loadgen_httpreceiver.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,183 @@ + + +#ifndef CHTTPReceiver_H +#define CHTTPReceiver_H + +#include +#include +#include +#include +#include + +// CONSTANTS +// None. + +// MACROS +#ifdef _DEBUG +#define TRACE( text ) RDebug::Printf( text ); +#define TRACE2( text, arg ) RDebug::Printf( text, arg ); +#else +#define TRACE( text ) +#define TRACE2( text, arg ) +#endif + +// DATA TYPES +// None. + +// FUNCTION PROTOTYPES +// None. + +// FORWARD DECLARATIONS +// None. + +class MHTTPRecvObserver + { + public: + + /** + * Callback for HTTP response received. + * @param aStatus Status code. + * @return None. + */ + virtual void HTTPFileReceived( TInt aStatus ) = 0; + }; + +// CLASS DECLARATION + +class CHTTPReceiver + : public CBase, + public MHTTPTransactionCallback + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CHTTPReceiver* NewL( MHTTPRecvObserver& aObserver ); + + /** + * Two-phased constructor. + */ + static CHTTPReceiver* NewLC( MHTTPRecvObserver& aObserver ); + + /** + * Destructor. + */ + virtual ~CHTTPReceiver(); + + /** + * Cancels the current HTTP transaction. + */ + void CancelTransaction(); + + /** + * Opens a connection to destination aUri and sends data using HTTP GET. + * Callbacks via MHTTPRecvObserver::HTTPFileReceived + * Leaves with KErrNotReady If network is not available + * @param aUri Destination URL, if http scheme not specified, prepends scheme. + */ + void SendHTTPGetL( const TDesC8& aUri ); + + protected: // Constructors and destructor + + /** + * C++ default constructor. + */ + CHTTPReceiver( MHTTPRecvObserver& aObserver ); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); + + /** + * Sets HTTP header fields. + * @param aHeaders HTTP headers. + * @param aHdrField Header field to set. + * @param aHdrValue Header field value. + */ + void SetHeaderL(RHTTPHeaders aHeaders, TInt aHdrField, + const TDesC8& aHdrValue); + + //From MHTTPTransactionCallback + /** + * Called by HTTP framework when HTTP events occur. + * @param aTransaction The transaction that the event has occurred on. + * @param aEvent The event that has occurred. + */ + void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); + + /** + * Called when RunL leaves from a transaction event. + * @param aError The leave code that RunL left with. + * @param aTransaction The transaction that was being processed. + * @param aEvent The event that was being processed. + * @return KErrNone. + */ + TInt MHFRunError( TInt aError, + RHTTPTransaction aTransaction, + const THTTPEvent& aEvent); + + /** + * Starts HTTP connection. + */ + void SetupConnectionL(); + + /** + * Utility:Checks for http uri scheme and prepends if not exists to the url + * @param aUri UriParser. + * @param aURL URL to check for. + * @return None + */ + void CheckForHTTPSchemeL(TUriParser8& aUri, const TDesC8& aURL); + + /** + * Utility: finish receiving, call calback HTTPFileReceived() + * @param aError to be signaled + * @return None + */ + void Finalize(); + + private: + + // Request uri, might need to prepend http scheme. + HBufC8* iUrl; + + // RSocketServ object. + RSocketServ iSocketServ; + + // RConnection object. + RConnection iConnection; + + // HTTP session. + RHTTPSession iSession; + + // HTTP transaction used for request. + RHTTPTransaction iTransaction; + + // Observer to notify. + MHTTPRecvObserver& iObserver; + + // ETrue if transaction in progress. + TBool iRunning; + + // ETrue if connection set up done. + TBool iConnectionSetupDone; + + // Response Status + TInt iResponseStatus; + +#ifdef _DEBUG + // Http response body written to file + RFile iResponseFile; + + // RFs to be used for writing to iResponseFile + RFs iFs; +#endif + +}; + +#endif + +// CHTTPReceiver_H +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_keypress.h --- a/loadgen/engine/inc/loadgen_keypress.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_keypress.h Fri Sep 03 17:11:21 2010 +0300 @@ -51,7 +51,7 @@ virtual void Close(); virtual TPtrC Description(); inline TKeyPressAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TKeyPressAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TKeyPressAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction(TAny* aThreadArg); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_memoryeat.h --- a/loadgen/engine/inc/loadgen_memoryeat.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_memoryeat.h Fri Sep 03 17:11:21 2010 +0300 @@ -52,7 +52,7 @@ virtual void Close(); virtual TPtrC Description(); inline TMemoryEatAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TMemoryEatAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TMemoryEatAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction(TAny* aThreadArg); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_messages.h --- a/loadgen/engine/inc/loadgen_messages.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_messages.h Fri Sep 03 17:11:21 2010 +0300 @@ -52,7 +52,7 @@ virtual void Close(); virtual TPtrC Description(); inline TMessageAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TMessageAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TMessageAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction( TAny* aThreadArg ); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_netconn.h --- a/loadgen/engine/inc/loadgen_netconn.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_netconn.h Fri Sep 03 17:11:21 2010 +0300 @@ -22,8 +22,7 @@ // INCLUDES #include #include -//#include -//#include +#include "loadgen_httpreceiver.h" #include "loadgen_loadbase.h" #include "loadgen_loadattributes.h" @@ -52,7 +51,7 @@ virtual void Close(); virtual TPtrC Description(); inline TNetConnAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TNetConnAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TNetConnAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction(TAny* aThreadArg); @@ -66,7 +65,7 @@ }; -class CNetConnManager : public CActive, public MHttpDownloadMgrObserver +class CNetConnManager : public CActive, public MHTTPRecvObserver { public: static CNetConnManager* NewL(TNetConnAttributes& aAttributes); @@ -84,15 +83,15 @@ static TInt PeriodicTimerCallBack(TAny* aAny); void StartDownloadL(); -private: // MHttpDownloadMgrObserver - void HandleDMgrEventL(RHttpDownload& aDownload, THttpDownloadEvent aEvent); +private: // MHTTPRecvObserver + void HTTPFileReceived( TInt aStatus ); public: inline CPeriodic* PeriodicTimer() { return iPeriodicTimer; } private: TNetConnAttributes& iAttributes; CPeriodic* iPeriodicTimer; - RHttpDownloadMgr iDownloadMgr; + CHTTPReceiver* iHTTPReceiver; }; #endif diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_phonecall.h --- a/loadgen/engine/inc/loadgen_phonecall.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_phonecall.h Fri Sep 03 17:11:21 2010 +0300 @@ -53,7 +53,7 @@ virtual void Close(); virtual TPtrC Description(); inline TPhoneCallAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TPhoneCallAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TPhoneCallAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction(TAny* aThreadArg); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_photocapture.h --- a/loadgen/engine/inc/loadgen_photocapture.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_photocapture.h Fri Sep 03 17:11:21 2010 +0300 @@ -51,7 +51,7 @@ virtual void Close(); virtual TPtrC Description(); inline TPhotoCaptureAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TPhotoCaptureAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TPhotoCaptureAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/inc/loadgen_pointerevent.h --- a/loadgen/engine/inc/loadgen_pointerevent.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/inc/loadgen_pointerevent.h Fri Sep 03 17:11:21 2010 +0300 @@ -51,7 +51,7 @@ virtual void Close(); virtual TPtrC Description(); inline TPointerEventAttributes& Attributes() { return iAttributes; } - inline void SetAttributes(TPointerEventAttributes aAttributes) { iAttributes = aAttributes; } + inline void SetAttributes(const TPointerEventAttributes& aAttributes) { iAttributes = aAttributes; } public: // New static methods static TInt ThreadFunction(TAny* aThreadArg); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/src/loadgen_applications.cpp --- a/loadgen/engine/src/loadgen_applications.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/src/loadgen_applications.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -459,9 +459,6 @@ { TApaAppInfo appInfo; User::LeaveIfError( iLs.GetAppInfo( appInfo, iCurrentAppUid ) ); - TApaAppCapabilityBuf capBuf; - User::LeaveIfError( iLs.GetAppCapability( capBuf, iCurrentAppUid ) ); - TApaAppCapability& caps = capBuf(); CApaCommandLine* cmdLine=CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL( appInfo.iFullName ); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/src/loadgen_httpreceiver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/loadgen/engine/src/loadgen_httpreceiver.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,353 @@ + +#include +#include +#include "loadgen_httpreceiver.h" + +// CONSTANTS +_LIT8( KHttpScheme, "http" ); +_LIT8( KSchemeAddon, "://" ); +// This client accepts all content types. +_LIT8(KAccept, "*/*"); + +CHTTPReceiver* CHTTPReceiver::NewL( MHTTPRecvObserver& aObserver ) + { + CHTTPReceiver* self = CHTTPReceiver::NewLC( aObserver ); + CleanupStack::Pop( self ); + return self; + } + +CHTTPReceiver* CHTTPReceiver::NewLC( MHTTPRecvObserver& aObserver ) + { + CHTTPReceiver* self = new (ELeave)CHTTPReceiver( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +CHTTPReceiver::CHTTPReceiver( MHTTPRecvObserver& aObserver ) : + iObserver(aObserver), iRunning(EFalse), iConnectionSetupDone(EFalse) + { + } + +void CHTTPReceiver::ConstructL() + { +#ifdef _DEBUG + User::LeaveIfError( iFs.Connect() ); +#endif + } + +CHTTPReceiver::~CHTTPReceiver() + { + TRACE( "Entry: CHTTPReceiver::~CHTTPReceiver" ); + + CancelTransaction(); + + TRAP_IGNORE( iSession.DisconnectL() ); + iSession.Close(); + iConnection.Stop(); + iConnection.Close(); + iSocketServ.Close(); + + TRACE( "Entry: CHTTPReceiver::~CHTTPReceiver - delete iUrl" ); + delete iUrl; + +#ifdef _DEBUG + iFs.Close(); +#endif + TRACE( "Exit: CHTTPReceiver::~CHTTPReceiver" ); + } + +void CHTTPReceiver::CancelTransaction() + { + if ( !iRunning) + return; + + TRACE( "Entry: CHTTPReceiver::CancelTransaction" ); + + if ( iRunning) + { + iTransaction.Close(); + iRunning = EFalse; + } + + TRACE( "Exit: CHTTPReceiver::CancelTransaction" ); + } + +// ---------------------------------------------------------------------------- +// CHTTPReceiver::SendHTTPGetL() +// +// Start a new HTTP GET transaction. +// ---------------------------------------------------------------------------- +void CHTTPReceiver::SendHTTPGetL( const TDesC8& aURL ) + { + TRACE( "Entry: CHTTPReceiver::SendHTTPGetL" ); + + iResponseStatus = KErrGeneral; + +#ifdef _DEBUG + iResponseFile.Replace( iFs, _L("C:\\Data\\loadgen.htm"), EFileWrite ); +#endif + + SetupConnectionL(); + + // Parse string to URI (as defined in RFC2396) + TUriParser8 uri; + + CheckForHTTPSchemeL(uri, aURL); + + RStringF method = iSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable()); + CleanupClosePushL( method ); + + iTransaction = iSession.OpenTransactionL(uri, *this, method); + + // Set headers for request: accepted content type + RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection(); + SetHeaderL(hdr, HTTP::EAccept, KAccept); + + iTransaction.SubmitL(); + + iRunning = ETrue; + CleanupStack::PopAndDestroy(); + TRACE( "Exit: CHTTPReceiver::SendHTTPGetL" ); + return; + } + +void CHTTPReceiver::CheckForHTTPSchemeL(TUriParser8& aUri, const TDesC8& aURL) + { + if( iUrl ) + { + delete iUrl; + iUrl = NULL; + } + + iUrl = aURL.AllocL(); + aUri.Parse( *iUrl ); + + TPtrC8 scheme( aUri.Extract (EUriScheme) ); + + // unsupported or no scheme in url. + // Insert 'http://' to the beginning of it. + if ( scheme != KHttpScheme ) + { + HBufC8* tempBuf = HBufC8::NewL( KHttpScheme().Length() + KSchemeAddon().Length() + aURL.Length() ); + CleanupStack::PushL( tempBuf ); + tempBuf->Des().Append( KHttpScheme ); + tempBuf->Des().Append( KSchemeAddon ); + tempBuf->Des().Append( aURL ); + + if( iUrl ) + { + delete iUrl; + iUrl = NULL; + } + iUrl = tempBuf; + aUri.Parse( *iUrl ); + CleanupStack::PopAndDestroy( tempBuf ); + } + } + +// Used to set header value to HTTP request +void CHTTPReceiver::SetHeaderL (RHTTPHeaders aHeaders, TInt aHdrField, const TDesC8& aHdrValue) + { + RStringF valStr = iSession.StringPool().OpenFStringL (aHdrValue); + CleanupClosePushL (valStr); + THTTPHdrVal val(valStr); + aHeaders.SetFieldL (iSession.StringPool().StringF (aHdrField, RHTTPSession::GetTable ()), val); + CleanupStack::PopAndDestroy (); // valStr + } + +// Inherited from MHTTPTransactionCallback +// Called by framework to pass transaction events. +// ---------------------------------------------------------------------------- +void CHTTPReceiver::MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent ) + { + TRACE( "Entry: CHTTPReceiver::MHFRunL" ); + TRACE2( "Entry: CHTTPReceiver::MHFRunL <%d>", aEvent.iStatus ); + + // state check + if ( !iRunning ) + { + TRACE( "Exit1: CHTTPReceiver::MHFRunL: recv in wrong state" ); + return; + } + + switch ( aEvent.iStatus ) + { + case THTTPEvent::EGotResponseHeaders: + { + TRACE( "Entry: CHTTPReceiver::MHFRunL EGotResponseHeaders" ); + // Get HTTP status code from header (e.g. 200) + RHTTPResponse resp = aTransaction.Response(); + iResponseStatus = resp.StatusCode(); + } + break; + + case THTTPEvent::EGotResponseBodyData: + { + // Get the body data supplier + TRACE( "Entry: CHTTPReceiver::MHFRunL EGotResponseBodyData" ); + MHTTPDataSupplier* body = aTransaction.Response().Body (); + TPtrC8 dataChunk; + body->GetNextDataPart ( dataChunk ); +#ifdef _DEBUG + if ( dataChunk.Length() ) + { + iResponseFile.Write( dataChunk ); + } +#endif + body->ReleaseData (); + } + break; + + case THTTPEvent::EResponseComplete: + { + // Indicates that header & body of response is completely received. + // Notify Observer + TRACE( "Entry: CHTTPReceiver::MHFRunL EResponseComplete" ); + } + break; + + case THTTPEvent::ESucceeded: + { + // Transaction can be closed now. It's not needed anymore. + TRACE( "Entry: CHTTPReceiver::MHFRunL ESucceeded" ); + Finalize(); + } + break; + + case THTTPEvent::EFailed: + { + TRACE( "Entry: CHTTPReceiver::MHFRunL EFailed" ); + iResponseStatus = KErrGeneral; + Finalize(); + } + break; + + default: + TRACE( "Entry: CHTTPReceiver::MHFRunL EDefault" ); + break; + } + } + +// Called by framework when *leave* occurs in handling of transaction event. +// These errors must be handled, or otherwise HTTP-CORE 6 panic is thrown. +// ---------------------------------------------------------------------------- +TInt CHTTPReceiver::MHFRunError ( TInt aError, RHTTPTransaction /*aTransaction*/, const THTTPEvent& /*aEvent*/ ) + { + TRACE( "Entry: CHTTPReceiver::MHFRunError" ); + iResponseStatus = aError; + Finalize(); + + TRACE( "Exit: CHTTPReceiver::MHFRunError" ); + return KErrNone; + } + +void CHTTPReceiver::SetupConnectionL () + { + TRACE( "Entry: CHTTPReceiver::StartConnectionL" ); + + // check if conncetion is already open + if ( iRunning ) + { + return; + } + + if ( iConnectionSetupDone ) + { + return; + } + + iConnectionSetupDone = ETrue; + + // open HTTP session + iSession.OpenL(); + + // open socket server + TInt result = iSocketServ.Connect(); + if ( result == KErrNone) + { + // open connection + result = iConnection.Open(iSocketServ); + if ( result == KErrNone) + { + // set overrides + TCommDbConnPref pref; + pref.SetDialogPreference (ECommDbDialogPrefPrompt); + //pref.SetDirection (ECommDbConnectionDirectionOutgoing); + //pref.SetIapId (accessPoint); + + // start with overrides + result = iConnection.Start(pref); + + if ( result == KErrNone) + { + // get connection info from iSession + RHTTPConnectionInfo connInfo = iSession.ConnectionInfo (); + RStringPool pool = iSession.StringPool (); + + // set socket server + connInfo.SetPropertyL (pool.StringF (HTTP::EHttpSocketServ, + RHTTPSession::GetTable () ), + THTTPHdrVal( iSocketServ.Handle () ) ); + + // attach to connection + TInt connectionPtr= REINTERPRET_CAST( TInt, + &iConnection ); + + connInfo.SetPropertyL (pool.StringF ( + HTTP::EHttpSocketConnection, + RHTTPSession::GetTable () ), + THTTPHdrVal (connectionPtr) ); + +#if defined(__WINSCW__) || defined(__WINS__) // if Emulator + _LIT8(KProxyAddr, "192.168.0.252:4040"); + TBufC8<30> proxyAddr(KProxyAddr); + + RStringF prxAddr = iSession.StringPool().OpenFStringL (proxyAddr); + CleanupClosePushL (prxAddr); + THTTPHdrVal prxUsage(iSession.StringPool().StringF (HTTP::EUseProxy, + RHTTPSession::GetTable ())); + iSession.ConnectionInfo().SetPropertyL (iSession.StringPool().StringF (HTTP::EProxyUsage, + RHTTPSession::GetTable ()), prxUsage); + iSession.ConnectionInfo().SetPropertyL (iSession.StringPool().StringF (HTTP::EProxyAddress, + RHTTPSession::GetTable ()), prxAddr); + CleanupStack::PopAndDestroy (); // prxAddr +#endif + + } + else + { + TRACE2( "CHTTPReceiver:: connection start: <%d>", result ); + } + } + else + { + TRACE2( "CHTTPReceiver:: connection open: <%d>", result ); + } + } + else + { + TRACE2( "CHTTPReceiver:: connection to socket server: <%d>", result ); + } + + User::LeaveIfError( result ); + + TRACE( "Exit: CHTTPReceiver::StartConnectionL" ); + } + +// ---------------------------------------------------------------------------- +// CHTTPReceiver::Finalize +// +// ---------------------------------------------------------------------------- +// +void CHTTPReceiver::Finalize() + { + TRACE( "Exit: CHTTPReceiver::Finalize" ); +#ifdef _DEBUG + iResponseFile.Close(); +#endif + iTransaction.Close(); + iRunning = EFalse; + iObserver.HTTPFileReceived( iResponseStatus ); + TRACE( "Exit: CHTTPReceiver::Finalize" ); + } diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/src/loadgen_memoryeat.cpp --- a/loadgen/engine/src/loadgen_memoryeat.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/src/loadgen_memoryeat.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -476,7 +476,7 @@ { aNewSize = 0; } - LOGSTRING2("Loadgen::DoEatMemoryL aNewSize = %d", aNewSize ); + LOGSTRING2("Loadgen::DoEatMemoryL aNewSize = %ld", aNewSize ); // set new size if (iAttributes.iSource == EMemoryEatSourceTypeRAM) { diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/engine/src/loadgen_netconn.cpp --- a/loadgen/engine/src/loadgen_netconn.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/engine/src/loadgen_netconn.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -184,8 +184,8 @@ CNetConnManager::~CNetConnManager() { Cancel(); - - iDownloadMgr.Close(); + + delete iHTTPReceiver; } // -------------------------------------------------------------------------------------------- @@ -201,10 +201,7 @@ // set the death status pointer point to the request status of this ao iAttributes.iDeathStatus = &iStatus; - // init - TUid dlUid; - dlUid.iUid = 0x00011100 + iAttributes.iId; // generate unique identifier instead of using the LoadGen uid for all instances - iDownloadMgr.ConnectL(dlUid, *this, ETrue); + iHTTPReceiver = CHTTPReceiver::NewL( *this ); // start timer iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityStandard); @@ -241,42 +238,23 @@ void CNetConnManager::StartDownloadL() { - iDownloadMgr.SetIntAttribute(EDlMgrExitAction, EExitPause); - iDownloadMgr.DeleteAll(); // create new download TBuf8<256> url; url.Copy(iAttributes.iDestination); - - RHttpDownload& download = iDownloadMgr.CreateDownloadL( url ); - download.SetIntAttribute(EDlAttrAction, EDoNothing); // do nothing when download has finished - download.SetBoolAttribute(EDlAttrHidden, ETrue); // download is hidden - download.SetIntAttribute(EDlAttrRestartAction, ERestartForced); // force to download always ignoring cache - - // start the download - download.Start(); + iHTTPReceiver->SendHTTPGetL( url ); } // -------------------------------------------------------------------------------------------- -void CNetConnManager::HandleDMgrEventL(RHttpDownload& aDownload, THttpDownloadEvent aEvent) +void CNetConnManager::HTTPFileReceived( TInt aStatus ) { - if (aEvent.iProgressState == EHttpContentTypeReceived) + switch ( aStatus ) { - // need to start the download if already not started - aDownload.Start(); - } - - switch ( aEvent.iDownloadState ) - { - case EHttpDlPaused: - case EHttpDlCompleted: - case EHttpDlFailed: + case 200: { // assume that the download has finished in this stage - // delete download and restart - aDownload.Delete(); iPeriodicTimer->Start(CLoadGenUtils::MilliSecondsToMicroSeconds(iAttributes.iIdle, iAttributes.iRandomVariance), KDefaultPeriod, TCallBack(PeriodicTimerCallBack, this)); break; } diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/hb.pro --- a/loadgen/ui/hb/hb.pro Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/hb.pro Fri Sep 03 17:11:21 2010 +0300 @@ -30,6 +30,7 @@ MMP_RULES *= UNPAGED BLD_INF_RULES.prj_exports += "./rom/loadgen.iby CORE_IBY_EXPORT_PATH(tools,loadgen.iby)" INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + INCLUDEPATH += /epoc32/include/mw/http HEADERS += inc/engine.h \ inc/enginewrapper.h SOURCES += src/engine.cpp \ @@ -44,7 +45,9 @@ ../../engine/src/loadgen_applications.cpp \ ../../engine/src/loadgen_photocapture.cpp \ ../../engine/src/loadgen_bluetooth.cpp \ - ../../engine/src/loadgen_pointerevent.cpp + ../../engine/src/loadgen_pointerevent.cpp \ + ../../engine/src/loadgen_netconn.cpp \ + ../../engine/src/loadgen_httpreceiver.cpp RSS_RULES += "group_name = \"RnD Tools\""; LIBS += -leuser \ -lcommonengine \ @@ -74,7 +77,9 @@ -lcentralrepository \ -lesock \ -lbluetooth \ - -lhal + -lhal \ + -lhttp \ + -linetprotutil TARGET.CAPABILITY = swevent \ ReadUserData \ WriteUserData \ diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/inc/engine.h --- a/loadgen/ui/hb/inc/engine.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/inc/engine.h Fri Sep 03 17:11:21 2010 +0300 @@ -104,16 +104,16 @@ TPhotoCaptureAttributes GetPhotoCaptureAttributes(); TBluetoothAttributes GetBluetoothAttributes(); TPointerEventAttributes GetPointerEventAttributes(); - void ChangeCPULoadAttributes(TCPULoadAttributes aAttributes); - void ChangeMemoryEatAttributes(TMemoryEatAttributes aAttributes); - void ChangePhoneCallAttributes(TPhoneCallAttributes aAttributes); - void ChangeNetConnAttributes(TNetConnAttributes aAttributes); - void ChangeKeyPressAttributes(TKeyPressAttributes aAttributes); - void ChangeMessageAttributes(TMessageAttributes aAttributes); - void ChangeApplicationsAttributes(TApplicationsAttributes aAttributes); - void ChangePhotoCaptureAttributes(TPhotoCaptureAttributes aAttributes); - void ChangeBluetoothAttributes(TBluetoothAttributes aAttributes); - void ChangePointerEventAttributes(TPointerEventAttributes aAttributes); + void ChangeCPULoadAttributes(const TCPULoadAttributes& aAttributes); + void ChangeMemoryEatAttributes(const TMemoryEatAttributes& aAttributes); + void ChangePhoneCallAttributes(const TPhoneCallAttributes& aAttributes); + void ChangeNetConnAttributes(const TNetConnAttributes& aAttributes); + void ChangeKeyPressAttributes(const TKeyPressAttributes& aAttributes); + void ChangeMessageAttributes(const TMessageAttributes& aAttributes); + void ChangeApplicationsAttributes(const TApplicationsAttributes& aAttributes); + void ChangePhotoCaptureAttributes(const TPhotoCaptureAttributes& aAttributes); + void ChangeBluetoothAttributes(const TBluetoothAttributes& aAttributes); + void ChangePointerEventAttributes(const TPointerEventAttributes& aAttributes); inline TLoadGenSettings& Settings() { return iSettings; } inline CEikonEnv* EikonEnv() { return iEnv; } diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/inc/enginewrapper.h --- a/loadgen/ui/hb/inc/enginewrapper.h Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/inc/enginewrapper.h Fri Sep 03 17:11:21 2010 +0300 @@ -143,52 +143,52 @@ /** * Set attributes for CPU load */ - void setCpuLoadAttributes(CPULoadAttributes attributes); + void setCpuLoadAttributes(const CPULoadAttributes& attributes); /** * Set attributes for memory eat */ - void setMemoryEatAttributes(MemoryEatAttributes attributes); + void setMemoryEatAttributes(const MemoryEatAttributes& attributes); /** * Set attributes for phone call */ - void setPhoneCallAttributes(PhoneCallAttributes attributes); + void setPhoneCallAttributes(const PhoneCallAttributes& attributes); /** * Set attributes for network connection */ - void setNetConnAttributes(NetConnAttributes attributes); + void setNetConnAttributes(const NetConnAttributes& attributes); /** * Set attributes for key presses */ - void setKeyPressAttributes(KeyPressAttributes attributes); + void setKeyPressAttributes(const KeyPressAttributes& attributes); /** * Set pointer event for messages */ - void setPointerEventAttributes(PointerEventAttributes attributes); + void setPointerEventAttributes(const PointerEventAttributes& attributes); /** * Set message attributes */ - void setMessageAttributes(MessageAttributes attributes); + void setMessageAttributes(const MessageAttributes& attributes); /** * Set applications attributes */ - void setApplicationsAttributes(ApplicationsAttributes attributes); + void setApplicationsAttributes(const ApplicationsAttributes& attributes); /** * Set photo capture attributes */ - void setPhotoCaptureAttributes(PhotoCaptureAttributes attributes); + void setPhotoCaptureAttributes(const PhotoCaptureAttributes& attributes); /** * Set BT attributes */ - void setBluetoothAttributes(BluetoothAttributes attributes); + void setBluetoothAttributes(const BluetoothAttributes& attributes); /** * Stop load diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/src/engine.cpp --- a/loadgen/ui/hb/src/engine.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/src/engine.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -24,7 +24,7 @@ #include "loadgen_cpuload.h" #include "loadgen_memoryeat.h" #include "loadgen_phonecall.h" -//#include "loadgen_netconn.h" +#include "loadgen_netconn.h" #include "loadgen_keypress.h" #include "loadgen_pointerevent.h" #include "loadgen_messages.h" @@ -530,12 +530,12 @@ item = CPhoneCall::NewL(iPhoneCallAttributes, iReferenceNumber); break; } -/* case ELoadGenCmdNewLoadNetConn: + case ELoadGenCmdNewLoadNetConn: { item = CNetConn::NewL(iNetConnAttributes, iReferenceNumber); break; } -*/ + case ELoadGenCmdNewLoadKeyPress: { item = CKeyPress::NewL(iKeyPressAttributes, iReferenceNumber); @@ -946,7 +946,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangeCPULoadAttributes(TCPULoadAttributes aAttributes) +void CEngine::ChangeCPULoadAttributes(const TCPULoadAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -976,7 +976,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangeMemoryEatAttributes(TMemoryEatAttributes aAttributes) +void CEngine::ChangeMemoryEatAttributes(const TMemoryEatAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -1006,7 +1006,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangePhoneCallAttributes(TPhoneCallAttributes aAttributes) +void CEngine::ChangePhoneCallAttributes(const TPhoneCallAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -1023,7 +1023,7 @@ TNetConnAttributes CEngine::GetNetConnAttributes() { -/* + if (iEditExistingLoad == EFalse) { return iNetConnAttributes; @@ -1033,14 +1033,14 @@ CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); return (static_cast(aItem)->Attributes()); } -*/ + } // -------------------------------------------------------------------------------------------- -void CEngine::ChangeNetConnAttributes(TNetConnAttributes aAttributes) +void CEngine::ChangeNetConnAttributes(const TNetConnAttributes& aAttributes) { -/* + if (iEditExistingLoad == EFalse) { iNetConnAttributes = aAttributes; @@ -1050,7 +1050,7 @@ CLoadBase* aItem = iLoadItemList->At(iCurrentItemIndex); static_cast(aItem)->SetAttributes(aAttributes); } -*/ + } // -------------------------------------------------------------------------------------------- @@ -1071,7 +1071,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangeKeyPressAttributes(TKeyPressAttributes aAttributes) +void CEngine::ChangeKeyPressAttributes(const TKeyPressAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -1101,7 +1101,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangeMessageAttributes(TMessageAttributes aAttributes) +void CEngine::ChangeMessageAttributes(const TMessageAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -1131,7 +1131,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangeApplicationsAttributes(TApplicationsAttributes aAttributes) +void CEngine::ChangeApplicationsAttributes(const TApplicationsAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -1161,7 +1161,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangePhotoCaptureAttributes(TPhotoCaptureAttributes aAttributes) +void CEngine::ChangePhotoCaptureAttributes(const TPhotoCaptureAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -1192,7 +1192,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangeBluetoothAttributes(TBluetoothAttributes aAttributes) +void CEngine::ChangeBluetoothAttributes(const TBluetoothAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { @@ -1222,7 +1222,7 @@ // -------------------------------------------------------------------------------------------- -void CEngine::ChangePointerEventAttributes(TPointerEventAttributes aAttributes) +void CEngine::ChangePointerEventAttributes(const TPointerEventAttributes& aAttributes) { if (iEditExistingLoad == EFalse) { diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/src/enginewrapper.cpp --- a/loadgen/ui/hb/src/enginewrapper.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/src/enginewrapper.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -172,14 +172,14 @@ if (listIndices.count() > 0) { QString message = QString("Stop %1 selections?").arg( listIndices.count() ); - HbMessageBox::question(message, this, SLOT(StopLoadYesNoDialogClosed(HbAction *))); + HbMessageBox::question(message, this, SLOT(StopLoadYesNoDialogClosed(HbAction *)), HbMessageBox::Yes|HbMessageBox::No); } else{ TInt currentItemIndex = mMainView.currentItemIndex(); if (mEngine->LoadItemCount() > currentItemIndex && currentItemIndex >= 0) { QString message("Stop highlighted selections?"); - HbMessageBox::question(message, this, SLOT(StopLoadYesNoDialogClosed(HbAction *))); + HbMessageBox::question(message, this, SLOT(StopLoadYesNoDialogClosed(HbAction *)), HbMessageBox::Yes|HbMessageBox::No); } } return true; @@ -352,7 +352,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setCpuLoadAttributes(CPULoadAttributes attributes) +void EngineWrapper::setCpuLoadAttributes(const CPULoadAttributes& attributes) { TCPULoadAttributes tCpuLoadAttributes; @@ -406,7 +406,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setMemoryEatAttributes(MemoryEatAttributes attributes) +void EngineWrapper::setMemoryEatAttributes(const MemoryEatAttributes& attributes) { TMemoryEatAttributes tMemoryEatAttributes = mEngine->GetMemoryEatAttributes();//TMemoryEatAttributes tMemoryEatAttributes; @@ -456,7 +456,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setPhoneCallAttributes(PhoneCallAttributes attributes) +void EngineWrapper::setPhoneCallAttributes(const PhoneCallAttributes& attributes) { TPhoneCallAttributes tPhoneCallAttributes = mEngine->GetPhoneCallAttributes(); //TPhoneCallAttributes tPhoneCallAttributes; @@ -483,9 +483,7 @@ attributes.mId = tNetConnAttributes.iId; attributes.mPriority = tNetConnAttributes.iPriority; - TBuf<128> dest; - dest.Copy(tNetConnAttributes.iDestination); - attributes.mDestination = QString((QChar*)dest.Ptr(), dest.Length()); + attributes.mDestination = QString::fromUtf16(tNetConnAttributes.iDestination.Ptr(), tNetConnAttributes.iDestination.Length()); attributes.mIdle = tNetConnAttributes.iIdle; attributes.mRandomVariance = tNetConnAttributes.iRandomVariance; @@ -494,7 +492,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setNetConnAttributes(NetConnAttributes attributes) +void EngineWrapper::setNetConnAttributes(const NetConnAttributes& attributes) { TNetConnAttributes tNetConnAttributes = mEngine->GetNetConnAttributes(); //TNetConnAttributes tNetConnAttributes; @@ -526,7 +524,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setKeyPressAttributes(KeyPressAttributes attributes) +void EngineWrapper::setKeyPressAttributes(const KeyPressAttributes& attributes) { TKeyPressAttributes tKeyPressAttributes = mEngine->GetKeyPressAttributes(); //TKeyPressAttributes tKeyPressAttributes; @@ -554,7 +552,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setPointerEventAttributes(PointerEventAttributes attributes) +void EngineWrapper::setPointerEventAttributes(const PointerEventAttributes& attributes) { TPointerEventAttributes tPointerEventAttributes = mEngine->GetPointerEventAttributes();//TPointerEventAttributes tPointerEventAttributes; @@ -590,7 +588,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setMessageAttributes(MessageAttributes attributes) +void EngineWrapper::setMessageAttributes(const MessageAttributes& attributes) { TMessageAttributes tMessageAttributes = mEngine->GetMessageAttributes();//TMessageAttributes tMessageAttributes; @@ -629,7 +627,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setApplicationsAttributes(ApplicationsAttributes attributes) +void EngineWrapper::setApplicationsAttributes(const ApplicationsAttributes& attributes) { TApplicationsAttributes tApplicationsAttributes = mEngine->GetApplicationsAttributes(); //TApplicationsAttributes tApplicationsAttributes; @@ -664,7 +662,7 @@ // --------------------------------------------------------------------------- -void EngineWrapper::setPhotoCaptureAttributes(PhotoCaptureAttributes attributes) +void EngineWrapper::setPhotoCaptureAttributes(const PhotoCaptureAttributes& attributes) { TPhotoCaptureAttributes tPhotoCaptureAttributes; @@ -689,12 +687,13 @@ attributes.mPriority = tBluetoothAttributes.iPriority; attributes.mIdle = tBluetoothAttributes.iIdle; attributes.mRandomVariance = tBluetoothAttributes.iRandomVariance; + attributes.mBluetoothSupported = tBluetoothAttributes.iBluetoothSupported ? true : false; return attributes; } // --------------------------------------------------------------------------- -void EngineWrapper::setBluetoothAttributes(BluetoothAttributes attributes) +void EngineWrapper::setBluetoothAttributes(const BluetoothAttributes& attributes) { TBluetoothAttributes tBluetoothAttributes; diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/src/main.cpp --- a/loadgen/ui/hb/src/main.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/src/main.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -17,7 +17,7 @@ #include #include - +#include #include "mainview.h" @@ -26,6 +26,9 @@ HbApplication app(argc, argv); HbMainWindow mainWindow; + // set as system application to prevent getting shut down events + CEikonEnv::Static()->SetSystem( ETrue ); + //Create main view MainView* view = new MainView(mainWindow); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/src/mainview.cpp --- a/loadgen/ui/hb/src/mainview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/src/mainview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -107,11 +107,11 @@ connect(mMessagesLoadAction, SIGNAL( triggered() ), mSm, SLOT(map())); mSm->setMapping(mMessagesLoadAction, ELoadGenCmdNewLoadMessages); //TODO to be fixed using replacement for downloadmanager -/* + mNetConnLoadAction = mLoadSubMenu1->addAction("Network conn."); connect(mNetConnLoadAction, SIGNAL( triggered() ), mSm, SLOT(map())); mSm->setMapping(mNetConnLoadAction, ELoadGenCmdNewLoadNetConn); -*/ + mKeyPressLoadAction = mLoadSubMenu2->addAction("Key presses"); connect(mKeyPressLoadAction, SIGNAL( triggered() ), mSm, SLOT(map())); mSm->setMapping(mKeyPressLoadAction, ELoadGenCmdNewLoadKeyPress); diff -r 5db69f4c3d06 -r b048e15729d6 loadgen/ui/hb/src/notifications.cpp --- a/loadgen/ui/hb/src/notifications.cpp Mon Aug 23 15:50:54 2010 +0300 +++ b/loadgen/ui/hb/src/notifications.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -27,7 +27,7 @@ void Notifications::about() { HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); - messageBox->setText("Version 1.5.0 - March 10th 2010. Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."); + messageBox->setText("Version 1.5.1 - August 27th 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 LoadGen", messageBox); messageBox->setHeadingWidget(header); messageBox->setAttribute(Qt::WA_DeleteOnClose); diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/data/Example_MemSpyProcessMemoryTrackingAutoStartConfig.xml --- a/memspyui/data/Example_MemSpyProcessMemoryTrackingAutoStartConfig.xml Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/data/MemSpyEComInterfaceIds.xml --- a/memspyui/data/MemSpyEComInterfaceIds.xml Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml --- a/memspyui/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/data/backup_registration.xml --- a/memspyui/data/backup_registration.xml Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/data/memspyui.rss --- a/memspyui/data/memspyui.rss Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1133 +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: -* -*/ - - -// Resource Identifier -NAME MEMS - -// System includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// User includes -#include "../ui/avkon/inc/MemSpy.hrh" - - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf="MemSpy"; } - -RESOURCE EIK_APP_INFO - { - hotkeys = r_memspy_hotkeys; - menubar = r_memspy_menubar; - cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - - - - - - -RESOURCE HOTKEYS r_memspy_hotkeys - { - control= - { - HOTKEY { command=EAknCmdExit; key='e'; } - }; - } - - -RESOURCE MENU_BAR r_memspy_menubar - { - titles= - { - MENU_TITLE { menu_pane=r_memspy_menupane; txt = "Main Menu"; } - }; - } - - - - -RESOURCE MENU_PANE r_memspy_menupane_stack - { - items= - { - MENU_ITEM { command = EMemSpyCmdStackInfoThread; txt = "Info"; } -#ifndef __WINS__ - , - MENU_ITEM { command = EMemSpyCmdStackData; cascade = r_memspy_menupane_stack_data; txt = "Data"; } -#endif - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_stack_data - { - items= - { - MENU_ITEM { command=EMemSpyCmdStackDataUser; txt = "User stack data"; }, - MENU_ITEM { command=EMemSpyCmdStackDataKernel; txt = "Kernel stack data"; } - }; - } - - - - - - -RESOURCE MENU_PANE r_memspy_menupane_heap - { - items= - { - MENU_ITEM { command = EMemSpyCmdHeapInfoThread; txt = "Info"; }, - MENU_ITEM { command = EMemSpyCmdHeapData; cascade = r_memspy_menupane_heap_data; txt = "Data"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_heap_data - { - items= - { - MENU_ITEM { command = EMemSpyCmdHeapCellListing; txt = "Cell list"; } -#ifndef __WINS__ - , - MENU_ITEM { command = EMemSpyCmdHeapDataDump; txt = "Heap data"; } -#endif - }; - } - - - - - - - - - - - - - -RESOURCE MENU_PANE r_memspy_menupane_auto_capture - { - items= - { - MENU_ITEM { command = EMemSpyCmdAutoCaptureToggle; txt = "Enable/Disable"; }, - MENU_ITEM { command = EMemSpyCmdAutoCaptureRetryTime; txt = "Timer period"; }, - MENU_ITEM { command = EMemSpyCmdAutoCaptureOperationType; txt = "Operation type"; } - }; - } - - -RESOURCE TBUF r_memspy_auto_capture_enable - { - buf = "Enable"; - } - - -RESOURCE TBUF r_memspy_auto_capture_disable - { - buf = "Disable"; - } - - -RESOURCE LISTBOX r_memspy_auto_capture_operation_listbox - { - flags = 0; //EEikListBoxMultipleSelection; - } - - -RESOURCE AVKON_SETTING_PAGE r_memspy_auto_capture_operation_types_settings_page - { - number = EAknSettingPageNoOrdinalDisplayed; - label = "Operation type"; - softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL; - type = EAknSetListBox; - editor_resource_id = r_memspy_auto_capture_operation_listbox; - } - - -RESOURCE ARRAY r_memspy_auto_capture_operation_types - { - items = - { - LBUF { txt = "General Info (Text)"; }, - LBUF { txt = "General Info (Detailed)"; }, - // - LBUF { txt = "User Heap Info (Text)"; }, - LBUF { txt = "User Heap Info (CSV)"; }, - // - LBUF { txt = "User Heap Cell List (Text)"; }, - // - LBUF { txt = "User Heap Data (Binary)"; }, - LBUF { txt = "Kernel Heap Data (Binary)"; }, - // - LBUF { txt = "User Stack Info (Text)"; }, - LBUF { txt = "User Stack Info (CSV)"; }, - // - LBUF { txt = "User Stack Data (Binary)"; }, - LBUF { txt = "Kernel Stack Data (Binary)"; } - }; - } - - - - - - - - - - - - - - - - - - - -RESOURCE MENU_PANE r_memspy_menupane_phone_info_general - { - 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"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_phone_info_heap - { - items= - { - MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapInfoSummary; txt = "Detailed Summary"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapInfoCompact; txt = "Compact Summary"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapCellListing; txt = "Cell Listing"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapDump; txt = "Data (Binary)"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_phone_info_stack - { - items= - { - MENU_ITEM { command = EMemSpyCmdPhoneInfoStackInfo; txt = "Detailed Summary"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoStackInfoCompact; txt = "Compact Summary"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoStackDumpUser; txt = "User Stacks (Binary)"; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoStackDumpKernel; txt = "Kernel Stacks (Binary)"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_phone_info - { - items= - { - MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneral; txt = "General"; cascade = r_memspy_menupane_phone_info_general; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoHeap; txt = "Heap"; cascade = r_memspy_menupane_phone_info_heap; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfoStack; txt = "Stack"; cascade = r_memspy_menupane_phone_info_stack; } - }; - } - - - - - - - - - - - - - - - - - - - -RESOURCE MENU_PANE r_memspy_menupane_process_sort - { - items= - { - MENU_ITEM { command = EMemSpyCmdProcessSortById; txt = "By Id"; }, - MENU_ITEM { command = EMemSpyCmdProcessSortByName; txt = "By Name"; }, - MENU_ITEM { command = EMemSpyCmdProcessSortByThreadCount; txt = "By Number of Threads"; }, - MENU_ITEM { command = EMemSpyCmdProcessSortByCodeSegs; txt = "By Code Segments"; }, - MENU_ITEM { command = EMemSpyCmdProcessSortByHeapUsage; txt = "By Heap Usage"; }, - MENU_ITEM { command = EMemSpyCmdProcessSortByStackUsage; txt = "By Stack Usage"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_process_info - { - items= - { - MENU_ITEM { command = EMemSpyCmdProcessInfoSummary; txt = "Summary"; }, - MENU_ITEM { command = EMemSpyCmdProcessInfoHandles; txt = "Handles"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_process_end - { - items= - { - MENU_ITEM { command = EMemSpyCmdProcessEndKill; txt = "Kill"; }, - MENU_ITEM { command = EMemSpyCmdProcessEndPanic; txt = "Panic"; }, - MENU_ITEM { command = EMemSpyCmdProcessEndTerminate; txt = "Terminate"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_process - { - 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; } - }; - } - - - - - - - -RESOURCE MENU_PANE r_memspy_menupane_thread_priority - { - items= - { - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteVeryLow; txt = "Abs. Very Low"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteLowNormal; txt = "Abs. Low Normal"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteLow; txt = "Abs. Low"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal; txt = "Abs. Background Normal"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteBackground; txt = "Abs. Background "; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal; txt = "Abs. Foreground Normal"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteForeground; txt = "Abs. Foreground"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteHighNormal; txt = "Abs. High Normal"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteHigh; txt = "Abs. High"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime1; txt = "Abs. Real Time 1"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime2; txt = "Abs. Real Time 2"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime3; txt = "Abs. Real Time 3"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime4; txt = "Abs. Real Time 4"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime5; txt = "Abs. Real Time 5"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime6; txt = "Abs. Real Time 6"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime7; txt = "Abs. Real Time 7"; }, - MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime8; txt = "Abs. Real Time 8"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_thread_info - { - items= - { - MENU_ITEM { command = EMemSpyCmdThreadInfoHandles; txt = "Handles"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_thread_end - { - items= - { - MENU_ITEM { command = EMemSpyCmdThreadEndKill; txt = "Kill"; }, - MENU_ITEM { command = EMemSpyCmdThreadEndPanic; txt = "Panic"; }, - MENU_ITEM { command = EMemSpyCmdThreadEndTerminate; txt = "Terminate"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_thread - { - items= - { - 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; } - }; - } - - - - - - - - - -RESOURCE MENU_PANE r_memspy_menupane_output - { - items= - { - MENU_ITEM { command = EMemSpyCmdOutputToDebug; txt = "Switch to Debug output"; }, - MENU_ITEM { command = EMemSpyCmdOutputToFile; txt = "Switch to File output"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_tools - { - items= - { - MENU_ITEM { command = EMemSpyCmdToolsListOpenFiles; txt = "List open files"; }, - MENU_ITEM { command = EMemSpyCmdOutput; txt = "Change output mode"; cascade = r_memspy_menupane_output; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_view - { - items= - { - MENU_ITEM { command = EMemSpyCmdViewRefresh; txt = "Refresh"; }, - MENU_ITEM { command = EMemSpyCmdViewOutputToSink; txt = "Output Contents"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_images - { - items= - { - MENU_ITEM { command = EMemSpyCmdImagesListing; txt = "Output Listing"; }, - MENU_ITEM { command = EMemSpyCmdImagesSlideshow; txt = "Slideshow"; } -#ifndef __WINS__ - , - MENU_ITEM { command = EMemSpyCmdImagesSaveAllToMemoryCard; txt = "Save All to Memory Card"; } -#endif - }; - } - - - -RESOURCE MENU_PANE r_memspy_menupane_server_list_output - { - items= - { - MENU_ITEM { command = EMemSpyCmdServerListOutputListCSV; txt = "Listing"; }, - MENU_ITEM { command = EMemSpyCmdServerListOutputListDetailed; txt = "Detailed Listing"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_server_list_sort - { - items= - { - MENU_ITEM { command = EMemSpyCmdServerListSortByName; txt = "By Name"; }, - MENU_ITEM { command = EMemSpyCmdServerListSortBySessionCount; txt = "By Number of Sessions"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_server_list - { - items= - { - MENU_ITEM { command = EMemSpyCmdServerListOutput; txt = "Output"; cascade = r_memspy_menupane_server_list_output; }, - MENU_ITEM { command = EMemSpyCmdServerListSort; txt = "Sort"; cascade = r_memspy_menupane_server_list_sort; } - }; - } - - - -RESOURCE MENU_PANE r_memspy_menupane_chunk_list_sort - { - items= - { - MENU_ITEM { command = EMemSpyCmdChunkSortByName; txt = "By Name"; }, - MENU_ITEM { command = EMemSpyCmdChunkSortBySize; txt = "By Size"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_chunk_list - { - items= - { - MENU_ITEM { command = EMemSpyCmdChunkListing; txt = "Output Listing"; }, - MENU_ITEM { command = EMemSpyCmdChunkSort; txt = "Sort"; cascade = r_memspy_menupane_chunk_list_sort; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_codeseg_list_filter_by_capability - { - items= - { - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTCBProcess; txt = "TCB (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTCBAll; txt = "TCB (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithCommDDProcess; txt = "Comm DD (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithCommDDAll; txt = "Comm DD (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess; txt = "Power Mgmt (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll; txt = "Power Mgmt (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess; txt = "Multimedia DD (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll; txt = "Multimedia DD (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess; txt = "Read Device Data (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll; txt = "Read Device Data (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess; txt = "Write Device Data (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll; txt = "Write Device Data (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDRMProcess; txt = "DRM (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDRMAll; txt = "DRM (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess; txt = "Trusted UI (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTrustedUIAll; txt = "Trusted UI (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithProtServProcess; txt = "Prot Serv (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithProtServAll; txt = "Prot Serv (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess; txt = "Disk Admin (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDiskAdminAll; txt = "Disk Admin (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess; txt = "Network Ctrl (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkControlAll; txt = "Network Ctrl (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithAllFilesProcess; txt = "All Files (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithAllFilesAll; txt = "All Files (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSwEventProcess; txt = "SW Event (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSwEventAll; txt = "SW Event (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess; txt = "Network Serv (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll; txt = "Network Serv (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess; txt = "Local Serv (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocalServicesAll; txt = "Local Serv (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess; txt = "Read User Data (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadUserDataAll; txt = "Read User Data (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess; txt = "Write User Data (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll; txt = "Write User Data (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocationProcess; txt = "Location (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocationAll; txt = "Location (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess; txt = "Surroundings DD (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll; txt = "Surroundings DD (All)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithUserEnvProcess; txt = "User Env (Exe)"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithUserEnvAll; txt = "User Env (All)"; } - }; - } - - - -RESOURCE MENU_PANE r_memspy_menupane_codeseg_list_filter - { - items= - { - MENU_ITEM { command = EMemSpyCmdCodeSegShowItemsAll; txt = "None"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowItemsGlobalData; txt = "By Global Data"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShowCaps; txt = "By Capability"; cascade = r_memspy_menupane_codeseg_list_filter_by_capability; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_codeseg_list_sort - { - items= - { - MENU_ITEM { command = EMemSpyCmdCodeSegSortByName; txt = "By Name"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegSortByCodeSize; txt = "By Code Size"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegSortByDataSize; txt = "By Total Data Size"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegSortByUid; txt = "By Uid"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_codeseg_list - { - items= - { - MENU_ITEM { command = EMemSpyCmdCodeSegListing; txt = "Output Listing"; }, - MENU_ITEM { command = EMemSpyCmdCodeSegShow; txt = "Filter"; cascade = r_memspy_menupane_codeseg_list_filter; }, - MENU_ITEM { command = EMemSpyCmdCodeSegSort; txt = "Sort"; cascade = r_memspy_menupane_codeseg_list_sort; } - }; - } - - - - - -RESOURCE MENU_PANE r_memspy_menupane_active_objects - { - items= - { - MENU_ITEM { command = EMemSpyCmdActiveObjectListing; txt = "Output Listing"; } - }; - } - - - - -RESOURCE MENU_PANE r_memspy_menupane_ram - { - items= - { - MENU_ITEM { command = EMemSpyCmdRAMAvkonIconCacheDisabled; txt = "Disable Icon Cache"; }, - MENU_ITEM { command = EMemSpyCmdRAMAvkonIconCacheEnabled; txt = "Enable Icon Cache"; } - }; - } - - - - - - - - - - - - - - - - - - - - - - - - - -RESOURCE MENU_PANE r_memspy_menupane_kernel_containers - { - items= - { - MENU_ITEM { command = EMemSpyCmdKernelContainersOutput; txt = "Output list"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_kernel_objects - { - items= - { - MENU_ITEM { command = EMemSpyCmdKernelObjectTerminate; txt = "Terminate"; }, - MENU_ITEM { command = EMemSpyCmdKernelObjectSwitchTo; txt = "Switch to"; }, - MENU_ITEM { command = EMemSpyCmdKernelObjectEnd; txt = "End"; }, - MENU_ITEM { command = EMemSpyCmdKernelObjectPanic; txt = "Panic"; } - }; - } - - -RESOURCE MENU_PANE r_memspy_menupane_kernel_heap - { - items= - { - MENU_ITEM { command = EMemSpyCmdKernelHeapDump; txt = "Dump Heap"; } - }; - } - - - -RESOURCE MENU_PANE r_memspy_menupane_memory_tracking - { - items= - { - MENU_ITEM { command = EMemSpyCmdMemoryTrackingStart; txt = "Start"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingStop; txt = "Stop"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingTotalWithSharedMem; txt = "Include shared memory in Total"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingTotalWithoutSharedMem; txt = "Exclude shared memory from Total"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingHWMReset; txt = "Reset HWM"; } - }; - } - - - -RESOURCE MENU_PANE r_memspy_menupane_memory_tracking_hwm - { - items= - { - MENU_ITEM { command = EMemSpyCmdMemoryTrackingHWMReset; txt = "Reset"; } - }; - } - - - -RESOURCE MENU_PANE r_memspy_menupane_memory_tracking_autostart - { - items= - { - MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemAdd; txt = "Add"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemEdit; txt = "Edit"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemDelete; txt = "Remove"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll; txt = "Remove All"; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemImport; txt = "Import"; } - }; - } - - - - -RESOURCE MENU_PANE r_memspy_menupane_window_groups - { - items= - { - MENU_ITEM { command = EMemSpyCmdWindowGroupTerminate; txt = "Terminate"; }, - MENU_ITEM { command = EMemSpyCmdWindowGroupSwitchTo; txt = "Switch to"; }, - MENU_ITEM { command = EMemSpyCmdWindowGroupEnd; txt = "End"; }, - MENU_ITEM { command = EMemSpyCmdWindowGroupPanic; txt = "Panic"; } - }; - } - - - - - - - -RESOURCE MENU_PANE r_memspy_menupane - { - items= - { - // This item is visible if the view supports child views - MENU_ITEM { command = EMemSpyCmdOpen; txt = "Open"; }, - - // These are view-specific menu cascades that are not shown unless a specific view is open - MENU_ITEM { command = EMemSpyCmdServerList; txt = "Server List"; cascade = r_memspy_menupane_server_list; }, - MENU_ITEM { command = EMemSpyCmdChunk; txt = "Chunk"; cascade = r_memspy_menupane_chunk_list; }, - MENU_ITEM { command = EMemSpyCmdCodeSeg; txt = "Code Segment"; cascade = r_memspy_menupane_codeseg_list; }, - MENU_ITEM { command = EMemSpyCmdImages; txt = "Images"; cascade = r_memspy_menupane_images; }, - MENU_ITEM { command = EMemSpyCmdActiveObject; txt = "Active Object"; cascade = r_memspy_menupane_active_objects; }, - MENU_ITEM { command = EMemSpyCmdHeap; txt = "Heap"; cascade = r_memspy_menupane_heap; }, - MENU_ITEM { command = EMemSpyCmdStack; txt = "Stack"; cascade = r_memspy_menupane_stack; }, - MENU_ITEM { command = EMemSpyCmdRAM; txt = "RAM"; cascade = r_memspy_menupane_ram; }, - MENU_ITEM { command = EMemSpyCmdProcess; txt = "Process"; cascade = r_memspy_menupane_process; }, - MENU_ITEM { command = EMemSpyCmdThread; txt = "Thread"; cascade = r_memspy_menupane_thread; }, - MENU_ITEM { command = EMemSpyCmdKernelContainers; txt = "Kernel Objects"; cascade = r_memspy_menupane_kernel_containers; }, - MENU_ITEM { command = EMemSpyCmdKernelObjects; txt = "Kernel Object"; cascade = r_memspy_menupane_kernel_objects; }, - MENU_ITEM { command = EMemSpyCmdKernelHeap; txt = "Kernel Heap"; cascade = r_memspy_menupane_kernel_heap; }, - MENU_ITEM { command = EMemSpyCmdMemoryTracking; txt = "Memory Tracking"; cascade = r_memspy_menupane_memory_tracking; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingHWM; txt = "Memory HWM"; cascade = r_memspy_menupane_memory_tracking_hwm; }, - MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStart; txt = "Auto-Start Items"; cascade = r_memspy_menupane_memory_tracking_autostart; }, - MENU_ITEM { command = EMemSpyCmdWindowGroups; txt = "Window Group"; cascade = r_memspy_menupane_window_groups; }, - - // These are standard menu items that are always visible - MENU_ITEM { command = EMemSpyCmdView; txt = "View"; cascade = r_memspy_menupane_view; }, - MENU_ITEM { command = EMemSpyCmdTools; txt = "Tools"; cascade = r_memspy_menupane_tools; }, - MENU_ITEM { command = EMemSpyCmdPhoneInfo; txt = "Phone Information"; cascade = r_memspy_menupane_phone_info; }, - MENU_ITEM { command = EMemSpyCmdAutoCapture; txt = "Automatic Capture"; cascade = r_memspy_menupane_auto_capture; }, - - // About - MENU_ITEM { command = EMemSpyCmdToolsAbout; txt = "About"; }, - - // One or other is visible, depending on whether it is a top level menu item - MENU_ITEM { command = EAknSoftkeyBack; txt = "Back"; }, - MENU_ITEM { command = EAknCmdExit; txt = "Exit"; } - }; - } - - -RESOURCE DIALOG r_memspy_device_wide_operation_progress_dialog - { - title = "Performing operation.."; - flags = EAknProgressNoteFlags | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EMemSpyCtrlIdProgressNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - - -RESOURCE DIALOG r_memspy_export_to_memorycard_dialog - { - title = "Save Bitmaps to Memory Card"; - flags = EAknProgressNoteFlags | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EMemSpyCtrlIdProgressNote; - control = AVKON_NOTE - { - layout = EProgressLayout; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - }; - } - }; - } - - -RESOURCE DIALOG r_memspy_device_wide_settings - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = ENumberLayout; - label = "Frequency (seconds)"; - control = AVKON_INTEGER_EDWIN - { - min = 5; - max = 3600; - maxlength = 4; - }; - }; - } - }; - } - - -RESOURCE DIALOG r_memspy_preparing_info_item_container_wait_note - { - flags = EAknWaitNoteFlags | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_EMPTY; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EMemSpyCtrlIdWaitNote; - control = AVKON_NOTE - { - layout = EWaitLayout; - singular_label = "Preparing items..."; - imagefile = AVKON_ICON_FILE; - imageid = EMbmAvkonQgn_note_progress; - imagemask = EMbmAvkonQgn_note_progress_mask; - animation = R_QGN_GRAF_WAIT_BAR_ANIM; - }; - } - }; - } - - - - - -RESOURCE DIALOG r_memspy_image_slideshow - { - title = "Image Slideshow..."; - flags = EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons | EEikDialogFlagWait; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EEikCtImage; - id = EMemSpyCtrlIdSlideShowImage; - control = IMAGE - { - }; - } - }; - } - - - - - - -RESOURCE DIALOG r_memspy_heap_tracker_timer_period - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = ENumberLayout; - label = "Frequency (seconds)"; - control = AVKON_INTEGER_EDWIN - { - min = 30; - max = 3600; - maxlength = 4; - }; - }; - } - }; - } - - -RESOURCE DIALOG r_memspy_heap_tracker_name_filter - { - flags = EAknDialogGenericQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - label = "Thread Name Filter"; - control = EDWIN - { - flags = 0; - width = 8; - lines = 1; - maxlength = 16; - avkon_flags = EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly; - allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; - default_input_mode = EAknEditorTextInputMode; - }; - }; - } - }; - } - -RESOURCE DIALOG r_memspy_memory_tracking_process_uid_dialog - { - flags = EAknDialogGenericQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - label = "Process Uid (Hex)"; - control = EDWIN - { - flags = 0; - width = 8; - lines = 1; - maxlength = 8; - avkon_flags = EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly; - allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; - default_input_mode = EAknEditorNumericInputMode; - }; - }; - } - }; - } - - -RESOURCE DIALOG r_memspy_memory_tracking_import_from_installed_xml_dialog - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = "Import auto-start items\nfrom installed XML file?"; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - - -RESOURCE DIALOG r_memspy_memory_tracking_import_from_userdefined_xml_dialog - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = "Import auto-start items\nfrom custom XML file?"; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - - -RESOURCE DIALOG r_memspyui_about_dialog - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = "About MemSpy"; - headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - message = "Version 1.2.0 - 27th October 2009. Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. Licensed under Eclipse Public License v1.0."; - }; - } - }; - } - - - -RESOURCE DIALOG r_memspy_ram_memory_delta_dialog - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EGeneralLayout; - singular_label = "Memory Delta"; - animation = R_QGN_NOTE_INFO_ANIM; - }; - } - }; - } - - -RESOURCE DIALOG r_memspy_panic_system_critical_thread_or_process - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = "Terminating/killing/panicking item will cause a reboot.\nContinue?"; - animation = R_QGN_NOTE_QUERY_ANIM; - }; - } - }; - } - -RESOURCE DIALOG r_memspy_kernel_object_details_dialog - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = "Object details"; - headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - message = "."; - }; - } - }; - } - -RESOURCE AVKON_SETTING_PAGE r_memspyui_swmt_categories_setting_page - { - type = EAknSetListBox; - editor_resource_id = r_memspyui_swmt_categories_items_listbox; - label = "SWMT Categories"; - } - -RESOURCE LISTBOX r_memspyui_swmt_categories_items_listbox - { - flags = EAknListBoxMultipleSelection; - } - -// --------------------------------------------------------- -// -// RESOURCE LOCALISABLE_APP_INFO -// -// --------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_memspyui_localisable_app_info - { - short_caption = "MemSpy"; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = "MemSpy"; - - number_of_icons = 1; - - // Note for ROM-based apps it is recommended to add the drive letter - // icon_file = "z:"APP_BITMAP_DIR"\\myapp_aif.mif"; - icon_file = APP_BITMAP_DIR"\\memspyui_aif.mif"; - }; - } - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/data/memspyui_reg.rss --- a/memspyui/data/memspyui_reg.rss Mon Aug 23 15:50:54 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: -* -*/ - - -// System includes -#include -#include -#include - - - -UID2 KUidAppRegistrationResourceFile - -UID3 0x2002129F - - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "MemSpyUI"; - localisable_resource_file = APP_RESOURCE_DIR"\\MemSpyUI"; - localisable_resource_id = R_MEMSPYUI_LOCALISABLE_APP_INFO; - group_name = "RnD Tools"; - } diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/group/bld.inf --- a/memspyui/group/bld.inf Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 - -prj_platforms - -WINSCW GCCE ARMV5 ARMV6 - -#include "bld_generic.inf" - -#include "../ui/avkon/group/bld.inf" - -prj_mmpfiles - -prj_extensions \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/group/bld_generic.inf --- a/memspyui/group/bld_generic.inf Mon Aug 23 15:50:54 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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/group/group.pro --- a/memspyui/group/group.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -# -# 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 5db69f4c3d06 -r b048e15729d6 memspyui/group/memspyui_icons_aif.mk --- a/memspyui/group/memspyui_icons_aif.mk Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\memspyui_aif.mif - - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : - @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : $(ICONTARGETFILENAME) - -$(ICONTARGETFILENAME) : ..\icons\qgn_menu_memspyui.svg - mifconv $(ICONTARGETFILENAME) \ - /c8,8 ..\icons\qgn_menu_memspyui.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/group/memspyui_stub_sis.mk --- a/memspyui/group/memspyui_stub_sis.mk Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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: -# - - -TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install - -SISNAME=MemSpy_stub -PKGNAME=MemSpy_stub - -$(TARGETDIR) : - @perl -S emkdir.pl "$(TARGETDIR)" - -do_nothing : - rem do_nothing - -SISFILE=$(TARGETDIR)\$(SISNAME).sis - -$(SISFILE) : ..\sis\$(PKGNAME).pkg - makesis -s $? $@ - - - -MAKMAKE : do_nothing - -RESOURCE : do_nothing - -SAVESPACE : do_nothing - -BLD : do_nothing - -FREEZE : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -FINAL : $(TARGETDIR) $(SISFILE) - -CLEAN : - @if exist $(SISFILE) erase $(SISFILE) - -RELEASABLES : - @echo $(SISFILE) diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/icons/qgn_menu_memspyui.svg --- a/memspyui/icons/qgn_menu_memspyui.svg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,363 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/memspyui.pro --- a/memspyui/memspyui.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -# -# 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 5db69f4c3d06 -r b048e15729d6 memspyui/memspywindowserverhelper/bwins/memspywindowserverhelperu.def --- a/memspyui/memspywindowserverhelper/bwins/memspywindowserverhelperu.def Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -EXPORTS - ?WindowGroupListL@CMemSpyEngineHelperWindowServerImpl@@UAEPAVMMemSpyEngineWindowGroupList@@XZ @ 1 NONAME ; class MMemSpyEngineWindowGroupList * CMemSpyEngineHelperWindowServerImpl::WindowGroupListL(void) - ?ItemIndex@CMemSpyEngineWindowGroupListImpl@@UBEHABVTMemSpyEngineWindowGroupBasicInfo@@@Z @ 2 NONAME ; int CMemSpyEngineWindowGroupListImpl::ItemIndex(class TMemSpyEngineWindowGroupBasicInfo const &) const - ?NewMemSpyEngineHelperWindowServerImplL@@YAPAVMMemSpyEngineHelperWindowServer@@XZ @ 3 NONAME ; class MMemSpyEngineHelperWindowServer * NewMemSpyEngineHelperWindowServerImplL(void) - ?MdcaPoint@CMemSpyEngineWindowGroupListImpl@@UBE?AVTPtrC16@@H@Z @ 4 NONAME ; class TPtrC16 CMemSpyEngineWindowGroupListImpl::MdcaPoint(int) const - ?At@CMemSpyEngineWindowGroupListImpl@@UBEABVTMemSpyEngineWindowGroupBasicInfo@@H@Z @ 5 NONAME ; class TMemSpyEngineWindowGroupBasicInfo const & CMemSpyEngineWindowGroupListImpl::At(int) const - ?GetWindowGroupListL@CMemSpyEngineHelperWindowServerImpl@@UAEXAAV?$RArray@VTMemSpyEngineWindowGroupBasicInfo@@@@@Z @ 6 NONAME ; void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupListL(class RArray &) - ?Count@CMemSpyEngineWindowGroupListImpl@@UBEHXZ @ 7 NONAME ; int CMemSpyEngineWindowGroupListImpl::Count(void) const - ?SwitchToL@CMemSpyEngineHelperWindowServerImpl@@UAEXH@Z @ 8 NONAME ; void CMemSpyEngineHelperWindowServerImpl::SwitchToL(int) - ?GetWindowGroupDetailsL@CMemSpyEngineHelperWindowServerImpl@@UAEXHAAVTMemSpyEngineWindowGroupDetails@@@Z @ 9 NONAME ; void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupDetailsL(int, class TMemSpyEngineWindowGroupDetails &) - ?NewL@CMemSpyEngineHelperWindowServerImpl@@SAPAV1@XZ @ 10 NONAME ; class CMemSpyEngineHelperWindowServerImpl * CMemSpyEngineHelperWindowServerImpl::NewL(void) - ?MdcaCount@CMemSpyEngineWindowGroupListImpl@@UBEHXZ @ 11 NONAME ; int CMemSpyEngineWindowGroupListImpl::MdcaCount(void) const - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/memspywindowserverhelper/eabi/memspywindowserverhelperu.def --- a/memspyui/memspywindowserverhelper/eabi/memspywindowserverhelperu.def Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -EXPORTS - _Z38NewMemSpyEngineHelperWindowServerImplLv @ 1 NONAME - _ZN35CMemSpyEngineHelperWindowServerImpl16WindowGroupListLEv @ 2 NONAME - _ZN35CMemSpyEngineHelperWindowServerImpl19GetWindowGroupListLER6RArrayI33TMemSpyEngineWindowGroupBasicInfoE @ 3 NONAME - _ZN35CMemSpyEngineHelperWindowServerImpl22GetWindowGroupDetailsLEiR31TMemSpyEngineWindowGroupDetails @ 4 NONAME - _ZN35CMemSpyEngineHelperWindowServerImpl4NewLEv @ 5 NONAME - _ZN35CMemSpyEngineHelperWindowServerImpl9SwitchToLEi @ 6 NONAME - _ZNK32CMemSpyEngineWindowGroupListImpl2AtEi @ 7 NONAME - _ZNK32CMemSpyEngineWindowGroupListImpl5CountEv @ 8 NONAME - _ZNK32CMemSpyEngineWindowGroupListImpl9ItemIndexERK33TMemSpyEngineWindowGroupBasicInfo @ 9 NONAME - _ZNK32CMemSpyEngineWindowGroupListImpl9MdcaCountEv @ 10 NONAME - _ZNK32CMemSpyEngineWindowGroupListImpl9MdcaPointEi @ 11 NONAME - _ZThn4_N35CMemSpyEngineHelperWindowServerImpl16WindowGroupListLEv @ 12 NONAME - _ZThn4_N35CMemSpyEngineHelperWindowServerImpl19GetWindowGroupListLER6RArrayI33TMemSpyEngineWindowGroupBasicInfoE @ 13 NONAME - _ZThn4_N35CMemSpyEngineHelperWindowServerImpl22GetWindowGroupDetailsLEiR31TMemSpyEngineWindowGroupDetails @ 14 NONAME - _ZThn4_N35CMemSpyEngineHelperWindowServerImpl9SwitchToLEi @ 15 NONAME - _ZThn4_NK32CMemSpyEngineWindowGroupListImpl2AtEi @ 16 NONAME - _ZThn4_NK32CMemSpyEngineWindowGroupListImpl5CountEv @ 17 NONAME - _ZThn4_NK32CMemSpyEngineWindowGroupListImpl9ItemIndexERK33TMemSpyEngineWindowGroupBasicInfo @ 18 NONAME - _ZThn4_NK32CMemSpyEngineWindowGroupListImpl9MdcaCountEv @ 19 NONAME - _ZThn4_NK32CMemSpyEngineWindowGroupListImpl9MdcaPointEi @ 20 NONAME - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/memspywindowserverhelper/group/bld.inf --- a/memspyui/memspywindowserverhelper/group/bld.inf Mon Aug 23 15:50:54 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: Build information file for MemSpyWindowServerHelper -* -*/ - - -PRJ_PLATFORMS - -PRJ_EXPORTS - -PRJ_MMPFILES -memspywindowserverhelper.mmp - - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/memspywindowserverhelper/group/memspywindowserverhelper.mmp --- a/memspyui/memspywindowserverhelper/group/memspywindowserverhelper.mmp Mon Aug 23 15:50:54 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: DLL implementing the MMemSpyEngineHelperWindowServer Interface -* -*/ - - -#include - -TARGET memspywindowserverhelper.dll -TARGETTYPE dll -UID 0x1000008D 0x20028783 -VENDORID VID_DEFAULT -SMPSAFE - -CAPABILITY ALL -TCB - -SOURCEPATH ../src -SOURCE MemSpyEngineHelperWindowServerImpl.cpp - -USERINCLUDE ../inc -APP_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib -LIBRARY ws32.lib apgrfx.lib - - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/memspywindowserverhelper/inc/MemSpyEngineHelperWindowServerImpl.h --- a/memspyui/memspywindowserverhelper/inc/MemSpyEngineHelperWindowServerImpl.h Mon Aug 23 15:50:54 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: -* -*/ - -#ifndef MEMSPYENGINEHELPERWINDOWSERVERIMPL_H -#define MEMSPYENGINEHELPERWINDOWSERVERIMPL_H - -// System includes -#include -#include - - -// User includes -#include - - -// Classes referenced - - -NONSHARABLE_CLASS( CMemSpyEngineHelperWindowServerImpl ) : public CBase, public MMemSpyEngineHelperWindowServer - { -public: - IMPORT_C static CMemSpyEngineHelperWindowServerImpl* NewL(); - virtual ~CMemSpyEngineHelperWindowServerImpl(); - -private: - CMemSpyEngineHelperWindowServerImpl(); - void ConstructL(); - -public: // API - IMPORT_C MMemSpyEngineWindowGroupList* WindowGroupListL(); - IMPORT_C void GetWindowGroupListL( RArray& aWindowGroups ); - IMPORT_C void GetWindowGroupDetailsL( TInt aWindowGroupId, TMemSpyEngineWindowGroupDetails& aWindowGroupDetails ); - IMPORT_C void SwitchToL( TInt aWindowGroupId ); - -private: - RWsSession iWsSession; - }; - - - - -NONSHARABLE_CLASS( CMemSpyEngineWindowGroupListImpl ) : public CBase, public MMemSpyEngineWindowGroupList - { -public: - static CMemSpyEngineWindowGroupListImpl* NewLC(); - virtual ~CMemSpyEngineWindowGroupListImpl(); - -private: - CMemSpyEngineWindowGroupListImpl(); - void ConstructL(); - -public: // API - IMPORT_C TInt Count() const; - IMPORT_C const TMemSpyEngineWindowGroupBasicInfo& At( TInt aIndex ) const; - IMPORT_C TInt ItemIndex( const TMemSpyEngineWindowGroupBasicInfo& aEntry ) const; - -public: // But not exported - void AddItemL( TMemSpyEngineWindowGroupBasicInfo& aItem ); - -public: // From MDesCArray - IMPORT_C TInt MdcaCount() const; - IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const; - -private: // Data members - RArray iItems; - }; - - -#endif diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/memspywindowserverhelper/src/MemSpyEngineHelperWindowServerImpl.cpp --- a/memspyui/memspywindowserverhelper/src/MemSpyEngineHelperWindowServerImpl.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +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 "MemSpyEngineHelperWindowServerImpl.h" - -// System includes -#include -#include - -// ============================= LOCAL FUNCTIONS =============================== - -EXPORT_C MMemSpyEngineHelperWindowServer* NewMemSpyEngineHelperWindowServerImplL() - { - return CMemSpyEngineHelperWindowServerImpl::NewL(); - } - - -// ============================ MEMBER FUNCTIONS =============================== - -CMemSpyEngineHelperWindowServerImpl::CMemSpyEngineHelperWindowServerImpl() - { - } - - -CMemSpyEngineHelperWindowServerImpl::~CMemSpyEngineHelperWindowServerImpl() - { - iWsSession.Close(); - } - - -void CMemSpyEngineHelperWindowServerImpl::ConstructL() - { - User::LeaveIfError( iWsSession.Connect() ); - } - - -EXPORT_C CMemSpyEngineHelperWindowServerImpl* CMemSpyEngineHelperWindowServerImpl::NewL() - { - CMemSpyEngineHelperWindowServerImpl* self = new(ELeave) CMemSpyEngineHelperWindowServerImpl(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - - -EXPORT_C MMemSpyEngineWindowGroupList* CMemSpyEngineHelperWindowServerImpl::WindowGroupListL() - { - CMemSpyEngineWindowGroupListImpl* list = CMemSpyEngineWindowGroupListImpl::NewLC(); - // - RArray groups; - CleanupClosePushL( groups ); - // - GetWindowGroupListL( groups ); - // - const TInt count = groups.Count(); - for( TInt i = 0; i < count; i++ ) - { - list->AddItemL( groups[ i ] ); - } - // - CleanupStack::PopAndDestroy( &groups ); - - // Done - CleanupStack::Pop( list ); - return list; - } - - -EXPORT_C void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupListL( RArray& aWindowGroups ) - { - TInt count; - User::LeaveIfError( count = iWsSession.NumWindowGroups() ); - RArray array; - CleanupClosePushL( array ); - User::LeaveIfError( iWsSession.WindowGroupList( &array ) ); - for (TInt i =0; i < count; i++ ) - { - TMemSpyEngineWindowGroupBasicInfo group; - group.iId = array[i].iId; - TThreadId threadId; - RThread thread; - iWsSession.GetWindowGroupClientThreadId( array[i].iId, threadId ); - group.iThreadId = threadId; - group.iOrdinalPosition = i; - if ( !thread.Open( threadId ) ) - { - _LIT( KLineFormatSpec, "%d\t%S" ); - group.iFullName.Format( KLineFormatSpec, group.iId, &thread.Name() ); - } - else - { - _LIT( KLineFormatSpec, "%d\t" ); - group.iFullName.Format( KLineFormatSpec, group.iId ); - } - thread.Close(); - aWindowGroups.AppendL( group ); - } - CleanupStack::PopAndDestroy( &array ); - } - - -EXPORT_C void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupDetailsL( TInt aWindowGroupId, TMemSpyEngineWindowGroupDetails& aWindowGroupDetails ) - { - TThreadId threadId; - RThread thread; - iWsSession.GetWindowGroupClientThreadId( aWindowGroupId, threadId ); - aWindowGroupDetails.iThreadId = threadId; - aWindowGroupDetails.iId = aWindowGroupId; - if ( !thread.Open( threadId ) ) - { - aWindowGroupDetails.iFullName.Copy( thread.Name() ); - } - else - { - aWindowGroupDetails.iFullName.Copy( _L("") ); - } - thread.Close(); - aWindowGroupDetails.iPriority = iWsSession.GetWindowGroupOrdinalPriority( aWindowGroupId ); - aWindowGroupDetails.iWindowGroupHandle = iWsSession.GetWindowGroupHandle( aWindowGroupId ); - CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( iWsSession, aWindowGroupId ); - aWindowGroupDetails.iUID = wgName->AppUid(); - aWindowGroupDetails.iIsBusy = wgName->IsBusy(); - aWindowGroupDetails.iIsSystem = wgName->IsSystem(); - aWindowGroupDetails.iIsHidden = wgName->Hidden(); - aWindowGroupDetails.iCaption = wgName->Caption(); - aWindowGroupDetails.iDocName = wgName->DocName(); - CleanupStack::PopAndDestroy( wgName ); - } - - -EXPORT_C void CMemSpyEngineHelperWindowServerImpl::SwitchToL( TInt aWindowGroupId ) - { - TApaTask task( iWsSession ); - CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( iWsSession, aWindowGroupId ); - task.SetWgId( aWindowGroupId ); - if ( wgName->Hidden() ) - { - User::Leave( KErrGeneral ); - } - if ( !task.Exists() ) - { - User::Leave( KErrNotFound ); - } - task.BringToForeground(); - CleanupStack::PopAndDestroy( wgName ); - } - - - - - - - - - -CMemSpyEngineWindowGroupListImpl::CMemSpyEngineWindowGroupListImpl() - { - } - - -CMemSpyEngineWindowGroupListImpl::~CMemSpyEngineWindowGroupListImpl() - { - iItems.Close(); - } - - -void CMemSpyEngineWindowGroupListImpl::ConstructL() - { - } - - -CMemSpyEngineWindowGroupListImpl* CMemSpyEngineWindowGroupListImpl::NewLC() - { - CMemSpyEngineWindowGroupListImpl* self = new(ELeave) CMemSpyEngineWindowGroupListImpl(); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - - -EXPORT_C TInt CMemSpyEngineWindowGroupListImpl::Count() const - { - return iItems.Count(); - } - - -EXPORT_C const TMemSpyEngineWindowGroupBasicInfo& CMemSpyEngineWindowGroupListImpl::At( TInt aIndex ) const - { - return iItems[ aIndex ]; - } - - -EXPORT_C TInt CMemSpyEngineWindowGroupListImpl::ItemIndex( const TMemSpyEngineWindowGroupBasicInfo& /*aEntry*/ ) const - { - TInt ret = KErrNotFound; - return ret; - } - - -void CMemSpyEngineWindowGroupListImpl::AddItemL( TMemSpyEngineWindowGroupBasicInfo& aItem ) - { - iItems.AppendL( aItem ); - } - - -EXPORT_C TInt CMemSpyEngineWindowGroupListImpl::MdcaCount() const - { - return Count(); - } - - -EXPORT_C TPtrC CMemSpyEngineWindowGroupListImpl::MdcaPoint( TInt aIndex ) const - { - return TPtrC( At( aIndex ).iFullName ); - } - - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/rom/memspyui.iby --- a/memspyui/rom/memspyui.iby Mon Aug 23 15:50:54 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 MEMSPYUI_IBY -#define MEMSPYUI_IBY - - -S60_APP_EXE(MemSpyUI) -S60_APP_AIF_ICONS(MemSpyUI) -S60_APP_RESOURCE(MemSpyUI) -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 -data=ZPRIVATE\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml \private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml - -// Stub SIS -data=ZSYSTEM\Install\MemSpy_stub.sis \system\install\MemSpy_stub.sis - -// MemSpyWindowServerHelper -file=ABI_DIR\BUILD_DIR\memspywindowserverhelper.dll SHARED_LIB_DIR\memspywindowserverhelper.dll - -#endif diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/sis/MemSpy_S60-50.pkg --- a/memspyui/sis/MemSpy_S60-50.pkg Mon Aug 23 15:50:54 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: -; - - -; Language - standard language definitions -&EN - -; Standard SIS file header -#{"MemSpy"},(0x2002129F),1,2,0,TYPE=SA - -; Supports S60 v 5.0 -[0x1028315F], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; Engine: -"\epoc32\release\armv5\urel\MemSpyDriver.ldd"-"!:\sys\bin\MemSpyDriver.ldd" -"\epoc32\release\armv5\urel\MemSpyDriverClient.dll"-"!:\sys\bin\MemSpyDriverClient.dll" -"\epoc32\release\armv5\urel\MemSpyEngine.dll"-"!:\sys\bin\MemSpyEngine.dll" -"\epoc32\release\armv5\urel\MemSpy.exe"-"!:\sys\bin\MemSpy.exe" -"\epoc32\release\armv5\urel\MemSpyConsole.exe"-"!:\sys\bin\MemSpyConsole.exe" -"\epoc32\data\z\private\2002129E\MemSpyEComInterfaceIds.xml"-"c:\private\2002129E\MemSpyEComInterfaceIds.xml" -"\epoc32\data\z\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml" - -; UI: -"\epoc32\release\armv5\urel\MemSpyUI.exe"-"!:\sys\bin\MemSpyUI.exe" -"\epoc32\data\z\Resource\apps\MemSpyUI_aif.mif"-"!:\Resource\Apps\MemSpyUI_aif.mif" -"\epoc32\data\z\Resource\apps\MemSpyUI.rsc"-"!:\Resource\Apps\MemSpyUI.rsc" -"\epoc32\data\z\private\10003A3F\apps\MemSpyUI_reg.rsc"-"!:\private\10003a3f\import\apps\MemSpyUI_reg.rsc" -"\epoc32\data\z\private\2002129F\MemSpyEComInterfaceIds.xml"-"c:\private\2002129F\MemSpyEComInterfaceIds.xml" -"\epoc32\data\z\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml" -"\epoc32\release\armv5\urel\memspywindowserverhelper.dll"-"!:\sys\bin\memspywindowserverhelper.dll" diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/sis/MemSpy_S60-50.sis Binary file memspyui/sis/MemSpy_S60-50.sis has changed diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/sis/MemSpy_S60-52.pkg --- a/memspyui/sis/MemSpy_S60-52.pkg Mon Aug 23 15:50:54 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: -; - - -; Language - standard language definitions -&EN - -; Standard SIS file header -#{"MemSpy"},(0x2002129F),1,2,0,TYPE=SA - -; Supports S60 v 5.2 -[0x20022E6D], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; Engine: -"\epoc32\release\armv5\urel\MemSpyDriver.ldd"-"!:\sys\bin\MemSpyDriver.ldd" -"\epoc32\release\armv5\urel\MemSpyDriverClient.dll"-"!:\sys\bin\MemSpyDriverClient.dll" -"\epoc32\release\armv5\urel\MemSpyEngine.dll"-"!:\sys\bin\MemSpyEngine.dll" -"\epoc32\release\armv5\urel\MemSpy.exe"-"!:\sys\bin\MemSpy.exe" -"\epoc32\release\armv5\urel\MemSpyConsole.exe"-"!:\sys\bin\MemSpyConsole.exe" -"\epoc32\data\z\private\2002129E\MemSpyEComInterfaceIds.xml"-"c:\private\2002129E\MemSpyEComInterfaceIds.xml" -"\epoc32\data\z\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml" - -; UI: -"\epoc32\release\armv5\urel\MemSpyUI.exe"-"!:\sys\bin\MemSpyUI.exe" -"\epoc32\data\z\Resource\apps\MemSpyUI_aif.mif"-"!:\Resource\Apps\MemSpyUI_aif.mif" -"\epoc32\data\z\Resource\apps\MemSpyUI.rsc"-"!:\Resource\Apps\MemSpyUI.rsc" -"\epoc32\data\z\private\10003A3F\apps\MemSpyUI_reg.rsc"-"!:\private\10003a3f\import\apps\MemSpyUI_reg.rsc" -"\epoc32\data\z\private\2002129F\MemSpyEComInterfaceIds.xml"-"c:\private\2002129F\MemSpyEComInterfaceIds.xml" -"\epoc32\data\z\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml" -"\epoc32\release\armv5\urel\memspywindowserverhelper.dll"-"!:\sys\bin\memspywindowserverhelper.dll" diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/sis/MemSpy_S60-52.sis Binary file memspyui/sis/MemSpy_S60-52.sis has changed diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/sis/MemSpy_stub.pkg --- a/memspyui/sis/MemSpy_stub.pkg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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: -; - - -; Language - standard language definitions -&EN - -; Standard SIS file header -#{"MemSpyUI"},(0x2002129F),1,0,0 - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; Engine: -""-"z:\sys\bin\MemSpyDriver.ldd" -""-"z:\sys\bin\MemSpyDriverClient.dll" -""-"z:\sys\bin\MemSpyEngine.dll" -""-"z:\sys\bin\MemSpy.exe" -""-"z:\sys\bin\MemSpyConsole.exe" -""-"z:\private\2002129E\MemSpyEComInterfaceIds.xml" -""-"z:\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml" - -; UI: -""-"z:\sys\bin\MemSpyUI.exe" -""-"z:\Resource\Apps\MemSpyUI_aif.mif" -""-"z:\Resource\Apps\MemSpyUI.rsc" -""-"z:\private\10003a3f\import\apps\MemSpyUI_reg.rsc" -""-"z:\private\2002129F\MemSpyEComInterfaceIds.xml" -""-"z:\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml" -""-"z:\sys\bin\memspywindowserverhelper.dll" diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/group/MemSpyCapabilities.mmh --- a/memspyui/ui/avkon/group/MemSpyCapabilities.mmh Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/group/bld.inf --- a/memspyui/ui/avkon/group/bld.inf Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 - -PRJ_MMPFILES -memspyui.mmp diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/group/memspyui.mmp --- a/memspyui/ui/avkon/group/memspyui.mmp Mon Aug 23 15:50:54 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: -* -*/ - - -#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/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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpy.hrh --- a/memspyui/ui/avkon/inc/MemSpy.hrh Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyApp.h --- a/memspyui/ui/avkon/inc/MemSpyApp.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyAppUi.h --- a/memspyui/ui/avkon/inc/MemSpyAppUi.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyContainer.h --- a/memspyui/ui/avkon/inc/MemSpyContainer.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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; -//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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyContainerObserver.h --- a/memspyui/ui/avkon/inc/MemSpyContainerObserver.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h --- a/memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyDocument.h --- a/memspyui/ui/avkon/inc/MemSpyDocument.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyExportBitmapsToMemoryCardDialog.h --- a/memspyui/ui/avkon/inc/MemSpyExportBitmapsToMemoryCardDialog.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpySettings.h --- a/memspyui/ui/avkon/inc/MemSpySettings.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyUiUtils.h --- a/memspyui/ui/avkon/inc/MemSpyUiUtils.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewBase.h --- a/memspyui/ui/avkon/inc/MemSpyViewBase.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewChunkList.h --- a/memspyui/ui/avkon/inc/MemSpyViewChunkList.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewCodeSegList.h --- a/memspyui/ui/avkon/inc/MemSpyViewCodeSegList.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewDriveInfo.h --- a/memspyui/ui/avkon/inc/MemSpyViewDriveInfo.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewECom.h --- a/memspyui/ui/avkon/inc/MemSpyViewECom.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewFBServBitmaps.h --- a/memspyui/ui/avkon/inc/MemSpyViewFBServBitmaps.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewHeapTracking.h --- a/memspyui/ui/avkon/inc/MemSpyViewHeapTracking.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewHeapTrackingResults.h --- a/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingResults.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewHeapTrackingSettings.h --- a/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingSettings.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewKernel.h --- a/memspyui/ui/avkon/inc/MemSpyViewKernel.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewKernelContainers.h --- a/memspyui/ui/avkon/inc/MemSpyViewKernelContainers.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewKernelHeap.h --- a/memspyui/ui/avkon/inc/MemSpyViewKernelHeap.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +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" -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h --- a/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewMainMenu.h --- a/memspyui/ui/avkon/inc/MemSpyViewMainMenu.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewMemoryTrackingAutoStartConfig.h --- a/memspyui/ui/avkon/inc/MemSpyViewMemoryTrackingAutoStartConfig.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewObserver.h --- a/memspyui/ui/avkon/inc/MemSpyViewObserver.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewOpenFiles.h --- a/memspyui/ui/avkon/inc/MemSpyViewOpenFiles.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewProcesses.h --- a/memspyui/ui/avkon/inc/MemSpyViewProcesses.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +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" - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewRAMInfo.h --- a/memspyui/ui/avkon/inc/MemSpyViewRAMInfo.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewROMInfo.h --- a/memspyui/ui/avkon/inc/MemSpyViewROMInfo.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewServerList.h --- a/memspyui/ui/avkon/inc/MemSpyViewServerList.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewSystemConfig.h --- a/memspyui/ui/avkon/inc/MemSpyViewSystemConfig.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h Mon Aug 23 15:50:54 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: -* -*/ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemMemoryTracking.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemMemoryTracking.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewThreads.h --- a/memspyui/ui/avkon/inc/MemSpyViewThreads.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +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" - -#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 ); - -private: // Member data - //CMemSpyProcess& iParentProcess; - //CMemSpyThread* iCurrentThread; - TThreadId iCurrentThreadId; - TProcessId iParentProcessId; - - RArray iThreads; - CDesCArrayFlat* iModel; - }; - - -#endif diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewType.h --- a/memspyui/ui/avkon/inc/MemSpyViewType.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/MemSpyViewWindowGroups.h --- a/memspyui/ui/avkon/inc/MemSpyViewWindowGroups.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/inc/viewcli.h --- a/memspyui/ui/avkon/inc/viewcli.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyApp.cpp --- a/memspyui/ui/avkon/src/MemSpyApp.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyAppUi.cpp --- a/memspyui/ui/avkon/src/MemSpyAppUi.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,763 +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 -//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 ) - { - /* TODO - //const TMemSpySinkType currentSink = iEngine.SinkType(); - const TMemSpySinkType currentSink = iMemSpySession.GetSinkType(); - 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.SwitchOutputSink( ESinkTypeDebug ); //set in engine - MemSpyDocument().Settings().SetSinkType( ESinkTypeDebug ); //set in settings - } - - -void CMemSpyAppUi::OnCmdOutputToFileL() - { - iMemSpySession.SwitchOutputSink( 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyContainer.cpp --- a/memspyui/ui/avkon/src/MemSpyContainer.cpp Mon Aug 23 15:50:54 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 "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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp --- a/memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,387 +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 - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyDocument.cpp --- a/memspyui/ui/avkon/src/MemSpyDocument.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +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" - -//cigasto -#include - - -CMemSpyDocument::CMemSpyDocument(CEikApplication& aApp) -: CAknDocument(aApp) - { - } - - -CMemSpyDocument::~CMemSpyDocument() - { - delete iSettings; - //delete iEngine; - if( iMemSpySession ) - { - 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyExportBitmapsToMemoryCardDialog.cpp --- a/memspyui/ui/avkon/src/MemSpyExportBitmapsToMemoryCardDialog.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpySettings.cpp --- a/memspyui/ui/avkon/src/MemSpySettings.cpp Mon Aug 23 15:50:54 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 "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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyUiUtils.cpp --- a/memspyui/ui/avkon/src/MemSpyUiUtils.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,367 +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 ); - } - } - -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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewBase.cpp --- a/memspyui/ui/avkon/src/MemSpyViewBase.cpp Mon Aug 23 15:50:54 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 "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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewChunkList.cpp --- a/memspyui/ui/avkon/src/MemSpyViewChunkList.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewCodeSegList.cpp --- a/memspyui/ui/avkon/src/MemSpyViewCodeSegList.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewDriveInfo.cpp --- a/memspyui/ui/avkon/src/MemSpyViewDriveInfo.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewECom.cpp --- a/memspyui/ui/avkon/src/MemSpyViewECom.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewFBServBitmaps.cpp --- a/memspyui/ui/avkon/src/MemSpyViewFBServBitmaps.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewHeapTracking.cpp --- a/memspyui/ui/avkon/src/MemSpyViewHeapTracking.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewHeapTrackingResults.cpp --- a/memspyui/ui/avkon/src/MemSpyViewHeapTrackingResults.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewHeapTrackingSettings.cpp --- a/memspyui/ui/avkon/src/MemSpyViewHeapTrackingSettings.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewKernel.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernel.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,170 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +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 - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,424 +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 - -#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* ret = new (ELeave) CDesC16ArrayFlat( 2 ); - - _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* iItem = HBufC::NewL( KMaxName ); - - iItem = FormatItem( KItem0, aHeap->Type() ); - TPtr pItem( iItem->Des() ); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem1, aHeap->Size() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - TUint address( aHeap->BaseAddress() ); - iItem = FormatItem( KItem8b, address ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - if(aHeap->Shared()) //Yes / No value formatting - iItem = FormatItem( KItem1b, KMemSpyCaptionYes ); - else - iItem = FormatItem( KItem1b, KMemSpyCaptionNo ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem2, aHeap->ChunkSize() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem3, aHeap->AllocationsCount() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem4, aHeap->FreeCount() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem5, aHeap->BiggestAllocation() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem6, aHeap->BiggestFree() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem6a, aHeap->TotalAllocations() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem6b, aHeap->TotalFree() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem7, aHeap->SlackFreeSpace() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - TReal iOneHundred( aHeap->Size() ); - TReal iValue( aHeap->Fragmentation() ); - iItem = FormatPercentageItem( KItem8a, iOneHundred, iValue ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem13, aHeap->HeaderSizeA() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem14, aHeap->HeaderSizeF() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem9a, aHeap->AllocationOverhead() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem9b, aHeap->FreeOverhead() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem9c, aHeap->TotalOverhead() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - TReal iOverhead( aHeap->Overhead() ); - iItem = FormatPercentageItem( KItem9d, iOneHundred, iOverhead ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem10, aHeap->MinLength() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - iItem = FormatItem( KItem11, aHeap->MaxLength() ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - if( aHeap->DebugAllocatorLibrary() ) - iItem = FormatItem( KItem12, KMemSpyCaptionYes ); - else - iItem = FormatItem( KItem12, KMemSpyCaptionNo ); - pItem = iItem->Des(); - ret->AppendL( pItem ); - pItem.Zero(); - - return ret; - } - -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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp --- a/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,923 +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 - -#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() ); //array for formated items - - 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; - - //CMemSpyEngineObjectContainer& container = iEngine.Container(); - //TThreadId id( iObjectList->At( iListBox->CurrentItemIndex() ).iId ); - TThreadId id( iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Id() ); //get id of the current thread - - iMemSpySession.ThreadSystemPermanentOrCritical( id, err ); - - // Try to find the thread in question... - //CMemSpyProcess* process = NULL; - //CMemSpyThread* thread = NULL; - //User::LeaveIfError( container.ProcessAndThreadByThreadId( id, process, thread ) ); // - - if( err ) - { - CAknQueryDialog* importDialog = CAknQueryDialog::NewL(); - doTerminate = ( importDialog->ExecuteLD( R_MEMSPY_PANIC_SYSTEM_CRITICAL_THREAD_OR_PROCESS ) ); - - if ( doTerminate ) - { - iMemSpySession.EndThread( id, ETerminate ); - RefreshL(); - } - } - - /* - 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(); - } - } - */ - 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.EndProcess( id, ETerminate ); - RefreshL(); - } - } - - // 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() - { - 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.EndThread( 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 ) - { - 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 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.EndProcess( 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 ); - 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 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.EndThread( 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.EndProcess( id, EPanic ); - RefreshL(); - } - } - - break; - } - default: - { - // Programming error - __ASSERT_ALWAYS( EFalse, User::Panic( _L("MemSpy-View"), 0 ) ); - } - } - } - - -void CMemSpyViewKernelObjects::CreateTabsL() - { - TMemSpyDriverContainerType type = iKernelObjectItems[ iListBox->CurrentItemIndex() ]->Type(); - 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 ); - /* 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 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 ); - /* 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 ) ); - } - } - - 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewMainMenu.cpp --- a/memspyui/ui/avkon/src/MemSpyViewMainMenu.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,317 +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 ) - { - } -*/ -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) 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 ); - - // 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(KItem2Format, "\tKernel"); - model->AppendL( KItem2Format ); - /* - // 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 = 1 ; - 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewMemoryTrackingAutoStartConfig.cpp --- a/memspyui/ui/avkon/src/MemSpyViewMemoryTrackingAutoStartConfig.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewOpenFiles.cpp --- a/memspyui/ui/avkon/src/MemSpyViewOpenFiles.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewProcesses.cpp --- a/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,687 +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 -#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 ); - // - 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() ) - { - CMemSpyProcess& process = CurrentProcess(); - //const TBool hide = ( iEngine.Container().Count() == 0 ) || process.IsDead(); //TODO - // - const TBool hide = EFalse; //to replace - - 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() - { - 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 - - /* - for( TInt i=0; i < iProcesses.Count(); i++ ) - { - HBufC* tempName = HBufC::NewL( iProcesses[i]->Name().Length() + 16 ); - CleanupStack::PushL( tempName ); - TPtr tempNamePtr( tempName->Des() ); - tempNamePtr.Copy( KTab ); - tempNamePtr.Append( iProcesses[i]->Name() ); - iModel->AppendL( tempNamePtr ); - - CleanupStack::PopAndDestroy( tempName ); - } - */ - 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 ) - {/* - 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; - } - */ - } - -//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; - } -/* -void CMemSpyViewProcesses::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 CMemSpyViewProcesses::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 CMemSpyViewProcesses::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; - } - } -*/ - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewRAMInfo.cpp --- a/memspyui/ui/avkon/src/MemSpyViewRAMInfo.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewROMInfo.cpp --- a/memspyui/ui/avkon/src/MemSpyViewROMInfo.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewServerList.cpp --- a/memspyui/ui/avkon/src/MemSpyViewServerList.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewSystemConfig.cpp --- a/memspyui/ui/avkon/src/MemSpyViewSystemConfig.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,248 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp Mon Aug 23 15:50:54 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( 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp Mon Aug 23 15:50:54 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( 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp Mon Aug 23 15:50:54 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: -* -*/ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +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 -#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 ); - - iModel = new (ELeave) CDesC16ArrayFlat( iThreadInfoItems.Count() + 10 ); - - for( TInt i=0; iCaption().Length() + iThreadInfoItems[i]->Value().Length() + 30 ); - /* - else if ( combined->Des().MaxLength() < requiredLength ) - { - combined = combined->ReAllocL( requiredLength ); - }*/ - - 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 ); - } - - 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp Mon Aug 23 15:50:54 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: -* -*/ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp Mon Aug 23 15:50:54 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 "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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,394 +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( 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewThreads.cpp --- a/memspyui/ui/avkon/src/MemSpyViewThreads.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,377 +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 -#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 ) - { - iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); - - _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 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() - { - iMemSpySession.OutputThreadInfoHandlesL( iCurrentThreadId ); - } - - -void CMemSpyViewThreads::SetListBoxModelL() - { - //iMemSpySession.GetThreadsL( iParentProcessId, iThreads ); - - iModel = new (ELeave) CDesC16ArrayFlat( iThreads.Count() ); //array for formated items - - _LIT( KTab, "\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() ); - 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 ); - } - - - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewType.cpp --- a/memspyui/ui/avkon/src/MemSpyViewType.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp --- a/memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,316 +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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/hb.pro --- a/memspyui/ui/hb/hb.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -# -# 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 - -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 - -RESOURCES += - -symbian: { - LIBS += -lestor \ - -lbafl \ - -lMemSpyClient - - 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/enginewrapper.h --- a/memspyui/ui/hb/inc/enginewrapper.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,529 +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 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 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); - - 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(); - -private: - RMemSpySession mSession; - - bool mSwmtRunning; - - MemSpySettings mSettings; -}; - -#endif /* ENGINEWRAPPER_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspyheapdumpsview.h --- a/memspyui/ui/hb/inc/memspyheapdumpsview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspykernelobjectdetailview.h --- a/memspyui/ui/hb/inc/memspykernelobjectdetailview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspykernelobjecttypeview.h --- a/memspyui/ui/hb/inc/memspykernelobjecttypeview.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspykernelobjectview.h --- a/memspyui/ui/hb/inc/memspykernelobjectview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspylistview.h --- a/memspyui/ui/hb/inc/memspylistview.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspymainview.h --- a/memspyui/ui/hb/inc/memspymainview.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspyprocessview.h --- a/memspyui/ui/hb/inc/memspyprocessview.h Mon Aug 23 15:50:54 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 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); - -private: - MemSpyProcessModel* mModel; -}; - -#endif /* MEMSPYPROCESSVIEW_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspysettingsview.h --- a/memspyui/ui/hb/inc/memspysettingsview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspyswmtview.h --- a/memspyui/ui/hb/inc/memspyswmtview.h Mon Aug 23 15:50:54 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: - * - */ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspythreaddetailindexview.h --- a/memspyui/ui/hb/inc/memspythreaddetailindexview.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspythreaddetailview.h --- a/memspyui/ui/hb/inc/memspythreaddetailview.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspythreadview.h --- a/memspyui/ui/hb/inc/memspythreadview.h Mon Aug 23 15:50:54 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: - * - */ - -#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; - -private slots: - void itemClicked(const QModelIndex& index); - void catchLongPress(HbAbstractViewItem *item, const QPointF &coords); - void changePriority(); - -private: - HbMenu* mContextMenu; - HbMenu* mPriorityMenu; - ThreadId mThreadId; - QString mProcessName; - - MemSpyThreadModel* mModel; -}; - -#endif /* MEMSPYTHREADVIEW_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspytrackingview.h --- a/memspyui/ui/hb/inc/memspytrackingview.h Mon Aug 23 15:50:54 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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/memspyview.h --- a/memspyui/ui/hb/inc/memspyview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +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 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/inc/viewmanager.h --- a/memspyui/ui/hb/inc/viewmanager.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +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 VIEWMANAGER_H_ -#define VIEWMANAGER_H_ - - -#include -#include - -enum ViewIndex { - MainView, - ProcessView, - ThreadView, - ThreadDetailIndexView, - ThreadDetailView, - KernelObjectTypeView, - KernelObjectView, - KernelObjectDetailView, - TrackingView, - SwmtView, - HeapDumpsView -}; - -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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/enginewrapper.cpp --- a/memspyui/ui/hb/src/enginewrapper.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,506 +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 "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(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)); - } - - } -} diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/main.cpp --- a/memspyui/ui/hb/src/main.cpp Mon Aug 23 15:50:54 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: -* -*/ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspyheapdumpsview.cpp --- a/memspyui/ui/hb/src/memspyheapdumpsview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,184 +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 -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspykernelobjectdetailview.cpp --- a/memspyui/ui/hb/src/memspykernelobjectdetailview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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 "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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspykernelobjecttypeview.cpp --- a/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +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 "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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspykernelobjectview.cpp --- a/memspyui/ui/hb/src/memspykernelobjectview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +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 "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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspylistview.cpp --- a/memspyui/ui/hb/src/memspylistview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +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 "memspylistview.h" - -HbWidget* MemSpyListView::createCentralWidget() -{ - return &mListView; -} diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspymainview.cpp --- a/memspyui/ui/hb/src/memspymainview.cpp Mon Aug 23 15:50:54 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 "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"); - 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 }; - mViewManager.showView(indexes[index.row()]); -} - -bool MemSpyMainView::isBreadCrumbVisible() const -{ - return false; -} - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspyprocessview.cpp --- a/memspyui/ui/hb/src/memspyprocessview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +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 "memspyprocessview.h" - -#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))); -} - -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::refresh() -{ - mModel->refresh(); -} - diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspysettingsview.cpp --- a/memspyui/ui/hb/src/memspysettingsview.cpp Mon Aug 23 15:50:54 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: - * - */ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspyswmtview.cpp --- a/memspyui/ui/hb/src/memspyswmtview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +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 -#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->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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspythreaddetailindexview.cpp --- a/memspyui/ui/hb/src/memspythreaddetailindexview.cpp Mon Aug 23 15:50:54 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: - * - */ - -#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 }; - - 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspythreaddetailview.cpp --- a/memspyui/ui/hb/src/memspythreaddetailview.cpp Mon Aug 23 15:50:54 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: - * - */ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspythreadview.cpp --- a/memspyui/ui/hb/src/memspythreadview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,204 +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 - -#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) -{ - ProcessId pid = qVariantValue(params["pid"]); - setTitle(tr("Threads")); - - mProcessName = params["pname"].toString(); - - MemSpyView::initialize(params); - - mModel = new MemSpyThreadModel(mEngine, pid, 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); -} - -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 }; - - mEngine.setThreadPriority(mThreadId, priorities[index]); - refresh(); -} - -void MemSpyThreadView::refresh() -{ - mModel->refresh(); -} diff -r 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspytrackingview.cpp --- a/memspyui/ui/hb/src/memspytrackingview.cpp Mon Aug 23 15:50:54 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: - * - */ - -#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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/memspyview.cpp --- a/memspyui/ui/hb/src/memspyview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +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 -#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.1.0 - 15th June 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 5db69f4c3d06 -r b048e15729d6 memspyui/ui/hb/src/viewmanager.cpp --- a/memspyui/ui/hb/src/viewmanager.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +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 -#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" - -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 -}; - - -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 5db69f4c3d06 -r b048e15729d6 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,1 @@ + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/data/Example_MemSpyProcessMemoryTrackingAutoStartConfig.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/data/Example_MemSpyProcessMemoryTrackingAutoStartConfig.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/data/MemSpyEComInterfaceIds.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/data/MemSpyEComInterfaceIds.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/data/MemSpyProcessMemoryTrackingAutoStartConfig.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/data/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/data/backup_registration.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/data/memspyui.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/data/memspyui.rss Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,1133 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// Resource Identifier +NAME MEMS + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +// User includes +#include "../ui/avkon/inc/MemSpy.hrh" + + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="MemSpy"; } + +RESOURCE EIK_APP_INFO + { + hotkeys = r_memspy_hotkeys; + menubar = r_memspy_menubar; + cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + + + + + + +RESOURCE HOTKEYS r_memspy_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + + +RESOURCE MENU_BAR r_memspy_menubar + { + titles= + { + MENU_TITLE { menu_pane=r_memspy_menupane; txt = "Main Menu"; } + }; + } + + + + +RESOURCE MENU_PANE r_memspy_menupane_stack + { + items= + { + MENU_ITEM { command = EMemSpyCmdStackInfoThread; txt = "Info"; } +#ifndef __WINS__ + , + MENU_ITEM { command = EMemSpyCmdStackData; cascade = r_memspy_menupane_stack_data; txt = "Data"; } +#endif + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_stack_data + { + items= + { + MENU_ITEM { command=EMemSpyCmdStackDataUser; txt = "User stack data"; }, + MENU_ITEM { command=EMemSpyCmdStackDataKernel; txt = "Kernel stack data"; } + }; + } + + + + + + +RESOURCE MENU_PANE r_memspy_menupane_heap + { + items= + { + MENU_ITEM { command = EMemSpyCmdHeapInfoThread; txt = "Info"; }, + MENU_ITEM { command = EMemSpyCmdHeapData; cascade = r_memspy_menupane_heap_data; txt = "Data"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_heap_data + { + items= + { + MENU_ITEM { command = EMemSpyCmdHeapCellListing; txt = "Cell list"; } +#ifndef __WINS__ + , + MENU_ITEM { command = EMemSpyCmdHeapDataDump; txt = "Heap data"; } +#endif + }; + } + + + + + + + + + + + + + +RESOURCE MENU_PANE r_memspy_menupane_auto_capture + { + items= + { + MENU_ITEM { command = EMemSpyCmdAutoCaptureToggle; txt = "Enable/Disable"; }, + MENU_ITEM { command = EMemSpyCmdAutoCaptureRetryTime; txt = "Timer period"; }, + MENU_ITEM { command = EMemSpyCmdAutoCaptureOperationType; txt = "Operation type"; } + }; + } + + +RESOURCE TBUF r_memspy_auto_capture_enable + { + buf = "Enable"; + } + + +RESOURCE TBUF r_memspy_auto_capture_disable + { + buf = "Disable"; + } + + +RESOURCE LISTBOX r_memspy_auto_capture_operation_listbox + { + flags = 0; //EEikListBoxMultipleSelection; + } + + +RESOURCE AVKON_SETTING_PAGE r_memspy_auto_capture_operation_types_settings_page + { + number = EAknSettingPageNoOrdinalDisplayed; + label = "Operation type"; + softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL; + type = EAknSetListBox; + editor_resource_id = r_memspy_auto_capture_operation_listbox; + } + + +RESOURCE ARRAY r_memspy_auto_capture_operation_types + { + items = + { + LBUF { txt = "General Info (Text)"; }, + LBUF { txt = "General Info (Detailed)"; }, + // + LBUF { txt = "User Heap Info (Text)"; }, + LBUF { txt = "User Heap Info (CSV)"; }, + // + LBUF { txt = "User Heap Cell List (Text)"; }, + // + LBUF { txt = "User Heap Data (Binary)"; }, + LBUF { txt = "Kernel Heap Data (Binary)"; }, + // + LBUF { txt = "User Stack Info (Text)"; }, + LBUF { txt = "User Stack Info (CSV)"; }, + // + LBUF { txt = "User Stack Data (Binary)"; }, + LBUF { txt = "Kernel Stack Data (Binary)"; } + }; + } + + + + + + + + + + + + + + + + + + + +RESOURCE MENU_PANE r_memspy_menupane_phone_info_general + { + 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"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_phone_info_heap + { + items= + { + MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapInfoSummary; txt = "Detailed Summary"; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapInfoCompact; txt = "Compact Summary"; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapCellListing; txt = "Cell Listing"; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoHeapDump; txt = "Data (Binary)"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_phone_info_stack + { + items= + { + MENU_ITEM { command = EMemSpyCmdPhoneInfoStackInfo; txt = "Detailed Summary"; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoStackInfoCompact; txt = "Compact Summary"; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoStackDumpUser; txt = "User Stacks (Binary)"; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoStackDumpKernel; txt = "Kernel Stacks (Binary)"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_phone_info + { + items= + { + MENU_ITEM { command = EMemSpyCmdPhoneInfoGeneral; txt = "General"; cascade = r_memspy_menupane_phone_info_general; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoHeap; txt = "Heap"; cascade = r_memspy_menupane_phone_info_heap; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfoStack; txt = "Stack"; cascade = r_memspy_menupane_phone_info_stack; } + }; + } + + + + + + + + + + + + + + + + + + +/* +RESOURCE MENU_PANE r_memspy_menupane_process_sort + { + items= + { + MENU_ITEM { command = EMemSpyCmdProcessSortById; txt = "By Id"; }, + MENU_ITEM { command = EMemSpyCmdProcessSortByName; txt = "By Name"; }, + MENU_ITEM { command = EMemSpyCmdProcessSortByThreadCount; txt = "By Number of Threads"; }, + MENU_ITEM { command = EMemSpyCmdProcessSortByCodeSegs; txt = "By Code Segments"; }, + MENU_ITEM { command = EMemSpyCmdProcessSortByHeapUsage; txt = "By Heap Usage"; }, + MENU_ITEM { command = EMemSpyCmdProcessSortByStackUsage; txt = "By Stack Usage"; } + }; + } + +RESOURCE MENU_PANE r_memspy_menupane_process_info + { + items= + { + MENU_ITEM { command = EMemSpyCmdProcessInfoSummary; txt = "Summary"; }, + MENU_ITEM { command = EMemSpyCmdProcessInfoHandles; txt = "Handles"; } + }; + } +*/ + + +RESOURCE MENU_PANE r_memspy_menupane_process_end + { + items= + { + MENU_ITEM { command = EMemSpyCmdProcessEndKill; txt = "Kill"; }, + MENU_ITEM { command = EMemSpyCmdProcessEndPanic; txt = "Panic"; }, + MENU_ITEM { command = EMemSpyCmdProcessEndTerminate; txt = "Terminate"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_process + { + 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; } + }; + } + + + + + + + +RESOURCE MENU_PANE r_memspy_menupane_thread_priority + { + items= + { + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteVeryLow; txt = "Abs. Very Low"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteLowNormal; txt = "Abs. Low Normal"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteLow; txt = "Abs. Low"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteBackgroundNormal; txt = "Abs. Background Normal"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteBackground; txt = "Abs. Background "; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteForegroundNormal; txt = "Abs. Foreground Normal"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteForeground; txt = "Abs. Foreground"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteHighNormal; txt = "Abs. High Normal"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteHigh; txt = "Abs. High"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime1; txt = "Abs. Real Time 1"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime2; txt = "Abs. Real Time 2"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime3; txt = "Abs. Real Time 3"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime4; txt = "Abs. Real Time 4"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime5; txt = "Abs. Real Time 5"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime6; txt = "Abs. Real Time 6"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime7; txt = "Abs. Real Time 7"; }, + MENU_ITEM { command = EMemSpyCmdThreadSetPriorityAbsoluteRealTime8; txt = "Abs. Real Time 8"; } + }; + } + +/* +RESOURCE MENU_PANE r_memspy_menupane_thread_info + { + items= + { + MENU_ITEM { command = EMemSpyCmdThreadInfoHandles; txt = "Handles"; } + }; + } +*/ + +RESOURCE MENU_PANE r_memspy_menupane_thread_end + { + items= + { + MENU_ITEM { command = EMemSpyCmdThreadEndKill; txt = "Kill"; }, + MENU_ITEM { command = EMemSpyCmdThreadEndPanic; txt = "Panic"; }, + MENU_ITEM { command = EMemSpyCmdThreadEndTerminate; txt = "Terminate"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_thread + { + items= + { + //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; } + }; + } + + + + + + + + + +RESOURCE MENU_PANE r_memspy_menupane_output + { + items= + { + MENU_ITEM { command = EMemSpyCmdOutputToDebug; txt = "Switch to Debug output"; }, + MENU_ITEM { command = EMemSpyCmdOutputToFile; txt = "Switch to File output"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_tools + { + items= + { + MENU_ITEM { command = EMemSpyCmdToolsListOpenFiles; txt = "List open files"; }, + MENU_ITEM { command = EMemSpyCmdOutput; txt = "Change output mode"; cascade = r_memspy_menupane_output; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_view + { + items= + { + MENU_ITEM { command = EMemSpyCmdViewRefresh; txt = "Refresh"; }, + MENU_ITEM { command = EMemSpyCmdViewOutputToSink; txt = "Output Contents"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_images + { + items= + { + MENU_ITEM { command = EMemSpyCmdImagesListing; txt = "Output Listing"; }, + MENU_ITEM { command = EMemSpyCmdImagesSlideshow; txt = "Slideshow"; } +#ifndef __WINS__ + , + MENU_ITEM { command = EMemSpyCmdImagesSaveAllToMemoryCard; txt = "Save All to Memory Card"; } +#endif + }; + } + + + +RESOURCE MENU_PANE r_memspy_menupane_server_list_output + { + items= + { + MENU_ITEM { command = EMemSpyCmdServerListOutputListCSV; txt = "Listing"; }, + MENU_ITEM { command = EMemSpyCmdServerListOutputListDetailed; txt = "Detailed Listing"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_server_list_sort + { + items= + { + MENU_ITEM { command = EMemSpyCmdServerListSortByName; txt = "By Name"; }, + MENU_ITEM { command = EMemSpyCmdServerListSortBySessionCount; txt = "By Number of Sessions"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_server_list + { + items= + { + MENU_ITEM { command = EMemSpyCmdServerListOutput; txt = "Output"; cascade = r_memspy_menupane_server_list_output; }, + MENU_ITEM { command = EMemSpyCmdServerListSort; txt = "Sort"; cascade = r_memspy_menupane_server_list_sort; } + }; + } + + + +RESOURCE MENU_PANE r_memspy_menupane_chunk_list_sort + { + items= + { + MENU_ITEM { command = EMemSpyCmdChunkSortByName; txt = "By Name"; }, + MENU_ITEM { command = EMemSpyCmdChunkSortBySize; txt = "By Size"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_chunk_list + { + items= + { + MENU_ITEM { command = EMemSpyCmdChunkListing; txt = "Output Listing"; }, + MENU_ITEM { command = EMemSpyCmdChunkSort; txt = "Sort"; cascade = r_memspy_menupane_chunk_list_sort; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_codeseg_list_filter_by_capability + { + items= + { + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTCBProcess; txt = "TCB (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTCBAll; txt = "TCB (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithCommDDProcess; txt = "Comm DD (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithCommDDAll; txt = "Comm DD (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithPowerMgmtProcess; txt = "Power Mgmt (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithPowerMgmtAll; txt = "Power Mgmt (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithMultimediaDDProcess; txt = "Multimedia DD (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithMultimediaDDAll; txt = "Multimedia DD (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadDeviceDataProcess; txt = "Read Device Data (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadDeviceDataAll; txt = "Read Device Data (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataProcess; txt = "Write Device Data (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteDeviceDataAll; txt = "Write Device Data (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDRMProcess; txt = "DRM (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDRMAll; txt = "DRM (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTrustedUIProcess; txt = "Trusted UI (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithTrustedUIAll; txt = "Trusted UI (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithProtServProcess; txt = "Prot Serv (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithProtServAll; txt = "Prot Serv (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDiskAdminProcess; txt = "Disk Admin (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithDiskAdminAll; txt = "Disk Admin (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkControlProcess; txt = "Network Ctrl (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkControlAll; txt = "Network Ctrl (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithAllFilesProcess; txt = "All Files (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithAllFilesAll; txt = "All Files (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSwEventProcess; txt = "SW Event (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSwEventAll; txt = "SW Event (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkServicesProcess; txt = "Network Serv (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithNetworkServicesAll; txt = "Network Serv (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocalServicesProcess; txt = "Local Serv (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocalServicesAll; txt = "Local Serv (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadUserDataProcess; txt = "Read User Data (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithReadUserDataAll; txt = "Read User Data (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteUserDataProcess; txt = "Write User Data (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithWriteUserDataAll; txt = "Write User Data (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocationProcess; txt = "Location (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithLocationAll; txt = "Location (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSurroundingsDDProcess; txt = "Surroundings DD (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithSurroundingsDDAll; txt = "Surroundings DD (All)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithUserEnvProcess; txt = "User Env (Exe)"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCapsWithUserEnvAll; txt = "User Env (All)"; } + }; + } + + + +RESOURCE MENU_PANE r_memspy_menupane_codeseg_list_filter + { + items= + { + MENU_ITEM { command = EMemSpyCmdCodeSegShowItemsAll; txt = "None"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowItemsGlobalData; txt = "By Global Data"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShowCaps; txt = "By Capability"; cascade = r_memspy_menupane_codeseg_list_filter_by_capability; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_codeseg_list_sort + { + items= + { + MENU_ITEM { command = EMemSpyCmdCodeSegSortByName; txt = "By Name"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegSortByCodeSize; txt = "By Code Size"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegSortByDataSize; txt = "By Total Data Size"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegSortByUid; txt = "By Uid"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_codeseg_list + { + items= + { + MENU_ITEM { command = EMemSpyCmdCodeSegListing; txt = "Output Listing"; }, + MENU_ITEM { command = EMemSpyCmdCodeSegShow; txt = "Filter"; cascade = r_memspy_menupane_codeseg_list_filter; }, + MENU_ITEM { command = EMemSpyCmdCodeSegSort; txt = "Sort"; cascade = r_memspy_menupane_codeseg_list_sort; } + }; + } + + + + + +RESOURCE MENU_PANE r_memspy_menupane_active_objects + { + items= + { + MENU_ITEM { command = EMemSpyCmdActiveObjectListing; txt = "Output Listing"; } + }; + } + + + + +RESOURCE MENU_PANE r_memspy_menupane_ram + { + items= + { + MENU_ITEM { command = EMemSpyCmdRAMAvkonIconCacheDisabled; txt = "Disable Icon Cache"; }, + MENU_ITEM { command = EMemSpyCmdRAMAvkonIconCacheEnabled; txt = "Enable Icon Cache"; } + }; + } + + + + + + + + + + + + + + + + + + + + + + + + + +RESOURCE MENU_PANE r_memspy_menupane_kernel_containers + { + items= + { + MENU_ITEM { command = EMemSpyCmdKernelContainersOutput; txt = "Output list"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_kernel_objects + { + items= + { + MENU_ITEM { command = EMemSpyCmdKernelObjectTerminate; txt = "Terminate"; }, + MENU_ITEM { command = EMemSpyCmdKernelObjectSwitchTo; txt = "Switch to"; }, + MENU_ITEM { command = EMemSpyCmdKernelObjectEnd; txt = "End"; }, + MENU_ITEM { command = EMemSpyCmdKernelObjectPanic; txt = "Panic"; } + }; + } + + +RESOURCE MENU_PANE r_memspy_menupane_kernel_heap + { + items= + { + MENU_ITEM { command = EMemSpyCmdKernelHeapDump; txt = "Dump Heap"; } + }; + } + + + +RESOURCE MENU_PANE r_memspy_menupane_memory_tracking + { + items= + { + MENU_ITEM { command = EMemSpyCmdMemoryTrackingStart; txt = "Start"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingStop; txt = "Stop"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingTotalWithSharedMem; txt = "Include shared memory in Total"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingTotalWithoutSharedMem; txt = "Exclude shared memory from Total"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingHWMReset; txt = "Reset HWM"; } + }; + } + + + +RESOURCE MENU_PANE r_memspy_menupane_memory_tracking_hwm + { + items= + { + MENU_ITEM { command = EMemSpyCmdMemoryTrackingHWMReset; txt = "Reset"; } + }; + } + + + +RESOURCE MENU_PANE r_memspy_menupane_memory_tracking_autostart + { + items= + { + MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemAdd; txt = "Add"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemEdit; txt = "Edit"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemDelete; txt = "Remove"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemDeleteAll; txt = "Remove All"; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStartItemImport; txt = "Import"; } + }; + } + + + + +RESOURCE MENU_PANE r_memspy_menupane_window_groups + { + items= + { + MENU_ITEM { command = EMemSpyCmdWindowGroupTerminate; txt = "Terminate"; }, + MENU_ITEM { command = EMemSpyCmdWindowGroupSwitchTo; txt = "Switch to"; }, + MENU_ITEM { command = EMemSpyCmdWindowGroupEnd; txt = "End"; }, + MENU_ITEM { command = EMemSpyCmdWindowGroupPanic; txt = "Panic"; } + }; + } + + + + + + + +RESOURCE MENU_PANE r_memspy_menupane + { + items= + { + // This item is visible if the view supports child views + MENU_ITEM { command = EMemSpyCmdOpen; txt = "Open"; }, + + // These are view-specific menu cascades that are not shown unless a specific view is open + MENU_ITEM { command = EMemSpyCmdServerList; txt = "Server List"; cascade = r_memspy_menupane_server_list; }, + MENU_ITEM { command = EMemSpyCmdChunk; txt = "Chunk"; cascade = r_memspy_menupane_chunk_list; }, + MENU_ITEM { command = EMemSpyCmdCodeSeg; txt = "Code Segment"; cascade = r_memspy_menupane_codeseg_list; }, + MENU_ITEM { command = EMemSpyCmdImages; txt = "Images"; cascade = r_memspy_menupane_images; }, + MENU_ITEM { command = EMemSpyCmdActiveObject; txt = "Active Object"; cascade = r_memspy_menupane_active_objects; }, + MENU_ITEM { command = EMemSpyCmdHeap; txt = "Heap"; cascade = r_memspy_menupane_heap; }, + MENU_ITEM { command = EMemSpyCmdStack; txt = "Stack"; cascade = r_memspy_menupane_stack; }, + MENU_ITEM { command = EMemSpyCmdRAM; txt = "RAM"; cascade = r_memspy_menupane_ram; }, + MENU_ITEM { command = EMemSpyCmdProcess; txt = "Process"; cascade = r_memspy_menupane_process; }, + MENU_ITEM { command = EMemSpyCmdThread; txt = "Thread"; cascade = r_memspy_menupane_thread; }, + MENU_ITEM { command = EMemSpyCmdKernelContainers; txt = "Kernel Objects"; cascade = r_memspy_menupane_kernel_containers; }, + MENU_ITEM { command = EMemSpyCmdKernelObjects; txt = "Kernel Object"; cascade = r_memspy_menupane_kernel_objects; }, + MENU_ITEM { command = EMemSpyCmdKernelHeap; txt = "Kernel Heap"; cascade = r_memspy_menupane_kernel_heap; }, + MENU_ITEM { command = EMemSpyCmdMemoryTracking; txt = "Memory Tracking"; cascade = r_memspy_menupane_memory_tracking; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingHWM; txt = "Memory HWM"; cascade = r_memspy_menupane_memory_tracking_hwm; }, + MENU_ITEM { command = EMemSpyCmdMemoryTrackingAutoStart; txt = "Auto-Start Items"; cascade = r_memspy_menupane_memory_tracking_autostart; }, + MENU_ITEM { command = EMemSpyCmdWindowGroups; txt = "Window Group"; cascade = r_memspy_menupane_window_groups; }, + + // These are standard menu items that are always visible + MENU_ITEM { command = EMemSpyCmdView; txt = "View"; cascade = r_memspy_menupane_view; }, + MENU_ITEM { command = EMemSpyCmdTools; txt = "Tools"; cascade = r_memspy_menupane_tools; }, + MENU_ITEM { command = EMemSpyCmdPhoneInfo; txt = "Phone Information"; cascade = r_memspy_menupane_phone_info; }, + MENU_ITEM { command = EMemSpyCmdAutoCapture; txt = "Automatic Capture"; cascade = r_memspy_menupane_auto_capture; }, + + // About + MENU_ITEM { command = EMemSpyCmdToolsAbout; txt = "About"; }, + + // One or other is visible, depending on whether it is a top level menu item + MENU_ITEM { command = EAknSoftkeyBack; txt = "Back"; }, + MENU_ITEM { command = EAknCmdExit; txt = "Exit"; } + }; + } + + +RESOURCE DIALOG r_memspy_device_wide_operation_progress_dialog + { + title = "Performing operation.."; + flags = EAknProgressNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EMemSpyCtrlIdProgressNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + imagefile = AVKON_ICON_FILE; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + }; + } + }; + } + + +RESOURCE DIALOG r_memspy_export_to_memorycard_dialog + { + title = "Save Bitmaps to Memory Card"; + flags = EAknProgressNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EMemSpyCtrlIdProgressNote; + control = AVKON_NOTE + { + layout = EProgressLayout; + imagefile = AVKON_ICON_FILE; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + }; + } + }; + } + + +RESOURCE DIALOG r_memspy_device_wide_settings + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = ENumberLayout; + label = "Frequency (seconds)"; + control = AVKON_INTEGER_EDWIN + { + min = 5; + max = 3600; + maxlength = 4; + }; + }; + } + }; + } + + +RESOURCE DIALOG r_memspy_preparing_info_item_container_wait_note + { + flags = EAknWaitNoteFlags | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EMemSpyCtrlIdWaitNote; + control = AVKON_NOTE + { + layout = EWaitLayout; + singular_label = "Preparing items..."; + imagefile = AVKON_ICON_FILE; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; + } + + + + + +RESOURCE DIALOG r_memspy_image_slideshow + { + title = "Image Slideshow..."; + flags = EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons | EEikDialogFlagWait; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EEikCtImage; + id = EMemSpyCtrlIdSlideShowImage; + control = IMAGE + { + }; + } + }; + } + + + + + + +RESOURCE DIALOG r_memspy_heap_tracker_timer_period + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = ENumberLayout; + label = "Frequency (seconds)"; + control = AVKON_INTEGER_EDWIN + { + min = 30; + max = 3600; + maxlength = 4; + }; + }; + } + }; + } + + +RESOURCE DIALOG r_memspy_heap_tracker_name_filter + { + flags = EAknDialogGenericQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = "Thread Name Filter"; + control = EDWIN + { + flags = 0; + width = 8; + lines = 1; + maxlength = 16; + avkon_flags = EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly; + allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; + default_input_mode = EAknEditorTextInputMode; + }; + }; + } + }; + } + +RESOURCE DIALOG r_memspy_memory_tracking_process_uid_dialog + { + flags = EAknDialogGenericQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + label = "Process Uid (Hex)"; + control = EDWIN + { + flags = 0; + width = 8; + lines = 1; + maxlength = 8; + avkon_flags = EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly; + allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode; + default_input_mode = EAknEditorNumericInputMode; + }; + }; + } + }; + } + + +RESOURCE DIALOG r_memspy_memory_tracking_import_from_installed_xml_dialog + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = "Import auto-start items\nfrom installed XML file?"; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + + +RESOURCE DIALOG r_memspy_memory_tracking_import_from_userdefined_xml_dialog + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = "Import auto-start items\nfrom custom XML file?"; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + + +RESOURCE DIALOG r_memspyui_about_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "About MemSpy"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + 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."; + }; + } + }; + } + + + +RESOURCE DIALOG r_memspy_ram_memory_delta_dialog + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control = AVKON_NOTE + { + layout = EGeneralLayout; + singular_label = "Memory Delta"; + animation = R_QGN_NOTE_INFO_ANIM; + }; + } + }; + } + + +RESOURCE DIALOG r_memspy_panic_system_critical_thread_or_process + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationLayout; + label = "Terminating/killing/panicking item will cause a reboot.\nContinue?"; + animation = R_QGN_NOTE_QUERY_ANIM; + }; + } + }; + } + +RESOURCE DIALOG r_memspy_kernel_object_details_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "Object details"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + message = "."; + }; + } + }; + } + +RESOURCE AVKON_SETTING_PAGE r_memspyui_swmt_categories_setting_page + { + type = EAknSetListBox; + editor_resource_id = r_memspyui_swmt_categories_items_listbox; + label = "SWMT Categories"; + } + +RESOURCE LISTBOX r_memspyui_swmt_categories_items_listbox + { + flags = EAknListBoxMultipleSelection; + } + +// --------------------------------------------------------- +// +// RESOURCE LOCALISABLE_APP_INFO +// +// --------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_memspyui_localisable_app_info + { + short_caption = "MemSpy"; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = "MemSpy"; + + number_of_icons = 1; + + // Note for ROM-based apps it is recommended to add the drive letter + // icon_file = "z:"APP_BITMAP_DIR"\\myapp_aif.mif"; + icon_file = APP_BITMAP_DIR"\\memspyui_aif.mif"; + }; + } + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/data/memspyui_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/data/memspyui_reg.rss Fri Sep 03 17:11:21 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: +* +*/ + + +// System includes +#include +#include +#include + + + +UID2 KUidAppRegistrationResourceFile + +UID3 0x2002129F + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "MemSpyUI"; + localisable_resource_file = APP_RESOURCE_DIR"\\MemSpyUI"; + localisable_resource_id = R_MEMSPYUI_LOCALISABLE_APP_INFO; + group_name = "RnD Tools"; + } diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/group/bld.inf Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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_platforms + +WINSCW GCCE ARMV5 ARMV6 + +#include "bld_generic.inf" + +#include "../ui/avkon/group/bld.inf" + +prj_mmpfiles + +prj_extensions \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/group/bld_generic.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/group/bld_generic.inf Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/group/group.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/group/group.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/group/memspyui_icons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/group/memspyui_icons_aif.mk Fri Sep 03 17:11:21 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\memspyui_aif.mif + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : ..\icons\qgn_menu_memspyui.svg + mifconv $(ICONTARGETFILENAME) \ + /c8,8 ..\icons\qgn_menu_memspyui.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/group/memspyui_stub_sis.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/group/memspyui_stub_sis.mk Fri Sep 03 17:11:21 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: +# + + +TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install + +SISNAME=MemSpy_stub +PKGNAME=MemSpy_stub + +$(TARGETDIR) : + @perl -S emkdir.pl "$(TARGETDIR)" + +do_nothing : + rem do_nothing + +SISFILE=$(TARGETDIR)\$(SISNAME).sis + +$(SISFILE) : ..\sis\$(PKGNAME).pkg + makesis -s $? $@ + + + +MAKMAKE : do_nothing + +RESOURCE : do_nothing + +SAVESPACE : do_nothing + +BLD : do_nothing + +FREEZE : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +FINAL : $(TARGETDIR) $(SISFILE) + +CLEAN : + @if exist $(SISFILE) erase $(SISFILE) + +RELEASABLES : + @echo $(SISFILE) diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/icons/qgn_menu_memspyui.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/icons/qgn_menu_memspyui.svg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,363 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/memspyui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/memspyui.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/memspywindowserverhelper/bwins/memspywindowserverhelperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/memspywindowserverhelper/bwins/memspywindowserverhelperu.def Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,13 @@ +EXPORTS + ?WindowGroupListL@CMemSpyEngineHelperWindowServerImpl@@UAEPAVMMemSpyEngineWindowGroupList@@XZ @ 1 NONAME ; class MMemSpyEngineWindowGroupList * CMemSpyEngineHelperWindowServerImpl::WindowGroupListL(void) + ?ItemIndex@CMemSpyEngineWindowGroupListImpl@@UBEHABVTMemSpyEngineWindowGroupBasicInfo@@@Z @ 2 NONAME ; int CMemSpyEngineWindowGroupListImpl::ItemIndex(class TMemSpyEngineWindowGroupBasicInfo const &) const + ?NewMemSpyEngineHelperWindowServerImplL@@YAPAVMMemSpyEngineHelperWindowServer@@XZ @ 3 NONAME ; class MMemSpyEngineHelperWindowServer * NewMemSpyEngineHelperWindowServerImplL(void) + ?MdcaPoint@CMemSpyEngineWindowGroupListImpl@@UBE?AVTPtrC16@@H@Z @ 4 NONAME ; class TPtrC16 CMemSpyEngineWindowGroupListImpl::MdcaPoint(int) const + ?At@CMemSpyEngineWindowGroupListImpl@@UBEABVTMemSpyEngineWindowGroupBasicInfo@@H@Z @ 5 NONAME ; class TMemSpyEngineWindowGroupBasicInfo const & CMemSpyEngineWindowGroupListImpl::At(int) const + ?GetWindowGroupListL@CMemSpyEngineHelperWindowServerImpl@@UAEXAAV?$RArray@VTMemSpyEngineWindowGroupBasicInfo@@@@@Z @ 6 NONAME ; void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupListL(class RArray &) + ?Count@CMemSpyEngineWindowGroupListImpl@@UBEHXZ @ 7 NONAME ; int CMemSpyEngineWindowGroupListImpl::Count(void) const + ?SwitchToL@CMemSpyEngineHelperWindowServerImpl@@UAEXH@Z @ 8 NONAME ; void CMemSpyEngineHelperWindowServerImpl::SwitchToL(int) + ?GetWindowGroupDetailsL@CMemSpyEngineHelperWindowServerImpl@@UAEXHAAVTMemSpyEngineWindowGroupDetails@@@Z @ 9 NONAME ; void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupDetailsL(int, class TMemSpyEngineWindowGroupDetails &) + ?NewL@CMemSpyEngineHelperWindowServerImpl@@SAPAV1@XZ @ 10 NONAME ; class CMemSpyEngineHelperWindowServerImpl * CMemSpyEngineHelperWindowServerImpl::NewL(void) + ?MdcaCount@CMemSpyEngineWindowGroupListImpl@@UBEHXZ @ 11 NONAME ; int CMemSpyEngineWindowGroupListImpl::MdcaCount(void) const + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/memspywindowserverhelper/eabi/memspywindowserverhelperu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/memspywindowserverhelper/eabi/memspywindowserverhelperu.def Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,22 @@ +EXPORTS + _Z38NewMemSpyEngineHelperWindowServerImplLv @ 1 NONAME + _ZN35CMemSpyEngineHelperWindowServerImpl16WindowGroupListLEv @ 2 NONAME + _ZN35CMemSpyEngineHelperWindowServerImpl19GetWindowGroupListLER6RArrayI33TMemSpyEngineWindowGroupBasicInfoE @ 3 NONAME + _ZN35CMemSpyEngineHelperWindowServerImpl22GetWindowGroupDetailsLEiR31TMemSpyEngineWindowGroupDetails @ 4 NONAME + _ZN35CMemSpyEngineHelperWindowServerImpl4NewLEv @ 5 NONAME + _ZN35CMemSpyEngineHelperWindowServerImpl9SwitchToLEi @ 6 NONAME + _ZNK32CMemSpyEngineWindowGroupListImpl2AtEi @ 7 NONAME + _ZNK32CMemSpyEngineWindowGroupListImpl5CountEv @ 8 NONAME + _ZNK32CMemSpyEngineWindowGroupListImpl9ItemIndexERK33TMemSpyEngineWindowGroupBasicInfo @ 9 NONAME + _ZNK32CMemSpyEngineWindowGroupListImpl9MdcaCountEv @ 10 NONAME + _ZNK32CMemSpyEngineWindowGroupListImpl9MdcaPointEi @ 11 NONAME + _ZThn4_N35CMemSpyEngineHelperWindowServerImpl16WindowGroupListLEv @ 12 NONAME + _ZThn4_N35CMemSpyEngineHelperWindowServerImpl19GetWindowGroupListLER6RArrayI33TMemSpyEngineWindowGroupBasicInfoE @ 13 NONAME + _ZThn4_N35CMemSpyEngineHelperWindowServerImpl22GetWindowGroupDetailsLEiR31TMemSpyEngineWindowGroupDetails @ 14 NONAME + _ZThn4_N35CMemSpyEngineHelperWindowServerImpl9SwitchToLEi @ 15 NONAME + _ZThn4_NK32CMemSpyEngineWindowGroupListImpl2AtEi @ 16 NONAME + _ZThn4_NK32CMemSpyEngineWindowGroupListImpl5CountEv @ 17 NONAME + _ZThn4_NK32CMemSpyEngineWindowGroupListImpl9ItemIndexERK33TMemSpyEngineWindowGroupBasicInfo @ 18 NONAME + _ZThn4_NK32CMemSpyEngineWindowGroupListImpl9MdcaCountEv @ 19 NONAME + _ZThn4_NK32CMemSpyEngineWindowGroupListImpl9MdcaPointEi @ 20 NONAME + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/memspywindowserverhelper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/memspywindowserverhelper/group/bld.inf Fri Sep 03 17:11:21 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: Build information file for MemSpyWindowServerHelper +* +*/ + + +PRJ_PLATFORMS + +PRJ_EXPORTS + +PRJ_MMPFILES +memspywindowserverhelper.mmp + + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/memspywindowserverhelper/group/memspywindowserverhelper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/memspywindowserverhelper/group/memspywindowserverhelper.mmp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: DLL implementing the MMemSpyEngineHelperWindowServer Interface +* +*/ + + +#include + +TARGET memspywindowserverhelper.dll +TARGETTYPE dll +UID 0x1000008D 0x20028783 +VENDORID VID_DEFAULT +SMPSAFE + +CAPABILITY ALL -TCB + +SOURCEPATH ../src +SOURCE MemSpyEngineHelperWindowServerImpl.cpp + +USERINCLUDE ../inc +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ws32.lib apgrfx.lib + + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/memspywindowserverhelper/inc/MemSpyEngineHelperWindowServerImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/memspywindowserverhelper/inc/MemSpyEngineHelperWindowServerImpl.h Fri Sep 03 17:11:21 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 MEMSPYENGINEHELPERWINDOWSERVERIMPL_H +#define MEMSPYENGINEHELPERWINDOWSERVERIMPL_H + +// System includes +#include +#include + + +// User includes +#include + + +// Classes referenced + + +NONSHARABLE_CLASS( CMemSpyEngineHelperWindowServerImpl ) : public CBase, public MMemSpyEngineHelperWindowServer + { +public: + IMPORT_C static CMemSpyEngineHelperWindowServerImpl* NewL(); + virtual ~CMemSpyEngineHelperWindowServerImpl(); + +private: + CMemSpyEngineHelperWindowServerImpl(); + void ConstructL(); + +public: // API + IMPORT_C MMemSpyEngineWindowGroupList* WindowGroupListL(); + IMPORT_C void GetWindowGroupListL( RArray& aWindowGroups ); + IMPORT_C void GetWindowGroupDetailsL( TInt aWindowGroupId, TMemSpyEngineWindowGroupDetails& aWindowGroupDetails ); + IMPORT_C void SwitchToL( TInt aWindowGroupId ); + +private: + RWsSession iWsSession; + }; + + + + +NONSHARABLE_CLASS( CMemSpyEngineWindowGroupListImpl ) : public CBase, public MMemSpyEngineWindowGroupList + { +public: + static CMemSpyEngineWindowGroupListImpl* NewLC(); + virtual ~CMemSpyEngineWindowGroupListImpl(); + +private: + CMemSpyEngineWindowGroupListImpl(); + void ConstructL(); + +public: // API + IMPORT_C TInt Count() const; + IMPORT_C const TMemSpyEngineWindowGroupBasicInfo& At( TInt aIndex ) const; + IMPORT_C TInt ItemIndex( const TMemSpyEngineWindowGroupBasicInfo& aEntry ) const; + +public: // But not exported + void AddItemL( TMemSpyEngineWindowGroupBasicInfo& aItem ); + +public: // From MDesCArray + IMPORT_C TInt MdcaCount() const; + IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const; + +private: // Data members + RArray iItems; + }; + + +#endif diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/memspywindowserverhelper/src/MemSpyEngineHelperWindowServerImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/memspywindowserverhelper/src/MemSpyEngineHelperWindowServerImpl.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,232 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "MemSpyEngineHelperWindowServerImpl.h" + +// System includes +#include +#include + +// ============================= LOCAL FUNCTIONS =============================== + +EXPORT_C MMemSpyEngineHelperWindowServer* NewMemSpyEngineHelperWindowServerImplL() + { + return CMemSpyEngineHelperWindowServerImpl::NewL(); + } + + +// ============================ MEMBER FUNCTIONS =============================== + +CMemSpyEngineHelperWindowServerImpl::CMemSpyEngineHelperWindowServerImpl() + { + } + + +CMemSpyEngineHelperWindowServerImpl::~CMemSpyEngineHelperWindowServerImpl() + { + iWsSession.Close(); + } + + +void CMemSpyEngineHelperWindowServerImpl::ConstructL() + { + User::LeaveIfError( iWsSession.Connect() ); + } + + +EXPORT_C CMemSpyEngineHelperWindowServerImpl* CMemSpyEngineHelperWindowServerImpl::NewL() + { + CMemSpyEngineHelperWindowServerImpl* self = new(ELeave) CMemSpyEngineHelperWindowServerImpl(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + +EXPORT_C MMemSpyEngineWindowGroupList* CMemSpyEngineHelperWindowServerImpl::WindowGroupListL() + { + CMemSpyEngineWindowGroupListImpl* list = CMemSpyEngineWindowGroupListImpl::NewLC(); + // + RArray groups; + CleanupClosePushL( groups ); + // + GetWindowGroupListL( groups ); + // + const TInt count = groups.Count(); + for( TInt i = 0; i < count; i++ ) + { + list->AddItemL( groups[ i ] ); + } + // + CleanupStack::PopAndDestroy( &groups ); + + // Done + CleanupStack::Pop( list ); + return list; + } + + +EXPORT_C void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupListL( RArray& aWindowGroups ) + { + TInt count; + User::LeaveIfError( count = iWsSession.NumWindowGroups() ); + RArray array; + CleanupClosePushL( array ); + User::LeaveIfError( iWsSession.WindowGroupList( &array ) ); + for (TInt i =0; i < count; i++ ) + { + TMemSpyEngineWindowGroupBasicInfo group; + group.iId = array[i].iId; + TThreadId threadId; + RThread thread; + iWsSession.GetWindowGroupClientThreadId( array[i].iId, threadId ); + group.iThreadId = threadId; + group.iOrdinalPosition = i; + if ( !thread.Open( threadId ) ) + { + _LIT( KLineFormatSpec, "%d\t%S" ); + group.iFullName.Format( KLineFormatSpec, group.iId, &thread.Name() ); + } + else + { + _LIT( KLineFormatSpec, "%d\t" ); + group.iFullName.Format( KLineFormatSpec, group.iId ); + } + thread.Close(); + aWindowGroups.AppendL( group ); + } + CleanupStack::PopAndDestroy( &array ); + } + + +EXPORT_C void CMemSpyEngineHelperWindowServerImpl::GetWindowGroupDetailsL( TInt aWindowGroupId, TMemSpyEngineWindowGroupDetails& aWindowGroupDetails ) + { + TThreadId threadId; + RThread thread; + iWsSession.GetWindowGroupClientThreadId( aWindowGroupId, threadId ); + aWindowGroupDetails.iThreadId = threadId; + aWindowGroupDetails.iId = aWindowGroupId; + if ( !thread.Open( threadId ) ) + { + aWindowGroupDetails.iFullName.Copy( thread.Name() ); + } + else + { + aWindowGroupDetails.iFullName.Copy( _L("") ); + } + thread.Close(); + aWindowGroupDetails.iPriority = iWsSession.GetWindowGroupOrdinalPriority( aWindowGroupId ); + aWindowGroupDetails.iWindowGroupHandle = iWsSession.GetWindowGroupHandle( aWindowGroupId ); + CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( iWsSession, aWindowGroupId ); + aWindowGroupDetails.iUID = wgName->AppUid(); + aWindowGroupDetails.iIsBusy = wgName->IsBusy(); + aWindowGroupDetails.iIsSystem = wgName->IsSystem(); + aWindowGroupDetails.iIsHidden = wgName->Hidden(); + aWindowGroupDetails.iCaption = wgName->Caption(); + aWindowGroupDetails.iDocName = wgName->DocName(); + CleanupStack::PopAndDestroy( wgName ); + } + + +EXPORT_C void CMemSpyEngineHelperWindowServerImpl::SwitchToL( TInt aWindowGroupId ) + { + TApaTask task( iWsSession ); + CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( iWsSession, aWindowGroupId ); + task.SetWgId( aWindowGroupId ); + if ( wgName->Hidden() ) + { + User::Leave( KErrGeneral ); + } + if ( !task.Exists() ) + { + User::Leave( KErrNotFound ); + } + task.BringToForeground(); + CleanupStack::PopAndDestroy( wgName ); + } + + + + + + + + + +CMemSpyEngineWindowGroupListImpl::CMemSpyEngineWindowGroupListImpl() + { + } + + +CMemSpyEngineWindowGroupListImpl::~CMemSpyEngineWindowGroupListImpl() + { + iItems.Close(); + } + + +void CMemSpyEngineWindowGroupListImpl::ConstructL() + { + } + + +CMemSpyEngineWindowGroupListImpl* CMemSpyEngineWindowGroupListImpl::NewLC() + { + CMemSpyEngineWindowGroupListImpl* self = new(ELeave) CMemSpyEngineWindowGroupListImpl(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +EXPORT_C TInt CMemSpyEngineWindowGroupListImpl::Count() const + { + return iItems.Count(); + } + + +EXPORT_C const TMemSpyEngineWindowGroupBasicInfo& CMemSpyEngineWindowGroupListImpl::At( TInt aIndex ) const + { + return iItems[ aIndex ]; + } + + +EXPORT_C TInt CMemSpyEngineWindowGroupListImpl::ItemIndex( const TMemSpyEngineWindowGroupBasicInfo& /*aEntry*/ ) const + { + TInt ret = KErrNotFound; + return ret; + } + + +void CMemSpyEngineWindowGroupListImpl::AddItemL( TMemSpyEngineWindowGroupBasicInfo& aItem ) + { + iItems.AppendL( aItem ); + } + + +EXPORT_C TInt CMemSpyEngineWindowGroupListImpl::MdcaCount() const + { + return Count(); + } + + +EXPORT_C TPtrC CMemSpyEngineWindowGroupListImpl::MdcaPoint( TInt aIndex ) const + { + return TPtrC( At( aIndex ).iFullName ); + } + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/rom/memspyui.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/rom/memspyui.iby Fri Sep 03 17:11:21 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 MEMSPYUI_IBY +#define MEMSPYUI_IBY + + +S60_APP_EXE(MemSpyUI) +S60_APP_AIF_ICONS(MemSpyUI) +S60_APP_RESOURCE(MemSpyUI) +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 +data=ZPRIVATE\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml \private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml + +// Stub SIS +data=ZSYSTEM\Install\MemSpy_stub.sis \system\install\MemSpy_stub.sis + +// MemSpyWindowServerHelper +file=ABI_DIR\BUILD_DIR\memspywindowserverhelper.dll SHARED_LIB_DIR\memspywindowserverhelper.dll + +#endif diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/sis/MemSpy_S60-50.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/sis/MemSpy_S60-50.pkg Fri Sep 03 17:11:21 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: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"MemSpy"},(0x2002129F),1,2,0,TYPE=SA + +; Supports S60 v 5.0 +[0x1028315F], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; Engine: +"\epoc32\release\armv5\urel\MemSpyDriver.ldd"-"!:\sys\bin\MemSpyDriver.ldd" +"\epoc32\release\armv5\urel\MemSpyDriverClient.dll"-"!:\sys\bin\MemSpyDriverClient.dll" +"\epoc32\release\armv5\urel\MemSpyEngine.dll"-"!:\sys\bin\MemSpyEngine.dll" +"\epoc32\release\armv5\urel\MemSpy.exe"-"!:\sys\bin\MemSpy.exe" +"\epoc32\release\armv5\urel\MemSpyConsole.exe"-"!:\sys\bin\MemSpyConsole.exe" +"\epoc32\data\z\private\2002129E\MemSpyEComInterfaceIds.xml"-"c:\private\2002129E\MemSpyEComInterfaceIds.xml" +"\epoc32\data\z\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml" + +; UI: +"\epoc32\release\armv5\urel\MemSpyUI.exe"-"!:\sys\bin\MemSpyUI.exe" +"\epoc32\data\z\Resource\apps\MemSpyUI_aif.mif"-"!:\Resource\Apps\MemSpyUI_aif.mif" +"\epoc32\data\z\Resource\apps\MemSpyUI.rsc"-"!:\Resource\Apps\MemSpyUI.rsc" +"\epoc32\data\z\private\10003A3F\apps\MemSpyUI_reg.rsc"-"!:\private\10003a3f\import\apps\MemSpyUI_reg.rsc" +"\epoc32\data\z\private\2002129F\MemSpyEComInterfaceIds.xml"-"c:\private\2002129F\MemSpyEComInterfaceIds.xml" +"\epoc32\data\z\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml" +"\epoc32\release\armv5\urel\memspywindowserverhelper.dll"-"!:\sys\bin\memspywindowserverhelper.dll" diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/sis/MemSpy_S60-50.sis Binary file perfapps/memspyui/sis/MemSpy_S60-50.sis has changed diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/sis/MemSpy_S60-52.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/sis/MemSpy_S60-52.pkg Fri Sep 03 17:11:21 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: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"MemSpy"},(0x2002129F),1,2,0,TYPE=SA + +; Supports S60 v 5.2 +[0x20022E6D], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; Engine: +"\epoc32\release\armv5\urel\MemSpyDriver.ldd"-"!:\sys\bin\MemSpyDriver.ldd" +"\epoc32\release\armv5\urel\MemSpyDriverClient.dll"-"!:\sys\bin\MemSpyDriverClient.dll" +"\epoc32\release\armv5\urel\MemSpyEngine.dll"-"!:\sys\bin\MemSpyEngine.dll" +"\epoc32\release\armv5\urel\MemSpy.exe"-"!:\sys\bin\MemSpy.exe" +"\epoc32\release\armv5\urel\MemSpyConsole.exe"-"!:\sys\bin\MemSpyConsole.exe" +"\epoc32\data\z\private\2002129E\MemSpyEComInterfaceIds.xml"-"c:\private\2002129E\MemSpyEComInterfaceIds.xml" +"\epoc32\data\z\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml" + +; UI: +"\epoc32\release\armv5\urel\MemSpyUI.exe"-"!:\sys\bin\MemSpyUI.exe" +"\epoc32\data\z\Resource\apps\MemSpyUI_aif.mif"-"!:\Resource\Apps\MemSpyUI_aif.mif" +"\epoc32\data\z\Resource\apps\MemSpyUI.rsc"-"!:\Resource\Apps\MemSpyUI.rsc" +"\epoc32\data\z\private\10003A3F\apps\MemSpyUI_reg.rsc"-"!:\private\10003a3f\import\apps\MemSpyUI_reg.rsc" +"\epoc32\data\z\private\2002129F\MemSpyEComInterfaceIds.xml"-"c:\private\2002129F\MemSpyEComInterfaceIds.xml" +"\epoc32\data\z\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml"-"c:\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml" +"\epoc32\release\armv5\urel\memspywindowserverhelper.dll"-"!:\sys\bin\memspywindowserverhelper.dll" diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/sis/MemSpy_S60-52.sis Binary file perfapps/memspyui/sis/MemSpy_S60-52.sis has changed diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/sis/MemSpy_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/sis/MemSpy_stub.pkg Fri Sep 03 17:11:21 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: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"MemSpyUI"},(0x2002129F),1,0,0 + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; Engine: +""-"z:\sys\bin\MemSpyDriver.ldd" +""-"z:\sys\bin\MemSpyDriverClient.dll" +""-"z:\sys\bin\MemSpyEngine.dll" +""-"z:\sys\bin\MemSpy.exe" +""-"z:\sys\bin\MemSpyConsole.exe" +""-"z:\private\2002129E\MemSpyEComInterfaceIds.xml" +""-"z:\private\2002129E\MemSpyProcessMemoryTrackingAutoStartConfig.xml" + +; UI: +""-"z:\sys\bin\MemSpyUI.exe" +""-"z:\Resource\Apps\MemSpyUI_aif.mif" +""-"z:\Resource\Apps\MemSpyUI.rsc" +""-"z:\private\10003a3f\import\apps\MemSpyUI_reg.rsc" +""-"z:\private\2002129F\MemSpyEComInterfaceIds.xml" +""-"z:\private\2002129F\MemSpyProcessMemoryTrackingAutoStartConfig.xml" +""-"z:\sys\bin\memspywindowserverhelper.dll" diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/group/MemSpyCapabilities.mmh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/group/MemSpyCapabilities.mmh Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/group/bld.inf Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/group/memspyui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/group/memspyui.mmp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpy.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpy.hrh Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyApp.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyAppUi.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyContainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyContainerObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyContainerObserver.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyDeviceWideOperationDialog.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyDocument.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyExportBitmapsToMemoryCardDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyExportBitmapsToMemoryCardDialog.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpySettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpySettings.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyUiUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyUiUtils.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewBase.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewChunkList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewChunkList.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewCodeSegList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewCodeSegList.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewDriveInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewDriveInfo.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewECom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewECom.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewFBServBitmaps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewFBServBitmaps.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewHeapTracking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewHeapTracking.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingResults.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingResults.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingSettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewHeapTrackingSettings.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewKernel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewKernel.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewKernelContainers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewKernelContainers.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewKernelHeap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewKernelHeap.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewKernelObjects.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewMainMenu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewMainMenu.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewMemoryTrackingAutoStartConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewMemoryTrackingAutoStartConfig.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewObserver.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewOpenFiles.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewOpenFiles.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewProcesses.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewProcesses.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewRAMInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewRAMInfo.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewROMInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewROMInfo.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewServerList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewServerList.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewSystemConfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewSystemConfig.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemActiveObject.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemChunk.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemCodeSeg.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneralInfo.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemGeneric.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemHeap.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemList.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemMemoryTracking.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemMemoryTracking.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemServer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreadInfoItemStack.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewThreads.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewThreads.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewType.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewType.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/MemSpyViewWindowGroups.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/MemSpyViewWindowGroups.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/inc/viewcli.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/inc/viewcli.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyApp.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyAppUi.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyContainer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyDeviceWideOperationDialog.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyDocument.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyExportBitmapsToMemoryCardDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyExportBitmapsToMemoryCardDialog.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpySettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpySettings.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyUiUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyUiUtils.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewBase.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewChunkList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewChunkList.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewCodeSegList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewCodeSegList.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewDriveInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewDriveInfo.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewECom.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewECom.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewFBServBitmaps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewFBServBitmaps.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewHeapTracking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewHeapTracking.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewHeapTrackingResults.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewHeapTrackingResults.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewHeapTrackingSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewHeapTrackingSettings.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewKernel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewKernel.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewKernelContainers.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewKernelHeap.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewKernelObjects.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewMainMenu.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewMainMenu.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewMemoryTrackingAutoStartConfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewMemoryTrackingAutoStartConfig.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewOpenFiles.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewOpenFiles.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewProcesses.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewRAMInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewRAMInfo.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewROMInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewROMInfo.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewServerList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewServerList.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewSystemConfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewSystemConfig.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemActiveObject.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemChunk.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemCodeSeg.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneralInfo.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemGeneric.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemHeap.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemList.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemMemoryTracking.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemServer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreadInfoItemStack.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewThreads.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewThreads.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewType.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewType.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/avkon/src/MemSpyViewWindowGroups.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/hb.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/hb.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/enginewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/enginewrapper.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyecomcategoryview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyecomcategoryview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyecomimplementationdetailview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyecomimplementationdetailview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyecomimplementationview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyecomimplementationview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyecominterfaceview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyecominterfaceview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyheapdumpsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyheapdumpsview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspykernelobjectdetailview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspykernelobjectdetailview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspykernelobjecttypeview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspykernelobjecttypeview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspykernelobjectview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspykernelobjectview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspylistview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspylistview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspymainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspymainview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyprocessview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyprocessview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyserverview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyserverview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspysettingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspysettingsview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyswmtview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyswmtview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspythreaddetailindexview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspythreaddetailindexview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspythreaddetailview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspythreaddetailview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspythreadview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspythreadview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspytrackingview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspytrackingview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/memspyview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/memspyview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/inc/viewmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/inc/viewmanager.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/enginewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/enginewrapper.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/main.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyecomcategoryview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyecomcategoryview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyecomimplementationdetailview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyecomimplementationdetailview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyecomimplementationview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyecomimplementationview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyecominterfaceview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyecominterfaceview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyheapdumpsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyheapdumpsview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspykernelobjectdetailview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspykernelobjectdetailview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspykernelobjecttypeview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspykernelobjectview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspykernelobjectview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspylistview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspylistview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspymainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspymainview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyprocessview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyprocessview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyserverview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyserverview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspysettingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspysettingsview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyswmtview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyswmtview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspythreaddetailindexview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspythreaddetailindexview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspythreaddetailview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspythreaddetailview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspythreadview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspythreadview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspytrackingview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspytrackingview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/memspyview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/memspyview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/memspyui/ui/hb/src/viewmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/memspyui/ui/hb/src/viewmanager.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/data/perfmon.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/data/perfmon.rss Fri Sep 03 17:11:21 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: +* +*/ + + + +NAME MATT + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "perfmon.hrh" +#include "perfmon_std.h" +#include +#include + + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name { buf=""; } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO + { + status_pane = r_perfmon_status_pane; + //menubar = r_perfmon_menubar; + //cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + +//---------------------------------------------------- +// r_perfmon_status_pane +//---------------------------------------------------- +// +RESOURCE STATUS_PANE_APP_MODEL r_perfmon_status_pane + { + panes= + { + SPANE_PANE + { + id = EEikStatusPaneUidNavi; + type = EAknCtNaviPane; + resource = r_perfmon_navi_decorator; + } + }; + } + +//---------------------------------------------------- +// r_perfmon_navi_decorator +//---------------------------------------------------- +// +RESOURCE NAVI_DECORATOR r_perfmon_navi_decorator + { + type = ENaviDecoratorControlTabGroup; + control = TAB_GROUP + { + tab_width = EAknTabWidthWithTwoTabs; + active = 0; + tabs = { + TAB + { + id = ETabMainViewValues; + txt = "Values"; + }, + TAB + { + id = ETabMainViewGraphs; + txt = "Graphs"; + } + }; + }; + } + +//---------------------------------------------------- +// +// r_perfmon_hotkeys +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_perfmon_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + + +//---------------------------------------------------- +// r_perfmon_view_values +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_perfmon_view_values + { + hotkeys=r_perfmon_hotkeys; + menubar=r_perfmon_menubar_view_values; + cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + +//---------------------------------------------------- +// r_perfmon_menubar_view_values +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_perfmon_menubar_view_values + { + titles= + { + MENU_TITLE { menu_pane=r_perfmon_app_menu; txt="App"; }, + MENU_TITLE { menu_pane=r_perfmon_view_values_menu; txt="Values"; } + }; + } + +//---------------------------------------------------- +// r_perfmon_view_values_menu +//---------------------------------------------------- +// + +RESOURCE MENU_PANE r_perfmon_view_values_menu + { + items= + { + }; + } + +//---------------------------------------------------- +// r_perfmon_view_graphs +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_perfmon_view_graphs + { + hotkeys=r_perfmon_hotkeys; + menubar=r_perfmon_menubar_view_graphs; + cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + +//---------------------------------------------------- +// r_perfmon_menubar_view_graphs +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_perfmon_menubar_view_graphs + { + titles= + { + MENU_TITLE { menu_pane=r_perfmon_app_menu; txt="App"; }, + MENU_TITLE { menu_pane=r_perfmon_view_graphs_menu; txt="graphs"; } + }; + } + +//---------------------------------------------------- +// r_perfmon_view_graphs_menu +//---------------------------------------------------- +// + +RESOURCE MENU_PANE r_perfmon_view_graphs_menu + { + items= + { + }; + } + + +//---------------------------------------------------- +// r_perfmon_app_menu +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_perfmon_app_menu + { + items= + { + MENU_ITEM { command=EPerfMonCmdEnableLogging; txt="Enable Logging"; }, + MENU_ITEM { command=EPerfMonCmdDisableLogging; txt="Disable Logging"; }, + MENU_ITEM { command=EPerfMonCmdSettings; txt="Settings"; }, + MENU_ITEM { command=EPerfMonCmdAbout; txt="About"; }, + MENU_ITEM { command=EAknCmdExit; txt="Exit"; } + }; + } + +//---------------------------------------------------- +// r_perfmon_settings_dialog +// Dialog for setting list +//---------------------------------------------------- +// +RESOURCE DIALOG r_perfmon_settings_dialog + { + flags = + EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | + EEikDialogFlagWait | EEikDialogFlagNoTitleBar; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + items = + { + DLG_LINE + { + type = EAknCtSettingListBox; + id = EPerfMonSettingItemList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = LISTBOX + { + flags = EAknListBoxSelectionList; + }; + } + }; + } + +//---------------------------------------------------- +// r_perfmon_settings_menubar +//---------------------------------------------------- +// + +RESOURCE MENU_BAR r_perfmon_settings_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_perfmon_settings_menupane; + txt = " "; // dummy + } + }; + } + +RESOURCE MENU_PANE r_perfmon_settings_menupane + { + items = + { + MENU_ITEM + { + command = EPerfMonCmdSettingsChange; + txt = "Change"; + }, + MENU_ITEM + { + command = EPerfMonCmdSettingsExit; + txt = "Exit"; + } + }; + } + + +//---------------------------------------------------- +// +// Setting item resources +// +//---------------------------------------------------- +// + +// generic resources +RESOURCE POPUP_SETTING_LIST r_popup_setting_list_editor + { + } +RESOURCE AVKON_SETTING_PAGE r_binary_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_yesno_binaryselection_texts + { + setting_texts_resource = r_yesno_binaryselection_text_array; + } +RESOURCE ARRAY r_yesno_binaryselection_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=0; text = "No"; }, + AVKON_ENUMERATED_TEXT { value=1; text = "Yes"; } + }; + } + +// +// resources for heartbeat selection +// +RESOURCE TBUF r_heartbeat_setting_title + { + buf = "Heart beat (ms)"; + } +RESOURCE AVKON_SETTING_PAGE r_heartbeat_setting_page + { + type = EAknCtIntegerEdwin; + editor_resource_id = r_heartbeat_integer_editor; + } +RESOURCE AVKON_INTEGER_EDWIN r_heartbeat_integer_editor + { + maxlength = 5; + min = 1; + max = 99999; + } + + +// +// resources for maxsamples selection +// +RESOURCE TBUF r_maxsamples_setting_title + { + buf = "Max samples"; + } +RESOURCE AVKON_SETTING_PAGE r_maxsamples_setting_page + { + type = EAknCtIntegerEdwin; + editor_resource_id = r_maxsamples_integer_editor; + } +RESOURCE AVKON_INTEGER_EDWIN r_maxsamples_integer_editor + { + maxlength = 4; + min = 1; + max = 9999; + } + + +// +// resources for priority selection +// +RESOURCE TBUF r_priority_setting_title + { + buf = "Priority"; + } +RESOURCE AVKON_SETTING_PAGE r_priority_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_priority_setting_texts + { + setting_texts_resource = r_priority_text_array; + } +RESOURCE ARRAY r_priority_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeMuchLess; text = "Much less"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeLess; text = "Less"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeNormal; text = "Normal"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeMore; text = "More"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeMuchMore; text = "Much more"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeRealTime; text = "Real time"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteVeryLow; text = "Abs. very low"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteLow; text = "Abs. low"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteBackground; text = "Abs. background"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteForeground; text = "Abs. foreground"; }, + AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteHigh; text = "Abs. high"; } + }; + } + + +// +// resources for cpumode selection +// +RESOURCE TBUF r_cpumode_setting_title + { + buf = "CPU sampling mode"; + } +RESOURCE AVKON_SETTING_PAGE r_cpumode_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_cpumode_setting_texts + { + setting_texts_resource = r_cpumode_text_array; + } +RESOURCE ARRAY r_cpumode_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=ECPUModeCPUTime; text = "CPU Time"; }, + AVKON_ENUMERATED_TEXT { value=ECPUModeNOPs; text = "NOPs"; } + }; + } + + +// +// resources for keepbacklighton selections +// +RESOURCE TBUF r_keepbacklighton_setting_title + { + buf = "Keep backlight on"; + } + + +// +// resources for enablepowermonitoring selections +// +RESOURCE TBUF r_powermonitoringenabled_setting_title + { + buf = "Enable power monitoring"; + } + + +// +// resources for datapopupvisibility selection +// +RESOURCE TBUF r_datapopupvisibility_setting_title + { + buf = "Visibility"; + } +RESOURCE AVKON_SETTING_PAGE r_datapopupvisibility_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_datapopupvisibility_setting_texts + { + setting_texts_resource = r_datapopupvisibility_text_array; + } +RESOURCE ARRAY r_datapopupvisibility_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=EDataPopupVisbilityAlwaysOn; text = "On"; }, + AVKON_ENUMERATED_TEXT { value=EDataPopupVisbilityBackgroundOnly; text = "Backgr. only"; }, + AVKON_ENUMERATED_TEXT { value=EDataPopupVisbilityAlwaysAlwaysOff; text = "Off"; } + }; + } + +// +// resources for datapopuplocation selection +// +RESOURCE TBUF r_datapopuplocation_setting_title + { + buf = "Location"; + } +RESOURCE AVKON_SETTING_PAGE r_datapopuplocation_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_datapopuplocation_setting_texts + { + setting_texts_resource = r_datapopuplocation_text_array; + } +RESOURCE ARRAY r_datapopuplocation_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=EDataPopupLocationTopRight; text = "Top right"; }, + AVKON_ENUMERATED_TEXT { value=EDataPopupLocationBottomMiddle; text = "Bottom middle"; } + }; + } + +// +// resources for sources selection +// +RESOURCE TBUF r_sources_setting_title + { + buf = "Sources"; + } +RESOURCE AVKON_SETTING_PAGE r_sources_setting_page + { + type = EAknSetListBox; + editor_resource_id = r_sources_items_listbox; + label = "Sources"; + } +RESOURCE LISTBOX r_sources_items_listbox + { + flags = EAknListBoxMultipleSelection; + } + + +// +// resources for graphsverticalbar selection +// +RESOURCE TBUF r_graphsverticalbar_setting_title + { + buf = "Vertical bar period (s)"; + } +RESOURCE AVKON_SETTING_PAGE r_graphsverticalbar_setting_page + { + type = EAknCtIntegerEdwin; + editor_resource_id = r_graphsverticalbar_integer_editor; + } +RESOURCE AVKON_INTEGER_EDWIN r_graphsverticalbar_integer_editor + { + maxlength = 3; + min = 0; + max = 999; + } + + +// +// resources for loggingmode selection +// +RESOURCE TBUF r_loggingmode_setting_title + { + buf = "Mode"; + } +RESOURCE AVKON_SETTING_PAGE r_loggingmode_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_loggingmode_setting_texts + { + setting_texts_resource = r_loggingmode_text_array; + } +RESOURCE ARRAY r_loggingmode_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=ELoggingModeRDebug; text = "RDebug"; }, + AVKON_ENUMERATED_TEXT { value=ELoggingModeLogFile; text = "Log file"; }, + AVKON_ENUMERATED_TEXT { value=ELoggingModeRDebugLogFile; text = "RDebug & log file"; } + }; + } + + +// +// resources for loggingfilepath selection +// +RESOURCE TBUF r_loggingfilepath_setting_title + { + buf = "Log file path"; + } +RESOURCE AVKON_SETTING_PAGE r_loggingfilepath_setting_page + { + type = EEikCtEdwin; + editor_resource_id = r_loggingfilepath_text_editor; + } + +RESOURCE EDWIN r_loggingfilepath_text_editor + { + lines = 0; // expanding to multiple rows + maxlength = 63; + flags = EEikEdwinNoLineOrParaBreaks; + } + + +// --------------------------------------------------------- +// +// r_perfmon_about_dialog +// About dialog - show version and copyright info etc. +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_perfmon_about_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "About PerfMon"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + 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."; + }; + } + }; + } + +// --------------------------------------------------------- +// r_general_confirmation_query +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_general_confirmation_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + }; + } + }; + } + +// --------------------------------------------------------- +// r_general_text_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_text_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + width = 256; + lines = 3; + maxlength = 256; + }; + }; + } + }; + } + +// --------------------------------------------------------- +// r_general_numeric_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_numeric_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = ENumberLayout; + control = AVKON_INTEGER_EDWIN + { + min = -999999; + max = 999999; + }; + }; + } + }; + } + + +// --------------------------------------------------------- +// +// RESOURCE LOCALISABLE_APP_INFO +// +// --------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_perfmon_localisable_app_info + { + short_caption = "PerfMon"; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = "PerfMon"; + + number_of_icons = 1; + + // Note for ROM-based apps it is recommended to add the drive letter + // icon_file = "z:"APP_BITMAP_DIR"\\myapp_aif.mif"; + icon_file = APP_BITMAP_DIR"\\perfmon_aif.mif"; + }; + } diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/data/perfmon_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/data/perfmon_reg.rss Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 + + +UID2 KUidAppRegistrationResourceFile +UID3 0x20011385 + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "PerfMon"; + localisable_resource_file = APP_RESOURCE_DIR"\\PerfMon"; + localisable_resource_id = R_PERFMON_LOCALISABLE_APP_INFO; + group_name = "RnD Tools"; + } diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/engine/inc/perfmon.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/engine/inc/perfmon.hrh Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/engine/inc/perfmon_engine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/engine/inc/perfmon_engine.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/engine/inc/perfmon_powerlistener.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/engine/inc/perfmon_powerlistener.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/engine/src/perfmon_engine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/engine/src/perfmon_engine.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,1129 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies 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), + iPowerClient(0) + { + } + +// -------------------------------------------------------------------------------------------- + +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) + { + 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) + { + 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) + { + 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) + { + 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/engine/src/perfmon_powerlistener.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/engine/src/perfmon_powerlistener.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/envpatcher/EnvPatcher.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/envpatcher/EnvPatcher.pl Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,544 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# Environment Patcher - Patches older S60 SDKs for supporting +# tricks in newer platforms +# + + +require v5.6.1; + +use File::Copy; +use strict; + +# check amount of commandline options is valid +if (@ARGV != 1) +{ + print "Usage: EnvPatcher \n"; + exit 1; +} + + +# get epocroot and convert, convert \ -> / +(my $epocroot = $ARGV[0]) =~ s{\\}{/}g; + +# remove any trailing forward slashes +$epocroot =~ s/\/$//; + + +# create variables for paths +my $e32toolsdir = $epocroot."/epoc32/tools"; +my $e32includedir = $epocroot."/epoc32/include"; +my $e32includeoemdir = $e32includedir."/oem"; +my $platformpathspath = $e32includedir."/platform_paths.hrh"; +my $domainplatformpathspath = $e32includedir."/domain/osextensions/platform_paths.hrh"; +my $mmppmpath = $e32toolsdir."/mmp.pm"; +my $pathutlpmpath = $e32toolsdir."/pathutl.pm"; +my $prepfilepmpath = $e32toolsdir."/prepfile.pm"; + +# variables for hacked content +my $dependshack = "\t\t\tif (/^DEPENDS\$/o) {\r\n\t\t\t\tnext LINE; # Ignore DEPENDS keyword, not needed by ABLD\r\n\t\t\t}\r\n"; +my $smpsafehack = "\t\tif (/^SMPSAFE\$/o) {\r\n\t\t\tnext LINE; # Ignore SMPSAFE keyword, not needed by older environments\r\n\t\t}\r\n"; +my $forwardslashhack = "\t\t# EnvPatcher forwardslash hack begins\r\n\t\t\$_=~s{/}{\\\\}g; # convert all forward slashes to backslashes\r\n\t\t# EnvPatcher forwardslash hack ends\r\n\r\n"; +my $coreibyexportsupport = "\r\n// Following definition is used for exporting tools and stubs IBY files to\r\n// Core image.\r\n#define CORE_IBY_EXPORT_PATH(path,exported) /epoc32/rom/include/##exported\r\n"; + + +# check epoc32\tools exists +unless (-d $e32toolsdir) +{ + print "$e32toolsdir not found, please check valid epocroot has been given!\n"; + exit 1; +} + +# check epoc32\include exists +unless (-d $e32includedir) +{ + print "$e32includedir not found, please check valid epocroot has been given!\n"; + exit 1; +} + + +# create epoc32\include\oem if it does not exist +unless (-d $e32includeoemdir) +{ + mkdir $e32includeoemdir or die; + print "Missing directory $e32includeoemdir created succesfully.\n"; +} + + +# check if epoc32\include\domain\osextensions\platform_paths.hrh exists +if (-e $domainplatformpathspath) +{ + # show an error if the file does not have any platform macros + unless (string_exists_in_file($domainplatformpathspath, "OS_LAYER_SYSTEMINCLUDE")) + { + print "ERROR: $domainplatformpathspath does not have SF macros.\n"; + print "Please check your environment, if you have S60 3.2 OEM or newer, please get the latest version!\n"; + exit 2; + } +} + + +# check if epoc32\include\platform_paths.hrh exists +if (-e $platformpathspath) +{ + print "$platformpathspath already exists, not checking it.\n"; +} +else +{ + # create the file missing file + create_default_platform_paths_hrh(); + print "Missing file $platformpathspath created succesfully.\n"; +} + + +# check if CORE_IBY_EXPORT_PATH macro exist in the platform_paths.hrh +unless (string_exists_in_file($platformpathspath, "CORE_IBY_EXPORT_PATH")) +{ + # read content of the platform_paths.hrh + my @filecontent = read_file_to_array($platformpathspath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # find the position where the include guards start (this should be a safe position) + foreach (@filecontent) + { + if ($_ =~ /#define PLATFORM_PATHS_HRH/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos+1, 0, $coreibyexportsupport); + + # write the modified array to the file + write_file_from_array($platformpathspath, @filecontent); + + print "Platform_paths.hrh updated to support CORE_IBY_EXPORT_PATH macro.\n"; + } + else + { + print "WARNING: $platformpathspath is corrupted or not supported!\n"; + } +} + + +# check if epoc32\tools\mmp.pm exists +if (-e $mmppmpath) +{ + # check if DEPENDS keyword already exists in the file + if (string_exists_in_file($mmppmpath, "DEPENDS")) + { + print "The SDK can already handle DEPENDS keyword in a MMP file.\n"; + } + else + { + # read content of the mmp.pm file + my @filecontent = read_file_to_array($mmppmpath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # loop through the array to find the correct place + foreach (@filecontent) + { + if ($_ =~ /Unrecognised Resource Keyword/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos-1, 0, $dependshack); + + # write the modified array to the file + write_file_from_array($mmppmpath, @filecontent); + + print "Mmp.pm patched with DEPENDS keyword hack.\n"; + } + else + { + print "ERROR: Unable to find correct place from $mmppmpath for patching!\n"; + print "Your SDK environment probably is not supported by this script!\n"; + exit(2); + } + } + + # check if SMPSAFE keyword already exists in the file + if (string_exists_in_file($mmppmpath, "SMPSAFE")) + { + print "The SDK can already handle SMPSAFE keyword in a MMP file.\n"; + } + else + { + # read content of the mmp.pm file + my @filecontent = read_file_to_array($mmppmpath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # loop through the array to find the correct place + foreach (@filecontent) + { + if ($_ =~ /Unrecognised Keyword/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos, 0, $smpsafehack); + + # write the modified array to the file + write_file_from_array($mmppmpath, @filecontent); + + print "Mmp.pm patched with SMPSAFE keyword hack.\n"; + } + else + { + print "ERROR: Unable to find correct place from $mmppmpath for patching!\n"; + print "Your SDK environment probably is not supported by this script!\n"; + exit(2); + } + } +} +else +{ + print "WARNING: $mmppmpath not found, this environment is not supported!\n"; +} + + +# check if epoc32\tools\pathutl.pm exists +if (-e $pathutlpmpath) +{ + # check if "sub Path_Norm" already exists in the pathutil.pm file + # if it does not exists, then we need to patch prepfile.pm + if (string_exists_in_file($pathutlpmpath, "sub Path_Norm")) + { + print "The SDK is non Symbian OS 9.1, no need to add forward slash hack.\n"; + } + else + { + # check if prepfile.pm has already been patched + if (string_exists_in_file($prepfilepmpath, "EnvPatcher forwardslash hack")) + { + print "The SDK has already been patched with forwardslash hack.\n"; + } + else + { + # read content of the prepfile.pm file + my @filecontent = read_file_to_array($prepfilepmpath); + + my $match_found = 0; + my $i = 0; + my $match_found_pos = 0; + + # loop through the array to find the correct place + foreach (@filecontent) + { + if ($_ =~ /# skip blank lines/) + { + $match_found = 1; + $match_found_pos = $i; + last; + } + + $i++; + } + + if ($match_found) + { + # insert the patched content to the file + splice(@filecontent, $match_found_pos+6, 0, $forwardslashhack); + + # write the modified array to the file + write_file_from_array($prepfilepmpath, @filecontent); + + print "Prepfile.pm patched with forward slash hack.\n"; + } + else + { + print "ERROR: Unable to find correct place from $prepfilepmpath for patching!\n"; + print "Your SDK environment probably is not supported by this script!\n"; + exit(2); + } + } + } +} +else +{ + print "WARNING: $pathutlpmpath not found, this environment is not supported!\n"; +} + + + +# checks if string exists in the file +sub string_exists_in_file +{ + my $filepath = $_[0]; + my $findstring = $_[1]; + my $match_found = 0; + + open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!"; + + # loop through the file for occurances + while () + { + if ($_ =~ /$findstring/) + { + $match_found = 1; + last; + } + } + + close FILE; + + return $match_found; +} + + +# reads lines from a file to an array +sub read_file_to_array +{ + my $filepath = $_[0]; + + open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!"; + my @data = ; + close FILE; + + return(@data); +} + + +# writes lines from an array to a file +sub write_file_from_array +{ + my ($filepath, @data) = @_; + + # take a backup of the file + copy ($filepath, $filepath."EnvPatcher") or die "Cannot take backup of $filepath to $filepath.EnvPatcher"; + + open(FILE, ">", $filepath) or die "Failed to open $filepath for writing!"; + + # write the array to file + foreach my $line (@data) + { + print FILE "$line"; + } + + close FILE; +} + +sub create_default_platform_paths_hrh +{ + # the file does not exist, so create the missing file + open(FILE, ">", $platformpathspath) or die "Failed to open $platformpathspath for writing!\n"; + + print FILE < thus they are first. +*/ +#define APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem + +/** +* This define statements defines the SYSTEMINCLUDE-line, which is intended to be +* used in the mmp-files that are part of the middleware-layer. It includes all +* the needed directories from the /epoc32/include, that are valid ones for the +* middleware-layer components. +*/ +#define MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem + +/** +* This define statements defines the SYSTEMINCLUDE-line, which is intended to be +* used in the mmp-files that are part of the osextensions-layer. It includes all +* the needed directories from the /epoc32/include, that are valid ones for the +* os-layer components. +*/ +#define OS_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem + + +// Below statement is Deprecated and the OS_LAYER_SYSTEMINCLUDE-macro has to be +// used. +#define OSEXT_LAYER_SYSTEMINCLUDE OS_LAYER_SYSTEMINCLUDE + +/** +* This define statements defines the SYSTEMINCLUDE-line, which is intended to be +* used in the mmp-files that are part of the os-layer. This is intended +* to be only used by those components which need to use in their mmp-file either +* kern_ext.mmh or nkern_ext.mmh. Reason is that those +* 2 files already contain the /epoc32/include as system include path. +* +*/ +#define OS_LAYER_KERNEL_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/oem + + +// Below statement is Deprecated and the OS_LAYER_KERNEL_SYSTEMINCLUDE-macro +// has to be used. +#define OSEXT_LAYER_KERNEL_SYSTEMINCLUDE OS_LAYER_KERNEL_SYSTEMINCLUDE + +/** +**************************************************************************** +* Definitions that also define the paths to the layer specific source directories. +**************************************************************************** +*/ +/** +* The below 3 macros define the paths to the layer-specific source dirs. +* See usage on top of this hrh-file, these are used the same way as +* for instance the OS_LAYER_DOMAIN_EXPORT_PATH +* Deprecated: is not allowed to be using in Symbian Foundation +*/ +#define APP_LAYER_SOURCE_PATH(rest) /s60/app/##rest +#define MW_LAYER_SOURCE_PATH(rest) /s60/mw/##rest +#define OSEXT_LAYER_SOURCE_PATH(rest) /s60/osext/##rest + +/** +**************************************************************************** +* Definitions to export IBY files to different folders where they will be taken +* to ROM image +**************************************************************************** +*/ +// Following definition is used for exporting tools and stubs IBY files to +// Core image. +#define CORE_IBY_EXPORT_PATH(path,exported) /epoc32/rom/include/##exported + +/** +* --------------------------------------- +* Macros for Configuration tool migration. +* The below macros define the location under epoc32, where the confml +* (Configuration Markup Language) and crml (Central Repository Markup Language) +* files should be exported. +* --------------------------------------- +*/ +#define CONFML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file +#define CRML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file +#define GCFML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file +#define CONFML_CONFIG_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/config/##file + +#define APP_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define APP_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define APP_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define APP_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) + +#define MW_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define MW_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define MW_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define MW_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) + +// Deprecate: Use the OS_LAYER_* macros instead of OSEXT_LAYER_* +#define OSEXT_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define OSEXT_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define OSEXT_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define OSEXT_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) +#define OS_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) +#define OS_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) +#define OS_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) +#define OS_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) + +#endif // end of PLATFORM_PATHS_HRH + +ENDOFTHEFILE + + close FILE; +} diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/envpatcher/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/envpatcher/ReadMe.txt Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,46 @@ +Environment Patcher v1.0.1 +========================== + +Updated: 12th November 2009 + + +Introduction: +------------- +This tool can be used to patch your S60 SDK environment so that the tricks and +macros introduced in the latest SDKs can be used in a public SDK and older +OEM releases. + +This tool can perform the following tasks: +- Adds support for forward slashes in paths in bld.inf/.mmp files in S60 3.0 +- Removes an unncessary warning about DEPENDS and SMPSAFE resource keywords in + an .mmp file +- Creates a missing epoc32\include\platform_paths.hrh file for supporting + platform macros introduced since S60 3.2 OEM and Symbian Foundation releases +- Modifies epoc32\include\platform_paths.hrh for missing macros +- Creates a missing epoc32\include\oem directory to suppress a possible warning + + +Usage: +------ +EnvPatcher.pl + +Where EPOCROOT is the path to the root of the SDK, for example: + EnvPatcher.pl c:\Symbian\9.1\S60_3rd_MR + EnvPatcher.pl z:\ + + +Requirements: +------------- +- S60 SDK (public or OEM), version 3.0 or newer +- Perl 5.6.1 or newer + + + + +Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +All rights reserved. + +This component and the accompanying materials are made available +under the terms of "Eclipse Public License v1.0" +which accompanies this distribution, and is available +at the URL "http://www.eclipse.org/legal/epl-v10.html". diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/group/ReleaseNotes_PerfMon.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/group/ReleaseNotes_PerfMon.txt Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,95 @@ +=============================================================================== + +RELEASE NOTES - PERFORMANCE MONITOR v1.2.0 +RELEASED 26th August 2010 + +SUPPORTS S60 5.2+ + +=============================================================================== + +Product Description: +==================== +PerfMon is an S60 UI application that you can use to monitor and log CPU load +in a device. You can also use it to monitor and log the consumption of memory +(RAM and disk drives) in a device. + +Main Features: +============== +- Three different monitor views for CPU load, RAM and disk usage: + - Values + - Graphs + - Popup (always on top) +- Supports CPU load sampling via a null thread CPU counter or with NOPs +- Source selections for graphs, popup and logging +- Heartbeat and thread priority configurable via settings +- Logging to RDebug and/or to a file + +=============================================================================== + +What's New in v1.2.0 +==================== +- SMP support +- Added power usage statistics +- Error corrections + +=============================================================================== + +Installation Notes: +=================== +PerfMon is typically preinstalled on ROM. If not, it can be added to the +ROM with the .iby file. Alternatively, the .sis file can be found under the +sis-directory, but the user need to sign it with their own developer +certificate. In Nokia R&D environment, you can use directly the R&D-signed .sis +file under the internal\sis directory. + +When signing with own developer certificate, the following capabilities are +needed: + WriteDeviceData + +When builing PerfMon against S60 3.0 or 3.1, you may need to patch your SDK +environment first with some fixes. For more information, please refer to the +instructions under the "envpatcher" directory. + +=============================================================================== + +System Requirements: +==================== +Basic Requirements: +- Any S60 3.x device or emulator environment + +=============================================================================== + +Compatibility Issues: +===================== +N/A + +=============================================================================== + +Known Issues: +============= +N/A + +=============================================================================== + +Version History: +================ + +Version 1.1.1 - 26th August 2010 +==================== +- Improved Orbit UI +- Error corrections + +Version 1.0.0 - 6th March 2008 +------------------------------ +- Initial version + +=============================================================================== + +Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +All rights reserved. + +This component and the accompanying materials are made available +under the terms of "Eclipse Public License v1.0" +which accompanies this distribution, and is available +at the URL "http://www.eclipse.org/legal/epl-v10.html". + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/group/backup_registration.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/group/bld.inf Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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_platforms + +WINSCW GCCE ARMV5 ARMV6 + +#include "bld_generic.inf" + +#include "../ui/avkon/group/bld.inf" + +prj_mmpfiles + +prj_extensions \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/group/bld_generic.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/group/bld_generic.inf Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/group/group.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/group/group.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/group/perfmon_icons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/group/perfmon_icons_aif.mk Fri Sep 03 17:11:21 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=\epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\perfmon_aif.mif + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : ..\icons\qgn_menu_perfmon.svg + mifconv $(ICONTARGETFILENAME) \ + /c8,8 ..\icons\qgn_menu_perfmon.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/group/perfmon_stub_sis.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/group/perfmon_stub_sis.mk Fri Sep 03 17:11:21 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: +# + + +TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install + +SISNAME=PerfMon_stub +PKGNAME=PerfMon_stub + +$(TARGETDIR) : + @perl -S emkdir.pl "$(TARGETDIR)" + +do_nothing : + rem do_nothing + +SISFILE=$(TARGETDIR)\$(SISNAME).sis + +$(SISFILE) : ..\sis\$(PKGNAME).pkg + makesis -s $? $@ + + + +MAKMAKE : do_nothing + +RESOURCE : do_nothing + +SAVESPACE : do_nothing + +BLD : do_nothing + +FREEZE : do_nothing + +LIB : do_nothing + +CLEANLIB : do_nothing + +FINAL : $(TARGETDIR) $(SISFILE) + +CLEAN : + @if exist $(SISFILE) erase $(SISFILE) + +RELEASABLES : + @echo $(SISFILE) diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/icons/qgn_menu_perfmon.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/icons/qgn_menu_perfmon.svg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/perfmon.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/perfmon.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/rom/perfmon.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/rom/perfmon.iby Fri Sep 03 17:11:21 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_IBY__ +#define __PERFMON_IBY__ + +S60_APP_EXE(PerfMon) +S60_APP_AIF_ICONS(PerfMon) +S60_APP_RESOURCE(PerfMon) +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 + +#endif // __PERFMON_IBY__ diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/rom/perfmon_datapopup.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/rom/perfmon_datapopup.iby Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/sis/PerfMon_S60-30.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/sis/PerfMon_S60-30.pkg Fri Sep 03 17:11:21 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: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"PerfMon"},(0x20011385),1,0,0,TYPE=SA + +; Supports S60 v 3.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\UREL\PerfMon.exe"-"!:\sys\bin\PerfMon.exe" +"\epoc32\data\z\Resource\apps\PerfMon_aif.mif"-"!:\Resource\Apps\PerfMon_aif.mif" +"\epoc32\data\z\Resource\apps\PerfMon.rsc"-"!:\Resource\Apps\PerfMon.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\PerfMon_reg.rsc"-"!:\private\10003a3f\import\apps\PerfMon_reg.rsc" +"..\group\backup_registration.xml"-"!:\private\20011385\backup_registration.xml" diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/sis/PerfMon_S60-30.sis Binary file perfapps/perfmon/sis/PerfMon_S60-30.sis has changed diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/sis/PerfMon_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/sis/PerfMon_stub.pkg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,36 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; + + +; Language - standard language definitions +&EN + +; Standard SIS file header +#{"PerfMon"},(0x20011385),1,0,0 + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +""-"z:\sys\bin\PerfMon.exe" +""-"z:\Resource\Apps\PerfMon_aif.mif" +""-"z:\Resource\Apps\PerfMon.rsc" +""-"z:\private\10003a3f\import\apps\PerfMon_reg.rsc" +""-"z:\private\20011385\backup_registration.xml" + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/symbian_version.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/symbian_version.hrh Fri Sep 03 17:11:21 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_4 + + +#endif // __SYMBIAN_VERSION_HRH diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/group/bld.inf Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/group/perfmon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/group/perfmon.mmp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_app.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_appui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_appui.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_datapopupcontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_datapopupcontainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_document.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_document.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_drawcallback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_drawcallback.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_graphscontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_graphscontainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_graphsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_graphsview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_model.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_model.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_settingsviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_settingsviewdlg.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_std.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_std.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_valuescontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_valuescontainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/inc/perfmon_valuesview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/inc/perfmon_valuesview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_app.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_app.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_appui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_appui.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_datapopupcontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_datapopupcontainer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_document.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_document.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_graphscontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_graphscontainer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_graphsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_graphsview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_model.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_model.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_settingsviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_settingsviewdlg.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_valuescontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_valuescontainer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/avkon/src/perfmon_valuesview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/avkon/src/perfmon_valuesview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/app.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/app.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/application.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/application.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/datacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/datacontainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/datapopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/datapopup.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/enginewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/enginewrapper.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/graphdatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/graphdatacontainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/mainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/mainview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/mainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/mainwindow.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/popupdatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/popupdatacontainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/settingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/settingsview.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/inc/valuedatacontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/inc/valuedatacontainer.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/application.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/application.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/datapopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/datapopup.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/enginewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/enginewrapper.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/graphdatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/graphdatacontainer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/main.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/mainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/mainview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/mainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/mainwindow.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/popupdatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/popupdatacontainer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/settingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/settingsview.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/app/src/valuedatacontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/app/src/valuedatacontainer.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/datapopup.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/datapopup.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopupdialog_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopupdialog_p.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopupplugin_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopupplugin_p.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopuppluginerrors_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopuppluginerrors_p.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopupwidget_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/inc/perfmondatapopupwidget_p.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/src/perfmondatapopupdialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/src/perfmondatapopupdialog.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/src/perfmondatapopupplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/src/perfmondatapopupplugin.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/datapopup/src/perfmondatapopupwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/datapopup/src/perfmondatapopupwidget.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/win/enginewrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/win/enginewrapper.cpp Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/win/enginewrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/win/enginewrapper.h Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/perfmon/ui/hb/win/win.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/perfmon/ui/hb/win/win.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/group/bld.inf Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "bld_generic.inf" +#include "../ui/avkon/group/bld.inf" + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/group/bld_generic.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/group/bld_generic.inf Fri Sep 03 17:11:21 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: +* +*/ + +PRJ_MMPFILES +PRJ_EXTENSIONS + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/group/group.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/group/group.pro Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,21 @@ +# +# 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 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/piprofilerui.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/piprofilerui.pro Fri Sep 03 17:11:21 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 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/sis/PIProfiler_S60-30.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/sis/PIProfiler_S60-30.pkg Fri Sep 03 17:11:21 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: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/sis/PIProfiler_S60-31.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/sis/PIProfiler_S60-31.pkg Fri Sep 03 17:11:21 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: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/sis/PIProfiler_S60-32.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/sis/PIProfiler_S60-32.pkg Fri Sep 03 17:11:21 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: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/sis/PIProfiler_S60-50.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/sis/PIProfiler_S60-50.pkg Fri Sep 03 17:11:21 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: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/sis/PIProfiler_Symbian3.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/sis/PIProfiler_Symbian3.pkg Fri Sep 03 17:11:21 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: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/sis/PIProfiler_Symbian4.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/sis/PIProfiler_Symbian4.pkg Fri Sep 03 17:11:21 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: +; +&EN + +; Standard SIS file header +#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU + +; Supports S60 v 3.0 and 5.0 +[0x101F7961], 0, 0, 0, {"S60ProductID"} + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" +"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" +"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" +"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/sis/PIProfiler_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/sis/PIProfiler_stub.pkg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,33 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +&EN + +; Standard SIS file header +#{"ProfilerGUI"},(0x2001E5AE),1,0,0 + +; Non-localised vendor name +:"Nokia Corporation" + +; Localised vendor names +%{"Nokia Corporation"} + +; normal stuff: +""-"!:\sys\bin\PIProfilerUI.exe" +""-"!:\Resource\Apps\piprofilerui_aif.mif" +""-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" +""-"!:\Resource\Apps\piprofilerui.rsc" +""-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" +""-"!:\private\2001E5AE\backup_registration.xml" diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/data/piprofilerui.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/data/piprofilerui.rss Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,962 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + + +NAME PIPR + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "profiler_gui.hrh" +#include "profiler_gui_std.h" +#include +#include + + +// --------------------------------------------------------- +// +// Define the resource file signature +// This resource should be empty. +// +// --------------------------------------------------------- +// +RESOURCE RSS_SIGNATURE { } + +// --------------------------------------------------------- +// +// Default Document Name +// +// --------------------------------------------------------- +// +RESOURCE TBUF r_default_document_name { buf=""; } + +// --------------------------------------------------------- +// +// Define default menu and CBA key. +// +// --------------------------------------------------------- +// +RESOURCE EIK_APP_INFO { } + +//---------------------------------------------------- +// +// r_profiler_gui_hotkeys +// +//---------------------------------------------------- +// +RESOURCE HOTKEYS r_profiler_gui_hotkeys + { + control= + { + HOTKEY { command=EAknCmdExit; key='e'; } + }; + } + + +//---------------------------------------------------- +// r_profiler_gui_view_main +//---------------------------------------------------- +// +RESOURCE AVKON_VIEW r_profiler_gui_view_main + { + hotkeys=r_profiler_gui_hotkeys; + menubar=r_profiler_gui_menubar_view_main; + cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; + } + +//---------------------------------------------------- +// r_profiler_gui_menubar_view_main +//---------------------------------------------------- +// +RESOURCE MENU_BAR r_profiler_gui_menubar_view_main + { + titles= + { + MENU_TITLE { menu_pane=r_profiler_gui_app_menu; txt="App"; }, + MENU_TITLE { menu_pane=r_profiler_gui_view_main_menu; txt="Main"; } + }; + } + +//---------------------------------------------------- +// r_profiler_gui_view_main_menu +//---------------------------------------------------- +// + +RESOURCE MENU_PANE r_profiler_gui_view_main_menu + { + items= + { + }; + } + + + +//---------------------------------------------------- +// r_profiler_gui_app_menu +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_profiler_gui_app_menu + { + items= + { + MENU_ITEM { command=EProfilerGuiCmdStartAll;cascade = r_profiler_start_submenu; txt="Start"; }, + MENU_ITEM { command=EProfilerGuiCmdStopAll; txt="Stop profiling"; }, + MENU_ITEM { command=EProfilerGuiCmdSamplerControl; txt="Sampler control"; cascade=r_profiler_sampler_control_menu; }, + MENU_ITEM { command=EProfilerGuiCmdSettings; txt="Settings"; }, + MENU_ITEM { command=EProfilerGuiCmdAbout; txt="About"; }, + MENU_ITEM { command=EAknCmdExit; txt="Exit"; } + }; + } + +//---------------------------------------------------- +// r_profiler_start_submenu +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_profiler_start_submenu + { + items = + { + MENU_ITEM + { + command = EProfilerGuiCmdStartAll; + txt = "Profiling"; + } + }; + } + +//---------------------------------------------------- +// r_profiler_sampler_control_menu +//---------------------------------------------------- +// +RESOURCE MENU_PANE r_profiler_sampler_control_menu + { + items= + { + MENU_ITEM { command=EProfilerGuiCmdSamplerEnable; txt="Enable"; }, + MENU_ITEM { command=EProfilerGuiCmdSamplerDisable; txt="Disable"; }, + MENU_ITEM { command=EProfilerGuiCmdSamplerSettings; txt="Sampler settings"; }, + MENU_ITEM { command=EProfilerGuiCmdSamplerInfo; txt="Sampler info"; } + }; + } + + +//---------------------------------------------------- +// r_profiler_gui_settings_dialog +// Dialog for setting list +//---------------------------------------------------- +// +RESOURCE DIALOG r_profiler_gui_settings_dialog + { + flags = + EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | + EEikDialogFlagWait | EEikDialogFlagNoTitleBar; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + items = + { + DLG_LINE + { + type = EAknCtSettingListBox; + id = EProfilerGuiSettingItemList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = LISTBOX + { + flags = EAknListBoxSelectionList; + }; + } + }; + } + +// generic resources +RESOURCE POPUP_SETTING_LIST r_popup_setting_list_editor + { + } +RESOURCE AVKON_SETTING_PAGE r_binary_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_yesno_binaryselection_texts + { + setting_texts_resource = r_yesno_binaryselection_text_array; + } +RESOURCE ARRAY r_yesno_binaryselection_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=0; text = "No"; }, + AVKON_ENUMERATED_TEXT { value=1; text = "Yes"; } + }; + } + + +// +// resources for plugin name mode selection +// +RESOURCE TBUF r_plugin_name_mode_setting_title + { + buf = "Sampler name length"; + } +RESOURCE AVKON_SETTING_PAGE r_plugin_name_mode_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_plugin_name_mode_setting_texts + { + setting_texts_resource = r_plugin_name_mode_text_array; + } +RESOURCE ARRAY r_plugin_name_mode_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=ESamplerNameShort; text = "Short"; }, + AVKON_ENUMERATED_TEXT { value=ESamplerNameMedium; text = "Medium"; }, + AVKON_ENUMERATED_TEXT { value=ESamplerNameLong; text = "Long"; } + }; + } + + +// +// resources for trace output selection +// +RESOURCE TBUF r_trace_output_setting_title + { + buf = "Output to"; + } +RESOURCE AVKON_SETTING_PAGE r_trace_output_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_trace_output_setting_texts + { + setting_texts_resource = r_trace_output_text_array; + } +RESOURCE ARRAY r_trace_output_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=EOutputToDebugPort; text = "Debug output"; }, + AVKON_ENUMERATED_TEXT { value=EOutputToFileSystem; text = "File system"; } + }; + } + + +// +// resources for save_file_prefix selection +// +RESOURCE TBUF r_save_file_prefix_setting_title + { + buf = "File prefix"; + } +RESOURCE AVKON_SETTING_PAGE r_save_file_prefix_setting_page + { + type = EEikCtEdwin; + editor_resource_id = r_save_file_prefix_text_editor; + } + +RESOURCE EDWIN r_save_file_prefix_text_editor + { + lines = 0; // expanding to multiple rows + maxlength = 63; + flags = EEikEdwinNoLineOrParaBreaks; + } + +// +// resources for save file drive selection +// +RESOURCE TBUF r_save_file_drive_setting_title + { + buf = "Save file in"; + } +RESOURCE AVKON_SETTING_PAGE r_save_file_drive_setting_page + { + type = EEikCtEdwin; + editor_resource_id = r_save_file_drive_text_editor; + } + +RESOURCE EDWIN r_save_file_drive_text_editor + { + lines = 0; // expanding to multiple rows + maxlength = 63; + flags = EEikEdwinNoLineOrParaBreaks; + } + +// +// resources for trace mode selection +// +RESOURCE TBUF r_trace_mode_setting_title + { + buf = "Trace mode"; + } +RESOURCE AVKON_SETTING_PAGE r_trace_mode_setting_page + { + number = EAknSettingPageNoOrdinalDisplayed; + type = EAknCtPopupSettingList; + editor_resource_id = r_popup_setting_list_editor; + } +RESOURCE AVKON_POPUP_SETTING_TEXTS r_trace_mode_setting_texts + { + setting_texts_resource = r_trace_mode_text_array; + } +RESOURCE ARRAY r_trace_mode_text_array + { + items = + { + AVKON_ENUMERATED_TEXT { value=ETraceModeStream; text = "Stream"; }, + AVKON_ENUMERATED_TEXT { value=ETraceModeBuffer; text = "Memory buffer"; } + }; + } + +// +// resources for timed_sampling_period selection +// +RESOURCE TBUF r_timed_sampling_period_setting_title + { + buf = "Profiling period (sec.)"; + } +RESOURCE AVKON_SETTING_PAGE r_timed_sampling_period_setting_page + { + type = EAknCtIntegerEdwin; + editor_resource_id = r_timed_sampling_period_integer_editor; + } + +RESOURCE AVKON_INTEGER_EDWIN r_timed_sampling_period_integer_editor + { + maxlength = 6; + min = 1; + max = 999999; + } + + +//---------------------------------------------------- +// r_profiler_gui_settings_menubar +//---------------------------------------------------- +// + +RESOURCE MENU_BAR r_profiler_gui_settings_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_profiler_gui_settings_menupane; + txt = " "; // dummy + } + }; + } + +RESOURCE MENU_PANE r_profiler_gui_settings_menupane + { + items = + { + MENU_ITEM + { + command = EProfilerGuiCmdSettingsChange; + txt = "Change"; + }, + MENU_ITEM + { + command = EProfilerGuiCmdSettingsExit; + txt = "Exit"; + } + }; + } + +//---------------------------------------------------- +// r_profiler_gui_settings_dialog +// Dialog for setting list +//---------------------------------------------------- +// +RESOURCE DIALOG r_profiler_sampler_settings_dialog + { + flags = + EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | + EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | + EEikDialogFlagWait | EEikDialogFlagNoTitleBar; + buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; + items = + { + DLG_LINE + { + type = EAknCtSettingListBox; + id = EProfilerSamplerSettingItemList; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = LISTBOX + { + flags = EAknListBoxSelectionList; + }; + } + }; + } + +//---------------------------------------------------- +// r_profiler_sampler_settings_menubar +//---------------------------------------------------- +// + +RESOURCE MENU_BAR r_profiler_sampler_settings_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_profiler_sampler_settings_menupane; + txt = "Sampler settings"; + } + }; + } + +RESOURCE MENU_PANE r_profiler_sampler_settings_menupane + { + items = + { + MENU_ITEM + { + command = EProfilerGuiCmdSettingsChange; + txt = "Change"; + }, + MENU_ITEM + { + command = EProfilerGuiCmdSettingsExit; + txt = "Exit"; + } + }; + } + + +// --------------------------------------------------------- +// +// r_profiler_gui_about_dialog +// About dialog - show version and copyright info etc. +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_profiler_gui_about_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "About Profiler"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + 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."; + }; + } + }; + } + +// --------------------------------------------------------- +// r_sampler_rate_setting_page +// --------------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_sampler_rate_setting_page + { + type = EAknCtIntegerEdwin; + editor_resource_id = r_sampler_rate_integer_editor; + } +RESOURCE AVKON_INTEGER_EDWIN r_sampler_rate_integer_editor + { + maxlength = 6; + min = 250; + max = 999999; + } + +// --------------------------------------------------------- +// r_cpu_sampler_rate_setting_page +// --------------------------------------------------------- +// +RESOURCE AVKON_SETTING_PAGE r_cpu_sampler_rate_setting_page + { + type = EAknCtIntegerEdwin; + editor_resource_id = r_cpu_sampler_rate_integer_editor; + } +RESOURCE AVKON_INTEGER_EDWIN r_cpu_sampler_rate_integer_editor + { + maxlength = 5; + min = 1; + max = 10000; + } + +// --------------------------------------------------------- +// +// r_generic_sampler_dlg_line_sample_rate +// Empty about dialog - show sampler plugin info in this +// +// --------------------------------------------------------- +// +RESOURCE DLG_LINE r_generic_sampler_dlg_line_sample_rate + { + type = EEikCtNumberEditor; + prompt = "Sample rate (ms)"; + id = EProfilerGuiGenericSamplerQuerySampleRate; + itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; + control = NUMBER_EDITOR + { + min = 1000; + max = 10000; + }; + } + +// --------------------------------------------------------- +// +// r_profiler_gui_empty_about_dialog +// Empty about dialog - show sampler plugin info in this +// +// --------------------------------------------------------- +// +RESOURCE DIALOG r_profiler_gui_empty_about_dialog + { + flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtPopupHeadingPane; + id = EAknMessageQueryHeaderId; + control = AVKON_HEADING + { + label = "About"; + headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; + }; + }, + DLG_LINE + { + type = EAknCtMessageQuery; + id = EAknMessageQueryContentId; + control = AVKON_MESSAGE_QUERY + { + message = ""; + }; + } + }; + } + + +RESOURCE TBUF r_dummy_setting_title + { + buf = ""; + } + +RESOURCE TBUF r_sample_rate_setting_title + { + buf = "Sample rate (ms)"; + } + +RESOURCE TBUF r_item1_setting_title + { + buf = "Item1"; + } + +RESOURCE TBUF r_item2_setting_title + { + buf = "Item2"; + } + +RESOURCE TBUF r_item3_setting_title + { + buf = "Item3"; + } + +RESOURCE TBUF r_item4_setting_title + { + buf = "Item4"; + } + +RESOURCE TBUF r_item5_setting_title + { + buf = "Item5"; + } + +RESOURCE TBUF r_item6_setting_title + { + buf = "Item6"; + } + +RESOURCE AVKON_SETTING_PAGE r_numeric_setting_page + { + type = EAknCtIntegerEdwin; + editor_resource_id = r_numeric_integer_editor; + } +RESOURCE AVKON_INTEGER_EDWIN r_numeric_integer_editor + { + maxlength = 5; + min = 0; + max = 10000; + } + +// +// resources for text selection +// +RESOURCE AVKON_SETTING_PAGE r_generic_text_setting_page + { + type = EEikCtEdwin; + editor_resource_id = r_generic_text_editor; + } + +RESOURCE EDWIN r_generic_text_editor + { + lines = 0; // expanding to multiple rows + maxlength = 63; + flags = EEikEdwinNoLineOrParaBreaks; + } + + +// --------------------------------------------------------- +// r_general_confirmation_query +// --------------------------------------------------------- +// + +RESOURCE DIALOG r_general_confirmation_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + }; + } + }; + } + +// --------------------------------------------------------- +// r_general_text_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_text_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EDataLayout; + control = EDWIN + { + width = 256; + lines = 3; + maxlength = 256; + }; + }; + } + }; + } + +// --------------------------------------------------------- +// r_general_text_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_general_numeric_query + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control= AVKON_DATA_QUERY + { + layout = ENumberLayout; + control = AVKON_INTEGER_EDWIN + { + min = -999999; + max = 999999; + }; + }; + } + }; + } + + +// --------------------------------------------------------- +// r_item_action_query +// --------------------------------------------------------- +// +RESOURCE DIALOG r_item_action_query_enabled + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_item_action_query_array_enabled; + }; + heading = "Sampler controls"; + }; + } + }; + } + +RESOURCE DIALOG r_item_action_query_disabled + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_item_action_query_array_disabled; + }; + heading = "Sampler controls"; + }; + } + }; + } + +RESOURCE DIALOG r_item_action_query_hidden_settings_enabled + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_item_action_query_array_hidden_settings_enabled; + }; + heading = "Sampler controls"; + }; + } + }; + } + +RESOURCE DIALOG r_item_action_query_hidden_settings_disabled + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_item_action_query_array_hidden_settings_disabled; + }; + heading = "Sampler controls"; + }; + } + }; + } + +RESOURCE DIALOG r_item_action_query_hidden_start_stop + { + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control= AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + listbox = AVKON_LIST_QUERY_LIST + { + array_id = r_item_action_query_array_hidden_start_stop; + }; + heading = "Sampler controls"; + }; + } + }; + } + +RESOURCE ARRAY r_item_action_query_array_disabled + { + items = + { + LBUF {txt = "Enable"; }, + LBUF {txt = "Sampler settings"; }, + LBUF {txt = "Sampler info"; } + }; + } + +RESOURCE ARRAY r_item_action_query_array_enabled + { + items = + { + LBUF {txt = "Disable"; }, + LBUF {txt = "Sampler settings"; }, + LBUF {txt = "Sampler info"; } + }; + } + +RESOURCE ARRAY r_item_action_query_array_hidden_settings_disabled + { + items = + { + LBUF {txt = "Enable"; }, + LBUF {txt = "Sampler info"; } + }; + } + +RESOURCE ARRAY r_item_action_query_array_hidden_settings_enabled + { + items = + { + LBUF {txt = "Disable"; }, + LBUF {txt = "Sampler info"; } + }; + } + +RESOURCE ARRAY r_item_action_query_array_hidden_start_stop + { + items = + { + LBUF {txt = "Sampler settings"; }, + LBUF {txt = "Sampler info"; } + }; + } + +RESOURCE STATUS_PANE_APP_MODEL r_profiler_gui_status_pane + { + panes = + { + SPANE_PANE + { + id = EEikStatusPaneUidTitle; + type = EAknCtTitlePane; + resource = r_profiler_gui_title_resource; + }, + SPANE_PANE + { + id = EEikStatusPaneUidNavi; + type = EAknCtNaviPane; + resource = r_profiler_gui_navi_text_idle; + } + }; + } + +RESOURCE TITLE_PANE r_profiler_gui_title_resource + { + txt = "PI Profiler"; + } + +RESOURCE TBUF r_profiler_gui_navi_text_idle + { + buf = "Idle"; + } + +RESOURCE TBUF r_profiler_gui_navi_text_initializing + { + buf = "Initializing..."; + } + +RESOURCE TBUF r_profiler_gui_navi_text_running + { + buf = "Profiling..."; + } + +RESOURCE TBUF r_profiler_gui_navi_text_stopping + { + buf = "Stopping..."; + } + +RESOURCE DIALOG r_profiler_gui_conf_query + { + flags = EAknGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_YES_NO; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EProfilerGuiViewConfQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = "Leave profiling on?"; + }; + } + }; + } + +// +// RESOURCE LOCALISABLE_APP_INFO +// +// --------------------------------------------------------- +// +RESOURCE LOCALISABLE_APP_INFO r_profiler_gui_localisable_app_info + { + short_caption = "PI Profiler"; + caption_and_icon = + CAPTION_AND_ICON_INFO + { + caption = "PI Profiler"; + + number_of_icons = 1; + + // Note for ROM-based apps it is recommended to add the drive letter + icon_file = APP_BITMAP_DIR"\\piprofilerui_aif.mif"; + }; + } diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/data/piprofilerui_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/data/piprofilerui_reg.rss Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 + + +UID2 KUidAppRegistrationResourceFile +UID3 0x2001E5AE + + +RESOURCE APP_REGISTRATION_INFO + { + app_file = "PIProfilerUI"; + localisable_resource_file = APP_RESOURCE_DIR"\\PIProfilerUI"; + localisable_resource_id = R_PROFILER_GUI_LOCALISABLE_APP_INFO; + group_name = "RnD Tools"; + } diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/group/backup_registration.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/group/backup_registration.xml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,8 @@ + + + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/group/bld.inf Fri Sep 03 17:11:21 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 + + +PRJ_EXPORTS +../group/backup_registration.xml Z:/private/2001E5AE/backup_registration.xml +../rom/piprofilerui_avkon.iby CORE_IBY_EXPORT_PATH(tools,piprofilerui.iby) + +PRJ_MMPFILES +#ifndef SBSV2 + gnumakefile piprofilerui_icons_aif.mk + gnumakefile piprofilerui_extraicons.mk +#endif + +piprofilerui.mmp + + +#ifdef SBSV2 + PRJ_EXTENSIONS + START EXTENSION s60/mifconv + OPTION TARGETFILE piprofilerui_aif.mif + OPTION SOURCEDIR ../../icons + OPTION SOURCES -c8,8 qgn_menu_piprofilerui + END + + START EXTENSION s60/mifconv + OPTION TARGETFILE piprofilerui_extraicons.mif + OPTION HEADERFILE piprofilerui_extraicons.mbg + OPTION SOURCEDIR ../../icons + OPTION SOURCES -c8,8 qgn_prob_piprofilerui_status_disabled -c8,8 qgn_prob_piprofilerui_status_enabled + END +#endif diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/group/piprofilerui.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/group/piprofilerui.mmp Fri Sep 03 17:11:21 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 +#include + + +TARGET PIProfilerUI.exe +TARGETTYPE exe +EPOCSTACKSIZE 0x8000 +EPOCHEAPSIZE 0x10000 0x1000000 // Min 64Kb, Max 16Mb + +UID 0x100039CE 0x2001E5AE + +VENDORID VID_DEFAULT +CAPABILITY ALL -TCB //swevent networkservices +SMPSAFE + +LANG SC + +START RESOURCE ../data/piprofilerui.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +END + +START RESOURCE ../data/piprofilerui_reg.rss +DEPENDS piprofilerui.rsg +TARGETPATH /private/10003a3f/apps +END + +APP_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc +SOURCEPATH ../src + + +SOURCE profiler_gui_app.cpp +SOURCE profiler_gui_document.cpp +SOURCE profiler_gui_appui.cpp +SOURCE profiler_gui_model.cpp +SOURCE profiler_gui_mainview.cpp +SOURCE profiler_gui_maincontainer.cpp +SOURCE profiler_gui_settingsviewdlg.cpp +SOURCE profiler_gui_samplersettingsviewdlg.cpp + + +LIBRARY euser.lib +LIBRARY eiksrv.lib +LIBRARY CommonEngine.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY eikctl.lib +LIBRARY eikdlg.lib +LIBRARY avkon.lib +LIBRARY ws32.lib +LIBRARY apgrfx.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY gdi.lib +LIBRARY aknnotify.lib +LIBRARY aknicon.lib +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY egul.lib +LIBRARY estor.lib +LIBRARY flogger.lib +LIBRARY charconv.lib +LIBRARY sysutil.lib +LIBRARY platformenv.lib diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk Fri Sep 03 17:11:21 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_extraicons.mif + +HEADERDIR=$(EPOCROOT)epoc32\include +HEADERFILENAME=$(HEADERDIR)\piprofilerui_extraicons.mbg + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + @if exist $(HEADERFILENAME) erase $(HEADERFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) (HEADERFILENAME) : ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg + mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ + /c8,8 ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg \ + /c8,8 ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(HEADERFILENAME) && \ + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk Fri Sep 03 17:11:21 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: +# + +ifeq (WINS,$(findstring WINS, $(PLATFORM))) +ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z +else +ZDIR=$(EPOCROOT)epoc32\data\z +endif + +TARGETDIR=$(ZDIR)\resource\apps +ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_aif.mif + + +do_nothing : + @rem do_nothing + +MAKMAKE : do_nothing + +BLD : do_nothing + +CLEAN : + @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) + +LIB : do_nothing + +CLEANLIB : do_nothing + +RESOURCE : $(ICONTARGETFILENAME) + +$(ICONTARGETFILENAME) : ..\..\icons\qgn_menu_piprofilerui.svg + mifconv $(ICONTARGETFILENAME) \ + /c8,8 ..\..\icons\qgn_menu_piprofilerui.svg + +FREEZE : do_nothing + +SAVESPACE : do_nothing + +RELEASABLES : + @echo $(ICONTARGETFILENAME) + +FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui.hrh Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 PROFILERGUI_HRH +#define PROFILERGUI_HRH + +enum TProfilerCmdSamplerIds + { + EProfilerGuiCmdSamplerEnable = 1, // id cannot be 0 + EProfilerGuiCmdSamplerDisable, + EProfilerGuiCmdSamplerSettings, + EProfilerGuiCmdSamplerInfo + }; + +enum TSamplerSettingItemIds + { + EProfilerGuiGenericSamplerQuerySampleRate = 0, + EProfilerGuiGenericSamplerQueryItem1, + EProfilerGuiGenericSamplerQueryItem2, + EProfilerGuiGenericSamplerQueryItem3, + EProfilerGuiGenericSamplerQueryItem4, + EProfilerGuiGenericSamplerQueryItem5, + EProfilerGuiGenericSamplerQueryItem6 + }; + +enum TGeneralSettingItemIds + { + ESettingListItemPluginTraceOutput = 0, + ESettingListItemPluginSaveFileDrive, + ESettingListItemPluginTraceFilePrefix, + ESettingListItemPluginSamplingTime + }; + +enum TProfilerGuiCommandIds + { + EProfilerGuiCmdStart = 1000, + EProfilerGuiCmdStop, + EProfilerGuiCmdStartAll, + EProfilerGuiCmdStartTimed, + EProfilerGuiCmdStopAll, + + EProfilerGuiCmdSamplerControl, + EProfilerGuiCmdSamplerSettingsChange, + EProfilerGuiCmdSamplerSettingsExit, + + EProfilerGuiCmdSettings, + EProfilerGuiCmdSettingsChange, + EProfilerGuiCmdSettingsExit, + EProfilerGuiCmdSettingsBack, + + EProfilerGuiCmdAbout, + + EProfilerGuiViewConfQuery, + EProfilerGuiSettingItemList, + EProfilerSamplerSettingItemList + }; + +enum TProfilerGuiSettingSamplerNameLength + { + ESamplerNameShort, + ESamplerNameMedium, + ESamplerNameLong + }; + +enum TProfilerGuiSettingTraceMode + { + ETraceModeStream, + ETraceModeBuffer + }; + +enum TProfilerGuiSettingOutputMode + { + EOutputToDebugPort = 0, + EOutputToFileSystem + }; + +enum TProfilerGuiSettingSaveFileDrive + { + ETraceSaveFileDriveC, + ETraceSaveFileDriveD, + ETraceSaveFileDriveE, + ETraceSaveFileDriveF, + ETraceSaveFileDriveG, + ETraceSaveFileDriveH, + ETraceSaveFileDriveI, + ETraceSaveFileDriveJ, + ETraceSaveFileDriveK, + ETraceSaveFileDriveL + }; + +enum TItemActionMenuTypes + { + EItemActionMenuTypeEnable = 0, + EItemActionMenuTypeDisable, + EItemActionMenuTypeEditSettings, + EItemActionMenuTypeInfo, + EItemActionMenuTypeStart, // for future use + EItemActionMenuTypeStop // for future use + }; + +#endif // PROFILERGUI_HRH diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_app.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_app.h Fri Sep 03 17:11:21 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 PROFILER_GUI_APP_H +#define PROFILER_GUI_APP_H + + +// INCLUDES +#include + +// CONSTANTS +// UID of the application +const TUid KUidProfilerGui = { 0x2001E5AE }; + +// CLASS DECLARATION + +/** +* CProfilerGuiApp application class. +* Provides factory to create concrete document object. +* +*/ +class CProfilerGuiApp : public CAknApplication + { + + public: // Functions from base classes + + private: + + /** + * From CApaApplication, creates CProfilerGuiDocument document object. + * @return A pointer to the created document object. + */ + CApaDocument* CreateDocumentL(); + + /** + * From CApaApplication, returns application's UID (KUidProfilerGui). + * @return The value of KUidProfilerGui. + */ + TUid AppDllUid() const; + }; + +#endif + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_appui.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_appui.h Fri Sep 03 17:11:21 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: +* +*/ + + + +#ifndef PROFILER_GUI_APPUI_H +#define PROFILER_GUI_APPUI_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include "profiler_gui_std.h" + +// profiler engine inclusions +#include + +// FORWARD DECLARATIONS +class CProfilerGuiModel; + +// CLASS DECLARATIONS + +class CProfilerGuiAppUi : public CAknViewAppUi + { +public: // constructors and destructor + void ConstructL(); + ~CProfilerGuiAppUi(); + + // profiler specific + void StartProfilerL(); + void StopProfilerL(); +private: // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); + +private: + void HandleCommandL(TInt aCommand); + virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + void HandleSystemEventL(const TWsEvent& aEvent); + + void SaveSettingsL(); + void LoadSettingsL(); + TInt RunConfQueryL( const TDesC* aOverrideText ); +private: //Data + CProfilerGuiModel* iModel; + }; + +#endif + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_attributes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_attributes.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 PROFILER_GUI_ATTRIBUTES_H +#define PROFILER_GUI_ATTRIBUTES_H + +// INCLUDES +#include +#include + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATIONS + +#endif diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_document.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_document.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 PROFILER_GUI_DOCUMENT_H +#define PROFILER_GUI_DOCUMENT_H + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CEikAppUi; +class CProfilerGuiModel; + + +// CLASS DECLARATION + +/** +* CProfilerGuiDocument application class. +*/ +class CProfilerGuiDocument : public CAknDocument + { + public: // Constructors and destructor + static CProfilerGuiDocument* NewL(CEikApplication& aApp); + virtual ~CProfilerGuiDocument(); + + public: // New functions + + public: // from CEikDocument + + protected: // New functions + + protected: // Functions from base classes + + private: + + /** + * EPOC default constructor. + */ + CProfilerGuiDocument(CEikApplication& aApp); + void ConstructL(); + + private: + + /** + * From CEikDocument, create CProfilerGuiAppUi "App UI" object. + */ + CEikAppUi* CreateAppUiL(); + + public: + inline CProfilerGuiModel* Model() { return iModel; } + + private: + CProfilerGuiModel* iModel; + + }; + +#endif + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h Fri Sep 03 17:11:21 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: +* +*/ + + + +#ifndef PROFILER_GUI_VALUESCONTAINER_H +#define PROFILER_GUI_VALUESCONTAINER_H + +// INCLUDES +#include +#include +#include +#include + +// FORWARD DECLARATIONS +class CProfilerGuiModel; +class CAknInfoPopupNoteController; + +// CLASS DECLARATIONS + +class CProfilerGuiMainContainer : public CCoeControl, MCoeControlObserver, MEikListBoxObserver + { +public: + void ConstructL(const TRect& aRect); + ~CProfilerGuiMainContainer(); + +private: + void SizeChanged(); + TInt CountComponentControls() const; + CCoeControl* ComponentControl(TInt aIndex) const; + void Draw(const TRect& aRect) const; + void HandleResourceChange(TInt aType); + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); // From MEikListBoxObserver + void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); // From MCoeControlObserver + TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); + +public: + const CArrayFix* ListBoxSelectionIndexes(); + TInt ListBoxSelectionIndexesCount(); + void SetDefaultTitlePaneTextL(); + TInt CurrentListBoxItemIndex(); + void SetListBoxTextArrayL(CDesCArray* aTextArray); + inline CAknSingleGraphicStyleListBox* ListBox() { return iListBox; } + void ShowWriterInfoPopupL(const TDesC& aNote); +private: + CProfilerGuiModel* iModel; + CAknSingleGraphicStyleListBox* iListBox; + CAknInfoPopupNoteController* iInfoPopup; + }; + +#endif + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_mainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_mainview.h Fri Sep 03 17:11:21 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 PROFILER_GUI_VALUESVIEW_H +#define PROFILER_GUI_VALUESVIEW_H + +// INCLUDES +#include + +#include "profiler_gui_std.h" +#include "profiler_gui_model.h" + + +// CONSTANTS +// UID of view +const TUid KMainViewUID = {1}; + +// FORWARD DECLARATIONS +class CProfilerGuiMainContainer; +class CProfilerGuiModel; +class CProfilerEngineStatusChecker; +class CAknNavigationDecorator; + + +/** +* CProfilerGuiMainView view class. +* +*/ +class CProfilerGuiMainView : public CAknView + { + public: // Constructors and destructor + void ConstructL(); + ~CProfilerGuiMainView(); + + public: // Functions from base classes + TUid Id() const; + void HandleCommandL(TInt aCommand); + void HandleClientRectChange(); + + /** + * Method for updating the Profiler engine status pane + * Called by Model class + * + * @param aStatus new status of profiler engine + */ + void UpdateStatusPaneL( TInt aStatus ); + + private: // From MEikMenuObserver + void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); + + private: // From AknView + void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); + void DoDeactivate(); + void HandleStatusPaneSizeChange(); + void SetupStatusPaneL(); + void CleanupStatusPaneL(); + HBufC* GetLabelTextLC(TInt aStatus); + private: // Data + CAknNavigationDecorator* iNaviDecorator; + CProfilerGuiMainContainer* iContainer; + CProfilerGuiModel* iModel; + + }; + +#endif + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_model.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_model.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 PROFILER_GUI_MODEL_H +#define PROFILER_GUI_MODEL_H + +// SYSTEM INCLUDES +#include +#include +#include +#include +#include +#include // RProperty + +// LOCAL INCLUDES +#include "profiler_gui_mainview.h" +#include "profiler_gui.hrh" + +// COMMON INCLUDES +#include +#include +#include + +// setting keys (do not change uids of existing keys to maintain compatibility to older versions!) +const TUid KPSettingPluginNameMode = { 0x00 }; +const TUid KPSettingPluginSaveFileDrive = { 0x01 }; +const TUid KPSettingPluginTraceOutput = { 0x02 }; +const TUid KPSettingPluginSaveFilePrefix = { 0x03 }; +const TUid KPSettingPluginTraceMode = { 0x04 }; + + +// FORWARD DECLARATIONS +class CProfilerGuiMainView; +class CProfilerGuiMainContainer; +class CEikonEnv; +class TSamplerAttributes; +class CProfilerEngineStatusChecker; +class MProfilerStatusObserver; + + +typedef CArrayFixSeg CSamplerItemList; + + + +class CProfilerGuiModel : public CActive, MProfilerStatusObserver + { +private: + enum TContainerDrawState + { + EDrawStateInvalid = -1, + EDrawStateMain + }; + public: + static CProfilerGuiModel* NewL(); + ~CProfilerGuiModel(); + void ActivateModelL(); + void DeActivateModelL(); + void SetMainView(CProfilerGuiMainView* aMainView); + void UpdateState(TInt aState); + TBool GetSelectedItemHasSettings(); + TBool GetSelectedItemEnabled(); + TBool GetSelectedItemHidden(); + TInt EditSelectedSamplerL(TInt index); + void SelectedSamplerInfoL(TInt index); + void TerminateProfilerL(); + TBool CheckTraceLocationSanityL(TGeneralAttributes& aAttr, TBool aQuietCheck); + private: + void RunL(); + void DoCancel(); + void LoadPluginsL(); + TInt EditSamplerL(TSamplerAttributes& aItem); + void SamplerInfoL(TSamplerAttributes& aItem); +private: + CProfilerGuiModel(); + void ConstructL(); + TInt LoadGeneralSettingsL(); + + void AppendToSamplerItemListL(TSamplerAttributes& aItem); + void DisableOrEnableFromSamplerItemListL(TInt aIndex); + void DeleteAllSamplerItems(); + void RefreshViewL(TBool aClearSelection=ETrue); + void LaunchProfilerEngineL(); + void UpdateUIRunningStateL(); + TInt FindProcessL(RProcess& aProc); + +public: + + enum TProfilingMode + { + EProfilingModeNormal = 0, + EProfilingModeTimed + }; + + void StartAllSamplerItemsL(TProfilingMode aProfilingMode = EProfilingModeNormal); + void StopAllSamplerItemsL(); + void DeleteAllSamplerItemsL(); + void DisableAllSamplerItemsL(); + void EnableAllSamplerItemsL(); + + TInt SamplerItemCount() const; + void ShowItemActionMenuL(); + void StopSelectedOrHighlightedItemsL(); + void DisableOrEnableSelectedOrHighlightedItemsL(); + + CDesCArray* GenerateListBoxItemTextArrayL(); + void StartNewSamplerL(TInt aCommand); + void AddNewSamplersL(CArrayFixFlat& iSamplerAttributes); + + void SaveGeneralSettingsL(); + void SetMainContainer(CProfilerGuiMainContainer* aContainer); + TInt LaunchSettingsDialogL(); + inline CEikonEnv* EikonEnv() { return iEnv; } + inline CProfilerGuiMainContainer* MainContainer() { return iMainContainer; } + inline TBool SamplerItemsExists() { return iSamplerItemList->Count() > 0; } + inline TGeneralAttributes const& GeneralSettings() const { return iGeneralAttributes; } + + TPtrC GetWriterInfoNoteL(const TDesC& aNote); + void AttachClient(); + void RemoveClient(); + +public: + // from MProfilerStatusObserver + void NotifyContainerReadyL(); + void HandleProfilerStatusChange( KProfilerStatus aStatus ); + void HandleProfilerErrorL( TInt aError ); + +private: + static const TInt iSamplerNameMode = ESamplerNameLong; + CProfilerGuiMainContainer* iMainContainer; + CEikonEnv* iEnv; + TInt iDrawState; + CSamplerItemList* iSamplerItemList; + TInt iReferenceNumber; + CArrayFixFlat* iSamplerAttributes; + TGeneralAttributes iGeneralAttributes; + TBool iProfilerStatus; // Status of Engine before it was launched by this application + CProfilerGuiMainView* iMainView; + + // checkers + CProfilerEngineStatusChecker* iStatusChecker; +public: + TInt iState; + }; + +#endif diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h Fri Sep 03 17:11:21 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: +* +*/ + + + +#ifndef PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H +#define PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#include "profiler_gui_model.h" + + +// FORWARD DECLARATIONS +class CAknSettingItemArray; +class CAknSettingStyleListBox; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; +class CAknTabGroup; +class TProfilerSamplerSettings; + +// CONSTANTS +const TUint KMaxItemCount = 7; +const TInt KMaxSettingUITextLength = 64; + +// CLASS DEFINITIONS + +class CProfilerSamplerSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver + { +public: + static CProfilerSamplerSettingsViewDlg* NewL(TSamplerAttributes& aSettings); + virtual ~CProfilerSamplerSettingsViewDlg(); + +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 + CProfilerSamplerSettingsViewDlg(TSamplerAttributes& aSettings); + void ConstructL(); + CAknSettingItem* GetSettingItemL(TSettingItem& aItem, TInt aIndex, TInt& aSettingPageResource); +private: // Data + CAknSettingItemArray* iSettingItemArray; + CAknSettingStyleListBox* iListBox; + CAknNavigationControlContainer* iNaviContainer; + TSamplerAttributes& iSettings; + TInt iItemCount; + + // item bufs for textual settings data + TInt iItemBuf[KMaxItemCount]; + }; + +#endif + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,91 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 PROFILER_GUI_SETTINGSVIEWDLG_H +#define PROFILER_GUI_SETTINGSVIEWDLG_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#include "profiler_gui_model.h" + + +// FORWARD DECLARATIONS +class CAknSettingItemArray; +class CAknSettingStyleListBox; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; +class CAknTabGroup; +class TProfilerGuiSettings; + + +// CLASS DEFINITIONS + +class CProfilerGuiSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver + { +public: + static CProfilerGuiSettingsViewDlg* NewL(TGeneralAttributes& aSettings); + virtual ~CProfilerGuiSettingsViewDlg(); + +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 + CProfilerGuiSettingsViewDlg(TGeneralAttributes& aSettings); + void ConstructL(); + +private: // Data + CAknSettingItemArray* iSettingItemArray; + CAknSettingStyleListBox* iListBox; + CAknNavigationControlContainer* iNaviContainer; + TGeneralAttributes& iSettings; + + // temporary member variables + TInt iTraceOutput; + TBuf<64> iSaveDrive; + TBuf<64> iFilePrefix; + }; + + +#endif + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/inc/profiler_gui_std.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/inc/profiler_gui_std.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 PROFILER_GUI_STD_H +#define PROFILER_GUI_STD_H + + + +#endif + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 __PROFILERGUI_IBY__ +#define __PROFILERGUI_IBY__ + +S60_APP_EXE(PIProfilerUI) +S60_APP_AIF_ICONS(PIProfilerUI) +S60_APP_RESOURCE(PIProfilerUI) +SCALABLE_IMAGE(APP_BITMAP_DIR, APP_BITMAP_DIR, PIProfilerui_ExtraIcons) +#ifdef S60_UPGRADABLE_APP_REG_RSC + S60_UPGRADABLE_APP_REG_RSC(PIProfilerUI) +#else + S60_APP_AIF_RSC(PIProfilerUI) +#endif + +#endif // __PROFILERGUI_IBY__ diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_app.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_app.cpp Fri Sep 03 17:11:21 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: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_app.h" +#include "profiler_gui_document.h" +#include + +#include + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProfilerGuiApp::AppDllUid() +// Returns application UID +// --------------------------------------------------------- +// +TUid CProfilerGuiApp::AppDllUid() const + { + return KUidProfilerGui; + } + +// --------------------------------------------------------- +// CProfilerGuiApp::CreateDocumentL() +// Creates CProfilerGuiDocument object +// --------------------------------------------------------- +// +CApaDocument* CProfilerGuiApp::CreateDocumentL() + { + return CProfilerGuiDocument::NewL( *this ); + } + +// ================= OTHER EXPORTED FUNCTIONS ============== + +LOCAL_C CApaApplication* NewApplication() + { + return new CProfilerGuiApp; + } + + +GLDEF_C TInt E32Main() + { + return EikStart::RunApplication(NewApplication); + } + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_appui.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_appui.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,260 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "profiler_gui_appui.h" +#include "profiler_gui_mainview.h" +#include "profiler_gui.hrh" +#include "profiler_gui_model.h" +#include "profiler_gui_document.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +// ================= MEMBER FUNCTIONS ======================= + +void CProfilerGuiAppUi::ConstructL() + { + // set as system application to prevent getting shut down events + iEikonEnv->SetSystem(ETrue); + + BaseConstructL(EAknEnableSkin); + + // get model + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + + LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - setting main view settings")); + + CProfilerGuiMainView* mainView = new(ELeave) CProfilerGuiMainView; + CleanupStack::PushL(mainView); + mainView->ConstructL(); + AddViewL(mainView); // transfer ownership to CAknViewAppUi + CleanupStack::Pop(); // mainView + + LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - setting default view")); + + SetDefaultViewL(*mainView); + + LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - activating model")); + + // notify the model that everything has been constructed + iModel->ActivateModelL(); + } + +// -------------------------------------------------------------------------------------------- + +CProfilerGuiAppUi::~CProfilerGuiAppUi() + { + // notify the model that the application is closing + if (iModel) + TRAP_IGNORE(iModel->DeActivateModelL()); + + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + if( aResourceId == R_PROFILER_START_SUBMENU ) + { + CEikMenuPaneItem::SData itemData; + _LIT(KMenuText, "Profiling for %d sec."); + itemData.iText.Format(KMenuText, iModel->GeneralSettings().iTimedSamplingPeriod);// = _L("Profiling for %d sec."); // Label text for the menu item + itemData.iCommandId = EProfilerGuiCmdStartTimed; // Command ID for the menu item + itemData.iFlags = 0; + itemData.iCascadeId = 0; + aMenuPane->AddMenuItemL( itemData ); + } + if (aResourceId == R_PROFILER_GUI_APP_MENU) + { + if(iModel->iState == MProfilerStatusObserver::ERunning) + { + aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, EFalse); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, ETrue); + } + else if(iModel->iState == MProfilerStatusObserver::EIdle) + { + aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, EFalse); + aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, EFalse); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, EFalse); + } + else + { + // if initializing or stopping no start/stop actions allowed + aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, ETrue); + } + } + + if(aResourceId == R_PROFILER_SAMPLER_CONTROL_MENU) + { + // check if item hidden, i.e. sampler cannot be started/stopped + if(!iModel->GetSelectedItemHidden()) + { + // item enabled => dimm the "enable" item, and other way round + if(iModel->GetSelectedItemEnabled()) + { + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, EFalse); + } + // item enabled => dimm the "enable" item, and other way round + else + { + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, EFalse); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, ETrue); + } + + } + // item hidden => dimm both enable and disable items + else + { + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, ETrue); + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, ETrue); + } + + // if sampler item has specific settings to control + if(iModel->GetSelectedItemHasSettings()) + { + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerSettings, EFalse); + } + else + { + aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerSettings, ETrue); + } + } + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CProfilerGuiAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +void CProfilerGuiAppUi::HandleSystemEventL(const TWsEvent& aEvent) + { + switch (*(TApaSystemEvent*)(aEvent.EventData())) + { + case EApaSystemEventShutdown: + // check if still profiling + if( iModel->iState != MProfilerStatusObserver::EIdle ) + { + // stop profiling process + iModel->StopAllSamplerItemsL(); + } + + // terminate profiler engine + iModel->TerminateProfilerL(); + break; + default: + break; + } + // call base class implementation + CAknAppUi::HandleSystemEventL(aEvent); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiAppUi::HandleCommandL(TInt aCommand) + { + switch ( aCommand ) + { + case EProfilerGuiCmdSettings: + { + // check if exit command received + if (iModel->LaunchSettingsDialogL() == EAknCmdExit) + { + // terminate profiler engine... + iModel->TerminateProfilerL(); + + // ... and exit + Exit(); + } + break; + } + case EProfilerGuiCmdAbout: + { + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; + dialog->ExecuteLD(R_PROFILER_GUI_ABOUT_DIALOG); + } + break; + + // a normal way to close an application + case EAknCmdExit: + case EEikCmdExit: + case EAknSoftkeyExit: + { + // decrease the client reference count in the server: + iModel->RemoveClient(); + // check if still profiling + if( iModel->iState != MProfilerStatusObserver::EIdle && + iModel->iState != MProfilerStatusObserver::EStopping ) + { + // ask user if he wants to leave profiling running in background process + if( this->RunConfQueryL( NULL ) == 0 ) + { + // stop profiling process + iModel->StopAllSamplerItemsL(); + + // terminate profiler engine + iModel->TerminateProfilerL(); + } + } + else + { + // terminate profiler engine + iModel->TerminateProfilerL(); + } + + Exit(); + } + break; + + default: + break; + } + } + +TInt CProfilerGuiAppUi::RunConfQueryL( const TDesC* aOverrideText ) + { + CAknQueryDialog* queryDialog = CAknQueryDialog::NewL(); + + if(aOverrideText) + { + queryDialog->SetPromptL(*aOverrideText); + } + return queryDialog->ExecuteLD(R_PROFILER_GUI_CONF_QUERY); + } + + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_document.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_document.cpp Fri Sep 03 17:11:21 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: +* +*/ + + + +// INCLUDE FILES +#include "profiler_gui_document.h" +#include "profiler_gui_appui.h" +#include "profiler_gui_model.h" + +// ================= MEMBER FUNCTIONS ======================= + +// constructor +CProfilerGuiDocument::CProfilerGuiDocument(CEikApplication& aApp) +: CAknDocument(aApp) + { + } + +// ---------------------------------------------------- + +// destructor +CProfilerGuiDocument::~CProfilerGuiDocument() + { + delete iModel; + } + +// ---------------------------------------------------- + +// EPOC default constructor can leave. +void CProfilerGuiDocument::ConstructL() + { + iModel = CProfilerGuiModel::NewL(); + } + +// ---------------------------------------------------- + +// Two-phased constructor. +CProfilerGuiDocument* CProfilerGuiDocument::NewL(CEikApplication& aApp) + { + CProfilerGuiDocument* self = new(ELeave) CProfilerGuiDocument(aApp); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ---------------------------------------------------- +// CProfilerGuiDocument::CreateAppUiL() +// constructs CProfilerGuiAppUi +// ---------------------------------------------------- +// +CEikAppUi* CProfilerGuiDocument::CreateAppUiL() + { + return new (ELeave) CProfilerGuiAppUi; + } + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "profiler_gui_maincontainer.h" +#include "profiler_gui.hrh" +#include "profiler_gui_document.h" +#include "profiler_gui_appui.h" +#include "profiler_gui_model.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +_LIT(KExtraIconsPath, "\\resource\\apps\\piprofilerui_extraicons.mif"); + +// ===================================== MEMBER FUNCTIONS ===================================== + +void CProfilerGuiMainContainer::ConstructL(const TRect& aRect) + { + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + iModel->SetMainContainer(this); + + CreateWindowL(); + SetRect(aRect); + SetBlank(); + + // init listbox + iListBox = new(ELeave) CAknSingleGraphicStyleListBox; + iListBox->SetContainerWindowL(*this); + iListBox->ConstructL(this, EAknListBoxMarkableList); + iListBox->View()->SetListEmptyTextL(_L("No plugins found yet")); + + // if description length longer than screen width, scroll the text + iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); + + // create icon array and add marking indicator to it + CAknIconArray* iconArray = new(ELeave) CAknIconArray(1); + CleanupStack::PushL(iconArray); + CFbsBitmap* markBitmap = NULL; + CFbsBitmap* markBitmapMask = NULL; + + TRgb defaultColor; + defaultColor = iEikonEnv->Color(EColorControlText); + + AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(), + KAknsIIDQgnIndiMarkedAdd, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + markBitmap, + markBitmapMask, + AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_indi_marked_add, + EMbmAvkonQgn_indi_marked_add_mask, + defaultColor + ); + + CGulIcon* markIcon = CGulIcon::NewL(markBitmap, markBitmapMask); + iconArray->AppendL(markIcon); + + // append icons from profiler_gui_extraicons.mif + TFileName extraIconsPath; + extraIconsPath.Copy(KExtraIconsPath); + TParsePtrC parse((CEikonEnv::Static()->EikAppUi()->Application())->AppFullName()); // get path where this app is installed + extraIconsPath.Insert(0, parse.Drive()); // drive letter + + CFbsBitmap* redBitmap = NULL; + CFbsBitmap* redBitmapMask = NULL; + CFbsBitmap* greenBitmap = NULL; + CFbsBitmap* greenBitmapMask = NULL; + + AknIconUtils::CreateIconL(redBitmap, redBitmapMask, extraIconsPath, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_disabled, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_disabled_mask); + AknIconUtils::CreateIconL(greenBitmap, greenBitmapMask, extraIconsPath, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_enabled, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_enabled_mask); + + CGulIcon* redIcon = CGulIcon::NewL(redBitmap, redBitmapMask); + iconArray->AppendL(redIcon); + + CGulIcon* greenIcon = CGulIcon::NewL(greenBitmap, greenBitmapMask); + iconArray->AppendL(greenIcon); + + // set icon array + CleanupStack::Pop(); // iconArray + iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray); + + iListBox->CreateScrollBarFrameL(ETrue); + iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); + iListBox->SetListBoxObserver(this); + + // set size of the listbox + TSize outputRectSize; + AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize); + TRect outputRect(outputRectSize); + iListBox->SetRect(outputRect); + + iListBox->ActivateL(); + + ActivateL(); + + iInfoPopup = CAknInfoPopupNoteController::NewL(); + iInfoPopup->SetTimePopupInView(5000); + iInfoPopup->SetTimeDelayBeforeShow(500); + iInfoPopup->SetTextL(_L("TIP: Check also sampler specific settings!")); + iInfoPopup->ShowInfoPopupNote(); + } + +// -------------------------------------------------------------------------------------------- + +CProfilerGuiMainContainer::~CProfilerGuiMainContainer() + { + delete iInfoPopup; + + if (iListBox) + delete iListBox; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::SizeChanged() +{ + TSize outputRectSize; + AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize); + TRect outputRect(outputRectSize); + + if (iListBox) + iListBox->SetRect(outputRect); +} + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiMainContainer::CountComponentControls() const + { + if (iListBox) + return 1; + else + return 0; + } + +// -------------------------------------------------------------------------------------------- + +CCoeControl* CProfilerGuiMainContainer::ComponentControl(TInt /*aIndex*/) const + { + if (iListBox) + return iListBox; + else + return NULL; + } + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiMainContainer::CurrentListBoxItemIndex() + { + if (iListBox) + { + return iListBox->CurrentItemIndex(); + } + else + return KErrNotFound; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::SetListBoxTextArrayL(CDesCArray* aTextArray) + { + if (iListBox) + { + iListBox->Model()->SetItemTextArray(aTextArray); + iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); + iListBox->HandleItemAdditionL(); + iListBox->UpdateScrollBarsL(); + } + } + +// -------------------------------------------------------------------------------------------- + +const CArrayFix* CProfilerGuiMainContainer::ListBoxSelectionIndexes() + { + if (iListBox) + { + const CListBoxView::CSelectionIndexArray* indices = iListBox->SelectionIndexes(); + return static_cast*>(indices); + } + else + return NULL; + } + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiMainContainer::ListBoxSelectionIndexesCount() + { + if (iListBox) + { + return iListBox->SelectionIndexes()->Count(); + } + else + return KErrNotFound; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + gc.Clear(aRect); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) + { + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::SetDefaultTitlePaneTextL() + { + _LIT(KTitleText, "PIProfiler"); + + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( KTitleText ); + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CProfilerGuiMainContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + if(aType != EEventKey) + return EKeyWasNotConsumed; + + if (iListBox && iListBox->Model()->NumberOfItems() > 0) + { + // handle OK/Enter keys + if (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) + { + // check if profiler state is idle + if(iModel->iState == MProfilerStatusObserver::EIdle) + { + // show action menu only if state is idle + iModel->ShowItemActionMenuL(); + } + } + else + { + return iListBox->OfferKeyEventL(aKeyEvent, aType); + } + } + + return EKeyWasNotConsumed; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + switch (aEventType) + { + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + { + iModel->ShowItemActionMenuL(); + } + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::HandleResourceChange(TInt aType) + { + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + TRect mainPaneRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); + SetRect(mainPaneRect); + + TSize outputRectSize; + AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize); + TRect outputRect(outputRectSize); + iListBox->SetRect(outputRect); + } + else + { + CCoeControl::HandleResourceChange(aType); + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiMainContainer::ShowWriterInfoPopupL(const TDesC& aNote) + { + if(!iInfoPopup) + { + iInfoPopup = CAknInfoPopupNoteController::NewL(); + } + // Hide the note. The last note may be visible when creating the second + iInfoPopup->HideInfoPopupNote(); + iInfoPopup->SetTimePopupInView(5000); + iInfoPopup->SetTimeDelayBeforeShow(500); + iInfoPopup->SetTextL(iModel->GetWriterInfoNoteL(aNote)); + iInfoPopup->ShowInfoPopupNote(); + } + + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,334 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "profiler_gui.hrh" +#include "profiler_gui_mainview.h" +#include "profiler_gui_maincontainer.h" +#include "profiler_gui_document.h" +#include "profiler_gui_model.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CProfilerGuiMainView::ConstructL(const TRect& aRect) +// EPOC two-phased constructor +// --------------------------------------------------------- +// +void CProfilerGuiMainView::ConstructL() + { + BaseConstructL( R_PROFILER_GUI_VIEW_MAIN ); + + iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); + iNaviDecorator = NULL; + iModel->SetMainView(this); + } + +// --------------------------------------------------------- +// CProfilerGuiMainView::~CProfilerGuiMainView() +// --------------------------------------------------------- +// +CProfilerGuiMainView::~CProfilerGuiMainView() + { + + if(iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + + if (iContainer) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + + } + +// --------------------------------------------------------- +// TUid CProfilerGuiMainView::Id() +// --------------------------------------------------------- +// +TUid CProfilerGuiMainView::Id() const + { + return KMainViewUID; + } + +// --------------------------------------------------------- +// TUid CProfilerGuiMainView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) +// --------------------------------------------------------- +// +void CProfilerGuiMainView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) + { + AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane); + } + + +// --------------------------------------------------------- +// CProfilerGuiMainView::HandleCommandL(TInt aCommand) +// --------------------------------------------------------- +// +void CProfilerGuiMainView::HandleCommandL(TInt aCommand) + { + switch ( aCommand ) + { + // commands from sampler control sub menu + case EProfilerGuiCmdSamplerEnable: + { + iModel->DisableOrEnableSelectedOrHighlightedItemsL(); + break; + } + case EProfilerGuiCmdSamplerDisable: + { + iModel->DisableOrEnableSelectedOrHighlightedItemsL(); + break; + } + case EProfilerGuiCmdSamplerSettings: + { + // check if sampler settings dialog returned exit command + iModel->EditSelectedSamplerL(iContainer->CurrentListBoxItemIndex()); + break; + } + case EProfilerGuiCmdSamplerInfo: + { + iModel->SelectedSamplerInfoL(iContainer->CurrentListBoxItemIndex()); + break; + } + + case EProfilerGuiCmdStartAll: + case EProfilerGuiCmdStartTimed: + { + // still using the old way of starting all the samplers simultaneously + if( iModel->iState != MProfilerStatusObserver::ERunning ) + { + // set state as "initializing" for a moment before profiling has started, + // NOTE: engine changes to "Running" state + iModel->iState = MProfilerStatusObserver::EInitializing; + // start the actual sampling process on Profiler Engine + if( aCommand == EProfilerGuiCmdStartTimed ) + iModel->StartAllSamplerItemsL(CProfilerGuiModel::EProfilingModeTimed); + else + iModel->StartAllSamplerItemsL(); + } + + // prevent the control of sampler specific settings during the trace + iContainer->SetDimmed(ETrue); + break; + } + case EProfilerGuiCmdStopAll: + { + // check if still profiling + if( iModel->iState != MProfilerStatusObserver::EIdle ) + { + // set to stopping mode + iModel->iState = MProfilerStatusObserver::EStopping; + // stop actual sampling process on Profiler Engine + iModel->StopAllSamplerItemsL(); + } + + // return the control to sampler specific settings when tracing stopped + iContainer->SetDimmed(EFalse); + + break; + } + + default: + { + AppUi()->HandleCommandL(aCommand); + break; + } + } + } + +// --------------------------------------------------------- +// CProfilerGuiMainView::HandleClientRectChange() +// --------------------------------------------------------- +// +void CProfilerGuiMainView::HandleClientRectChange() + { + if ( iContainer ) + { + iContainer->SetRect( ClientRect() ); + } + } + +// --------------------------------------------------------- +// CProfilerGuiMainView::DoActivateL(...) +// --------------------------------------------------------- +// +void CProfilerGuiMainView::DoActivateL( + const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + // show wait dialog + CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC(); + waitDialog->SetSoftkeys(R_AVKON_SOFTKEYS_EMPTY); + TInt dialogId = waitDialog->ShowNoteL(EAknGlobalWaitNote, _L("Initializing samplers")); + + // setup the profiler engine status pane + SetupStatusPaneL(); + + // check if container creation succesfull + if (!iContainer) + { + iContainer = new (ELeave) CProfilerGuiMainContainer; + iModel->SetMainContainer(iContainer); + iContainer->SetMopParent(this); + iContainer->ConstructL( ClientRect() ); + iModel->NotifyContainerReadyL(); + AppUi()->AddToStackL( *this, iContainer ); + } + + // remove the wait dialog + waitDialog->CancelNoteL(dialogId); + CleanupStack::PopAndDestroy(); //waitDialog; + } + +// --------------------------------------------------------- +// CProfilerGuiMainView::DoDeactivate() +// --------------------------------------------------------- +// +void CProfilerGuiMainView::DoDeactivate() + { + TRAP_IGNORE(CleanupStatusPaneL()); + + if (iContainer) + { + AppUi()->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + } + +void CProfilerGuiMainView::HandleStatusPaneSizeChange() + { + CAknView::HandleStatusPaneSizeChange(); + + TInt result; + TRAP(result, SetupStatusPaneL()); + } + + +void CProfilerGuiMainView::SetupStatusPaneL() + { + TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi); + CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid); + if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned()) + { + CAknNavigationControlContainer* naviPane = static_cast (StatusPane()->ControlL(naviPaneUid)); + if(iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + + // get the initial status label + HBufC* labelText = GetLabelTextLC(iModel->iState); + iNaviDecorator = naviPane->CreateNavigationLabelL(*labelText); + CleanupStack::PopAndDestroy(labelText); + + naviPane->PushL(*iNaviDecorator); + } + } + +void CProfilerGuiMainView::CleanupStatusPaneL() + { + // destructor for navi pane, called by destructor + TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi); + CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid); + if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned()) + { + CAknNavigationControlContainer* naviPane = static_cast (StatusPane()->ControlL(naviPaneUid)); + if(iNaviDecorator) + { + naviPane->Pop(iNaviDecorator); + delete iNaviDecorator; + iNaviDecorator = NULL; + } + } + } + +HBufC* CProfilerGuiMainView::GetLabelTextLC(TInt aStatus) + { + // get the predefined status text + HBufC* labelText = NULL; + switch(aStatus) + { + case MProfilerStatusObserver::EIdle: + labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_IDLE); + break; + case MProfilerStatusObserver::EInitializing: + labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_INITIALIZING); + break; + case MProfilerStatusObserver::ERunning: + labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_RUNNING); + break; + case MProfilerStatusObserver::EStopping: + labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_STOPPING); + break; + case MProfilerStatusObserver::ERestarting: + labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_RUNNING); + break; + default: + labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_IDLE); + break; + } + return labelText; + } + +void CProfilerGuiMainView::UpdateStatusPaneL( TInt aStatus ) + { + TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi); + CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid); + // check if navi pane is correctly initialized + if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned()) + { + CAknNavigationControlContainer* naviPane = static_cast (StatusPane()->ControlL(naviPaneUid)); + if(iNaviDecorator) + { + delete iNaviDecorator; + iNaviDecorator = NULL; + } + HBufC* labelText; + + // get the right status label text + labelText = GetLabelTextLC(aStatus); + iNaviDecorator = naviPane->CreateNavigationLabelL(*labelText); + CleanupStack::PopAndDestroy(labelText); + + naviPane->PushL(*iNaviDecorator); + } + } + + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_model.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_model.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,1176 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "profiler_gui_samplersettingsviewdlg.h" +#include "profiler_gui_model.h" +#include "profiler_gui_app.h" +#include "profiler_gui_settingsviewdlg.h" +#include "profiler_gui_maincontainer.h" +#include "profiler_gui.hrh" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// UIDs +#include + +#include +#include + +// LITERALS +_LIT(KAppName, "PI Profiler"); +_LIT(KWarningNote, "NOTE: output changed!\n"); +_LIT(KProfilerEngineExe, "PIProfilerEngine.exe"); + +// literals for default general setting values +_LIT8(KTraceOutput, "file_system"); +_LIT8(KTraceDebugOutput, "debug_output"); +_LIT8(KProfilerDefaultDrive, "E:\\data"); +_LIT8(KProfilerDefaultPrefix, "Profiler_#"); + +// ===================================== MEMBER FUNCTIONS ===================================== + +CProfilerGuiModel* CProfilerGuiModel::NewL() + { + CProfilerGuiModel* self = new(ELeave) CProfilerGuiModel; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CProfilerGuiModel::CProfilerGuiModel() : CActive(EPriorityStandard) + { + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::ConstructL() + { + // initialize basic settings + iDrawState = EDrawStateInvalid; + iReferenceNumber = 0; + iState = MProfilerStatusObserver::EIdle; + + iEnv = CEikonEnv::Static(); + + // profiler engine specific initialization + LaunchProfilerEngineL(); + + // max sampler item list length is 64, i.e. max 64 sampler plugins loaded + iSamplerItemList = new(ELeave) CSamplerItemList(64); + + // initialize attribute arrays + iSamplerAttributes = new(ELeave) CArrayFixFlat(20); // max sampler count is 20 + + // engine status checker + iStatusChecker = CProfilerEngineStatusChecker::NewL(); + iStatusChecker->SetObserver(this); + + CActiveScheduler::Add(this); + } + +void CProfilerGuiModel::UpdateUIRunningStateL() + { + // prevent the control of sampler specific settings during the trace + iMainContainer->SetDimmed(ETrue); + + // update status pane + iMainView->UpdateStatusPaneL(iState); + + // show an info popup showing the logging method + iMainContainer->ShowWriterInfoPopupL(KNullDesC); + + // refresh view + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- +void CProfilerGuiModel::NotifyContainerReadyL() + { + // load initial plugins + LoadPluginsL(); + + // get the initial state + if( iStatusChecker->GetInitialState() == MProfilerStatusObserver::ERunning ) + { + // set model state to restarting and grabbing an existing profiler process + iState = MProfilerStatusObserver::ERestarting; + + // update status pane to correspond the running mode + UpdateUIRunningStateL(); + + // set model state to running + iState = MProfilerStatusObserver::ERunning; + + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::ActivateModelL() + { + // load general settings + if( LoadGeneralSettingsL() != KErrNone ) + { + LOGTEXT(_L("ProfilerGuiAppUi::ActivateModelL - could not connect profiler engine")); + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::DeActivateModelL() + { + Cancel(); + + // for a faster exit, send the application to background + TApaTask selfTask(iEnv->WsSession()); + selfTask.SetWgId(iEnv->RootWin().Identifier()); + selfTask.SendToBackground(); + } + +// -------------------------------------------------------------------------------------------- + +CProfilerGuiModel::~CProfilerGuiModel() + { + if (iSamplerItemList) + { + DeleteAllSamplerItems(); + delete iSamplerItemList; + iSamplerItemList = NULL; + } + + if(iStatusChecker) + { + iStatusChecker->Cancel(); + delete iStatusChecker; + iStatusChecker = NULL; + } + + + if(iSamplerAttributes) + { + iSamplerAttributes->Reset(); + delete iSamplerAttributes; + iSamplerAttributes = NULL; + } + + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::DoCancel() + { + + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::RunL() + { + + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::SetMainContainer(CProfilerGuiMainContainer* aContainer) + { + iMainContainer = aContainer; + iDrawState = EDrawStateMain; + } + +void CProfilerGuiModel::UpdateState(TInt aState) + { + iState = aState; + } + +TInt CProfilerGuiModel::FindProcessL(RProcess& aProc) + { + TProcessId engId; + TFindProcess procName; + procName.Find(_L("PIProfilerEngine.exe*")); + TFullName aResult; + TFullName aResult2; + TInt err(KErrNone); + + // find the first appearance + err = procName.Next(aResult); + if(err != KErrNone) + { + // did not find any engine process + return err; + } + else + { + err = aProc.Open(procName); + if(err == KErrNone) + { + if(aProc.ExitCategory().Length() > 0) + { + aProc.Close(); + // process already exited => create a new one + return KErrNotFound; + } + aProc.Close(); + } + } + +// // 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); +// +// // check if aResult2 contained the second appearance of profiler engine +// if(aResult2.CompareF(aResult) > 0) +// { +// // other process found, i.e. right process to communicate with, in case started from eshell +// err = aProc.Open(procName); +// if(err == KErrNone) +// { +// if(aProc.ExitCategory().Length() > 0) +// { +// // process already exited => create a new one +// return KErrNotFound; +// } +// aProc.Close(); +// } +// } + + return err; + } + +void CProfilerGuiModel::LaunchProfilerEngineL() + { + LOGTEXT(_L("CProfilerGuiModel::LaunchProfilerEngineL - start")); + + TRequestStatus stat = KRequestPending; + RProcess proc; + + TInt err(KErrNone); + + // check if process exists + err = FindProcessL(proc); + + // check if already exists and don't start a new eshell profiling + if( err == KErrNotFound ) + { + // try create new process + err = proc.Create(KProfilerEngineExe, _L("")); + + // check if RProcess::Create() succeeded + if( err == KErrNone ) + { + // Trigger rendezvous on the supplied TRequestStatus object + proc.Rendezvous(stat); + + // kick off the engine process + proc.Resume(); + + // wait for the constructor to complete + User::WaitForRequest(stat); + + // just lose the handle + proc.Close(); + } + } + + // Increase the client reference count in server: + AttachClient(); + } + +//----------------------------------------------------------------------------- +// CProfilerGuiModel::TerminateProfilerL() +// Stops Profiler Engine if it has been launched by this launcher. +//----------------------------------------------------------------------------- + +void CProfilerGuiModel::TerminateProfilerL() + { + LOGTEXT(_L("CProfilerGuiModel::TerminateProfiler - entry")); + + // exit profiler engine + RProfiler::ExitProfiler(); + + LOGTEXT(_L("CProfilerGuiModel::TerminateProfiler - exit")); + + } + +void CProfilerGuiModel::AttachClient() + { + LOGTEXT(_L("CProfilerGuiModel::AttachClient - entry")); + + // + RProfiler::AttachClient(); + + LOGTEXT(_L("CProfilerGuiModel::AttachClient - exit")); + + } + +void CProfilerGuiModel::RemoveClient() + { + LOGTEXT(_L("CProfilerGuiModel::RemoveClient - entry")); + + // + RProfiler::RemoveClient(); + + LOGTEXT(_L("CProfilerGuiModel::RemoveClient - exit")); + + } + +void CProfilerGuiModel::AddNewSamplersL(CArrayFixFlat& aAttributes) + { + TSamplerAttributes item; + + TInt count(aAttributes.Count()); + + // loop the attribute array and insert them into view list + for (TInt i(0);iListBox()->SetCurrentItemIndexAndDraw(iMainContainer->ListBox()->Model()->NumberOfItems()-1); + + } + // refresh again + if(iReferenceNumber > 0) + { + RefreshViewL(ETrue); + } + } + +TBool CProfilerGuiModel::CheckTraceLocationSanityL(TGeneralAttributes& aAttr, TBool aQuietCheck) + { + RFs fs; + User::LeaveIfError(fs.Connect()); + + TBuf<32> drive; + + CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aAttr.iSaveFileDrive); + + TDriveUnit driveUnit = TDriveUnit(drive); + + TBool ret(EFalse); + + // check that the root folder is correct + if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone ) + { + // check then if drive has still some space + if(!SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit)) + { + ret = ETrue; + } + } + + // check if the sanity check failed + if(!ret) + { + // show an error note + if(aQuietCheck == EFalse) + { + CAknErrorNote* note = new(ELeave) CAknErrorNote(); + note->ExecuteLD(_L("Invalid path, check settings!")); + } + } + fs.Close(); + return ret; + } + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiModel::LaunchSettingsDialogL() + { + // launch the settings dialog + TGeneralAttributes newSettings = iGeneralAttributes; + TBool quietCheck(EFalse); + + CProfilerGuiSettingsViewDlg* dlg = CProfilerGuiSettingsViewDlg::NewL(newSettings); + TInt returnValue = dlg->ExecuteLD(R_PROFILER_GUI_SETTINGS_DIALOG); + + // check if exit command => no error note to user + if(returnValue == EAknCmdExit) + quietCheck = ETrue; + + // always save settings since the settings dialog does not provide a possibility to cancel + iGeneralAttributes.iTraceOutput.Copy(newSettings.iTraceOutput); + iGeneralAttributes.iTraceFilePrefix.Copy(newSettings.iTraceFilePrefix); + iGeneralAttributes.iTimedSamplingPeriod = newSettings.iTimedSamplingPeriod; + + // check if debug output selected no check of + if(newSettings.iTraceOutput.CompareF(KTraceDebugOutput) != 0) + { + // Check save file drive sanity + if(CheckTraceLocationSanityL(newSettings, quietCheck)) + { + // save the new location + iGeneralAttributes.iSaveFileDrive.Copy(newSettings.iSaveFileDrive); + } + } + + // saves the general settings to profiler engine + SaveGeneralSettingsL(); + + // 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; + } + + +TPtrC CProfilerGuiModel::GetWriterInfoNoteL(const TDesC& aNote) + { + TBuf<256> buf; + TBuf<128> descBuf; + + buf.Zero(); + + // get active profiler since it + RProfiler::GetActiveWriter(buf); + + if(iGeneralAttributes.iTraceOutput.CompareF(KTraceOutput) == 0) + { + if(iState == MProfilerStatusObserver::EInitializing || + iState == MProfilerStatusObserver::ERestarting ) + { + descBuf.Zero(); + // set the additional note if available + buf.Copy(aNote); + RProfiler::GetFileName(descBuf); + buf.Append(_L("Writing to ")); + buf.Append(descBuf); + } + else if(iState == MProfilerStatusObserver::EIdle || + iState == MProfilerStatusObserver::EStopping || + iState == MProfilerStatusObserver::ERunning ) + { + descBuf.Zero(); + // set the additional note if available + buf.Copy(aNote); + RProfiler::GetFileName(descBuf); + buf.Append(_L("Wrote trace data to ")); + buf.Append(descBuf); + } + else + { + buf.Copy(KNullDesC); + } + } + else if(iGeneralAttributes.iTraceOutput.CompareF(KTraceDebugOutput) == 0) + { + if(iState == MProfilerStatusObserver::EInitializing || + iState == MProfilerStatusObserver::ERestarting ) + { + buf.Copy(_L("Writing to debug output...")); + } + else if( iState == MProfilerStatusObserver::EIdle || + iState == MProfilerStatusObserver::EStopping || + iState == MProfilerStatusObserver::ERunning ) + { + buf.Copy(_L("Wrote trace data to debug output")); + } + else + { + buf.Copy(KNullDesC); + } + } + else + { + // should not reach this point + buf.Copy(KNullDesC); + } + + return TPtrC(buf); + } + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiModel::EditSamplerL(TSamplerAttributes& aItem) + { + // edit sampler specific settings i.e. attributes + TSamplerAttributes& newSettings = aItem; + TInt indexToReplace(iMainContainer->CurrentListBoxItemIndex()); + + // create a new settings editor dialog + CProfilerSamplerSettingsViewDlg* dlg = CProfilerSamplerSettingsViewDlg::NewL(newSettings); + TInt returnValue = dlg->ExecuteLD(R_PROFILER_SAMPLER_SETTINGS_DIALOG); + + // save settings + aItem = newSettings; + + // replace the old attribute container with saved values + iSamplerItemList->Delete(indexToReplace); + iSamplerItemList->InsertL(indexToReplace, newSettings); + + // save the settings to sampler item + RProfiler::SetSamplerAttributes(newSettings); + + // 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 CProfilerGuiModel::SamplerInfoL(TSamplerAttributes& aItem) + { + TBuf<64> header; + TBuf<256> info; + + _LIT(KSamplerStr, "Sampler Info"); + +// CnvUtfConverter::ConvertToUnicodeFromUtf8(header, aItem.iName); + + header.Append(KSamplerStr); + + CnvUtfConverter::ConvertToUnicodeFromUtf8(info, aItem.iDescription); + + CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; + //dialog->ExecuteLD(info); + dialog->PrepareLC( R_PROFILER_GUI_EMPTY_ABOUT_DIALOG ); + dialog->SetHeaderText(header); + dialog->SetMessageTextL(info); + dialog->RunLD(); + + RefreshViewL(EFalse); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::StartAllSamplerItemsL(TProfilingMode aProfilingMode) + { + TBuf<256> activeWriterDes; + TBuf8<256> writer8; + + iState = MProfilerStatusObserver::EInitializing; + + RProfiler::TProfilingMode profilingMode = aProfilingMode == EProfilingModeTimed ? RProfiler::EProfilingModeTimed : RProfiler::EProfilingModeNormal; + + // update status pane to correspond the initializing mode + // prevent the control of sampler specific settings during the trace + iMainContainer->SetDimmed(ETrue); + + // update status pane + iMainView->UpdateStatusPaneL(iState); + + // refresh view + RefreshViewL(); + + // try to start profiling process through client-server interface + if(RProfiler::StartSampling(profilingMode) == KErrNotFound) + { + + // profiler stopped (e.g. from eshell) and must be restarted + LaunchProfilerEngineL(); + + // set general attributes + SaveGeneralSettingsL(); + + // set sampler attributes + for(TInt i(0);iCount();i++) + { + // set the attributes for each sampler loaded in the UI + RProfiler::SetSamplerAttributes(iSamplerAttributes->At(i)); + } + + // try to launch sampling again + RProfiler::StartSampling(profilingMode); + } + + // get selected writer + RProfiler::GetActiveWriter(activeWriterDes); + CnvUtfConverter::ConvertFromUnicodeToUtf8(writer8, activeWriterDes); + + // check that output mode has not changed for a problem with trace file name + // problem cases: + // - trace file name and/or path false + // - disk full, cannot write to given location + // - false drive, e.g. x: + if(writer8.CompareF(iGeneralAttributes.iTraceOutput) != 0) + { + // save change also to general attributes + iGeneralAttributes.iTraceOutput.Copy(writer8); + // show an info popup showing the logging method + iMainContainer->ShowWriterInfoPopupL(KWarningNote); + } + else + { + // show an info popup showing the logging method + iMainContainer->ShowWriterInfoPopupL(KNullDesC); + } + + // update the view + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::DeleteAllSamplerItemsL() + { + DeleteAllSamplerItems(); + + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::StopAllSamplerItemsL() + { + // show an info popup showing the logging method + iMainContainer->ShowWriterInfoPopupL(KNullDesC); + + // Stop profiling process through CS session + RProfiler::StopSampling(); + + RefreshViewL(); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::RefreshViewL(TBool aClearSelection) + { + // refresh the main list view + if (iMainContainer && iDrawState == EDrawStateMain && iMainContainer->ListBox()) + { + // clear selections if any + iMainContainer->ListBox()->ClearSelection(); + + // set item index to 0 + if (aClearSelection) + iMainContainer->ListBox()->SetCurrentItemIndex(0); + + // set text items + iMainContainer->SetListBoxTextArrayL(GenerateListBoxItemTextArrayL()); + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::AppendToSamplerItemListL(TSamplerAttributes& aItem) + { + // append single sampler item into sampler item list + if (iSamplerItemList) + iSamplerItemList->AppendL( aItem ); + else + User::Leave(KErrNotReady); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::DisableOrEnableFromSamplerItemListL(TInt aIndex) + { + if (iSamplerItemList) + { + if (iSamplerItemList->Count() > aIndex && aIndex >= 0) + { + TSamplerAttributes& attr = iSamplerItemList->At(aIndex); + if (attr.iEnabled) + { + attr.iEnabled = EFalse; + } + else if (!attr.iEnabled) + { + attr.iEnabled = ETrue; + } + // save settings to engine + RProfiler::SetSamplerAttributes(attr); + } + else + User::Leave(KErrNotFound); + } + else + { + User::Leave(KErrNotReady); + } + + } + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiModel::SamplerItemCount() const + { + TInt count(0); + + if (iSamplerItemList) + count = iSamplerItemList->Count(); + + return count; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::DeleteAllSamplerItems() + { + // reset sampler array + iSamplerItemList->Reset(); + } + +// -------------------------------------------------------------------------------------------- + +CDesCArray* CProfilerGuiModel::GenerateListBoxItemTextArrayL() + { + CDesCArray* textArray = new(ELeave) CDesCArrayFlat(64); + CleanupStack::PushL(textArray); + + _LIT(KEntryTemplateRedIcon, "1\t%S\t\t"); + _LIT(KEntryTemplateGreenIcon, "2\t%S\t\t"); + + TSamplerAttributes attr; + TInt itemCount(SamplerItemCount()); + for (TInt i(0); i textEntry; + TBuf<512> description; + + attr = iSamplerItemList->At(i); + + description.Copy(attr.iName); + + if (attr.iEnabled) + textEntry.Format(KEntryTemplateGreenIcon, &description); + else + textEntry.Format(KEntryTemplateRedIcon, &description); + + textArray->AppendL(textEntry); + } + + CleanupStack::Pop(); //textArray + return textArray; + } + +// -------------------------------------------------------------------------------------------- + +TBool CProfilerGuiModel::GetSelectedItemEnabled() + { + TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); + + if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) + { + return iSamplerItemList->At(currentItemIndex).iEnabled; + } + return EFalse; + } + +// -------------------------------------------------------------------------------------------- + +TBool CProfilerGuiModel::GetSelectedItemHasSettings() + { + TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); + + if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) + { + if(iSamplerItemList->At(currentItemIndex).iItemCount != 0 || + iSamplerItemList->At(currentItemIndex).iSampleRate != KErrNotFound) + { + return ETrue; + } + else + { + return EFalse; + } + } + return EFalse; + } + +// -------------------------------------------------------------------------------------------- + +TBool CProfilerGuiModel::GetSelectedItemHidden() + { + TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); + + if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) + { + if(iSamplerItemList->At(currentItemIndex).iIsHidden) + { + return ETrue; + } + else + { + return EFalse; + } + } + return EFalse; + } + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiModel::EditSelectedSamplerL(TInt index) + { + TSamplerAttributes sampler; + if(SamplerItemCount() > index && index >= 0) + { + sampler = iSamplerItemList->At(index); + return EditSamplerL(sampler); + } + return KErrNone; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::SelectedSamplerInfoL(TInt index) + { + if(SamplerItemCount() > index && index >= 0) + { + SamplerInfoL(iSamplerItemList->At(index)); + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::ShowItemActionMenuL() + { + TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); + + if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) + { + // show a query dialog + TInt queryIndex(0); + CAknListQueryDialog* listQueryDlg = new(ELeave) CAknListQueryDialog(&queryIndex); + TInt resource = 0; + TSamplerAttributes sampler = iSamplerItemList->At(currentItemIndex); + + // check if sampler enabled + if(sampler.iEnabled) + { + resource = R_ITEM_ACTION_QUERY_ENABLED; + } + else + { + resource = R_ITEM_ACTION_QUERY_DISABLED; + } + + // check if sampler plugin hidden => don't allow starting and stopping of sampling + if(sampler.iIsHidden) + { + resource = R_ITEM_ACTION_QUERY_HIDDEN_START_STOP; + } + else if(( sampler.iItemCount == 0 && + sampler.iSampleRate == KErrNotFound ) && + sampler.iEnabled ) + { + resource = R_ITEM_ACTION_QUERY_HIDDEN_SETTINGS_ENABLED; + } + else if(( sampler.iItemCount == 0 && + sampler.iSampleRate == KErrNotFound ) && + !sampler.iEnabled ) + { + resource = R_ITEM_ACTION_QUERY_HIDDEN_SETTINGS_DISABLED; + } + + // execute query dialog with the given resource + if (listQueryDlg->ExecuteLD(resource)) + { + if(!sampler.iIsHidden) + { + if(sampler.iItemCount != 0 || + sampler.iSampleRate != KErrNotFound ) + { + // enable/disable sampler + if (queryIndex == EItemActionMenuTypeEnable) + { + DisableOrEnableSelectedOrHighlightedItemsL(); + } + // edit sampler settings + else if (queryIndex == EItemActionMenuTypeEditSettings - 1) + { + EditSamplerL(sampler); + } + // info + else if (queryIndex == EItemActionMenuTypeInfo - 1) + { + SamplerInfoL(sampler); + } + } + else + { + // special case, use raw query indexes + if (queryIndex == 0) + { + DisableOrEnableSelectedOrHighlightedItemsL(); + } + else if (queryIndex == 1) + { + SamplerInfoL(sampler); + } + } + } + else + { + if(sampler.iItemCount != 0 || + sampler.iSampleRate != KErrNotFound) + { + // special case, use raw query indexes + // edit sampler settings + if (queryIndex == 0) + { + EditSamplerL(sampler); + } + // sampler info + else if (queryIndex == 1) + { + SamplerInfoL(sampler); + } + } + else + { + // only sampler info available if hidden and no setting items to be set + if (queryIndex == 0) + { + SamplerInfoL(sampler); + } + + } + } + } + } + } + +void CProfilerGuiModel::DisableOrEnableSelectedOrHighlightedItemsL() + { + const CArrayFix* selectionIndexes = iMainContainer->ListBoxSelectionIndexes(); + + // by default use selected items + if (selectionIndexes && selectionIndexes->Count() > 0) + { + TInt ref(0); + TKeyArrayFix key(0, ECmpTUint16); + TInt index(0); + + for (TInt i=0; iFind(ref, key, index) == 0) + { + DisableOrEnableFromSamplerItemListL(i); + } + } + + RefreshViewL(EFalse); + } + + // or if none selected, use the current item index + else + { + TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); + + if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) + { + DisableOrEnableFromSamplerItemListL(currentItemIndex); + + RefreshViewL(EFalse); + } + } + } + +void CProfilerGuiModel::LoadPluginsL() + { + // get samplers from Profiler Engine (client-server session) + // and add the to the samplers list for the first time + LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - get sampler plugins")); + TInt err = RProfiler::GetSamplerAttributes(*iSamplerAttributes); + + // check if engine provided a list of samplers + if( err != KErrNone ) + { + // could not get samplers from engine + LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - failed to connect engine")); + } + else + { + LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - adding new samplers into view")); + AddNewSamplersL(*iSamplerAttributes); + } + + LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - exit")); + } + +// -------------------------------------------------------------------------------------------- + +TInt CProfilerGuiModel::LoadGeneralSettingsL() + { + // local variable for getting saved settings from profiler engine + TGeneralAttributes generalAttr; + TInt err(KErrNone); + + // before loading saved settings (from settings file) set the default values + iGeneralAttributes.iTraceOutput.Copy(KTraceOutput); + iGeneralAttributes.iTraceFilePrefix.Copy(KProfilerDefaultPrefix); + iGeneralAttributes.iSaveFileDrive.Copy(KProfilerDefaultDrive); + iGeneralAttributes.iTimedSamplingPeriod = KDefaultTimedSamplingPeriod; + + // request to + err = RProfiler::GetGeneralAttributes(generalAttr); + + // check that request succesfull + if( err != KErrNone ) + { + // could not connect profiler engine, use + return err; + } + + // check if saved settings different than the default + if(generalAttr.iTraceOutput.MatchF(iGeneralAttributes.iTraceOutput) == KErrNotFound) + { + iGeneralAttributes.iTraceOutput.Copy(generalAttr.iTraceOutput); + } + + if(generalAttr.iTraceFilePrefix.MatchF(iGeneralAttributes.iTraceFilePrefix) == KErrNotFound) + { + iGeneralAttributes.iTraceFilePrefix.Copy(generalAttr.iTraceFilePrefix); + } + + if(generalAttr.iSaveFileDrive.MatchF(iGeneralAttributes.iSaveFileDrive) == KErrNotFound) + { + iGeneralAttributes.iSaveFileDrive.Copy(generalAttr.iSaveFileDrive); + } + + if( generalAttr.iTimedSamplingPeriod > 0) + { + iGeneralAttributes.iTimedSamplingPeriod = generalAttr.iTimedSamplingPeriod; + } + + return err; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::SaveGeneralSettingsL() + { + TInt err(KErrNone); + + // save general attributes to Profiler Engine + err = RProfiler::SetGeneralAttributes(iGeneralAttributes); + + // check if save failed + if(err == KErrNotFound) + { + // profiler stopped (e.g. from eshell) and must be restarted + LaunchProfilerEngineL(); + + err = RProfiler::SetGeneralAttributes(iGeneralAttributes); + if(err != KErrNone) + { + // leave no use to continue + User::Leave(err); + } + } + } + +void CProfilerGuiModel::SetMainView(CProfilerGuiMainView* aMainView) + { + iMainView = aMainView; + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiModel::HandleProfilerStatusChange( KProfilerStatus aStatus ) + { + iState = aStatus; + if( aStatus == EIdle ) + { + iMainContainer->ShowWriterInfoPopupL(KNullDesC); + // set plugin list back to enabled + iMainContainer->SetDimmed(EFalse); + } + TRAP_IGNORE(iMainView->UpdateStatusPaneL(aStatus)); + } + +void CProfilerGuiModel::HandleProfilerErrorL( TInt aError ) + { + TBuf<64> errorMsg; + _LIT(KErrorMessage, "Error: "); + _LIT(KNoMemory, "Cannot write to file, check settings"); + + errorMsg.Copy(KErrorMessage); + // message from pwr sampler + if( aError < -1000 ) + { + errorMsg.Append(_L("Stop other power measurement tools!")); + } + else if( aError == KErrAlreadyExists || aError == 11 ) + { + errorMsg.Append(_L("Close old Profiler before start!")); + } + else if( aError == KErrNotReady ) + { + errorMsg.Append(_L("Memory card removed, failed to write!")); + } + else if( aError == KErrPathNotFound ) + { + errorMsg.Append(_L("Given trace data location does not exist")); + } + else + { + if( aError == KErrNoMemory || + aError == KErrOverflow || + aError == KErrDirFull || + aError == KErrDiskFull || + aError == KErrNotReady ) + { + errorMsg.Append(KNoMemory); + } + else + { + errorMsg.Append(_L("code: ")); + errorMsg.AppendNum(aError); + } + } + // simply show an error note + CAknErrorNote* note = new(ELeave) CAknErrorNote(); + note->ExecuteLD(errorMsg); + + // set state idle in all error cases + iState = MProfilerStatusObserver::EIdle; + + // update status pane + iMainView->UpdateStatusPaneL(iState); + + // set plugin list back to enabled + iMainContainer->SetDimmed(EFalse); + + // refresh and set menus etc. in correct state + RefreshViewL(); + } + +// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,479 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "profiler_gui_samplersettingsviewdlg.h" +#include "profiler_gui_model.h" +#include "profiler_gui.hrh" +#include "profiler_gui_std.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// LITERALS +_LIT8(KCPUSamplerName, "gpp"); +_LIT(KEmptySettingItem, ""); + +// ===================================== MEMBER FUNCTIONS ===================================== + +CProfilerSamplerSettingsViewDlg* CProfilerSamplerSettingsViewDlg::NewL(TSamplerAttributes& aSettings) + { + CProfilerSamplerSettingsViewDlg* self = new(ELeave) CProfilerSamplerSettingsViewDlg(aSettings); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CProfilerSamplerSettingsViewDlg::~CProfilerSamplerSettingsViewDlg() + { + // restore default navi pane + if(iNaviContainer) + iNaviContainer->Pop(); + + if (iSettingItemArray) + { + iSettingItemArray->ResetAndDestroy(); + delete iSettingItemArray; + } + + } + +// -------------------------------------------------------------------------------------------- + +CProfilerSamplerSettingsViewDlg::CProfilerSamplerSettingsViewDlg(TSamplerAttributes& aSettings) + : iSettings(aSettings) + { + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::ConstructL() + { + // construct a menu bar + CAknDialog::ConstructL(R_PROFILER_SAMPLER_SETTINGS_MENUBAR); + + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + + // set empty navi pane label + iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); + iNaviContainer->PushDefaultL(); + + TBuf<64> settingsTitle; + + settingsTitle.Zero(); + settingsTitle.Copy(iSettings.iName); + + // set title text + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( settingsTitle ); + + iItemCount = iSettings.iItemCount; + + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + switch (aEventType) + { + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + ShowSettingPageL(EFalse); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::TabChangedL(TInt /*aIndex*/) + { + iListBox->SetCurrentItemIndex(0); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::ProcessCommandL(TInt aCommandId) + { + CAknDialog::ProcessCommandL(aCommandId); + + switch (aCommandId) + { + case EProfilerGuiCmdSettingsChange: + ShowSettingPageL(ETrue); + break; + case EProfilerGuiCmdSettingsExit: + TryExitL(EAknCmdExit); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CProfilerSamplerSettingsViewDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) + { + + return CAknDialog::OfferKeyEventL(aKeyEvent, aType); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::PreLayoutDynInitL() + { + iListBox = static_cast( Control(EProfilerSamplerSettingItemList) ); + 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 CProfilerSamplerSettingsViewDlg::OkToExitL(TInt aButtonId) + { + // save all settings when exiting, only numeric values are needed to saved since copied from TBuf + for(TInt i(1);iAt(i)->IsHidden() == EFalse) + { + switch(i) + { + case 1: + { + // check if settings value type integer + if(iSettings.iSettingItem1.iType == TSettingItem::ESettingItemTypeInt) + { + iSettings.iSettingItem1.iValue.Num(iItemBuf[i]); + } + break; + } + case 2: + { + // check if settings value type integer + if(iSettings.iSettingItem2.iType == TSettingItem::ESettingItemTypeInt) + { + iSettings.iSettingItem2.iValue.Num(iItemBuf[i]); + } + break; + } + case 3: + { + // check if settings value type integer + if(iSettings.iSettingItem3.iType == TSettingItem::ESettingItemTypeInt) + { + iSettings.iSettingItem3.iValue.Num(iItemBuf[i]); + } + break; + } + case 4: + { + // check if settings value type integer + if(iSettings.iSettingItem4.iType == TSettingItem::ESettingItemTypeInt) + { + iSettings.iSettingItem4.iValue.Num(iItemBuf[i]); + } + + break; + } + case 5: + { + // check if settings value type integer + if(iSettings.iSettingItem5.iType == TSettingItem::ESettingItemTypeInt) + { + iSettings.iSettingItem5.iValue.Num(iItemBuf[i]); + } + + break; + } + case 6: + { + // check if settings value type integer + if(iSettings.iSettingItem6.iType == TSettingItem::ESettingItemTypeInt) + { + iSettings.iSettingItem6.iValue.Num(iItemBuf[i]); + } + + break; + } + } + } + } + return CAknDialog::OkToExitL(aButtonId); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::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 CProfilerSamplerSettingsViewDlg::SetVisibilitiesOfSettingItemsL() + { + if (iSettingItemArray->Count() > 0) + { + if(iSettings.iSampleRate > 0) + { + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQuerySampleRate])->SetHidden(EFalse); + } + else + { + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQuerySampleRate])->SetHidden(ETrue); + } + if(iItemCount>0) + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem1])->SetHidden(EFalse); + if(iItemCount>1) + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem2])->SetHidden(EFalse); + if(iItemCount>2) + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem3])->SetHidden(EFalse); + if(iItemCount>3) + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem4])->SetHidden(EFalse); + if(iItemCount>4) + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem5])->SetHidden(EFalse); + if(iItemCount>5) + ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem6])->SetHidden(EFalse); + + iSettingItemArray->RecalculateVisibleIndicesL(); + iListBox->HandleItemAdditionL(); + iListBox->UpdateScrollBarsL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::UpdateListBoxL() + { + iSettingItemArray->ResetAndDestroy(); + + // create items + TInt ordinal(0); + + AddSettingItemL(EProfilerGuiGenericSamplerQuerySampleRate, + R_SAMPLE_RATE_SETTING_TITLE, + R_SAMPLER_RATE_SETTING_PAGE, + NULL, + ordinal++); + + if(iItemCount>0) + AddSettingItemL(EProfilerGuiGenericSamplerQueryItem1, + R_ITEM1_SETTING_TITLE, + NULL, + NULL, + ordinal++); + if(iItemCount>1) + AddSettingItemL(EProfilerGuiGenericSamplerQueryItem2, + R_ITEM2_SETTING_TITLE, + NULL, + NULL, + ordinal++); + if(iItemCount>2) + AddSettingItemL(EProfilerGuiGenericSamplerQueryItem3, + R_ITEM3_SETTING_TITLE, + NULL, + NULL, + ordinal++); + if(iItemCount>3) + AddSettingItemL(EProfilerGuiGenericSamplerQueryItem4, + R_ITEM4_SETTING_TITLE, + NULL, + NULL, + ordinal++); + if(iItemCount>4) + AddSettingItemL(EProfilerGuiGenericSamplerQueryItem5, + R_ITEM5_SETTING_TITLE, + NULL, + NULL, + ordinal++); + if(iItemCount>5) + AddSettingItemL(EProfilerGuiGenericSamplerQueryItem6, + R_ITEM6_SETTING_TITLE, + NULL, + NULL, + ordinal++); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +CAknSettingItem* CProfilerSamplerSettingsViewDlg::GetSettingItemL(TSettingItem& aItem, TInt aIndex, TInt& aSettingPageResource) + { + CAknSettingItem* settingItem = NULL; + + // set default setting page dialog style resource + aSettingPageResource = R_GENERIC_TEXT_SETTING_PAGE; + + // check if setting item type integer + if(aItem.iType == TSettingItem::ESettingItemTypeInt) + { + TLex* lex = new TLex(aItem.iValue); + // check if value valid + if(lex->Val(iItemBuf[aIndex]) != KErrNone) + { + // if value not valid set to 0 + iItemBuf[aIndex] = 0; + } + settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aIndex, iItemBuf[aIndex]); + aSettingPageResource = R_NUMERIC_SETTING_PAGE; + delete lex; + return settingItem; + } + else // else manipulate as a text setting + { + settingItem = new(ELeave) CAknTextSettingItem(aIndex, aItem.iValue); + settingItem->SetEmptyItemTextL(KEmptySettingItem); + return settingItem; + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerSamplerSettingsViewDlg::AddSettingItemL(TInt aId, + TInt aTitleResource, + TInt aSettingPageResource, + TInt aAssociatedResource, + TInt aOrdinal) + { + // create a setting item + CAknSettingItem* settingItem = NULL; + + TBuf ptr; + switch(aId) + { + case EProfilerGuiGenericSamplerQuerySampleRate: + { + settingItem = new (ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iSampleRate); + break; + } + case EProfilerGuiGenericSamplerQueryItem1: + { + ptr.Copy(iSettings.iSettingItem1.iUIText); + settingItem = GetSettingItemL(iSettings.iSettingItem1, aId, aSettingPageResource); + break; + } + case EProfilerGuiGenericSamplerQueryItem2: + { + ptr.Copy(iSettings.iSettingItem2.iUIText); + settingItem = GetSettingItemL(iSettings.iSettingItem2, aId, aSettingPageResource); + break; + } + case EProfilerGuiGenericSamplerQueryItem3: + { + ptr.Copy(iSettings.iSettingItem3.iUIText); + settingItem = GetSettingItemL(iSettings.iSettingItem3, aId, aSettingPageResource); + break; + } + case EProfilerGuiGenericSamplerQueryItem4: + { + ptr.Copy(iSettings.iSettingItem4.iUIText); + settingItem = GetSettingItemL(iSettings.iSettingItem4, aId, aSettingPageResource); + break; + } + case EProfilerGuiGenericSamplerQueryItem5: + { + ptr.Copy(iSettings.iSettingItem5.iUIText); + settingItem = GetSettingItemL(iSettings.iSettingItem5, aId, aSettingPageResource); + break; + } + case EProfilerGuiGenericSamplerQueryItem6: + { + ptr.Copy(iSettings.iSettingItem6.iUIText); + settingItem = GetSettingItemL(iSettings.iSettingItem6, aId, aSettingPageResource); + break; + } + default: + { + // Id not supported + User::Leave(KErrNotSupported); + break; + } + } + + CleanupStack::PushL(settingItem); + + // get title text + HBufC* itemTitle; + + if( ptr.Compare(KNullDesC) == 0 ) + { + itemTitle = StringLoader::LoadLC(aTitleResource); + + // special case: check if CPU sampler + if(iSettings.iShortName.CompareF(KCPUSamplerName) == 0) + { + // change setting page using different value range, since > 10000 ms rates are too big + aSettingPageResource = R_CPU_SAMPLER_RATE_SETTING_PAGE; + } + + // 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 + } + else + { + // construct the setting item + settingItem->ConstructL(EFalse, aOrdinal, ptr, NULL, aSettingPageResource, + EAknCtPopupSettingList, NULL, aAssociatedResource); + + // append the setting item to settingitem array + iSettingItemArray->InsertL(aOrdinal, settingItem); + } + + CleanupStack::Pop(); //settingItem + } + +// -------------------------------------------------------------------------------------------- +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 "profiler_gui_settingsviewdlg.h" +#include "profiler_gui_model.h" +#include "profiler_gui.hrh" +#include "profiler_gui_std.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +// LITERALS +_LIT8(KDebugOutput, "debug_output"); +_LIT8(KFileSystem, "file_system"); +_LIT(KEmptySettingItem, ""); + +// ===================================== MEMBER FUNCTIONS ===================================== + +CProfilerGuiSettingsViewDlg* CProfilerGuiSettingsViewDlg::NewL(TGeneralAttributes& aSettings) + { + CProfilerGuiSettingsViewDlg* self = new(ELeave) CProfilerGuiSettingsViewDlg(aSettings); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// -------------------------------------------------------------------------------------------- + +CProfilerGuiSettingsViewDlg::~CProfilerGuiSettingsViewDlg() + { + // restore default navi pane + if(iNaviContainer) + iNaviContainer->Pop(); + + if (iSettingItemArray) + { + iSettingItemArray->ResetAndDestroy(); + delete iSettingItemArray; + } + + } + +// -------------------------------------------------------------------------------------------- + +CProfilerGuiSettingsViewDlg::CProfilerGuiSettingsViewDlg(TGeneralAttributes& aSettings) : iSettings(aSettings) + { + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiSettingsViewDlg::ConstructL() + { + // construct a menu bar + CAknDialog::ConstructL(R_PROFILER_GUI_SETTINGS_MENUBAR); + + CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); + + // set empty navi pane label + iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); + iNaviContainer->PushDefaultL(); + + // set title text + CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); + tp->SetTextL( _L("Settings") ); + + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) + { + switch (aEventType) + { + case EEventEnterKeyPressed: + case EEventItemDoubleClicked: + ShowSettingPageL(EFalse); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiSettingsViewDlg::TabChangedL(TInt /*aIndex*/) + { + iListBox->SetCurrentItemIndex(0); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiSettingsViewDlg::ProcessCommandL(TInt aCommandId) + { + CAknDialog::ProcessCommandL(aCommandId); + + switch (aCommandId) + { + case EProfilerGuiCmdSettingsChange: + ShowSettingPageL(ETrue); + break; + case EProfilerGuiCmdSettingsExit: + TryExitL(EAknCmdExit); + break; + default: + break; + } + } + +// -------------------------------------------------------------------------------------------- + +TKeyResponse CProfilerGuiSettingsViewDlg::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 CProfilerGuiSettingsViewDlg::PreLayoutDynInitL() + { + iListBox = static_cast( Control(EProfilerGuiSettingItemList) ); + 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 CProfilerGuiSettingsViewDlg::OkToExitL(TInt aButtonId) + { + // save settings to iSettings before exiting + + // check if trace output target changed + if(iTraceOutput == EOutputToDebugPort) + { + iSettings.iTraceOutput.Copy(KDebugOutput); + } + else + { + iSettings.iTraceOutput.Copy(KFileSystem); + } + + // save trace file prefix + if(iFilePrefix.CompareF(KNullDesC) != 0) + { + CnvUtfConverter::ConvertFromUnicodeToUtf8(iSettings.iTraceFilePrefix, iFilePrefix); + } + + // save the drive + if(iSaveDrive.CompareF(KNullDesC) != 0) + { + CnvUtfConverter::ConvertFromUnicodeToUtf8(iSettings.iSaveFileDrive, iSaveDrive); + } + + return CAknDialog::OkToExitL(aButtonId); + } + + + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiSettingsViewDlg::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 CProfilerGuiSettingsViewDlg::SetVisibilitiesOfSettingItemsL() + { + + // check if setting item array contains more than 0 items + if (iSettingItemArray->Count() > 0) + { +// ((*iSettingItemArray)[ESettingListItemPluginNameMode])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPluginTraceOutput])->SetHidden(EFalse); + if(iTraceOutput == EOutputToDebugPort) + { + ((*iSettingItemArray)[ESettingListItemPluginSaveFileDrive])->SetHidden(ETrue); + ((*iSettingItemArray)[ESettingListItemPluginTraceFilePrefix])->SetHidden(ETrue); + } + else + { + ((*iSettingItemArray)[ESettingListItemPluginSaveFileDrive])->SetHidden(EFalse); + ((*iSettingItemArray)[ESettingListItemPluginTraceFilePrefix])->SetHidden(EFalse); + } +// ((*iSettingItemArray)[ESettingListItemPluginTraceMode])->SetHidden(ETrue); + + iSettingItemArray->RecalculateVisibleIndicesL(); + iListBox->HandleItemAdditionL(); + iListBox->UpdateScrollBarsL(); + } + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiSettingsViewDlg::UpdateListBoxL() + { + iSettingItemArray->ResetAndDestroy(); + + // create items + TInt ordinal(0); + +// AddSettingItemL(ESettingListItemPluginNameMode, +// R_PLUGIN_NAME_MODE_SETTING_TITLE, +// R_PLUGIN_NAME_MODE_SETTING_PAGE, +// R_PLUGIN_NAME_MODE_SETTING_TEXTS, +// ordinal++); + + AddSettingItemL(ESettingListItemPluginTraceOutput, + R_TRACE_OUTPUT_SETTING_TITLE, + R_TRACE_OUTPUT_SETTING_PAGE, + R_TRACE_OUTPUT_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemPluginSaveFileDrive, + R_SAVE_FILE_DRIVE_SETTING_TITLE, + R_SAVE_FILE_DRIVE_SETTING_PAGE, + NULL, //R_SAVE_FILE_DRIVE_SETTING_TEXTS, + ordinal++); + + AddSettingItemL(ESettingListItemPluginTraceFilePrefix, + R_SAVE_FILE_PREFIX_SETTING_TITLE, + R_SAVE_FILE_PREFIX_SETTING_PAGE, + NULL, + ordinal++); + + AddSettingItemL(ESettingListItemPluginSamplingTime, + R_TIMED_SAMPLING_PERIOD_SETTING_TITLE, + R_TIMED_SAMPLING_PERIOD_SETTING_PAGE, + NULL, + ordinal++); + + + +// AddSettingItemL(ESettingListItemPluginTraceMode, +// R_TRACE_MODE_SETTING_TITLE, +// R_TRACE_MODE_SETTING_PAGE, +// R_TRACE_MODE_SETTING_TEXTS, +// ordinal++); + + SetVisibilitiesOfSettingItemsL(); + } + +// -------------------------------------------------------------------------------------------- + +void CProfilerGuiSettingsViewDlg::AddSettingItemL(TInt aId, + TInt aTitleResource, + TInt aSettingPageResource, + TInt aAssociatedResource, + TInt aOrdinal) + { + // create a setting item + CAknSettingItem* settingItem = NULL; + + switch (aId) + { + + case ESettingListItemPluginSaveFileDrive: + { + CnvUtfConverter::ConvertToUnicodeFromUtf8(iSaveDrive, iSettings.iSaveFileDrive); + settingItem = new(ELeave) CAknTextSettingItem(aId, iSaveDrive); + settingItem->SetEmptyItemTextL(KEmptySettingItem); + break; + } + case ESettingListItemPluginTraceOutput: + if(iSettings.iTraceOutput.MatchF(KDebugOutput) != KErrNotFound) + { + iTraceOutput = EOutputToDebugPort; + } + else + { + iTraceOutput = EOutputToFileSystem; + } + settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iTraceOutput); + + break; + + case ESettingListItemPluginTraceFilePrefix: + { + CnvUtfConverter::ConvertToUnicodeFromUtf8(iFilePrefix, iSettings.iTraceFilePrefix); + settingItem = new(ELeave) CAknTextSettingItem(aId, iFilePrefix); + settingItem->SetEmptyItemTextL(KEmptySettingItem); + break; + } + case ESettingListItemPluginSamplingTime: + { + settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iTimedSamplingPeriod); + 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 + } + +// End of File + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/hb.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/hb.pro Fri Sep 03 17:11:21 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: +# +# + + +TEMPLATE = app +TARGET = PIProfilerUI +DEPENDPATH += ./src +INCLUDEPATH += inc +INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE +load(hb.prf) +symbian:CONFIG -= symbian_i18n + +# Input +HEADERS += ./inc/pimainview.h \ + ./inc/piprofilerengineprivate.h \ + ./inc/pluginattributes.h \ + ./inc/notifications.h \ + ./inc/pisettingsview.h \ + ./inc/pimainwindow.h \ + ./inc/generalattributes.h \ + ./inc/piprofilerengine.h +SOURCES += ./src/pimainview.cpp \ + ./src/piprofilerengineprivate.cpp \ + ./src/main.cpp \ + ./src/pluginattributes.cpp \ + ./src/notifications.cpp \ + ./src/pisettingsview.cpp \ + ./src/pimainwindow.cpp \ + ./src/piprofilerengine.cpp + + +RESOURCES += piprofiler.qrc + + +symbian: { + TARGET.UID2 = 0x100039CE + TARGET.UID3 = 0x2001E5AE + + BLD_INF_RULES.prj_exports += "./rom/piprofilerui_hb.iby \ + CORE_IBY_EXPORT_PATH(tools,piprofilerui.iby)" + + TARGET.CAPABILITY = ALL -TCB + + LIBS += -lcharconv -lbafl -lsysutil -lefsrv + + ICON = ../icons/qgn_menu_piprofilerui.svg + +} else { + error("Only Symbian supported!") +} \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/generalattributes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/generalattributes.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,34 @@ +/* +* 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 GENERALATTRIBUTES_H_ +#define GENERALATTRIBUTES_H_ +/* + * + * GeneralAttributes class definition, internal settings format + * + */ +class GeneralAttributes +{ +public: + QString mTraceOutput; + QString mTraceFilePrefix; + QString mSaveFileDrive; + int mTimedSamplingPeriod; +}; + +#endif /* GENERALATTRIBUTES_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/notifications.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/notifications.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,39 @@ +/* +* 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 NOTIFICATIONS_H_ +#define NOTIFICATIONS_H_ + +#include + +/** + * Notifications class for viewing notification messages. + */ + +class Notifications +{ +public: + + static void showInformationNote(const QString &text); + static void showErrorNote(const QString &text); + static void showMessageBox(const QString &text); + +private: + +}; + +#endif // NOTIFICATIONS_H_ diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/pimainview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/pimainview.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,206 @@ +/* +* 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 PIMAINVIEW_H +#define PIMAINVIEW_H + +#include +#include + +#include "pluginattributes.h" +#include "piprofilerengine.h" + +class HbAction; +class HbMainWindow; +class HbDocumentLoader; +class HbApplication; +class HbLabel; +class HbWidget; +class HbListWidget; +class HbListWidgetItem; +class HbMenu; +class PISettingsView; +class PIMainWindow; +class HbDialog; + +class PIMainView: public HbView +{ +Q_OBJECT + +public: + + /** + * Constructor + */ + PIMainView(); + + /** + * Destructor + */ + ~PIMainView(); + + /** + * Initializes view + */ + void init(PIMainWindow *mainWindow, HbApplication *app, HbDocumentLoader &loader, + PIProfilerEngine *engine); + + /** + * Sets and updates new plug-in list into main view + * @param pluginList List of plug-ins + */ + void setPluginList(QList *pluginList); + +private: + + /** + * connects signals and slots + */ + void connectSignalsAndSlots(HbApplication* app); + + /** + * Loads all UI items from xml file + */ + void loadItemsFromResources(HbDocumentLoader &loader); + + /** + * Updates plug-in list according to member variable mPluginList + */ + void updatePlugInLists(); + + /** + * Gets plug-in attributes for plug-in which UID number is defined in parameter + * If plugin for UID if not found, empty pluginattributes variable is returned + */ + PluginAttributes getPluginAttributes(int uid); + + /** + * Shows profiling note + */ + void showProfilingNote(); + +private slots: + + /** + * Slot that is called when profiling status is changed. + * Method updated text in popup that is shown in the screen + */ + void profilingStatusChanged(ProfilerEngineStatus status, const QString &text = 0, + ProfilingMode profilingMode = PI_PROFILINGMODENORMAL, ProfilingOutput output = + PI_FILE_OUTPUT); + + /** + * shows about popup + */ + void showAboutPopup(); + + /** + * opens settings view + */ + void openSettingsView(); + + /** + * Enables or disables plug-in from plug-in list. If parameter is zero, selected + * plug-in from plug-in list is enabled/disabled. + */ + void enableOrDisablePlugin(HbListWidgetItem *widget = 0); + + /** + * Shows context menu for list widget + */ + void showContexMenu(HbListWidgetItem *widget, const QPointF &point); + + /** + * Opens sampler info for plug-in that is selected. + */ + void openSampleInfo(); + + /** + * sets context menu pointer to zero + */ + + void contextMenuClosed(); + + /** + * Shows profiling-popup and starts profiling + */ + void startProfiling(); + + /** + * Shows profiling popup and starts profiling + */ + void startTimedProfiling(); + + /** + * Stops profiling + */ + void stopProfiling(); + + /** + * Updates "Start timed profiling for xx seconds" text according to settings + */ + void updateTimedProfilingText(); + + /** + * Exits and leaves profiling on + */ + void exitAndLeaveProfilingOn(); + + /** + * Opens plug-in specific settings for selected plug-in + */ + void openPluginSpecificSettings(); +private: + + // main application + HbApplication *application; + + // main window + PIMainWindow *mMainWindow; + + // engine pointer + PIProfilerEngine *mEngine; + + // list of plug-ins + QList *mPluginList; + + // context menu + HbMenu *mContextMenu; + + // Actions + HbAction *mActionExit; + HbAction *mActionExitAndLeaveProfilingOn; + HbAction *mActionAbout; + HbAction *mActionStartProfiling; + HbAction *mActionStartTimedProfiling; + HbAction *mActionSettings; + HbAction *mActionStopProfiling; + + // plug-in list widget + HbListWidget *mListPlugins; + + // Profiling note + HbDialog *mProfilingNote; + + // Icons for enabled and disabled plug-ins + HbIcon mIconEnabled; + HbIcon mIconDisabled; + +}; + +#endif // PIMAINVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/pimainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/pimainwindow.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,109 @@ +/* +* 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 PIPROFILERMAINWINDOW_H_ +#define PIPROFILERMAINWINDOW_H_ + +// System includes +#include +#include + +// User includes +#include "pluginattributes.h" + +// Forward declarations +class PIMainView; +class PISettingsView; +class PIProfilerEngine; +class HbDocumentLoader; +class HbApplication; + +// Class declaration +class PIMainWindow: public HbMainWindow +{ +Q_OBJECT +public: + + // Member functions + + PIMainWindow(PIProfilerEngine* engine, HbDocumentLoader &loader, HbApplication *app); + virtual ~PIMainWindow(); + +signals: + + /** + * Signal that is emitted when back button is pressed at settings view + */ + void returnedFromSettings(); + +public slots: + + /** + * Activates main view + */ + void activateMainView(); + + /** + * Activates settings view + */ + void activateSettingsView(int uid = 0); + + /** + * method that is called when back button pressed at settings view + */ + void settingsViewClosed(); + + /** + * Sets and new plugin list to all views + */ + void setPluginList(QList &pluginList); + +private: + + /** + * creates and adds main view to window + */ + void addMainView(HbDocumentLoader &loader, HbApplication *app); + + /** + * creates and adds settings view to main window + */ + void addSettingsView(); + +private slots: + +private: + // data + + // Engine wrapper + PIProfilerEngine* mEngine; + + // Main view + PIMainView* mMainView; + + // Settings view + PISettingsView* mSettingsView; + + // Back Action + HbAction *mBackAction; + + // plug-in attributes + QList mPluginAttributes; + +}; + +#endif /* PIPROFILERMAINWINDOW_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/piprofilerengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/piprofilerengine.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,135 @@ +/* +* 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 PIPROFILEREGINE_H +#define PIPROFILEREGINE_H + +#include +#include + +#include "pluginattributes.h" + +class PIProfilerEnginePrivate; +class GeneralAttributes; + +enum ProfilerEngineStatus +{ + PI_PROFILING = 0, PI_FINISHED_SUCCEFULLY, PI_ERROR +}; +enum ProfilingMode +{ + PI_PROFILINGMODENORMAL = 0, PI_PROFILINGMODETIMED +}; +enum ProfilingOutput +{ + PI_DEBUG_OUTPUT = 0, PI_FILE_OUTPUT +}; + +class PIProfilerEngine: public QObject +{ +Q_OBJECT +public: + + /** + * Constructor + */ + PIProfilerEngine(); + + /** + * Initilises engine + */ + bool init(); + + /** + * Destructor + */ + ~PIProfilerEngine(); + + /** + * Gets PI Profiler general settings + */ + void getGeneralSettings(GeneralAttributes &settings); + + /** + * Notifys engine that ui is ready + */ + void notifyUIReady(); + + /** + * Saves general settings into engine + */ + bool saveGeneralSettings(GeneralAttributes &settings); + + /** + * Saves plug-in settings into engine + */ + bool savePluginSettings(const PluginAttributes &pluginAttributes); + + /** + * Starts normal profiling + */ + bool startProfiling(); + + /** + * Starts timed profiling + */ + bool startTimedProfiling(); + + /** + * Stops profiling + */ + void stopProfiling(); + + /** + * gets time limit for timed profiling + */ + int getTimeLimit(); + + /** + * Sets PI profiler engine to continue running after ui is closed. + */ + void leaveProfilingOnAfterClosing(); + + bool checkTraceLocationSanity(QString &location); + +signals: + + /** + * Signal that is emitted when plug-in list is loaded + */ + void pluginListUpdated(QList &samplerList); + + /** + * Signal that is emitted when profiling status is changed + */ + void profilingStatusChanged(ProfilerEngineStatus status, const QString &text = 0, + ProfilingMode profilingMode = PI_PROFILINGMODENORMAL, ProfilingOutput output = + PI_FILE_OUTPUT); + +private: + + // private implementation + PIProfilerEnginePrivate *mPrivate; + +private: + // Friend classes + + friend class PIProfilerEnginePrivate; + +}; + +#endif // PIPROFILEREGINE_H diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/piprofilerengineprivate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/piprofilerengineprivate.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,217 @@ +/* +* 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 PIPROFILEREGINEPRIVATE_H +#define PIPROFILEREGINEPRIVATE_H + +#include +#include +#include + +class TSamplerAttributes; +class PIMainView; +class PluginAttributes; +class GeneralAttributes; +class SettingItem; +class CProfilerEngineStatusChecker; +class PIProfilerEngine; +class PIProfilerEnginePrivate: public MProfilerStatusObserver +{ + +public: + + enum TProfilingMode + { + EProfilingModeNormal = 0, EProfilingModeTimed + }; + + /** + * Constructor + */ + PIProfilerEnginePrivate(PIProfilerEngine *aEngine); + + /** + * Destructor + */ + ~PIProfilerEnginePrivate(); + + /** + * Initializesprofiler engine + */ + bool Init(); + + /** + * Method that is called when UI is ready + */ + void NotifyUIReady(); + + /** + * Saves plug-in settings into engine + */ + bool SavePluginSettings(const PluginAttributes &pluginAttributes); + + /** + * Starts normal profiling + */ + bool StartProfiling(); + + /** + * Starts timed profiling + */ + bool StartTimedProfiling(); + + /** + * Stops profiling + */ + void StopProfiling(); + + /** + * MProfilerStatusObserver method that is called when profiler engine's status is changed + */ + void HandleProfilerStatusChange(KProfilerStatus aStatus); + + /** + * MProfilerStatusObserver method that is called when profiler error is occured. + */ + void HandleProfilerErrorL(TInt aError); + + /** + * Gets PI Profiler general settings + */ + void GetGeneralSettings(GeneralAttributes &settings); + + /** + * Saves general settings into engine + */ + bool SaveGeneralSettings(GeneralAttributes &settings); + + /** + * gets time limit for timed profiling + */ + int GetTimeLimit(); + + /** + * Sets PI profiler engine to continue running after ui is closed. + */ + void LeaveProfilingOnAfterClosing(); + + bool CheckTraceLocationSanity(QString &location); + +private: + + /** + * Saves general settings into engine + */ + void SaveGeneralSettingsL(); + + /** + * loads general settings from engine + */ + TInt LoadGeneralSettingsL(); + + /** + * Starts to profile + */ + void StartAllSamplerItemsL(TProfilingMode aProfilingMode); + + // Converters for symbian to qt and qt to symbian + + /** + * TSamplerAttributes -> SamplerAttributes + */ + static void convertTSamplerAttributesToPluginAttributes(TSamplerAttributes &tSamplerAttributes, + PluginAttributes &samplerAttributes); + + /** + * TSettingItem -> SettingItem + */ + static void convertTSettingItemToSettingItem(TSettingItem &tSettingItem, + SettingItem &settingItem); + + /** + * SettingItem -> TSettingItem + */ + static void convertSettingItemToTSettingItem(TSettingItem &tSettingItem, + const SettingItem &settingItem); + + /** + * TGeneralAttributes -> GeneralAttributes + */ + static void convertTGeneralAttributesToGeneralAttributes( + TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes); + + /** + * GeneralAttributes -> TGeneralAttributes + */ + static void convertGeneralAttributesToTGeneralAttributes( + TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes); + + /** + * Launches PI Profiler engine + */ + int LaunchEngineL(); + + /** + * Terminates PI Profiler engine + */ + void terminateEngine(); + + /** + * Gets plug-ins from engine + */ + void addNewSamplers(CArrayFixFlat& aAttributes); + + /** + * Loads plug-ins + */ + void loadPlugins(); + + /** + * Finds PI Profiler Engine process + */ + TInt FindProcessL(RProcess& aProc); + + /** + * Attaches client into PI Profiler engine + */ + void AttachClient(); + + /** + * Checks trace location sanity + */ + TBool CheckTraceLocationSanityL(TBuf8& aAttr); + +private: + + // Should Engine leaved on after ui is closed + bool iLeaveProfilingOnAfterClosing; + + // Public part of engine + PIProfilerEngine *iPublic; + + // Sampler Attributes + CArrayFixFlat* iSamplerAttributes; + + // General attributes + TGeneralAttributes iGeneralAttributes; + + // Engine status checker + CProfilerEngineStatusChecker* iStatusChecker; + +}; + +#endif // PIPROFILEREGINEPRIVATE_H diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/pisettingsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/pisettingsview.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,140 @@ +/* +* 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 PISETTINGSVIEW_H +#define PISETTINGSVIEW_H + +#include +#include + +#include "generalattributes.h" + +class PIProfilerEngine; +class HbMainWindow; +class HbDataForm; +class HbDataFormModel; +class HbDataFormModelItem; +class PluginAttributes; +class SettingItem; + +class PISettingsView: public HbView +{ +Q_OBJECT + +public: + + enum OutputMode + { + OUTPUT_MODE_DEBUG, OUTPUT_MODE_FILE + }; + + /** + * Constructor + */ + PISettingsView(PIProfilerEngine *engine); + + /** + * Destructor + */ + ~PISettingsView(); + + /** + * Reads general settings from data form and returns GeneralAttributes + */ + GeneralAttributes& getGeneralAttributes(); + + /** + * Reads plug-in specific settings from data form and saves them into mPluginlist + */ + void readPluginSettings(); + + /** + * Sets plug-in specific settings and creates data form items for them + */ + void setPluginSettings(QList *pluginList); + + /** + * Expands one plug-ins settings group. Other groups are collapsed. + */ + void expandPluginGroup(int uid); + +private: + + /** + * Creates general settings form items + */ + void createGeneralSettingForms(); + + /** + * Creates plug-in specific form items + */ + void createPluginSpecificSettings(); + + /** + * Loads general settings and updates them into form + */ + void loadGeneralSettings(); + + /** + * Creates one plug-in setting item + */ + HbDataFormModelItem *createPluginSettingItem(const SettingItem *item, + HbDataFormModelItem *parentGroup); + + /** + * reads ont plug-in setting value and saves it into qstring value + */ + void readPluginSettingItemValue(HbDataFormModelItem *dataFormItem, SettingItem *settingItem); + +private slots: + + /** + * Adds text validators into form items + */ + void addTextValidators(const QModelIndex index); + +private: + + // engine pointer + PIProfilerEngine *mEngine; + + // General settings + GeneralAttributes mGeneralAttributes; + + // list of plug-ins + QList *mPluginList; + + // setting form + HbDataForm *mSettingForm; + + // model class + HbDataFormModel *mModel; + + // data form groups + HbDataFormModelItem *mGeneralSettingsGroup; + HbDataFormModelItem *mPluginSettingsGroup; + + // general setting items + HbDataFormModelItem *mOutputItem; + HbDataFormModelItem *mFileLocation; + HbDataFormModelItem *mPrefix; + HbDataFormModelItem *mSamplingPeriod; + + HbDataFormModelItem *testItem;//TODO remove! +}; + +#endif // PISETTINGSVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/inc/pluginattributes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/inc/pluginattributes.h Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,91 @@ +/* +* 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 PLUGINATTRIBUTES_H_ +#define PLUGINATTRIBUTES_H_ + +/* + * + * PluginAttributes class definition, internal settings format + * + */ +#include +#include +#include + +class HbDataFormModelItem; + +/* + * + * TSettingItem class definition, internal settings format + * + */ +class SettingItem +{ +public: + enum + { + SettingItemTypeInt = 0, SettingItemTypeBool, SettingItemTypeHex, SettingItemTypeText + }; + +public: + QString mSettingText; + int mType; + QString mValue; + QString mSettingDescription; + QString mUIText; +}; + +class PluginAttributes// : public QObject +{ + //Q_OBJECT +public: + + // default constructor + PluginAttributes(); + + ~PluginAttributes(); +public: + int mUid; + QString mShortName; // name of the plugin, short name + QString mName; // name of the plugin, long name + QString mDescription; // plugin description, info about HW/SW dependencies etc. + int mSampleRate; // sample rate of the plugin + bool mEnabled; // enabled for profiling + bool mIsHidden; // hidden, i.e. no start/stop controls + int mItemCount; // plugin specific setting item count + + + // plugin specific settings, plugin implementation dependent + SettingItem mSettingItem1; + SettingItem mSettingItem2; + SettingItem mSettingItem3; + SettingItem mSettingItem4; + SettingItem mSettingItem5; + SettingItem mSettingItem6; + + HbDataFormModelItem *mFormItemSettingItem1; + HbDataFormModelItem *mFormItemSettingItem2; + HbDataFormModelItem *mFormItemSettingItem3; + HbDataFormModelItem *mFormItemSettingItem4; + HbDataFormModelItem *mFormItemSettingItem5; + HbDataFormModelItem *mFormItemSettingItem6; + HbDataFormModelItem *mFormItemSampleRate; + +}; + +#endif /* PLUGINATTRIBUTES_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/pimainview.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/pimainview.docml Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/piprofiler.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/piprofiler.qrc Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,29 @@ + + + + + pimainview.docml + + + ../icons/qgn_menu_piprofilerui.svg + ../icons/qgn_prob_piprofilerui_status_enabled.svg + ../icons/qgn_prob_piprofilerui_status_disabled.svg + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/rom/piprofilerui_hb.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/rom/piprofilerui_hb.iby Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies 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 __PROFILERGUI_IBY__ +#define __PROFILERGUI_IBY__ + +S60_APP_EXE(PIProfilerUI) +//S60_APP_AIF_ICONS(PIProfilerUI) +data=ZRESOURCE\apps\PIProfilerUI.mif resource\apps\PIProfilerUI.mif +data=ZRESOURCE\apps\PIProfilerUI.rsc resource\apps\PIProfilerUI.rsc +//S60_APP_RESOURCE(PIProfilerUI) +data=ZPRIVATE\10003a3f\import\apps\PIProfilerUI_reg.rsc private\10003a3f\import\apps\PIProfilerUI_reg.rsc + +#endif // __PROFILERGUI_IBY__ diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/main.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,68 @@ +/* +* 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 "pimainview.h" +#include "piprofilerengine.h" +#include "notifications.h" +#include "pimainwindow.h" + +// Create custom document loader to be able to use custom views in XML. +class PIProfilerDocumentLoader: public HbDocumentLoader +{ +public: + virtual QObject *createObject(const QString& type, const QString &name); +}; + +int main(int argc, char *argv[]) +{ + + // Create application and document loader. + HbApplication app(argc, argv); + PIProfilerDocumentLoader loader; + + // Create Engine and initialize it + PIProfilerEngine engine; + if (!engine.init()) { + Notifications::showErrorNote(QString("Unable to start PI Profiler engine")); + return EXIT_FAILURE; + } + + // create and show main window + PIMainWindow mainWindow(&engine, loader, &app); + mainWindow.show(); + + return app.exec(); +} + +QObject *PIProfilerDocumentLoader::createObject(const QString& type, const QString &name) +{ + // Main view + if (type == PIMainView::staticMetaObject.className()) { + QObject *object = new PIMainView; + object->setObjectName(name); + return object; + } + + return HbDocumentLoader::createObject(type, name); +} + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/notifications.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/notifications.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,73 @@ +/* +* 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 "notifications.h" + +// --------------------------------------------------------------------------- + +void Notifications::showInformationNote(const QString &text) +{ + + // Create new dialog + HbDialog *infoNote = new HbDialog(); + infoNote->setAttribute(Qt::WA_DeleteOnClose); + + // set dismiss policy + infoNote->setTimeout(0); // + + // create text item for popup + HbTextItem *label = new HbTextItem(text, infoNote); + label->setAlignment(Qt::AlignCenter); + infoNote->setContentWidget(label); + infoNote->setPrimaryAction(new HbAction("Ok")); + + infoNote->show(); +} + +// --------------------------------------------------------------------------- + +void Notifications::showMessageBox(const QString &text) +{ + HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation ); + note->setAttribute(Qt::WA_DeleteOnClose); + note->setTimeout(0); + note->setText(text); + note->show(); + +} + +// --------------------------------------------------------------------------- + +void Notifications::showErrorNote(const QString &text) +{ + HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeWarning ); + note->setAttribute(Qt::WA_DeleteOnClose); + note->setTimeout(0); + note->setText(text); + note->show(); + +} + +// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/pimainview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/pimainview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,564 @@ +/* +* 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pimainview.h" +#include "piprofilerengine.h" +#include "notifications.h" +#include "pimainwindow.h" + +const char *INVALIDCONFIGURATIONFILE = "Invalid configuration file"; +const char *APPLICATIONNAME = "PI Profiler"; + +// actions that are found from xml +const char *ACTIONEXIT = "actionExit"; +const char *ACTIONSTARTPROFILING = "actionStartProfiling"; +const char *ACTIONSTARTTIMEDPROFILING = "actionStartTimedProfiling"; +const char *ACTIONSETTINGS = "actionSettings"; +const char *ACTIONABOUT = "actionAbout"; + +// UI components that are found from xml + +const char *LISTWIDGETPLUGINS = "listPlugins"; +const char *TEXTMANDATORYPLUGINS = "Mandatory plug-ins:"; +const char *TEXTOPTIONALPLUGINS = "Optional plug-ins:"; + +// --------------------------------------------------------------------------- + +PIMainView::PIMainView() : + application(0), mMainWindow(0), mEngine(0), mPluginList(0), mContextMenu(0), mActionExit(0), + mActionExitAndLeaveProfilingOn(0), mActionAbout(0), mActionStartTimedProfiling(0), + mActionSettings(0), mActionStopProfiling(0), mListPlugins(0), mProfilingNote(0) +{ + +} + +// --------------------------------------------------------------------------- + +PIMainView::~PIMainView() +{ +} + +// --------------------------------------------------------------------------- + +void PIMainView::init(PIMainWindow *mainWindow, HbApplication* app, HbDocumentLoader &loader, + PIProfilerEngine *engine) +{ + + application = app; + mMainWindow = mainWindow; + + // Load items from xml file + loadItemsFromResources(loader); + + // Set list widget items + mListPlugins->setClampingStyle(HbScrollArea::BounceBackClamping); + mListPlugins->setFrictionEnabled(true); + + // Create stop profiling action + mActionStopProfiling = new HbAction("Stop Profiling", this); + + // Create exit and leave profiling on action + mActionExitAndLeaveProfilingOn = new HbAction("Close UI\n(Continue profiling)", this); + + mEngine = engine; + + // Connect signals and slots + this->connectSignalsAndSlots(app); + + // Create icons + mIconDisabled = HbIcon(":/gfx/disabled.svg"); + mIconEnabled = HbIcon(":/gfx/enabled.svg"); + + // update timed profiling text according to settings + updateTimedProfilingText(); +} + +// --------------------------------------------------------------------------- + + +void PIMainView::connectSignalsAndSlots(HbApplication* app) +{ + + // Menu items: + connect(mActionExit, SIGNAL(triggered()), app, SLOT( quit() )); + connect(mActionSettings, SIGNAL(triggered()), this, SLOT( openSettingsView() )); + connect(mActionAbout, SIGNAL(triggered()), this, SLOT( showAboutPopup() )); + connect(mActionStartProfiling, SIGNAL(triggered()), this, SLOT( startProfiling() )); + connect(mActionStartTimedProfiling, SIGNAL(triggered()), this, SLOT( startTimedProfiling() )); + + // List widget actions + connect(mListPlugins, SIGNAL(activated(HbListWidgetItem*)), this, + SLOT(enableOrDisablePlugin(HbListWidgetItem*))); + connect(mListPlugins, SIGNAL(longPressed(HbListWidgetItem*, QPointF)), this, + SLOT(showContexMenu(HbListWidgetItem*, QPointF))); + + connect( + mEngine, + SIGNAL(profilingStatusChanged(ProfilerEngineStatus, const QString&, ProfilingMode, ProfilingOutput)), + this, + SLOT(profilingStatusChanged(ProfilerEngineStatus, const QString&, ProfilingMode, ProfilingOutput))); + + connect(mMainWindow, SIGNAL(returnedFromSettings()), this, SLOT( updateTimedProfilingText() )); + connect(mActionExitAndLeaveProfilingOn, SIGNAL(triggered()), this, + SLOT( exitAndLeaveProfilingOn() )); + connect(mActionStopProfiling, SIGNAL(triggered()), this, SLOT( stopProfiling() )); + +} + +// --------------------------------------------------------------------------- + + +void PIMainView::loadItemsFromResources(HbDocumentLoader &loader) +{ + + // ACTIONS: + + // Exit + QObject *object = loader.findObject(ACTIONEXIT); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionExit = qobject_cast (object); + + // About + object = loader.findObject(ACTIONABOUT); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionAbout = qobject_cast (object); + + // Settings + object = loader.findObject(ACTIONSETTINGS); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionSettings = qobject_cast (object); + + // Start profiling + object = loader.findObject(ACTIONSTARTPROFILING); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionStartProfiling = qobject_cast (object); + + // Start timed profiling + object = loader.findObject(ACTIONSTARTTIMEDPROFILING); + Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); + this->mActionStartTimedProfiling = qobject_cast (object); + + QGraphicsWidget *widget = loader.findWidget(LISTWIDGETPLUGINS); + Q_ASSERT_X((widget != 0), "Launcher", "Invalid launcher.xml file"); + this->mListPlugins = qobject_cast (widget); +} + +// --------------------------------------------------------------------------- + +void PIMainView::showAboutPopup() +{ + + Notifications::showMessageBox("Version 2.2.1 - 10th August 2010. \n" + "Copyright © 2010 Nokia Corporation " + "and/or its subsidiary(-ies). " + "All rights reserved."); + +} +// --------------------------------------------------------------------------- + +void PIMainView::setPluginList(QList *pluginList) +{ + + this->mPluginList = pluginList; + this->updatePlugInLists(); + +} + +// --------------------------------------------------------------------------- + +void PIMainView::openSettingsView() +{ + mMainWindow->activateSettingsView(); +} + +// --------------------------------------------------------------------------- + +void PIMainView::updatePlugInLists() +{ + + mListPlugins->clear(); + + // Create Compulsory and Optional labels into list widget: + HbListWidgetItem *compulsory = new HbListWidgetItem(); + compulsory->setText(TEXTMANDATORYPLUGINS); + mListPlugins->addItem(compulsory); + + HbListWidgetItem *optional = new HbListWidgetItem(); + optional->setText(TEXTOPTIONALPLUGINS); + mListPlugins->addItem(optional); + + HbIcon *icon; + + // Go thru pluginlist and add list item for each plug-in into list widget + for (int index = 0; index < mPluginList->size(); index++) { + QString plugInName = mPluginList->at(index).mName; + + // get icon for item + if (mPluginList->at(index).mEnabled) { + icon = &mIconEnabled; + } + else { + icon = &mIconDisabled; + } + + // Create list widget item + // TODO ensure that this does not leak memory + HbListWidgetItem *newItem = new HbListWidgetItem(); + newItem->setIcon(*icon); + newItem->setText(plugInName); + newItem->setData(mPluginList->at(index).mUid); + + // check if plug-in is compulsory or optional + if (mPluginList->at(index).mIsHidden) { + mListPlugins->insertItem(mListPlugins->row(optional), newItem); + } + else { + mListPlugins->addItem(newItem); + + } + } + +} +// --------------------------------------------------------------------------- + +void PIMainView::enableOrDisablePlugin(HbListWidgetItem *widget) +{ + + // if widget is not found, set currently highlighted item as widget + // (in that case this method is called from context menu) + if (widget == 0) { + widget = mListPlugins->currentItem(); + } + + // if this method is called from list widget's activated signal, do nothing + // if context menu is open. + else { + if (mContextMenu != 0) { + return; + } + } + bool ok = false; + int widgetUid = widget->data().toInt(&ok); + if (!ok) { + qWarning("PIProfiler: Unable to find plug-in uid"); + return; + } + + // go thru plug-in array and find checked plug-in + for (int index = 0; index < mPluginList->size(); index++) { + + if (mPluginList->at(index).mUid == widgetUid) { + PluginAttributes pluginAttributes = mPluginList->at(index); + + // if plug-in is hidden it cannot be disabled + if (pluginAttributes.mIsHidden) { + return; + } + + // change enable status and set icon correct + if (pluginAttributes.mEnabled) { + pluginAttributes.mEnabled = false; + widget->setIcon(mIconDisabled); + } + else { + pluginAttributes.mEnabled = true; + widget->setIcon(mIconEnabled); + } + + // save plug-in settings + if (mEngine->savePluginSettings(pluginAttributes)) { + mPluginList->replace(index, pluginAttributes); + } + else { + // if saving operation failed, revert icon back + if (pluginAttributes.mEnabled) { + widget->setIcon(mIconEnabled); + } + else { + pluginAttributes.mEnabled = true; + widget->setIcon(mIconDisabled); + } + Notifications::showErrorNote( + "Error occured while saving settings to Profiler engine."); + } + break; + } + + } + +} + +// --------------------------------------------------------------------------- + +void PIMainView::showContexMenu(HbListWidgetItem *widget, const QPointF &point) +{ + + bool ok = false; + int uid = widget->data().toInt(&ok); + + if (!ok) { + return; + } + + for (int index = 0; index < mPluginList->size(); index++) { + + if (mPluginList->at(index).mUid == uid) { + + // Create Context menu: + mContextMenu = new HbMenu(); + mContextMenu->setPreferredPos(point, HbPopup::TopLeftCorner); + mContextMenu->setDismissPolicy(HbPopup::TapOutside); + mContextMenu->setAttribute(Qt::WA_DeleteOnClose); + + // Enable/disable plug-in + if (!mPluginList->at(index).mIsHidden) { + HbAction *enableAction; + if (mPluginList->at(index).mEnabled) { + enableAction = mContextMenu->addAction(QString("Disable")); + } + else { + enableAction = mContextMenu->addAction(QString("Enable")); + } + connect(enableAction, SIGNAL(triggered()), this, SLOT( enableOrDisablePlugin() )); + } + + //FIXME take these into use once expanding and collapsing data form groups works. + // Plug-in specific settings + /*if (mPluginList->at(index).mItemCount != 0 || mPluginList->at(index).mSampleRate != -1) { + HbAction *pluginSettingsAction = mContextMenu->addAction(QString( + "Plug-in settings")); + connect(pluginSettingsAction, SIGNAL(triggered()), this, + SLOT(openPluginSpecificSettings())); + }*/ + + // Plug in info + HbAction *infoAction = mContextMenu->addAction(QString("Plug-in info")); + connect(infoAction, SIGNAL(triggered()), this, SLOT( openSampleInfo() )); + + connect(mContextMenu, SIGNAL(aboutToClose()), this, SLOT( contextMenuClosed() )); + mContextMenu->open(this, SLOT(contextMenuClosed())); + break; + } + } + +} + +// --------------------------------------------------------------------------- + +void PIMainView::openSampleInfo() +{ + + // Show plug-in specific info + bool ok = false; + int uid = mListPlugins->currentItem()->data().toInt(&ok); + if (!ok) { + return; + } + Notifications::showInformationNote(this->getPluginAttributes(uid).mDescription); +} +// --------------------------------------------------------------------------- + +PluginAttributes PIMainView::getPluginAttributes(int uid) +{ + // Get plug-in attributes from the plug-in list based on uid number + for (int index = 0; index < mPluginList->size(); index++) { + if (mPluginList->at(index).mUid == uid) { + return mPluginList->at(index); + } + } + return PluginAttributes(); +} + +// --------------------------------------------------------------------------- + +void PIMainView::contextMenuClosed() +{ + mContextMenu = 0; +} + +// --------------------------------------------------------------------------- + +void PIMainView::startProfiling() +{ + + showProfilingNote(); + if (!mEngine->startProfiling()) { + Notifications::showErrorNote("Unable to start profiling"); + mProfilingNote->close(); + mProfilingNote = 0; + } +} + +// --------------------------------------------------------------------------- +void PIMainView::startTimedProfiling() +{ + showProfilingNote(); + if (!mEngine->startTimedProfiling()) { + Notifications::showErrorNote("Unable to start profiling"); + mProfilingNote->close(); + mProfilingNote = 0; + } +} + +// --------------------------------------------------------------------------- + + +void PIMainView::stopProfiling() +{ + mProfilingNote = 0; + mEngine->stopProfiling(); +} + +// --------------------------------------------------------------------------- + +void PIMainView::profilingStatusChanged(ProfilerEngineStatus status, const QString &text, + ProfilingMode profilingMode, ProfilingOutput outputMode) +{ + + if (status == PI_FINISHED_SUCCEFULLY) { + // Profiling finished successfully + + // close profiling note + if (mProfilingNote != 0) { + mProfilingNote->close(); + mProfilingNote = 0; + } + + // Show info text + Notifications::showInformationNote(text); + return; + } + + if (mProfilingNote == 0) { + // if profiling note is not yet shown, create it + showProfilingNote(); + } + + if (status == PI_ERROR) { + // if errors occured, close profiling note and show error message + if (mProfilingNote != 0) { + mProfilingNote->close(); + mProfilingNote = 0; + } + Notifications::showErrorNote(text); + } + + else if (status == PI_PROFILING) { + // if profiling is on-going, update info text according to output: + + HbLabel *titleLabel = new HbLabel("Profiling...", mProfilingNote); + titleLabel->setAlignment(Qt::AlignCenter); + + HbTextItem *textItem = new HbTextItem(text, mProfilingNote); + textItem->setAlignment(Qt::AlignCenter); + + mProfilingNote->setHeadingWidget(titleLabel); + mProfilingNote->setContentWidget(textItem); + } + +} + +// --------------------------------------------------------------------------- + +void PIMainView::showProfilingNote() +{ + // Create new dialog + mProfilingNote = new HbDialog(); + mProfilingNote->setAttribute(Qt::WA_DeleteOnClose); + + // Make it modal. + mProfilingNote->setModal(true); + + // set dismiss policy + mProfilingNote->setDismissPolicy(HbPopup::NoDismiss); + mProfilingNote->setTimeout(0); // + mProfilingNote->setBackgroundFaded(true); + + // create label and text item for popup + HbTextItem *titleLabel = new HbTextItem("Profiling...", mProfilingNote); + HbTextItem *label = new HbTextItem("Starting to profile", mProfilingNote); + + label->setAlignment(Qt::AlignCenter); + titleLabel->setAlignment(Qt::AlignCenter); + mProfilingNote->setHeadingWidget(titleLabel); + mProfilingNote->setContentWidget(label); + + // set actions + mProfilingNote->setPrimaryAction(mActionStopProfiling); + mProfilingNote->setSecondaryAction(mActionExitAndLeaveProfilingOn); + + mProfilingNote->open(); +} + +// --------------------------------------------------------------------------- + +void PIMainView::updateTimedProfilingText() +{ + QString text = "Start timed profiling("; + QString number; + number.setNum(mEngine->getTimeLimit(), 10); + text.append(number); + text.append("s)"); + mActionStartTimedProfiling->setText(text); + +} + +// --------------------------------------------------------------------------- + +void PIMainView::exitAndLeaveProfilingOn() +{ + mEngine->leaveProfilingOnAfterClosing(); + application->quit(); +} +// --------------------------------------------------------------------------- + +void PIMainView::openPluginSpecificSettings() +{ + HbListWidgetItem *listItem = mListPlugins->currentItem(); + bool ok = false; + int uid = listItem->data().toInt(&ok); + if (ok) { + mMainWindow->activateSettingsView(uid); + } +} + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/pimainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/pimainwindow.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,160 @@ +/* +* 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: +* +*/ + + +// System include +#include +#include +#include +#include +#include +#include + +// User includes +#include "pimainwindow.h" +//#include "mcsendengine.h" +#include "pimainview.h" +#include "pisettingsview.h" +#include "generalattributes.h" +#include "piprofilerengine.h" +#include "notifications.h" + +// xml definition of view +const char *PI_MAINVIEW_XML = ":/xml/pimainview.docml"; + +// name of the application view object in the xml file. +const char *APPLICATIONVIEW = "PIMainView"; + +// ViewManager Constructor +PIMainWindow::PIMainWindow(PIProfilerEngine* engine, HbDocumentLoader &loader, HbApplication *app) : + mEngine(engine), mMainView(0), mSettingsView(0), mBackAction(0) +{ + + HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::WaitDialog); + note->setAttribute(Qt::WA_DeleteOnClose); + note->setText("Loading PI Profiler plug-ins..."); + note->open(); + + // Add the views to the main window + addMainView(loader, app); + addSettingsView(); + + // Set main view to be displayed on startup + activateMainView(); + + connect(mEngine, SIGNAL(pluginListUpdated(QList&)), this, + SLOT(setPluginList(QList&))); + + QMetaObject::connectSlotsByName(this); + + mEngine->notifyUIReady(); + + note->close(); + +} + +PIMainWindow::~PIMainWindow() +{ + if (mMainView != 0) { + delete mMainView; + mMainView = 0; + } + if (mSettingsView != 0) { + delete mSettingsView; + mSettingsView = 0; + } + +} + +// Methods to add views to the main window + +void PIMainWindow::addMainView(HbDocumentLoader &loader, HbApplication *app) +{ + // Load xml-file + bool ok = false; + loader.load(PI_MAINVIEW_XML, &ok); + + // Load Application View: + QGraphicsWidget *widget = loader.findWidget(APPLICATIONVIEW); + Q_ASSERT_X(ok && (widget != 0), "PIProfiler", "Invalid docml file"); + mMainView = qobject_cast (widget); + + mMainView->init(this, app, loader, mEngine); + + // Add view to main window + this->addView(mMainView); + +} + +void PIMainWindow::addSettingsView() +{ + mSettingsView = new PISettingsView(mEngine); + mBackAction = new HbAction("back", this); + + bool value = connect(mBackAction, SIGNAL(triggered()), this, SLOT(settingsViewClosed())); + mSettingsView->setNavigationAction(mBackAction); + mSettingsView->navigationAction()->setIcon(HbIcon(":/gfx/enabled.svg")); + addView(mSettingsView); +} + +// Slots to handle view change +void PIMainWindow::activateMainView() +{ + setCurrentView(mMainView); +} + +void PIMainWindow::activateSettingsView(int uid) +{ + if (uid != 0) { + mSettingsView->expandPluginGroup(uid); + } + setCurrentView(mSettingsView); +} + +void PIMainWindow::settingsViewClosed() +{ + if (currentView() == mSettingsView) { + bool error = false; + if (!mEngine->saveGeneralSettings(mSettingsView->getGeneralAttributes())) { + error = true; + } + + mSettingsView->readPluginSettings(); + + for (int index = 0; index < mPluginAttributes.size(); index++) { + if (!mEngine->savePluginSettings(mPluginAttributes.at(index))) { + error = true; + } + } + + if (error) { + Notifications::showErrorNote("Unable to save some of the settings into engine"); + } + activateMainView(); + emit returnedFromSettings(); + } + else { + qWarning("Back action is not triggered at the correct view!"); + } +} + +void PIMainWindow::setPluginList(QList &pluginList) +{ + mPluginAttributes = pluginList; + mMainView->setPluginList(&mPluginAttributes); + mSettingsView->setPluginSettings(&mPluginAttributes); +} diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/piprofilerengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/piprofilerengine.cpp Fri Sep 03 17:11:21 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: +* +*/ + + +#include "piprofilerengine.h" +#include "piprofilerengineprivate.h" + +PIProfilerEngine::PIProfilerEngine() +{ + +} + +PIProfilerEngine::~PIProfilerEngine() +{ + if (mPrivate != 0) { + delete mPrivate; + mPrivate = 0; + } +} + +bool PIProfilerEngine::init() +{ + mPrivate = new PIProfilerEnginePrivate(this); + return mPrivate->Init(); +} + +void PIProfilerEngine::getGeneralSettings(GeneralAttributes &settings) +{ + mPrivate->GetGeneralSettings(settings); +} + +void PIProfilerEngine::notifyUIReady() +{ + mPrivate->NotifyUIReady(); +} + +bool PIProfilerEngine::saveGeneralSettings(GeneralAttributes &settings) +{ + return mPrivate->SaveGeneralSettings(settings); + +} + +bool PIProfilerEngine::savePluginSettings(const PluginAttributes &pluginAttributes) +{ + return mPrivate->SavePluginSettings(pluginAttributes); +} + +bool PIProfilerEngine::startProfiling() +{ + return mPrivate->StartProfiling(); +} +bool PIProfilerEngine::startTimedProfiling() +{ + return mPrivate->StartTimedProfiling(); +} +void PIProfilerEngine::stopProfiling() +{ + return mPrivate->StopProfiling(); +} + +int PIProfilerEngine::getTimeLimit() +{ + return mPrivate->GetTimeLimit(); +} + +void PIProfilerEngine::leaveProfilingOnAfterClosing() +{ + mPrivate->LeaveProfilingOnAfterClosing(); +} + +bool PIProfilerEngine::checkTraceLocationSanity(QString &location) +{ + mPrivate->CheckTraceLocationSanity(location); +} diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,678 @@ +/* +* 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 +#include +#include "piprofilerengineprivate.h" +#include +#include "pluginattributes.h" +#include "generalattributes.h" +#include "piprofilerengine.h" + +// literals for default general setting values +_LIT8(KTraceOutput, "file_system"); +_LIT8(KTraceDebugOutput, "debug_output"); +_LIT8(KProfilerDefaultDrive, "E:\\data"); +_LIT8(KProfilerDefaultPrefix, "Profiler_#"); +_LIT(KProfilerEngineExe, "PIProfilerEngine.exe"); +const TInt KProfilerDefaultTimedSamplingPeriod = 60; // Sampling time in seconds + +// --------------------------------------------------------------------------- + +PIProfilerEnginePrivate::PIProfilerEnginePrivate(PIProfilerEngine *aEngine) : + iPublic(aEngine), iSamplerAttributes(0), iStatusChecker(0), iLeaveProfilingOnAfterClosing( + EFalse) +{ + +} + +// --------------------------------------------------------------------------- + +PIProfilerEnginePrivate::~PIProfilerEnginePrivate() +{ + + // remove profiler client + RProfiler::RemoveClient(); + // Terminate engine in case it is running. + if (iLeaveProfilingOnAfterClosing == EFalse) { + terminateEngine(); + } + + // delete sampler attributes. + if (iSamplerAttributes) { + delete iSamplerAttributes; + iSamplerAttributes = 0; + } + + if (iStatusChecker) { + iStatusChecker->Cancel(); + delete iStatusChecker; + iStatusChecker = NULL; + } +} + +// --------------------------------------------------------------------------- + +bool PIProfilerEnginePrivate::Init() +{ + TRAPD(error, this->LaunchEngineL()); + if (error != KErrNone) { + return false; + } + + // initialize attribute arrays + + TRAP(error, iSamplerAttributes = new (ELeave) CArrayFixFlat (20)); // max sampler count is 20 + if (error != KErrNone) { + return false; + } + + // engine status checker + TRAP(error, iStatusChecker = CProfilerEngineStatusChecker::NewL()); + if (error != KErrNone) { + return false; + } + + iStatusChecker->SetObserver(this); + + TRAP(error, LoadGeneralSettingsL()); + if (error != KErrNone) { + return false; + } + + return true; +} + +// --------------------------------------------------------------------------- + + +int PIProfilerEnginePrivate::LaunchEngineL() +{ + + TRequestStatus stat = KRequestPending; + RProcess proc; + + TInt err(KErrNone); + + // check if process exists + err = FindProcessL(proc); + + // check if already exists and don't start a new eshell profiling + if (err == KErrNotFound) { + // try create new process + err = proc.Create(KProfilerEngineExe, _L("")); + + // check if RProcess::Create() succeeded + if (err == KErrNone) { + // Trigger rendezvous on the supplied TRequestStatus object + proc.Rendezvous(stat); + + // kick off the engine process + proc.Resume(); + + // wait for the constructor to complete + User::WaitForRequest(stat); + + // just lose the handle + proc.Close(); + } + } + + // Increase the client reference count in server: + AttachClient(); +} + +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::AttachClient() +{ + RProfiler::AttachClient(); +} +// --------------------------------------------------------------------------- + +int PIProfilerEnginePrivate::FindProcessL(RProcess& aProc) +{ + TProcessId engId; + TFindProcess procName; + procName.Find(_L("PIProfilerEngine.exe*")); + TFullName aResult; + TFullName aResult2; + TInt err(KErrNone); + + // find the first appearance + err = procName.Next(aResult); + if (err != KErrNone) { + // did not find any engine process + return err; + } + else { + err = aProc.Open(procName); + if (err == KErrNone) { + if (aProc.ExitCategory().Length() > 0) { + aProc.Close(); + // process already exited => create a new one + return KErrNotFound; + } + aProc.Close(); + } + } + + // 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); + + // check if aResult2 contained the second appearance of profiler engine + if(aResult2.CompareF(aResult) > 0) + { + // other process found, i.e. right process to communicate with, in case started from eshell + err = aProc.Open(procName); + if(err == KErrNone) + { + if(aProc.ExitCategory().Length() > 0) + { + // process already exited => create a new one + return KErrNotFound; + } + aProc.Close(); + } + } + + return err; +} + +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::terminateEngine() +{ + // exit profiler engine + RProfiler::ExitProfiler(); +} +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::NotifyUIReady() +{ + // load initial plugins + loadPlugins(); + + // get the initial state + int initialState = iStatusChecker->GetInitialState(); + if (initialState == ERunning) { + HandleProfilerStatusChange(ERunning); + } +} + +// --------------------------------------------------------------------------- + + +void PIProfilerEnginePrivate::loadPlugins() +{ + // get samplers from Profiler Engine (client-server session) + // and add the to the samplers list for the first time + LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - get sampler plugins")); + + TInt err = RProfiler::GetSamplerAttributes(*iSamplerAttributes); + + // check if engine provided a list of samplers + if (err != KErrNone) { + // could not get samplers from engine + LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - failed to connect engine")); + } + else { + LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - adding new samplers into view")); + addNewSamplers(*iSamplerAttributes); + }LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - exit")); +} +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::addNewSamplers(CArrayFixFlat& aAttributes) +{ + TSamplerAttributes item; + + TInt count(aAttributes.Count()); + + // loop the attribute array and insert them into view list + + QList samplerList; + + for (TInt i(0); i < count; i++) { + // get a TSamplerAttributes from list at a time + item = aAttributes.At(i); + + PluginAttributes samplerAttributes; + convertTSamplerAttributesToPluginAttributes(item, samplerAttributes); + + samplerList.append(samplerAttributes); + } + + emit iPublic->pluginListUpdated(samplerList); + +} + +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::convertTSamplerAttributesToPluginAttributes( + TSamplerAttributes &tSamplerAttributes, PluginAttributes &samplerAttributes) +{ + + samplerAttributes.mUid = tSamplerAttributes.iUid; + samplerAttributes.mSampleRate = tSamplerAttributes.iSampleRate; + samplerAttributes.mEnabled = tSamplerAttributes.iEnabled; + samplerAttributes.mIsHidden = tSamplerAttributes.iIsHidden; + samplerAttributes.mItemCount = tSamplerAttributes.iItemCount; + + TBuf16<8> temp8; + temp8.Copy(tSamplerAttributes.iShortName); + samplerAttributes.mShortName = QString((QChar*) temp8.Ptr(), temp8.Length()); + + TBuf16<64> temp64; + temp64.Copy(tSamplerAttributes.iName); + samplerAttributes.mName = QString((QChar*) temp64.Ptr(), temp64.Length()); + + TBuf16<256> temp256; + temp256.Copy(tSamplerAttributes.iDescription); + samplerAttributes.mDescription = QString((QChar*) temp256.Ptr(), temp256.Length()); + + convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem1, + samplerAttributes.mSettingItem1); + convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem2, + samplerAttributes.mSettingItem2); + convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem3, + samplerAttributes.mSettingItem3); + convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem4, + samplerAttributes.mSettingItem4); + convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem5, + samplerAttributes.mSettingItem5); + convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem6, + samplerAttributes.mSettingItem6); +} + +// --------------------------------------------------------------------------- + +bool PIProfilerEnginePrivate::SavePluginSettings(const PluginAttributes &samplerAttributes) +{ + for (int index = 0; index < iSamplerAttributes->Count(); index++) { + if (samplerAttributes.mUid == this->iSamplerAttributes->At(index).iUid) { + iSamplerAttributes->At(index).iEnabled = samplerAttributes.mEnabled; + iSamplerAttributes->At(index).iSampleRate = samplerAttributes.mSampleRate; + + convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem1, + samplerAttributes.mSettingItem1); + convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem2, + samplerAttributes.mSettingItem2); + convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem3, + samplerAttributes.mSettingItem3); + convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem4, + samplerAttributes.mSettingItem4); + convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem5, + samplerAttributes.mSettingItem5); + convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem6, + samplerAttributes.mSettingItem6); + + TSamplerAttributes attr = iSamplerAttributes->At(index); + + if (RProfiler::SetSamplerAttributes(this->iSamplerAttributes->At(index)) == KErrNone) { + return true; + } + else { + return false; + } + } + } + return false; + +} + +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::StartAllSamplerItemsL(TProfilingMode aProfilingMode) +{ + TBuf<256> activeWriterDes; + TBuf8<256> writer8; + + //iState = MProfilerStatusObserver::EInitializing; + + RProfiler::TProfilingMode profilingMode = aProfilingMode == EProfilingModeTimed + ? RProfiler::EProfilingModeTimed : RProfiler::EProfilingModeNormal; + + // try to start profiling process through client-server interface + if (RProfiler::StartSampling(profilingMode) == KErrNotFound) { + // profiler stopped (e.g. from eshell) and must be restarted + LaunchEngineL(); + // try to launch sampling again + RProfiler::StartSampling(profilingMode); + } +} + +// --------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::StopProfiling() +{ + // Stop profiling process through CS session + RProfiler::StopSampling(); + +} + +// -------------------------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::HandleProfilerStatusChange(KProfilerStatus aStatus) +{ + if (aStatus == EIdle || aStatus == ERunning) { + + if (iGeneralAttributes.iTraceOutput == KTraceOutput) { + + TBuf<256> buf; + // get profiler file name + TBool valu = RProfiler::GetFileName(buf); + + QString filename = QString((QChar*) buf.Ptr(), buf.Length()); + + // Let ui know that status has changed + + if (aStatus == EIdle) { + QString text = QString("Wrote trace data to: \n"); + text.append(filename); + emit iPublic->profilingStatusChanged(PI_FINISHED_SUCCEFULLY, text, + PI_PROFILINGMODENORMAL, PI_FILE_OUTPUT); + } + else if (aStatus == ERunning) { + QString text = QString("Writing trace data to: \n"); + text.append(filename); + emit iPublic->profilingStatusChanged(PI_PROFILING, text, PI_PROFILINGMODENORMAL, + PI_FILE_OUTPUT); + } + } + else { + // Let ui know that status has changed + if (aStatus == EIdle) { + emit iPublic->profilingStatusChanged(PI_FINISHED_SUCCEFULLY, QString( + "Wrote trace data to debug output"), PI_PROFILINGMODENORMAL, PI_DEBUG_OUTPUT); + } + else if (aStatus == ERunning) { + emit iPublic->profilingStatusChanged(PI_PROFILING, QString( + "Writing trace data to debug output"), PI_PROFILINGMODENORMAL, PI_DEBUG_OUTPUT); + } + } + } + +} + +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::HandleProfilerErrorL(TInt aError) +{ + { + QString errorMsg = QString("Error: "); + QString KNoMemory = QString("Cannot write to file, check settings"); + + // message from pwr sampler + if (aError < -1000) { + errorMsg.append(QString("Stop other power measurement tools!")); + } + else if (aError == KErrAlreadyExists || aError == 11) { + errorMsg.append(QString("Close old Profiler before start!")); + } + else if (aError == KErrNotReady) { + errorMsg.append(QString("Memory card removed, failed to write!")); + } + else if (aError == KErrPathNotFound) { + errorMsg.append(QString("Given trace data location does not exist")); + } + else { + if (aError == KErrNoMemory || aError == KErrOverflow || aError == KErrDirFull || aError + == KErrDiskFull || aError == KErrNotReady) { + errorMsg.append(KNoMemory); + } + else { + errorMsg.append(QString("code: ")); + errorMsg.append(aError); + } + } + + emit iPublic->profilingStatusChanged(PI_ERROR, errorMsg); + } + +} +// --------------------------------------------------------------------------- + +bool PIProfilerEnginePrivate::StartProfiling() +{ + TRAPD(error, this->StartAllSamplerItemsL(PIProfilerEnginePrivate::EProfilingModeNormal)); + if (error == KErrNone) { + return true; + } + return false; + +} + +// --------------------------------------------------------------------------- + +bool PIProfilerEnginePrivate::StartTimedProfiling() +{ + TRAPD(error, this->StartAllSamplerItemsL(PIProfilerEnginePrivate::EProfilingModeTimed)); + if (error == KErrNone) { + return true; + } + return false; +} + +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::convertTGeneralAttributesToGeneralAttributes( + TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes) +{ + samplerAttributes.mTimedSamplingPeriod = tSamplerAttributes.iTimedSamplingPeriod; + int test = tSamplerAttributes.iSaveFileDrive.Length(); + TBuf16 test2; + test2.Copy(tSamplerAttributes.iSaveFileDrive); + samplerAttributes.mSaveFileDrive = QString((QChar*) test2.Ptr(), test2.Length()); + test2.Copy(tSamplerAttributes.iTraceFilePrefix); + samplerAttributes.mTraceFilePrefix = QString((QChar*) test2.Ptr(), test2.Length()); + test2.Copy(tSamplerAttributes.iTraceOutput); + samplerAttributes.mTraceOutput = QString((QChar*) test2.Ptr(), test2.Length()); +} +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::convertGeneralAttributesToTGeneralAttributes( + TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes) +{ + tSamplerAttributes.iTimedSamplingPeriod = samplerAttributes.mTimedSamplingPeriod; + + tSamplerAttributes.iTraceOutput.Copy(TBuf ( + samplerAttributes.mTraceOutput.utf16())); + tSamplerAttributes.iSaveFileDrive.Copy(TBuf ( + samplerAttributes.mSaveFileDrive.utf16())); + tSamplerAttributes.iTraceFilePrefix.Copy(TBuf ( + samplerAttributes.mTraceFilePrefix.utf16())); + +} +// --------------------------------------------------------------------------- + +TInt PIProfilerEnginePrivate::LoadGeneralSettingsL() +{ + // local variable for getting saved settings from profiler engine + TGeneralAttributes generalAttr; + TInt err(KErrNone); + + // before loading saved settings (from settings file) set the default values + iGeneralAttributes.iTraceOutput.Copy(KTraceOutput); + iGeneralAttributes.iTraceFilePrefix.Copy(KProfilerDefaultPrefix); + iGeneralAttributes.iSaveFileDrive.Copy(KProfilerDefaultDrive); + iGeneralAttributes.iTimedSamplingPeriod = KProfilerDefaultTimedSamplingPeriod; + + // request to + err = RProfiler::GetGeneralAttributes(generalAttr); + + // check that request succesfull + if (err != KErrNone) { + // could not connect profiler engine, use + return err; + } + + // check if saved settings different than the default + if (generalAttr.iTraceOutput.MatchF(iGeneralAttributes.iTraceOutput) == KErrNotFound) { + iGeneralAttributes.iTraceOutput.Copy(generalAttr.iTraceOutput); + } + + if (generalAttr.iTraceFilePrefix.MatchF(iGeneralAttributes.iTraceFilePrefix) == KErrNotFound) { + iGeneralAttributes.iTraceFilePrefix.Copy(generalAttr.iTraceFilePrefix); + } + + if (generalAttr.iSaveFileDrive.MatchF(iGeneralAttributes.iSaveFileDrive) == KErrNotFound) { + iGeneralAttributes.iSaveFileDrive.Copy(generalAttr.iSaveFileDrive); + } + + if (generalAttr.iTimedSamplingPeriod > 0) { + iGeneralAttributes.iTimedSamplingPeriod = generalAttr.iTimedSamplingPeriod; + } + + return err; +} + +// --------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::GetGeneralSettings(GeneralAttributes &settings) +{ + convertTGeneralAttributesToGeneralAttributes(iGeneralAttributes, settings); +} +// --------------------------------------------------------------------------- + +bool PIProfilerEnginePrivate::SaveGeneralSettings(GeneralAttributes &settings) +{ + convertGeneralAttributesToTGeneralAttributes(iGeneralAttributes, settings); + TRAPD(error, SaveGeneralSettingsL()); + if (error != KErrNone) { + return false; + } + return true; +} + +// --------------------------------------------------------------------------- + +// -------------------------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::SaveGeneralSettingsL() +{ + TInt err(KErrNone); + + // save general attributes to Profiler Engine + err = RProfiler::SetGeneralAttributes(iGeneralAttributes); + + // check if save failed + if (err == KErrNotFound) { + // profiler stopped (e.g. from eshell) and must be restarted + LaunchEngineL(); + + err = RProfiler::SetGeneralAttributes(iGeneralAttributes); + if (err != KErrNone) { + // leave no use to continue + User::Leave(err); + } + } +} +// -------------------------------------------------------------------------------------------- + +int PIProfilerEnginePrivate::GetTimeLimit() +{ + return iGeneralAttributes.iTimedSamplingPeriod; +} + +// -------------------------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::convertTSettingItemToSettingItem(TSettingItem &tSettingItem, + SettingItem &settingItem) +{ + + settingItem.mType = tSettingItem.iType; + settingItem.mSettingDescription = QString((QChar*) tSettingItem.iSettingDescription.Ptr(), + tSettingItem.iSettingDescription.Length()); + settingItem.mSettingText = QString((QChar*) tSettingItem.iSettingText.Ptr(), + tSettingItem.iSettingText.Length()); + settingItem.mUIText = QString((QChar*) tSettingItem.iUIText.Ptr(), + tSettingItem.iUIText.Length()); + settingItem.mValue = QString((QChar*) tSettingItem.iValue.Ptr(), tSettingItem.iValue.Length()); + +} +// -------------------------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::convertSettingItemToTSettingItem(TSettingItem &tSettingItem, + const SettingItem &settingItem) +{ + tSettingItem.iType = settingItem.mType; + tSettingItem.iSettingDescription.Copy(TBuf<256> (settingItem.mSettingDescription.utf16())); + tSettingItem.iSettingText.Copy(TBuf<64> (settingItem.mSettingText.utf16())); + tSettingItem.iUIText.Copy(TBuf<64> (settingItem.mUIText.utf16())); + tSettingItem.iValue.Copy(TBuf<128> (settingItem.mValue.utf16())); + +} + +// -------------------------------------------------------------------------------------------- + +void PIProfilerEnginePrivate::LeaveProfilingOnAfterClosing() +{ + iLeaveProfilingOnAfterClosing = ETrue; +} + +// -------------------------------------------------------------------------------------------- + +bool PIProfilerEnginePrivate::CheckTraceLocationSanity(QString& location) +{ + TBool value = EFalse; + + TBuf8 fileLocation; + fileLocation.Copy(TBuf (location.utf16())); + TRAPD(error, value = CheckTraceLocationSanityL(fileLocation)); + if (error != KErrNone) { + return false; + } + return value; +} + +// -------------------------------------------------------------------------------------------- + +TBool PIProfilerEnginePrivate::CheckTraceLocationSanityL(TBuf8 &aAttr) +{ + RFs fs; + User::LeaveIfError(fs.Connect()); + + TBuf<32> drive; + + CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aAttr); + + TDriveUnit driveUnit = TDriveUnit(drive); + + TBool ret(EFalse); + + // check that the root folder is correct + if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone) { + // check then if drive has still some space + if (!SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit)) { + ret = ETrue; + } + } + + fs.Close(); + return ret; +} diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/pisettingsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/pisettingsview.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,434 @@ +/* + * 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 +#include +#include +#include +#include +#include + +#include "pisettingsview.h" +#include "pimainview.h" +#include "notifications.h" +#include "piprofilerengine.h" +#include "pluginattributes.h" + +const QStringList OUTPUTMODES = (QStringList() << "Debug output" << "File system"); + +PISettingsView::PISettingsView(PIProfilerEngine *engine) : + mEngine(engine), mGeneralAttributes(), mPluginList(0), mSettingForm(0), mModel(0), + mGeneralSettingsGroup(0), mPluginSettingsGroup(0), mOutputItem(0), mFileLocation(0), + mPrefix(0), mSamplingPeriod(0) + +{ + this->setTitle("Settings"); + + //create setting form + mSettingForm = new HbDataForm(this); + + //create a model class + mModel = new HbDataFormModel(this); + + this->createGeneralSettingForms(); + + // Set created model model to form + mSettingForm->setModel(mModel); + + // Set widget into view + setWidget(mSettingForm); + + // load general settings into data form + loadGeneralSettings(); + + // Let us know when list is shown + connect(mSettingForm, SIGNAL(itemShown(const QModelIndex)), this, + SLOT(addTextValidators(const QModelIndex))); + + // Set general group as expanded. + /*HbDataFormViewItem *viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem( + mGeneralSettingsGroup)); + viewItem->setExpanded(true);*/ + +} + +// --------------------------------------------------------------------------- + +PISettingsView::~PISettingsView() +{ + if (mSettingForm != 0) { + delete mSettingForm; + mSettingForm = 0; + } + + if (mModel != 0) { + delete mModel; + mModel = 0; + } +} + +// --------------------------------------------------------------------------- + +void PISettingsView::addTextValidators(const QModelIndex index) +{ + HbDataFormModelItem *modelItem = mModel->itemFromIndex(index); + + // Check if item is integer text box + if (modelItem->contentWidgetData(QString("TextboxType")) == QString("integer")) { + + QString value = modelItem->contentWidgetData(QString("text")).toString(); + // Create validator that accepts only integer values. + HbValidator *validator = new HbValidator(this); + validator->addField(new QIntValidator(0, 10000, validator), "1"); + + // Line editor widget from form + HbDataFormViewItem *viewItem = qobject_cast (mSettingForm->itemByIndex(index)); + HbWidget *widget = viewItem->dataItemContentWidget(); + HbLineEdit *editor = static_cast (widget); + + if (editor != 0) { + // Create interface and attach lineEdit to it. + HbEditorInterface editInterface(editor); + // set editor as phone number editor so that inserting numbers is easier + editor->setInputMethodHints(Qt::ImhDigitsOnly); + editor->setValidator(validator); + } + modelItem->setContentWidgetData(QString("text"), value); + + } + +} + +// --------------------------------------------------------------------------- + +void PISettingsView::createGeneralSettingForms() +{ + + // Add data into setting model + + // General settings group + mGeneralSettingsGroup = mModel->appendDataFormGroup(QString("General settings"), + mModel->invisibleRootItem()); + + // Output drop down list + mOutputItem = mModel->appendDataFormItem(HbDataFormModelItem::ComboBoxItem, + QString("Output to"), mGeneralSettingsGroup); + mOutputItem->setContentWidgetData(QString("items"), OUTPUTMODES); + + // Data file location textbox + mFileLocation = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString( + "Save file in"), mGeneralSettingsGroup); + mFileLocation->setContentWidgetData("maxLength", 64); + + // File name textbox + mPrefix = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString("File prefix"), + mGeneralSettingsGroup); + mPrefix->setContentWidgetData("maxLength", 64); + + // Period that used when using timed progfiling + mSamplingPeriod = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString( + "Sampling period(s)"), mGeneralSettingsGroup); + mSamplingPeriod->setContentWidgetData(QString("TextboxType"), QString("integer")); + mSamplingPeriod->setContentWidgetData("maxLength", 64); + +} + +// --------------------------------------------------------------------------- + +void PISettingsView::createPluginSpecificSettings() +{ + + // Create plug-in specific group + mPluginSettingsGroup = mModel->appendDataFormGroup(QString("Plug-in specific settings"), + mModel->invisibleRootItem()); + + if (mPluginList != 0) { + + for (int index = 0; index < mPluginList->size(); index++) { + + // create plug-in specific settings group for each plug-in which has own settings + if (mPluginList->at(index).mItemCount > 0 || mPluginList->at(index).mSampleRate != -1) { + + // Create settings group + HbDataFormModelItem *mPluginGroup = mModel->appendDataFormGroup(QString( + mPluginList->at(index).mName), mPluginSettingsGroup); + + + // get plugin attributes + PluginAttributes attributes = mPluginList->at(index); + + // Create sample rate item if it is needed + if (attributes.mSampleRate != -1) { + attributes.mFormItemSampleRate = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, "Sample rate (ms)", mPluginGroup); + attributes.mFormItemSampleRate->setContentWidgetData(QString("TextboxType"), QString( + "integer")); + + attributes.mFormItemSampleRate->setContentWidgetData("text", + attributes.mSampleRate); + } + + // create other setting items + attributes.mFormItemSettingItem1 = createPluginSettingItem( + &attributes.mSettingItem1, mPluginGroup); + attributes.mFormItemSettingItem2 = createPluginSettingItem( + &attributes.mSettingItem2, mPluginGroup); + attributes.mFormItemSettingItem3 = createPluginSettingItem( + &attributes.mSettingItem3, mPluginGroup); + attributes.mFormItemSettingItem4 = createPluginSettingItem( + &attributes.mSettingItem4, mPluginGroup); + attributes.mFormItemSettingItem5 = createPluginSettingItem( + &attributes.mSettingItem5, mPluginGroup); + attributes.mFormItemSettingItem6 = createPluginSettingItem( + &attributes.mSettingItem6, mPluginGroup); + mPluginList->replace(index, attributes); + } + } + } + +} + +// --------------------------------------------------------------------------- + +HbDataFormModelItem *PISettingsView::createPluginSettingItem(const SettingItem *item, + HbDataFormModelItem *parentGroup) +{ + // create individual plug-in setting item + + HbDataFormModelItem *settingItem = 0; + if (item->mSettingText != QString("")) { + switch (item->mType) { + case SettingItem::SettingItemTypeBool: + settingItem = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem, + item->mUIText, parentGroup); + bool value = false; + if (item->mValue == "true") { + value = true; + } + settingItem->setContentWidgetData("tristate", value); + + break; + case SettingItem::SettingItemTypeHex: + settingItem = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, item->mUIText, + parentGroup); + settingItem->setContentWidgetData("text", item->mValue); + settingItem->setContentWidgetData("maxLength", 64); + + break; + + case SettingItem::SettingItemTypeInt: + settingItem = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, item->mUIText, + parentGroup); + settingItem->setContentWidgetData("text", item->mValue); + settingItem->setContentWidgetData(QString("TextboxType"), QString("integer")); + settingItem->setContentWidgetData("maxLength", 64); + + break; + + case SettingItem::SettingItemTypeText: + HbDataFormModelItem *settingItem = mModel->appendDataFormItem( + HbDataFormModelItem::TextItem, item->mUIText, parentGroup); + settingItem->setContentWidgetData("text", item->mValue); + settingItem->setContentWidgetData("maxLength", 64); + + break; + + } + } + return settingItem; + +} + +// --------------------------------------------------------------------------- + +void PISettingsView::loadGeneralSettings() +{ + // load general settings from engine + mEngine->getGeneralSettings(mGeneralAttributes); + + // set output item correct + if (mGeneralAttributes.mTraceOutput == "file_system") { + mOutputItem->setContentWidgetData(QString("currentIndex"), OUTPUT_MODE_FILE); + } + else { + mOutputItem->setContentWidgetData(QString("currentIndex"), OUTPUT_MODE_DEBUG); + } + + mFileLocation->setContentWidgetData(QString("text"), mGeneralAttributes.mSaveFileDrive); + mPrefix->setContentWidgetData(QString("text"), mGeneralAttributes.mTraceFilePrefix); + mSamplingPeriod->setContentWidgetData(QString("text"), mGeneralAttributes.mTimedSamplingPeriod); + +} + +// --------------------------------------------------------------------------- + +GeneralAttributes &PISettingsView::getGeneralAttributes() +{ + // Read items from ui elements and save them into mGeneralAttributes + + + QString fileLocation = mFileLocation->contentWidgetData(QString("text")).toString(); + if (fileLocation.length() > 0 && mEngine->checkTraceLocationSanity(fileLocation)) { + mGeneralAttributes.mSaveFileDrive = fileLocation; + } + else { + Notifications::showErrorNote("Invalid path, check settings!"); + mFileLocation->setContentWidgetData(QString("text"), mGeneralAttributes.mSaveFileDrive); + } + bool ok = false; + mGeneralAttributes.mTimedSamplingPeriod + = mSamplingPeriod->contentWidgetData(QString("text")).toInt(&ok); + + if (!ok) { + // this should not happen because intvalidator is set into text box + qWarning("Unable to convert sampling period to integer"); + + } + mGeneralAttributes.mTraceFilePrefix = mPrefix->contentWidgetData(QString("text")).toString(); + + if (mOutputItem->contentWidgetData(QString("currentIndex")).toInt(&ok) == OUTPUT_MODE_FILE) { + mGeneralAttributes.mTraceOutput = QString("file_system"); + } + else { + mGeneralAttributes.mTraceOutput = QString("debug_output"); + } + + return mGeneralAttributes; + +} + +// --------------------------------------------------------------------------- + +void PISettingsView::setPluginSettings(QList *pluginList) +{ + mPluginList = pluginList; + createPluginSpecificSettings(); +} + +// --------------------------------------------------------------------------- + + +void PISettingsView::readPluginSettingItemValue(HbDataFormModelItem *dataFormItem, + SettingItem *settingItem) +{ + if (settingItem != 0 && dataFormItem != 0) { + // check if item type is bool, convert bool to string + if (settingItem->mType == SettingItem::SettingItemTypeBool) { + bool checkboxValue = true; + checkboxValue = dataFormItem->contentWidgetData(QString("tristate")).toBool(); + + if(checkboxValue){ + settingItem->mValue = QString("true"); + } + else{ + settingItem->mValue = QString("false"); + } + + } + // otherwise save text straight into settin item + else { + settingItem->mValue = dataFormItem->contentWidgetData("text").toString(); + } + } +} + +// --------------------------------------------------------------------------- + +void PISettingsView::readPluginSettings() +{ + // Read Plug-in setting item and save values into m + for (int index = 0; index < mPluginList->size(); index++) { + + PluginAttributes attributes = mPluginList->at(index); + + readPluginSettingItemValue(attributes.mFormItemSettingItem1, &attributes.mSettingItem1); + readPluginSettingItemValue(attributes.mFormItemSettingItem2, &attributes.mSettingItem2); + readPluginSettingItemValue(attributes.mFormItemSettingItem3, &attributes.mSettingItem3); + readPluginSettingItemValue(attributes.mFormItemSettingItem4, &attributes.mSettingItem4); + readPluginSettingItemValue(attributes.mFormItemSettingItem5, &attributes.mSettingItem5); + readPluginSettingItemValue(attributes.mFormItemSettingItem6, &attributes.mSettingItem6); + + if (attributes.mFormItemSampleRate != 0) { + bool ok = false; + attributes.mSampleRate + = attributes.mFormItemSampleRate->contentWidgetData("text").toInt(&ok); + if (!ok) { + // this should not happen because intvalidator is set into text box + qWarning("Unable to convert sample rate to integer"); + } + } + + mPluginList->replace(index, attributes); + + } + +} + +// --------------------------------------------------------------------------- + +void PISettingsView::expandPluginGroup(int uid) +{ + + // FIXME some of the methods is deprecating fix once new methods available. + //collapse all group items + /*HbDataFormViewItem *viewItem = 0; + viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mPluginSettingsGroup)); + if (viewItem != 0) { + viewItem->setExpanded(false); + } + viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mGeneralSettingsGroup)); + if (viewItem != 0) { + viewItem->setExpanded(false); + } + // Set plugin group as expanded. + viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mPluginSettingsGroup)); + if (viewItem != 0) { + viewItem->setExpanded(true); + } + // find group item which has same uid number + for (int index = 0; index < mPluginSettingsGroup->childCount(); index++) { + HbDataFormModelItem *item = mPluginSettingsGroup->childAt(index); + bool ok = false; + int groupUid = item->data(HbDataFormModelItem::KeyRole).toInt(&ok); + if (ok) { + if (uid == groupUid) { + // Set group as expanded + viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(item)); + if (viewItem != 0) { + viewItem->setExpanded(true); + } + + // scroll view so that group is shown + mSettingForm->scrollTo(mModel->indexFromItem(item), + HbAbstractItemView::PositionAtTop); + break; + + } + } + + }*/ + +} + +// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/hb/src/pluginattributes.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/hb/src/pluginattributes.cpp Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,32 @@ +/* +* 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 "pluginattributes.h" + +PluginAttributes::PluginAttributes() : + mFormItemSettingItem1(0), mFormItemSettingItem2(0), mFormItemSettingItem3(0), + mFormItemSettingItem4(0), mFormItemSettingItem5(0), mFormItemSettingItem6(0), + mFormItemSampleRate(0) +{ + +} + +PluginAttributes::~PluginAttributes() +{ + +} diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/icons/qgn_menu_piprofilerui.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/icons/qgn_menu_piprofilerui.svg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,59 @@ + + + + + + image/svg+xml + + + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfapps/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/perfapps/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg Fri Sep 03 17:11:21 2010 +0300 @@ -0,0 +1,17 @@ + + + + + + diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/data/perfmon.rss --- a/perfmon/data/perfmon.rss Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,693 +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: -* -*/ - - - -NAME MATT - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "perfmon.hrh" -#include "perfmon_std.h" -#include -#include - - -// --------------------------------------------------------- -// -// Define the resource file signature -// This resource should be empty. -// -// --------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE { } - -// --------------------------------------------------------- -// -// Default Document Name -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_default_document_name { buf=""; } - -// --------------------------------------------------------- -// -// Define default menu and CBA key. -// -// --------------------------------------------------------- -// -RESOURCE EIK_APP_INFO - { - status_pane = r_perfmon_status_pane; - //menubar = r_perfmon_menubar; - //cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - -//---------------------------------------------------- -// r_perfmon_status_pane -//---------------------------------------------------- -// -RESOURCE STATUS_PANE_APP_MODEL r_perfmon_status_pane - { - panes= - { - SPANE_PANE - { - id = EEikStatusPaneUidNavi; - type = EAknCtNaviPane; - resource = r_perfmon_navi_decorator; - } - }; - } - -//---------------------------------------------------- -// r_perfmon_navi_decorator -//---------------------------------------------------- -// -RESOURCE NAVI_DECORATOR r_perfmon_navi_decorator - { - type = ENaviDecoratorControlTabGroup; - control = TAB_GROUP - { - tab_width = EAknTabWidthWithTwoTabs; - active = 0; - tabs = { - TAB - { - id = ETabMainViewValues; - txt = "Values"; - }, - TAB - { - id = ETabMainViewGraphs; - txt = "Graphs"; - } - }; - }; - } - -//---------------------------------------------------- -// -// r_perfmon_hotkeys -// -//---------------------------------------------------- -// -RESOURCE HOTKEYS r_perfmon_hotkeys - { - control= - { - HOTKEY { command=EAknCmdExit; key='e'; } - }; - } - - -//---------------------------------------------------- -// r_perfmon_view_values -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_perfmon_view_values - { - hotkeys=r_perfmon_hotkeys; - menubar=r_perfmon_menubar_view_values; - cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - -//---------------------------------------------------- -// r_perfmon_menubar_view_values -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_perfmon_menubar_view_values - { - titles= - { - MENU_TITLE { menu_pane=r_perfmon_app_menu; txt="App"; }, - MENU_TITLE { menu_pane=r_perfmon_view_values_menu; txt="Values"; } - }; - } - -//---------------------------------------------------- -// r_perfmon_view_values_menu -//---------------------------------------------------- -// - -RESOURCE MENU_PANE r_perfmon_view_values_menu - { - items= - { - }; - } - -//---------------------------------------------------- -// r_perfmon_view_graphs -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_perfmon_view_graphs - { - hotkeys=r_perfmon_hotkeys; - menubar=r_perfmon_menubar_view_graphs; - cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - -//---------------------------------------------------- -// r_perfmon_menubar_view_graphs -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_perfmon_menubar_view_graphs - { - titles= - { - MENU_TITLE { menu_pane=r_perfmon_app_menu; txt="App"; }, - MENU_TITLE { menu_pane=r_perfmon_view_graphs_menu; txt="graphs"; } - }; - } - -//---------------------------------------------------- -// r_perfmon_view_graphs_menu -//---------------------------------------------------- -// - -RESOURCE MENU_PANE r_perfmon_view_graphs_menu - { - items= - { - }; - } - - -//---------------------------------------------------- -// r_perfmon_app_menu -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_perfmon_app_menu - { - items= - { - MENU_ITEM { command=EPerfMonCmdEnableLogging; txt="Enable Logging"; }, - MENU_ITEM { command=EPerfMonCmdDisableLogging; txt="Disable Logging"; }, - MENU_ITEM { command=EPerfMonCmdSettings; txt="Settings"; }, - MENU_ITEM { command=EPerfMonCmdAbout; txt="About"; }, - MENU_ITEM { command=EAknCmdExit; txt="Exit"; } - }; - } - -//---------------------------------------------------- -// r_perfmon_settings_dialog -// Dialog for setting list -//---------------------------------------------------- -// -RESOURCE DIALOG r_perfmon_settings_dialog - { - flags = - EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | - EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | - EEikDialogFlagWait | EEikDialogFlagNoTitleBar; - buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; - items = - { - DLG_LINE - { - type = EAknCtSettingListBox; - id = EPerfMonSettingItemList; - itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; - control = LISTBOX - { - flags = EAknListBoxSelectionList; - }; - } - }; - } - -//---------------------------------------------------- -// r_perfmon_settings_menubar -//---------------------------------------------------- -// - -RESOURCE MENU_BAR r_perfmon_settings_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_perfmon_settings_menupane; - txt = " "; // dummy - } - }; - } - -RESOURCE MENU_PANE r_perfmon_settings_menupane - { - items = - { - MENU_ITEM - { - command = EPerfMonCmdSettingsChange; - txt = "Change"; - }, - MENU_ITEM - { - command = EPerfMonCmdSettingsExit; - txt = "Exit"; - } - }; - } - - -//---------------------------------------------------- -// -// Setting item resources -// -//---------------------------------------------------- -// - -// generic resources -RESOURCE POPUP_SETTING_LIST r_popup_setting_list_editor - { - } -RESOURCE AVKON_SETTING_PAGE r_binary_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_yesno_binaryselection_texts - { - setting_texts_resource = r_yesno_binaryselection_text_array; - } -RESOURCE ARRAY r_yesno_binaryselection_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=0; text = "No"; }, - AVKON_ENUMERATED_TEXT { value=1; text = "Yes"; } - }; - } - -// -// resources for heartbeat selection -// -RESOURCE TBUF r_heartbeat_setting_title - { - buf = "Heart beat (ms)"; - } -RESOURCE AVKON_SETTING_PAGE r_heartbeat_setting_page - { - type = EAknCtIntegerEdwin; - editor_resource_id = r_heartbeat_integer_editor; - } -RESOURCE AVKON_INTEGER_EDWIN r_heartbeat_integer_editor - { - maxlength = 5; - min = 1; - max = 99999; - } - - -// -// resources for maxsamples selection -// -RESOURCE TBUF r_maxsamples_setting_title - { - buf = "Max samples"; - } -RESOURCE AVKON_SETTING_PAGE r_maxsamples_setting_page - { - type = EAknCtIntegerEdwin; - editor_resource_id = r_maxsamples_integer_editor; - } -RESOURCE AVKON_INTEGER_EDWIN r_maxsamples_integer_editor - { - maxlength = 4; - min = 1; - max = 9999; - } - - -// -// resources for priority selection -// -RESOURCE TBUF r_priority_setting_title - { - buf = "Priority"; - } -RESOURCE AVKON_SETTING_PAGE r_priority_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_priority_setting_texts - { - setting_texts_resource = r_priority_text_array; - } -RESOURCE ARRAY r_priority_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeMuchLess; text = "Much less"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeLess; text = "Less"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeNormal; text = "Normal"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeMore; text = "More"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeMuchMore; text = "Much more"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeRealTime; text = "Real time"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteVeryLow; text = "Abs. very low"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteLow; text = "Abs. low"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteBackground; text = "Abs. background"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteForeground; text = "Abs. foreground"; }, - AVKON_ENUMERATED_TEXT { value=EThreadPriorityTypeAbsoluteHigh; text = "Abs. high"; } - }; - } - - -// -// resources for cpumode selection -// -RESOURCE TBUF r_cpumode_setting_title - { - buf = "CPU sampling mode"; - } -RESOURCE AVKON_SETTING_PAGE r_cpumode_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_cpumode_setting_texts - { - setting_texts_resource = r_cpumode_text_array; - } -RESOURCE ARRAY r_cpumode_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=ECPUModeCPUTime; text = "CPU Time"; }, - AVKON_ENUMERATED_TEXT { value=ECPUModeNOPs; text = "NOPs"; } - }; - } - - -// -// resources for keepbacklighton selections -// -RESOURCE TBUF r_keepbacklighton_setting_title - { - buf = "Keep backlight on"; - } - - -// -// resources for datapopupvisibility selection -// -RESOURCE TBUF r_datapopupvisibility_setting_title - { - buf = "Visibility"; - } -RESOURCE AVKON_SETTING_PAGE r_datapopupvisibility_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_datapopupvisibility_setting_texts - { - setting_texts_resource = r_datapopupvisibility_text_array; - } -RESOURCE ARRAY r_datapopupvisibility_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=EDataPopupVisbilityAlwaysOn; text = "On"; }, - AVKON_ENUMERATED_TEXT { value=EDataPopupVisbilityBackgroundOnly; text = "Backgr. only"; }, - AVKON_ENUMERATED_TEXT { value=EDataPopupVisbilityAlwaysAlwaysOff; text = "Off"; } - }; - } - -// -// resources for datapopuplocation selection -// -RESOURCE TBUF r_datapopuplocation_setting_title - { - buf = "Location"; - } -RESOURCE AVKON_SETTING_PAGE r_datapopuplocation_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_datapopuplocation_setting_texts - { - setting_texts_resource = r_datapopuplocation_text_array; - } -RESOURCE ARRAY r_datapopuplocation_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=EDataPopupLocationTopRight; text = "Top right"; }, - AVKON_ENUMERATED_TEXT { value=EDataPopupLocationBottomMiddle; text = "Bottom middle"; } - }; - } - -// -// resources for sources selection -// -RESOURCE TBUF r_sources_setting_title - { - buf = "Sources"; - } -RESOURCE AVKON_SETTING_PAGE r_sources_setting_page - { - type = EAknSetListBox; - editor_resource_id = r_sources_items_listbox; - label = "Sources"; - } -RESOURCE LISTBOX r_sources_items_listbox - { - flags = EAknListBoxMultipleSelection; - } - - -// -// resources for graphsverticalbar selection -// -RESOURCE TBUF r_graphsverticalbar_setting_title - { - buf = "Vertical bar period (s)"; - } -RESOURCE AVKON_SETTING_PAGE r_graphsverticalbar_setting_page - { - type = EAknCtIntegerEdwin; - editor_resource_id = r_graphsverticalbar_integer_editor; - } -RESOURCE AVKON_INTEGER_EDWIN r_graphsverticalbar_integer_editor - { - maxlength = 3; - min = 0; - max = 999; - } - - -// -// resources for loggingmode selection -// -RESOURCE TBUF r_loggingmode_setting_title - { - buf = "Mode"; - } -RESOURCE AVKON_SETTING_PAGE r_loggingmode_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_loggingmode_setting_texts - { - setting_texts_resource = r_loggingmode_text_array; - } -RESOURCE ARRAY r_loggingmode_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=ELoggingModeRDebug; text = "RDebug"; }, - AVKON_ENUMERATED_TEXT { value=ELoggingModeLogFile; text = "Log file"; }, - AVKON_ENUMERATED_TEXT { value=ELoggingModeRDebugLogFile; text = "RDebug & log file"; } - }; - } - - -// -// resources for loggingfilepath selection -// -RESOURCE TBUF r_loggingfilepath_setting_title - { - buf = "Log file path"; - } -RESOURCE AVKON_SETTING_PAGE r_loggingfilepath_setting_page - { - type = EEikCtEdwin; - editor_resource_id = r_loggingfilepath_text_editor; - } - -RESOURCE EDWIN r_loggingfilepath_text_editor - { - lines = 0; // expanding to multiple rows - maxlength = 63; - flags = EEikEdwinNoLineOrParaBreaks; - } - - -// --------------------------------------------------------- -// -// r_perfmon_about_dialog -// About dialog - show version and copyright info etc. -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_perfmon_about_dialog - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = "About PerfMon"; - headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - 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."; - }; - } - }; - } - -// --------------------------------------------------------- -// r_general_confirmation_query -// --------------------------------------------------------- -// - -RESOURCE DIALOG r_general_confirmation_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - }; - } - }; - } - -// --------------------------------------------------------- -// r_general_text_query -// --------------------------------------------------------- -// -RESOURCE DIALOG r_general_text_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - control = EDWIN - { - width = 256; - lines = 3; - maxlength = 256; - }; - }; - } - }; - } - -// --------------------------------------------------------- -// r_general_numeric_query -// --------------------------------------------------------- -// -RESOURCE DIALOG r_general_numeric_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = ENumberLayout; - control = AVKON_INTEGER_EDWIN - { - min = -999999; - max = 999999; - }; - }; - } - }; - } - - -// --------------------------------------------------------- -// -// RESOURCE LOCALISABLE_APP_INFO -// -// --------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_perfmon_localisable_app_info - { - short_caption = "PerfMon"; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = "PerfMon"; - - number_of_icons = 1; - - // Note for ROM-based apps it is recommended to add the drive letter - // icon_file = "z:"APP_BITMAP_DIR"\\myapp_aif.mif"; - icon_file = APP_BITMAP_DIR"\\perfmon_aif.mif"; - }; - } diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/data/perfmon_reg.rss --- a/perfmon/data/perfmon_reg.rss Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +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 - - -UID2 KUidAppRegistrationResourceFile -UID3 0x20011385 - - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "PerfMon"; - localisable_resource_file = APP_RESOURCE_DIR"\\PerfMon"; - localisable_resource_id = R_PERFMON_LOCALISABLE_APP_INFO; - group_name = "RnD Tools"; - } diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/engine/inc/perfmon.hrh --- a/perfmon/engine/inc/perfmon.hrh Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/engine/inc/perfmon_engine.h --- a/perfmon/engine/inc/perfmon_engine.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,224 +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_ENGINE_H -#define PERFMON_ENGINE_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 CPerfMonEngine : public CActive - { -public: - ~CPerfMonEngine(); - void ActivateEngineL(); - void DeActivateEngineL(); - void EnableLogging(TBool aEnable); - -private: - void RunL(); - void DoCancel(); - -protected: - CPerfMonEngine(); - void ConstructL(); - void LoadSettingsL(); - void SaveSettingsL(); - void OpenLogFile(TBool aOpen); - 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); - -protected: - 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; } - -protected: - RTimer iTimer; - CEikonEnv* iEnv; - TPerfMonSettings iSettings; - RApaLsSession iLs; - 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 5db69f4c3d06 -r b048e15729d6 perfmon/engine/src/perfmon_engine.cpp --- a/perfmon/engine/src/perfmon_engine.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,925 +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_engine.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* 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::EPriorityLow); - TCallBack cb(CPULoadCount, aParam); - idle->Start(cb); - - pS->Start(); - - delete idle; - delete pS; - delete pC; - - return 0; - } - -// ===================================== MEMBER FUNCTIONS ===================================== - -CPerfMonEngine::CPerfMonEngine() : - CActive(EPriorityUserInput) - { - } - -// -------------------------------------------------------------------------------------------- - -void CPerfMonEngine::ConstructL() - { - iCurrentCPUMode = ECPUModeNotSet; - iLogFileInitialized = EFalse; - - 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(); - - DeActivateCPUMonitoring(); - - // close log file - OpenLogFile(EFalse); - } - -// -------------------------------------------------------------------------------------------- - -CPerfMonEngine::~CPerfMonEngine() - { - 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(); - } - - // 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; - 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(EPriorityAbsoluteVeryLow); - iCPULoadThread.Resume(); - - iCurrentCPUMode = ECPUModeNOPs; // NOPs taken succesfully in use - } - -// -------------------------------------------------------------------------------------------- - -TBool CPerfMonEngine::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 CPerfMonEngine::DeActivateCPUMonitoring() - { - if (iCurrentCPUMode == ECPUModeCPUTime) - { - iNullThread.Close(); - } - - else if (iCurrentCPUMode == ECPUModeNOPs) - { - // kill the cpu load thread - iCPULoadThread.Kill(0); - iCPULoadThread.Close(); - } - } - -// -------------------------------------------------------------------------------------------- - -TBool CPerfMonEngine::CPUTimeSupported() - { - TTimeIntervalMicroSeconds time; - TInt err = RThread().GetCpuTime(time); - - if (err == KErrNone && time.Int64() > 0) - return ETrue; - else - return EFalse; - } - -// -------------------------------------------------------------------------------------------- - -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); - - // add all source entries - for (TInt i = 0; i < ESourcesLength; i++) - { - TSampleEntry newSampleEntry; - - if (i == ESourceCPU) - { - newSampleEntry.iDescription.Copy(_L("CPU")); - newSampleEntry.iUnitTypeShort.Copy(KNullDesC); - newSampleEntry.iUnitTypeLong.Copy(KNullDesC); - newSampleEntry.iDriveNumber = -1; - newSampleEntry.iGraphColor = KRgbYellow; - } - - else if (i == ESourceRAM) - { - newSampleEntry.iDescription.Copy(_L("RAM")); - newSampleEntry.iUnitTypeShort.Copy(_L("b")); - newSampleEntry.iUnitTypeLong.Copy(_L("bytes")); - newSampleEntry.iDriveNumber = -1; - newSampleEntry.iGraphColor = KRgbGreen; - } - - else //drives - { - TChar driveLetter = 'C' + i - ESourceC; // C is the first drive - - newSampleEntry.iDescription.Append(driveLetter); - newSampleEntry.iDescription.Append(_L(":")); - newSampleEntry.iUnitTypeShort.Copy(_L("b")); - newSampleEntry.iUnitTypeLong.Copy(_L("bytes")); - - iEnv->FsSession().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 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 - 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; i - < iSampleEntryArray->At(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; i < iSampleEntryArray->Count(); 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; i < iSampleEntryArray->Count(); i++) - { - 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[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; - // TODO: remove the next line once data popup is working - iSettings.iDataPopupVisibility = EDataPopupVisbilityAlwaysAlwaysOff; - 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) - { - 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); - - 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); - - 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 - } - -// --------------------------------------------------------------------------- - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/envpatcher/EnvPatcher.pl --- a/perfmon/envpatcher/EnvPatcher.pl Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,544 +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: -# Environment Patcher - Patches older S60 SDKs for supporting -# tricks in newer platforms -# - - -require v5.6.1; - -use File::Copy; -use strict; - -# check amount of commandline options is valid -if (@ARGV != 1) -{ - print "Usage: EnvPatcher \n"; - exit 1; -} - - -# get epocroot and convert, convert \ -> / -(my $epocroot = $ARGV[0]) =~ s{\\}{/}g; - -# remove any trailing forward slashes -$epocroot =~ s/\/$//; - - -# create variables for paths -my $e32toolsdir = $epocroot."/epoc32/tools"; -my $e32includedir = $epocroot."/epoc32/include"; -my $e32includeoemdir = $e32includedir."/oem"; -my $platformpathspath = $e32includedir."/platform_paths.hrh"; -my $domainplatformpathspath = $e32includedir."/domain/osextensions/platform_paths.hrh"; -my $mmppmpath = $e32toolsdir."/mmp.pm"; -my $pathutlpmpath = $e32toolsdir."/pathutl.pm"; -my $prepfilepmpath = $e32toolsdir."/prepfile.pm"; - -# variables for hacked content -my $dependshack = "\t\t\tif (/^DEPENDS\$/o) {\r\n\t\t\t\tnext LINE; # Ignore DEPENDS keyword, not needed by ABLD\r\n\t\t\t}\r\n"; -my $smpsafehack = "\t\tif (/^SMPSAFE\$/o) {\r\n\t\t\tnext LINE; # Ignore SMPSAFE keyword, not needed by older environments\r\n\t\t}\r\n"; -my $forwardslashhack = "\t\t# EnvPatcher forwardslash hack begins\r\n\t\t\$_=~s{/}{\\\\}g; # convert all forward slashes to backslashes\r\n\t\t# EnvPatcher forwardslash hack ends\r\n\r\n"; -my $coreibyexportsupport = "\r\n// Following definition is used for exporting tools and stubs IBY files to\r\n// Core image.\r\n#define CORE_IBY_EXPORT_PATH(path,exported) /epoc32/rom/include/##exported\r\n"; - - -# check epoc32\tools exists -unless (-d $e32toolsdir) -{ - print "$e32toolsdir not found, please check valid epocroot has been given!\n"; - exit 1; -} - -# check epoc32\include exists -unless (-d $e32includedir) -{ - print "$e32includedir not found, please check valid epocroot has been given!\n"; - exit 1; -} - - -# create epoc32\include\oem if it does not exist -unless (-d $e32includeoemdir) -{ - mkdir $e32includeoemdir or die; - print "Missing directory $e32includeoemdir created succesfully.\n"; -} - - -# check if epoc32\include\domain\osextensions\platform_paths.hrh exists -if (-e $domainplatformpathspath) -{ - # show an error if the file does not have any platform macros - unless (string_exists_in_file($domainplatformpathspath, "OS_LAYER_SYSTEMINCLUDE")) - { - print "ERROR: $domainplatformpathspath does not have SF macros.\n"; - print "Please check your environment, if you have S60 3.2 OEM or newer, please get the latest version!\n"; - exit 2; - } -} - - -# check if epoc32\include\platform_paths.hrh exists -if (-e $platformpathspath) -{ - print "$platformpathspath already exists, not checking it.\n"; -} -else -{ - # create the file missing file - create_default_platform_paths_hrh(); - print "Missing file $platformpathspath created succesfully.\n"; -} - - -# check if CORE_IBY_EXPORT_PATH macro exist in the platform_paths.hrh -unless (string_exists_in_file($platformpathspath, "CORE_IBY_EXPORT_PATH")) -{ - # read content of the platform_paths.hrh - my @filecontent = read_file_to_array($platformpathspath); - - my $match_found = 0; - my $i = 0; - my $match_found_pos = 0; - - # find the position where the include guards start (this should be a safe position) - foreach (@filecontent) - { - if ($_ =~ /#define PLATFORM_PATHS_HRH/) - { - $match_found = 1; - $match_found_pos = $i; - last; - } - - $i++; - } - - if ($match_found) - { - # insert the patched content to the file - splice(@filecontent, $match_found_pos+1, 0, $coreibyexportsupport); - - # write the modified array to the file - write_file_from_array($platformpathspath, @filecontent); - - print "Platform_paths.hrh updated to support CORE_IBY_EXPORT_PATH macro.\n"; - } - else - { - print "WARNING: $platformpathspath is corrupted or not supported!\n"; - } -} - - -# check if epoc32\tools\mmp.pm exists -if (-e $mmppmpath) -{ - # check if DEPENDS keyword already exists in the file - if (string_exists_in_file($mmppmpath, "DEPENDS")) - { - print "The SDK can already handle DEPENDS keyword in a MMP file.\n"; - } - else - { - # read content of the mmp.pm file - my @filecontent = read_file_to_array($mmppmpath); - - my $match_found = 0; - my $i = 0; - my $match_found_pos = 0; - - # loop through the array to find the correct place - foreach (@filecontent) - { - if ($_ =~ /Unrecognised Resource Keyword/) - { - $match_found = 1; - $match_found_pos = $i; - last; - } - - $i++; - } - - if ($match_found) - { - # insert the patched content to the file - splice(@filecontent, $match_found_pos-1, 0, $dependshack); - - # write the modified array to the file - write_file_from_array($mmppmpath, @filecontent); - - print "Mmp.pm patched with DEPENDS keyword hack.\n"; - } - else - { - print "ERROR: Unable to find correct place from $mmppmpath for patching!\n"; - print "Your SDK environment probably is not supported by this script!\n"; - exit(2); - } - } - - # check if SMPSAFE keyword already exists in the file - if (string_exists_in_file($mmppmpath, "SMPSAFE")) - { - print "The SDK can already handle SMPSAFE keyword in a MMP file.\n"; - } - else - { - # read content of the mmp.pm file - my @filecontent = read_file_to_array($mmppmpath); - - my $match_found = 0; - my $i = 0; - my $match_found_pos = 0; - - # loop through the array to find the correct place - foreach (@filecontent) - { - if ($_ =~ /Unrecognised Keyword/) - { - $match_found = 1; - $match_found_pos = $i; - last; - } - - $i++; - } - - if ($match_found) - { - # insert the patched content to the file - splice(@filecontent, $match_found_pos, 0, $smpsafehack); - - # write the modified array to the file - write_file_from_array($mmppmpath, @filecontent); - - print "Mmp.pm patched with SMPSAFE keyword hack.\n"; - } - else - { - print "ERROR: Unable to find correct place from $mmppmpath for patching!\n"; - print "Your SDK environment probably is not supported by this script!\n"; - exit(2); - } - } -} -else -{ - print "WARNING: $mmppmpath not found, this environment is not supported!\n"; -} - - -# check if epoc32\tools\pathutl.pm exists -if (-e $pathutlpmpath) -{ - # check if "sub Path_Norm" already exists in the pathutil.pm file - # if it does not exists, then we need to patch prepfile.pm - if (string_exists_in_file($pathutlpmpath, "sub Path_Norm")) - { - print "The SDK is non Symbian OS 9.1, no need to add forward slash hack.\n"; - } - else - { - # check if prepfile.pm has already been patched - if (string_exists_in_file($prepfilepmpath, "EnvPatcher forwardslash hack")) - { - print "The SDK has already been patched with forwardslash hack.\n"; - } - else - { - # read content of the prepfile.pm file - my @filecontent = read_file_to_array($prepfilepmpath); - - my $match_found = 0; - my $i = 0; - my $match_found_pos = 0; - - # loop through the array to find the correct place - foreach (@filecontent) - { - if ($_ =~ /# skip blank lines/) - { - $match_found = 1; - $match_found_pos = $i; - last; - } - - $i++; - } - - if ($match_found) - { - # insert the patched content to the file - splice(@filecontent, $match_found_pos+6, 0, $forwardslashhack); - - # write the modified array to the file - write_file_from_array($prepfilepmpath, @filecontent); - - print "Prepfile.pm patched with forward slash hack.\n"; - } - else - { - print "ERROR: Unable to find correct place from $prepfilepmpath for patching!\n"; - print "Your SDK environment probably is not supported by this script!\n"; - exit(2); - } - } - } -} -else -{ - print "WARNING: $pathutlpmpath not found, this environment is not supported!\n"; -} - - - -# checks if string exists in the file -sub string_exists_in_file -{ - my $filepath = $_[0]; - my $findstring = $_[1]; - my $match_found = 0; - - open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!"; - - # loop through the file for occurances - while () - { - if ($_ =~ /$findstring/) - { - $match_found = 1; - last; - } - } - - close FILE; - - return $match_found; -} - - -# reads lines from a file to an array -sub read_file_to_array -{ - my $filepath = $_[0]; - - open(FILE, "<", $filepath) or die "Failed to open $filepath for reading!"; - my @data = ; - close FILE; - - return(@data); -} - - -# writes lines from an array to a file -sub write_file_from_array -{ - my ($filepath, @data) = @_; - - # take a backup of the file - copy ($filepath, $filepath."EnvPatcher") or die "Cannot take backup of $filepath to $filepath.EnvPatcher"; - - open(FILE, ">", $filepath) or die "Failed to open $filepath for writing!"; - - # write the array to file - foreach my $line (@data) - { - print FILE "$line"; - } - - close FILE; -} - -sub create_default_platform_paths_hrh -{ - # the file does not exist, so create the missing file - open(FILE, ">", $platformpathspath) or die "Failed to open $platformpathspath for writing!\n"; - - print FILE < thus they are first. -*/ -#define APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem - -/** -* This define statements defines the SYSTEMINCLUDE-line, which is intended to be -* used in the mmp-files that are part of the middleware-layer. It includes all -* the needed directories from the /epoc32/include, that are valid ones for the -* middleware-layer components. -*/ -#define MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem - -/** -* This define statements defines the SYSTEMINCLUDE-line, which is intended to be -* used in the mmp-files that are part of the osextensions-layer. It includes all -* the needed directories from the /epoc32/include, that are valid ones for the -* os-layer components. -*/ -#define OS_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include /epoc32/include/oem - - -// Below statement is Deprecated and the OS_LAYER_SYSTEMINCLUDE-macro has to be -// used. -#define OSEXT_LAYER_SYSTEMINCLUDE OS_LAYER_SYSTEMINCLUDE - -/** -* This define statements defines the SYSTEMINCLUDE-line, which is intended to be -* used in the mmp-files that are part of the os-layer. This is intended -* to be only used by those components which need to use in their mmp-file either -* kern_ext.mmh or nkern_ext.mmh. Reason is that those -* 2 files already contain the /epoc32/include as system include path. -* -*/ -#define OS_LAYER_KERNEL_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/oem - - -// Below statement is Deprecated and the OS_LAYER_KERNEL_SYSTEMINCLUDE-macro -// has to be used. -#define OSEXT_LAYER_KERNEL_SYSTEMINCLUDE OS_LAYER_KERNEL_SYSTEMINCLUDE - -/** -**************************************************************************** -* Definitions that also define the paths to the layer specific source directories. -**************************************************************************** -*/ -/** -* The below 3 macros define the paths to the layer-specific source dirs. -* See usage on top of this hrh-file, these are used the same way as -* for instance the OS_LAYER_DOMAIN_EXPORT_PATH -* Deprecated: is not allowed to be using in Symbian Foundation -*/ -#define APP_LAYER_SOURCE_PATH(rest) /s60/app/##rest -#define MW_LAYER_SOURCE_PATH(rest) /s60/mw/##rest -#define OSEXT_LAYER_SOURCE_PATH(rest) /s60/osext/##rest - -/** -**************************************************************************** -* Definitions to export IBY files to different folders where they will be taken -* to ROM image -**************************************************************************** -*/ -// Following definition is used for exporting tools and stubs IBY files to -// Core image. -#define CORE_IBY_EXPORT_PATH(path,exported) /epoc32/rom/include/##exported - -/** -* --------------------------------------- -* Macros for Configuration tool migration. -* The below macros define the location under epoc32, where the confml -* (Configuration Markup Language) and crml (Central Repository Markup Language) -* files should be exported. -* --------------------------------------- -*/ -#define CONFML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file -#define CRML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file -#define GCFML_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/##file -#define CONFML_CONFIG_EXPORT_PATH(file,category) /epoc32/rom/config/confml_data/##category##/config/##file - -#define APP_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) -#define APP_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) -#define APP_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) -#define APP_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) - -#define MW_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) -#define MW_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) -#define MW_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) -#define MW_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) - -// Deprecate: Use the OS_LAYER_* macros instead of OSEXT_LAYER_* -#define OSEXT_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) -#define OSEXT_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) -#define OSEXT_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) -#define OSEXT_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) -#define OS_LAYER_CONFML(exported) CONFML_EXPORT_PATH(exported,s60) -#define OS_LAYER_CRML(exported) CRML_EXPORT_PATH(exported,s60) -#define OS_LAYER_GCFML(exported) GCFML_EXPORT_PATH(exported,s60) -#define OS_LAYER_CONFML_CONFIG(exported) CONFML_CONFIG_EXPORT_PATH(exported,s60) - -#endif // end of PLATFORM_PATHS_HRH - -ENDOFTHEFILE - - close FILE; -} diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/envpatcher/ReadMe.txt --- a/perfmon/envpatcher/ReadMe.txt Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -Environment Patcher v1.0.1 -========================== - -Updated: 12th November 2009 - - -Introduction: -------------- -This tool can be used to patch your S60 SDK environment so that the tricks and -macros introduced in the latest SDKs can be used in a public SDK and older -OEM releases. - -This tool can perform the following tasks: -- Adds support for forward slashes in paths in bld.inf/.mmp files in S60 3.0 -- Removes an unncessary warning about DEPENDS and SMPSAFE resource keywords in - an .mmp file -- Creates a missing epoc32\include\platform_paths.hrh file for supporting - platform macros introduced since S60 3.2 OEM and Symbian Foundation releases -- Modifies epoc32\include\platform_paths.hrh for missing macros -- Creates a missing epoc32\include\oem directory to suppress a possible warning - - -Usage: ------- -EnvPatcher.pl - -Where EPOCROOT is the path to the root of the SDK, for example: - EnvPatcher.pl c:\Symbian\9.1\S60_3rd_MR - EnvPatcher.pl z:\ - - -Requirements: -------------- -- S60 SDK (public or OEM), version 3.0 or newer -- Perl 5.6.1 or newer - - - - -Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -All rights reserved. - -This component and the accompanying materials are made available -under the terms of "Eclipse Public License v1.0" -which accompanies this distribution, and is available -at the URL "http://www.eclipse.org/legal/epl-v10.html". diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/group/ReleaseNotes_PerfMon.txt --- a/perfmon/group/ReleaseNotes_PerfMon.txt Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -=============================================================================== - -RELEASE NOTES - PERFORMANCE MONITOR v1.1.1 -RELEASED 21st May 2010 - -SUPPORTS S60 5.2+ - -=============================================================================== - -Product Description: -==================== -PerfMon is an S60 UI application that you can use to monitor and log CPU load -in a device. You can also use it to monitor and log the consumption of memory -(RAM and disk drives) in a device. - -Main Features: -============== -- Three different monitor views for CPU load, RAM and disk usage: - - Values - - Graphs - - Popup (always on top) -- Supports CPU load sampling via a null thread CPU counter or with NOPs -- Source selections for graphs, popup and logging -- Heartbeat and thread priority configurable via settings -- Logging to RDebug and/or to a file - -=============================================================================== - -What's New in v1.1.1 -==================== -- Improved Orbit UI -- Error corrections - -=============================================================================== - -Installation Notes: -=================== -PerfMon is typically preinstalled on ROM. If not, it can be added to the -ROM with the .iby file. Alternatively, the .sis file can be found under the -sis-directory, but the user need to sign it with their own developer -certificate. In Nokia R&D environment, you can use directly the R&D-signed .sis -file under the internal\sis directory. - -When signing with own developer certificate, the following capabilities are -needed: - WriteDeviceData - -When builing PerfMon against S60 3.0 or 3.1, you may need to patch your SDK -environment first with some fixes. For more information, please refer to the -instructions under the "envpatcher" directory. - -=============================================================================== - -System Requirements: -==================== -Basic Requirements: -- Any S60 3.x device or emulator environment - -=============================================================================== - -Compatibility Issues: -===================== -N/A - -=============================================================================== - -Known Issues: -============= -N/A - -=============================================================================== - -Version History: -================ - -Version 1.0.0 - 6th March 2008 ------------------------------- -- Initial version - -=============================================================================== - -Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -All rights reserved. - -This component and the accompanying materials are made available -under the terms of "Eclipse Public License v1.0" -which accompanies this distribution, and is available -at the URL "http://www.eclipse.org/legal/epl-v10.html". - diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/group/backup_registration.xml --- a/perfmon/group/backup_registration.xml Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/group/bld.inf --- a/perfmon/group/bld.inf Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 - -prj_platforms - -WINSCW GCCE ARMV5 ARMV6 - -#include "bld_generic.inf" - -#include "../ui/avkon/group/bld.inf" - -prj_mmpfiles - -prj_extensions \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/group/bld_generic.inf --- a/perfmon/group/bld_generic.inf Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/group/group.pro --- a/perfmon/group/group.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -# -# 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\"" -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 5db69f4c3d06 -r b048e15729d6 perfmon/group/perfmon_icons_aif.mk --- a/perfmon/group/perfmon_icons_aif.mk Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\perfmon_aif.mif - - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : - @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : $(ICONTARGETFILENAME) - -$(ICONTARGETFILENAME) : ..\icons\qgn_menu_perfmon.svg - mifconv $(ICONTARGETFILENAME) \ - /c8,8 ..\icons\qgn_menu_perfmon.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/group/perfmon_stub_sis.mk --- a/perfmon/group/perfmon_stub_sis.mk Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +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: -# - - -TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install - -SISNAME=PerfMon_stub -PKGNAME=PerfMon_stub - -$(TARGETDIR) : - @perl -S emkdir.pl "$(TARGETDIR)" - -do_nothing : - rem do_nothing - -SISFILE=$(TARGETDIR)\$(SISNAME).sis - -$(SISFILE) : ..\sis\$(PKGNAME).pkg - makesis -s $? $@ - - - -MAKMAKE : do_nothing - -RESOURCE : do_nothing - -SAVESPACE : do_nothing - -BLD : do_nothing - -FREEZE : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -FINAL : $(TARGETDIR) $(SISFILE) - -CLEAN : - @if exist $(SISFILE) erase $(SISFILE) - -RELEASABLES : - @echo $(SISFILE) diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/icons/qgn_menu_perfmon.svg --- a/perfmon/icons/qgn_menu_perfmon.svg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/perfmon.pro --- a/perfmon/perfmon.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -# -# 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/datapopup \ - ui/hb/app diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/rom/perfmon.iby --- a/perfmon/rom/perfmon.iby Mon Aug 23 15:50:54 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_IBY__ -#define __PERFMON_IBY__ - -S60_APP_EXE(PerfMon) -S60_APP_AIF_ICONS(PerfMon) -S60_APP_RESOURCE(PerfMon) -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 - -#endif // __PERFMON_IBY__ diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/rom/perfmon_datapopup.iby --- a/perfmon/rom/perfmon_datapopup.iby Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +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_DATAPOPUP_IBY__ -#define __PERFMON_DATAPOPUP_IBY__ - -file=ABI_DIR\BUILD_DIR\PerfMonDataPopupPlugin.dll SHARED_LIB_DIR\PerfMonDataPopupPlugin.dll -data=DATAZ_\PRIVATE\20011385\PerfMonDataPopupPlugin.qtplugin PRIVATE\20011385\PerfMonDataPopupPlugin.qtplugin - -#endif // __PERFMON_DATAPOPUP_IBY__ diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/sis/PerfMon_S60-30.pkg --- a/perfmon/sis/PerfMon_S60-30.pkg Mon Aug 23 15:50:54 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: -; - - -; Language - standard language definitions -&EN - -; Standard SIS file header -#{"PerfMon"},(0x20011385),1,0,0,TYPE=SA - -; Supports S60 v 3.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -"\epoc32\RELEASE\armv5\UREL\PerfMon.exe"-"!:\sys\bin\PerfMon.exe" -"\epoc32\data\z\Resource\apps\PerfMon_aif.mif"-"!:\Resource\Apps\PerfMon_aif.mif" -"\epoc32\data\z\Resource\apps\PerfMon.rsc"-"!:\Resource\Apps\PerfMon.rsc" -"\epoc32\data\z\PRIVATE\10003A3F\APPS\PerfMon_reg.rsc"-"!:\private\10003a3f\import\apps\PerfMon_reg.rsc" -"..\group\backup_registration.xml"-"!:\private\20011385\backup_registration.xml" diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/sis/PerfMon_S60-30.sis Binary file perfmon/sis/PerfMon_S60-30.sis has changed diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/sis/PerfMon_stub.pkg --- a/perfmon/sis/PerfMon_stub.pkg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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: -; - - -; Language - standard language definitions -&EN - -; Standard SIS file header -#{"PerfMon"},(0x20011385),1,0,0 - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -""-"z:\sys\bin\PerfMon.exe" -""-"z:\Resource\Apps\PerfMon_aif.mif" -""-"z:\Resource\Apps\PerfMon.rsc" -""-"z:\private\10003a3f\import\apps\PerfMon_reg.rsc" -""-"z:\private\20011385\backup_registration.xml" - diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/group/bld.inf --- a/perfmon/ui/avkon/group/bld.inf Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +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 - -PRJ_MMPFILES -perfmon.mmp diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/group/perfmon.mmp --- a/perfmon/ui/avkon/group/perfmon.mmp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +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 - -USERINCLUDE ../../../engine/inc -SOURCEPATH ../../../engine/src -SOURCE perfmon_engine.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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_app.h --- a/perfmon/ui/avkon/inc/perfmon_app.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_appui.h --- a/perfmon/ui/avkon/inc/perfmon_appui.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_datapopupcontainer.h --- a/perfmon/ui/avkon/inc/perfmon_datapopupcontainer.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_document.h --- a/perfmon/ui/avkon/inc/perfmon_document.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_drawcallback.h --- a/perfmon/ui/avkon/inc/perfmon_drawcallback.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_graphscontainer.h --- a/perfmon/ui/avkon/inc/perfmon_graphscontainer.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_graphsview.h --- a/perfmon/ui/avkon/inc/perfmon_graphsview.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_model.h --- a/perfmon/ui/avkon/inc/perfmon_model.h Mon Aug 23 15:50:54 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 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(); - - 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_settingsviewdlg.h --- a/perfmon/ui/avkon/inc/perfmon_settingsviewdlg.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_std.h --- a/perfmon/ui/avkon/inc/perfmon_std.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_valuescontainer.h --- a/perfmon/ui/avkon/inc/perfmon_valuescontainer.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/inc/perfmon_valuesview.h --- a/perfmon/ui/avkon/inc/perfmon_valuesview.h Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_app.cpp --- a/perfmon/ui/avkon/src/perfmon_app.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_appui.cpp --- a/perfmon/ui/avkon/src/perfmon_appui.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_datapopupcontainer.cpp --- a/perfmon/ui/avkon/src/perfmon_datapopupcontainer.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_document.cpp --- a/perfmon/ui/avkon/src/perfmon_document.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_graphscontainer.cpp --- a/perfmon/ui/avkon/src/perfmon_graphscontainer.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_graphsview.cpp --- a/perfmon/ui/avkon/src/perfmon_graphsview.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_model.cpp --- a/perfmon/ui/avkon/src/perfmon_model.cpp Mon Aug 23 15:50:54 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_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; - } - -// --------------------------------------------------------------------------- - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_settingsviewdlg.cpp --- a/perfmon/ui/avkon/src/perfmon_settingsviewdlg.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,681 +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_settingsviewdlg.h" -#include "perfmon_model.h" -#include "perfmon.hrh" -#include "perfmon_std.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); - - ((*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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_valuescontainer.cpp --- a/perfmon/ui/avkon/src/perfmon_valuescontainer.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/avkon/src/perfmon_valuesview.cpp --- a/perfmon/ui/avkon/src/perfmon_valuesview.cpp Mon Aug 23 15:50:54 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/app.pro --- a/perfmon/ui/hb/app/app.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -# -# 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 - - SOURCES += ../../../engine/src/perfmon_engine.cpp - - LIBS += -lestor \ - -lbafl \ - -lefsrv \ - -lavkon \ - -lapparc \ - -lapgrfx \ - -lgdi \ - -lcone - - 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/application.h --- a/perfmon/ui/hb/app/inc/application.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/datacontainer.h --- a/perfmon/ui/hb/app/inc/datacontainer.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/datapopup.h --- a/perfmon/ui/hb/app/inc/datapopup.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/enginewrapper.h --- a/perfmon/ui/hb/app/inc/enginewrapper.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* -* 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; } - -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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/graphdatacontainer.h --- a/perfmon/ui/hb/app/inc/graphdatacontainer.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/mainview.h --- a/perfmon/ui/hb/app/inc/mainview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/mainwindow.h --- a/perfmon/ui/hb/app/inc/mainwindow.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/popupdatacontainer.h --- a/perfmon/ui/hb/app/inc/popupdatacontainer.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/settingsview.h --- a/perfmon/ui/hb/app/inc/settingsview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* -* 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* mPopupVisibilityItem; - HbDataFormModelItem* mPopupLocationItem; - HbDataFormModelItem* mPopupSourcesItem; - HbDataFormModelItem* mVerticalBarPeriodItem; - HbDataFormModelItem* mGraphSourcesItem; - - HbDataFormModelItem* mLogPage; - HbDataFormModelItem* mLogModeItem; - HbDataFormModelItem* mLogFilePathItem; - HbDataFormModelItem* mLogSourcesItem; - - QString mLogFilePath; -}; - -#endif // SETTINGSVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/inc/valuedatacontainer.h --- a/perfmon/ui/hb/app/inc/valuedatacontainer.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/application.cpp --- a/perfmon/ui/hb/app/src/application.cpp Mon Aug 23 15:50:54 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: -* -*/ - -#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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/datapopup.cpp --- a/perfmon/ui/hb/app/src/datapopup.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* -* 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(); - 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', 0); - lines.append(text); - } - else - { - // RAM and Drives - QString text = tr("%1 free %L2%3").arg(entry.description()). - arg(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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/enginewrapper.cpp --- a/perfmon/ui/hb/app/src/enginewrapper.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* 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; -} - -// --------------------------------------------------------------------------- - -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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/graphdatacontainer.cpp --- a/perfmon/ui/hb/app/src/graphdatacontainer.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/main.cpp --- a/perfmon/ui/hb/app/src/main.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* 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(); - -// 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/mainview.cpp --- a/perfmon/ui/hb/app/src/mainview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* -* 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.1.1 - 21st May 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/mainwindow.cpp --- a/perfmon/ui/hb/app/src/mainwindow.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/popupdatacontainer.cpp --- a/perfmon/ui/hb/app/src/popupdatacontainer.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* 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 - { - // 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/settingsview.cpp --- a/perfmon/ui/hb/app/src/settingsview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,266 +0,0 @@ -/* -* 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:"); - -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")); - - // 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); - - 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.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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/app/src/valuedatacontainer.cpp --- a/perfmon/ui/hb/app/src/valuedatacontainer.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* 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; - - for (int i=0; i 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++; - } - else 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++; - } - } -} diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/datapopup.pro --- a/perfmon/ui/hb/datapopup/datapopup.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -# -# 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 = /private/20011385 - DEPLOYMENT += pluginstub -} \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/inc/perfmondatapopupdialog_p.h --- a/perfmon/ui/hb/datapopup/inc/perfmondatapopupdialog_p.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/inc/perfmondatapopupplugin_p.h --- a/perfmon/ui/hb/datapopup/inc/perfmondatapopupplugin_p.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/inc/perfmondatapopuppluginerrors_p.h --- a/perfmon/ui/hb/datapopup/inc/perfmondatapopuppluginerrors_p.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/inc/perfmondatapopupwidget_p.h --- a/perfmon/ui/hb/datapopup/inc/perfmondatapopupwidget_p.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/src/perfmondatapopupdialog.cpp --- a/perfmon/ui/hb/datapopup/src/perfmondatapopupdialog.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* -* 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); - - 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())); - } - 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/src/perfmondatapopupplugin.cpp --- a/perfmon/ui/hb/datapopup/src/perfmondatapopupplugin.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* 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->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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/datapopup/src/perfmondatapopupwidget.cpp --- a/perfmon/ui/hb/datapopup/src/perfmondatapopupwidget.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/win/enginewrapper.cpp --- a/perfmon/ui/hb/win/enginewrapper.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,114 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/win/enginewrapper.h --- a/perfmon/ui/hb/win/enginewrapper.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,270 +0,0 @@ -/* -* 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 5db69f4c3d06 -r b048e15729d6 perfmon/ui/hb/win/win.pro --- a/perfmon/ui/hb/win/win.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -# -# 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 5db69f4c3d06 -r b048e15729d6 piprofilerui/group/bld.inf --- a/piprofilerui/group/bld.inf Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies 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 "bld_generic.inf" -#include "../ui/avkon/group/bld.inf" - - - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/group/bld_generic.inf --- a/piprofilerui/group/bld_generic.inf Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* -* 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: -* -*/ - -PRJ_MMPFILES -PRJ_EXTENSIONS - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/group/group.pro --- a/piprofilerui/group/group.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -# -# 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 5db69f4c3d06 -r b048e15729d6 piprofilerui/piprofilerui.pro --- a/piprofilerui/piprofilerui.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -# -# 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 5db69f4c3d06 -r b048e15729d6 piprofilerui/sis/PIProfiler_S60-30.pkg --- a/piprofilerui/sis/PIProfiler_S60-30.pkg Mon Aug 23 15:50:54 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: -; -&EN - -; Standard SIS file header -#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU - -; Supports S60 v 3.0 and 5.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" -"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" -"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" -"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" -"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" -"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/sis/PIProfiler_S60-31.pkg --- a/piprofilerui/sis/PIProfiler_S60-31.pkg Mon Aug 23 15:50:54 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: -; -&EN - -; Standard SIS file header -#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU - -; Supports S60 v 3.0 and 5.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" -"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" -"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" -"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" -"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" -"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/sis/PIProfiler_S60-32.pkg --- a/piprofilerui/sis/PIProfiler_S60-32.pkg Mon Aug 23 15:50:54 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: -; -&EN - -; Standard SIS file header -#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU - -; Supports S60 v 3.0 and 5.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" -"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" -"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" -"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" -"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" -"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/sis/PIProfiler_S60-50.pkg --- a/piprofilerui/sis/PIProfiler_S60-50.pkg Mon Aug 23 15:50:54 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: -; -&EN - -; Standard SIS file header -#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU - -; Supports S60 v 3.0 and 5.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" -"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" -"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" -"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" -"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" -"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/sis/PIProfiler_Symbian3.pkg --- a/piprofilerui/sis/PIProfiler_Symbian3.pkg Mon Aug 23 15:50:54 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: -; -&EN - -; Standard SIS file header -#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU - -; Supports S60 v 3.0 and 5.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" -"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" -"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" -"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" -"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" -"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/sis/PIProfiler_Symbian4.pkg --- a/piprofilerui/sis/PIProfiler_Symbian4.pkg Mon Aug 23 15:50:54 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: -; -&EN - -; Standard SIS file header -#{"PIProfilerUI"},(0x2001E5AE),2,2,01,TYPE=SA, RU - -; Supports S60 v 3.0 and 5.0 -[0x101F7961], 0, 0, 0, {"S60ProductID"} - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -"\epoc32\RELEASE\armv5\urel\PIProfilerUI.exe"-"!:\sys\bin\PIProfilerUI.exe" -"\epoc32\data\z\Resource\apps\piprofilerui_aif.mif"-"!:\Resource\Apps\piprofilerui_aif.mif" -"\epoc32\data\z\Resource\apps\piprofilerui_ExtraIcons.mif"-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" -"\epoc32\data\z\Resource\apps\piprofilerui.rsc"-"!:\Resource\Apps\piprofilerui.rsc" -"\epoc32\data\z\PRIVATE\10003A3F\APPS\piprofilerui_reg.rsc"-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" -"..\ui\avkon\group\backup_registration.xml"-"!:\private\2001E5AE\backup_registration.xml" - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/sis/PIProfiler_stub.pkg --- a/piprofilerui/sis/PIProfiler_stub.pkg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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: -; -&EN - -; Standard SIS file header -#{"ProfilerGUI"},(0x2001E5AE),1,0,0 - -; Non-localised vendor name -:"Nokia Corporation" - -; Localised vendor names -%{"Nokia Corporation"} - -; normal stuff: -""-"!:\sys\bin\PIProfilerUI.exe" -""-"!:\Resource\Apps\piprofilerui_aif.mif" -""-"!:\Resource\Apps\piprofilerui_ExtraIcons.mif" -""-"!:\Resource\Apps\piprofilerui.rsc" -""-"!:\private\10003a3f\import\apps\piprofilerui_reg.rsc" -""-"!:\private\2001E5AE\backup_registration.xml" diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/data/piprofilerui.rss --- a/piprofilerui/ui/avkon/data/piprofilerui.rss Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,962 +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: -* -*/ - - - - -NAME PIPR - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "profiler_gui.hrh" -#include "profiler_gui_std.h" -#include -#include - - -// --------------------------------------------------------- -// -// Define the resource file signature -// This resource should be empty. -// -// --------------------------------------------------------- -// -RESOURCE RSS_SIGNATURE { } - -// --------------------------------------------------------- -// -// Default Document Name -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_default_document_name { buf=""; } - -// --------------------------------------------------------- -// -// Define default menu and CBA key. -// -// --------------------------------------------------------- -// -RESOURCE EIK_APP_INFO { } - -//---------------------------------------------------- -// -// r_profiler_gui_hotkeys -// -//---------------------------------------------------- -// -RESOURCE HOTKEYS r_profiler_gui_hotkeys - { - control= - { - HOTKEY { command=EAknCmdExit; key='e'; } - }; - } - - -//---------------------------------------------------- -// r_profiler_gui_view_main -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_profiler_gui_view_main - { - hotkeys=r_profiler_gui_hotkeys; - menubar=r_profiler_gui_menubar_view_main; - cba=R_AVKON_SOFTKEYS_OPTIONS_EXIT; - } - -//---------------------------------------------------- -// r_profiler_gui_menubar_view_main -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_profiler_gui_menubar_view_main - { - titles= - { - MENU_TITLE { menu_pane=r_profiler_gui_app_menu; txt="App"; }, - MENU_TITLE { menu_pane=r_profiler_gui_view_main_menu; txt="Main"; } - }; - } - -//---------------------------------------------------- -// r_profiler_gui_view_main_menu -//---------------------------------------------------- -// - -RESOURCE MENU_PANE r_profiler_gui_view_main_menu - { - items= - { - }; - } - - - -//---------------------------------------------------- -// r_profiler_gui_app_menu -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_profiler_gui_app_menu - { - items= - { - MENU_ITEM { command=EProfilerGuiCmdStartAll;cascade = r_profiler_start_submenu; txt="Start"; }, - MENU_ITEM { command=EProfilerGuiCmdStopAll; txt="Stop profiling"; }, - MENU_ITEM { command=EProfilerGuiCmdSamplerControl; txt="Sampler control"; cascade=r_profiler_sampler_control_menu; }, - MENU_ITEM { command=EProfilerGuiCmdSettings; txt="Settings"; }, - MENU_ITEM { command=EProfilerGuiCmdAbout; txt="About"; }, - MENU_ITEM { command=EAknCmdExit; txt="Exit"; } - }; - } - -//---------------------------------------------------- -// r_profiler_start_submenu -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_profiler_start_submenu - { - items = - { - MENU_ITEM - { - command = EProfilerGuiCmdStartAll; - txt = "Profiling"; - } - }; - } - -//---------------------------------------------------- -// r_profiler_sampler_control_menu -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_profiler_sampler_control_menu - { - items= - { - MENU_ITEM { command=EProfilerGuiCmdSamplerEnable; txt="Enable"; }, - MENU_ITEM { command=EProfilerGuiCmdSamplerDisable; txt="Disable"; }, - MENU_ITEM { command=EProfilerGuiCmdSamplerSettings; txt="Sampler settings"; }, - MENU_ITEM { command=EProfilerGuiCmdSamplerInfo; txt="Sampler info"; } - }; - } - - -//---------------------------------------------------- -// r_profiler_gui_settings_dialog -// Dialog for setting list -//---------------------------------------------------- -// -RESOURCE DIALOG r_profiler_gui_settings_dialog - { - flags = - EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | - EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | - EEikDialogFlagWait | EEikDialogFlagNoTitleBar; - buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; - items = - { - DLG_LINE - { - type = EAknCtSettingListBox; - id = EProfilerGuiSettingItemList; - itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; - control = LISTBOX - { - flags = EAknListBoxSelectionList; - }; - } - }; - } - -// generic resources -RESOURCE POPUP_SETTING_LIST r_popup_setting_list_editor - { - } -RESOURCE AVKON_SETTING_PAGE r_binary_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_yesno_binaryselection_texts - { - setting_texts_resource = r_yesno_binaryselection_text_array; - } -RESOURCE ARRAY r_yesno_binaryselection_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=0; text = "No"; }, - AVKON_ENUMERATED_TEXT { value=1; text = "Yes"; } - }; - } - - -// -// resources for plugin name mode selection -// -RESOURCE TBUF r_plugin_name_mode_setting_title - { - buf = "Sampler name length"; - } -RESOURCE AVKON_SETTING_PAGE r_plugin_name_mode_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_plugin_name_mode_setting_texts - { - setting_texts_resource = r_plugin_name_mode_text_array; - } -RESOURCE ARRAY r_plugin_name_mode_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=ESamplerNameShort; text = "Short"; }, - AVKON_ENUMERATED_TEXT { value=ESamplerNameMedium; text = "Medium"; }, - AVKON_ENUMERATED_TEXT { value=ESamplerNameLong; text = "Long"; } - }; - } - - -// -// resources for trace output selection -// -RESOURCE TBUF r_trace_output_setting_title - { - buf = "Output to"; - } -RESOURCE AVKON_SETTING_PAGE r_trace_output_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_trace_output_setting_texts - { - setting_texts_resource = r_trace_output_text_array; - } -RESOURCE ARRAY r_trace_output_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=EOutputToDebugPort; text = "Debug output"; }, - AVKON_ENUMERATED_TEXT { value=EOutputToFileSystem; text = "File system"; } - }; - } - - -// -// resources for save_file_prefix selection -// -RESOURCE TBUF r_save_file_prefix_setting_title - { - buf = "File prefix"; - } -RESOURCE AVKON_SETTING_PAGE r_save_file_prefix_setting_page - { - type = EEikCtEdwin; - editor_resource_id = r_save_file_prefix_text_editor; - } - -RESOURCE EDWIN r_save_file_prefix_text_editor - { - lines = 0; // expanding to multiple rows - maxlength = 63; - flags = EEikEdwinNoLineOrParaBreaks; - } - -// -// resources for save file drive selection -// -RESOURCE TBUF r_save_file_drive_setting_title - { - buf = "Save file in"; - } -RESOURCE AVKON_SETTING_PAGE r_save_file_drive_setting_page - { - type = EEikCtEdwin; - editor_resource_id = r_save_file_drive_text_editor; - } - -RESOURCE EDWIN r_save_file_drive_text_editor - { - lines = 0; // expanding to multiple rows - maxlength = 63; - flags = EEikEdwinNoLineOrParaBreaks; - } - -// -// resources for trace mode selection -// -RESOURCE TBUF r_trace_mode_setting_title - { - buf = "Trace mode"; - } -RESOURCE AVKON_SETTING_PAGE r_trace_mode_setting_page - { - number = EAknSettingPageNoOrdinalDisplayed; - type = EAknCtPopupSettingList; - editor_resource_id = r_popup_setting_list_editor; - } -RESOURCE AVKON_POPUP_SETTING_TEXTS r_trace_mode_setting_texts - { - setting_texts_resource = r_trace_mode_text_array; - } -RESOURCE ARRAY r_trace_mode_text_array - { - items = - { - AVKON_ENUMERATED_TEXT { value=ETraceModeStream; text = "Stream"; }, - AVKON_ENUMERATED_TEXT { value=ETraceModeBuffer; text = "Memory buffer"; } - }; - } - -// -// resources for timed_sampling_period selection -// -RESOURCE TBUF r_timed_sampling_period_setting_title - { - buf = "Profiling period (sec.)"; - } -RESOURCE AVKON_SETTING_PAGE r_timed_sampling_period_setting_page - { - type = EAknCtIntegerEdwin; - editor_resource_id = r_timed_sampling_period_integer_editor; - } - -RESOURCE AVKON_INTEGER_EDWIN r_timed_sampling_period_integer_editor - { - maxlength = 6; - min = 1; - max = 999999; - } - - -//---------------------------------------------------- -// r_profiler_gui_settings_menubar -//---------------------------------------------------- -// - -RESOURCE MENU_BAR r_profiler_gui_settings_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_profiler_gui_settings_menupane; - txt = " "; // dummy - } - }; - } - -RESOURCE MENU_PANE r_profiler_gui_settings_menupane - { - items = - { - MENU_ITEM - { - command = EProfilerGuiCmdSettingsChange; - txt = "Change"; - }, - MENU_ITEM - { - command = EProfilerGuiCmdSettingsExit; - txt = "Exit"; - } - }; - } - -//---------------------------------------------------- -// r_profiler_gui_settings_dialog -// Dialog for setting list -//---------------------------------------------------- -// -RESOURCE DIALOG r_profiler_sampler_settings_dialog - { - flags = - EEikDialogFlagNoDrag | EEikDialogFlagFillAppClientRect | - EEikDialogFlagButtonsRight | EEikDialogFlagCbaButtons | - EEikDialogFlagWait | EEikDialogFlagNoTitleBar; - buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK; - items = - { - DLG_LINE - { - type = EAknCtSettingListBox; - id = EProfilerSamplerSettingItemList; - itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; - control = LISTBOX - { - flags = EAknListBoxSelectionList; - }; - } - }; - } - -//---------------------------------------------------- -// r_profiler_sampler_settings_menubar -//---------------------------------------------------- -// - -RESOURCE MENU_BAR r_profiler_sampler_settings_menubar - { - titles = - { - MENU_TITLE - { - menu_pane = r_profiler_sampler_settings_menupane; - txt = "Sampler settings"; - } - }; - } - -RESOURCE MENU_PANE r_profiler_sampler_settings_menupane - { - items = - { - MENU_ITEM - { - command = EProfilerGuiCmdSettingsChange; - txt = "Change"; - }, - MENU_ITEM - { - command = EProfilerGuiCmdSettingsExit; - txt = "Exit"; - } - }; - } - - -// --------------------------------------------------------- -// -// r_profiler_gui_about_dialog -// About dialog - show version and copyright info etc. -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_profiler_gui_about_dialog - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = "About Profiler"; - headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - 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."; - }; - } - }; - } - -// --------------------------------------------------------- -// r_sampler_rate_setting_page -// --------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_sampler_rate_setting_page - { - type = EAknCtIntegerEdwin; - editor_resource_id = r_sampler_rate_integer_editor; - } -RESOURCE AVKON_INTEGER_EDWIN r_sampler_rate_integer_editor - { - maxlength = 6; - min = 250; - max = 999999; - } - -// --------------------------------------------------------- -// r_cpu_sampler_rate_setting_page -// --------------------------------------------------------- -// -RESOURCE AVKON_SETTING_PAGE r_cpu_sampler_rate_setting_page - { - type = EAknCtIntegerEdwin; - editor_resource_id = r_cpu_sampler_rate_integer_editor; - } -RESOURCE AVKON_INTEGER_EDWIN r_cpu_sampler_rate_integer_editor - { - maxlength = 5; - min = 1; - max = 10000; - } - -// --------------------------------------------------------- -// -// r_generic_sampler_dlg_line_sample_rate -// Empty about dialog - show sampler plugin info in this -// -// --------------------------------------------------------- -// -RESOURCE DLG_LINE r_generic_sampler_dlg_line_sample_rate - { - type = EEikCtNumberEditor; - prompt = "Sample rate (ms)"; - id = EProfilerGuiGenericSamplerQuerySampleRate; - itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys; - control = NUMBER_EDITOR - { - min = 1000; - max = 10000; - }; - } - -// --------------------------------------------------------- -// -// r_profiler_gui_empty_about_dialog -// Empty about dialog - show sampler plugin info in this -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_profiler_gui_empty_about_dialog - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = "About"; - headinglayout = R_AVKON_WML_SIGN_QUERY_HEADING_PANE; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - message = ""; - }; - } - }; - } - - -RESOURCE TBUF r_dummy_setting_title - { - buf = ""; - } - -RESOURCE TBUF r_sample_rate_setting_title - { - buf = "Sample rate (ms)"; - } - -RESOURCE TBUF r_item1_setting_title - { - buf = "Item1"; - } - -RESOURCE TBUF r_item2_setting_title - { - buf = "Item2"; - } - -RESOURCE TBUF r_item3_setting_title - { - buf = "Item3"; - } - -RESOURCE TBUF r_item4_setting_title - { - buf = "Item4"; - } - -RESOURCE TBUF r_item5_setting_title - { - buf = "Item5"; - } - -RESOURCE TBUF r_item6_setting_title - { - buf = "Item6"; - } - -RESOURCE AVKON_SETTING_PAGE r_numeric_setting_page - { - type = EAknCtIntegerEdwin; - editor_resource_id = r_numeric_integer_editor; - } -RESOURCE AVKON_INTEGER_EDWIN r_numeric_integer_editor - { - maxlength = 5; - min = 0; - max = 10000; - } - -// -// resources for text selection -// -RESOURCE AVKON_SETTING_PAGE r_generic_text_setting_page - { - type = EEikCtEdwin; - editor_resource_id = r_generic_text_editor; - } - -RESOURCE EDWIN r_generic_text_editor - { - lines = 0; // expanding to multiple rows - maxlength = 63; - flags = EEikEdwinNoLineOrParaBreaks; - } - - -// --------------------------------------------------------- -// r_general_confirmation_query -// --------------------------------------------------------- -// - -RESOURCE DIALOG r_general_confirmation_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - }; - } - }; - } - -// --------------------------------------------------------- -// r_general_text_query -// --------------------------------------------------------- -// -RESOURCE DIALOG r_general_text_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - control = EDWIN - { - width = 256; - lines = 3; - maxlength = 256; - }; - }; - } - }; - } - -// --------------------------------------------------------- -// r_general_text_query -// --------------------------------------------------------- -// -RESOURCE DIALOG r_general_numeric_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = ENumberLayout; - control = AVKON_INTEGER_EDWIN - { - min = -999999; - max = 999999; - }; - }; - } - }; - } - - -// --------------------------------------------------------- -// r_item_action_query -// --------------------------------------------------------- -// -RESOURCE DIALOG r_item_action_query_enabled - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control= AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_item_action_query_array_enabled; - }; - heading = "Sampler controls"; - }; - } - }; - } - -RESOURCE DIALOG r_item_action_query_disabled - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control= AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_item_action_query_array_disabled; - }; - heading = "Sampler controls"; - }; - } - }; - } - -RESOURCE DIALOG r_item_action_query_hidden_settings_enabled - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control= AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_item_action_query_array_hidden_settings_enabled; - }; - heading = "Sampler controls"; - }; - } - }; - } - -RESOURCE DIALOG r_item_action_query_hidden_settings_disabled - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control= AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_item_action_query_array_hidden_settings_disabled; - }; - heading = "Sampler controls"; - }; - } - }; - } - -RESOURCE DIALOG r_item_action_query_hidden_start_stop - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - AVKON_LIST_QUERY_DLG_LINE - { - control= AVKON_LIST_QUERY_CONTROL - { - listtype = EAknCtSinglePopupMenuListBox; - listbox = AVKON_LIST_QUERY_LIST - { - array_id = r_item_action_query_array_hidden_start_stop; - }; - heading = "Sampler controls"; - }; - } - }; - } - -RESOURCE ARRAY r_item_action_query_array_disabled - { - items = - { - LBUF {txt = "Enable"; }, - LBUF {txt = "Sampler settings"; }, - LBUF {txt = "Sampler info"; } - }; - } - -RESOURCE ARRAY r_item_action_query_array_enabled - { - items = - { - LBUF {txt = "Disable"; }, - LBUF {txt = "Sampler settings"; }, - LBUF {txt = "Sampler info"; } - }; - } - -RESOURCE ARRAY r_item_action_query_array_hidden_settings_disabled - { - items = - { - LBUF {txt = "Enable"; }, - LBUF {txt = "Sampler info"; } - }; - } - -RESOURCE ARRAY r_item_action_query_array_hidden_settings_enabled - { - items = - { - LBUF {txt = "Disable"; }, - LBUF {txt = "Sampler info"; } - }; - } - -RESOURCE ARRAY r_item_action_query_array_hidden_start_stop - { - items = - { - LBUF {txt = "Sampler settings"; }, - LBUF {txt = "Sampler info"; } - }; - } - -RESOURCE STATUS_PANE_APP_MODEL r_profiler_gui_status_pane - { - panes = - { - SPANE_PANE - { - id = EEikStatusPaneUidTitle; - type = EAknCtTitlePane; - resource = r_profiler_gui_title_resource; - }, - SPANE_PANE - { - id = EEikStatusPaneUidNavi; - type = EAknCtNaviPane; - resource = r_profiler_gui_navi_text_idle; - } - }; - } - -RESOURCE TITLE_PANE r_profiler_gui_title_resource - { - txt = "PI Profiler"; - } - -RESOURCE TBUF r_profiler_gui_navi_text_idle - { - buf = "Idle"; - } - -RESOURCE TBUF r_profiler_gui_navi_text_initializing - { - buf = "Initializing..."; - } - -RESOURCE TBUF r_profiler_gui_navi_text_running - { - buf = "Profiling..."; - } - -RESOURCE TBUF r_profiler_gui_navi_text_stopping - { - buf = "Stopping..."; - } - -RESOURCE DIALOG r_profiler_gui_conf_query - { - flags = EAknGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EProfilerGuiViewConfQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - label = "Leave profiling on?"; - }; - } - }; - } - -// -// RESOURCE LOCALISABLE_APP_INFO -// -// --------------------------------------------------------- -// -RESOURCE LOCALISABLE_APP_INFO r_profiler_gui_localisable_app_info - { - short_caption = "PI Profiler"; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = "PI Profiler"; - - number_of_icons = 1; - - // Note for ROM-based apps it is recommended to add the drive letter - icon_file = APP_BITMAP_DIR"\\piprofilerui_aif.mif"; - }; - } diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/data/piprofilerui_reg.rss --- a/piprofilerui/ui/avkon/data/piprofilerui_reg.rss Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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 - - -UID2 KUidAppRegistrationResourceFile -UID3 0x2001E5AE - - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "PIProfilerUI"; - localisable_resource_file = APP_RESOURCE_DIR"\\PIProfilerUI"; - localisable_resource_id = R_PROFILER_GUI_LOCALISABLE_APP_INFO; - group_name = "RnD Tools"; - } diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/group/backup_registration.xml --- a/piprofilerui/ui/avkon/group/backup_registration.xml Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/group/bld.inf --- a/piprofilerui/ui/avkon/group/bld.inf Mon Aug 23 15:50:54 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 - - -PRJ_EXPORTS -../group/backup_registration.xml Z:/private/2001E5AE/backup_registration.xml -../rom/piprofilerui_avkon.iby CORE_IBY_EXPORT_PATH(tools,piprofilerui.iby) - -PRJ_MMPFILES -#ifndef SBSV2 - gnumakefile piprofilerui_icons_aif.mk - gnumakefile piprofilerui_extraicons.mk -#endif - -piprofilerui.mmp - - -#ifdef SBSV2 - PRJ_EXTENSIONS - START EXTENSION s60/mifconv - OPTION TARGETFILE piprofilerui_aif.mif - OPTION SOURCEDIR ../../icons - OPTION SOURCES -c8,8 qgn_menu_piprofilerui - END - - START EXTENSION s60/mifconv - OPTION TARGETFILE piprofilerui_extraicons.mif - OPTION HEADERFILE piprofilerui_extraicons.mbg - OPTION SOURCEDIR ../../icons - OPTION SOURCES -c8,8 qgn_prob_piprofilerui_status_disabled -c8,8 qgn_prob_piprofilerui_status_enabled - END -#endif diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/group/piprofilerui.mmp --- a/piprofilerui/ui/avkon/group/piprofilerui.mmp Mon Aug 23 15:50:54 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 -#include - - -TARGET PIProfilerUI.exe -TARGETTYPE exe -EPOCSTACKSIZE 0x8000 -EPOCHEAPSIZE 0x10000 0x1000000 // Min 64Kb, Max 16Mb - -UID 0x100039CE 0x2001E5AE - -VENDORID VID_DEFAULT -CAPABILITY ALL -TCB //swevent networkservices -SMPSAFE - -LANG SC - -START RESOURCE ../data/piprofilerui.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -END - -START RESOURCE ../data/piprofilerui_reg.rss -DEPENDS piprofilerui.rsg -TARGETPATH /private/10003a3f/apps -END - -APP_LAYER_SYSTEMINCLUDE -USERINCLUDE ../inc -SOURCEPATH ../src - - -SOURCE profiler_gui_app.cpp -SOURCE profiler_gui_document.cpp -SOURCE profiler_gui_appui.cpp -SOURCE profiler_gui_model.cpp -SOURCE profiler_gui_mainview.cpp -SOURCE profiler_gui_maincontainer.cpp -SOURCE profiler_gui_settingsviewdlg.cpp -SOURCE profiler_gui_samplersettingsviewdlg.cpp - - -LIBRARY euser.lib -LIBRARY eiksrv.lib -LIBRARY CommonEngine.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY eikctl.lib -LIBRARY eikdlg.lib -LIBRARY avkon.lib -LIBRARY ws32.lib -LIBRARY apgrfx.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY gdi.lib -LIBRARY aknnotify.lib -LIBRARY aknicon.lib -LIBRARY aknskins.lib -LIBRARY aknskinsrv.lib -LIBRARY egul.lib -LIBRARY estor.lib -LIBRARY flogger.lib -LIBRARY charconv.lib -LIBRARY sysutil.lib -LIBRARY platformenv.lib diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk --- a/piprofilerui/ui/avkon/group/piprofilerui_extraicons.mk Mon Aug 23 15:50:54 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=$(EPOCROOT)epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_extraicons.mif - -HEADERDIR=$(EPOCROOT)epoc32\include -HEADERFILENAME=$(HEADERDIR)\piprofilerui_extraicons.mbg - - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : - @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) - @if exist $(HEADERFILENAME) erase $(HEADERFILENAME) - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : $(ICONTARGETFILENAME) - -$(ICONTARGETFILENAME) (HEADERFILENAME) : ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c8,8 ..\..\icons\qgn_prob_piprofilerui_status_disabled.svg \ - /c8,8 ..\..\icons\qgn_prob_piprofilerui_status_enabled.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME) && \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk --- a/piprofilerui/ui/avkon/group/piprofilerui_icons_aif.mk Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=$(EPOCROOT)epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\piprofilerui_aif.mif - - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : - @if exist $(ICONTARGETFILENAME) erase $(ICONTARGETFILENAME) - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : $(ICONTARGETFILENAME) - -$(ICONTARGETFILENAME) : ..\..\icons\qgn_menu_piprofilerui.svg - mifconv $(ICONTARGETFILENAME) \ - /c8,8 ..\..\icons\qgn_menu_piprofilerui.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui.hrh --- a/piprofilerui/ui/avkon/inc/profiler_gui.hrh Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +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 PROFILERGUI_HRH -#define PROFILERGUI_HRH - -enum TProfilerCmdSamplerIds - { - EProfilerGuiCmdSamplerEnable = 1, // id cannot be 0 - EProfilerGuiCmdSamplerDisable, - EProfilerGuiCmdSamplerSettings, - EProfilerGuiCmdSamplerInfo - }; - -enum TSamplerSettingItemIds - { - EProfilerGuiGenericSamplerQuerySampleRate = 0, - EProfilerGuiGenericSamplerQueryItem1, - EProfilerGuiGenericSamplerQueryItem2, - EProfilerGuiGenericSamplerQueryItem3, - EProfilerGuiGenericSamplerQueryItem4, - EProfilerGuiGenericSamplerQueryItem5, - EProfilerGuiGenericSamplerQueryItem6 - }; - -enum TGeneralSettingItemIds - { - ESettingListItemPluginTraceOutput = 0, - ESettingListItemPluginSaveFileDrive, - ESettingListItemPluginTraceFilePrefix, - ESettingListItemPluginSamplingTime - }; - -enum TProfilerGuiCommandIds - { - EProfilerGuiCmdStart = 1000, - EProfilerGuiCmdStop, - EProfilerGuiCmdStartAll, - EProfilerGuiCmdStartTimed, - EProfilerGuiCmdStopAll, - - EProfilerGuiCmdSamplerControl, - EProfilerGuiCmdSamplerSettingsChange, - EProfilerGuiCmdSamplerSettingsExit, - - EProfilerGuiCmdSettings, - EProfilerGuiCmdSettingsChange, - EProfilerGuiCmdSettingsExit, - EProfilerGuiCmdSettingsBack, - - EProfilerGuiCmdAbout, - - EProfilerGuiViewConfQuery, - EProfilerGuiSettingItemList, - EProfilerSamplerSettingItemList - }; - -enum TProfilerGuiSettingSamplerNameLength - { - ESamplerNameShort, - ESamplerNameMedium, - ESamplerNameLong - }; - -enum TProfilerGuiSettingTraceMode - { - ETraceModeStream, - ETraceModeBuffer - }; - -enum TProfilerGuiSettingOutputMode - { - EOutputToDebugPort = 0, - EOutputToFileSystem - }; - -enum TProfilerGuiSettingSaveFileDrive - { - ETraceSaveFileDriveC, - ETraceSaveFileDriveD, - ETraceSaveFileDriveE, - ETraceSaveFileDriveF, - ETraceSaveFileDriveG, - ETraceSaveFileDriveH, - ETraceSaveFileDriveI, - ETraceSaveFileDriveJ, - ETraceSaveFileDriveK, - ETraceSaveFileDriveL - }; - -enum TItemActionMenuTypes - { - EItemActionMenuTypeEnable = 0, - EItemActionMenuTypeDisable, - EItemActionMenuTypeEditSettings, - EItemActionMenuTypeInfo, - EItemActionMenuTypeStart, // for future use - EItemActionMenuTypeStop // for future use - }; - -#endif // PROFILERGUI_HRH diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_app.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_app.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +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 PROFILER_GUI_APP_H -#define PROFILER_GUI_APP_H - - -// INCLUDES -#include - -// CONSTANTS -// UID of the application -const TUid KUidProfilerGui = { 0x2001E5AE }; - -// CLASS DECLARATION - -/** -* CProfilerGuiApp application class. -* Provides factory to create concrete document object. -* -*/ -class CProfilerGuiApp : public CAknApplication - { - - public: // Functions from base classes - - private: - - /** - * From CApaApplication, creates CProfilerGuiDocument document object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication, returns application's UID (KUidProfilerGui). - * @return The value of KUidProfilerGui. - */ - TUid AppDllUid() const; - }; - -#endif - -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_appui.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_appui.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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 PROFILER_GUI_APPUI_H -#define PROFILER_GUI_APPUI_H - -// INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include "profiler_gui_std.h" - -// profiler engine inclusions -#include - -// FORWARD DECLARATIONS -class CProfilerGuiModel; - -// CLASS DECLARATIONS - -class CProfilerGuiAppUi : public CAknViewAppUi - { -public: // constructors and destructor - void ConstructL(); - ~CProfilerGuiAppUi(); - - // profiler specific - void StartProfilerL(); - void StopProfilerL(); -private: // From MEikMenuObserver - void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); - -private: - void HandleCommandL(TInt aCommand); - virtual TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); - void HandleSystemEventL(const TWsEvent& aEvent); - - void SaveSettingsL(); - void LoadSettingsL(); - TInt RunConfQueryL( const TDesC* aOverrideText ); -private: //Data - CProfilerGuiModel* iModel; - }; - -#endif - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_attributes.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_attributes.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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 PROFILER_GUI_ATTRIBUTES_H -#define PROFILER_GUI_ATTRIBUTES_H - -// INCLUDES -#include -#include - -// CONSTANTS - -// FORWARD DECLARATIONS - -// CLASS DECLARATIONS - -#endif diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_document.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_document.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +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 PROFILER_GUI_DOCUMENT_H -#define PROFILER_GUI_DOCUMENT_H - -// INCLUDES -#include - -// CONSTANTS - -// FORWARD DECLARATIONS -class CEikAppUi; -class CProfilerGuiModel; - - -// CLASS DECLARATION - -/** -* CProfilerGuiDocument application class. -*/ -class CProfilerGuiDocument : public CAknDocument - { - public: // Constructors and destructor - static CProfilerGuiDocument* NewL(CEikApplication& aApp); - virtual ~CProfilerGuiDocument(); - - public: // New functions - - public: // from CEikDocument - - protected: // New functions - - protected: // Functions from base classes - - private: - - /** - * EPOC default constructor. - */ - CProfilerGuiDocument(CEikApplication& aApp); - void ConstructL(); - - private: - - /** - * From CEikDocument, create CProfilerGuiAppUi "App UI" object. - */ - CEikAppUi* CreateAppUiL(); - - public: - inline CProfilerGuiModel* Model() { return iModel; } - - private: - CProfilerGuiModel* iModel; - - }; - -#endif - -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_maincontainer.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +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 PROFILER_GUI_VALUESCONTAINER_H -#define PROFILER_GUI_VALUESCONTAINER_H - -// INCLUDES -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CProfilerGuiModel; -class CAknInfoPopupNoteController; - -// CLASS DECLARATIONS - -class CProfilerGuiMainContainer : public CCoeControl, MCoeControlObserver, MEikListBoxObserver - { -public: - void ConstructL(const TRect& aRect); - ~CProfilerGuiMainContainer(); - -private: - void SizeChanged(); - TInt CountComponentControls() const; - CCoeControl* ComponentControl(TInt aIndex) const; - void Draw(const TRect& aRect) const; - void HandleResourceChange(TInt aType); - void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); // From MEikListBoxObserver - void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); // From MCoeControlObserver - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); - -public: - const CArrayFix* ListBoxSelectionIndexes(); - TInt ListBoxSelectionIndexesCount(); - void SetDefaultTitlePaneTextL(); - TInt CurrentListBoxItemIndex(); - void SetListBoxTextArrayL(CDesCArray* aTextArray); - inline CAknSingleGraphicStyleListBox* ListBox() { return iListBox; } - void ShowWriterInfoPopupL(const TDesC& aNote); -private: - CProfilerGuiModel* iModel; - CAknSingleGraphicStyleListBox* iListBox; - CAknInfoPopupNoteController* iInfoPopup; - }; - -#endif - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_mainview.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_mainview.h Mon Aug 23 15:50:54 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: -* -*/ - - - -#ifndef PROFILER_GUI_VALUESVIEW_H -#define PROFILER_GUI_VALUESVIEW_H - -// INCLUDES -#include - -#include "profiler_gui_std.h" -#include "profiler_gui_model.h" - - -// CONSTANTS -// UID of view -const TUid KMainViewUID = {1}; - -// FORWARD DECLARATIONS -class CProfilerGuiMainContainer; -class CProfilerGuiModel; -class CProfilerEngineStatusChecker; -class CAknNavigationDecorator; - - -/** -* CProfilerGuiMainView view class. -* -*/ -class CProfilerGuiMainView : public CAknView - { - public: // Constructors and destructor - void ConstructL(); - ~CProfilerGuiMainView(); - - public: // Functions from base classes - TUid Id() const; - void HandleCommandL(TInt aCommand); - void HandleClientRectChange(); - - /** - * Method for updating the Profiler engine status pane - * Called by Model class - * - * @param aStatus new status of profiler engine - */ - void UpdateStatusPaneL( TInt aStatus ); - - private: // From MEikMenuObserver - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - - private: // From AknView - void DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage); - void DoDeactivate(); - void HandleStatusPaneSizeChange(); - void SetupStatusPaneL(); - void CleanupStatusPaneL(); - HBufC* GetLabelTextLC(TInt aStatus); - private: // Data - CAknNavigationDecorator* iNaviDecorator; - CProfilerGuiMainContainer* iContainer; - CProfilerGuiModel* iModel; - - }; - -#endif - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_model.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_model.h Mon Aug 23 15:50:54 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: -* -*/ - - - -#ifndef PROFILER_GUI_MODEL_H -#define PROFILER_GUI_MODEL_H - -// SYSTEM INCLUDES -#include -#include -#include -#include -#include -#include // RProperty - -// LOCAL INCLUDES -#include "profiler_gui_mainview.h" -#include "profiler_gui.hrh" - -// COMMON INCLUDES -#include -#include -#include - -// setting keys (do not change uids of existing keys to maintain compatibility to older versions!) -const TUid KPSettingPluginNameMode = { 0x00 }; -const TUid KPSettingPluginSaveFileDrive = { 0x01 }; -const TUid KPSettingPluginTraceOutput = { 0x02 }; -const TUid KPSettingPluginSaveFilePrefix = { 0x03 }; -const TUid KPSettingPluginTraceMode = { 0x04 }; - - -// FORWARD DECLARATIONS -class CProfilerGuiMainView; -class CProfilerGuiMainContainer; -class CEikonEnv; -class TSamplerAttributes; -class CProfilerEngineStatusChecker; -class MProfilerStatusObserver; - - -typedef CArrayFixSeg CSamplerItemList; - - - -class CProfilerGuiModel : public CActive, MProfilerStatusObserver - { -private: - enum TContainerDrawState - { - EDrawStateInvalid = -1, - EDrawStateMain - }; - public: - static CProfilerGuiModel* NewL(); - ~CProfilerGuiModel(); - void ActivateModelL(); - void DeActivateModelL(); - void SetMainView(CProfilerGuiMainView* aMainView); - void UpdateState(TInt aState); - TBool GetSelectedItemHasSettings(); - TBool GetSelectedItemEnabled(); - TBool GetSelectedItemHidden(); - TInt EditSelectedSamplerL(TInt index); - void SelectedSamplerInfoL(TInt index); - void TerminateProfilerL(); - TBool CheckTraceLocationSanityL(TGeneralAttributes& aAttr, TBool aQuietCheck); - private: - void RunL(); - void DoCancel(); - void LoadPluginsL(); - TInt EditSamplerL(TSamplerAttributes& aItem); - void SamplerInfoL(TSamplerAttributes& aItem); -private: - CProfilerGuiModel(); - void ConstructL(); - TInt LoadGeneralSettingsL(); - - void AppendToSamplerItemListL(TSamplerAttributes& aItem); - void DisableOrEnableFromSamplerItemListL(TInt aIndex); - void DeleteAllSamplerItems(); - void RefreshViewL(TBool aClearSelection=ETrue); - void LaunchProfilerEngineL(); - void UpdateUIRunningStateL(); - TInt FindProcessL(RProcess& aProc); - -public: - - enum TProfilingMode - { - EProfilingModeNormal = 0, - EProfilingModeTimed - }; - - void StartAllSamplerItemsL(TProfilingMode aProfilingMode = EProfilingModeNormal); - void StopAllSamplerItemsL(); - void DeleteAllSamplerItemsL(); - void DisableAllSamplerItemsL(); - void EnableAllSamplerItemsL(); - - TInt SamplerItemCount() const; - void ShowItemActionMenuL(); - void StopSelectedOrHighlightedItemsL(); - void DisableOrEnableSelectedOrHighlightedItemsL(); - - CDesCArray* GenerateListBoxItemTextArrayL(); - void StartNewSamplerL(TInt aCommand); - void AddNewSamplersL(CArrayFixFlat& iSamplerAttributes); - - void SaveGeneralSettingsL(); - void SetMainContainer(CProfilerGuiMainContainer* aContainer); - TInt LaunchSettingsDialogL(); - inline CEikonEnv* EikonEnv() { return iEnv; } - inline CProfilerGuiMainContainer* MainContainer() { return iMainContainer; } - inline TBool SamplerItemsExists() { return iSamplerItemList->Count() > 0; } - inline TGeneralAttributes const& GeneralSettings() const { return iGeneralAttributes; } - - TPtrC GetWriterInfoNoteL(const TDesC& aNote); - void AttachClient(); - void RemoveClient(); - -public: - // from MProfilerStatusObserver - void NotifyContainerReadyL(); - void HandleProfilerStatusChange( KProfilerStatus aStatus ); - void HandleProfilerErrorL( TInt aError ); - -private: - static const TInt iSamplerNameMode = ESamplerNameLong; - CProfilerGuiMainContainer* iMainContainer; - CEikonEnv* iEnv; - TInt iDrawState; - CSamplerItemList* iSamplerItemList; - TInt iReferenceNumber; - CArrayFixFlat* iSamplerAttributes; - TGeneralAttributes iGeneralAttributes; - TBool iProfilerStatus; // Status of Engine before it was launched by this application - CProfilerGuiMainView* iMainView; - - // checkers - CProfilerEngineStatusChecker* iStatusChecker; -public: - TInt iState; - }; - -#endif diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_samplersettingsviewdlg.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +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 PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H -#define PROFILER_GUI_SAMPLERSETTINGSVIEWDLG_H - -// INCLUDES -#include -#include -#include -#include -#include -#include - -#include "profiler_gui_model.h" - - -// FORWARD DECLARATIONS -class CAknSettingItemArray; -class CAknSettingStyleListBox; -class CAknNavigationControlContainer; -class CAknNavigationDecorator; -class CAknTabGroup; -class TProfilerSamplerSettings; - -// CONSTANTS -const TUint KMaxItemCount = 7; -const TInt KMaxSettingUITextLength = 64; - -// CLASS DEFINITIONS - -class CProfilerSamplerSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver - { -public: - static CProfilerSamplerSettingsViewDlg* NewL(TSamplerAttributes& aSettings); - virtual ~CProfilerSamplerSettingsViewDlg(); - -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 - CProfilerSamplerSettingsViewDlg(TSamplerAttributes& aSettings); - void ConstructL(); - CAknSettingItem* GetSettingItemL(TSettingItem& aItem, TInt aIndex, TInt& aSettingPageResource); -private: // Data - CAknSettingItemArray* iSettingItemArray; - CAknSettingStyleListBox* iListBox; - CAknNavigationControlContainer* iNaviContainer; - TSamplerAttributes& iSettings; - TInt iItemCount; - - // item bufs for textual settings data - TInt iItemBuf[KMaxItemCount]; - }; - -#endif - -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_settingsviewdlg.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +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 PROFILER_GUI_SETTINGSVIEWDLG_H -#define PROFILER_GUI_SETTINGSVIEWDLG_H - -// INCLUDES -#include -#include -#include -#include -#include -#include - -#include "profiler_gui_model.h" - - -// FORWARD DECLARATIONS -class CAknSettingItemArray; -class CAknSettingStyleListBox; -class CAknNavigationControlContainer; -class CAknNavigationDecorator; -class CAknTabGroup; -class TProfilerGuiSettings; - - -// CLASS DEFINITIONS - -class CProfilerGuiSettingsViewDlg : public CAknDialog, public MEikListBoxObserver, public MAknTabObserver - { -public: - static CProfilerGuiSettingsViewDlg* NewL(TGeneralAttributes& aSettings); - virtual ~CProfilerGuiSettingsViewDlg(); - -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 - CProfilerGuiSettingsViewDlg(TGeneralAttributes& aSettings); - void ConstructL(); - -private: // Data - CAknSettingItemArray* iSettingItemArray; - CAknSettingStyleListBox* iListBox; - CAknNavigationControlContainer* iNaviContainer; - TGeneralAttributes& iSettings; - - // temporary member variables - TInt iTraceOutput; - TBuf<64> iSaveDrive; - TBuf<64> iFilePrefix; - }; - - -#endif - -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/inc/profiler_gui_std.h --- a/piprofilerui/ui/avkon/inc/profiler_gui_std.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +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 PROFILER_GUI_STD_H -#define PROFILER_GUI_STD_H - - - -#endif - -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby --- a/piprofilerui/ui/avkon/rom/piprofilerui_avkon.iby Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +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 __PROFILERGUI_IBY__ -#define __PROFILERGUI_IBY__ - -S60_APP_EXE(PIProfilerUI) -S60_APP_AIF_ICONS(PIProfilerUI) -S60_APP_RESOURCE(PIProfilerUI) -SCALABLE_IMAGE(APP_BITMAP_DIR, APP_BITMAP_DIR, PIProfilerui_ExtraIcons) -#ifdef S60_UPGRADABLE_APP_REG_RSC - S60_UPGRADABLE_APP_REG_RSC(PIProfilerUI) -#else - S60_APP_AIF_RSC(PIProfilerUI) -#endif - -#endif // __PROFILERGUI_IBY__ diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_app.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_app.cpp Mon Aug 23 15:50:54 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 FILES -#include "profiler_gui_app.h" -#include "profiler_gui_document.h" -#include - -#include - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CProfilerGuiApp::AppDllUid() -// Returns application UID -// --------------------------------------------------------- -// -TUid CProfilerGuiApp::AppDllUid() const - { - return KUidProfilerGui; - } - -// --------------------------------------------------------- -// CProfilerGuiApp::CreateDocumentL() -// Creates CProfilerGuiDocument object -// --------------------------------------------------------- -// -CApaDocument* CProfilerGuiApp::CreateDocumentL() - { - return CProfilerGuiDocument::NewL( *this ); - } - -// ================= OTHER EXPORTED FUNCTIONS ============== - -LOCAL_C CApaApplication* NewApplication() - { - return new CProfilerGuiApp; - } - - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_appui.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_appui.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +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 "profiler_gui_appui.h" -#include "profiler_gui_mainview.h" -#include "profiler_gui.hrh" -#include "profiler_gui_model.h" -#include "profiler_gui_document.h" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - - -// ================= MEMBER FUNCTIONS ======================= - -void CProfilerGuiAppUi::ConstructL() - { - // set as system application to prevent getting shut down events - iEikonEnv->SetSystem(ETrue); - - BaseConstructL(EAknEnableSkin); - - // get model - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - - LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - setting main view settings")); - - CProfilerGuiMainView* mainView = new(ELeave) CProfilerGuiMainView; - CleanupStack::PushL(mainView); - mainView->ConstructL(); - AddViewL(mainView); // transfer ownership to CAknViewAppUi - CleanupStack::Pop(); // mainView - - LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - setting default view")); - - SetDefaultViewL(*mainView); - - LOGTEXT(_L("ProfilerGuiAppUi::ConstructL - activating model")); - - // notify the model that everything has been constructed - iModel->ActivateModelL(); - } - -// -------------------------------------------------------------------------------------------- - -CProfilerGuiAppUi::~CProfilerGuiAppUi() - { - // notify the model that the application is closing - if (iModel) - TRAP_IGNORE(iModel->DeActivateModelL()); - - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) - { - if( aResourceId == R_PROFILER_START_SUBMENU ) - { - CEikMenuPaneItem::SData itemData; - _LIT(KMenuText, "Profiling for %d sec."); - itemData.iText.Format(KMenuText, iModel->GeneralSettings().iTimedSamplingPeriod);// = _L("Profiling for %d sec."); // Label text for the menu item - itemData.iCommandId = EProfilerGuiCmdStartTimed; // Command ID for the menu item - itemData.iFlags = 0; - itemData.iCascadeId = 0; - aMenuPane->AddMenuItemL( itemData ); - } - if (aResourceId == R_PROFILER_GUI_APP_MENU) - { - if(iModel->iState == MProfilerStatusObserver::ERunning) - { - aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, EFalse); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, ETrue); - } - else if(iModel->iState == MProfilerStatusObserver::EIdle) - { - aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, EFalse); - aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, EFalse); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, EFalse); - } - else - { - // if initializing or stopping no start/stop actions allowed - aMenuPane->SetItemDimmed(EProfilerGuiCmdStartAll, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdStopAll, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerControl, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSettings, ETrue); - } - } - - if(aResourceId == R_PROFILER_SAMPLER_CONTROL_MENU) - { - // check if item hidden, i.e. sampler cannot be started/stopped - if(!iModel->GetSelectedItemHidden()) - { - // item enabled => dimm the "enable" item, and other way round - if(iModel->GetSelectedItemEnabled()) - { - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, EFalse); - } - // item enabled => dimm the "enable" item, and other way round - else - { - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, EFalse); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, ETrue); - } - - } - // item hidden => dimm both enable and disable items - else - { - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerEnable, ETrue); - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerDisable, ETrue); - } - - // if sampler item has specific settings to control - if(iModel->GetSelectedItemHasSettings()) - { - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerSettings, EFalse); - } - else - { - aMenuPane->SetItemDimmed(EProfilerGuiCmdSamplerSettings, ETrue); - } - } - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CProfilerGuiAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) - { - return EKeyWasNotConsumed; - } - -void CProfilerGuiAppUi::HandleSystemEventL(const TWsEvent& aEvent) - { - switch (*(TApaSystemEvent*)(aEvent.EventData())) - { - case EApaSystemEventShutdown: - // check if still profiling - if( iModel->iState != MProfilerStatusObserver::EIdle ) - { - // stop profiling process - iModel->StopAllSamplerItemsL(); - } - - // terminate profiler engine - iModel->TerminateProfilerL(); - break; - default: - break; - } - // call base class implementation - CAknAppUi::HandleSystemEventL(aEvent); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiAppUi::HandleCommandL(TInt aCommand) - { - switch ( aCommand ) - { - case EProfilerGuiCmdSettings: - { - // check if exit command received - if (iModel->LaunchSettingsDialogL() == EAknCmdExit) - { - // terminate profiler engine... - iModel->TerminateProfilerL(); - - // ... and exit - Exit(); - } - break; - } - case EProfilerGuiCmdAbout: - { - CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; - dialog->ExecuteLD(R_PROFILER_GUI_ABOUT_DIALOG); - } - break; - - // a normal way to close an application - case EAknCmdExit: - case EEikCmdExit: - case EAknSoftkeyExit: - { - // decrease the client reference count in the server: - iModel->RemoveClient(); - // check if still profiling - if( iModel->iState != MProfilerStatusObserver::EIdle && - iModel->iState != MProfilerStatusObserver::EStopping ) - { - // ask user if he wants to leave profiling running in background process - if( this->RunConfQueryL( NULL ) == 0 ) - { - // stop profiling process - iModel->StopAllSamplerItemsL(); - - // terminate profiler engine - iModel->TerminateProfilerL(); - } - } - else - { - // terminate profiler engine - iModel->TerminateProfilerL(); - } - - Exit(); - } - break; - - default: - break; - } - } - -TInt CProfilerGuiAppUi::RunConfQueryL( const TDesC* aOverrideText ) - { - CAknQueryDialog* queryDialog = CAknQueryDialog::NewL(); - - if(aOverrideText) - { - queryDialog->SetPromptL(*aOverrideText); - } - return queryDialog->ExecuteLD(R_PROFILER_GUI_CONF_QUERY); - } - - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_document.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_document.cpp Mon Aug 23 15:50:54 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: -* -*/ - - - -// INCLUDE FILES -#include "profiler_gui_document.h" -#include "profiler_gui_appui.h" -#include "profiler_gui_model.h" - -// ================= MEMBER FUNCTIONS ======================= - -// constructor -CProfilerGuiDocument::CProfilerGuiDocument(CEikApplication& aApp) -: CAknDocument(aApp) - { - } - -// ---------------------------------------------------- - -// destructor -CProfilerGuiDocument::~CProfilerGuiDocument() - { - delete iModel; - } - -// ---------------------------------------------------- - -// EPOC default constructor can leave. -void CProfilerGuiDocument::ConstructL() - { - iModel = CProfilerGuiModel::NewL(); - } - -// ---------------------------------------------------- - -// Two-phased constructor. -CProfilerGuiDocument* CProfilerGuiDocument::NewL(CEikApplication& aApp) - { - CProfilerGuiDocument* self = new(ELeave) CProfilerGuiDocument(aApp); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - } - -// ---------------------------------------------------- -// CProfilerGuiDocument::CreateAppUiL() -// constructs CProfilerGuiAppUi -// ---------------------------------------------------- -// -CEikAppUi* CProfilerGuiDocument::CreateAppUiL() - { - return new (ELeave) CProfilerGuiAppUi; - } - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_maincontainer.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,332 +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 "profiler_gui_maincontainer.h" -#include "profiler_gui.hrh" -#include "profiler_gui_document.h" -#include "profiler_gui_appui.h" -#include "profiler_gui_model.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -_LIT(KExtraIconsPath, "\\resource\\apps\\piprofilerui_extraicons.mif"); - -// ===================================== MEMBER FUNCTIONS ===================================== - -void CProfilerGuiMainContainer::ConstructL(const TRect& aRect) - { - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - iModel->SetMainContainer(this); - - CreateWindowL(); - SetRect(aRect); - SetBlank(); - - // init listbox - iListBox = new(ELeave) CAknSingleGraphicStyleListBox; - iListBox->SetContainerWindowL(*this); - iListBox->ConstructL(this, EAknListBoxMarkableList); - iListBox->View()->SetListEmptyTextL(_L("No plugins found yet")); - - // if description length longer than screen width, scroll the text - iListBox->ItemDrawer()->ColumnData()->EnableMarqueeL(ETrue); - - // create icon array and add marking indicator to it - CAknIconArray* iconArray = new(ELeave) CAknIconArray(1); - CleanupStack::PushL(iconArray); - CFbsBitmap* markBitmap = NULL; - CFbsBitmap* markBitmapMask = NULL; - - TRgb defaultColor; - defaultColor = iEikonEnv->Color(EColorControlText); - - AknsUtils::CreateColorIconL(AknsUtils::SkinInstance(), - KAknsIIDQgnIndiMarkedAdd, - KAknsIIDQsnIconColors, - EAknsCIQsnIconColorsCG13, - markBitmap, - markBitmapMask, - AknIconUtils::AvkonIconFileName(), - EMbmAvkonQgn_indi_marked_add, - EMbmAvkonQgn_indi_marked_add_mask, - defaultColor - ); - - CGulIcon* markIcon = CGulIcon::NewL(markBitmap, markBitmapMask); - iconArray->AppendL(markIcon); - - // append icons from profiler_gui_extraicons.mif - TFileName extraIconsPath; - extraIconsPath.Copy(KExtraIconsPath); - TParsePtrC parse((CEikonEnv::Static()->EikAppUi()->Application())->AppFullName()); // get path where this app is installed - extraIconsPath.Insert(0, parse.Drive()); // drive letter - - CFbsBitmap* redBitmap = NULL; - CFbsBitmap* redBitmapMask = NULL; - CFbsBitmap* greenBitmap = NULL; - CFbsBitmap* greenBitmapMask = NULL; - - AknIconUtils::CreateIconL(redBitmap, redBitmapMask, extraIconsPath, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_disabled, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_disabled_mask); - AknIconUtils::CreateIconL(greenBitmap, greenBitmapMask, extraIconsPath, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_enabled, EMbmPiprofilerui_extraiconsQgn_prob_piprofilerui_status_enabled_mask); - - CGulIcon* redIcon = CGulIcon::NewL(redBitmap, redBitmapMask); - iconArray->AppendL(redIcon); - - CGulIcon* greenIcon = CGulIcon::NewL(greenBitmap, greenBitmapMask); - iconArray->AppendL(greenIcon); - - // set icon array - CleanupStack::Pop(); // iconArray - iListBox->ItemDrawer()->ColumnData()->SetIconArray(iconArray); - - iListBox->CreateScrollBarFrameL(ETrue); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); - iListBox->SetListBoxObserver(this); - - // set size of the listbox - TSize outputRectSize; - AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize); - TRect outputRect(outputRectSize); - iListBox->SetRect(outputRect); - - iListBox->ActivateL(); - - ActivateL(); - - iInfoPopup = CAknInfoPopupNoteController::NewL(); - iInfoPopup->SetTimePopupInView(5000); - iInfoPopup->SetTimeDelayBeforeShow(500); - iInfoPopup->SetTextL(_L("TIP: Check also sampler specific settings!")); - iInfoPopup->ShowInfoPopupNote(); - } - -// -------------------------------------------------------------------------------------------- - -CProfilerGuiMainContainer::~CProfilerGuiMainContainer() - { - delete iInfoPopup; - - if (iListBox) - delete iListBox; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::SizeChanged() -{ - TSize outputRectSize; - AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize); - TRect outputRect(outputRectSize); - - if (iListBox) - iListBox->SetRect(outputRect); -} - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiMainContainer::CountComponentControls() const - { - if (iListBox) - return 1; - else - return 0; - } - -// -------------------------------------------------------------------------------------------- - -CCoeControl* CProfilerGuiMainContainer::ComponentControl(TInt /*aIndex*/) const - { - if (iListBox) - return iListBox; - else - return NULL; - } - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiMainContainer::CurrentListBoxItemIndex() - { - if (iListBox) - { - return iListBox->CurrentItemIndex(); - } - else - return KErrNotFound; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::SetListBoxTextArrayL(CDesCArray* aTextArray) - { - if (iListBox) - { - iListBox->Model()->SetItemTextArray(aTextArray); - iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray); - iListBox->HandleItemAdditionL(); - iListBox->UpdateScrollBarsL(); - } - } - -// -------------------------------------------------------------------------------------------- - -const CArrayFix* CProfilerGuiMainContainer::ListBoxSelectionIndexes() - { - if (iListBox) - { - const CListBoxView::CSelectionIndexArray* indices = iListBox->SelectionIndexes(); - return static_cast*>(indices); - } - else - return NULL; - } - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiMainContainer::ListBoxSelectionIndexesCount() - { - if (iListBox) - { - return iListBox->SelectionIndexes()->Count(); - } - else - return KErrNotFound; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::Draw(const TRect& aRect) const - { - CWindowGc& gc = SystemGc(); - gc.Clear(aRect); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) - { - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::SetDefaultTitlePaneTextL() - { - _LIT(KTitleText, "PIProfiler"); - - CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - tp->SetTextL( KTitleText ); - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CProfilerGuiMainContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) - { - if(aType != EEventKey) - return EKeyWasNotConsumed; - - if (iListBox && iListBox->Model()->NumberOfItems() > 0) - { - // handle OK/Enter keys - if (aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter) - { - // check if profiler state is idle - if(iModel->iState == MProfilerStatusObserver::EIdle) - { - // show action menu only if state is idle - iModel->ShowItemActionMenuL(); - } - } - else - { - return iListBox->OfferKeyEventL(aKeyEvent, aType); - } - } - - return EKeyWasNotConsumed; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) - { - switch (aEventType) - { - case EEventEnterKeyPressed: - case EEventItemDoubleClicked: - { - iModel->ShowItemActionMenuL(); - } - break; - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::HandleResourceChange(TInt aType) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); - SetRect(mainPaneRect); - - TSize outputRectSize; - AknLayoutUtils::LayoutMetricsSize(AknLayoutUtils::EMainPane, outputRectSize); - TRect outputRect(outputRectSize); - iListBox->SetRect(outputRect); - } - else - { - CCoeControl::HandleResourceChange(aType); - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiMainContainer::ShowWriterInfoPopupL(const TDesC& aNote) - { - if(!iInfoPopup) - { - iInfoPopup = CAknInfoPopupNoteController::NewL(); - } - // Hide the note. The last note may be visible when creating the second - iInfoPopup->HideInfoPopupNote(); - iInfoPopup->SetTimePopupInView(5000); - iInfoPopup->SetTimeDelayBeforeShow(500); - iInfoPopup->SetTextL(iModel->GetWriterInfoNoteL(aNote)); - iInfoPopup->ShowInfoPopupNote(); - } - - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_mainview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,334 +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 "profiler_gui.hrh" -#include "profiler_gui_mainview.h" -#include "profiler_gui_maincontainer.h" -#include "profiler_gui_document.h" -#include "profiler_gui_model.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CProfilerGuiMainView::ConstructL(const TRect& aRect) -// EPOC two-phased constructor -// --------------------------------------------------------- -// -void CProfilerGuiMainView::ConstructL() - { - BaseConstructL( R_PROFILER_GUI_VIEW_MAIN ); - - iModel = static_cast(reinterpret_cast(iEikonEnv->AppUi())->Document())->Model(); - iNaviDecorator = NULL; - iModel->SetMainView(this); - } - -// --------------------------------------------------------- -// CProfilerGuiMainView::~CProfilerGuiMainView() -// --------------------------------------------------------- -// -CProfilerGuiMainView::~CProfilerGuiMainView() - { - - if(iNaviDecorator) - { - delete iNaviDecorator; - iNaviDecorator = NULL; - } - - if (iContainer) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - iContainer = NULL; - } - - } - -// --------------------------------------------------------- -// TUid CProfilerGuiMainView::Id() -// --------------------------------------------------------- -// -TUid CProfilerGuiMainView::Id() const - { - return KMainViewUID; - } - -// --------------------------------------------------------- -// TUid CProfilerGuiMainView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) -// --------------------------------------------------------- -// -void CProfilerGuiMainView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) - { - AppUi()->DynInitMenuPaneL(aResourceId, aMenuPane); - } - - -// --------------------------------------------------------- -// CProfilerGuiMainView::HandleCommandL(TInt aCommand) -// --------------------------------------------------------- -// -void CProfilerGuiMainView::HandleCommandL(TInt aCommand) - { - switch ( aCommand ) - { - // commands from sampler control sub menu - case EProfilerGuiCmdSamplerEnable: - { - iModel->DisableOrEnableSelectedOrHighlightedItemsL(); - break; - } - case EProfilerGuiCmdSamplerDisable: - { - iModel->DisableOrEnableSelectedOrHighlightedItemsL(); - break; - } - case EProfilerGuiCmdSamplerSettings: - { - // check if sampler settings dialog returned exit command - iModel->EditSelectedSamplerL(iContainer->CurrentListBoxItemIndex()); - break; - } - case EProfilerGuiCmdSamplerInfo: - { - iModel->SelectedSamplerInfoL(iContainer->CurrentListBoxItemIndex()); - break; - } - - case EProfilerGuiCmdStartAll: - case EProfilerGuiCmdStartTimed: - { - // still using the old way of starting all the samplers simultaneously - if( iModel->iState != MProfilerStatusObserver::ERunning ) - { - // set state as "initializing" for a moment before profiling has started, - // NOTE: engine changes to "Running" state - iModel->iState = MProfilerStatusObserver::EInitializing; - // start the actual sampling process on Profiler Engine - if( aCommand == EProfilerGuiCmdStartTimed ) - iModel->StartAllSamplerItemsL(CProfilerGuiModel::EProfilingModeTimed); - else - iModel->StartAllSamplerItemsL(); - } - - // prevent the control of sampler specific settings during the trace - iContainer->SetDimmed(ETrue); - break; - } - case EProfilerGuiCmdStopAll: - { - // check if still profiling - if( iModel->iState != MProfilerStatusObserver::EIdle ) - { - // set to stopping mode - iModel->iState = MProfilerStatusObserver::EStopping; - // stop actual sampling process on Profiler Engine - iModel->StopAllSamplerItemsL(); - } - - // return the control to sampler specific settings when tracing stopped - iContainer->SetDimmed(EFalse); - - break; - } - - default: - { - AppUi()->HandleCommandL(aCommand); - break; - } - } - } - -// --------------------------------------------------------- -// CProfilerGuiMainView::HandleClientRectChange() -// --------------------------------------------------------- -// -void CProfilerGuiMainView::HandleClientRectChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -// --------------------------------------------------------- -// CProfilerGuiMainView::DoActivateL(...) -// --------------------------------------------------------- -// -void CProfilerGuiMainView::DoActivateL( - const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - // show wait dialog - CAknGlobalNote* waitDialog = CAknGlobalNote::NewLC(); - waitDialog->SetSoftkeys(R_AVKON_SOFTKEYS_EMPTY); - TInt dialogId = waitDialog->ShowNoteL(EAknGlobalWaitNote, _L("Initializing samplers")); - - // setup the profiler engine status pane - SetupStatusPaneL(); - - // check if container creation succesfull - if (!iContainer) - { - iContainer = new (ELeave) CProfilerGuiMainContainer; - iModel->SetMainContainer(iContainer); - iContainer->SetMopParent(this); - iContainer->ConstructL( ClientRect() ); - iModel->NotifyContainerReadyL(); - AppUi()->AddToStackL( *this, iContainer ); - } - - // remove the wait dialog - waitDialog->CancelNoteL(dialogId); - CleanupStack::PopAndDestroy(); //waitDialog; - } - -// --------------------------------------------------------- -// CProfilerGuiMainView::DoDeactivate() -// --------------------------------------------------------- -// -void CProfilerGuiMainView::DoDeactivate() - { - TRAP_IGNORE(CleanupStatusPaneL()); - - if (iContainer) - { - AppUi()->RemoveFromViewStack( *this, iContainer ); - delete iContainer; - iContainer = NULL; - } - } - -void CProfilerGuiMainView::HandleStatusPaneSizeChange() - { - CAknView::HandleStatusPaneSizeChange(); - - TInt result; - TRAP(result, SetupStatusPaneL()); - } - - -void CProfilerGuiMainView::SetupStatusPaneL() - { - TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi); - CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid); - if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned()) - { - CAknNavigationControlContainer* naviPane = static_cast (StatusPane()->ControlL(naviPaneUid)); - if(iNaviDecorator) - { - delete iNaviDecorator; - iNaviDecorator = NULL; - } - - // get the initial status label - HBufC* labelText = GetLabelTextLC(iModel->iState); - iNaviDecorator = naviPane->CreateNavigationLabelL(*labelText); - CleanupStack::PopAndDestroy(labelText); - - naviPane->PushL(*iNaviDecorator); - } - } - -void CProfilerGuiMainView::CleanupStatusPaneL() - { - // destructor for navi pane, called by destructor - TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi); - CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid); - if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned()) - { - CAknNavigationControlContainer* naviPane = static_cast (StatusPane()->ControlL(naviPaneUid)); - if(iNaviDecorator) - { - naviPane->Pop(iNaviDecorator); - delete iNaviDecorator; - iNaviDecorator = NULL; - } - } - } - -HBufC* CProfilerGuiMainView::GetLabelTextLC(TInt aStatus) - { - // get the predefined status text - HBufC* labelText = NULL; - switch(aStatus) - { - case MProfilerStatusObserver::EIdle: - labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_IDLE); - break; - case MProfilerStatusObserver::EInitializing: - labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_INITIALIZING); - break; - case MProfilerStatusObserver::ERunning: - labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_RUNNING); - break; - case MProfilerStatusObserver::EStopping: - labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_STOPPING); - break; - case MProfilerStatusObserver::ERestarting: - labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_RUNNING); - break; - default: - labelText = StringLoader::LoadLC(R_PROFILER_GUI_NAVI_TEXT_IDLE); - break; - } - return labelText; - } - -void CProfilerGuiMainView::UpdateStatusPaneL( TInt aStatus ) - { - TUid naviPaneUid = TUid::Uid(EEikStatusPaneUidNavi); - CEikStatusPaneBase::TPaneCapabilities subPaneNavi = StatusPane()->PaneCapabilities(naviPaneUid); - // check if navi pane is correctly initialized - if(subPaneNavi.IsPresent() && subPaneNavi.IsAppOwned()) - { - CAknNavigationControlContainer* naviPane = static_cast (StatusPane()->ControlL(naviPaneUid)); - if(iNaviDecorator) - { - delete iNaviDecorator; - iNaviDecorator = NULL; - } - HBufC* labelText; - - // get the right status label text - labelText = GetLabelTextLC(aStatus); - iNaviDecorator = naviPane->CreateNavigationLabelL(*labelText); - CleanupStack::PopAndDestroy(labelText); - - naviPane->PushL(*iNaviDecorator); - } - } - - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_model.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_model.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1176 +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 "profiler_gui_samplersettingsviewdlg.h" -#include "profiler_gui_model.h" -#include "profiler_gui_app.h" -#include "profiler_gui_settingsviewdlg.h" -#include "profiler_gui_maincontainer.h" -#include "profiler_gui.hrh" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// UIDs -#include - -#include -#include - -// LITERALS -_LIT(KAppName, "PI Profiler"); -_LIT(KWarningNote, "NOTE: output changed!\n"); -_LIT(KProfilerEngineExe, "PIProfilerEngine.exe"); - -// literals for default general setting values -_LIT8(KTraceOutput, "file_system"); -_LIT8(KTraceDebugOutput, "debug_output"); -_LIT8(KProfilerDefaultDrive, "E:\\data"); -_LIT8(KProfilerDefaultPrefix, "Profiler_#"); - -// ===================================== MEMBER FUNCTIONS ===================================== - -CProfilerGuiModel* CProfilerGuiModel::NewL() - { - CProfilerGuiModel* self = new(ELeave) CProfilerGuiModel; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// -------------------------------------------------------------------------------------------- - -CProfilerGuiModel::CProfilerGuiModel() : CActive(EPriorityStandard) - { - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::ConstructL() - { - // initialize basic settings - iDrawState = EDrawStateInvalid; - iReferenceNumber = 0; - iState = MProfilerStatusObserver::EIdle; - - iEnv = CEikonEnv::Static(); - - // profiler engine specific initialization - LaunchProfilerEngineL(); - - // max sampler item list length is 64, i.e. max 64 sampler plugins loaded - iSamplerItemList = new(ELeave) CSamplerItemList(64); - - // initialize attribute arrays - iSamplerAttributes = new(ELeave) CArrayFixFlat(20); // max sampler count is 20 - - // engine status checker - iStatusChecker = CProfilerEngineStatusChecker::NewL(); - iStatusChecker->SetObserver(this); - - CActiveScheduler::Add(this); - } - -void CProfilerGuiModel::UpdateUIRunningStateL() - { - // prevent the control of sampler specific settings during the trace - iMainContainer->SetDimmed(ETrue); - - // update status pane - iMainView->UpdateStatusPaneL(iState); - - // show an info popup showing the logging method - iMainContainer->ShowWriterInfoPopupL(KNullDesC); - - // refresh view - RefreshViewL(); - } - -// -------------------------------------------------------------------------------------------- -void CProfilerGuiModel::NotifyContainerReadyL() - { - // load initial plugins - LoadPluginsL(); - - // get the initial state - if( iStatusChecker->GetInitialState() == MProfilerStatusObserver::ERunning ) - { - // set model state to restarting and grabbing an existing profiler process - iState = MProfilerStatusObserver::ERestarting; - - // update status pane to correspond the running mode - UpdateUIRunningStateL(); - - // set model state to running - iState = MProfilerStatusObserver::ERunning; - - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::ActivateModelL() - { - // load general settings - if( LoadGeneralSettingsL() != KErrNone ) - { - LOGTEXT(_L("ProfilerGuiAppUi::ActivateModelL - could not connect profiler engine")); - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::DeActivateModelL() - { - Cancel(); - - // for a faster exit, send the application to background - TApaTask selfTask(iEnv->WsSession()); - selfTask.SetWgId(iEnv->RootWin().Identifier()); - selfTask.SendToBackground(); - } - -// -------------------------------------------------------------------------------------------- - -CProfilerGuiModel::~CProfilerGuiModel() - { - if (iSamplerItemList) - { - DeleteAllSamplerItems(); - delete iSamplerItemList; - iSamplerItemList = NULL; - } - - if(iStatusChecker) - { - iStatusChecker->Cancel(); - delete iStatusChecker; - iStatusChecker = NULL; - } - - - if(iSamplerAttributes) - { - iSamplerAttributes->Reset(); - delete iSamplerAttributes; - iSamplerAttributes = NULL; - } - - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::DoCancel() - { - - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::RunL() - { - - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::SetMainContainer(CProfilerGuiMainContainer* aContainer) - { - iMainContainer = aContainer; - iDrawState = EDrawStateMain; - } - -void CProfilerGuiModel::UpdateState(TInt aState) - { - iState = aState; - } - -TInt CProfilerGuiModel::FindProcessL(RProcess& aProc) - { - TProcessId engId; - TFindProcess procName; - procName.Find(_L("PIProfilerEngine.exe*")); - TFullName aResult; - TFullName aResult2; - TInt err(KErrNone); - - // find the first appearance - err = procName.Next(aResult); - if(err != KErrNone) - { - // did not find any engine process - return err; - } - else - { - err = aProc.Open(procName); - if(err == KErrNone) - { - if(aProc.ExitCategory().Length() > 0) - { - aProc.Close(); - // process already exited => create a new one - return KErrNotFound; - } - aProc.Close(); - } - } - -// // 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); -// -// // check if aResult2 contained the second appearance of profiler engine -// if(aResult2.CompareF(aResult) > 0) -// { -// // other process found, i.e. right process to communicate with, in case started from eshell -// err = aProc.Open(procName); -// if(err == KErrNone) -// { -// if(aProc.ExitCategory().Length() > 0) -// { -// // process already exited => create a new one -// return KErrNotFound; -// } -// aProc.Close(); -// } -// } - - return err; - } - -void CProfilerGuiModel::LaunchProfilerEngineL() - { - LOGTEXT(_L("CProfilerGuiModel::LaunchProfilerEngineL - start")); - - TRequestStatus stat = KRequestPending; - RProcess proc; - - TInt err(KErrNone); - - // check if process exists - err = FindProcessL(proc); - - // check if already exists and don't start a new eshell profiling - if( err == KErrNotFound ) - { - // try create new process - err = proc.Create(KProfilerEngineExe, _L("")); - - // check if RProcess::Create() succeeded - if( err == KErrNone ) - { - // Trigger rendezvous on the supplied TRequestStatus object - proc.Rendezvous(stat); - - // kick off the engine process - proc.Resume(); - - // wait for the constructor to complete - User::WaitForRequest(stat); - - // just lose the handle - proc.Close(); - } - } - - // Increase the client reference count in server: - AttachClient(); - } - -//----------------------------------------------------------------------------- -// CProfilerGuiModel::TerminateProfilerL() -// Stops Profiler Engine if it has been launched by this launcher. -//----------------------------------------------------------------------------- - -void CProfilerGuiModel::TerminateProfilerL() - { - LOGTEXT(_L("CProfilerGuiModel::TerminateProfiler - entry")); - - // exit profiler engine - RProfiler::ExitProfiler(); - - LOGTEXT(_L("CProfilerGuiModel::TerminateProfiler - exit")); - - } - -void CProfilerGuiModel::AttachClient() - { - LOGTEXT(_L("CProfilerGuiModel::AttachClient - entry")); - - // - RProfiler::AttachClient(); - - LOGTEXT(_L("CProfilerGuiModel::AttachClient - exit")); - - } - -void CProfilerGuiModel::RemoveClient() - { - LOGTEXT(_L("CProfilerGuiModel::RemoveClient - entry")); - - // - RProfiler::RemoveClient(); - - LOGTEXT(_L("CProfilerGuiModel::RemoveClient - exit")); - - } - -void CProfilerGuiModel::AddNewSamplersL(CArrayFixFlat& aAttributes) - { - TSamplerAttributes item; - - TInt count(aAttributes.Count()); - - // loop the attribute array and insert them into view list - for (TInt i(0);iListBox()->SetCurrentItemIndexAndDraw(iMainContainer->ListBox()->Model()->NumberOfItems()-1); - - } - // refresh again - if(iReferenceNumber > 0) - { - RefreshViewL(ETrue); - } - } - -TBool CProfilerGuiModel::CheckTraceLocationSanityL(TGeneralAttributes& aAttr, TBool aQuietCheck) - { - RFs fs; - User::LeaveIfError(fs.Connect()); - - TBuf<32> drive; - - CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aAttr.iSaveFileDrive); - - TDriveUnit driveUnit = TDriveUnit(drive); - - TBool ret(EFalse); - - // check that the root folder is correct - if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone ) - { - // check then if drive has still some space - if(!SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit)) - { - ret = ETrue; - } - } - - // check if the sanity check failed - if(!ret) - { - // show an error note - if(aQuietCheck == EFalse) - { - CAknErrorNote* note = new(ELeave) CAknErrorNote(); - note->ExecuteLD(_L("Invalid path, check settings!")); - } - } - fs.Close(); - return ret; - } - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiModel::LaunchSettingsDialogL() - { - // launch the settings dialog - TGeneralAttributes newSettings = iGeneralAttributes; - TBool quietCheck(EFalse); - - CProfilerGuiSettingsViewDlg* dlg = CProfilerGuiSettingsViewDlg::NewL(newSettings); - TInt returnValue = dlg->ExecuteLD(R_PROFILER_GUI_SETTINGS_DIALOG); - - // check if exit command => no error note to user - if(returnValue == EAknCmdExit) - quietCheck = ETrue; - - // always save settings since the settings dialog does not provide a possibility to cancel - iGeneralAttributes.iTraceOutput.Copy(newSettings.iTraceOutput); - iGeneralAttributes.iTraceFilePrefix.Copy(newSettings.iTraceFilePrefix); - iGeneralAttributes.iTimedSamplingPeriod = newSettings.iTimedSamplingPeriod; - - // check if debug output selected no check of - if(newSettings.iTraceOutput.CompareF(KTraceDebugOutput) != 0) - { - // Check save file drive sanity - if(CheckTraceLocationSanityL(newSettings, quietCheck)) - { - // save the new location - iGeneralAttributes.iSaveFileDrive.Copy(newSettings.iSaveFileDrive); - } - } - - // saves the general settings to profiler engine - SaveGeneralSettingsL(); - - // 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; - } - - -TPtrC CProfilerGuiModel::GetWriterInfoNoteL(const TDesC& aNote) - { - TBuf<256> buf; - TBuf<128> descBuf; - - buf.Zero(); - - // get active profiler since it - RProfiler::GetActiveWriter(buf); - - if(iGeneralAttributes.iTraceOutput.CompareF(KTraceOutput) == 0) - { - if(iState == MProfilerStatusObserver::EInitializing || - iState == MProfilerStatusObserver::ERestarting ) - { - descBuf.Zero(); - // set the additional note if available - buf.Copy(aNote); - RProfiler::GetFileName(descBuf); - buf.Append(_L("Writing to ")); - buf.Append(descBuf); - } - else if(iState == MProfilerStatusObserver::EIdle || - iState == MProfilerStatusObserver::EStopping || - iState == MProfilerStatusObserver::ERunning ) - { - descBuf.Zero(); - // set the additional note if available - buf.Copy(aNote); - RProfiler::GetFileName(descBuf); - buf.Append(_L("Wrote trace data to ")); - buf.Append(descBuf); - } - else - { - buf.Copy(KNullDesC); - } - } - else if(iGeneralAttributes.iTraceOutput.CompareF(KTraceDebugOutput) == 0) - { - if(iState == MProfilerStatusObserver::EInitializing || - iState == MProfilerStatusObserver::ERestarting ) - { - buf.Copy(_L("Writing to debug output...")); - } - else if( iState == MProfilerStatusObserver::EIdle || - iState == MProfilerStatusObserver::EStopping || - iState == MProfilerStatusObserver::ERunning ) - { - buf.Copy(_L("Wrote trace data to debug output")); - } - else - { - buf.Copy(KNullDesC); - } - } - else - { - // should not reach this point - buf.Copy(KNullDesC); - } - - return TPtrC(buf); - } - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiModel::EditSamplerL(TSamplerAttributes& aItem) - { - // edit sampler specific settings i.e. attributes - TSamplerAttributes& newSettings = aItem; - TInt indexToReplace(iMainContainer->CurrentListBoxItemIndex()); - - // create a new settings editor dialog - CProfilerSamplerSettingsViewDlg* dlg = CProfilerSamplerSettingsViewDlg::NewL(newSettings); - TInt returnValue = dlg->ExecuteLD(R_PROFILER_SAMPLER_SETTINGS_DIALOG); - - // save settings - aItem = newSettings; - - // replace the old attribute container with saved values - iSamplerItemList->Delete(indexToReplace); - iSamplerItemList->InsertL(indexToReplace, newSettings); - - // save the settings to sampler item - RProfiler::SetSamplerAttributes(newSettings); - - // 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 CProfilerGuiModel::SamplerInfoL(TSamplerAttributes& aItem) - { - TBuf<64> header; - TBuf<256> info; - - _LIT(KSamplerStr, "Sampler Info"); - -// CnvUtfConverter::ConvertToUnicodeFromUtf8(header, aItem.iName); - - header.Append(KSamplerStr); - - CnvUtfConverter::ConvertToUnicodeFromUtf8(info, aItem.iDescription); - - CAknMessageQueryDialog* dialog = new(ELeave) CAknMessageQueryDialog; - //dialog->ExecuteLD(info); - dialog->PrepareLC( R_PROFILER_GUI_EMPTY_ABOUT_DIALOG ); - dialog->SetHeaderText(header); - dialog->SetMessageTextL(info); - dialog->RunLD(); - - RefreshViewL(EFalse); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::StartAllSamplerItemsL(TProfilingMode aProfilingMode) - { - TBuf<256> activeWriterDes; - TBuf8<256> writer8; - - iState = MProfilerStatusObserver::EInitializing; - - RProfiler::TProfilingMode profilingMode = aProfilingMode == EProfilingModeTimed ? RProfiler::EProfilingModeTimed : RProfiler::EProfilingModeNormal; - - // update status pane to correspond the initializing mode - // prevent the control of sampler specific settings during the trace - iMainContainer->SetDimmed(ETrue); - - // update status pane - iMainView->UpdateStatusPaneL(iState); - - // refresh view - RefreshViewL(); - - // try to start profiling process through client-server interface - if(RProfiler::StartSampling(profilingMode) == KErrNotFound) - { - - // profiler stopped (e.g. from eshell) and must be restarted - LaunchProfilerEngineL(); - - // set general attributes - SaveGeneralSettingsL(); - - // set sampler attributes - for(TInt i(0);iCount();i++) - { - // set the attributes for each sampler loaded in the UI - RProfiler::SetSamplerAttributes(iSamplerAttributes->At(i)); - } - - // try to launch sampling again - RProfiler::StartSampling(profilingMode); - } - - // get selected writer - RProfiler::GetActiveWriter(activeWriterDes); - CnvUtfConverter::ConvertFromUnicodeToUtf8(writer8, activeWriterDes); - - // check that output mode has not changed for a problem with trace file name - // problem cases: - // - trace file name and/or path false - // - disk full, cannot write to given location - // - false drive, e.g. x: - if(writer8.CompareF(iGeneralAttributes.iTraceOutput) != 0) - { - // save change also to general attributes - iGeneralAttributes.iTraceOutput.Copy(writer8); - // show an info popup showing the logging method - iMainContainer->ShowWriterInfoPopupL(KWarningNote); - } - else - { - // show an info popup showing the logging method - iMainContainer->ShowWriterInfoPopupL(KNullDesC); - } - - // update the view - RefreshViewL(); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::DeleteAllSamplerItemsL() - { - DeleteAllSamplerItems(); - - RefreshViewL(); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::StopAllSamplerItemsL() - { - // show an info popup showing the logging method - iMainContainer->ShowWriterInfoPopupL(KNullDesC); - - // Stop profiling process through CS session - RProfiler::StopSampling(); - - RefreshViewL(); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::RefreshViewL(TBool aClearSelection) - { - // refresh the main list view - if (iMainContainer && iDrawState == EDrawStateMain && iMainContainer->ListBox()) - { - // clear selections if any - iMainContainer->ListBox()->ClearSelection(); - - // set item index to 0 - if (aClearSelection) - iMainContainer->ListBox()->SetCurrentItemIndex(0); - - // set text items - iMainContainer->SetListBoxTextArrayL(GenerateListBoxItemTextArrayL()); - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::AppendToSamplerItemListL(TSamplerAttributes& aItem) - { - // append single sampler item into sampler item list - if (iSamplerItemList) - iSamplerItemList->AppendL( aItem ); - else - User::Leave(KErrNotReady); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::DisableOrEnableFromSamplerItemListL(TInt aIndex) - { - if (iSamplerItemList) - { - if (iSamplerItemList->Count() > aIndex && aIndex >= 0) - { - TSamplerAttributes& attr = iSamplerItemList->At(aIndex); - if (attr.iEnabled) - { - attr.iEnabled = EFalse; - } - else if (!attr.iEnabled) - { - attr.iEnabled = ETrue; - } - // save settings to engine - RProfiler::SetSamplerAttributes(attr); - } - else - User::Leave(KErrNotFound); - } - else - { - User::Leave(KErrNotReady); - } - - } - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiModel::SamplerItemCount() const - { - TInt count(0); - - if (iSamplerItemList) - count = iSamplerItemList->Count(); - - return count; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::DeleteAllSamplerItems() - { - // reset sampler array - iSamplerItemList->Reset(); - } - -// -------------------------------------------------------------------------------------------- - -CDesCArray* CProfilerGuiModel::GenerateListBoxItemTextArrayL() - { - CDesCArray* textArray = new(ELeave) CDesCArrayFlat(64); - CleanupStack::PushL(textArray); - - _LIT(KEntryTemplateRedIcon, "1\t%S\t\t"); - _LIT(KEntryTemplateGreenIcon, "2\t%S\t\t"); - - TSamplerAttributes attr; - TInt itemCount(SamplerItemCount()); - for (TInt i(0); i textEntry; - TBuf<512> description; - - attr = iSamplerItemList->At(i); - - description.Copy(attr.iName); - - if (attr.iEnabled) - textEntry.Format(KEntryTemplateGreenIcon, &description); - else - textEntry.Format(KEntryTemplateRedIcon, &description); - - textArray->AppendL(textEntry); - } - - CleanupStack::Pop(); //textArray - return textArray; - } - -// -------------------------------------------------------------------------------------------- - -TBool CProfilerGuiModel::GetSelectedItemEnabled() - { - TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); - - if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) - { - return iSamplerItemList->At(currentItemIndex).iEnabled; - } - return EFalse; - } - -// -------------------------------------------------------------------------------------------- - -TBool CProfilerGuiModel::GetSelectedItemHasSettings() - { - TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); - - if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) - { - if(iSamplerItemList->At(currentItemIndex).iItemCount != 0 || - iSamplerItemList->At(currentItemIndex).iSampleRate != KErrNotFound) - { - return ETrue; - } - else - { - return EFalse; - } - } - return EFalse; - } - -// -------------------------------------------------------------------------------------------- - -TBool CProfilerGuiModel::GetSelectedItemHidden() - { - TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); - - if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) - { - if(iSamplerItemList->At(currentItemIndex).iIsHidden) - { - return ETrue; - } - else - { - return EFalse; - } - } - return EFalse; - } - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiModel::EditSelectedSamplerL(TInt index) - { - TSamplerAttributes sampler; - if(SamplerItemCount() > index && index >= 0) - { - sampler = iSamplerItemList->At(index); - return EditSamplerL(sampler); - } - return KErrNone; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::SelectedSamplerInfoL(TInt index) - { - if(SamplerItemCount() > index && index >= 0) - { - SamplerInfoL(iSamplerItemList->At(index)); - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::ShowItemActionMenuL() - { - TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); - - if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) - { - // show a query dialog - TInt queryIndex(0); - CAknListQueryDialog* listQueryDlg = new(ELeave) CAknListQueryDialog(&queryIndex); - TInt resource = 0; - TSamplerAttributes sampler = iSamplerItemList->At(currentItemIndex); - - // check if sampler enabled - if(sampler.iEnabled) - { - resource = R_ITEM_ACTION_QUERY_ENABLED; - } - else - { - resource = R_ITEM_ACTION_QUERY_DISABLED; - } - - // check if sampler plugin hidden => don't allow starting and stopping of sampling - if(sampler.iIsHidden) - { - resource = R_ITEM_ACTION_QUERY_HIDDEN_START_STOP; - } - else if(( sampler.iItemCount == 0 && - sampler.iSampleRate == KErrNotFound ) && - sampler.iEnabled ) - { - resource = R_ITEM_ACTION_QUERY_HIDDEN_SETTINGS_ENABLED; - } - else if(( sampler.iItemCount == 0 && - sampler.iSampleRate == KErrNotFound ) && - !sampler.iEnabled ) - { - resource = R_ITEM_ACTION_QUERY_HIDDEN_SETTINGS_DISABLED; - } - - // execute query dialog with the given resource - if (listQueryDlg->ExecuteLD(resource)) - { - if(!sampler.iIsHidden) - { - if(sampler.iItemCount != 0 || - sampler.iSampleRate != KErrNotFound ) - { - // enable/disable sampler - if (queryIndex == EItemActionMenuTypeEnable) - { - DisableOrEnableSelectedOrHighlightedItemsL(); - } - // edit sampler settings - else if (queryIndex == EItemActionMenuTypeEditSettings - 1) - { - EditSamplerL(sampler); - } - // info - else if (queryIndex == EItemActionMenuTypeInfo - 1) - { - SamplerInfoL(sampler); - } - } - else - { - // special case, use raw query indexes - if (queryIndex == 0) - { - DisableOrEnableSelectedOrHighlightedItemsL(); - } - else if (queryIndex == 1) - { - SamplerInfoL(sampler); - } - } - } - else - { - if(sampler.iItemCount != 0 || - sampler.iSampleRate != KErrNotFound) - { - // special case, use raw query indexes - // edit sampler settings - if (queryIndex == 0) - { - EditSamplerL(sampler); - } - // sampler info - else if (queryIndex == 1) - { - SamplerInfoL(sampler); - } - } - else - { - // only sampler info available if hidden and no setting items to be set - if (queryIndex == 0) - { - SamplerInfoL(sampler); - } - - } - } - } - } - } - -void CProfilerGuiModel::DisableOrEnableSelectedOrHighlightedItemsL() - { - const CArrayFix* selectionIndexes = iMainContainer->ListBoxSelectionIndexes(); - - // by default use selected items - if (selectionIndexes && selectionIndexes->Count() > 0) - { - TInt ref(0); - TKeyArrayFix key(0, ECmpTUint16); - TInt index(0); - - for (TInt i=0; iFind(ref, key, index) == 0) - { - DisableOrEnableFromSamplerItemListL(i); - } - } - - RefreshViewL(EFalse); - } - - // or if none selected, use the current item index - else - { - TInt currentItemIndex = iMainContainer->CurrentListBoxItemIndex(); - - if (SamplerItemCount() > currentItemIndex && currentItemIndex >= 0) - { - DisableOrEnableFromSamplerItemListL(currentItemIndex); - - RefreshViewL(EFalse); - } - } - } - -void CProfilerGuiModel::LoadPluginsL() - { - // get samplers from Profiler Engine (client-server session) - // and add the to the samplers list for the first time - LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - get sampler plugins")); - TInt err = RProfiler::GetSamplerAttributes(*iSamplerAttributes); - - // check if engine provided a list of samplers - if( err != KErrNone ) - { - // could not get samplers from engine - LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - failed to connect engine")); - } - else - { - LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - adding new samplers into view")); - AddNewSamplersL(*iSamplerAttributes); - } - - LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - exit")); - } - -// -------------------------------------------------------------------------------------------- - -TInt CProfilerGuiModel::LoadGeneralSettingsL() - { - // local variable for getting saved settings from profiler engine - TGeneralAttributes generalAttr; - TInt err(KErrNone); - - // before loading saved settings (from settings file) set the default values - iGeneralAttributes.iTraceOutput.Copy(KTraceOutput); - iGeneralAttributes.iTraceFilePrefix.Copy(KProfilerDefaultPrefix); - iGeneralAttributes.iSaveFileDrive.Copy(KProfilerDefaultDrive); - iGeneralAttributes.iTimedSamplingPeriod = KDefaultTimedSamplingPeriod; - - // request to - err = RProfiler::GetGeneralAttributes(generalAttr); - - // check that request succesfull - if( err != KErrNone ) - { - // could not connect profiler engine, use - return err; - } - - // check if saved settings different than the default - if(generalAttr.iTraceOutput.MatchF(iGeneralAttributes.iTraceOutput) == KErrNotFound) - { - iGeneralAttributes.iTraceOutput.Copy(generalAttr.iTraceOutput); - } - - if(generalAttr.iTraceFilePrefix.MatchF(iGeneralAttributes.iTraceFilePrefix) == KErrNotFound) - { - iGeneralAttributes.iTraceFilePrefix.Copy(generalAttr.iTraceFilePrefix); - } - - if(generalAttr.iSaveFileDrive.MatchF(iGeneralAttributes.iSaveFileDrive) == KErrNotFound) - { - iGeneralAttributes.iSaveFileDrive.Copy(generalAttr.iSaveFileDrive); - } - - if( generalAttr.iTimedSamplingPeriod > 0) - { - iGeneralAttributes.iTimedSamplingPeriod = generalAttr.iTimedSamplingPeriod; - } - - return err; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::SaveGeneralSettingsL() - { - TInt err(KErrNone); - - // save general attributes to Profiler Engine - err = RProfiler::SetGeneralAttributes(iGeneralAttributes); - - // check if save failed - if(err == KErrNotFound) - { - // profiler stopped (e.g. from eshell) and must be restarted - LaunchProfilerEngineL(); - - err = RProfiler::SetGeneralAttributes(iGeneralAttributes); - if(err != KErrNone) - { - // leave no use to continue - User::Leave(err); - } - } - } - -void CProfilerGuiModel::SetMainView(CProfilerGuiMainView* aMainView) - { - iMainView = aMainView; - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiModel::HandleProfilerStatusChange( KProfilerStatus aStatus ) - { - iState = aStatus; - if( aStatus == EIdle ) - { - iMainContainer->ShowWriterInfoPopupL(KNullDesC); - // set plugin list back to enabled - iMainContainer->SetDimmed(EFalse); - } - TRAP_IGNORE(iMainView->UpdateStatusPaneL(aStatus)); - } - -void CProfilerGuiModel::HandleProfilerErrorL( TInt aError ) - { - TBuf<64> errorMsg; - _LIT(KErrorMessage, "Error: "); - _LIT(KNoMemory, "Cannot write to file, check settings"); - - errorMsg.Copy(KErrorMessage); - // message from pwr sampler - if( aError < -1000 ) - { - errorMsg.Append(_L("Stop other power measurement tools!")); - } - else if( aError == KErrAlreadyExists || aError == 11 ) - { - errorMsg.Append(_L("Close old Profiler before start!")); - } - else if( aError == KErrNotReady ) - { - errorMsg.Append(_L("Memory card removed, failed to write!")); - } - else if( aError == KErrPathNotFound ) - { - errorMsg.Append(_L("Given trace data location does not exist")); - } - else - { - if( aError == KErrNoMemory || - aError == KErrOverflow || - aError == KErrDirFull || - aError == KErrDiskFull || - aError == KErrNotReady ) - { - errorMsg.Append(KNoMemory); - } - else - { - errorMsg.Append(_L("code: ")); - errorMsg.AppendNum(aError); - } - } - // simply show an error note - CAknErrorNote* note = new(ELeave) CAknErrorNote(); - note->ExecuteLD(errorMsg); - - // set state idle in all error cases - iState = MProfilerStatusObserver::EIdle; - - // update status pane - iMainView->UpdateStatusPaneL(iState); - - // set plugin list back to enabled - iMainContainer->SetDimmed(EFalse); - - // refresh and set menus etc. in correct state - RefreshViewL(); - } - -// End of File diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_samplersettingsviewdlg.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,479 +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 "profiler_gui_samplersettingsviewdlg.h" -#include "profiler_gui_model.h" -#include "profiler_gui.hrh" -#include "profiler_gui_std.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// LITERALS -_LIT8(KCPUSamplerName, "gpp"); -_LIT(KEmptySettingItem, ""); - -// ===================================== MEMBER FUNCTIONS ===================================== - -CProfilerSamplerSettingsViewDlg* CProfilerSamplerSettingsViewDlg::NewL(TSamplerAttributes& aSettings) - { - CProfilerSamplerSettingsViewDlg* self = new(ELeave) CProfilerSamplerSettingsViewDlg(aSettings); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------------------------- - -CProfilerSamplerSettingsViewDlg::~CProfilerSamplerSettingsViewDlg() - { - // restore default navi pane - if(iNaviContainer) - iNaviContainer->Pop(); - - if (iSettingItemArray) - { - iSettingItemArray->ResetAndDestroy(); - delete iSettingItemArray; - } - - } - -// -------------------------------------------------------------------------------------------- - -CProfilerSamplerSettingsViewDlg::CProfilerSamplerSettingsViewDlg(TSamplerAttributes& aSettings) - : iSettings(aSettings) - { - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::ConstructL() - { - // construct a menu bar - CAknDialog::ConstructL(R_PROFILER_SAMPLER_SETTINGS_MENUBAR); - - CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); - - // set empty navi pane label - iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); - iNaviContainer->PushDefaultL(); - - TBuf<64> settingsTitle; - - settingsTitle.Zero(); - settingsTitle.Copy(iSettings.iName); - - // set title text - CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - tp->SetTextL( settingsTitle ); - - iItemCount = iSettings.iItemCount; - - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) - { - switch (aEventType) - { - case EEventEnterKeyPressed: - case EEventItemDoubleClicked: - ShowSettingPageL(EFalse); - break; - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::TabChangedL(TInt /*aIndex*/) - { - iListBox->SetCurrentItemIndex(0); - - SetVisibilitiesOfSettingItemsL(); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::ProcessCommandL(TInt aCommandId) - { - CAknDialog::ProcessCommandL(aCommandId); - - switch (aCommandId) - { - case EProfilerGuiCmdSettingsChange: - ShowSettingPageL(ETrue); - break; - case EProfilerGuiCmdSettingsExit: - TryExitL(EAknCmdExit); - break; - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CProfilerSamplerSettingsViewDlg::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) - { - - return CAknDialog::OfferKeyEventL(aKeyEvent, aType); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::PreLayoutDynInitL() - { - iListBox = static_cast( Control(EProfilerSamplerSettingItemList) ); - 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 CProfilerSamplerSettingsViewDlg::OkToExitL(TInt aButtonId) - { - // save all settings when exiting, only numeric values are needed to saved since copied from TBuf - for(TInt i(1);iAt(i)->IsHidden() == EFalse) - { - switch(i) - { - case 1: - { - // check if settings value type integer - if(iSettings.iSettingItem1.iType == TSettingItem::ESettingItemTypeInt) - { - iSettings.iSettingItem1.iValue.Num(iItemBuf[i]); - } - break; - } - case 2: - { - // check if settings value type integer - if(iSettings.iSettingItem2.iType == TSettingItem::ESettingItemTypeInt) - { - iSettings.iSettingItem2.iValue.Num(iItemBuf[i]); - } - break; - } - case 3: - { - // check if settings value type integer - if(iSettings.iSettingItem3.iType == TSettingItem::ESettingItemTypeInt) - { - iSettings.iSettingItem3.iValue.Num(iItemBuf[i]); - } - break; - } - case 4: - { - // check if settings value type integer - if(iSettings.iSettingItem4.iType == TSettingItem::ESettingItemTypeInt) - { - iSettings.iSettingItem4.iValue.Num(iItemBuf[i]); - } - - break; - } - case 5: - { - // check if settings value type integer - if(iSettings.iSettingItem5.iType == TSettingItem::ESettingItemTypeInt) - { - iSettings.iSettingItem5.iValue.Num(iItemBuf[i]); - } - - break; - } - case 6: - { - // check if settings value type integer - if(iSettings.iSettingItem6.iType == TSettingItem::ESettingItemTypeInt) - { - iSettings.iSettingItem6.iValue.Num(iItemBuf[i]); - } - - break; - } - } - } - } - return CAknDialog::OkToExitL(aButtonId); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::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 CProfilerSamplerSettingsViewDlg::SetVisibilitiesOfSettingItemsL() - { - if (iSettingItemArray->Count() > 0) - { - if(iSettings.iSampleRate > 0) - { - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQuerySampleRate])->SetHidden(EFalse); - } - else - { - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQuerySampleRate])->SetHidden(ETrue); - } - if(iItemCount>0) - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem1])->SetHidden(EFalse); - if(iItemCount>1) - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem2])->SetHidden(EFalse); - if(iItemCount>2) - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem3])->SetHidden(EFalse); - if(iItemCount>3) - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem4])->SetHidden(EFalse); - if(iItemCount>4) - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem5])->SetHidden(EFalse); - if(iItemCount>5) - ((*iSettingItemArray)[EProfilerGuiGenericSamplerQueryItem6])->SetHidden(EFalse); - - iSettingItemArray->RecalculateVisibleIndicesL(); - iListBox->HandleItemAdditionL(); - iListBox->UpdateScrollBarsL(); - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::UpdateListBoxL() - { - iSettingItemArray->ResetAndDestroy(); - - // create items - TInt ordinal(0); - - AddSettingItemL(EProfilerGuiGenericSamplerQuerySampleRate, - R_SAMPLE_RATE_SETTING_TITLE, - R_SAMPLER_RATE_SETTING_PAGE, - NULL, - ordinal++); - - if(iItemCount>0) - AddSettingItemL(EProfilerGuiGenericSamplerQueryItem1, - R_ITEM1_SETTING_TITLE, - NULL, - NULL, - ordinal++); - if(iItemCount>1) - AddSettingItemL(EProfilerGuiGenericSamplerQueryItem2, - R_ITEM2_SETTING_TITLE, - NULL, - NULL, - ordinal++); - if(iItemCount>2) - AddSettingItemL(EProfilerGuiGenericSamplerQueryItem3, - R_ITEM3_SETTING_TITLE, - NULL, - NULL, - ordinal++); - if(iItemCount>3) - AddSettingItemL(EProfilerGuiGenericSamplerQueryItem4, - R_ITEM4_SETTING_TITLE, - NULL, - NULL, - ordinal++); - if(iItemCount>4) - AddSettingItemL(EProfilerGuiGenericSamplerQueryItem5, - R_ITEM5_SETTING_TITLE, - NULL, - NULL, - ordinal++); - if(iItemCount>5) - AddSettingItemL(EProfilerGuiGenericSamplerQueryItem6, - R_ITEM6_SETTING_TITLE, - NULL, - NULL, - ordinal++); - - SetVisibilitiesOfSettingItemsL(); - } - -// -------------------------------------------------------------------------------------------- - -CAknSettingItem* CProfilerSamplerSettingsViewDlg::GetSettingItemL(TSettingItem& aItem, TInt aIndex, TInt& aSettingPageResource) - { - CAknSettingItem* settingItem = NULL; - - // set default setting page dialog style resource - aSettingPageResource = R_GENERIC_TEXT_SETTING_PAGE; - - // check if setting item type integer - if(aItem.iType == TSettingItem::ESettingItemTypeInt) - { - TLex* lex = new TLex(aItem.iValue); - // check if value valid - if(lex->Val(iItemBuf[aIndex]) != KErrNone) - { - // if value not valid set to 0 - iItemBuf[aIndex] = 0; - } - settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aIndex, iItemBuf[aIndex]); - aSettingPageResource = R_NUMERIC_SETTING_PAGE; - delete lex; - return settingItem; - } - else // else manipulate as a text setting - { - settingItem = new(ELeave) CAknTextSettingItem(aIndex, aItem.iValue); - settingItem->SetEmptyItemTextL(KEmptySettingItem); - return settingItem; - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerSamplerSettingsViewDlg::AddSettingItemL(TInt aId, - TInt aTitleResource, - TInt aSettingPageResource, - TInt aAssociatedResource, - TInt aOrdinal) - { - // create a setting item - CAknSettingItem* settingItem = NULL; - - TBuf ptr; - switch(aId) - { - case EProfilerGuiGenericSamplerQuerySampleRate: - { - settingItem = new (ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iSampleRate); - break; - } - case EProfilerGuiGenericSamplerQueryItem1: - { - ptr.Copy(iSettings.iSettingItem1.iUIText); - settingItem = GetSettingItemL(iSettings.iSettingItem1, aId, aSettingPageResource); - break; - } - case EProfilerGuiGenericSamplerQueryItem2: - { - ptr.Copy(iSettings.iSettingItem2.iUIText); - settingItem = GetSettingItemL(iSettings.iSettingItem2, aId, aSettingPageResource); - break; - } - case EProfilerGuiGenericSamplerQueryItem3: - { - ptr.Copy(iSettings.iSettingItem3.iUIText); - settingItem = GetSettingItemL(iSettings.iSettingItem3, aId, aSettingPageResource); - break; - } - case EProfilerGuiGenericSamplerQueryItem4: - { - ptr.Copy(iSettings.iSettingItem4.iUIText); - settingItem = GetSettingItemL(iSettings.iSettingItem4, aId, aSettingPageResource); - break; - } - case EProfilerGuiGenericSamplerQueryItem5: - { - ptr.Copy(iSettings.iSettingItem5.iUIText); - settingItem = GetSettingItemL(iSettings.iSettingItem5, aId, aSettingPageResource); - break; - } - case EProfilerGuiGenericSamplerQueryItem6: - { - ptr.Copy(iSettings.iSettingItem6.iUIText); - settingItem = GetSettingItemL(iSettings.iSettingItem6, aId, aSettingPageResource); - break; - } - default: - { - // Id not supported - User::Leave(KErrNotSupported); - break; - } - } - - CleanupStack::PushL(settingItem); - - // get title text - HBufC* itemTitle; - - if( ptr.Compare(KNullDesC) == 0 ) - { - itemTitle = StringLoader::LoadLC(aTitleResource); - - // special case: check if CPU sampler - if(iSettings.iShortName.CompareF(KCPUSamplerName) == 0) - { - // change setting page using different value range, since > 10000 ms rates are too big - aSettingPageResource = R_CPU_SAMPLER_RATE_SETTING_PAGE; - } - - // 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 - } - else - { - // construct the setting item - settingItem->ConstructL(EFalse, aOrdinal, ptr, NULL, aSettingPageResource, - EAknCtPopupSettingList, NULL, aAssociatedResource); - - // append the setting item to settingitem array - iSettingItemArray->InsertL(aOrdinal, settingItem); - } - - CleanupStack::Pop(); //settingItem - } - -// -------------------------------------------------------------------------------------------- -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp --- a/piprofilerui/ui/avkon/src/profiler_gui_settingsviewdlg.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,386 +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 "profiler_gui_settingsviewdlg.h" -#include "profiler_gui_model.h" -#include "profiler_gui.hrh" -#include "profiler_gui_std.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// LITERALS -_LIT8(KDebugOutput, "debug_output"); -_LIT8(KFileSystem, "file_system"); -_LIT(KEmptySettingItem, ""); - -// ===================================== MEMBER FUNCTIONS ===================================== - -CProfilerGuiSettingsViewDlg* CProfilerGuiSettingsViewDlg::NewL(TGeneralAttributes& aSettings) - { - CProfilerGuiSettingsViewDlg* self = new(ELeave) CProfilerGuiSettingsViewDlg(aSettings); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// -------------------------------------------------------------------------------------------- - -CProfilerGuiSettingsViewDlg::~CProfilerGuiSettingsViewDlg() - { - // restore default navi pane - if(iNaviContainer) - iNaviContainer->Pop(); - - if (iSettingItemArray) - { - iSettingItemArray->ResetAndDestroy(); - delete iSettingItemArray; - } - - } - -// -------------------------------------------------------------------------------------------- - -CProfilerGuiSettingsViewDlg::CProfilerGuiSettingsViewDlg(TGeneralAttributes& aSettings) : iSettings(aSettings) - { - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiSettingsViewDlg::ConstructL() - { - // construct a menu bar - CAknDialog::ConstructL(R_PROFILER_GUI_SETTINGS_MENUBAR); - - CEikStatusPane* sp = iEikonEnv->AppUiFactory()->StatusPane(); - - // set empty navi pane label - iNaviContainer = static_cast(sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi))); - iNaviContainer->PushDefaultL(); - - // set title text - CAknTitlePane* tp = static_cast( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); - tp->SetTextL( _L("Settings") ); - - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiSettingsViewDlg::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) - { - switch (aEventType) - { - case EEventEnterKeyPressed: - case EEventItemDoubleClicked: - ShowSettingPageL(EFalse); - break; - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiSettingsViewDlg::TabChangedL(TInt /*aIndex*/) - { - iListBox->SetCurrentItemIndex(0); - - SetVisibilitiesOfSettingItemsL(); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiSettingsViewDlg::ProcessCommandL(TInt aCommandId) - { - CAknDialog::ProcessCommandL(aCommandId); - - switch (aCommandId) - { - case EProfilerGuiCmdSettingsChange: - ShowSettingPageL(ETrue); - break; - case EProfilerGuiCmdSettingsExit: - TryExitL(EAknCmdExit); - break; - default: - break; - } - } - -// -------------------------------------------------------------------------------------------- - -TKeyResponse CProfilerGuiSettingsViewDlg::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 CProfilerGuiSettingsViewDlg::PreLayoutDynInitL() - { - iListBox = static_cast( Control(EProfilerGuiSettingItemList) ); - 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 CProfilerGuiSettingsViewDlg::OkToExitL(TInt aButtonId) - { - // save settings to iSettings before exiting - - // check if trace output target changed - if(iTraceOutput == EOutputToDebugPort) - { - iSettings.iTraceOutput.Copy(KDebugOutput); - } - else - { - iSettings.iTraceOutput.Copy(KFileSystem); - } - - // save trace file prefix - if(iFilePrefix.CompareF(KNullDesC) != 0) - { - CnvUtfConverter::ConvertFromUnicodeToUtf8(iSettings.iTraceFilePrefix, iFilePrefix); - } - - // save the drive - if(iSaveDrive.CompareF(KNullDesC) != 0) - { - CnvUtfConverter::ConvertFromUnicodeToUtf8(iSettings.iSaveFileDrive, iSaveDrive); - } - - return CAknDialog::OkToExitL(aButtonId); - } - - - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiSettingsViewDlg::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 CProfilerGuiSettingsViewDlg::SetVisibilitiesOfSettingItemsL() - { - - // check if setting item array contains more than 0 items - if (iSettingItemArray->Count() > 0) - { -// ((*iSettingItemArray)[ESettingListItemPluginNameMode])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemPluginTraceOutput])->SetHidden(EFalse); - if(iTraceOutput == EOutputToDebugPort) - { - ((*iSettingItemArray)[ESettingListItemPluginSaveFileDrive])->SetHidden(ETrue); - ((*iSettingItemArray)[ESettingListItemPluginTraceFilePrefix])->SetHidden(ETrue); - } - else - { - ((*iSettingItemArray)[ESettingListItemPluginSaveFileDrive])->SetHidden(EFalse); - ((*iSettingItemArray)[ESettingListItemPluginTraceFilePrefix])->SetHidden(EFalse); - } -// ((*iSettingItemArray)[ESettingListItemPluginTraceMode])->SetHidden(ETrue); - - iSettingItemArray->RecalculateVisibleIndicesL(); - iListBox->HandleItemAdditionL(); - iListBox->UpdateScrollBarsL(); - } - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiSettingsViewDlg::UpdateListBoxL() - { - iSettingItemArray->ResetAndDestroy(); - - // create items - TInt ordinal(0); - -// AddSettingItemL(ESettingListItemPluginNameMode, -// R_PLUGIN_NAME_MODE_SETTING_TITLE, -// R_PLUGIN_NAME_MODE_SETTING_PAGE, -// R_PLUGIN_NAME_MODE_SETTING_TEXTS, -// ordinal++); - - AddSettingItemL(ESettingListItemPluginTraceOutput, - R_TRACE_OUTPUT_SETTING_TITLE, - R_TRACE_OUTPUT_SETTING_PAGE, - R_TRACE_OUTPUT_SETTING_TEXTS, - ordinal++); - - AddSettingItemL(ESettingListItemPluginSaveFileDrive, - R_SAVE_FILE_DRIVE_SETTING_TITLE, - R_SAVE_FILE_DRIVE_SETTING_PAGE, - NULL, //R_SAVE_FILE_DRIVE_SETTING_TEXTS, - ordinal++); - - AddSettingItemL(ESettingListItemPluginTraceFilePrefix, - R_SAVE_FILE_PREFIX_SETTING_TITLE, - R_SAVE_FILE_PREFIX_SETTING_PAGE, - NULL, - ordinal++); - - AddSettingItemL(ESettingListItemPluginSamplingTime, - R_TIMED_SAMPLING_PERIOD_SETTING_TITLE, - R_TIMED_SAMPLING_PERIOD_SETTING_PAGE, - NULL, - ordinal++); - - - -// AddSettingItemL(ESettingListItemPluginTraceMode, -// R_TRACE_MODE_SETTING_TITLE, -// R_TRACE_MODE_SETTING_PAGE, -// R_TRACE_MODE_SETTING_TEXTS, -// ordinal++); - - SetVisibilitiesOfSettingItemsL(); - } - -// -------------------------------------------------------------------------------------------- - -void CProfilerGuiSettingsViewDlg::AddSettingItemL(TInt aId, - TInt aTitleResource, - TInt aSettingPageResource, - TInt aAssociatedResource, - TInt aOrdinal) - { - // create a setting item - CAknSettingItem* settingItem = NULL; - - switch (aId) - { - - case ESettingListItemPluginSaveFileDrive: - { - CnvUtfConverter::ConvertToUnicodeFromUtf8(iSaveDrive, iSettings.iSaveFileDrive); - settingItem = new(ELeave) CAknTextSettingItem(aId, iSaveDrive); - settingItem->SetEmptyItemTextL(KEmptySettingItem); - break; - } - case ESettingListItemPluginTraceOutput: - if(iSettings.iTraceOutput.MatchF(KDebugOutput) != KErrNotFound) - { - iTraceOutput = EOutputToDebugPort; - } - else - { - iTraceOutput = EOutputToFileSystem; - } - settingItem = new(ELeave) CAknEnumeratedTextPopupSettingItem(aId, iTraceOutput); - - break; - - case ESettingListItemPluginTraceFilePrefix: - { - CnvUtfConverter::ConvertToUnicodeFromUtf8(iFilePrefix, iSettings.iTraceFilePrefix); - settingItem = new(ELeave) CAknTextSettingItem(aId, iFilePrefix); - settingItem->SetEmptyItemTextL(KEmptySettingItem); - break; - } - case ESettingListItemPluginSamplingTime: - { - settingItem = new(ELeave) CAknIntegerEdwinSettingItem(aId, iSettings.iTimedSamplingPeriod); - 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 - } - -// End of File - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/hb.pro --- a/piprofilerui/ui/hb/hb.pro Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -# -# 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 = PIProfilerUI -DEPENDPATH += ./src -INCLUDEPATH += inc -INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE -load(hb.prf) -symbian:CONFIG -= symbian_i18n - -# Input -HEADERS += ./inc/pimainview.h \ - ./inc/piprofilerengineprivate.h \ - ./inc/pluginattributes.h \ - ./inc/notifications.h \ - ./inc/pisettingsview.h \ - ./inc/pimainwindow.h \ - ./inc/generalattributes.h \ - ./inc/piprofilerengine.h -SOURCES += ./src/pimainview.cpp \ - ./src/piprofilerengineprivate.cpp \ - ./src/main.cpp \ - ./src/pluginattributes.cpp \ - ./src/notifications.cpp \ - ./src/pisettingsview.cpp \ - ./src/pimainwindow.cpp \ - ./src/piprofilerengine.cpp - - -RESOURCES += piprofiler.qrc - - -symbian: { - TARGET.UID2 = 0x100039CE - TARGET.UID3 = 0x2001E5AE - - BLD_INF_RULES.prj_exports += "./rom/piprofilerui_hb.iby \ - CORE_IBY_EXPORT_PATH(tools,piprofilerui.iby)" - - TARGET.CAPABILITY = ALL -TCB - - LIBS += -lcharconv -lbafl -lsysutil -lefsrv - - ICON = ../icons/qgn_menu_piprofilerui.svg - -} else { - error("Only Symbian supported!") -} \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/generalattributes.h --- a/piprofilerui/ui/hb/inc/generalattributes.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* 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 GENERALATTRIBUTES_H_ -#define GENERALATTRIBUTES_H_ -/* - * - * GeneralAttributes class definition, internal settings format - * - */ -class GeneralAttributes -{ -public: - QString mTraceOutput; - QString mTraceFilePrefix; - QString mSaveFileDrive; - int mTimedSamplingPeriod; -}; - -#endif /* GENERALATTRIBUTES_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/notifications.h --- a/piprofilerui/ui/hb/inc/notifications.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* 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 NOTIFICATIONS_H_ -#define NOTIFICATIONS_H_ - -#include - -/** - * Notifications class for viewing notification messages. - */ - -class Notifications -{ -public: - - static void showInformationNote(const QString &text); - static void showErrorNote(const QString &text); - static void showMessageBox(const QString &text); - -private: - -}; - -#endif // NOTIFICATIONS_H_ diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/pimainview.h --- a/piprofilerui/ui/hb/inc/pimainview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,206 +0,0 @@ -/* -* 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 PIMAINVIEW_H -#define PIMAINVIEW_H - -#include -#include - -#include "pluginattributes.h" -#include "piprofilerengine.h" - -class HbAction; -class HbMainWindow; -class HbDocumentLoader; -class HbApplication; -class HbLabel; -class HbWidget; -class HbListWidget; -class HbListWidgetItem; -class HbMenu; -class PISettingsView; -class PIMainWindow; -class HbDialog; - -class PIMainView: public HbView -{ -Q_OBJECT - -public: - - /** - * Constructor - */ - PIMainView(); - - /** - * Destructor - */ - ~PIMainView(); - - /** - * Initializes view - */ - void init(PIMainWindow *mainWindow, HbApplication *app, HbDocumentLoader &loader, - PIProfilerEngine *engine); - - /** - * Sets and updates new plug-in list into main view - * @param pluginList List of plug-ins - */ - void setPluginList(QList *pluginList); - -private: - - /** - * connects signals and slots - */ - void connectSignalsAndSlots(HbApplication* app); - - /** - * Loads all UI items from xml file - */ - void loadItemsFromResources(HbDocumentLoader &loader); - - /** - * Updates plug-in list according to member variable mPluginList - */ - void updatePlugInLists(); - - /** - * Gets plug-in attributes for plug-in which UID number is defined in parameter - * If plugin for UID if not found, empty pluginattributes variable is returned - */ - PluginAttributes getPluginAttributes(int uid); - - /** - * Shows profiling note - */ - void showProfilingNote(); - -private slots: - - /** - * Slot that is called when profiling status is changed. - * Method updated text in popup that is shown in the screen - */ - void profilingStatusChanged(ProfilerEngineStatus status, const QString &text = 0, - ProfilingMode profilingMode = PI_PROFILINGMODENORMAL, ProfilingOutput output = - PI_FILE_OUTPUT); - - /** - * shows about popup - */ - void showAboutPopup(); - - /** - * opens settings view - */ - void openSettingsView(); - - /** - * Enables or disables plug-in from plug-in list. If parameter is zero, selected - * plug-in from plug-in list is enabled/disabled. - */ - void enableOrDisablePlugin(HbListWidgetItem *widget = 0); - - /** - * Shows context menu for list widget - */ - void showContexMenu(HbListWidgetItem *widget, const QPointF &point); - - /** - * Opens sampler info for plug-in that is selected. - */ - void openSampleInfo(); - - /** - * sets context menu pointer to zero - */ - - void contextMenuClosed(); - - /** - * Shows profiling-popup and starts profiling - */ - void startProfiling(); - - /** - * Shows profiling popup and starts profiling - */ - void startTimedProfiling(); - - /** - * Stops profiling - */ - void stopProfiling(); - - /** - * Updates "Start timed profiling for xx seconds" text according to settings - */ - void updateTimedProfilingText(); - - /** - * Exits and leaves profiling on - */ - void exitAndLeaveProfilingOn(); - - /** - * Opens plug-in specific settings for selected plug-in - */ - void openPluginSpecificSettings(); -private: - - // main application - HbApplication *application; - - // main window - PIMainWindow *mMainWindow; - - // engine pointer - PIProfilerEngine *mEngine; - - // list of plug-ins - QList *mPluginList; - - // context menu - HbMenu *mContextMenu; - - // Actions - HbAction *mActionExit; - HbAction *mActionExitAndLeaveProfilingOn; - HbAction *mActionAbout; - HbAction *mActionStartProfiling; - HbAction *mActionStartTimedProfiling; - HbAction *mActionSettings; - HbAction *mActionStopProfiling; - - // plug-in list widget - HbListWidget *mListPlugins; - - // Profiling note - HbDialog *mProfilingNote; - - // Icons for enabled and disabled plug-ins - HbIcon mIconEnabled; - HbIcon mIconDisabled; - -}; - -#endif // PIMAINVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/pimainwindow.h --- a/piprofilerui/ui/hb/inc/pimainwindow.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* -* 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 PIPROFILERMAINWINDOW_H_ -#define PIPROFILERMAINWINDOW_H_ - -// System includes -#include -#include - -// User includes -#include "pluginattributes.h" - -// Forward declarations -class PIMainView; -class PISettingsView; -class PIProfilerEngine; -class HbDocumentLoader; -class HbApplication; - -// Class declaration -class PIMainWindow: public HbMainWindow -{ -Q_OBJECT -public: - - // Member functions - - PIMainWindow(PIProfilerEngine* engine, HbDocumentLoader &loader, HbApplication *app); - virtual ~PIMainWindow(); - -signals: - - /** - * Signal that is emitted when back button is pressed at settings view - */ - void returnedFromSettings(); - -public slots: - - /** - * Activates main view - */ - void activateMainView(); - - /** - * Activates settings view - */ - void activateSettingsView(int uid = 0); - - /** - * method that is called when back button pressed at settings view - */ - void settingsViewClosed(); - - /** - * Sets and new plugin list to all views - */ - void setPluginList(QList &pluginList); - -private: - - /** - * creates and adds main view to window - */ - void addMainView(HbDocumentLoader &loader, HbApplication *app); - - /** - * creates and adds settings view to main window - */ - void addSettingsView(); - -private slots: - -private: - // data - - // Engine wrapper - PIProfilerEngine* mEngine; - - // Main view - PIMainView* mMainView; - - // Settings view - PISettingsView* mSettingsView; - - // Back Action - HbAction *mBackAction; - - // plug-in attributes - QList mPluginAttributes; - -}; - -#endif /* PIPROFILERMAINWINDOW_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/piprofilerengine.h --- a/piprofilerui/ui/hb/inc/piprofilerengine.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -/* -* 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 PIPROFILEREGINE_H -#define PIPROFILEREGINE_H - -#include -#include - -#include "pluginattributes.h" - -class PIProfilerEnginePrivate; -class GeneralAttributes; - -enum ProfilerEngineStatus -{ - PI_PROFILING = 0, PI_FINISHED_SUCCEFULLY, PI_ERROR -}; -enum ProfilingMode -{ - PI_PROFILINGMODENORMAL = 0, PI_PROFILINGMODETIMED -}; -enum ProfilingOutput -{ - PI_DEBUG_OUTPUT = 0, PI_FILE_OUTPUT -}; - -class PIProfilerEngine: public QObject -{ -Q_OBJECT -public: - - /** - * Constructor - */ - PIProfilerEngine(); - - /** - * Initilises engine - */ - bool init(); - - /** - * Destructor - */ - ~PIProfilerEngine(); - - /** - * Gets PI Profiler general settings - */ - void getGeneralSettings(GeneralAttributes &settings); - - /** - * Notifys engine that ui is ready - */ - void notifyUIReady(); - - /** - * Saves general settings into engine - */ - bool saveGeneralSettings(GeneralAttributes &settings); - - /** - * Saves plug-in settings into engine - */ - bool savePluginSettings(const PluginAttributes &pluginAttributes); - - /** - * Starts normal profiling - */ - bool startProfiling(); - - /** - * Starts timed profiling - */ - bool startTimedProfiling(); - - /** - * Stops profiling - */ - void stopProfiling(); - - /** - * gets time limit for timed profiling - */ - int getTimeLimit(); - - /** - * Sets PI profiler engine to continue running after ui is closed. - */ - void leaveProfilingOnAfterClosing(); - - bool checkTraceLocationSanity(QString &location); - -signals: - - /** - * Signal that is emitted when plug-in list is loaded - */ - void pluginListUpdated(QList &samplerList); - - /** - * Signal that is emitted when profiling status is changed - */ - void profilingStatusChanged(ProfilerEngineStatus status, const QString &text = 0, - ProfilingMode profilingMode = PI_PROFILINGMODENORMAL, ProfilingOutput output = - PI_FILE_OUTPUT); - -private: - - // private implementation - PIProfilerEnginePrivate *mPrivate; - -private: - // Friend classes - - friend class PIProfilerEnginePrivate; - -}; - -#endif // PIPROFILEREGINE_H diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/piprofilerengineprivate.h --- a/piprofilerui/ui/hb/inc/piprofilerengineprivate.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -/* -* 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 PIPROFILEREGINEPRIVATE_H -#define PIPROFILEREGINEPRIVATE_H - -#include -#include -#include - -class TSamplerAttributes; -class PIMainView; -class PluginAttributes; -class GeneralAttributes; -class SettingItem; -class CProfilerEngineStatusChecker; -class PIProfilerEngine; -class PIProfilerEnginePrivate: public MProfilerStatusObserver -{ - -public: - - enum TProfilingMode - { - EProfilingModeNormal = 0, EProfilingModeTimed - }; - - /** - * Constructor - */ - PIProfilerEnginePrivate(PIProfilerEngine *aEngine); - - /** - * Destructor - */ - ~PIProfilerEnginePrivate(); - - /** - * Initializesprofiler engine - */ - bool Init(); - - /** - * Method that is called when UI is ready - */ - void NotifyUIReady(); - - /** - * Saves plug-in settings into engine - */ - bool SavePluginSettings(const PluginAttributes &pluginAttributes); - - /** - * Starts normal profiling - */ - bool StartProfiling(); - - /** - * Starts timed profiling - */ - bool StartTimedProfiling(); - - /** - * Stops profiling - */ - void StopProfiling(); - - /** - * MProfilerStatusObserver method that is called when profiler engine's status is changed - */ - void HandleProfilerStatusChange(KProfilerStatus aStatus); - - /** - * MProfilerStatusObserver method that is called when profiler error is occured. - */ - void HandleProfilerErrorL(TInt aError); - - /** - * Gets PI Profiler general settings - */ - void GetGeneralSettings(GeneralAttributes &settings); - - /** - * Saves general settings into engine - */ - bool SaveGeneralSettings(GeneralAttributes &settings); - - /** - * gets time limit for timed profiling - */ - int GetTimeLimit(); - - /** - * Sets PI profiler engine to continue running after ui is closed. - */ - void LeaveProfilingOnAfterClosing(); - - bool CheckTraceLocationSanity(QString &location); - -private: - - /** - * Saves general settings into engine - */ - void SaveGeneralSettingsL(); - - /** - * loads general settings from engine - */ - TInt LoadGeneralSettingsL(); - - /** - * Starts to profile - */ - void StartAllSamplerItemsL(TProfilingMode aProfilingMode); - - // Converters for symbian to qt and qt to symbian - - /** - * TSamplerAttributes -> SamplerAttributes - */ - static void convertTSamplerAttributesToPluginAttributes(TSamplerAttributes &tSamplerAttributes, - PluginAttributes &samplerAttributes); - - /** - * TSettingItem -> SettingItem - */ - static void convertTSettingItemToSettingItem(TSettingItem &tSettingItem, - SettingItem &settingItem); - - /** - * SettingItem -> TSettingItem - */ - static void convertSettingItemToTSettingItem(TSettingItem &tSettingItem, - const SettingItem &settingItem); - - /** - * TGeneralAttributes -> GeneralAttributes - */ - static void convertTGeneralAttributesToGeneralAttributes( - TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes); - - /** - * GeneralAttributes -> TGeneralAttributes - */ - static void convertGeneralAttributesToTGeneralAttributes( - TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes); - - /** - * Launches PI Profiler engine - */ - int LaunchEngineL(); - - /** - * Terminates PI Profiler engine - */ - void terminateEngine(); - - /** - * Gets plug-ins from engine - */ - void addNewSamplers(CArrayFixFlat& aAttributes); - - /** - * Loads plug-ins - */ - void loadPlugins(); - - /** - * Finds PI Profiler Engine process - */ - TInt FindProcessL(RProcess& aProc); - - /** - * Attaches client into PI Profiler engine - */ - void AttachClient(); - - /** - * Checks trace location sanity - */ - TBool CheckTraceLocationSanityL(TBuf8& aAttr); - -private: - - // Should Engine leaved on after ui is closed - bool iLeaveProfilingOnAfterClosing; - - // Public part of engine - PIProfilerEngine *iPublic; - - // Sampler Attributes - CArrayFixFlat* iSamplerAttributes; - - // General attributes - TGeneralAttributes iGeneralAttributes; - - // Engine status checker - CProfilerEngineStatusChecker* iStatusChecker; - -}; - -#endif // PIPROFILEREGINEPRIVATE_H diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/pisettingsview.h --- a/piprofilerui/ui/hb/inc/pisettingsview.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* -* 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 PISETTINGSVIEW_H -#define PISETTINGSVIEW_H - -#include -#include - -#include "generalattributes.h" - -class PIProfilerEngine; -class HbMainWindow; -class HbDataForm; -class HbDataFormModel; -class HbDataFormModelItem; -class PluginAttributes; -class SettingItem; - -class PISettingsView: public HbView -{ -Q_OBJECT - -public: - - enum OutputMode - { - OUTPUT_MODE_DEBUG, OUTPUT_MODE_FILE - }; - - /** - * Constructor - */ - PISettingsView(PIProfilerEngine *engine); - - /** - * Destructor - */ - ~PISettingsView(); - - /** - * Reads general settings from data form and returns GeneralAttributes - */ - GeneralAttributes& getGeneralAttributes(); - - /** - * Reads plug-in specific settings from data form and saves them into mPluginlist - */ - void readPluginSettings(); - - /** - * Sets plug-in specific settings and creates data form items for them - */ - void setPluginSettings(QList *pluginList); - - /** - * Expands one plug-ins settings group. Other groups are collapsed. - */ - void expandPluginGroup(int uid); - -private: - - /** - * Creates general settings form items - */ - void createGeneralSettingForms(); - - /** - * Creates plug-in specific form items - */ - void createPluginSpecificSettings(); - - /** - * Loads general settings and updates them into form - */ - void loadGeneralSettings(); - - /** - * Creates one plug-in setting item - */ - HbDataFormModelItem *createPluginSettingItem(const SettingItem *item, - HbDataFormModelItem *parentGroup); - - /** - * reads ont plug-in setting value and saves it into qstring value - */ - void readPluginSettingItemValue(HbDataFormModelItem *dataFormItem, SettingItem *settingItem); - -private slots: - - /** - * Adds text validators into form items - */ - void addTextValidators(const QModelIndex index); - -private: - - // engine pointer - PIProfilerEngine *mEngine; - - // General settings - GeneralAttributes mGeneralAttributes; - - // list of plug-ins - QList *mPluginList; - - // setting form - HbDataForm *mSettingForm; - - // model class - HbDataFormModel *mModel; - - // data form groups - HbDataFormModelItem *mGeneralSettingsGroup; - HbDataFormModelItem *mPluginSettingsGroup; - - // general setting items - HbDataFormModelItem *mOutputItem; - HbDataFormModelItem *mFileLocation; - HbDataFormModelItem *mPrefix; - HbDataFormModelItem *mSamplingPeriod; - - HbDataFormModelItem *testItem;//TODO remove! -}; - -#endif // PISETTINGSVIEW_H diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/inc/pluginattributes.h --- a/piprofilerui/ui/hb/inc/pluginattributes.h Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* -* 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 PLUGINATTRIBUTES_H_ -#define PLUGINATTRIBUTES_H_ - -/* - * - * PluginAttributes class definition, internal settings format - * - */ -#include -#include -#include - -class HbDataFormModelItem; - -/* - * - * TSettingItem class definition, internal settings format - * - */ -class SettingItem -{ -public: - enum - { - SettingItemTypeInt = 0, SettingItemTypeBool, SettingItemTypeHex, SettingItemTypeText - }; - -public: - QString mSettingText; - int mType; - QString mValue; - QString mSettingDescription; - QString mUIText; -}; - -class PluginAttributes// : public QObject -{ - //Q_OBJECT -public: - - // default constructor - PluginAttributes(); - - ~PluginAttributes(); -public: - int mUid; - QString mShortName; // name of the plugin, short name - QString mName; // name of the plugin, long name - QString mDescription; // plugin description, info about HW/SW dependencies etc. - int mSampleRate; // sample rate of the plugin - bool mEnabled; // enabled for profiling - bool mIsHidden; // hidden, i.e. no start/stop controls - int mItemCount; // plugin specific setting item count - - - // plugin specific settings, plugin implementation dependent - SettingItem mSettingItem1; - SettingItem mSettingItem2; - SettingItem mSettingItem3; - SettingItem mSettingItem4; - SettingItem mSettingItem5; - SettingItem mSettingItem6; - - HbDataFormModelItem *mFormItemSettingItem1; - HbDataFormModelItem *mFormItemSettingItem2; - HbDataFormModelItem *mFormItemSettingItem3; - HbDataFormModelItem *mFormItemSettingItem4; - HbDataFormModelItem *mFormItemSettingItem5; - HbDataFormModelItem *mFormItemSettingItem6; - HbDataFormModelItem *mFormItemSampleRate; - -}; - -#endif /* PLUGINATTRIBUTES_H_ */ diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/pimainview.docml --- a/piprofilerui/ui/hb/pimainview.docml Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/piprofiler.qrc --- a/piprofilerui/ui/hb/piprofiler.qrc Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ - - - - - pimainview.docml - - - ../icons/qgn_menu_piprofilerui.svg - ../icons/qgn_prob_piprofilerui_status_enabled.svg - ../icons/qgn_prob_piprofilerui_status_disabled.svg - - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/rom/piprofilerui_hb.iby --- a/piprofilerui/ui/hb/rom/piprofilerui_hb.iby Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +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 __PROFILERGUI_IBY__ -#define __PROFILERGUI_IBY__ - -S60_APP_EXE(PIProfilerUI) -//S60_APP_AIF_ICONS(PIProfilerUI) -data=ZRESOURCE\apps\PIProfilerUI.mif resource\apps\PIProfilerUI.mif -data=ZRESOURCE\apps\PIProfilerUI.rsc resource\apps\PIProfilerUI.rsc -//S60_APP_RESOURCE(PIProfilerUI) -data=ZPRIVATE\10003a3f\import\apps\PIProfilerUI_reg.rsc private\10003a3f\import\apps\PIProfilerUI_reg.rsc - -#endif // __PROFILERGUI_IBY__ diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/main.cpp --- a/piprofilerui/ui/hb/src/main.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* -* 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 "pimainview.h" -#include "piprofilerengine.h" -#include "notifications.h" -#include "pimainwindow.h" - -// Create custom document loader to be able to use custom views in XML. -class PIProfilerDocumentLoader: public HbDocumentLoader -{ -public: - virtual QObject *createObject(const QString& type, const QString &name); -}; - -int main(int argc, char *argv[]) -{ - - // Create application and document loader. - HbApplication app(argc, argv); - PIProfilerDocumentLoader loader; - - // Create Engine and initialize it - PIProfilerEngine engine; - if (!engine.init()) { - Notifications::showErrorNote(QString("Unable to start PI Profiler engine")); - return EXIT_FAILURE; - } - - // create and show main window - PIMainWindow mainWindow(&engine, loader, &app); - mainWindow.show(); - - return app.exec(); -} - -QObject *PIProfilerDocumentLoader::createObject(const QString& type, const QString &name) -{ - // Main view - if (type == PIMainView::staticMetaObject.className()) { - QObject *object = new PIMainView; - object->setObjectName(name); - return object; - } - - return HbDocumentLoader::createObject(type, name); -} - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/notifications.cpp --- a/piprofilerui/ui/hb/src/notifications.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* 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 "notifications.h" - -// --------------------------------------------------------------------------- - -void Notifications::showInformationNote(const QString &text) -{ - - // Create new dialog - HbDialog *infoNote = new HbDialog(); - infoNote->setAttribute(Qt::WA_DeleteOnClose); - - // set dismiss policy - infoNote->setTimeout(0); // - - // create text item for popup - HbTextItem *label = new HbTextItem(text, infoNote); - label->setAlignment(Qt::AlignCenter); - infoNote->setContentWidget(label); - infoNote->setPrimaryAction(new HbAction("Ok")); - - infoNote->show(); -} - -// --------------------------------------------------------------------------- - -void Notifications::showMessageBox(const QString &text) -{ - HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeInformation ); - note->setAttribute(Qt::WA_DeleteOnClose); - note->setTimeout(0); - note->setText(text); - note->show(); - -} - -// --------------------------------------------------------------------------- - -void Notifications::showErrorNote(const QString &text) -{ - HbMessageBox *note = new HbMessageBox(HbMessageBox::MessageTypeWarning ); - note->setAttribute(Qt::WA_DeleteOnClose); - note->setTimeout(0); - note->setText(text); - note->show(); - -} - -// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/pimainview.cpp --- a/piprofilerui/ui/hb/src/pimainview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,564 +0,0 @@ -/* -* 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pimainview.h" -#include "piprofilerengine.h" -#include "notifications.h" -#include "pimainwindow.h" - -const char *INVALIDCONFIGURATIONFILE = "Invalid configuration file"; -const char *APPLICATIONNAME = "PI Profiler"; - -// actions that are found from xml -const char *ACTIONEXIT = "actionExit"; -const char *ACTIONSTARTPROFILING = "actionStartProfiling"; -const char *ACTIONSTARTTIMEDPROFILING = "actionStartTimedProfiling"; -const char *ACTIONSETTINGS = "actionSettings"; -const char *ACTIONABOUT = "actionAbout"; - -// UI components that are found from xml - -const char *LISTWIDGETPLUGINS = "listPlugins"; -const char *TEXTMANDATORYPLUGINS = "Mandatory plug-ins:"; -const char *TEXTOPTIONALPLUGINS = "Optional plug-ins:"; - -// --------------------------------------------------------------------------- - -PIMainView::PIMainView() : - application(0), mMainWindow(0), mEngine(0), mPluginList(0), mContextMenu(0), mActionExit(0), - mActionExitAndLeaveProfilingOn(0), mActionAbout(0), mActionStartTimedProfiling(0), - mActionSettings(0), mActionStopProfiling(0), mListPlugins(0), mProfilingNote(0) -{ - -} - -// --------------------------------------------------------------------------- - -PIMainView::~PIMainView() -{ -} - -// --------------------------------------------------------------------------- - -void PIMainView::init(PIMainWindow *mainWindow, HbApplication* app, HbDocumentLoader &loader, - PIProfilerEngine *engine) -{ - - application = app; - mMainWindow = mainWindow; - - // Load items from xml file - loadItemsFromResources(loader); - - // Set list widget items - mListPlugins->setClampingStyle(HbScrollArea::BounceBackClamping); - mListPlugins->setFrictionEnabled(true); - - // Create stop profiling action - mActionStopProfiling = new HbAction("Stop Profiling", this); - - // Create exit and leave profiling on action - mActionExitAndLeaveProfilingOn = new HbAction("Close UI\n(Continue profiling)", this); - - mEngine = engine; - - // Connect signals and slots - this->connectSignalsAndSlots(app); - - // Create icons - mIconDisabled = HbIcon(":/gfx/disabled.svg"); - mIconEnabled = HbIcon(":/gfx/enabled.svg"); - - // update timed profiling text according to settings - updateTimedProfilingText(); -} - -// --------------------------------------------------------------------------- - - -void PIMainView::connectSignalsAndSlots(HbApplication* app) -{ - - // Menu items: - connect(mActionExit, SIGNAL(triggered()), app, SLOT( quit() )); - connect(mActionSettings, SIGNAL(triggered()), this, SLOT( openSettingsView() )); - connect(mActionAbout, SIGNAL(triggered()), this, SLOT( showAboutPopup() )); - connect(mActionStartProfiling, SIGNAL(triggered()), this, SLOT( startProfiling() )); - connect(mActionStartTimedProfiling, SIGNAL(triggered()), this, SLOT( startTimedProfiling() )); - - // List widget actions - connect(mListPlugins, SIGNAL(activated(HbListWidgetItem*)), this, - SLOT(enableOrDisablePlugin(HbListWidgetItem*))); - connect(mListPlugins, SIGNAL(longPressed(HbListWidgetItem*, QPointF)), this, - SLOT(showContexMenu(HbListWidgetItem*, QPointF))); - - connect( - mEngine, - SIGNAL(profilingStatusChanged(ProfilerEngineStatus, const QString&, ProfilingMode, ProfilingOutput)), - this, - SLOT(profilingStatusChanged(ProfilerEngineStatus, const QString&, ProfilingMode, ProfilingOutput))); - - connect(mMainWindow, SIGNAL(returnedFromSettings()), this, SLOT( updateTimedProfilingText() )); - connect(mActionExitAndLeaveProfilingOn, SIGNAL(triggered()), this, - SLOT( exitAndLeaveProfilingOn() )); - connect(mActionStopProfiling, SIGNAL(triggered()), this, SLOT( stopProfiling() )); - -} - -// --------------------------------------------------------------------------- - - -void PIMainView::loadItemsFromResources(HbDocumentLoader &loader) -{ - - // ACTIONS: - - // Exit - QObject *object = loader.findObject(ACTIONEXIT); - Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); - this->mActionExit = qobject_cast (object); - - // About - object = loader.findObject(ACTIONABOUT); - Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); - this->mActionAbout = qobject_cast (object); - - // Settings - object = loader.findObject(ACTIONSETTINGS); - Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); - this->mActionSettings = qobject_cast (object); - - // Start profiling - object = loader.findObject(ACTIONSTARTPROFILING); - Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); - this->mActionStartProfiling = qobject_cast (object); - - // Start timed profiling - object = loader.findObject(ACTIONSTARTTIMEDPROFILING); - Q_ASSERT_X((object != 0), APPLICATIONNAME, INVALIDCONFIGURATIONFILE); - this->mActionStartTimedProfiling = qobject_cast (object); - - QGraphicsWidget *widget = loader.findWidget(LISTWIDGETPLUGINS); - Q_ASSERT_X((widget != 0), "Launcher", "Invalid launcher.xml file"); - this->mListPlugins = qobject_cast (widget); -} - -// --------------------------------------------------------------------------- - -void PIMainView::showAboutPopup() -{ - - Notifications::showMessageBox("Version 2.2.1 - 10th August 2010. \n" - "Copyright © 2010 Nokia Corporation " - "and/or its subsidiary(-ies). " - "All rights reserved."); - -} -// --------------------------------------------------------------------------- - -void PIMainView::setPluginList(QList *pluginList) -{ - - this->mPluginList = pluginList; - this->updatePlugInLists(); - -} - -// --------------------------------------------------------------------------- - -void PIMainView::openSettingsView() -{ - mMainWindow->activateSettingsView(); -} - -// --------------------------------------------------------------------------- - -void PIMainView::updatePlugInLists() -{ - - mListPlugins->clear(); - - // Create Compulsory and Optional labels into list widget: - HbListWidgetItem *compulsory = new HbListWidgetItem(); - compulsory->setText(TEXTMANDATORYPLUGINS); - mListPlugins->addItem(compulsory); - - HbListWidgetItem *optional = new HbListWidgetItem(); - optional->setText(TEXTOPTIONALPLUGINS); - mListPlugins->addItem(optional); - - HbIcon *icon; - - // Go thru pluginlist and add list item for each plug-in into list widget - for (int index = 0; index < mPluginList->size(); index++) { - QString plugInName = mPluginList->at(index).mName; - - // get icon for item - if (mPluginList->at(index).mEnabled) { - icon = &mIconEnabled; - } - else { - icon = &mIconDisabled; - } - - // Create list widget item - // TODO ensure that this does not leak memory - HbListWidgetItem *newItem = new HbListWidgetItem(); - newItem->setIcon(*icon); - newItem->setText(plugInName); - newItem->setData(mPluginList->at(index).mUid); - - // check if plug-in is compulsory or optional - if (mPluginList->at(index).mIsHidden) { - mListPlugins->insertItem(mListPlugins->row(optional), newItem); - } - else { - mListPlugins->addItem(newItem); - - } - } - -} -// --------------------------------------------------------------------------- - -void PIMainView::enableOrDisablePlugin(HbListWidgetItem *widget) -{ - - // if widget is not found, set currently highlighted item as widget - // (in that case this method is called from context menu) - if (widget == 0) { - widget = mListPlugins->currentItem(); - } - - // if this method is called from list widget's activated signal, do nothing - // if context menu is open. - else { - if (mContextMenu != 0) { - return; - } - } - bool ok = false; - int widgetUid = widget->data().toInt(&ok); - if (!ok) { - qWarning("PIProfiler: Unable to find plug-in uid"); - return; - } - - // go thru plug-in array and find checked plug-in - for (int index = 0; index < mPluginList->size(); index++) { - - if (mPluginList->at(index).mUid == widgetUid) { - PluginAttributes pluginAttributes = mPluginList->at(index); - - // if plug-in is hidden it cannot be disabled - if (pluginAttributes.mIsHidden) { - return; - } - - // change enable status and set icon correct - if (pluginAttributes.mEnabled) { - pluginAttributes.mEnabled = false; - widget->setIcon(mIconDisabled); - } - else { - pluginAttributes.mEnabled = true; - widget->setIcon(mIconEnabled); - } - - // save plug-in settings - if (mEngine->savePluginSettings(pluginAttributes)) { - mPluginList->replace(index, pluginAttributes); - } - else { - // if saving operation failed, revert icon back - if (pluginAttributes.mEnabled) { - widget->setIcon(mIconEnabled); - } - else { - pluginAttributes.mEnabled = true; - widget->setIcon(mIconDisabled); - } - Notifications::showErrorNote( - "Error occured while saving settings to Profiler engine."); - } - break; - } - - } - -} - -// --------------------------------------------------------------------------- - -void PIMainView::showContexMenu(HbListWidgetItem *widget, const QPointF &point) -{ - - bool ok = false; - int uid = widget->data().toInt(&ok); - - if (!ok) { - return; - } - - for (int index = 0; index < mPluginList->size(); index++) { - - if (mPluginList->at(index).mUid == uid) { - - // Create Context menu: - mContextMenu = new HbMenu(); - mContextMenu->setPreferredPos(point, HbPopup::TopLeftCorner); - mContextMenu->setDismissPolicy(HbPopup::TapOutside); - mContextMenu->setAttribute(Qt::WA_DeleteOnClose); - - // Enable/disable plug-in - if (!mPluginList->at(index).mIsHidden) { - HbAction *enableAction; - if (mPluginList->at(index).mEnabled) { - enableAction = mContextMenu->addAction(QString("Disable")); - } - else { - enableAction = mContextMenu->addAction(QString("Enable")); - } - connect(enableAction, SIGNAL(triggered()), this, SLOT( enableOrDisablePlugin() )); - } - - //FIXME take these into use once expanding and collapsing data form groups works. - // Plug-in specific settings - /*if (mPluginList->at(index).mItemCount != 0 || mPluginList->at(index).mSampleRate != -1) { - HbAction *pluginSettingsAction = mContextMenu->addAction(QString( - "Plug-in settings")); - connect(pluginSettingsAction, SIGNAL(triggered()), this, - SLOT(openPluginSpecificSettings())); - }*/ - - // Plug in info - HbAction *infoAction = mContextMenu->addAction(QString("Plug-in info")); - connect(infoAction, SIGNAL(triggered()), this, SLOT( openSampleInfo() )); - - connect(mContextMenu, SIGNAL(aboutToClose()), this, SLOT( contextMenuClosed() )); - mContextMenu->open(this, SLOT(contextMenuClosed())); - break; - } - } - -} - -// --------------------------------------------------------------------------- - -void PIMainView::openSampleInfo() -{ - - // Show plug-in specific info - bool ok = false; - int uid = mListPlugins->currentItem()->data().toInt(&ok); - if (!ok) { - return; - } - Notifications::showInformationNote(this->getPluginAttributes(uid).mDescription); -} -// --------------------------------------------------------------------------- - -PluginAttributes PIMainView::getPluginAttributes(int uid) -{ - // Get plug-in attributes from the plug-in list based on uid number - for (int index = 0; index < mPluginList->size(); index++) { - if (mPluginList->at(index).mUid == uid) { - return mPluginList->at(index); - } - } - return PluginAttributes(); -} - -// --------------------------------------------------------------------------- - -void PIMainView::contextMenuClosed() -{ - mContextMenu = 0; -} - -// --------------------------------------------------------------------------- - -void PIMainView::startProfiling() -{ - - showProfilingNote(); - if (!mEngine->startProfiling()) { - Notifications::showErrorNote("Unable to start profiling"); - mProfilingNote->close(); - mProfilingNote = 0; - } -} - -// --------------------------------------------------------------------------- -void PIMainView::startTimedProfiling() -{ - showProfilingNote(); - if (!mEngine->startTimedProfiling()) { - Notifications::showErrorNote("Unable to start profiling"); - mProfilingNote->close(); - mProfilingNote = 0; - } -} - -// --------------------------------------------------------------------------- - - -void PIMainView::stopProfiling() -{ - mProfilingNote = 0; - mEngine->stopProfiling(); -} - -// --------------------------------------------------------------------------- - -void PIMainView::profilingStatusChanged(ProfilerEngineStatus status, const QString &text, - ProfilingMode profilingMode, ProfilingOutput outputMode) -{ - - if (status == PI_FINISHED_SUCCEFULLY) { - // Profiling finished successfully - - // close profiling note - if (mProfilingNote != 0) { - mProfilingNote->close(); - mProfilingNote = 0; - } - - // Show info text - Notifications::showInformationNote(text); - return; - } - - if (mProfilingNote == 0) { - // if profiling note is not yet shown, create it - showProfilingNote(); - } - - if (status == PI_ERROR) { - // if errors occured, close profiling note and show error message - if (mProfilingNote != 0) { - mProfilingNote->close(); - mProfilingNote = 0; - } - Notifications::showErrorNote(text); - } - - else if (status == PI_PROFILING) { - // if profiling is on-going, update info text according to output: - - HbLabel *titleLabel = new HbLabel("Profiling...", mProfilingNote); - titleLabel->setAlignment(Qt::AlignCenter); - - HbTextItem *textItem = new HbTextItem(text, mProfilingNote); - textItem->setAlignment(Qt::AlignCenter); - - mProfilingNote->setHeadingWidget(titleLabel); - mProfilingNote->setContentWidget(textItem); - } - -} - -// --------------------------------------------------------------------------- - -void PIMainView::showProfilingNote() -{ - // Create new dialog - mProfilingNote = new HbDialog(); - mProfilingNote->setAttribute(Qt::WA_DeleteOnClose); - - // Make it modal. - mProfilingNote->setModal(true); - - // set dismiss policy - mProfilingNote->setDismissPolicy(HbPopup::NoDismiss); - mProfilingNote->setTimeout(0); // - mProfilingNote->setBackgroundFaded(true); - - // create label and text item for popup - HbTextItem *titleLabel = new HbTextItem("Profiling...", mProfilingNote); - HbTextItem *label = new HbTextItem("Starting to profile", mProfilingNote); - - label->setAlignment(Qt::AlignCenter); - titleLabel->setAlignment(Qt::AlignCenter); - mProfilingNote->setHeadingWidget(titleLabel); - mProfilingNote->setContentWidget(label); - - // set actions - mProfilingNote->setPrimaryAction(mActionStopProfiling); - mProfilingNote->setSecondaryAction(mActionExitAndLeaveProfilingOn); - - mProfilingNote->open(); -} - -// --------------------------------------------------------------------------- - -void PIMainView::updateTimedProfilingText() -{ - QString text = "Start timed profiling("; - QString number; - number.setNum(mEngine->getTimeLimit(), 10); - text.append(number); - text.append("s)"); - mActionStartTimedProfiling->setText(text); - -} - -// --------------------------------------------------------------------------- - -void PIMainView::exitAndLeaveProfilingOn() -{ - mEngine->leaveProfilingOnAfterClosing(); - application->quit(); -} -// --------------------------------------------------------------------------- - -void PIMainView::openPluginSpecificSettings() -{ - HbListWidgetItem *listItem = mListPlugins->currentItem(); - bool ok = false; - int uid = listItem->data().toInt(&ok); - if (ok) { - mMainWindow->activateSettingsView(uid); - } -} - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/pimainwindow.cpp --- a/piprofilerui/ui/hb/src/pimainwindow.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* 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: -* -*/ - - -// System include -#include -#include -#include -#include -#include -#include - -// User includes -#include "pimainwindow.h" -//#include "mcsendengine.h" -#include "pimainview.h" -#include "pisettingsview.h" -#include "generalattributes.h" -#include "piprofilerengine.h" -#include "notifications.h" - -// xml definition of view -const char *PI_MAINVIEW_XML = ":/xml/pimainview.docml"; - -// name of the application view object in the xml file. -const char *APPLICATIONVIEW = "PIMainView"; - -// ViewManager Constructor -PIMainWindow::PIMainWindow(PIProfilerEngine* engine, HbDocumentLoader &loader, HbApplication *app) : - mEngine(engine), mMainView(0), mSettingsView(0), mBackAction(0) -{ - - HbProgressDialog *note = new HbProgressDialog(HbProgressDialog::WaitDialog); - note->setAttribute(Qt::WA_DeleteOnClose); - note->setText("Loading PI Profiler plug-ins..."); - note->open(); - - // Add the views to the main window - addMainView(loader, app); - addSettingsView(); - - // Set main view to be displayed on startup - activateMainView(); - - connect(mEngine, SIGNAL(pluginListUpdated(QList&)), this, - SLOT(setPluginList(QList&))); - - QMetaObject::connectSlotsByName(this); - - mEngine->notifyUIReady(); - - note->close(); - -} - -PIMainWindow::~PIMainWindow() -{ - if (mMainView != 0) { - delete mMainView; - mMainView = 0; - } - if (mSettingsView != 0) { - delete mSettingsView; - mSettingsView = 0; - } - -} - -// Methods to add views to the main window - -void PIMainWindow::addMainView(HbDocumentLoader &loader, HbApplication *app) -{ - // Load xml-file - bool ok = false; - loader.load(PI_MAINVIEW_XML, &ok); - - // Load Application View: - QGraphicsWidget *widget = loader.findWidget(APPLICATIONVIEW); - Q_ASSERT_X(ok && (widget != 0), "PIProfiler", "Invalid docml file"); - mMainView = qobject_cast (widget); - - mMainView->init(this, app, loader, mEngine); - - // Add view to main window - this->addView(mMainView); - -} - -void PIMainWindow::addSettingsView() -{ - mSettingsView = new PISettingsView(mEngine); - mBackAction = new HbAction("back", this); - - bool value = connect(mBackAction, SIGNAL(triggered()), this, SLOT(settingsViewClosed())); - mSettingsView->setNavigationAction(mBackAction); - mSettingsView->navigationAction()->setIcon(HbIcon(":/gfx/enabled.svg")); - addView(mSettingsView); -} - -// Slots to handle view change -void PIMainWindow::activateMainView() -{ - setCurrentView(mMainView); -} - -void PIMainWindow::activateSettingsView(int uid) -{ - if (uid != 0) { - mSettingsView->expandPluginGroup(uid); - } - setCurrentView(mSettingsView); -} - -void PIMainWindow::settingsViewClosed() -{ - if (currentView() == mSettingsView) { - bool error = false; - if (!mEngine->saveGeneralSettings(mSettingsView->getGeneralAttributes())) { - error = true; - } - - mSettingsView->readPluginSettings(); - - for (int index = 0; index < mPluginAttributes.size(); index++) { - if (!mEngine->savePluginSettings(mPluginAttributes.at(index))) { - error = true; - } - } - - if (error) { - Notifications::showErrorNote("Unable to save some of the settings into engine"); - } - activateMainView(); - emit returnedFromSettings(); - } - else { - qWarning("Back action is not triggered at the correct view!"); - } -} - -void PIMainWindow::setPluginList(QList &pluginList) -{ - mPluginAttributes = pluginList; - mMainView->setPluginList(&mPluginAttributes); - mSettingsView->setPluginSettings(&mPluginAttributes); -} diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/piprofilerengine.cpp --- a/piprofilerui/ui/hb/src/piprofilerengine.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* 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 "piprofilerengine.h" -#include "piprofilerengineprivate.h" - -PIProfilerEngine::PIProfilerEngine() -{ - -} - -PIProfilerEngine::~PIProfilerEngine() -{ - if (mPrivate != 0) { - delete mPrivate; - mPrivate = 0; - } -} - -bool PIProfilerEngine::init() -{ - mPrivate = new PIProfilerEnginePrivate(this); - return mPrivate->Init(); -} - -void PIProfilerEngine::getGeneralSettings(GeneralAttributes &settings) -{ - mPrivate->GetGeneralSettings(settings); -} - -void PIProfilerEngine::notifyUIReady() -{ - mPrivate->NotifyUIReady(); -} - -bool PIProfilerEngine::saveGeneralSettings(GeneralAttributes &settings) -{ - return mPrivate->SaveGeneralSettings(settings); - -} - -bool PIProfilerEngine::savePluginSettings(const PluginAttributes &pluginAttributes) -{ - return mPrivate->SavePluginSettings(pluginAttributes); -} - -bool PIProfilerEngine::startProfiling() -{ - return mPrivate->StartProfiling(); -} -bool PIProfilerEngine::startTimedProfiling() -{ - return mPrivate->StartTimedProfiling(); -} -void PIProfilerEngine::stopProfiling() -{ - return mPrivate->StopProfiling(); -} - -int PIProfilerEngine::getTimeLimit() -{ - return mPrivate->GetTimeLimit(); -} - -void PIProfilerEngine::leaveProfilingOnAfterClosing() -{ - mPrivate->LeaveProfilingOnAfterClosing(); -} - -bool PIProfilerEngine::checkTraceLocationSanity(QString &location) -{ - mPrivate->CheckTraceLocationSanity(location); -} diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/piprofilerengineprivate.cpp --- a/piprofilerui/ui/hb/src/piprofilerengineprivate.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,678 +0,0 @@ -/* -* 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 -#include -#include "piprofilerengineprivate.h" -#include -#include "pluginattributes.h" -#include "generalattributes.h" -#include "piprofilerengine.h" - -// literals for default general setting values -_LIT8(KTraceOutput, "file_system"); -_LIT8(KTraceDebugOutput, "debug_output"); -_LIT8(KProfilerDefaultDrive, "E:\\data"); -_LIT8(KProfilerDefaultPrefix, "Profiler_#"); -_LIT(KProfilerEngineExe, "PIProfilerEngine.exe"); -const TInt KProfilerDefaultTimedSamplingPeriod = 60; // Sampling time in seconds - -// --------------------------------------------------------------------------- - -PIProfilerEnginePrivate::PIProfilerEnginePrivate(PIProfilerEngine *aEngine) : - iPublic(aEngine), iSamplerAttributes(0), iStatusChecker(0), iLeaveProfilingOnAfterClosing( - EFalse) -{ - -} - -// --------------------------------------------------------------------------- - -PIProfilerEnginePrivate::~PIProfilerEnginePrivate() -{ - - // remove profiler client - RProfiler::RemoveClient(); - // Terminate engine in case it is running. - if (iLeaveProfilingOnAfterClosing == EFalse) { - terminateEngine(); - } - - // delete sampler attributes. - if (iSamplerAttributes) { - delete iSamplerAttributes; - iSamplerAttributes = 0; - } - - if (iStatusChecker) { - iStatusChecker->Cancel(); - delete iStatusChecker; - iStatusChecker = NULL; - } -} - -// --------------------------------------------------------------------------- - -bool PIProfilerEnginePrivate::Init() -{ - TRAPD(error, this->LaunchEngineL()); - if (error != KErrNone) { - return false; - } - - // initialize attribute arrays - - TRAP(error, iSamplerAttributes = new (ELeave) CArrayFixFlat (20)); // max sampler count is 20 - if (error != KErrNone) { - return false; - } - - // engine status checker - TRAP(error, iStatusChecker = CProfilerEngineStatusChecker::NewL()); - if (error != KErrNone) { - return false; - } - - iStatusChecker->SetObserver(this); - - TRAP(error, LoadGeneralSettingsL()); - if (error != KErrNone) { - return false; - } - - return true; -} - -// --------------------------------------------------------------------------- - - -int PIProfilerEnginePrivate::LaunchEngineL() -{ - - TRequestStatus stat = KRequestPending; - RProcess proc; - - TInt err(KErrNone); - - // check if process exists - err = FindProcessL(proc); - - // check if already exists and don't start a new eshell profiling - if (err == KErrNotFound) { - // try create new process - err = proc.Create(KProfilerEngineExe, _L("")); - - // check if RProcess::Create() succeeded - if (err == KErrNone) { - // Trigger rendezvous on the supplied TRequestStatus object - proc.Rendezvous(stat); - - // kick off the engine process - proc.Resume(); - - // wait for the constructor to complete - User::WaitForRequest(stat); - - // just lose the handle - proc.Close(); - } - } - - // Increase the client reference count in server: - AttachClient(); -} - -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::AttachClient() -{ - RProfiler::AttachClient(); -} -// --------------------------------------------------------------------------- - -int PIProfilerEnginePrivate::FindProcessL(RProcess& aProc) -{ - TProcessId engId; - TFindProcess procName; - procName.Find(_L("PIProfilerEngine.exe*")); - TFullName aResult; - TFullName aResult2; - TInt err(KErrNone); - - // find the first appearance - err = procName.Next(aResult); - if (err != KErrNone) { - // did not find any engine process - return err; - } - else { - err = aProc.Open(procName); - if (err == KErrNone) { - if (aProc.ExitCategory().Length() > 0) { - aProc.Close(); - // process already exited => create a new one - return KErrNotFound; - } - aProc.Close(); - } - } - - // 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); - - // check if aResult2 contained the second appearance of profiler engine - if(aResult2.CompareF(aResult) > 0) - { - // other process found, i.e. right process to communicate with, in case started from eshell - err = aProc.Open(procName); - if(err == KErrNone) - { - if(aProc.ExitCategory().Length() > 0) - { - // process already exited => create a new one - return KErrNotFound; - } - aProc.Close(); - } - } - - return err; -} - -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::terminateEngine() -{ - // exit profiler engine - RProfiler::ExitProfiler(); -} -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::NotifyUIReady() -{ - // load initial plugins - loadPlugins(); - - // get the initial state - int initialState = iStatusChecker->GetInitialState(); - if (initialState == ERunning) { - HandleProfilerStatusChange(ERunning); - } -} - -// --------------------------------------------------------------------------- - - -void PIProfilerEnginePrivate::loadPlugins() -{ - // get samplers from Profiler Engine (client-server session) - // and add the to the samplers list for the first time - LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - get sampler plugins")); - - TInt err = RProfiler::GetSamplerAttributes(*iSamplerAttributes); - - // check if engine provided a list of samplers - if (err != KErrNone) { - // could not get samplers from engine - LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - failed to connect engine")); - } - else { - LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - adding new samplers into view")); - addNewSamplers(*iSamplerAttributes); - }LOGTEXT(_L("CProfilerGuiModel::LoadPlugins - exit")); -} -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::addNewSamplers(CArrayFixFlat& aAttributes) -{ - TSamplerAttributes item; - - TInt count(aAttributes.Count()); - - // loop the attribute array and insert them into view list - - QList samplerList; - - for (TInt i(0); i < count; i++) { - // get a TSamplerAttributes from list at a time - item = aAttributes.At(i); - - PluginAttributes samplerAttributes; - convertTSamplerAttributesToPluginAttributes(item, samplerAttributes); - - samplerList.append(samplerAttributes); - } - - emit iPublic->pluginListUpdated(samplerList); - -} - -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::convertTSamplerAttributesToPluginAttributes( - TSamplerAttributes &tSamplerAttributes, PluginAttributes &samplerAttributes) -{ - - samplerAttributes.mUid = tSamplerAttributes.iUid; - samplerAttributes.mSampleRate = tSamplerAttributes.iSampleRate; - samplerAttributes.mEnabled = tSamplerAttributes.iEnabled; - samplerAttributes.mIsHidden = tSamplerAttributes.iIsHidden; - samplerAttributes.mItemCount = tSamplerAttributes.iItemCount; - - TBuf16<8> temp8; - temp8.Copy(tSamplerAttributes.iShortName); - samplerAttributes.mShortName = QString((QChar*) temp8.Ptr(), temp8.Length()); - - TBuf16<64> temp64; - temp64.Copy(tSamplerAttributes.iName); - samplerAttributes.mName = QString((QChar*) temp64.Ptr(), temp64.Length()); - - TBuf16<256> temp256; - temp256.Copy(tSamplerAttributes.iDescription); - samplerAttributes.mDescription = QString((QChar*) temp256.Ptr(), temp256.Length()); - - convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem1, - samplerAttributes.mSettingItem1); - convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem2, - samplerAttributes.mSettingItem2); - convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem3, - samplerAttributes.mSettingItem3); - convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem4, - samplerAttributes.mSettingItem4); - convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem5, - samplerAttributes.mSettingItem5); - convertTSettingItemToSettingItem(tSamplerAttributes.iSettingItem6, - samplerAttributes.mSettingItem6); -} - -// --------------------------------------------------------------------------- - -bool PIProfilerEnginePrivate::SavePluginSettings(const PluginAttributes &samplerAttributes) -{ - for (int index = 0; index < iSamplerAttributes->Count(); index++) { - if (samplerAttributes.mUid == this->iSamplerAttributes->At(index).iUid) { - iSamplerAttributes->At(index).iEnabled = samplerAttributes.mEnabled; - iSamplerAttributes->At(index).iSampleRate = samplerAttributes.mSampleRate; - - convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem1, - samplerAttributes.mSettingItem1); - convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem2, - samplerAttributes.mSettingItem2); - convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem3, - samplerAttributes.mSettingItem3); - convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem4, - samplerAttributes.mSettingItem4); - convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem5, - samplerAttributes.mSettingItem5); - convertSettingItemToTSettingItem(this->iSamplerAttributes->At(index).iSettingItem6, - samplerAttributes.mSettingItem6); - - TSamplerAttributes attr = iSamplerAttributes->At(index); - - if (RProfiler::SetSamplerAttributes(this->iSamplerAttributes->At(index)) == KErrNone) { - return true; - } - else { - return false; - } - } - } - return false; - -} - -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::StartAllSamplerItemsL(TProfilingMode aProfilingMode) -{ - TBuf<256> activeWriterDes; - TBuf8<256> writer8; - - //iState = MProfilerStatusObserver::EInitializing; - - RProfiler::TProfilingMode profilingMode = aProfilingMode == EProfilingModeTimed - ? RProfiler::EProfilingModeTimed : RProfiler::EProfilingModeNormal; - - // try to start profiling process through client-server interface - if (RProfiler::StartSampling(profilingMode) == KErrNotFound) { - // profiler stopped (e.g. from eshell) and must be restarted - LaunchEngineL(); - // try to launch sampling again - RProfiler::StartSampling(profilingMode); - } -} - -// --------------------------------------------------------------------------- -// -------------------------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::StopProfiling() -{ - // Stop profiling process through CS session - RProfiler::StopSampling(); - -} - -// -------------------------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::HandleProfilerStatusChange(KProfilerStatus aStatus) -{ - if (aStatus == EIdle || aStatus == ERunning) { - - if (iGeneralAttributes.iTraceOutput == KTraceOutput) { - - TBuf<256> buf; - // get profiler file name - TBool valu = RProfiler::GetFileName(buf); - - QString filename = QString((QChar*) buf.Ptr(), buf.Length()); - - // Let ui know that status has changed - - if (aStatus == EIdle) { - QString text = QString("Wrote trace data to: \n"); - text.append(filename); - emit iPublic->profilingStatusChanged(PI_FINISHED_SUCCEFULLY, text, - PI_PROFILINGMODENORMAL, PI_FILE_OUTPUT); - } - else if (aStatus == ERunning) { - QString text = QString("Writing trace data to: \n"); - text.append(filename); - emit iPublic->profilingStatusChanged(PI_PROFILING, text, PI_PROFILINGMODENORMAL, - PI_FILE_OUTPUT); - } - } - else { - // Let ui know that status has changed - if (aStatus == EIdle) { - emit iPublic->profilingStatusChanged(PI_FINISHED_SUCCEFULLY, QString( - "Wrote trace data to debug output"), PI_PROFILINGMODENORMAL, PI_DEBUG_OUTPUT); - } - else if (aStatus == ERunning) { - emit iPublic->profilingStatusChanged(PI_PROFILING, QString( - "Writing trace data to debug output"), PI_PROFILINGMODENORMAL, PI_DEBUG_OUTPUT); - } - } - } - -} - -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::HandleProfilerErrorL(TInt aError) -{ - { - QString errorMsg = QString("Error: "); - QString KNoMemory = QString("Cannot write to file, check settings"); - - // message from pwr sampler - if (aError < -1000) { - errorMsg.append(QString("Stop other power measurement tools!")); - } - else if (aError == KErrAlreadyExists || aError == 11) { - errorMsg.append(QString("Close old Profiler before start!")); - } - else if (aError == KErrNotReady) { - errorMsg.append(QString("Memory card removed, failed to write!")); - } - else if (aError == KErrPathNotFound) { - errorMsg.append(QString("Given trace data location does not exist")); - } - else { - if (aError == KErrNoMemory || aError == KErrOverflow || aError == KErrDirFull || aError - == KErrDiskFull || aError == KErrNotReady) { - errorMsg.append(KNoMemory); - } - else { - errorMsg.append(QString("code: ")); - errorMsg.append(aError); - } - } - - emit iPublic->profilingStatusChanged(PI_ERROR, errorMsg); - } - -} -// --------------------------------------------------------------------------- - -bool PIProfilerEnginePrivate::StartProfiling() -{ - TRAPD(error, this->StartAllSamplerItemsL(PIProfilerEnginePrivate::EProfilingModeNormal)); - if (error == KErrNone) { - return true; - } - return false; - -} - -// --------------------------------------------------------------------------- - -bool PIProfilerEnginePrivate::StartTimedProfiling() -{ - TRAPD(error, this->StartAllSamplerItemsL(PIProfilerEnginePrivate::EProfilingModeTimed)); - if (error == KErrNone) { - return true; - } - return false; -} - -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::convertTGeneralAttributesToGeneralAttributes( - TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes) -{ - samplerAttributes.mTimedSamplingPeriod = tSamplerAttributes.iTimedSamplingPeriod; - int test = tSamplerAttributes.iSaveFileDrive.Length(); - TBuf16 test2; - test2.Copy(tSamplerAttributes.iSaveFileDrive); - samplerAttributes.mSaveFileDrive = QString((QChar*) test2.Ptr(), test2.Length()); - test2.Copy(tSamplerAttributes.iTraceFilePrefix); - samplerAttributes.mTraceFilePrefix = QString((QChar*) test2.Ptr(), test2.Length()); - test2.Copy(tSamplerAttributes.iTraceOutput); - samplerAttributes.mTraceOutput = QString((QChar*) test2.Ptr(), test2.Length()); -} -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::convertGeneralAttributesToTGeneralAttributes( - TGeneralAttributes &tSamplerAttributes, GeneralAttributes &samplerAttributes) -{ - tSamplerAttributes.iTimedSamplingPeriod = samplerAttributes.mTimedSamplingPeriod; - - tSamplerAttributes.iTraceOutput.Copy(TBuf ( - samplerAttributes.mTraceOutput.utf16())); - tSamplerAttributes.iSaveFileDrive.Copy(TBuf ( - samplerAttributes.mSaveFileDrive.utf16())); - tSamplerAttributes.iTraceFilePrefix.Copy(TBuf ( - samplerAttributes.mTraceFilePrefix.utf16())); - -} -// --------------------------------------------------------------------------- - -TInt PIProfilerEnginePrivate::LoadGeneralSettingsL() -{ - // local variable for getting saved settings from profiler engine - TGeneralAttributes generalAttr; - TInt err(KErrNone); - - // before loading saved settings (from settings file) set the default values - iGeneralAttributes.iTraceOutput.Copy(KTraceOutput); - iGeneralAttributes.iTraceFilePrefix.Copy(KProfilerDefaultPrefix); - iGeneralAttributes.iSaveFileDrive.Copy(KProfilerDefaultDrive); - iGeneralAttributes.iTimedSamplingPeriod = KProfilerDefaultTimedSamplingPeriod; - - // request to - err = RProfiler::GetGeneralAttributes(generalAttr); - - // check that request succesfull - if (err != KErrNone) { - // could not connect profiler engine, use - return err; - } - - // check if saved settings different than the default - if (generalAttr.iTraceOutput.MatchF(iGeneralAttributes.iTraceOutput) == KErrNotFound) { - iGeneralAttributes.iTraceOutput.Copy(generalAttr.iTraceOutput); - } - - if (generalAttr.iTraceFilePrefix.MatchF(iGeneralAttributes.iTraceFilePrefix) == KErrNotFound) { - iGeneralAttributes.iTraceFilePrefix.Copy(generalAttr.iTraceFilePrefix); - } - - if (generalAttr.iSaveFileDrive.MatchF(iGeneralAttributes.iSaveFileDrive) == KErrNotFound) { - iGeneralAttributes.iSaveFileDrive.Copy(generalAttr.iSaveFileDrive); - } - - if (generalAttr.iTimedSamplingPeriod > 0) { - iGeneralAttributes.iTimedSamplingPeriod = generalAttr.iTimedSamplingPeriod; - } - - return err; -} - -// --------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::GetGeneralSettings(GeneralAttributes &settings) -{ - convertTGeneralAttributesToGeneralAttributes(iGeneralAttributes, settings); -} -// --------------------------------------------------------------------------- - -bool PIProfilerEnginePrivate::SaveGeneralSettings(GeneralAttributes &settings) -{ - convertGeneralAttributesToTGeneralAttributes(iGeneralAttributes, settings); - TRAPD(error, SaveGeneralSettingsL()); - if (error != KErrNone) { - return false; - } - return true; -} - -// --------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::SaveGeneralSettingsL() -{ - TInt err(KErrNone); - - // save general attributes to Profiler Engine - err = RProfiler::SetGeneralAttributes(iGeneralAttributes); - - // check if save failed - if (err == KErrNotFound) { - // profiler stopped (e.g. from eshell) and must be restarted - LaunchEngineL(); - - err = RProfiler::SetGeneralAttributes(iGeneralAttributes); - if (err != KErrNone) { - // leave no use to continue - User::Leave(err); - } - } -} -// -------------------------------------------------------------------------------------------- - -int PIProfilerEnginePrivate::GetTimeLimit() -{ - return iGeneralAttributes.iTimedSamplingPeriod; -} - -// -------------------------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::convertTSettingItemToSettingItem(TSettingItem &tSettingItem, - SettingItem &settingItem) -{ - - settingItem.mType = tSettingItem.iType; - settingItem.mSettingDescription = QString((QChar*) tSettingItem.iSettingDescription.Ptr(), - tSettingItem.iSettingDescription.Length()); - settingItem.mSettingText = QString((QChar*) tSettingItem.iSettingText.Ptr(), - tSettingItem.iSettingText.Length()); - settingItem.mUIText = QString((QChar*) tSettingItem.iUIText.Ptr(), - tSettingItem.iUIText.Length()); - settingItem.mValue = QString((QChar*) tSettingItem.iValue.Ptr(), tSettingItem.iValue.Length()); - -} -// -------------------------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::convertSettingItemToTSettingItem(TSettingItem &tSettingItem, - const SettingItem &settingItem) -{ - tSettingItem.iType = settingItem.mType; - tSettingItem.iSettingDescription.Copy(TBuf<256> (settingItem.mSettingDescription.utf16())); - tSettingItem.iSettingText.Copy(TBuf<64> (settingItem.mSettingText.utf16())); - tSettingItem.iUIText.Copy(TBuf<64> (settingItem.mUIText.utf16())); - tSettingItem.iValue.Copy(TBuf<128> (settingItem.mValue.utf16())); - -} - -// -------------------------------------------------------------------------------------------- - -void PIProfilerEnginePrivate::LeaveProfilingOnAfterClosing() -{ - iLeaveProfilingOnAfterClosing = ETrue; -} - -// -------------------------------------------------------------------------------------------- - -bool PIProfilerEnginePrivate::CheckTraceLocationSanity(QString& location) -{ - TBool value = EFalse; - - TBuf8 fileLocation; - fileLocation.Copy(TBuf (location.utf16())); - TRAPD(error, value = CheckTraceLocationSanityL(fileLocation)); - if (error != KErrNone) { - return false; - } - return value; -} - -// -------------------------------------------------------------------------------------------- - -TBool PIProfilerEnginePrivate::CheckTraceLocationSanityL(TBuf8 &aAttr) -{ - RFs fs; - User::LeaveIfError(fs.Connect()); - - TBuf<32> drive; - - CnvUtfConverter::ConvertToUnicodeFromUtf8(drive, aAttr); - - TDriveUnit driveUnit = TDriveUnit(drive); - - TBool ret(EFalse); - - // check that the root folder is correct - if (drive.Length() > 2 && BaflUtils::CheckFolder(fs, drive.Left(3)) == KErrNone) { - // check then if drive has still some space - if (!SysUtil::DiskSpaceBelowCriticalLevelL(&fs, 0, driveUnit)) { - ret = ETrue; - } - } - - fs.Close(); - return ret; -} diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/pisettingsview.cpp --- a/piprofilerui/ui/hb/src/pisettingsview.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,434 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include - -#include "pisettingsview.h" -#include "pimainview.h" -#include "notifications.h" -#include "piprofilerengine.h" -#include "pluginattributes.h" - -const QStringList OUTPUTMODES = (QStringList() << "Debug output" << "File system"); - -PISettingsView::PISettingsView(PIProfilerEngine *engine) : - mEngine(engine), mGeneralAttributes(), mPluginList(0), mSettingForm(0), mModel(0), - mGeneralSettingsGroup(0), mPluginSettingsGroup(0), mOutputItem(0), mFileLocation(0), - mPrefix(0), mSamplingPeriod(0) - -{ - this->setTitle("Settings"); - - //create setting form - mSettingForm = new HbDataForm(this); - - //create a model class - mModel = new HbDataFormModel(this); - - this->createGeneralSettingForms(); - - // Set created model model to form - mSettingForm->setModel(mModel); - - // Set widget into view - setWidget(mSettingForm); - - // load general settings into data form - loadGeneralSettings(); - - // Let us know when list is shown - connect(mSettingForm, SIGNAL(itemShown(const QModelIndex)), this, - SLOT(addTextValidators(const QModelIndex))); - - // Set general group as expanded. - /*HbDataFormViewItem *viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem( - mGeneralSettingsGroup)); - viewItem->setExpanded(true);*/ - -} - -// --------------------------------------------------------------------------- - -PISettingsView::~PISettingsView() -{ - if (mSettingForm != 0) { - delete mSettingForm; - mSettingForm = 0; - } - - if (mModel != 0) { - delete mModel; - mModel = 0; - } -} - -// --------------------------------------------------------------------------- - -void PISettingsView::addTextValidators(const QModelIndex index) -{ - HbDataFormModelItem *modelItem = mModel->itemFromIndex(index); - - // Check if item is integer text box - if (modelItem->contentWidgetData(QString("TextboxType")) == QString("integer")) { - - QString value = modelItem->contentWidgetData(QString("text")).toString(); - // Create validator that accepts only integer values. - HbValidator *validator = new HbValidator(this); - validator->addField(new QIntValidator(0, 10000, validator), "1"); - - // Line editor widget from form - HbDataFormViewItem *viewItem = qobject_cast (mSettingForm->itemByIndex(index)); - HbWidget *widget = viewItem->dataItemContentWidget(); - HbLineEdit *editor = static_cast (widget); - - if (editor != 0) { - // Create interface and attach lineEdit to it. - HbEditorInterface editInterface(editor); - // set editor as phone number editor so that inserting numbers is easier - editor->setInputMethodHints(Qt::ImhDigitsOnly); - editor->setValidator(validator); - } - modelItem->setContentWidgetData(QString("text"), value); - - } - -} - -// --------------------------------------------------------------------------- - -void PISettingsView::createGeneralSettingForms() -{ - - // Add data into setting model - - // General settings group - mGeneralSettingsGroup = mModel->appendDataFormGroup(QString("General settings"), - mModel->invisibleRootItem()); - - // Output drop down list - mOutputItem = mModel->appendDataFormItem(HbDataFormModelItem::ComboBoxItem, - QString("Output to"), mGeneralSettingsGroup); - mOutputItem->setContentWidgetData(QString("items"), OUTPUTMODES); - - // Data file location textbox - mFileLocation = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString( - "Save file in"), mGeneralSettingsGroup); - mFileLocation->setContentWidgetData("maxLength", 64); - - // File name textbox - mPrefix = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString("File prefix"), - mGeneralSettingsGroup); - mPrefix->setContentWidgetData("maxLength", 64); - - // Period that used when using timed progfiling - mSamplingPeriod = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, QString( - "Sampling period(s)"), mGeneralSettingsGroup); - mSamplingPeriod->setContentWidgetData(QString("TextboxType"), QString("integer")); - mSamplingPeriod->setContentWidgetData("maxLength", 64); - -} - -// --------------------------------------------------------------------------- - -void PISettingsView::createPluginSpecificSettings() -{ - - // Create plug-in specific group - mPluginSettingsGroup = mModel->appendDataFormGroup(QString("Plug-in specific settings"), - mModel->invisibleRootItem()); - - if (mPluginList != 0) { - - for (int index = 0; index < mPluginList->size(); index++) { - - // create plug-in specific settings group for each plug-in which has own settings - if (mPluginList->at(index).mItemCount > 0 || mPluginList->at(index).mSampleRate != -1) { - - // Create settings group - HbDataFormModelItem *mPluginGroup = mModel->appendDataFormGroup(QString( - mPluginList->at(index).mName), mPluginSettingsGroup); - - - // get plugin attributes - PluginAttributes attributes = mPluginList->at(index); - - // Create sample rate item if it is needed - if (attributes.mSampleRate != -1) { - attributes.mFormItemSampleRate = mModel->appendDataFormItem( - HbDataFormModelItem::TextItem, "Sample rate (ms)", mPluginGroup); - attributes.mFormItemSampleRate->setContentWidgetData(QString("TextboxType"), QString( - "integer")); - - attributes.mFormItemSampleRate->setContentWidgetData("text", - attributes.mSampleRate); - } - - // create other setting items - attributes.mFormItemSettingItem1 = createPluginSettingItem( - &attributes.mSettingItem1, mPluginGroup); - attributes.mFormItemSettingItem2 = createPluginSettingItem( - &attributes.mSettingItem2, mPluginGroup); - attributes.mFormItemSettingItem3 = createPluginSettingItem( - &attributes.mSettingItem3, mPluginGroup); - attributes.mFormItemSettingItem4 = createPluginSettingItem( - &attributes.mSettingItem4, mPluginGroup); - attributes.mFormItemSettingItem5 = createPluginSettingItem( - &attributes.mSettingItem5, mPluginGroup); - attributes.mFormItemSettingItem6 = createPluginSettingItem( - &attributes.mSettingItem6, mPluginGroup); - mPluginList->replace(index, attributes); - } - } - } - -} - -// --------------------------------------------------------------------------- - -HbDataFormModelItem *PISettingsView::createPluginSettingItem(const SettingItem *item, - HbDataFormModelItem *parentGroup) -{ - // create individual plug-in setting item - - HbDataFormModelItem *settingItem = 0; - if (item->mSettingText != QString("")) { - switch (item->mType) { - case SettingItem::SettingItemTypeBool: - settingItem = mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem, - item->mUIText, parentGroup); - bool value = false; - if (item->mValue == "true") { - value = true; - } - settingItem->setContentWidgetData("tristate", value); - - break; - case SettingItem::SettingItemTypeHex: - settingItem = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, item->mUIText, - parentGroup); - settingItem->setContentWidgetData("text", item->mValue); - settingItem->setContentWidgetData("maxLength", 64); - - break; - - case SettingItem::SettingItemTypeInt: - settingItem = mModel->appendDataFormItem(HbDataFormModelItem::TextItem, item->mUIText, - parentGroup); - settingItem->setContentWidgetData("text", item->mValue); - settingItem->setContentWidgetData(QString("TextboxType"), QString("integer")); - settingItem->setContentWidgetData("maxLength", 64); - - break; - - case SettingItem::SettingItemTypeText: - HbDataFormModelItem *settingItem = mModel->appendDataFormItem( - HbDataFormModelItem::TextItem, item->mUIText, parentGroup); - settingItem->setContentWidgetData("text", item->mValue); - settingItem->setContentWidgetData("maxLength", 64); - - break; - - } - } - return settingItem; - -} - -// --------------------------------------------------------------------------- - -void PISettingsView::loadGeneralSettings() -{ - // load general settings from engine - mEngine->getGeneralSettings(mGeneralAttributes); - - // set output item correct - if (mGeneralAttributes.mTraceOutput == "file_system") { - mOutputItem->setContentWidgetData(QString("currentIndex"), OUTPUT_MODE_FILE); - } - else { - mOutputItem->setContentWidgetData(QString("currentIndex"), OUTPUT_MODE_DEBUG); - } - - mFileLocation->setContentWidgetData(QString("text"), mGeneralAttributes.mSaveFileDrive); - mPrefix->setContentWidgetData(QString("text"), mGeneralAttributes.mTraceFilePrefix); - mSamplingPeriod->setContentWidgetData(QString("text"), mGeneralAttributes.mTimedSamplingPeriod); - -} - -// --------------------------------------------------------------------------- - -GeneralAttributes &PISettingsView::getGeneralAttributes() -{ - // Read items from ui elements and save them into mGeneralAttributes - - - QString fileLocation = mFileLocation->contentWidgetData(QString("text")).toString(); - if (fileLocation.length() > 0 && mEngine->checkTraceLocationSanity(fileLocation)) { - mGeneralAttributes.mSaveFileDrive = fileLocation; - } - else { - Notifications::showErrorNote("Invalid path, check settings!"); - mFileLocation->setContentWidgetData(QString("text"), mGeneralAttributes.mSaveFileDrive); - } - bool ok = false; - mGeneralAttributes.mTimedSamplingPeriod - = mSamplingPeriod->contentWidgetData(QString("text")).toInt(&ok); - - if (!ok) { - // this should not happen because intvalidator is set into text box - qWarning("Unable to convert sampling period to integer"); - - } - mGeneralAttributes.mTraceFilePrefix = mPrefix->contentWidgetData(QString("text")).toString(); - - if (mOutputItem->contentWidgetData(QString("currentIndex")).toInt(&ok) == OUTPUT_MODE_FILE) { - mGeneralAttributes.mTraceOutput = QString("file_system"); - } - else { - mGeneralAttributes.mTraceOutput = QString("debug_output"); - } - - return mGeneralAttributes; - -} - -// --------------------------------------------------------------------------- - -void PISettingsView::setPluginSettings(QList *pluginList) -{ - mPluginList = pluginList; - createPluginSpecificSettings(); -} - -// --------------------------------------------------------------------------- - - -void PISettingsView::readPluginSettingItemValue(HbDataFormModelItem *dataFormItem, - SettingItem *settingItem) -{ - if (settingItem != 0 && dataFormItem != 0) { - // check if item type is bool, convert bool to string - if (settingItem->mType == SettingItem::SettingItemTypeBool) { - bool checkboxValue = true; - checkboxValue = dataFormItem->contentWidgetData(QString("tristate")).toBool(); - - if(checkboxValue){ - settingItem->mValue = QString("true"); - } - else{ - settingItem->mValue = QString("false"); - } - - } - // otherwise save text straight into settin item - else { - settingItem->mValue = dataFormItem->contentWidgetData("text").toString(); - } - } -} - -// --------------------------------------------------------------------------- - -void PISettingsView::readPluginSettings() -{ - // Read Plug-in setting item and save values into m - for (int index = 0; index < mPluginList->size(); index++) { - - PluginAttributes attributes = mPluginList->at(index); - - readPluginSettingItemValue(attributes.mFormItemSettingItem1, &attributes.mSettingItem1); - readPluginSettingItemValue(attributes.mFormItemSettingItem2, &attributes.mSettingItem2); - readPluginSettingItemValue(attributes.mFormItemSettingItem3, &attributes.mSettingItem3); - readPluginSettingItemValue(attributes.mFormItemSettingItem4, &attributes.mSettingItem4); - readPluginSettingItemValue(attributes.mFormItemSettingItem5, &attributes.mSettingItem5); - readPluginSettingItemValue(attributes.mFormItemSettingItem6, &attributes.mSettingItem6); - - if (attributes.mFormItemSampleRate != 0) { - bool ok = false; - attributes.mSampleRate - = attributes.mFormItemSampleRate->contentWidgetData("text").toInt(&ok); - if (!ok) { - // this should not happen because intvalidator is set into text box - qWarning("Unable to convert sample rate to integer"); - } - } - - mPluginList->replace(index, attributes); - - } - -} - -// --------------------------------------------------------------------------- - -void PISettingsView::expandPluginGroup(int uid) -{ - - // FIXME some of the methods is deprecating fix once new methods available. - //collapse all group items - /*HbDataFormViewItem *viewItem = 0; - viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mPluginSettingsGroup)); - if (viewItem != 0) { - viewItem->setExpanded(false); - } - viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mGeneralSettingsGroup)); - if (viewItem != 0) { - viewItem->setExpanded(false); - } - // Set plugin group as expanded. - viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(mPluginSettingsGroup)); - if (viewItem != 0) { - viewItem->setExpanded(true); - } - // find group item which has same uid number - for (int index = 0; index < mPluginSettingsGroup->childCount(); index++) { - HbDataFormModelItem *item = mPluginSettingsGroup->childAt(index); - bool ok = false; - int groupUid = item->data(HbDataFormModelItem::KeyRole).toInt(&ok); - if (ok) { - if (uid == groupUid) { - // Set group as expanded - viewItem = mSettingForm->dataFormViewItem(mModel->indexFromItem(item)); - if (viewItem != 0) { - viewItem->setExpanded(true); - } - - // scroll view so that group is shown - mSettingForm->scrollTo(mModel->indexFromItem(item), - HbAbstractItemView::PositionAtTop); - break; - - } - } - - }*/ - -} - -// --------------------------------------------------------------------------- diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/hb/src/pluginattributes.cpp --- a/piprofilerui/ui/hb/src/pluginattributes.cpp Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* 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 "pluginattributes.h" - -PluginAttributes::PluginAttributes() : - mFormItemSettingItem1(0), mFormItemSettingItem2(0), mFormItemSettingItem3(0), - mFormItemSettingItem4(0), mFormItemSettingItem5(0), mFormItemSettingItem6(0), - mFormItemSampleRate(0) -{ - -} - -PluginAttributes::~PluginAttributes() -{ - -} diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/icons/qgn_menu_piprofilerui.svg --- a/piprofilerui/ui/icons/qgn_menu_piprofilerui.svg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg --- a/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_disabled.svg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - diff -r 5db69f4c3d06 -r b048e15729d6 piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg --- a/piprofilerui/ui/icons/qgn_prob_piprofilerui_status_enabled.svg Mon Aug 23 15:50:54 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ - - - - - -