# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268649634 -7200 # Node ID 3cb097cb90f8b38b0c0b9d23a0eb767247b42373 # Parent 108d9820af0157976edbea292c89e78f1ab216b2 Revision: 201009 Kit: 201010 diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/data/fmradio.rss --- a/fmradio/fmradio/data/fmradio.rss Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/data/fmradio.rss Mon Mar 15 12:40:34 2010 +0200 @@ -45,7 +45,7 @@ #include #define KFMRadioBitmapFile APP_BITMAP_DIR "\\fmradio.mif" - +#define KAvkonBitmapFile APP_BITMAP_DIR "\\avkon2.mif" // RESOURCE DEFINITIONS // RESOURCE RSS_SIGNATURE { } @@ -118,18 +118,18 @@ RESOURCE AKN_ICON_ARRAY r_fmradio_channel_list_icon_array { type = EAknIconArraySimple; - bmpfile = KFMRadioBitmapFile; + bmpfile = KAvkonBitmapFile; icons = { AKN_ICON { - iconId = EMbmFmradioQgn_indi_radio_playing; - maskId = EMbmFmradioQgn_indi_radio_playing_mask; + iconId = EMbmAvkonQgn_indi_speaker; + maskId = EMbmAvkonQgn_indi_speaker_mask; }, AKN_ICON { - iconId = EMbmFmradioQgn_indi_marked_add; - maskId = EMbmFmradioQgn_indi_marked_add_mask; + iconId = EMbmAvkonQgn_indi_marked_add; + maskId = EMbmAvkonQgn_indi_marked_add_mask; } }; } diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/inc/fmradioappui.h --- a/fmradio/fmradio/inc/fmradioappui.h Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/inc/fmradioappui.h Mon Mar 15 12:40:34 2010 +0200 @@ -17,7 +17,6 @@ * */ - #ifndef FMRADIOAPPUI_H #define FMRADIOAPPUI_H @@ -66,17 +65,14 @@ * @since 2.6 */ class MInformationNoteInterface - { - public: - - /** + { + public: + /** * tells when dialog was terminated */ - virtual void DialogTerminated() = 0; - - }; - - + virtual void DialogTerminated() = 0; + }; + /** * Information note for headset key events. Enabling functionality to disable new dialog creation * when dialog is active @@ -84,27 +80,25 @@ * @since 2.6 */ class CFMInformationNote: public CAknInformationNote - { - public: - - /** + { + public: + + /** * default constructor. */ - CFMInformationNote( MInformationNoteInterface& aObserver); - - /** + CFMInformationNote( MInformationNoteInterface& aObserver); + + /** * Destructor. */ - virtual ~CFMInformationNote(); - - private: - - // Dialog event observer - MInformationNoteInterface& iDialogObserver; - - }; - - + virtual ~CFMInformationNote(); + + private: + + // Dialog event observer + MInformationNoteInterface& iDialogObserver; + + }; /** * Instantiates the application views. It also acts as the default command handler for the @@ -131,12 +125,35 @@ EDirectionNone, EDirectionDown }; + + enum TRadioState + { + EFMRadioStateOff = 0, // Radio off + EFMRadioStateOffForPhoneCall, // Radio off because a phone call + EFMRadioStateOffBeforePhoneCall, // Radio was off + phone call going on -> no resume + EFMRadioStateOn, + EFMRadioStateRecording, + EFMRadioStateBusyRadioOn, + EFMRadioStateBusyRadioOff, + EFMRadioStateBusySeek, + EFMRadioStateBusyMute, + EFMRadioStateBusyVolume, + EFMRadioStateBusyManualTune, + EFMRadioStateBusyScanLocalStations, + EFMRadioStateExiting + }; public: // Constructors and destructor /** * EPOC default constructor. */ void ConstructL(); + + /** + * C++ default constructor. + */ + CFMRadioAppUi(); + /** * Destructor. */ @@ -164,7 +181,7 @@ * @param aCommand command to be handled */ void HandleCommandL( TInt aCommand ); - + /** * Notification interface from RadioEngine. Used to inform * us when requests have completed. @@ -174,38 +191,38 @@ */ void HandleRadioEngineCallBack( MRadioEngineStateChangeCallback::TFMRadioNotifyEvent aEventCode, TInt aErrorCode ); public: // new functions - /** - * Returns a pointer to the radio engine - * - * @return Radio engine - */ - CRadioEngine* RadioEngine(); - + /** + * Returns a pointer to the radio engine + * + * @return Radio engine + */ + CRadioEngine* RadioEngine(); + /** * Returns a reference to Back Stepping wrapper * * @return Reference to Back Stepping wrapper */ CFMRadioBackSteppingServiceWrapper& BackSteppingWrapper() const; - - /** - * Returns a pointer to FMRadio's document, cannot be null. - * - * @return A pointer to a CFMRadioDocument object. - */ - CFMRadioDocument* Document() const; + + /** + * Returns a pointer to FMRadio's document, cannot be null. + * + * @return A pointer to a CFMRadioDocument object. + */ + CFMRadioDocument* Document() const; /** - * Checks if current screen orientation is landscape - * - * @return ETrue if orientation is landscape, otherwise EFalse - */ - TBool IsLandscapeOrientation() const; - - /** - * Handles offline mode at startup. - */ - void HandleOfflineModeAtStartUpL(); - + * Checks if current screen orientation is landscape + * + * @return ETrue if orientation is landscape, otherwise EFalse + */ + TBool IsLandscapeOrientation() const; + + /** + * Handles offline mode at startup. + */ + void HandleOfflineModeAtStartUpL(); + /** * Handles start up foreground event. */ @@ -214,25 +231,25 @@ * Nunber of channels stored in presets. * @return number of channels in presets */ - TInt NumberOfChannelsStored() const; + TInt NumberOfChannelsStored() const; + /** + * Returns the UID of the currently active local view. KNullUid if none + * active (construction/destruction). + * @return UID of the currently active local view, KNullUid if none + * active. + */ + TUid ActiveView() const; /** - * Returns the UID of the currently active local view. KNullUid if none - * active (construction/destruction). - * @return UID of the currently active local view, KNullUid if none - * active. - */ - TUid ActiveView() const; - /** - * Return startup scanning wizard status. - * @return running status - */ - TBool IsStartupWizardRunning() const; - /** - * Set startup scanning wizard status. - * @param aRunningState running state - */ - void SetStartupWizardRunning( const TBool aRunningState ); - /** + * Return startup scanning wizard status. + * @return running status + */ + TBool IsStartupWizardRunning() const; + /** + * Set startup scanning wizard status. + * @param aRunningState running state + */ + void SetStartupWizardRunning( const TBool aRunningState ); + /** * Tune to the specified frequency * @since 2.6 * @param aFrequency the frequency to be tuned @@ -242,37 +259,37 @@ * @return mirrored layout state */ TBool IsLayoutMirrored() const; - /** - * Show currently active volume popup control - */ - void ShowVolumePopupL(); + /** + * Show currently active volume popup control + */ + void ShowVolumePopupL(); + + /** + * From MChannelListHandler + * Updates channels array in appui + * @param aOperation tells which operation is made to array + * @param aIndex tells affecting index + * @param aMovedToNewIndex optional during move operation + */ + void UpdateChannelsL( TMoveoperations aOperation, + TInt aIndex, + TInt aMovedToNewIndex ); - /** - * From MChannelListHandler - * Updates channels array in appui - * @param aOperation tells which operation is made to array - * @param aIndex tells affecting index - * @param aMovedToNewIndex optional during move operation - */ - void UpdateChannelsL( TMoveoperations aOperation, - TInt aIndex, - TInt aMovedToNewIndex ); - - /** - * From MChannelListHandler - * Add a new channel to list of channels - * @param aChannelName Name of the channel to be saved - * @param aChannelFreq Channel frequency - */ - void AddChannelToListL( const TDesC& aChannelName, TInt aChannelFreq ); - - /** - * From MChannelListHandler - * Accessory method to channels array - */ - CArrayFixFlat* Channels(); - - void AutoTuneInMainView ( TBool aTune ); + /** + * From MChannelListHandler + * Add a new channel to list of channels + * @param aChannelName Name of the channel to be saved + * @param aChannelFreq Channel frequency + */ + void AddChannelToListL( const TDesC& aChannelName, TInt aChannelFreq ); + + /** + * From MChannelListHandler + * Accessory method to channels array + */ + RPointerArray& Channels(); + + void AutoTuneInMainView ( TBool aTune ); /** * status of the startup wizard state * @return wizard status @@ -300,31 +317,36 @@ * @return active volume popup */ CAknVolumePopup* ActiveVolumePopup() const; + + /* + * Get current radio state. + * @return TRadioState state of the radio + */ + CFMRadioAppUi::TRadioState CFMRadioAppUi::RadioState() const; protected: /** * From CEikAppUi HandleWsEventL */ void HandleWsEventL(const TWsEvent& aEvent,CCoeControl* aDestination); - + /** * From base class CCoeAppUi - */ - void HandleForegroundEventL( TBool aForeground ); - + */ + void HandleForegroundEventL( TBool aForeground ); + private: // Functions from base classes - /** * Handles a change to the application's resources * @param aType The type of changed resource */ void HandleResourceChangeL( TInt aType ); /** - * Updates the landscape data. This is done separately - * and not in IsLandscapeOrientation method as - * IsLandscapeOrientation MUST NOT do a window server flush - */ - void UpdateLandscapeInformation(); + * Updates the landscape data. This is done separately + * and not in IsLandscapeOrientation method as + * IsLandscapeOrientation MUST NOT do a window server flush + */ + void UpdateLandscapeInformation(); private: // new functions /** @@ -409,14 +431,14 @@ * @param aErrorNote id of the text to display in the error note */ void DisplayErrorNoteL( TInt aErrorNote ); - + /** * Displays an information note with the text contained in the passed in reference * @since 2.6 * @param aInfoNote id of the text to display in the error note */ void DisplayInformationNoteL( TInt aInfoNote ); - + /** * Return the numeric key value corresponding to the key code * @since 2.6 @@ -468,7 +490,7 @@ * Processes "volume update failed" callback * @since 2.6 */ - void HandleVolumeUpdateFailedCallback(); + void HandleVolumeUpdateFailedCallback(); /** * Handles mute keypress from main view * @@ -529,15 +551,15 @@ /** * Request tuner control from engine - */ + */ void RequestTunerControl() const; - + /** * Is offline profile activated when radio audio was disabled. * @return ETrue, if offline profile activated when radio - * audio was disabled. EFalse otherwise. + * audio was disabled. EFalse otherwise. */ - TBool IsOfflineProfileActivatedWhenRadioAudioDisabled() const; + TBool IsOfflineProfileActivatedWhenRadioAudioDisabled() const; /** * Sets the toolbar visibility. @@ -581,11 +603,9 @@ * * @param aSelfPtr Pointer to self. * @return Always 0. - */ - static TInt StaticStartupForegroundCallback( TAny* aSelfPtr ); - + */ + static TInt StaticStartupForegroundCallback( TAny* aSelfPtr ); private: - /** * Called when volume level should be changed. * Set volume control visible. @@ -593,7 +613,6 @@ * -1 change volume down */ void FMRadioSvkChangeVolumeL( TInt aVolumeChange ); - /** * Called when volume was changed last time 2 seconds ago or * timer was started 2 seconds ago. The remove control timer @@ -601,45 +620,40 @@ * or when started through CMmsSvkEvents::StartRemoveTimerL() */ void FMRadioSvkRemoveVolumeL( ); - void FMRadioHeadsetEvent(TAccessoryEvent aEvent); - /** * From MFMRadioGlobalConfirmationQueryObserver * * @see MFMRadioGlobalConfirmationQueryObserver::GlobalConfirmationQueryDismissedL(TInt aSoftKey) */ void GlobalConfirmationQueryDismissedL( TInt aSoftKey ); - /** *From MCoeControlObserver. To handle the volume events. */ void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); - /** * From MInformationNoteInterface. To handle dialog terminated events. */ void DialogTerminated(); - /** * Gets the Channels array */ void GetChannelsArrayL(); - /** - * Check available IAD updates - */ - void HandleIADUpdateCheckL(); - // from base class MIAUpdateObserver - void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ); - void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResultDetails ); - void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ); - - /** - * Processes the tail of the command - * @param aTail The tail to be processed - */ - void ProcessCommandTailL( const TDesC8& aTail ); - + /** + * Check available IAD updates + */ + void HandleIADUpdateCheckL(); + // from base class MIAUpdateObserver + void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ); + void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResultDetails ); + void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ); + + /** + * Processes the tail of the command + * @param aTail The tail to be processed + */ + void ProcessCommandTailL( const TDesC8& aTail ); + // from base class CEikAppUi MCoeMessageObserver::TMessageResponse HandleMessageL( TUint32 aClientHandleOfTargetWindowGroup, @@ -649,14 +663,14 @@ TBool ProcessCommandParametersL( TApaCommand aCommand, TFileName& aDocumentName, const TDesC8& aTail ); - + /** * Check if Active Idle app is on foreground. * * @return ETrue if idle app is in the foreground, EFalse otherwise. - */ + */ TBool IsIdleAppForeground(); - + /** * Check if Active Idle is enabled. * @@ -668,27 +682,8 @@ * Handles the possibly pending view activation */ void HandlePendingViewActivationL(); - + private: - - enum TInterfaceState - { - EFMRadioStateOff = 0, // Radio off - EFMRadioStateOffForPhoneCall, // Radio off because a phone call - EFMRadioStateOffBeforePhoneCall,// Radio was off + phone call going on -> no resume - EFMRadioStateOn, - EFMRadioStateRecording, - EFMRadioStateBusyRadioOn, - EFMRadioStateBusyRadioOff, - EFMRadioStateBusyScanUp, - EFMRadioStateBusyScanDown, - EFMRadioStateBusySeek, - EFMRadioStateBusyMute, - EFMRadioStateBusyVolume, - EFMRadioStateBusyManualTune, - EFMRadioStateBusyScanLocalStations, - EFMRadioStateExiting - }; /** * State to indicate the mute status @@ -699,14 +694,14 @@ EFMUnmuted, // Unmute state EFMMuted // Mute state }; - + // System's volume indicator CAknVolumePopup* iIhfVolumePopupControl; CAknVolumePopup* iHeadsetVolumePopupControl; CAknVolumePopup* iActiveVolumePopupControl; CRadioEngine* iRadioEngine; - TInt iCurrentRadioState; + TRadioState iCurrentRadioState; CFMRadioScanLocalStationsView* iScanLocalStationsView; CFMRadioChannelListView* iChannelListView; CFMRadioMainView* iMainView; @@ -753,18 +748,18 @@ /** * Is the local or global offline query activated. - */ + */ TBool iOfflineQueryDialogActivated; - /** - * Is the start up of application ongoing. - */ - TBool iStartUp; + /** + * Is the start up of application ongoing. + */ + TBool iStartUp; - /** - * Is the screen orientation landscape - */ - TBool iLandscape; + /** + * Is the screen orientation landscape + */ + TBool iLandscape; CAlfEnv* iAlfEnv; // Owned // flag to indicate wizard handling TBool iStartupWizardHandled; @@ -773,23 +768,21 @@ // connect headset query CAknQueryDialog* iConnectHeadsetQuery; // flag to indicate if automatic tune is activated from startup wizard - TBool iTuneFromWizardActivated; - // akn information note ptr to check that dialog has dismissed from display - TBool iInfoNoteOn; - // global note for headset status when radio is background - CAknGlobalNote* iConnectHeadsetGlobalNote; - // flag for previous mute status + TBool iTuneFromWizardActivated; + // akn information note ptr to check that dialog has dismissed from display + TBool iInfoNoteOn; + // global note for headset status when radio is background + CAknGlobalNote* iConnectHeadsetGlobalNote; + // flag for previous mute status TFMMuteStatus iMuteStatusBeforeRadioInit; - // Channels list - CArrayFixFlat* iChannels; - // IAD client object. Owned. - CIAUpdate* iUpdate; - // Parameters for IAD update. Owned. - CIAUpdateParameters* iParameters; - TBool iAutoTune; - TBool iAutoTuneUnmute; + // Channels list + RPointerArray iChannels; + // IAD client object. Owned. + CIAUpdate* iUpdate; + // Parameters for IAD update. Owned. + CIAUpdateParameters* iParameters; // The backstepping wrapper. Owned. - CFMRadioBackSteppingServiceWrapper* iBsWrapper; + CFMRadioBackSteppingServiceWrapper* iBsWrapper; // Is feature manager initialized, used for uninitializing feature manager TBool iFeatureManagerInitialized; // own, for active idle setting diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/inc/fmradiochannellistview.h --- a/fmradio/fmradio/inc/fmradiochannellistview.h Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/inc/fmradiochannellistview.h Mon Mar 15 12:40:34 2010 +0200 @@ -177,7 +177,7 @@ void RdsDataProgrammeService( const TDesC& aProgramService ); void RdsDataPsNameIsStatic( TBool aStatic ); void RdsDataRadioText( const TDesC& aRadioText ); - void RdsDataRadioTextPlus( const TInt /*aRTPlusClass*/, const TDesC& /*aRadioText*/ ){}; + void RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioText ); void RdsAfSearchBegin(); void RdsAfSearchEnd( TUint32 aFrequency, TInt aError ); void RdsAfSearchStateChange( TBool aEnabled ); diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/inc/fmradiodefines.h --- a/fmradio/fmradio/inc/fmradiodefines.h Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/inc/fmradiodefines.h Mon Mar 15 12:40:34 2010 +0200 @@ -180,6 +180,8 @@ // Channel list icon index in the icon array const TInt KNowPlayingIconIndexChList = 0; const TInt KMoveIconIndexChList = 1; +// RDS text max length +const TInt KFMRadioWebLinkMaxLength = 64; #endif diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/inc/fmradiopreset.h --- a/fmradio/fmradio/inc/fmradiopreset.h Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/inc/fmradiopreset.h Mon Mar 15 12:40:34 2010 +0200 @@ -51,7 +51,7 @@ * Returns preset name * @return name */ - TDesC& PresetName(); + const TDesC& PresetName(); /* * Set of the preset valid * @param aValid ETrue is the name is set valid @@ -73,6 +73,18 @@ */ TInt PresetFrequency(); + /* + * set station web url + * @param aUrl url to set + */ + void SetPresetUrlL( const TDesC& aUrl ); + + /* + * Gets station web url + * @return url + */ + const TDesC& PresetUrl(); + private: /** * C++ default constructor. @@ -90,6 +102,9 @@ TInt iStationFrequency; // Validity of the station name TBool iNameIsValid; + // station web url + RBuf iStationUrl; + }; diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/inc/mchannellisthandler.h --- a/fmradio/fmradio/inc/mchannellisthandler.h Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/inc/mchannellisthandler.h Mon Mar 15 12:40:34 2010 +0200 @@ -20,6 +20,8 @@ #define MCHANNELLISTHANDLER_H +#include "fmradiopreset.h" + /** * Operations to main list * @since 2.6 @@ -34,15 +36,6 @@ ERemoveAllFromRepository }; -/** -* Holder for the channel information and channel frequency -* @since 2.6 -*/ -struct TChannelInformation - { - TBuf<32> iChannelInformation; - TInt iChannelFrequency; - }; /** * Interface to update channel list @@ -60,7 +53,7 @@ virtual void AddChannelToListL( const TDesC& aChannelName, TInt aChannelFreq ) = 0; - virtual CArrayFixFlat* Channels() = 0; + virtual RPointerArray& Channels() = 0; }; diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradioalfvisualizer.cpp --- a/fmradio/fmradio/src/fmradioalfvisualizer.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradioalfvisualizer.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -537,8 +537,9 @@ FTRACE( FPrint( _L("CFMRadioAlfVisualizer::HandleGestureL(eventCode=%d)"), eventCode ) ); CFMRadioAppUi* appUi = static_cast( CCoeEnv::Static()->AppUi() ); - // handle gestures only if there is no call ongoing - if ( !appUi->RadioEngine()->IsInCall() ) + // handle gestures only if there is no call or tuning ongoing + if ( !appUi->RadioEngine()->IsInCall() && + appUi->RadioState() != CFMRadioAppUi::EFMRadioStateBusySeek ) { switch ( eventCode ) { @@ -682,7 +683,7 @@ } else { - FTRACE(FPrint(_L("CFMRadioAlfVisualizer::HandleGestureL() call ongoing -> gestures ignored"))); + FTRACE(FPrint(_L("CFMRadioAlfVisualizer::HandleGestureL() call or tuning ongoing -> gestures ignored"))); } } // ---------------------------------------------------------------------------- @@ -724,7 +725,7 @@ } if ( aEvent.IsPointerEvent() ) { - CGestureControl::OfferEventL( aEvent ); + return CGestureControl::OfferEventL( aEvent ); } return EFalse; } diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradioappui.cpp --- a/fmradio/fmradio/src/fmradioappui.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradioappui.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -73,26 +73,37 @@ // CFMInformationNote::CFMInformationNote // --------------------------------------------------------------------------------- CFMInformationNote::CFMInformationNote( MInformationNoteInterface& aObserver ) : - CAknInformationNote ( EFalse ), - iDialogObserver( aObserver ) - { - - } - - + CAknInformationNote ( EFalse ), + iDialogObserver( aObserver ) + { + + } // --------------------------------------------------------------------------------- // CFMInformationNote::~CFMInformationNote // --------------------------------------------------------------------------------- // CFMInformationNote::~CFMInformationNote() - { - iDialogObserver.DialogTerminated(); - } + { + iDialogObserver.DialogTerminated(); + } +// ================= MEMBER FUNCTIONS ======================= - +// --------------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------------- +// +CFMRadioAppUi::CFMRadioAppUi() : + iStartUp( ETrue ), + iStartupWizardHandled( EFalse ), + iStartupWizardRunning( EFalse ), + iTuneFromWizardActivated( EFalse ), + iInfoNoteOn( EFalse ), + iPendingViewId( KNullUid ), + iRegionChanged( EFalse ) + { + } -// ================= MEMBER FUNCTIONS ======================= -// // --------------------------------------------------------------------------------- // CFMRadioAppUi::ConstructL // 2nd phase constructor. Instanciates all member objects @@ -102,22 +113,11 @@ { FTRACE( FPrint( _L("CFMRadioAppUi::ConstructL()") ) ); - iPendingViewId = TUid::Null(); - iStartUp = ETrue; - iStartupWizardHandled = EFalse; - iStartupWizardRunning = EFalse; - iTuneFromWizardActivated = EFalse; - iInfoNoteOn = EFalse; - iAutoTune = EFalse; - iAutoTuneUnmute = EFalse; - iRegionChanged = EFalse; - - BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); + BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible ); + FeatureManager::InitializeLibL(); iFeatureManagerInitialized = ETrue; - iChannels = new( ELeave ) CArrayFixFlat( 1 ); - // initialise local variation key with all features disabled. iFMRadioVariationFlags = 0; iAudioResourceAvailable = ETrue; @@ -154,9 +154,9 @@ { FTRACE( FPrint( _L("CFMRadioAppUi::SecondaryConstructL()") ) ); - iLayoutChangeObserver = iMainView; + iLayoutChangeObserver = iMainView; - iRadioEngine->PubSubL().PublishPresetCountL( iChannels->Count() ); + iRadioEngine->PubSubL().PublishPresetCountL( iChannels.Count() ); // Create vertical volume popup for speaker and headset iIhfVolumePopupControl = CAknVolumePopup::NewL( NULL, ETrue ); @@ -179,22 +179,22 @@ // For monitoring side volume key events iSvkEvents = CFMRadioSvkEvents::NewL(*this); - iRadioEngine->PubSubL().PublishApplicationRunningStateL( EFMRadioPSApplicationRunning ); - - UpdateLandscapeInformation(); - - // Create alfred environment + iRadioEngine->PubSubL().PublishApplicationRunningStateL( EFMRadioPSApplicationRunning ); + + UpdateLandscapeInformation(); + + // Create alfred environment iAlfEnv = CAlfEnv::NewL(); - - // Create alfred display - TRect rect; - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); - if( !IsLandscapeOrientation() ) - { - TRect toolBarRect = iMainView->Toolbar()->Rect(); - rect.SetHeight( rect.Height() - toolBarRect.Height() ); - } - iAlfEnv->NewDisplayL( rect, CAlfEnv::ENewDisplayAsCoeControl ); + + // Create alfred display + TRect rect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); + if( !IsLandscapeOrientation() ) + { + TRect toolBarRect = iMainView->Toolbar()->Rect(); + rect.SetHeight( rect.Height() - toolBarRect.Height() ); + } + iAlfEnv->NewDisplayL( rect, CAlfEnv::ENewDisplayAsCoeControl ); } // --------------------------------------------------------------------------- @@ -203,7 +203,7 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::HandleTunerReadyCallback() - { + { iRadioEngine->InitializeRadio(); } @@ -258,53 +258,46 @@ { delete iSvkEvents; } - if (iGlobalOfflineQuery) { delete iGlobalOfflineQuery; } - if (iLocalActivateOfflineQuery) { delete iLocalActivateOfflineQuery; } - if (iLocalContinueOfflineQuery) { delete iLocalContinueOfflineQuery; } - delete iControlEventObserver; delete iAlfEnv; iAlreadyClean = ETrue; - if ( iConnectHeadsetGlobalNote ) - { - delete iConnectHeadsetGlobalNote; - iConnectHeadsetGlobalNote = NULL; - } - - if ( iConnectHeadsetQuery ) - { - delete iConnectHeadsetQuery; - iConnectHeadsetQuery = NULL; - } - if ( iChannels ) - { - iChannels->Reset(); - delete iChannels; - iChannels = NULL; - } - if ( iUpdate ) - { - delete iUpdate; - iUpdate = NULL; - } - if ( iParameters ) - { - delete iParameters; - iParameters = NULL; + if ( iConnectHeadsetGlobalNote ) + { + delete iConnectHeadsetGlobalNote; + iConnectHeadsetGlobalNote = NULL; + } + if ( iConnectHeadsetQuery ) + { + delete iConnectHeadsetQuery; + iConnectHeadsetQuery = NULL; + } + + iChannels.ResetAndDestroy(); + iChannels.Close(); + + if ( iUpdate ) + { + delete iUpdate; + iUpdate = NULL; + } + if ( iParameters ) + { + delete iParameters; + iParameters = NULL; } if ( iSettingsRepository ) { @@ -346,21 +339,20 @@ ScanDownL(); break; case EFMRadioCmdSaveChannel: - SaveChannelToLastIntoListL(); + SaveChannelToLastIntoListL(); break; case EFMRadioCmdScanLocalStations: - ActivateLocalViewL(iScanLocalStationsView->Id()); - break; + ActivateLocalViewL( iScanLocalStationsView->Id() ); + break; case EFMRadioCmdScanLocalStationsScan: - // continue scanning - StartLocalStationsSeekL(); - break; + // continue scanning + StartLocalStationsSeekL(); + break; case EFMRadioCmdListenCh: - - if ( iChannels->Count() > 0 ) - { - PlayChannel( iChannelListView->CurrentlySelectedChannel() ); - } + if ( iChannels.Count() > 0 ) + { + PlayChannel( iChannelListView->CurrentlySelectedChannel() ); + } break; case EFMRadioCmdRename: RenameCurrentChannelL(); @@ -372,22 +364,22 @@ SetAudioOutput( CRadioEngine::EFMRadioOutputHeadset ); break; case EFMRadioCmdEnableRdsAfSearch: - iRadioEngine->SetRdsAfSearchEnable( ETrue ); - break; + iRadioEngine->SetRdsAfSearchEnable( ETrue ); + break; case EFMRadioCmdDisableRdsAfSearch: - iRadioEngine->SetRdsAfSearchEnable( EFalse ); + iRadioEngine->SetRdsAfSearchEnable( EFalse ); break; case EFMRadioCmdUpdateVolume: UpdateVolume( EDirectionNone ); break; case EFMRadioCmdNextChannel: { - TInt channelCount = iChannels->Count(); + TInt channelCount = iChannels.Count(); if ( channelCount >= 1 ) - { - iMainView->SetStationChangeType( EFMRadioStationChangeNext ); - PlayChannel( iChannelListView->NextChannel() ); - } + { + iMainView->SetStationChangeType( EFMRadioStationChangeNext ); + PlayChannel( iChannelListView->NextChannel() ); + } else { if ( AknLayoutUtils::PenEnabled() ) @@ -399,12 +391,12 @@ } case EFMRadioCmdPrevChannel: { - TInt channelCount = iChannels->Count(); + TInt channelCount = iChannels.Count(); if ( channelCount >= 1 ) - { - iMainView->SetStationChangeType( EFMRadioStationChangePrevious ); - PlayChannel( iChannelListView->PreviousChannel() ); - } + { + iMainView->SetStationChangeType( EFMRadioStationChangePrevious ); + PlayChannel( iChannelListView->PreviousChannel() ); + } else { if ( AknLayoutUtils::PenEnabled() ) @@ -428,42 +420,31 @@ { #if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE if ( ActiveView() == KFMRadioMainViewId ) - { - HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), GetCurrentHelpContextL() ); - } + { + HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), GetCurrentHelpContextL() ); + } else - { + { CArrayFix* buf = CCoeAppUi::AppHelpContextL(); HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), buf ); - } + } #endif } break; case EFMRadioCmdScanLocalStationsViewActive: - iLayoutChangeObserver = iScanLocalStationsView; - break; + iLayoutChangeObserver = iScanLocalStationsView; + break; case EFMRadioCmdChannelListViewActive: iLayoutChangeObserver = iChannelListView; break; case EFMRadioCmdMainViewActive: iLayoutChangeObserver = iMainView; - if ( iAutoTune && - ( iScanLocalStationsView->CancelType() == EFMRadioCancelScanBySoftkey || - iScanLocalStationsView->CancelType() == EFMRadioCancelScanDefault)) - { - ScanUpL(); - iAutoTune = EFalse; - iAutoTuneUnmute = ETrue; - } break; - default: break; } } - else if( iCurrentRadioState == EFMRadioStateBusyScanUp || - iCurrentRadioState == EFMRadioStateBusyScanDown || - iCurrentRadioState == EFMRadioStateBusySeek || + else if ( iCurrentRadioState == EFMRadioStateBusySeek || iCurrentRadioState == EFMRadioStateBusyScanLocalStations ) { switch ( aCommand ) @@ -502,9 +483,9 @@ // --------------------------------------------------------------------------- // CRadioEngine* CFMRadioAppUi::RadioEngine() - { - return iRadioEngine; - } + { + return iRadioEngine; + } // --------------------------------------------------------------------------- // CFMRadioAppUi::Document @@ -548,11 +529,11 @@ iMuteStatusBeforeRadioInit = EFMUnmuted; } } - iCurrentRadioState = EFMRadioStateBusyRadioOn; - // use mute here so we have no audio until tune event - iRadioEngine->SetMuteOn( ETrue ); - iRadioEngine->RadioOn(); - } + iCurrentRadioState = EFMRadioStateBusyRadioOn; + // use mute here so we have no audio until tune event + iRadioEngine->SetMuteOn( ETrue ); + iRadioEngine->RadioOn(); + } } // --------------------------------------------------------------------------- @@ -614,7 +595,7 @@ channelIndex = iRadioEngine->GetPresetIndex(); } // Display the text query - CRadioEngine::TStationName channelName = iChannels->At(channelIndex).iChannelInformation; + CRadioEngine::TStationName channelName = iChannels[ channelIndex ]->PresetName(); CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog( channelName, CAknQueryDialog::ENoTone ); @@ -622,12 +603,11 @@ { FTRACE(FPrint(_L("CFMRadioAppUi::RenameCurrentChannelL()"))); - iChannels->At(channelIndex).iChannelInformation = channelName; + iChannels[channelIndex]->SetPresetNameL( channelName ); - iChannelListView->UpdateChannelListContentL( channelIndex, - iChannels->At(channelIndex).iChannelInformation, - iChannels->At(channelIndex).iChannelFrequency ); + iChannels[ channelIndex ]->PresetName(), + iChannels[ channelIndex ]->PresetFrequency() ); UpdateChannelsL( EStoreIndexToRepository, channelIndex, 0 ); @@ -650,7 +630,7 @@ void CFMRadioAppUi::SaveChannelToLastIntoListL() { FTRACE( FPrint( _L("CFMRadioAppUi::SaveChannelToLastIntoListL()") ) ); - SaveChannelL( iChannels->Count() + 1 ); + SaveChannelL( iChannels.Count() + 1 ); } // --------------------------------------------------------------------------- @@ -688,7 +668,7 @@ UpdateChannelsL( EStoreAllToRepository, 0, 0 ); iMainView->SetStationChangeType( EFMRadioStationChangeNone ); - PlayChannel( iChannels->Count() - 1 ); + PlayChannel( iChannels.Count() - 1 ); } } @@ -707,16 +687,16 @@ RBuf channelData; channelData.CleanupClosePushL(); - if ( iChannels->At( aIndex ).iChannelInformation.Length() ) + if ( iChannels[ aIndex ]->PresetName().Length() ) { stringResourceId = R_QTN_FMRADIO_QUERY_DELETE; - channelData.CreateL( iChannels->At( aIndex ).iChannelInformation ); + channelData.CreateL( iChannels[ aIndex ]->PresetName() ); } else { stringResourceId = R_QTN_FMRADIO_QUERY_DELETE_MHZ; TInt maxDecimalPlaces = iRadioEngine->DecimalCount(); - TInt channelfreq = iChannels->At( aIndex ).iChannelFrequency; + TInt channelfreq = iChannels[ aIndex ]->PresetFrequency(); TReal realFrequency = static_cast( channelfreq / static_cast( KHzConversionFactor )); channelData.CreateL( KFrequencyMaxLength ); @@ -725,7 +705,6 @@ channelData.Num( realFrequency, format ); AknTextUtils::LanguageSpecificNumberConversion( channelData ); } - // Excecute a confirmation query with string and query resource id HBufC* prompt = StringLoader::LoadLC( stringResourceId, channelData, iCoeEnv ); CAknQueryDialog* queryDlg = CAknQueryDialog::NewL(); @@ -745,8 +724,8 @@ FTRACE( FPrint( _L("CFMRadioAppUi::ScanUpL()") ) ); // Frequency is always 0 when asking engine for automatical tuning. Frequency // parameter is then ignored by engine when automatical tuning (seek) is requested. - iCurrentRadioState = EFMRadioStateBusyScanUp; - + iCurrentRadioState = EFMRadioStateBusySeek; + if ( iMainView->IsForeground() ) { iMainView->SetStationChangeType( EFMRadioStationChangeScanUp ); @@ -765,7 +744,7 @@ FTRACE( FPrint( _L("CFMRadioAppUi::ScanDownL()") ) ); // Frequency is always 0 when asking engine for automatical tuning. Frequency // parameter is then ignored by engine when automatical tuning (seek) is requested. - iCurrentRadioState = EFMRadioStateBusyScanDown; + iCurrentRadioState = EFMRadioStateBusySeek; if ( iMainView->IsForeground() ) { @@ -786,12 +765,10 @@ // Frequency is always 0 when asking engine for automatical tuning. Frequency // parameter is then ignored by engine when automatical tuning (seek) is requested. iCurrentRadioState = EFMRadioStateBusySeek; - if (iMainView->IsForeground()) - { - iMainView->SeekL(); // Show seek wait note - } - + { + iMainView->SeekL(); // Show seek wait note + } iRadioEngine->Tune(aFrequency); } @@ -803,11 +780,11 @@ void CFMRadioAppUi::UpdateVolume( CFMRadioAppUi::TFMRadioDirections aDirection ) { FTRACE( FPrint( _L("CFMRadioAppUi::UpdateVolume(%d)"), UpdateVolume ) ); - + if ( !iRadioEngine->IsInCall() ) { TInt volumeControlLevel = iRadioEngine->GetVolume(); - + TInt newVol = 0; if ( aDirection == EDirectionDown ) { @@ -870,8 +847,7 @@ void CFMRadioAppUi::CancelSeek() { FTRACE( FPrint( _L("CFMRadioAppUi::CancelSeek()") ) ); - if( iCurrentRadioState == EFMRadioStateBusyScanUp || - iCurrentRadioState == EFMRadioStateBusyScanDown ) + if ( iCurrentRadioState == EFMRadioStateBusySeek ) { iRadioEngine->CancelScan(); // Seek request to engine } @@ -944,12 +920,12 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::HandleForegroundEventL( TBool aForeground ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::HandleForegroundEventL(%d)"), aForeground ) ); - CAknViewAppUi::HandleForegroundEventL( aForeground ); - - if ( aForeground ) - { + { + FTRACE( FPrint( _L("CFMRadioAppUi::HandleForegroundEventL(%d)"), aForeground ) ); + CAknViewAppUi::HandleForegroundEventL( aForeground ); + + if ( aForeground ) + { if ( iStartUp ) { iStartUp = EFalse; @@ -960,58 +936,58 @@ iStartupForegroundCallback->CallBack(); } else - { - // Restores all resources that were released with a call to Release(). - // After this the Hitchcock user interface should be in the same state - // in terms of resources as it was prior to the Release() call. - //iAlfEnv->RestoreL(); - - // Check if offline profile is activated after/when playing e.g. music player. - // In that case we didn't show the offline query as global, so we need - // to show it now. - if ( IsOfflineProfileActivatedWhenRadioAudioDisabled() ) - { - // Do not re-show the offline query if user hasn't yet answered to it. - if ( !iShowingLocalOfflineContinueQuery ) - { - iRadioEngine->RadioOff(); - TInt res(0); - iShowingLocalOfflineContinueQuery = ETrue; - - iOfflineQueryDialogActivated = ETrue; - - if ( !iLocalContinueOfflineQuery ) - { - iLocalContinueOfflineQuery = CAknQueryDialog::NewL(); - } - - res = iLocalContinueOfflineQuery->ExecuteLD( R_FMRADIO_CONTINUE_IN_OFFLINE_QUERY ); - - iLocalContinueOfflineQuery = NULL; - iOfflineQueryDialogActivated = EFalse; - iShowingLocalOfflineContinueQuery = EFalse; - - if ( res ) - { - iOfflineProfileActivatedWhenRadioAudioDisabled = EFalse; - iRadioEngine->RadioOn(); - HandlePendingViewActivationL(); - } - else - { - Exit(); - } - } - } - TryToResumeAudioL(); - } - } - else - { - // Releases as many resources of the Hitchcock as possible. - //iAlfEnv->Release( ETrue ); - } - } + { + // Restores all resources that were released with a call to Release(). + // After this the Hitchcock user interface should be in the same state + // in terms of resources as it was prior to the Release() call. + //iAlfEnv->RestoreL(); + + // Check if offline profile is activated after/when playing e.g. music player. + // In that case we didn't show the offline query as global, so we need + // to show it now. + if ( IsOfflineProfileActivatedWhenRadioAudioDisabled() ) + { + // Do not re-show the offline query if user hasn't yet answered to it. + if ( !iShowingLocalOfflineContinueQuery ) + { + iRadioEngine->RadioOff(); + TInt res(0); + iShowingLocalOfflineContinueQuery = ETrue; + + iOfflineQueryDialogActivated = ETrue; + + if ( !iLocalContinueOfflineQuery ) + { + iLocalContinueOfflineQuery = CAknQueryDialog::NewL(); + } + + res = iLocalContinueOfflineQuery->ExecuteLD( R_FMRADIO_CONTINUE_IN_OFFLINE_QUERY ); + + iLocalContinueOfflineQuery = NULL; + iOfflineQueryDialogActivated = EFalse; + iShowingLocalOfflineContinueQuery = EFalse; + + if ( res ) + { + iOfflineProfileActivatedWhenRadioAudioDisabled = EFalse; + iRadioEngine->RadioOn(); + HandlePendingViewActivationL(); + } + else + { + Exit(); + } + } + } + TryToResumeAudioL(); + } + } + else + { + // Releases as many resources of the Hitchcock as possible. + //iAlfEnv->Release( ETrue ); + } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::HandleRadioEngineCallBack @@ -1030,63 +1006,64 @@ switch ( aEventCode ) { case EFMRadioEventTunerReady: - HandleTunerReadyCallback(); + HandleTunerReadyCallback(); break; case EFMRadioEventRadioOn: - iCurrentRadioState = EFMRadioStateOn; - TRAPD( err, HandleStartupWizardL() ); - iStartupWizardHandled = ETrue;//FirstRadioInitCall = EFalse; - if ( iAutoTune && - iScanLocalStationsView->CancelType() == EFMRadioCancelScanByHeadsetDisconnect) - { - TRAP_IGNORE( ScanUpL() ); - iAutoTune = EFalse; - iAutoTuneUnmute = ETrue; - } - else if( !IsStartupWizardRunning() || err != KErrNone ) - { - //we use method because the behaviour we require is the same. - if ( !iTuneFromWizardActivated && iMuteStatusBeforeRadioInit != EFMUninitialized ) - { + { + iCurrentRadioState = EFMRadioStateOn; + TRAPD( err, HandleStartupWizardL() ); + iStartupWizardHandled = ETrue; + const TUid activeViewTuid = ActiveView(); + + if ( activeViewTuid == KFMRadioChannelListViewId ) + { + CAknToolbar* toolbar = iChannelListView->Toolbar(); + if ( toolbar ) + { + iChannelListView->UpdateToolbar(); + toolbar->DrawDeferred(); + } + } + if( !IsStartupWizardRunning() || err != KErrNone ) + { + //we use method because the behaviour we require is the same. + if ( !iTuneFromWizardActivated && iMuteStatusBeforeRadioInit != EFMUninitialized ) + { TBool mute = EFalse; if ( iMuteStatusBeforeRadioInit == EFMMuted ) { mute = ETrue; } iRadioEngine->SetMuteOn( mute ); - iMuteStatusBeforeRadioInit = EFMUninitialized; - } - HandleStopSeekCallback(); - } + iMuteStatusBeforeRadioInit = EFMUninitialized; + } + HandleStopSeekCallback(); + } + } break; case EFMRadioEventRadioOff: - iCurrentRadioState = EFMRadioStateOff; + iCurrentRadioState = EFMRadioStateOff; - if ( !iOfflineQueryDialogActivated ) - { - ExitApplication(); - } + if ( !iOfflineQueryDialogActivated ) + { + ExitApplication(); + } - break; + break; case EFMRadioEventFMRadioInitialized: - TRAP( err, HandleInitializedCallbackL() ); + TRAP( err, HandleInitializedCallbackL() ); break; case EFMRadioEventTune: - if ( iTuneFromWizardActivated ) - { - iTuneFromWizardActivated = EFalse; - iRadioEngine->SetMuteOn( EFalse ); - iMuteStatusBeforeRadioInit = EFMUninitialized; - } - if( iAutoTuneUnmute ) - { - iRadioEngine->SetMuteOn( EFalse ); - iAutoTuneUnmute = EFalse; - } - if ( IsStartupWizardHandled() ) - { - HandleStopSeekCallback(); - } + if ( iTuneFromWizardActivated ) + { + iTuneFromWizardActivated = EFalse; + iRadioEngine->SetMuteOn( EFalse ); + iMuteStatusBeforeRadioInit = EFMUninitialized; + } + if ( IsStartupWizardHandled() ) + { + HandleStopSeekCallback(); + } break; case EFMRadioEventSetMuteState: HandleSetMuteStateCallback(); @@ -1118,33 +1095,35 @@ TRAP( err, HandleAudioResourceAvailableL() ); break; case EFMRadioEventCallStarted: - if ( iCurrentRadioState != EFMRadioStateOff && - iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) - { - iCurrentRadioState = EFMRadioStateOffForPhoneCall; - } - else - { - iCurrentRadioState = EFMRadioStateOffBeforePhoneCall; - } + if ( iCurrentRadioState != EFMRadioStateOff && + iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) + { + iCurrentRadioState = EFMRadioStateOffForPhoneCall; + } + else + { + iCurrentRadioState = EFMRadioStateOffBeforePhoneCall; + } FadeViewsAndShowExit( ETrue ); break; case EFMRadioEventCallEnded: - FadeViewsAndShowExit( EFalse ); - if ( iAudioLost ) - { - TRAP_IGNORE( TryToResumeAudioL() ); + { + if ( iAudioLost ) + { + TRAP_IGNORE( TryToResumeAudioL() ); iCurrentRadioState = EFMRadioStateOff; - } - else if ( iCurrentRadioState == EFMRadioStateOffForPhoneCall ) - { - TurnRadioOn(); - } - else - { - // Do nothing. - } + } + else if ( iCurrentRadioState == EFMRadioStateOffForPhoneCall ) + { + TurnRadioOn(); + } + else + { + // Do nothing. + } + FadeViewsAndShowExit( EFalse ); break; + } case EFMRadioEventStandbyMode: ExitApplication(); break; @@ -1161,11 +1140,11 @@ HandleFreqRangeChangedCallback(); break; case EFMRadioEventScanLocalStationsCanceled: - { - HandleStopSeekCallback(); - SetStartupWizardRunning( EFalse ); - break; - } + { + HandleStopSeekCallback(); + SetStartupWizardRunning( EFalse ); + break; + } default: break; } @@ -1180,43 +1159,42 @@ break; case EFMRadioEventAudioResourcePaused: TRAP( err, HandleAudioResourceNotAvailableL( aErrorCode ) ); - break; + break; case EFMRadioEventTune: - if ( iTuneFromWizardActivated ) - { - iTuneFromWizardActivated = EFalse; - iRadioEngine->SetMuteOn( EFalse ); - iMuteStatusBeforeRadioInit = EFMUninitialized; - } + if ( iTuneFromWizardActivated ) + { + iTuneFromWizardActivated = EFalse; + iRadioEngine->SetMuteOn( EFalse ); + iMuteStatusBeforeRadioInit = EFMUninitialized; + } - if ( aErrorCode == KFmRadioErrAntennaNotConnected ) - { - iScanLocalStationsView->SetScanCanceled(EFMRadioCancelScanByHeadsetDisconnect); - } + if ( aErrorCode == KFmRadioErrAntennaNotConnected ) + { + iScanLocalStationsView->SetScanCanceled(EFMRadioCancelScanByHeadsetDisconnect); + } HandleStopSeekCallback(); break; case EFMRadioEventCallStarted: - { - FTRACE( FPrint( _L("CFMRadioAppUi::HandleRadioEngineCallBack() error -> EFMRadioEventCallStarted ") ) ); - if ( iCurrentRadioState != EFMRadioStateOff && - iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) - { - iCurrentRadioState = EFMRadioStateOffForPhoneCall; - } - else - { - iCurrentRadioState = EFMRadioStateOffBeforePhoneCall; - } - FadeViewsAndShowExit( ETrue ); - break; - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::HandleRadioEngineCallBack() error -> EFMRadioEventCallStarted ") ) ); + if ( iCurrentRadioState != EFMRadioStateOff && + iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) + { + iCurrentRadioState = EFMRadioStateOffForPhoneCall; + } + else + { + iCurrentRadioState = EFMRadioStateOffBeforePhoneCall; + } + FadeViewsAndShowExit( ETrue ); + break; + } default: FTRACE( FPrint( _L("CFMRadioAppUi::HandleRadioEngineCallBack() failed to process event.") ) ); break; } } - FTRACE( FPrint( _L("END CFMRadioAppUi::HandleRadioEngineCallBack()") ) ); } @@ -1235,7 +1213,7 @@ iActiveVolumePopupControl->SetValue( newVolume ); } else - { + { iActiveVolumePopupControl->SetValue( KFMRadioMinVolumeLevel ); } } @@ -1271,12 +1249,12 @@ // void CFMRadioAppUi::FadeViewsAndShowExit( TBool aState ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::FadeViewsAndShowExit( Tbool %d )"), aState ) ); - iMainView->FadeAndShowExit( aState ); + { + FTRACE( FPrint( _L("CFMRadioAppUi::FadeViewsAndShowExit( Tbool %d )"), aState ) ); + iMainView->FadeAndShowExit( aState ); iChannelListView->FadeAndShowExit( aState ); iScanLocalStationsView->FadeAndShowExit( aState ); - } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::HandleAudioResourceAvailableL @@ -1286,7 +1264,7 @@ void CFMRadioAppUi::HandleAudioResourceAvailableL() { FTRACE( FPrint( _L("CFMRadioAppUi::HandleAudioResourceAvailableL") ) ); - + iAudioResourceAvailable = ETrue; if ( !IsOfflineProfileActivatedWhenRadioAudioDisabled() && @@ -1317,11 +1295,11 @@ FTRACE( FPrint( _L("CFMRadioAppUi::HandleAudioResourceNotAvailableL() error code: %d"), aError ) ); - SetStartupWizardRunning( EFalse ); + SetStartupWizardRunning( EFalse ); iAudioResourceAvailable = EFalse; if ( iCurrentRadioState != EFMRadioStateOffForPhoneCall && - iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) + iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) { iCurrentRadioState = EFMRadioStateOff; } @@ -1346,7 +1324,6 @@ iCurrentRadioState = EFMRadioStateOff; TRAP_IGNORE( ShowConnectHeadsetDialogL() ); } - } // --------------------------------------------------------------------------- @@ -1358,28 +1335,28 @@ { FTRACE( FPrint( _L("CFMRadioAppUi::HandleHeadsetReconnectedCallback()") ) ); if ( iConnectHeadsetQuery ) - { - delete iConnectHeadsetQuery; - iConnectHeadsetQuery = NULL; - } + { + delete iConnectHeadsetQuery; + iConnectHeadsetQuery = NULL; + } - //compare bitmask to see if feature supported - if ( !(iFMRadioVariationFlags & KFMRadioInternalAntennaSupported) && - iCurrentRadioState != EFMRadioStateOffForPhoneCall && - iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) - { - // active offline query controls radio on/off - if ( iAudioLost ) + //compare bitmask to see if feature supported + if ( !(iFMRadioVariationFlags & KFMRadioInternalAntennaSupported) && + iCurrentRadioState != EFMRadioStateOffForPhoneCall && + iCurrentRadioState != EFMRadioStateOffBeforePhoneCall ) + { + // active offline query controls radio on/off + if ( iAudioLost ) { TRAP_IGNORE( TryToResumeAudioL() ); } - else if ( ( iGlobalOfflineQuery && !iGlobalOfflineQuery->IsActive() ) || - !iGlobalOfflineQuery ) - { - iRadioEngine->InitializeRadio(); - } - HandleVolumeChangedCallback(); - } + else if ( ( iGlobalOfflineQuery && !iGlobalOfflineQuery->IsActive() ) || + !iGlobalOfflineQuery ) + { + iRadioEngine->InitializeRadio(); + } + HandleVolumeChangedCallback(); + } } // --------------------------------------------------------------------------- @@ -1423,8 +1400,6 @@ FTRACE( FPrint( _L("CFMRadioAppUi::HandleStopSeekCallback() state %d "), iCurrentRadioState) ); if ( iCurrentRadioState == EFMRadioStateBusyManualTune || - iCurrentRadioState == EFMRadioStateBusyScanUp || - iCurrentRadioState == EFMRadioStateBusyScanDown || iCurrentRadioState == EFMRadioStateBusySeek || iCurrentRadioState == EFMRadioStateBusyScanLocalStations ) { @@ -1449,7 +1424,6 @@ { // nop } - FTRACE( FPrint( _L("end CFMRadioAppUi::HandleStopSeekCallback") ) ); } @@ -1469,7 +1443,6 @@ { iActiveVolumePopupControl = iHeadsetVolumePopupControl; } - // restore volume for current output TInt volumeLevel = iRadioEngine->GetVolume(); iRadioEngine->SetVolume( volumeLevel ); @@ -1519,15 +1492,12 @@ switch ( aEvent.Type() ) { case EEventFocusLost: + { // being sent to background, so if tuning cancel first then handle event - if( iCurrentRadioState == EFMRadioStateBusyScanUp || - iCurrentRadioState == EFMRadioStateBusyScanDown ) - { - iRadioEngine->CancelScan(); - HandleStopSeekCallback(); - } - CAknViewAppUi::HandleWsEventL(aEvent, aDestination); + CancelSeek(); + CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); break; + } case EEventFocusGained: // override default behavior of unfading the ui // can be taken out when auto resume is implemented @@ -1541,9 +1511,9 @@ iChannelListView->UpdateDisplayForFocusGained(); } if (iScanLocalStationsView) - { - iScanLocalStationsView->UpdateDisplayForFocusGained(); - } + { + iScanLocalStationsView->UpdateDisplayForFocusGained(); + } break; default: CAknViewAppUi::HandleWsEventL(aEvent, aDestination); @@ -1558,24 +1528,24 @@ // ---------------------------------------------------------------------------------------------------- // void CFMRadioAppUi::FMRadioSvkChangeVolumeL( TInt aVolumeChange ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::FMRadioSvkRemoveVolumeL() aVolumeChange : %d"), aVolumeChange ) ); - - TBool headsetConnected = iRadioEngine->IsHeadsetConnected(); - - if ( iCurrentRadioState != EFMRadioStateBusyScanLocalStations && IsStartupWizardHandled() && - headsetConnected ) - { - if ( aVolumeChange > 0 ) // up direction - { - UpdateVolume( EDirectionUp ); - } - else // down direction - { - UpdateVolume( EDirectionDown ); - } - } - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::FMRadioSvkRemoveVolumeL() aVolumeChange : %d"), aVolumeChange ) ); + + TBool headsetConnected = iRadioEngine->IsHeadsetConnected(); + + if ( iCurrentRadioState != EFMRadioStateBusyScanLocalStations && IsStartupWizardHandled() && + headsetConnected ) + { + if ( aVolumeChange > 0 ) // up direction + { + UpdateVolume( EDirectionUp ); + } + else // down direction + { + UpdateVolume( EDirectionDown ); + } + } + } // ---------------------------------------------------------------------------------------------------- // CFMRadioAppUi::FMRadioSvkRemoveVolumeL @@ -1588,7 +1558,6 @@ FTRACE( FPrint( _L("CFMRadioAppUi::FMRadioSvkRemoveVolumeL( )") ) ); } - // ---------------------------------------------------------------------------------------------------- // CFMRadioAppUi::FMRadioHeadsetEvent // Handles the Headset button pressed @@ -1656,15 +1625,15 @@ FTRACE( FPrint( _L("CFMRadioAppUi::HandleResourceChangeL type: %d "), aType ) ); CAknViewAppUi::HandleResourceChangeL( aType ); - if ( aType == KEikDynamicLayoutVariantSwitch ) + if ( aType == KEikDynamicLayoutVariantSwitch ) { UpdateLandscapeInformation(); iLayoutChangeObserver->LayoutChangedL( aType ); } - else if ( aType == KAknsMessageSkinChange ) - { - iLayoutChangeObserver->LayoutChangedL( aType ); - } + else if ( aType == KAknsMessageSkinChange ) + { + iLayoutChangeObserver->LayoutChangedL( aType ); + } } // ---------------------------------------------------------------------------------------------------- @@ -1713,10 +1682,10 @@ // DialogTerminated // ---------------------------------------------------------------------------------------------------- void CFMRadioAppUi::DialogTerminated() - { - iInfoNoteOn = EFalse; - } - + { + iInfoNoteOn = EFalse; + } + // --------------------------------------------------------------------------- // CFMRadioAppUi::UpdateLandscapeInformation // --------------------------------------------------------------------------- @@ -1742,68 +1711,68 @@ // CFMRadioAppUi::UpdateChannelsL // --------------------------------------------------------------------------- // -void CFMRadioAppUi::UpdateChannelsL( TMoveoperations aOperation, - TInt aIndex, TInt aMovedToNewIndex ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::UpdateChannelsL(%d, %d, %d)"), aOperation, aIndex, aMovedToNewIndex ) ); - TChannelInformation channelinfo; - - // Move channel operation moves channel from aIndex to aMovedToNewIndex value - if ( EMoveChannels == aOperation ) - { - channelinfo = iChannels->At( aIndex ); - iChannels->Delete( aIndex ); - iChannels->InsertL( aMovedToNewIndex, channelinfo ); - } - // Delete channel deletes channel from list - else if( EDeleteChannel == aOperation ) - { - iChannels->Delete( aIndex ); - - for ( TInt index = 0; index < iChannels->Count(); index++ ) - { - iRadioEngine->SetPresetNameFrequencyL( - index, - iChannels->At( index ).iChannelInformation, - iChannels->At( index ).iChannelFrequency ); - } - - CRadioEngine::TStationName emptyStationName; - // Remove last - iRadioEngine->SetPresetNameFrequencyL( iChannels->Count(), emptyStationName, KErrNotFound ); - } - // Store all channels to repository - else if ( EStoreAllToRepository == aOperation ) - { - for ( TInt index = 0; index < iChannels->Count(); index++ ) - { - iRadioEngine->SetPresetNameFrequencyL( - index, - iChannels->At( index ).iChannelInformation, - iChannels->At( index ).iChannelFrequency ); - } - } - // Store specified index to repository and same index - else if (EStoreIndexToRepository== aOperation ) - { - iRadioEngine->SetPresetNameFrequencyL( - aIndex, - iChannels->At( aIndex ).iChannelInformation, - iChannels->At( aIndex ).iChannelFrequency ); - - } +void CFMRadioAppUi::UpdateChannelsL( TMoveoperations aOperation, + TInt aIndex, TInt aMovedToNewIndex ) + { + FTRACE( FPrint( _L("CFMRadioAppUi::UpdateChannelsL(%d, %d, %d)"), aOperation, aIndex, aMovedToNewIndex ) ); + + // Move channel operation moves channel from aIndex to aMovedToNewIndex value + if ( EMoveChannels == aOperation ) + { + const CFMRadioPreset* channelinfo = iChannels[ aIndex ]; + iChannels.Remove( aIndex ); + iChannels.Insert( channelinfo, aMovedToNewIndex ); + } + // Delete channel deletes channel from list + else if ( EDeleteChannel == aOperation ) + { + const CFMRadioPreset* channelinfo = iChannels[ aIndex ]; + iChannels.Remove( aIndex ); + delete channelinfo; + + for ( TInt index = 0; index < iChannels.Count(); index++ ) + { + iRadioEngine->SetPresetNameFrequencyL( + index, + iChannels[ index ]->PresetName(), + iChannels[ index ]->PresetFrequency() ); + + iRadioEngine->SaveUrlToPresetL( index, iChannels[ index ]->PresetUrl() ); + } + iRadioEngine->DeletePresetL( iChannels.Count() ); + } + + // Store all channels to repository + else if ( EStoreAllToRepository == aOperation ) + { + for ( TInt index = 0; index < iChannels.Count(); index++ ) + { + iRadioEngine->SetPresetNameFrequencyL( + index, + iChannels[ index ]->PresetName(), + iChannels[ index ]->PresetFrequency() ); + + iRadioEngine->SaveUrlToPresetL( index, iChannels[ index ]->PresetUrl() ); + } + } + + // Store specified index to repository and same index + else if ( EStoreIndexToRepository == aOperation ) + { + iRadioEngine->SetPresetNameFrequencyL( + aIndex, + iChannels[ aIndex ]->PresetName(), + iChannels[ aIndex ]->PresetFrequency() ); + + iRadioEngine->SaveUrlToPresetL( aIndex, iChannels[ aIndex ]->PresetUrl() ); + } else if ( ERemoveAllFromRepository == aOperation ) { - CRadioEngine::TStationName emptyStationName; - - for ( TInt i = 0; i < iChannels->Count(); i++ ) - { - iRadioEngine->SetPresetNameFrequencyL( i, emptyStationName, KErrNotFound ); - } - iChannels->Reset(); + iRadioEngine->DeletePresetL( -1 ); // reset all presets + iChannels.ResetAndDestroy(); } - iRadioEngine->PubSubL().PublishPresetCountL( iChannels->Count() ); + iRadioEngine->PubSubL().PublishPresetCountL( iChannels.Count() ); } // --------------------------------------------------------------------------- @@ -1811,13 +1780,15 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::AddChannelToListL( const TDesC& aChannelName, TInt aChannelFreq ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::AddChannelToListL(%S, %d)"), &aChannelName, aChannelFreq ) ); - TChannelInformation channelinfo; - channelinfo.iChannelInformation = aChannelName; - channelinfo.iChannelFrequency = aChannelFreq; - iChannels->AppendL( channelinfo ); - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::AddChannelToListL(%S, %d)"), &aChannelName, aChannelFreq ) ); + CFMRadioPreset* preset = CFMRadioPreset::NewL(); + CleanupStack::PushL( preset ); + preset->SetPresetNameL( aChannelName ); + preset->SetPresetFrequency( aChannelFreq ); + iChannels.AppendL( preset ); + CleanupStack::Pop( preset ); + } // --------------------------------------------------------------------------- // CFMRadioAppUi::IsLandscapeOrientation @@ -1885,19 +1856,19 @@ // (that would disable auto resume) is playing (or has played) // audio, a global confirmation query is displayed. if ( iAudioResourceAvailable ) - { - iRadioEngine->RadioOff(); - + { + iRadioEngine->RadioOff(); + if ( !iGlobalOfflineQuery ) - { + { iGlobalOfflineQuery = CFMRadioGlobalConfirmationQuery::NewL( this ); } - + HBufC* text = StringLoader::LoadLC( R_QTN_FMRADIO_QUERY_OFFLINE_USE, iCoeEnv ); - + iOfflineQueryDialogActivated = ETrue; iGlobalOfflineQuery->ShowQueryL( *text, R_AVKON_SOFTKEYS_YES_NO, R_QGN_NOTE_QUERY_ANIM ); - + CleanupStack::PopAndDestroy( text ); } @@ -1919,12 +1890,12 @@ { FTRACE( FPrint( _L("CFMRadioAppUi::HandleFlightModeDisabledCallback" ) ) ); iOfflineProfileActivatedWhenRadioAudioDisabled = EFalse; - + // Close continue offline query - if ( iLocalContinueOfflineQuery && iLocalContinueOfflineQuery->IsVisible() ) - { - TRAP_IGNORE( iLocalContinueOfflineQuery->DismissQueryL() ); - } + if ( iLocalContinueOfflineQuery && iLocalContinueOfflineQuery->IsVisible() ) + { + TRAP_IGNORE( iLocalContinueOfflineQuery->DismissQueryL() ); + } } // --------------------------------------------------------------------------- @@ -1963,11 +1934,11 @@ void CFMRadioAppUi::HandleStartupForegroundEventL() { FTRACE( FPrint( _L("CFMRadioAppUi::HandleStartupForegroundEventL" ) ) ); - HandleOfflineModeAtStartUpL(); + HandleOfflineModeAtStartUpL(); TFMRadioRegionSetting region = HandleRegionsAtStartUpL(); iRadioEngine->SetRegionIdL( region ); HandlePendingViewActivationL(); - RequestTunerControl(); + RequestTunerControl(); } // --------------------------------------------------------------------------- @@ -1983,9 +1954,9 @@ iOfflineQueryDialogActivated = ETrue; if ( AknLayoutUtils::PenEnabled() ) - { - // We must hide toolbar, otherwise query dialog softkeys doesn't work - ShowToolbar( EFalse ); + { + // We must hide toolbar, otherwise query dialog softkeys doesn't work + ShowToolbar( EFalse ); } iLocalActivateOfflineQuery = CAknQueryDialog::NewL(); @@ -1995,18 +1966,18 @@ iOfflineQueryDialogActivated = EFalse; if ( result ) - { + { if ( AknLayoutUtils::PenEnabled() ) - { - ShowToolbar( ETrue ); - } + { + ShowToolbar( ETrue ); + } } else - { - Exit(); - } - } - } + { + Exit(); + } + } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::ShowToolbar @@ -2015,17 +1986,17 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::ShowToolbar( TBool aVisible ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::ShowToolbar(%d)"), aVisible ) ); - if ( iLayoutChangeObserver == iMainView ) - { - iMainView->ShowToolbar( aVisible ); - } - else if ( iLayoutChangeObserver == iScanLocalStationsView ) - { - iScanLocalStationsView->ShowToolbar( aVisible ); - } - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::ShowToolbar(%d)"), aVisible ) ); + if ( iLayoutChangeObserver == iMainView ) + { + iMainView->ShowToolbar( aVisible ); + } + else if ( iLayoutChangeObserver == iScanLocalStationsView ) + { + iScanLocalStationsView->ShowToolbar( aVisible ); + } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::IsOfflineProfileActivatedWhenRadioAudioDisabled @@ -2102,25 +2073,24 @@ iCurrentRadioState = EFMRadioStateOff; Exit(); } - // --------------------------------------------------------------------------- // CFMRadioAppUi::HandleMuteCommand // Handles mute keypress from main view // --------------------------------------------------------------------------- // void CFMRadioAppUi::HandleMuteCommand() - { - FTRACE( FPrint( _L("CFMRadioAppUi::HandleMuteCommand" ) ) ); - if ( iRadioEngine->IsMuteOn() ) - { - iRadioEngine->SetMuteOn( EFalse ); - } - else - { - iRadioEngine->SetMuteOn( ETrue ); - } - } - + { + FTRACE( FPrint( _L("CFMRadioAppUi::HandleMuteCommand" ) ) ); + if ( iRadioEngine->IsMuteOn() ) + { + iRadioEngine->SetMuteOn( EFalse ); + } + else + { + iRadioEngine->SetMuteOn( ETrue ); + } + } + // --------------------------------------------------------------------------- // CFMRadioAppUi::HandleRegionsAtStartUpL // get region automatically from network or manually by user choice if network @@ -2129,50 +2099,50 @@ // TFMRadioRegionSetting CFMRadioAppUi::HandleRegionsAtStartUpL() { - FTRACE( FPrint( _L("CFMRadioAppUi::HandleRegionsAtStartUpL()")) ); - TFMRadioRegionSetting region = iRadioEngine->GetRegionL(); + FTRACE( FPrint( _L("CFMRadioAppUi::HandleRegionsAtStartUpL()")) ); + TFMRadioRegionSetting region = iRadioEngine->GetRegionL(); if ( region == EFMRadioRegionNone ) { - ShowToolbar( EFalse ); + ShowToolbar( EFalse ); TInt index = 0; CDesCArraySeg* regionList = new( ELeave ) CDesCArraySeg( KDefaultRegionArrayGranularity ); - CleanupStack::PushL( regionList ); + CleanupStack::PushL( regionList ); iRadioEngine->FillListWithRegionDataL( *regionList ); - + CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &index ); - dlg->PrepareLC( R_FMRADIO_SELECT_REGION_QUERY ); - CTextListBoxModel* model = + dlg->PrepareLC( R_FMRADIO_SELECT_REGION_QUERY ); + CTextListBoxModel* model = static_cast( dlg->ListControl() )->listbox()->Model(); - model->SetItemTextArray( regionList ); - model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Array won't be deleted here + model->SetItemTextArray( regionList ); + model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Array won't be deleted here TInt ret = dlg->RunLD(); CleanupStack::PopAndDestroy( regionList ); if ( ret != EAknSoftkeyExit ) - { - // We should have a proper region selected by user - region = iRadioEngine->RegionIdAtIndex( index ); - } - + { + // We should have a proper region selected by user + region = iRadioEngine->RegionIdAtIndex( index ); + } + if ( region == EFMRadioRegionNone ) { - Exit(); // This will eventually exit FMRadio. + Exit();// This will eventually exit FMRadio. } else - { + { HBufC* bandSetText = StringLoader::LoadLC( R_QTN_FMRADIO_CONF_FREQ_BAND_SET_MANUAL, iCoeEnv ); - CAknInformationNote* note = new( ELeave ) CAknInformationNote( ETrue ); - note->ExecuteLD( *bandSetText ); - CleanupStack::PopAndDestroy( bandSetText ); - if ( AknLayoutUtils::PenEnabled() ) - { - ShowToolbar( ETrue ); - } + CAknInformationNote* note = new( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *bandSetText ); + CleanupStack::PopAndDestroy( bandSetText ); + if ( AknLayoutUtils::PenEnabled() ) + { + ShowToolbar( ETrue ); + } } } else @@ -2182,7 +2152,7 @@ { TInt previousRegion = iRadioEngine->RegionId(); - if ( previousRegion != EFMRadioRegionNone ) + if ( previousRegion != EFMRadioRegionNone ) { // Show note only if the region has changed from a concrete // one to another concrete one. EFMRadioRegionNone is not @@ -2195,7 +2165,6 @@ } } } - return region; } @@ -2231,10 +2200,10 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::RequestTunerControl() const - { - FTRACE( FPrint( _L("CFMRadioAppUi::RequestTunerControl()")) ); - iRadioEngine->RequestTunerControl(); - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::RequestTunerControl()")) ); + iRadioEngine->RequestTunerControl(); + } // --------------------------------------------------------------------------- // CFMRadioAppUi::NumberOfChannelsStored @@ -2242,11 +2211,11 @@ // --------------------------------------------------------------------------- // TInt CFMRadioAppUi::NumberOfChannelsStored() const - { - FTRACE( FPrint( _L("CFMRadioAppUi::NumberOfChannelsStored()")) ); - return iChannels->Count(); - } - + { + FTRACE( FPrint( _L("CFMRadioAppUi::NumberOfChannelsStored()")) ); + return iChannels.Count(); + } + // --------------------------------------------------------------------------- // CFMRadioAppUi::HandleStartupWizard // Determine if "Scan all channels" in scan local stations view should be started. @@ -2286,9 +2255,9 @@ // --------------------------------------------------------------------------- // TBool CFMRadioAppUi::IsStartupWizardRunning() const - { - return iStartupWizardRunning; - } + { + return iStartupWizardRunning; + } // --------------------------------------------------------------------------- // CFMRadioAppUi::SetStartupWizardRunning @@ -2296,10 +2265,10 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::SetStartupWizardRunning( const TBool aRunningState ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::SetStartupWizardRunning() - state = %d"), aRunningState) ); - iStartupWizardRunning = aRunningState; - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::SetStartupWizardRunning() - state = %d"), aRunningState) ); + iStartupWizardRunning = aRunningState; + } // --------------------------------------------------------------------------- // CFMRadioAppUi::StartLocalStationsSeekL @@ -2307,11 +2276,11 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::StartLocalStationsSeekL() - { - FTRACE( FPrint( _L("CFMRadioAppUi::StartLocalStationsSeekL()")) ); - iCurrentRadioState = EFMRadioStateBusyScanLocalStations; + { + FTRACE( FPrint( _L("CFMRadioAppUi::StartLocalStationsSeekL()")) ); + iCurrentRadioState = EFMRadioStateBusyScanLocalStations; iRadioEngine->ScanUp(); - } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::TryToResumeAudioL @@ -2319,61 +2288,61 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::TryToResumeAudioL() - { + { FTRACE( FPrint( _L("CFMRadioAppUi::TryToResumeAudioL" ) ) ); - TFMRadioRegionSetting region = iRadioEngine->GetRegionL(); - if ( iAudioLost && - IsForeground() && - !iOfflineQueryDialogActivated && - region != EFMRadioRegionNone ) - { - iAudioLost = EFalse; - iRadioEngine->InitializeRadio(); - } - } - + TFMRadioRegionSetting region = iRadioEngine->GetRegionL(); + if ( iAudioLost && + IsForeground() && + !iOfflineQueryDialogActivated && + region != EFMRadioRegionNone ) + { + iAudioLost = EFalse; + iRadioEngine->InitializeRadio(); + } + } + // --------------------------------------------------------------------------- // CFMRadioAppUi::ShowConnectHeadsetDialogL // Show connect headset query with only exit softkey // --------------------------------------------------------------------------- // void CFMRadioAppUi::ShowConnectHeadsetDialogL() - { - FTRACE( FPrint( _L("CFMRadioAppUi::ShowConnectHeadsetDialogL" ) ) ); - if ( !iConnectHeadsetQuery && !iConnectHeadsetGlobalNote ) - { - HBufC* noteTxt = StringLoader::LoadLC( R_QTN_FMRADIO_ERROR_CON_HEADSET, iCoeEnv ); - - // if radio is in background, show also global note - if ( !IsForeground() ) - { - iConnectHeadsetGlobalNote = CAknGlobalNote::NewL(); - iConnectHeadsetGlobalNote->ShowNoteL( EAknGlobalInformationNote, *noteTxt ); - delete iConnectHeadsetGlobalNote; - iConnectHeadsetGlobalNote = NULL; - } - - iConnectHeadsetQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone ); - TInt ret = iConnectHeadsetQuery->ExecuteLD( R_FMRADIO_CONNECT_HEADSET_NOTE, *noteTxt ); - - CleanupStack::PopAndDestroy( noteTxt ); - - if ( iConnectHeadsetQuery ) - { - iConnectHeadsetQuery = NULL; - if ( ret == EAknSoftkeyExit ) - { - TApaTask task( iCoeEnv->WsSession() ); - task.SetWgId( iCoeEnv->RootWin().Identifier() ); - task.EndTask(); - } - else - { - HandlePendingViewActivationL(); - } - } - } - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::ShowConnectHeadsetDialogL" ) ) ); + if ( !iConnectHeadsetQuery && !iConnectHeadsetGlobalNote ) + { + HBufC* noteTxt = StringLoader::LoadLC( R_QTN_FMRADIO_ERROR_CON_HEADSET, iCoeEnv ); + + // if radio is in background, show also global note + if ( !IsForeground() ) + { + iConnectHeadsetGlobalNote = CAknGlobalNote::NewL(); + iConnectHeadsetGlobalNote->ShowNoteL( EAknGlobalInformationNote, *noteTxt ); + delete iConnectHeadsetGlobalNote; + iConnectHeadsetGlobalNote = NULL; + } + + iConnectHeadsetQuery = CAknQueryDialog::NewL( CAknQueryDialog::EErrorTone ); + TInt ret = iConnectHeadsetQuery->ExecuteLD( R_FMRADIO_CONNECT_HEADSET_NOTE, *noteTxt ); + + CleanupStack::PopAndDestroy( noteTxt ); + + if ( iConnectHeadsetQuery ) + { + iConnectHeadsetQuery = NULL; + if ( ret == EAknSoftkeyExit ) + { + TApaTask task( iCoeEnv->WsSession() ); + task.SetWgId( iCoeEnv->RootWin().Identifier() ); + task.EndTask(); + } + else + { + HandlePendingViewActivationL(); + } + } + } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::ShowVolumePopupL @@ -2401,19 +2370,19 @@ // --------------------------------------------------------------------------- // CArrayFix* CFMRadioAppUi::GetCurrentHelpContextL() const - { - FTRACE( FPrint( _L("CFMRadioAppUi::GetCurrentHelpContextL" ) ) ); + { + FTRACE( FPrint( _L("CFMRadioAppUi::GetCurrentHelpContextL" ) ) ); #if defined __SERIES60_HELP || defined FF_S60_HELPS_IN_USE - // currently main container and manual tuning container are derived from CBase - // so lets create help array manually for them - CArrayFixFlat* helpArray = new( ELeave ) - CArrayFixFlat( 1 ); - CleanupStack::PushL( helpArray ); - helpArray->AppendL( TCoeHelpContext( TUid::Uid( KUidFMRadioApplication ), KFMRADIO_HLP_MAIN ) ); - CleanupStack::Pop( helpArray ); - return helpArray; + // currently main container and manual tuning container are derived from CBase + // so lets create help array manually for them + CArrayFixFlat* helpArray = new( ELeave ) + CArrayFixFlat( 1 ); + CleanupStack::PushL( helpArray ); + helpArray->AppendL( TCoeHelpContext( TUid::Uid( KUidFMRadioApplication ), KFMRADIO_HLP_MAIN ) ); + CleanupStack::Pop( helpArray ); + return helpArray; #else - return AppHelpContextL(); + return AppHelpContextL(); #endif } @@ -2429,16 +2398,33 @@ // Note: KMaxNumberOfChannelListItems can be setted to any supported max value for ( TInt index = 0; index < KMaxNumberOfChannelListItems; index++ ) { - TChannelInformation channelinfo; - + TBuf chName; + TInt chFrequency; + iRadioEngine->GetPresetNameAndFrequencyL( index, - channelinfo.iChannelInformation, - channelinfo.iChannelFrequency ); + chName, + chFrequency ); - if ( channelinfo.iChannelFrequency != KErrNotFound ) + if ( chFrequency != KErrNotFound ) { FTRACE( FPrint( _L("CFMRadioChannelListView::ChannelInUse inside if") ) ); - iChannels->AppendL( channelinfo ); + CFMRadioPreset* preset = CFMRadioPreset::NewL(); + CleanupStack::PushL( preset ); + preset->SetPresetNameL( chName ); + preset->SetPresetFrequency( chFrequency ); + + RBuf url; + url.CleanupClosePushL(); + url.CreateL( KFMRadioWebLinkMaxLength ); + TInt err = iRadioEngine->PresetUrlL( index, url ); + if ( !err ) + { + preset->SetPresetUrlL( url ); + } + + iChannels.AppendL( preset ); + CleanupStack::PopAndDestroy( &url ); + CleanupStack::Pop( preset ); } } } @@ -2515,7 +2501,7 @@ // tune to station index TLex8 indexLex( tailLex.NextToken() ); TInt32 index = 0; - TInt ret = indexLex.BoundedVal( index, iChannels->Count() - 1 ); + TInt ret = indexLex.BoundedVal( index, iChannels.Count() - 1 ); if ( ret == KErrNone && index >= 0 ) { iRadioEngine->CancelScan(); @@ -2571,7 +2557,7 @@ // Returns channels array // --------------------------------------------------------------------------- // -CArrayFixFlat* CFMRadioAppUi::Channels() +RPointerArray& CFMRadioAppUi::Channels() { return iChannels; } @@ -2582,25 +2568,25 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::HandleIADUpdateCheckL() - { - FTRACE( FPrint( _L("CFMRadioAppUi::HandleIADUpdateCheckL") ) ); - if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::HandleIADUpdateCheckL - KFeatureIdIAUpdate supported") ) ); - TRAPD( err, iUpdate = CIAUpdate::NewL( *this ) ) - if ( err && err != KErrNotSupported ) - { - User::Leave( err ); - } - if ( !err ) - { - iParameters = CIAUpdateParameters::NewL(); - // Use SIS package UID - iParameters->SetUid( TUid::Uid( KUidFMRadioApplication ) ); - iUpdate->CheckUpdates( *iParameters ); - } - } - } + { + FTRACE( FPrint( _L("CFMRadioAppUi::HandleIADUpdateCheckL") ) ); + if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) ) + { + FTRACE( FPrint( _L("CFMRadioAppUi::HandleIADUpdateCheckL - KFeatureIdIAUpdate supported") ) ); + TRAPD( err, iUpdate = CIAUpdate::NewL( *this ) ) + if ( err && err != KErrNotSupported ) + { + User::Leave( err ); + } + if ( !err ) + { + iParameters = CIAUpdateParameters::NewL(); + // Use SIS package UID + iParameters->SetUid( TUid::Uid( KUidFMRadioApplication ) ); + iUpdate->CheckUpdates( *iParameters ); + } + } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::CheckUpdatesComplete @@ -2608,9 +2594,9 @@ // --------------------------------------------------------------------------- // void CFMRadioAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::CheckUpdatesComplete(%d, %d)"), aErrorCode, aAvailableUpdates ) ); - if ( aErrorCode == KErrNone ) + { + FTRACE( FPrint( _L("CFMRadioAppUi::CheckUpdatesComplete(%d, %d)"), aErrorCode, aAvailableUpdates ) ); + if ( aErrorCode == KErrNone ) { if ( aAvailableUpdates > 0 ) { @@ -2626,18 +2612,18 @@ delete iParameters; iParameters = NULL; } - } - } - + } + } + // --------------------------------------------------------------------------- // CFMRadioAppUi::UpdateComplete // from base class MIAUpdateObserver // --------------------------------------------------------------------------- // void CFMRadioAppUi::UpdateComplete( TInt FDEBUGVAR( aErrorCode ), CIAUpdateResult* aResultDetails ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::UpdateComplete(%d)"), aErrorCode ) ); - // The update process that the user started from IAUpdate UI is now completed. + { + FTRACE( FPrint( _L("CFMRadioAppUi::UpdateComplete(%d)"), aErrorCode ) ); + // The update process that the user started from IAUpdate UI is now completed. // If the client application itself was updated in the update process, this callback // is never called, since the client is not running anymore. @@ -2648,17 +2634,17 @@ iUpdate = NULL; delete iParameters; iParameters = NULL; - } - + } + // --------------------------------------------------------------------------- // CFMRadioAppUi::UpdateQueryComplete // from base class MIAUpdateObserver // --------------------------------------------------------------------------- // void CFMRadioAppUi::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ) - { - FTRACE( FPrint( _L("CFMRadioAppUi::UpdateQueryComplete(%d, %d)"), aErrorCode, aUpdateNow ) ); - if ( aErrorCode == KErrNone ) + { + FTRACE( FPrint( _L("CFMRadioAppUi::UpdateQueryComplete(%d, %d)"), aErrorCode, aUpdateNow ) ); + if ( aErrorCode == KErrNone ) { if ( aUpdateNow ) { @@ -2675,18 +2661,17 @@ iParameters = NULL; } } - } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::AutoTuneInMainView // Set autotune true, if scan is interrupted // --------------------------------------------------------------------------- // -void CFMRadioAppUi::AutoTuneInMainView ( TBool aTune ) - { +void CFMRadioAppUi::AutoTuneInMainView ( TBool /*aTune*/ ) + { FTRACE( FPrint( _L("CFMRadioAppUi::AutoTuneInMainView()"))); - iAutoTune = aTune; - } + } // --------------------------------------------------------------------------- // CFMRadioAppUi::IsStartupWizardHandled @@ -2719,7 +2704,6 @@ delete wgName; } ); } - return isIdleActive; } @@ -2766,11 +2750,11 @@ TInt CFMRadioAppUi::MatchingChannelL( TInt aFrequency ) { TInt channelIndex = KErrNotFound; - TInt numberOfChannels = iChannels->Count(); + TInt numberOfChannels = iChannels.Count(); for ( TInt i = 0; i < numberOfChannels; i++ ) { - TInt presetFrequency = iChannels->At( i ).iChannelFrequency; + TInt presetFrequency = iChannels[ i ]->PresetFrequency(); if ( aFrequency == presetFrequency ) { @@ -2805,4 +2789,13 @@ return iActiveVolumePopupControl; } +// --------------------------------------------------------- +// CFMRadioAppUi::RadioState +// --------------------------------------------------------- +// +CFMRadioAppUi::TRadioState CFMRadioAppUi::RadioState() const + { + return iCurrentRadioState; + } + // End of File diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradiochannellistcontainer.cpp --- a/fmradio/fmradio/src/fmradiochannellistcontainer.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradiochannellistcontainer.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -485,6 +485,7 @@ { // The channel list fills the whole view iChannelList->SetRect( Rect() ); + DrawDeferred(); } // --------------------------------------------------------- diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradiochannellistview.cpp --- a/fmradio/fmradio/src/fmradiochannellistview.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradiochannellistview.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -237,7 +237,7 @@ if ( res ) { - if ( iObserver.Channels()->Count() < KMaxNumberOfChannelListItems ) + if ( iObserver.Channels().Count() < KMaxNumberOfChannelListItems ) { TInt usefreq = static_cast( retFreq * KFMRadioFreqMultiplier ); iRadioEngine->Tune( usefreq ); @@ -250,7 +250,7 @@ iContainer->AddChannelL( stationName, usefreq, ETrue ); - iRadioEngine->TunePresetL( iObserver.Channels()->Count()-1 ); + iRadioEngine->TunePresetL( iObserver.Channels().Count() - 1 ); TInt index = iRadioEngine->GetPresetIndex(); @@ -380,15 +380,15 @@ { TBool nowPlaying = EFalse; - CArrayFixFlat* channels = iObserver.Channels(); - TInt channelCount = channels->Count(); + RPointerArray& channels = iObserver.Channels(); + TInt channelCount = channels.Count(); for ( TInt channelIndex = 0; channelCount > channelIndex; channelIndex++ ) { FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use") ) ); - iContainer->AddChannelL( channels->At( channelIndex ).iChannelInformation, - channels->At( channelIndex ).iChannelFrequency, + iContainer->AddChannelL( channels[ channelIndex ]->PresetName(), + channels[ channelIndex ]->PresetFrequency(), nowPlaying ); UpdateMiddleSoftKeyL(); @@ -551,7 +551,7 @@ iChIndex = iChIndex + 1; - if ( iChIndex >= iObserver.Channels()->Count() ) + if ( iChIndex >= iObserver.Channels().Count() ) { iChIndex = 0; } @@ -578,7 +578,7 @@ if ( iChIndex <= 0 ) { - iChIndex = iObserver.Channels()->Count()-1; + iChIndex = iObserver.Channels().Count() - 1; } else { @@ -695,7 +695,7 @@ } // don't show stylus pop-up menu during move operation - if ( iObserver.Channels()->Count() > 1 && !iMoveMode ) + if ( iObserver.Channels().Count() > 1 && !iMoveMode ) { aMenuPane->SetItemDimmed( EFMRadioCmdMove, EFalse ); } @@ -761,7 +761,7 @@ if ( ( iContainer && ( iContainer->CurrentlySelectedChannel() == iRadioEngine->GetPresetIndex() - || iObserver.Channels()->Count() == 0 ) ) || + || iObserver.Channels().Count() == 0 ) ) || iMoveMode ) { SetMiddleSoftKeyLabelL(R_QTN_FMRADIO_NONE, EFMRadioCmdListenCh); @@ -816,31 +816,25 @@ if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode && currentPresetIx != KErrNotFound ) { - TBuf stationName; - stationName.SetLength( 0 ); - - - TInt presetFreq( 0 ); - - CArrayFixFlat* channels = iObserver.Channels(); + RPointerArray& channels = iObserver.Channels(); // this checks that index is not out of bound and cause -21 error during update - if ( currentPresetIx < channels->Count() ) + if ( currentPresetIx < channels.Count() ) { - stationName = channels->At( currentPresetIx ).iChannelInformation; - presetFreq = channels->At( currentPresetIx ).iChannelFrequency; + const TDesC& stationName = channels[ currentPresetIx ]->PresetName(); + TInt presetFreq = channels[ currentPresetIx ]->PresetFrequency(); if ( stationName.Length() == 0 ) //Set and save PSname only if no name set before { TRAP_IGNORE( { iContainer->UpdateChannelListContentL( currentPresetIx, - programmeService, - presetFreq ); + programmeService, + presetFreq ); - iRadioEngine->SetPresetNameFrequencyL( currentPresetIx, programmeService, presetFreq ); - iObserver.Channels()->At( currentPresetIx ).iChannelInformation = programmeService; - } ); + iRadioEngine->SetPresetNameFrequencyL( currentPresetIx, programmeService, presetFreq ); + channels[ currentPresetIx ]->SetPresetNameL( programmeService ); + } ) } } } @@ -942,6 +936,25 @@ // void CFMRadioChannelListView::RdsDataRadioText( const TDesC& /*aRadioText*/ ){} +void CFMRadioChannelListView::RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioText ) + { + if ( aRTPlusClass == ERTplusProgramHomepage && + iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode ) + { + TInt currentPresetIx = iRadioEngine->GetPresetIndex(); + if ( currentPresetIx < iObserver.Channels().Count() ) + { + TRAP_IGNORE + ( + // save permanently + iRadioEngine->SaveUrlToPresetL( currentPresetIx, aRadioText ); + // save to ui list + iObserver.Channels()[ currentPresetIx ]->SetPresetUrlL( aRadioText ); + ) + } + } + } + // ----------------------------------------------------------------------------------------------- // CFMRadioChannelListView::RdsAfSearchBegin // From MFMRadioRdsObserver, implementation not needed. diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradiologo.cpp --- a/fmradio/fmradio/src/fmradiologo.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradiologo.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -217,8 +217,8 @@ bitmapLayout.Rect().Size(), EAspectRatioPreserved, iBackgroundBitmapFileName, - EMbmFmradioQgn_indi_radio_default, - EMbmFmradioQgn_indi_radio_default_mask ); + EMbmFmradioQgn_menu_radio, + EMbmFmradioQgn_menu_radio_mask ); // image for landscape bitmapLayout.LayoutRect( @@ -229,8 +229,8 @@ bitmapLayout.Rect().Size(), EAspectRatioPreserved, iBackgroundBitmapFileName, - EMbmFmradioQgn_indi_radio_default, - EMbmFmradioQgn_indi_radio_default_mask ); + EMbmFmradioQgn_menu_radio, + EMbmFmradioQgn_menu_radio_mask ); iImageVisual->SetImage( iPortraitImage ); iImageVisual->SetSecondaryImage( iLandscapeImage ); diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradiomaincontainer.cpp --- a/fmradio/fmradio/src/fmradiomaincontainer.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradiomaincontainer.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -259,14 +259,14 @@ iRadioLogo = CFMRadioLogo::NewL( iAlfEnv ); iRadioLogo->SetId( KFMRadioLogoId ); - // Append the controls into the control group. - group->AppendL( iMediaIdle ); - group->AppendL( iVisualControl ); + // Append the controls into the control group. + group->AppendL( iMediaIdle ); group->AppendL( iRdsIndicator ); group->AppendL( iRdsAfIndicator ); group->AppendL( iRdsViewer ); group->AppendL( iRdsInteractionIndicator ); group->AppendL( iRadioLogo ); + group->AppendL( iVisualControl ); } iIdleController = CFMRadioIdleController::NewL(); @@ -280,9 +280,8 @@ UpdateTextColorFromSkin(); SizeChanged(); - //Make the control group active on the display + // Make the control group active on the display display->Roster().ShowL( *group ); - display->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground ); } // -------------------------------------------------------------------------------- @@ -658,6 +657,9 @@ iVisualControl->SetStationInformationTextColor( color ); iMediaIdle->SetPrimaryColor( color ); iRdsViewer->SetTextColor( color ); + iRdsIndicator->SetTextColor( color ); + iRdsAfIndicator->SetTextColor( color ); + iRdsInteractionIndicator->SetTextColor( color ); AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG10 ); diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradiomainview.cpp --- a/fmradio/fmradio/src/fmradiomainview.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradiomainview.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -200,7 +200,7 @@ CFMRadioAppUi* appUi = static_cast( iCoeEnv->AppUi() ); TInt presetIndex = iRadioEngine->GetPresetIndex(); - TInt channelCount = iObserver.Channels()->Count(); + TInt channelCount = iObserver.Channels().Count(); if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode && channelCount > 0 && @@ -393,7 +393,7 @@ TInt presetIndex = iRadioEngine->GetPresetIndex(); // When we haven't preset name, ps name will save as preset name if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode && - presetIndex < iObserver.Channels()->Count() ) + presetIndex < iObserver.Channels().Count() ) { presetIndexToDisplay = presetIndex; } @@ -417,7 +417,7 @@ if ( aStatic ) { // When we haven't got a name for preset, a static ps name will be saved - TInt channelCount = iObserver.Channels()->Count(); + TInt channelCount = iObserver.Channels().Count(); TInt currentPresetIx = iRadioEngine->GetPresetIndex(); if ( aStatic && iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode && @@ -425,14 +425,14 @@ channelCount > 0 && currentPresetIx < channelCount ) { - TDesC& stationName = iObserver.Channels()->At( currentPresetIx ).iChannelInformation; - TInt presetFreq = iObserver.Channels()->At( currentPresetIx ).iChannelFrequency; + const TDesC& stationName = iObserver.Channels()[ currentPresetIx ]->PresetName(); + TInt presetFreq = iObserver.Channels()[ currentPresetIx ]->PresetFrequency(); if ( stationName.Length() == 0 && presetFreq != KErrNotFound && iRadioEngine->RdsReceiver().ProgrammeService().Length() ) { - iObserver.Channels()->At( currentPresetIx ).iChannelInformation = iRadioEngine->RdsReceiver().ProgrammeService(); + iObserver.Channels()[ currentPresetIx ]->SetPresetNameL( iRadioEngine->RdsReceiver().ProgrammeService() ); iObserver.UpdateChannelsL( EStoreIndexToRepository, currentPresetIx, 0 ); // Update station information display DisplayChannelL( currentPresetIx ); @@ -460,8 +460,26 @@ // CFMRadioMainView::RdsDataRadioTextPlus // --------------------------------------------------------- // -void CFMRadioMainView::RdsDataRadioTextPlus( const TInt /*aRadioTextPlusClass*/, const TDesC& /*aRadioText*/ ) +void CFMRadioMainView::RdsDataRadioTextPlus( const TInt aRadioTextPlusClass, const TDesC& aRadioText ) { + if ( aRadioTextPlusClass == ERTplusProgramHomepage && + iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode ) + { + TInt currentPresetIx = iRadioEngine->GetPresetIndex(); + + if ( currentPresetIx < iObserver.Channels().Count() ) + { + TRAP_IGNORE + ( + // save permanently + iRadioEngine->SaveUrlToPresetL( currentPresetIx, aRadioText ); + // save to ui list + iObserver.Channels()[ currentPresetIx ]->SetPresetUrlL( aRadioText ); + ) + } + } + + if ( IsRTPlusInterActionIndicatorNeeded() ) { iContainer->ShowRTPlusInteractionIndicator( ETrue, ETrue ); @@ -629,6 +647,12 @@ stationName, seekDirection, channelFrequency ); + + // show '+' indicator if channel exists and url is stored + if ( channelNumber && iObserver.Channels()[ aChannelIndex ]->PresetUrl().Length() ) + { + iContainer->ShowRTPlusInteractionIndicator( ETrue, ETrue ); + } } else { @@ -727,6 +751,17 @@ if ( appUi->EraseChannelL( iRadioEngine->GetPresetIndex() ) ) { // delete has been confirmed, update station info + if ( iContainer ) + { + if ( IsRTPlusInterActionIndicatorNeeded() ) + { + iContainer->ShowRTPlusInteractionIndicator( ETrue, ETrue ); + } + else + { + iContainer->ShowRTPlusInteractionIndicator( EFalse, ETrue ); + } + } SetStationChangeType( EFMRadioStationChangeNone ); iRadioEngine->SetTunerModeOn(); DisplayChannelL( KErrNotFound ); @@ -765,12 +800,28 @@ // ---------------------------------------- void CFMRadioMainView::LaunchBrowserL( TInt aCommandId ) { + FTRACE( FPrint(_L("CFMRadioMainView::LaunchBrowserL") ) ); + CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver(); switch ( aCommandId ) { case EMPXPbvCmdInternetGoToWeb: - iMusicStoreHandler->LaunchWebPageL( receiver.RtPlusProgramUrl() ); + { + RBuf webLinkToLaunch; + webLinkToLaunch.CleanupClosePushL(); + if ( receiver.RtPlusProgramUrl().Length() ) + { + webLinkToLaunch.CreateL( receiver.RtPlusProgramUrl() ); + } + else if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode ) + { + webLinkToLaunch.CreateL( + iObserver.Channels()[ iRadioEngine->GetPresetIndex() ]->PresetUrl() ); + } + iMusicStoreHandler->LaunchWebPageL( webLinkToLaunch ); + CleanupStack::PopAndDestroy( &webLinkToLaunch ); break; + } default: iMusicStoreHandler->LaunchMusicStoreL( aCommandId, receiver.RtPlusSong(), @@ -1342,12 +1393,27 @@ TBool CFMRadioMainView::IsWebLinkAvailable() { TBool response = EFalse; + TBool webLinkStored = EFalse; + TInt presetIndex = iRadioEngine->GetPresetIndex(); + + if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode && + presetIndex < iObserver.Channels().Count() ) + { + if ( iObserver.Channels()[ presetIndex ]->PresetUrl().Length() ) + { + webLinkStored = ETrue; + } + } + CFMRadioRdsReceiverBase& receiver = iRadioEngine->RdsReceiver(); - if ( receiver.RtPlusProgramUrl().Length() && - iRadioEngine->GetRTPlusSupportLevel() == EFMRadioAllInteractions ) + + if ( ( receiver.RtPlusProgramUrl().Length() || + webLinkStored ) && + iRadioEngine->GetRTPlusSupportLevel() == EFMRadioAllInteractions ) { response = ETrue; } + return response; } diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradiopreset.cpp --- a/fmradio/fmradio/src/fmradiopreset.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradiopreset.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -60,6 +60,7 @@ CFMRadioPreset::~CFMRadioPreset() { iStationName.Close(); + iStationUrl.Close(); } // --------------------------------------------------------------------------- @@ -76,7 +77,7 @@ // CFMRadioPreset::PresetName // --------------------------------------------------------------------------- // -TDesC& CFMRadioPreset::PresetName() +const TDesC& CFMRadioPreset::PresetName() { return iStationName; } @@ -116,3 +117,22 @@ { return iStationFrequency; } + +// --------------------------------------------------------------------------- +// CFMRadioPreset::SetPresetUrlL +// --------------------------------------------------------------------------- +// +void CFMRadioPreset::SetPresetUrlL( const TDesC& aUrl ) + { + iStationUrl.Close(); + iStationUrl.CreateL( aUrl ); + } + +// --------------------------------------------------------------------------- +// CFMRadioPreset::PresetUrl +// --------------------------------------------------------------------------- +// +const TDesC& CFMRadioPreset::PresetUrl() + { + return iStationUrl; + } diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradio/src/fmradioscanlocalstationsview.cpp --- a/fmradio/fmradio/src/fmradioscanlocalstationsview.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradio/src/fmradioscanlocalstationsview.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -174,13 +174,8 @@ { case EAknSoftkeyBack: // go back to the main view { - const TVwsViewId viewId( TUid::Uid( KUidFMRadioApplication ), Id() ); - if ( appUi->BackSteppingWrapper().HandleBackCommandL( viewId ) ) - { - // Command was consumed - break; - } - // Fall through to activate previous view + appUi->ActivateLocalViewL( KFMRadioChannelListViewId ); + break; } case EEikBidCancel: { @@ -1172,14 +1167,14 @@ TInt savedChannelCount = 0; - if( aSavingMode == EAppend ) - { - /** Append found channels to preset list */ - for( TInt freqIx = 0; KMaxNumberOfChannelListItems > iObserver.Channels()->Count() && + if ( aSavingMode == EAppend ) + { + /** Append found channels to preset list */ + for ( TInt freqIx = 0; KMaxNumberOfChannelListItems > iObserver.Channels().Count() && chCount > freqIx; freqIx++ ) - { - const TDesC& name = iScannedChannels[ freqIx ]->PresetNameValid() ? - iScannedChannels[ freqIx ]->PresetName() : KNullDesC; + { + const TDesC& name = iScannedChannels[ freqIx ]->PresetNameValid() ? + iScannedChannels[ freqIx ]->PresetName() : KNullDesC; iObserver.AddChannelToListL( name, iScannedChannels[ freqIx ]->PresetFrequency() ); @@ -1507,9 +1502,9 @@ // void CFMRadioScanLocalStationsView::HandleOneChannelSaveL() { - TInt currentPresetCount = iObserver.Channels()->Count(); + TInt currentPresetCount = iObserver.Channels().Count(); TInt chIndex = iContainer->CurrentlySelectedChannel(); - TBool continueWithSave = ETrue; + TBool continueWithSave = ETrue; if ( !ChannelInUse( chIndex ) ) { diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradioengine/bwins/fmradioengineacu.def --- a/fmradio/fmradioengine/bwins/fmradioengineacu.def Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradioengine/bwins/fmradioengineacu.def Mon Mar 15 12:40:34 2010 +0200 @@ -71,4 +71,7 @@ ?PublishRDSRadioTextL@CFMRadioPubSub@@QBEXABVTDesC16@@@Z @ 70 NONAME ; void CFMRadioPubSub::PublishRDSRadioTextL(class TDesC16 const &) const ?RtPlusProgramUrl@CFMRadioRdsReceiverBase@@QBEABVTDesC16@@XZ @ 71 NONAME ; class TDesC16 const & CFMRadioRdsReceiverBase::RtPlusProgramUrl(void) const ?SetTunerModeOn@CRadioEngine@@QAEXXZ @ 72 NONAME ; void CRadioEngine::SetTunerModeOn(void) + ?PresetUrlL@CRadioEngine@@QAEHHAAVTDes16@@@Z @ 73 NONAME ; int CRadioEngine::PresetUrlL(int, class TDes16 &) + ?DeletePresetL@CRadioEngine@@QAEXH@Z @ 74 NONAME ; void CRadioEngine::DeletePresetL(int) + ?SaveUrlToPresetL@CRadioEngine@@QAEXHABVTDesC16@@@Z @ 75 NONAME ; void CRadioEngine::SaveUrlToPresetL(int, class TDesC16 const &) diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradioengine/eabi/fmradioengineacu.def --- a/fmradio/fmradioengine/eabi/fmradioengineacu.def Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradioengine/eabi/fmradioengineacu.def Mon Mar 15 12:40:34 2010 +0200 @@ -87,4 +87,7 @@ _ZTV25CCentralRepositoryHandler @ 86 NONAME _ZTV25CFMRadioAccessoryObserver @ 87 NONAME _ZTV27CFMRadioSystemEventDetector @ 88 NONAME + _ZN12CRadioEngine10PresetUrlLEiR6TDes16 @ 89 NONAME + _ZN12CRadioEngine13DeletePresetLEi @ 90 NONAME + _ZN12CRadioEngine16SaveUrlToPresetLEiRK7TDesC16 @ 91 NONAME diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradioengine/group/fmradioengine.mmp --- a/fmradio/fmradioengine/group/fmradioengine.mmp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradioengine/group/fmradioengine.mmp Mon Mar 15 12:40:34 2010 +0200 @@ -68,7 +68,6 @@ SYSTEMINCLUDE /epoc32/include/internal #endif // __FMRADIO_ADVANCED_AUTO_RESUME -LIBRARY accmonitor.lib LIBRARY radio_utility.lib LIBRARY fmpresetutility.lib LIBRARY cenrepnotifhandler.lib diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradioengine/inc/fmradioengine.h --- a/fmradio/fmradioengine/inc/fmradioengine.h Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradioengine/inc/fmradioengine.h Mon Mar 15 12:40:34 2010 +0200 @@ -21,7 +21,6 @@ #define FMRADIOENGINE_H #include -#include #include #include #include @@ -724,6 +723,27 @@ */ IMPORT_C void SetCurrentPresetIndex( const TInt aIndex ); + /* Gets saved preset url. + * @param aIndex channel index + * @param aUrl string to be modified with saved url + * @return error code. KErrNotFound if no url is saved or KErrOverflow + * if the aUrl is not big enough. See TFmPresetName + */ + IMPORT_C TInt PresetUrlL( TInt aIndex, TDes& aUrl ); + + /* + * Delete preset. With index -1 all preset are reseted + * @param aIndex index to delete + */ + IMPORT_C void DeletePresetL( TInt aIndex ); + + /* + * Saves given url to preset + * @param aIndex channel index + * @param aUrl url to save + */ + IMPORT_C void SaveUrlToPresetL( TInt aIndex, const TDesC& aUrl ); + private: /** @@ -748,17 +768,6 @@ */ void StoreAndPublishFrequency( TInt aFrequency ); - /** - * Scans all current presets and sets stored frequencies to KErrNotFound - * if the preset name is empty. - */ - void ResetPresetsL(); - - /** - * Resolves if BT audio accessory is connected - * @return ETrue if BT Audio connected - */ - TBool IsBTAccessoryConnectedL(); private: //the internal radio engine states diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradioengine/src/fmradioaccessoryobserver.cpp --- a/fmradio/fmradioengine/src/fmradioaccessoryobserver.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradioengine/src/fmradioaccessoryobserver.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -101,6 +101,7 @@ case EAccModeWiredHeadset: // Falls through. case EAccModeLoopset: // Falls through. case EAccModeHeadphones: + case EAccModeMusicStand: { accessoryConnected = ETrue; break; diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradioengine/src/fmradioengine.cpp --- a/fmradio/fmradioengine/src/fmradioengine.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradioengine/src/fmradioengine.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -169,12 +169,7 @@ iPubSub->PublishFrequencyDecimalCountL( TFMRadioPSFrequencyDecimalCount( iRadioSettings->DecimalCount() ) ); - - if ( iRadioSettings->StartupCount() == 0 ) - { - ResetPresetsL(); - } - + FTRACE(FPrint(_L("CRadioEngine::ConstructL() End "))); } @@ -809,13 +804,6 @@ // use mute here to avoid any audio peaks during output change SetMuteOn( ETrue ); - TBool btAudioConnected = EFalse; - TRAPD( err, btAudioConnected = IsBTAccessoryConnectedL(); ) - if ( err != KErrNone ) - { - btAudioConnected = ETrue; - } - #ifndef __ACCESSORY_FW tempError = iDosServerObserver->SetAudioRouting(aAudioOutput); @@ -825,12 +813,7 @@ CAudioOutput::TAudioOutputPreference outputPreference = CAudioOutput::EPrivate; - if( btAudioConnected && !iHeadsetObserver->IsHeadsetAccessoryConnected() ) - { - FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() EPublic don't route to BT"))); - outputPreference = CAudioOutput::EPublic; - } - else if ( EFMRadioOutputHeadset == aAudioOutput ) + if ( EFMRadioOutputHeadset == aAudioOutput ) { FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() Headset is set to Output"))); outputPreference = CAudioOutput::EPrivate; @@ -839,10 +822,6 @@ { FTRACE(FPrint(_L("CRadioEngine::SetAudioOutput() IHF is set to Output"))); - if ( iHeadsetObserver->IsHeadsetAccessoryConnected() ) - { //user has chosen 'Activate IHF' in options menu - iHFOptionActivated = ETrue; - } outputPreference = CAudioOutput::EPublic; } @@ -1025,14 +1004,7 @@ { FTRACE(FPrint(_L("CRadioEngine::HeadsetAccessoryConnectedCallbackL"))); // forward volume changes to headset - if ( iHFOptionActivated ) - { - iHFOptionActivated = EFalse; - } - else - { - SetAudioOutput( EFMRadioOutputHeadset ); - } + SetAudioOutput( EFMRadioOutputHeadset ); } // ---------------------------------------------------- @@ -2011,66 +1983,55 @@ } // --------------------------------------------------------------------------- -// CRadioEngine::ResetPresetsL -// initialize channel frequencies +// CRadioEngine::PresetUrlL // --------------------------------------------------------------------------- // -void CRadioEngine::ResetPresetsL() +EXPORT_C TInt CRadioEngine::PresetUrlL( TInt aIndex, TDes& aUrl ) { - FTRACE( FPrint( _L("CRadioEngine::ResetPresetsL()" ) ) ); - TInt maxNumberOfPresets; - TStationName channelName; - TInt channelFrequency; + FTRACE( FPrint( _L("CRadioEngine::PresetUrlL( Index %d, url: %S)"), aIndex, &aUrl ) ); + TInt err = KErrNone; + TFmPresetUrl presetUrl; - iPresetUtility->GetMaxNumberOfPresets( maxNumberOfPresets ); - - for ( TInt i = 0; i < maxNumberOfPresets; i++ ) + if ( presetUrl.MaxLength() <= aUrl.MaxLength() ) { - iPresetUtility->GetPresetL( i, channelName, channelFrequency ); - - if ( channelName.Length() == 0 && channelFrequency != KErrNotFound ) + iPresetUtility->GetPresetUrlL( aIndex, presetUrl ); + aUrl.Copy( presetUrl ); + if ( !aUrl.Length() ) { - // set empty name and frequency to KErrNotFound - iPresetUtility->SetPresetL( i, channelName, KErrNotFound ); - } + err = KErrNotFound; + } } + else + { + err = KErrOverflow; + } + return err; } // --------------------------------------------------------------------------- -// CRadioEngine::IsBTAccessoryConnectedL -// Returns ETrue if queried accessory is connected +// CRadioEngine::DeletePresetL +// Delete preset. With index -1 all preset are reseted // --------------------------------------------------------------------------- // -TBool CRadioEngine::IsBTAccessoryConnectedL ( ) +EXPORT_C void CRadioEngine::DeletePresetL( TInt aIndex ) { - FTRACE(FPrint(_L("CRadioEngine::IsBTAccessoryConnectedL ()" ) ) ); - TBool result = EFalse; - CAccMonitor* accMonitor = CAccMonitor::NewLC(); + FTRACE( FPrint( _L("CRadioEngine::DeletePresetL( i: %d )"), aIndex ) ); + iPresetUtility->DeletePresetL( aIndex ); + } - RConnectedAccessories connectedAccessories; - CleanupClosePushL( connectedAccessories ); - - accMonitor->GetConnectedAccessoriesL( connectedAccessories ); - CAccMonitorInfo* accInfo = CAccMonitorInfo::NewLC(); - TInt countOfArray = connectedAccessories.Count(); - - for( TInt i = 0; i != countOfArray; i++ ) +// --------------------------------------------------------------------------- +// CRadioEngine::SaveUrlToCurrentPresetL +// --------------------------------------------------------------------------- +// +EXPORT_C void CRadioEngine::SaveUrlToPresetL( TInt aIndex, const TDesC& aUrl ) + { + FTRACE( FPrint( _L("CRadioEngine::SaveUrlToCurrentPresetL( i: %d Url: %S)"), aIndex, &aUrl ) ); + TFmPresetUrl presetUrl; + if ( aUrl.Length() <= presetUrl.MaxLength() ) { - TAccMonCapability connectionType = connectedAccessories[ i ]->AccPhysicalConnection(); - if( connectionType == KAccMonBluetooth ) - { - accInfo->CopyL( connectedAccessories[ i ] ); - if ( accInfo->Exists(KAccMonStereoAudio) || - accInfo->Exists(KAccMonMonoAudio) ) - { - result = ETrue; - } - } + presetUrl.Copy( aUrl ); + iPresetUtility->SetPresetUrlL( aIndex, presetUrl ); } - // Destroy the pointers from the array, because those are owned by the client - CleanupStack::PopAndDestroy( accInfo ); - CleanupStack::PopAndDestroy( &connectedAccessories ); - CleanupStack::PopAndDestroy( accMonitor ); - return result; } + // End of file diff -r 108d9820af01 -r 3cb097cb90f8 fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp --- a/fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp Fri Mar 12 15:42:47 2010 +0200 +++ b/fmradio/fmradiomcpplugin/src/fmradiomcpplugin.cpp Mon Mar 15 12:40:34 2010 +0200 @@ -227,10 +227,10 @@ EMbmFmradioQgn_indi_radio_default_mask); iObserver->PublishImageL( this, EMusicWidgetImage1, - KAknsIIDQgnIndiRadioDefault, - iMifFileName, - EMbmFmradioQgn_indi_radio_default, - EMbmFmradioQgn_indi_radio_default_mask); + KAknsIIDNone, + iMifFileName, + EMbmFmradioQgn_menu_radio, + EMbmFmradioQgn_menu_radio_mask ); InstallFMRadioCommandActionL( KFMRadioCommandValueStartNowPlaying, EMusicWidgetTrigger1 ); InstallFMRadioCommandActionL( KFMRadioCommandValueStartNowPlaying, EMusicMenuMusicInfoTrigger );