# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1271249861 -10800 # Node ID f73067c3e563d11dbe2f1cb769bdc304211b9d82 # Parent 95ac6b0f7f5b5c65f04513807f7d9fb2b751a879 Revision: 201013 Kit: 201015 diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/data/fmradio.rss --- a/fmradio/fmradio/data/fmradio.rss Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/data/fmradio.rss Wed Apr 14 15:57:41 2010 +0300 @@ -45,7 +45,7 @@ #include #define KFMRadioBitmapFile APP_BITMAP_DIR "\\fmradio.mif" -#define KAvkonBitmapFile APP_BITMAP_DIR "\\avkon2.mif" + // RESOURCE DEFINITIONS // RESOURCE RSS_SIGNATURE { } @@ -109,29 +109,6 @@ }; } }; - } - -// --------------------------------------------------------------------------- -// r_fmradio_channel_list_icon_array -// --------------------------------------------------------------------------- -// -RESOURCE AKN_ICON_ARRAY r_fmradio_channel_list_icon_array - { - type = EAknIconArraySimple; - bmpfile = KAvkonBitmapFile; - icons = - { - AKN_ICON - { - iconId = EMbmAvkonQgn_indi_speaker; - maskId = EMbmAvkonQgn_indi_speaker_mask; - }, - AKN_ICON - { - iconId = EMbmAvkonQgn_indi_marked_add; - maskId = EMbmAvkonQgn_indi_marked_add_mask; - } - }; } // --------------------------------------------------------------------------- diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/group/fmradio.mmp --- a/fmradio/fmradio/group/fmradio.mmp Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/group/fmradio.mmp Wed Apr 14 15:57:41 2010 +0300 @@ -113,5 +113,6 @@ LIBRARY centralrepository.lib LIBRARY ecom.lib LIBRARY gesturehelper.lib +LIBRARY touchfeedback.lib DEBUGLIBRARY flogger.lib diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/group/iconlist.txt --- a/fmradio/fmradio/group/iconlist.txt Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/group/iconlist.txt Wed Apr 14 15:57:41 2010 +0300 @@ -28,7 +28,6 @@ -c8,8 qgn_indi_radio_tb_list.svg -c8,8 qgn_indi_tb_rename.svg -c8,8 qgn_indi_cam4_tb_delete.svg --c8,8 qgn_indi_marked_add.svg -c8,8 qgn_indi_tb_ihf_on.svg -c8,8 qgn_indi_tb_ihf_off.svg -c8,8 qgn_indi_radio_tb_manualtune.svg diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/inc/fmradioalfvisualizer.h --- a/fmradio/fmradio/inc/fmradioalfvisualizer.h Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/inc/fmradioalfvisualizer.h Wed Apr 14 15:57:41 2010 +0300 @@ -64,6 +64,7 @@ class CAlfGradientBrush; class CFMRadioAlfBitmapAnimation; class CFMRadioAppUi; +class MTouchFeedback; using namespace GestureHelper; // CLASS DEFINITION @@ -424,6 +425,8 @@ TBool iRevertGestureDrag; // The axis for the currently ongoing stroke TFMRadioDragAxis iDragAxis; + // Tactile feedback for closing the popup + MTouchFeedback* iTouchFeedback; // For Tactile feedback }; #endif //FMRADIOALFVISUALIZER_H diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/inc/fmradiochannellistcontainer.h --- a/fmradio/fmradio/inc/fmradiochannellistcontainer.h Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/inc/fmradiochannellistcontainer.h Wed Apr 14 15:57:41 2010 +0300 @@ -166,12 +166,6 @@ */ CCoeControl* ComponentControl( TInt aIndex ) const; /** - * Redraw the window owned by this container - * @since 2.6 - * @param aRect the size of the window to redraw - */ - void Draw( const TRect& aRect ) const; - /** * From MEikListBoxObserver, for listbox event handling. * @since 2.6 * @param aListBox The originating list box. @@ -207,6 +201,13 @@ * @param aRect Frame rectangle for container. */ void ConstructL( const TRect& aRect); + + /* + * Adds icons to the icon array. + * @param aArray array to add icons + */ + void CreateListIconsL( CArrayPtr& aArray ); + /** * Create the channel list (initially all spots are set as empty) * @since 2.6 @@ -220,6 +221,8 @@ // Index of the most recently listened channel to keep the listbox up-to-date. TInt iLastChIndex; RPointerArray iControls; + // array for list icon bitmaps + RPointerArray iBitMaps; TBool iFadeStatus; CRadioEngine& iRadioEngine; TBool iMoveAction; diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h --- a/fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/inc/fmradioscanlocalstationscontainer.h Wed Apr 14 15:57:41 2010 +0300 @@ -136,12 +136,6 @@ */ CCoeControl* ComponentControl( TInt aIndex ) const; /** - * Redraw the window owned by this container - * @since 2.6 - * @param aRect the size of the window to redraw - */ - void Draw( const TRect& aRect ) const; - /** * From MEikListBoxObserver, for listbox event handling. * @since 2.6 * @param aListBox The originating list box. @@ -177,6 +171,12 @@ * @param aRect Frame rectangle for container. */ void ConstructL( const TRect& aRect); + + /* + * Adds icons to the icon array. + * @param aArray array to add icons + */ + void CreateListIconsL( CArrayPtr& aArray ); private: //data @@ -184,14 +184,14 @@ CAknSingleNumberStyleListBox* iChannelList; // Array of channel list items CDesCArray* iChannelItemArray; - // Index of the most recently listened channel to keep the listbox up-to-date. TInt iLastChIndex; RPointerArray iControls; TBool iFadeStatus; - CAknsBasicBackgroundControlContext* iBackground; MAknsSkinInstance* iSkin; CRadioEngine& iRadioEngine; //not own + // array for list icon bitmaps + RPointerArray iBitMaps; }; diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/src/fmradioalfvisualizer.cpp --- a/fmradio/fmradio/src/fmradioalfvisualizer.cpp Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/src/fmradioalfvisualizer.cpp Wed Apr 14 15:57:41 2010 +0300 @@ -43,6 +43,7 @@ #include #include #include +#include #include "fmradioalfvisualizer.h" #include "fmradioappui.h" @@ -117,6 +118,8 @@ CAlfControlGroup& group = aEnv.ControlGroup( KFMRadioVisualControlsGroupId ); group.AppendL( iBmpAnimation ); + iTouchFeedback = MTouchFeedback::Instance(); + UpdateLayout(); if ( AknLayoutUtils::PenEnabled() ) @@ -551,6 +554,7 @@ if ( volPopup->IsVisible() ) { volPopup->CloseVolumePopup(); + iTouchFeedback->InstantFeedback( ETouchFeedbackBasic ); } else { diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/src/fmradioappui.cpp --- a/fmradio/fmradio/src/fmradioappui.cpp Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/src/fmradioappui.cpp Wed Apr 14 15:57:41 2010 +0300 @@ -1493,8 +1493,12 @@ { case EEventFocusLost: { - // being sent to background, so if tuning cancel first then handle event - CancelSeek(); + // being sent to background, cancel any seek expect local stations scan + if ( iCurrentRadioState == EFMRadioStateBusySeek ) + { + iRadioEngine->CancelScan(); + HandleStopSeekCallback(); + } CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); break; } @@ -1646,6 +1650,20 @@ ( aControl == iActiveVolumePopupControl ) ) { TInt volumeControlLevel = iActiveVolumePopupControl->Value(); + + if ( iRadioEngine->IsMuteOn() && volumeControlLevel == 1 ) + { + // Volume has been muted and volume is changed from + // popup. Restore volume to the previous level. + volumeControlLevel = iRadioEngine->GetVolume(); + volumeControlLevel++; + if ( volumeControlLevel > KFMRadioMaxVolumeLevel ) + { + volumeControlLevel = KFMRadioMaxVolumeLevel; + } + iActiveVolumePopupControl->SetValue( volumeControlLevel ); + } + // Set mute if ( volumeControlLevel == KFMRadioMinVolumeLevel ) { diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/src/fmradiochannellistcontainer.cpp --- a/fmradio/fmradio/src/fmradiochannellistcontainer.cpp Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/src/fmradiochannellistcontainer.cpp Wed Apr 14 15:57:41 2010 +0300 @@ -33,6 +33,9 @@ #include #include #include +#include +#include + #include "fmradioappui.h" #include "fmradiochannellistcontainer.h" @@ -82,12 +85,6 @@ void CFMRadioChannelListContainer::ConstructL( const TRect& aRect ) { CreateWindowL(); - CAknIconArray* radioTypeIcons = NULL; - - radioTypeIcons = new( ELeave ) CAknIconArray( 2 ); - CleanupStack::PushL( radioTypeIcons ); - - radioTypeIcons->AppendFromResourceL( R_FMRADIO_CHANNEL_LIST_ICON_ARRAY ); // Instantiate a listbox for the channel list iChannelList = new ( ELeave ) CAknDoubleNumberStyleListBox(); @@ -103,14 +100,13 @@ emptyString = StringLoader::LoadLC( R_QTN_FMRADIO_LIST_NO_STATIONS, iEikonEnv ); iChannelList->View()->SetListEmptyTextL( *emptyString ); - CleanupStack::PopAndDestroy( emptyString ); + CleanupStack::PopAndDestroy( emptyString ); - // The following line really takes the ownership -- must be the last item - // there, as if leaves and the object is in cleanupstack, problems arise. - // (Cleanup stack corruption!) - // Set the icon array for this list. List takes ownership of the array. - iChannelList->ItemDrawer()->FormattedCellData()->SetIconArrayL( radioTypeIcons ); - CleanupStack::Pop( radioTypeIcons ); + CAknIconArray* listIconArray = new ( ELeave ) CAknIconArray( 2 ); + CleanupStack::PushL( listIconArray ); + CreateListIconsL( *listIconArray ); + iChannelList->ItemDrawer()->FormattedCellData()->SetIconArrayL( listIconArray ); + CleanupStack::Pop( listIconArray ); // Array for channels iChannelItemArray = new( ELeave ) CDesCArrayFlat( KMaxNumberOfChannelListItems ); @@ -119,7 +115,6 @@ CFMRadioAppUi* appUi = static_cast( iCoeEnv->AppUi() ); iChannelView = static_cast ( appUi->View( KFMRadioChannelListViewId ) ); - ActivateL(); } @@ -131,10 +126,81 @@ CFMRadioChannelListContainer::~CFMRadioChannelListContainer() { iControls.ResetAndDestroy(); + iControls.Close(); + iBitMaps.ResetAndDestroy(); + iBitMaps.Close(); delete iChannelItemArray; } // ---------------------------------------------------- +// CFMRadioChannelListContainer::CreateListIconsL +// ---------------------------------------------------- +// +void CFMRadioChannelListContainer::CreateListIconsL( CArrayPtr& aArray ) + { + if ( iBitMaps.Count() ) + { + // release any previously created bitmaps + iBitMaps.ResetAndDestroy(); + } + + TRgb defaultColor = iEikonEnv->Color( EColorControlText ); + MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); + + // speaker icon + CFbsBitmap* playingIconBitmap = NULL; + CFbsBitmap* playingIconBitmapMask = NULL; + + AknsUtils::CreateColorIconLC( skinInstance, + KAknsIIDQgnIndiSpeaker, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + playingIconBitmap, + playingIconBitmapMask, + KAvkonBitmapFile, + EMbmAvkonQgn_indi_speaker, + EMbmAvkonQgn_indi_speaker_mask, + defaultColor + ); + iBitMaps.AppendL( playingIconBitmap ); + iBitMaps.AppendL( playingIconBitmapMask ); + CleanupStack::Pop( 2 ); // playingIconBitmap, playingIconBitmapMask + + CGulIcon* playingIcon = CGulIcon::NewLC(); + playingIcon->SetBitmapsOwnedExternally( ETrue ); + playingIcon->SetBitmap( playingIconBitmap ); + playingIcon->SetMask( playingIconBitmap ); + aArray.AppendL( playingIcon ); + CleanupStack::Pop( playingIcon ); + + // marked icon + CFbsBitmap* markedIconBitmap = NULL; + CFbsBitmap* markedIconBitmapMask = NULL; + + AknsUtils::CreateColorIconLC( skinInstance, + KAknsIIDQgnIndiMarkedAdd, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + markedIconBitmap, + markedIconBitmapMask, + KAvkonBitmapFile, + EMbmAvkonQgn_indi_marked_add, + EMbmAvkonQgn_indi_marked_add_mask, + defaultColor + ); + iBitMaps.AppendL( markedIconBitmap ); + iBitMaps.AppendL( markedIconBitmapMask ); + CleanupStack::Pop( 2 ); // markedIconBitmap, markedIconBitmapMask + + CGulIcon* markedIcon = CGulIcon::NewLC(); + markedIcon->SetBitmapsOwnedExternally( ETrue ); + markedIcon->SetBitmap( markedIconBitmap ); + markedIcon->SetMask( markedIconBitmapMask ); + aArray.AppendL( markedIcon ); + CleanupStack::Pop( markedIcon ); + } + +// ---------------------------------------------------- // CFMRadioChannelListContainer::InitializeChannelListL // Create the channel list (initially all spots are set as empty) // ---------------------------------------------------- @@ -471,10 +537,17 @@ void CFMRadioChannelListContainer::HandleResourceChange(TInt aType) { CCoeControl::HandleResourceChange(aType); - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SizeChanged(); - } + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + SizeChanged(); + } + else if ( aType == KAknsMessageSkinChange ) + { + CArrayPtr* iconArray = iChannelList->ItemDrawer()->FormattedCellData()->IconArray(); + // update icons with new skin + iconArray->ResetAndDestroy(); + TRAP_IGNORE( CreateListIconsL( *iconArray ) ) + } } // --------------------------------------------------------- // CFMRadioChannelListContainer::SizeChanged @@ -519,7 +592,17 @@ TKeyResponse response = EKeyWasNotConsumed; switch ( aKeyEvent.iCode ) - { + { + case EKeyOK: + { + // msk, used to accept move action + if ( iMoveAction ) + { + iChannelView->MoveActionDoneL(); + return EKeyWasConsumed; + } + break; + } case EKeyLeftArrow: case EKeyRightArrow: { @@ -575,23 +658,6 @@ break; } return iChannelList->OfferKeyEventL(aKeyEvent, aType); - } - -// --------------------------------------------------------- -// CFMRadioChannelListContainer::Draw -// Redraw the window owned by this container -// --------------------------------------------------------- -// -void CFMRadioChannelListContainer::Draw( const TRect& aRect ) const - { - CWindowGc& gc = SystemGc(); - gc.SetPenStyle( CGraphicsContext::ENullPen ); - gc.SetBrushColor( KRgbGray ); - gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); - gc.DrawRect( aRect ); - - // Fade if needed - Window().SetFaded( iFadeStatus, RWindowTreeNode::EFadeIncludeChildren ); } // --------------------------------------------------------------------------- diff -r 95ac6b0f7f5b -r f73067c3e563 fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp --- a/fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp Wed Mar 31 21:31:32 2010 +0300 +++ b/fmradio/fmradio/src/fmradioscanlocalstationscontainer.cpp Wed Apr 14 15:57:41 2010 +0300 @@ -33,6 +33,8 @@ #include #include #include +#include +#include #if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE #include "radio.hlp.hrh" @@ -70,7 +72,6 @@ return self; } -// // ---------------------------------------------------- // CFMRadioScanLocalStationsContainer::ConstructL // EPOC two phased constructor @@ -82,9 +83,7 @@ CFMRadioAppUi* appUi = static_cast( iCoeEnv->AppUi() ); TBool isLandscape = appUi->IsLandscapeOrientation(); CreateWindowL(); - - // Create the new context with image: KAknsIIDQsnBgAreaMain, and parent absolute layout is not used. - iBackground = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain, Rect(), EFalse ); + iSkin = AknsUtils::SkinInstance(); // Instantiate a listbox for the channel list @@ -95,18 +94,13 @@ iChannelList->ConstructL( this, CEikListBox::ELoopScrolling | EAknListBoxSelectionList ); // Looped list // Create scrollbars iChannelList->CreateScrollBarFrameL( ETrue ); - - CAknIconArray* radioTypeIcons = NULL; - radioTypeIcons = new ( ELeave ) CAknIconArray( 2 ); - CleanupStack::PushL( radioTypeIcons ); - radioTypeIcons->AppendFromResourceL( R_FMRADIO_CHANNEL_LIST_ICON_ARRAY ); - // The following line really takes the ownership -- must be the last item - // there, as if leaves and the object is in cleanupstack, problems arise. - // (Cleanup stack corruption!) - // Set the icon array for this list. List takes ownership of the array. - iChannelList->ItemDrawer()->ColumnData()->SetIconArray( radioTypeIcons ); - CleanupStack::Pop( radioTypeIcons ); + CAknIconArray* listIconArray = new ( ELeave ) CAknIconArray( 1 ); + CleanupStack::PushL( listIconArray ); + CreateListIconsL( *listIconArray ); + iChannelList->ItemDrawer()->ColumnData()->SetIconArray( listIconArray ); + CleanupStack::Pop( listIconArray ); + // Array for channels iChannelItemArray = new( ELeave ) CDesCArrayFlat( KMaxNumberOfChannelListItems ); InitializeChannelListL(); @@ -118,6 +112,47 @@ } // ---------------------------------------------------- +// CFMRadioScanLocalStationsContainer::CreateListIconsL +// ---------------------------------------------------- +// +void CFMRadioScanLocalStationsContainer::CreateListIconsL( CArrayPtr& aArray ) + { + if ( iBitMaps.Count() ) + { + // release any previously created bitmaps + iBitMaps.ResetAndDestroy(); + } + + TRgb defaultColor = iEikonEnv->Color( EColorControlText ); + + // speaker icon + CFbsBitmap* playingIconBitmap = NULL; + CFbsBitmap* playingIconBitmapMask = NULL; + + AknsUtils::CreateColorIconLC( iSkin, + KAknsIIDQgnIndiSpeaker, + KAknsIIDQsnIconColors, + EAknsCIQsnIconColorsCG13, + playingIconBitmap, + playingIconBitmapMask, + KAvkonBitmapFile, + EMbmAvkonQgn_indi_speaker, + EMbmAvkonQgn_indi_speaker_mask, + defaultColor + ); + iBitMaps.AppendL( playingIconBitmap ); + iBitMaps.AppendL( playingIconBitmapMask ); + CleanupStack::Pop( 2 ); // playingIconBitmap, playingIconBitmapMask + + CGulIcon* playingIcon = CGulIcon::NewLC(); + playingIcon->SetBitmapsOwnedExternally( ETrue ); + playingIcon->SetBitmap( playingIconBitmap ); + playingIcon->SetMask( playingIconBitmap ); + aArray.AppendL( playingIcon ); + CleanupStack::Pop( playingIcon ); + } + +// ---------------------------------------------------- // CFMRadioScanLocalStationsContainer::~CFMRadioScanLocalStationsContainer // Class destructor // ---------------------------------------------------- @@ -125,12 +160,10 @@ CFMRadioScanLocalStationsContainer::~CFMRadioScanLocalStationsContainer() { iControls.ResetAndDestroy(); + iControls.Close(); + iBitMaps.ResetAndDestroy(); + iBitMaps.Close(); delete iChannelItemArray; - if ( iBackground ) - { - delete iBackground; - iBackground = NULL; - } } // ---------------------------------------------------- @@ -226,7 +259,6 @@ iChannelList->DrawDeferred(); } - // -------------------------------------------------------------------------------- // CFMRadioScanLocalStationsContainer::InsertScannedChannelToListL // -------------------------------------------------------------------------------- @@ -431,10 +463,17 @@ void CFMRadioScanLocalStationsContainer::HandleResourceChange( TInt aType ) { CCoeControl::HandleResourceChange( aType ); - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - SizeChanged(); - } + if ( aType == KEikDynamicLayoutVariantSwitch ) + { + SizeChanged(); + } + else if ( aType == KAknsMessageSkinChange ) + { + CArrayPtr* iconArray = iChannelList->ItemDrawer()->ColumnData()->IconArray(); + // update icons with new skin + iconArray->ResetAndDestroy(); + TRAP_IGNORE( CreateListIconsL( *iconArray ) ) + } } // --------------------------------------------------------- @@ -444,12 +483,7 @@ // void CFMRadioScanLocalStationsContainer::SizeChanged() { - iChannelList->SetRect( Rect() ); - - if ( iBackground ) - { - iBackground->SetRect( Rect() ); - } + iChannelList->SetRect( Rect() ); } // --------------------------------------------------------- @@ -520,28 +554,6 @@ return iChannelList->OfferKeyEventL( aKeyEvent, aType ); } -// --------------------------------------------------------- -// CFMRadioScanLocalStationsContainer::Draw -// Redraw the window owned by this container -// --------------------------------------------------------- -// -void CFMRadioScanLocalStationsContainer::Draw( const TRect& aRect ) const - { - CWindowGc& gc = SystemGc(); - gc.Clear(); - - if ( iBackground ) - { - if ( !AknsDrawUtils::Background( iSkin, iBackground, this, gc, aRect) ) - { - // The background was not drawn - iBackground->UpdateContext(); - } - } - // Fade if needed - Window().SetFaded( iFadeStatus, RWindowTreeNode::EFadeIncludeChildren ); - } - // --------------------------------------------------------------------------- // CFMRadioScanLocalStationsContainer::GetHelpContext // Gets Help