diff -r d05a55b217df -r 79311d856354 idlehomescreen/widgetmanager/src/wmwidgetdata.cpp --- a/idlehomescreen/widgetmanager/src/wmwidgetdata.cpp Wed Apr 14 15:47:59 2010 +0300 +++ b/idlehomescreen/widgetmanager/src/wmwidgetdata.cpp Tue Apr 27 16:26:12 2010 +0300 @@ -36,6 +36,7 @@ #include "wmpersistentwidgetorder.h" #include "wmresourceloader.h" #include "wmcommon.h" +#include "wmimageconverter.h" // --------------------------------------------------------- // CWmWidgetData::NewL @@ -87,32 +88,26 @@ iPublisherUid = KNullUid; iLogoSize = aLogoSize; iAnimationTimer = NULL; - iTimeoutTimer = NULL; iAnimationIndex = 0; iAsyncUninstalling = EFalse; - iFireLogoChanged = EFalse; iMdcaPoint = NULL; - iWidgetName = NULL; } // --------------------------------------------------------- // CWmWidgetData::ConstructL // --------------------------------------------------------- // -void CWmWidgetData::ConstructL( +void CWmWidgetData::ConstructL( CHsContentInfo* aHsContentInfo, RWidgetRegistryClientSession* aRegistryClientSession ) { // start decoding the icon - iImageConverter = CWmImageConverter::NewL( this ); - iWait = new (ELeave) CActiveSchedulerWait(); + iImageConverter = CWmImageConverter::NewL(); iAnimationTimer = CPeriodic::NewL( CActive::EPriorityStandard ); - iTimeoutTimer = CPeriodic::NewL( CActive::EPriorityStandard ); InitL( aHsContentInfo, aRegistryClientSession ); // start logo handling - iImageConverter->SetLogoSize( iLogoSize ); HandleIconString( HsContentInfo().IconPath() ); } @@ -154,19 +149,6 @@ // CWmWidgetData::~CWmWidgetData() { - if ( iTimeoutTimer && - iTimeoutTimer->IsActive() ) - { - iTimeoutTimer->Cancel(); - } - delete iTimeoutTimer; - - delete iWidgetName; - if ( iWait && iWait->IsStarted() ) - { - iWait->AsyncStop(); - } - delete iWait; SetObserver( NULL ); DestroyAnimData(); delete iAnimationTimer; @@ -243,37 +225,6 @@ } // --------------------------------------------------------- -// CWmWidgetData::NotifyCompletion -// --------------------------------------------------------- -// -void CWmWidgetData::NotifyCompletion( TInt aError ) - { - delete iLogoImage; - iLogoImage = NULL; - delete iLogoImageMask; - iLogoImageMask = NULL; - if ( KErrNone != aError ) - { - // no image available. Do nothing. - } - else - { - iLogoImage = iImageConverter->Bitmap(); - iLogoImageMask = iImageConverter->Mask(); - - if ( iWait && iWait->IsStarted() ) - { - iWait->AsyncStop(); - } - if ( iFireLogoChanged ) - { - iFireLogoChanged = EFalse; - FireDataChanged(); - } - } - } - -// --------------------------------------------------------- // CWmWidgetData::HandleIconString // --------------------------------------------------------- // @@ -305,27 +256,17 @@ { size = iLogoSize; } - TInt err = iImageConverter->HandleIconString( - size.iWidth, size.iHeight, *iconStr ); + + iImageConverter->HandleIconString( + size, + *iconStr, + iLogoImage, + iLogoImageMask ); delete iconStr; iconStr = NULL; - // handle result - if ( KErrNone == err && iWait && - IsPrepairingLogo() && iTimeoutTimer ) - { - iTimeoutTimer->Cancel(); - const TInt tickInterval = 200000; - iTimeoutTimer->Start( - tickInterval,tickInterval,TCallBack(TimeoutTick, this)); - iWait->Start(); - } - else if ( KErrNone != err && iFireLogoChanged ) - { - FireDataChanged(); // draw default icon - iFireLogoChanged = EFalse; - } + FireDataChanged(); // draw default icon } // --------------------------------------------------------- @@ -447,21 +388,25 @@ // CWmWidgetData::ReCreateLogo // --------------------------------------------------------- // -void CWmWidgetData::ReCreateLogo( const TSize& aSize ) - { - delete iLogoImage; - iLogoImage = NULL; - delete iLogoImageMask; - iLogoImageMask = NULL; - - if ( iWait && iWait->IsStarted() ) +void CWmWidgetData::UpdateLogo( const TSize& aSize, TBool aReCreateLogo ) + { + iLogoSize = aSize; + if ( aReCreateLogo ) { - iWait->AsyncStop(); + delete iLogoImage; + iLogoImage = NULL; + delete iLogoImageMask; + iLogoImageMask = NULL; + HandleIconString( HsContentInfo().IconPath() ); } - - iFireLogoChanged = ETrue; - iLogoSize = aSize; - HandleIconString( HsContentInfo().IconPath() ); + else + { + iImageConverter->UpdateImageSize( + iLogoSize, + HsContentInfo().IconPath(), + *iLogoImage, + *iLogoImageMask ); + } } // --------------------------------------------------------- @@ -500,27 +445,13 @@ { // re-convert image // change event will be fired later when bitmap is ready - ReCreateLogo( iLogoSize ); + UpdateLogo( iLogoSize, ETrue ); } return !( sameAppearance && sameLogo ); } // --------------------------------------------------------- -// CWmWidgetData::IsPrepairingLogo -// --------------------------------------------------------- -// -TBool CWmWidgetData::IsPrepairingLogo() - { - TBool prepairing( EFalse ); - if ( !iLogoImage ) - { - prepairing = iImageConverter->IsProcessing(); - } - return prepairing; - } - -// --------------------------------------------------------- // CWmWidgetData::VisualizeUninstall // --------------------------------------------------------- // @@ -606,21 +537,6 @@ } // --------------------------------------------------------- -// CWmWidgetData::TimeoutTick -// --------------------------------------------------------- -// -TInt CWmWidgetData::TimeoutTick( TAny* aPtr ) - { - CWmWidgetData* self = static_cast< CWmWidgetData* >( aPtr ); - self->iTimeoutTimer->Cancel(); - if ( self->iWait && self->iWait->IsStarted() ) - { - self->iWait->AsyncStop(); - } - return 1; - } - -// --------------------------------------------------------- // CWmWidgetData::AnimationBitmap // --------------------------------------------------------- //