mpxmusicplayer/app/src/mpxappui.cpp
branchRCL_3
changeset 14 943ff5625028
parent 11 13afc0e517bd
child 18 c54d95799c80
equal deleted inserted replaced
11:13afc0e517bd 14:943ff5625028
   209 // Cover UI start
   209 // Cover UI start
   210 //#ifdef __COVER_DISPLAY
   210 //#ifdef __COVER_DISPLAY
   211 // initialize FeatureManager
   211 // initialize FeatureManager
   212     FeatureManager::InitializeLibL();
   212     FeatureManager::InitializeLibL();
   213 
   213 
       
   214     // Check updates from IAD, continue UI launching even if something fails there
       
   215 	// Uncomment when to add IAD update checking functionality to music player
       
   216     // TRAP_IGNORE( CheckUpdatesL() );
       
   217 
   214     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
   218     if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
   215         {
   219         {
   216         iCoverDisplay = ETrue;
   220         iCoverDisplay = ETrue;
   217         iCommandInitiator = CMediatorCommandInitiator::NewL( NULL );
   221         iCommandInitiator = CMediatorCommandInitiator::NewL( NULL );
   218         }
   222         }
   778             TMPXPlaybackState playerState( EPbStateNotInitialised );
   782             TMPXPlaybackState playerState( EPbStateNotInitialised );
   779             playerState = iPlaybackUtility->StateL();
   783             playerState = iPlaybackUtility->StateL();
   780             if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) ||
   784             if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) ||
   781                 ( playerState == EPbStatePlaying ) ||
   785                 ( playerState == EPbStatePlaying ) ||
   782                 ( playerState == EPbStateSeekingForward ) ||
   786                 ( playerState == EPbStateSeekingForward ) ||
   783                 ( playerState == EPbStateSeekingBackward ) )
   787                 ( playerState == EPbStateSeekingBackward ) ||
   784                 {
   788                 iPdParameterHandler )
       
   789                 {
       
   790                 TMPXPlaybackState pdPlayerState( EPbStateNotInitialised );
       
   791                 if ( iPdParameterHandler )
       
   792                     {
       
   793                     pdPlayerState = iPdParameterHandler->PdStateL();
       
   794                     }
   785                 // only process command if there no call ongoing
   795                 // only process command if there no call ongoing
   786                 // or if we're actively playing during call
   796                 // or if we're actively playing during call
   787                 if ( IsForeground() || EPbStatePlaying == playerState )
   797                 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState )
   788                     {
   798                     {
   789                     MuteVolume();
   799                     MuteVolume();
   790                     HandlePopupL( EPbCmdMuteVolume );
   800                     HandlePopupL( EPbCmdMuteVolume );
   791                     }
   801                     }
   792                 }
   802                 }
   797             TMPXPlaybackState playerState( EPbStateNotInitialised );
   807             TMPXPlaybackState playerState( EPbStateNotInitialised );
   798             playerState = iPlaybackUtility->StateL();
   808             playerState = iPlaybackUtility->StateL();
   799             if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) ||
   809             if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) ||
   800                 ( playerState == EPbStatePlaying ) ||
   810                 ( playerState == EPbStatePlaying ) ||
   801                 ( playerState == EPbStateSeekingForward ) ||
   811                 ( playerState == EPbStateSeekingForward ) ||
   802                 ( playerState == EPbStateSeekingBackward ) )
   812                 ( playerState == EPbStateSeekingBackward ) ||
       
   813                 iPdParameterHandler )
   803                 {
   814                 {
   804                 // only process command if there no call ongoing
   815                 // only process command if there no call ongoing
   805                 // or if we're actively playing during call
   816                 // or if we're actively playing during call
   806                 if ( IsForeground() || EPbStatePlaying == playerState )
   817                 TMPXPlaybackState pdPlayerState( EPbStateNotInitialised );
       
   818                 if ( iPdParameterHandler )
       
   819                     {
       
   820                     pdPlayerState = iPdParameterHandler->PdStateL();
       
   821                     }
       
   822                 if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState )
   807                     {
   823                     {
   808                     UnMuteVolume();
   824                     UnMuteVolume();
   809                     HandlePopupL( EPbCmdUnMuteVolume );
   825                     HandlePopupL( EPbCmdUnMuteVolume );
   810                     }
   826                     }
   811                 }
   827                 }
  2094 
  2110 
  2095         RArray<TProcessId> procArray;
  2111         RArray<TProcessId> procArray;
  2096         CleanupClosePushL( procArray );
  2112         CleanupClosePushL( procArray );
  2097         TProcessId npProcId( 0 );
  2113         TProcessId npProcId( 0 );
  2098         MMPXPlaybackUtility* activePbU = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
  2114         MMPXPlaybackUtility* activePbU = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
       
  2115         CleanupClosePushL( *activePbU );
  2099         activePbU->GetClientsL( procArray );
  2116         activePbU->GetClientsL( procArray );
  2100         activePbU->Close();
  2117         CleanupStack::PopAndDestroy( activePbU );
  2101         npProcId = procArray[ 0 ];
  2118         npProcId = procArray[ 0 ];
  2102         CleanupStack::PopAndDestroy( &procArray );
  2119         CleanupStack::PopAndDestroy( &procArray );
  2103 
  2120 
  2104         TInt64 standAlonePId( CMPXCommonUiHelper::StandAloneModePId() );
  2121         TInt64 standAlonePId( CMPXCommonUiHelper::StandAloneModePId() );
  2105 
  2122 
  3331     {
  3348     {
  3332     MPX_FUNC( "CMPXAppUi::HandleCommandL" );
  3349     MPX_FUNC( "CMPXAppUi::HandleCommandL" );
  3333     TMPXPlaybackCommand cmd = EPbCmdEnd;
  3350     TMPXPlaybackCommand cmd = EPbCmdEnd;
  3334     switch ( aCommand )
  3351     switch ( aCommand )
  3335         {
  3352         {
  3336 	    case EMPXCmdCheckIADUpdates:
       
  3337 	        {
       
  3338 	        TRAP_IGNORE( CheckUpdatesL() );
       
  3339 	        break;
       
  3340 	        }
       
  3341         case EMPXCmdPlay:
  3353         case EMPXCmdPlay:
  3342         case EMPXCmdPause:
  3354         case EMPXCmdPause:
  3343         case EMPXCmdPlayPause:
  3355         case EMPXCmdPlayPause:
  3344         case EMPXCmdStop:
  3356         case EMPXCmdStop:
  3345         case EMPXCmdNext:
  3357         case EMPXCmdNext:
  4350     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
  4362     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
  4351     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  4363     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  4352     cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
  4364     cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
  4353     cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdSetVolume );
  4365     cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdSetVolume );
  4354     cmd->SetTObjectValueL<TUint>( KMPXCommandPlaybackGeneralData, aVolume );
  4366     cmd->SetTObjectValueL<TUint>( KMPXCommandPlaybackGeneralData, aVolume );
  4355     iPlaybackUtility->CommandL( *cmd );
  4367     
       
  4368     MMPXPlaybackUtility* activePbu = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
       
  4369     CleanupClosePushL( *activePbu );
       
  4370     activePbu->CommandL( *cmd );
       
  4371     CleanupStack::PopAndDestroy( activePbu );
       
  4372     
  4356     CleanupStack::PopAndDestroy( cmd );
  4373     CleanupStack::PopAndDestroy( cmd );
  4357     }
  4374     }
  4358 
  4375 
  4359 // -----------------------------------------------------------------------------
  4376 // -----------------------------------------------------------------------------
  4360 // CMPXAppUi::MuteVolume
  4377 // CMPXAppUi::MuteVolume
  4366     CleanupStack::PushL( cmd );
  4383     CleanupStack::PushL( cmd );
  4367     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
  4384     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
  4368     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  4385     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  4369     cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
  4386     cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
  4370     cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdMuteVolume );
  4387     cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdMuteVolume );
  4371     iPlaybackUtility->CommandL( *cmd );
  4388     
       
  4389     MMPXPlaybackUtility* activePbu = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
       
  4390     CleanupClosePushL( *activePbu );
       
  4391     activePbu->CommandL( *cmd );
       
  4392     CleanupStack::PopAndDestroy( activePbu );
       
  4393     
  4372     CleanupStack::PopAndDestroy( cmd );
  4394     CleanupStack::PopAndDestroy( cmd );
  4373     }
  4395     }
  4374 
  4396 
  4375 // -----------------------------------------------------------------------------
  4397 // -----------------------------------------------------------------------------
  4376 // CMPXAppUi::UnMuteVolume
  4398 // CMPXAppUi::UnMuteVolume
  4382     CleanupStack::PushL( cmd );
  4404     CleanupStack::PushL( cmd );
  4383     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
  4405     cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
  4384     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  4406     cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
  4385     cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
  4407     cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
  4386     cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdUnMuteVolume );
  4408     cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdUnMuteVolume );
  4387     iPlaybackUtility->CommandL( *cmd );
  4409     
       
  4410     MMPXPlaybackUtility* activePbu = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
       
  4411     CleanupClosePushL( *activePbu );
       
  4412     activePbu->CommandL( *cmd );
       
  4413     CleanupStack::PopAndDestroy( activePbu );
       
  4414     
  4388     CleanupStack::PopAndDestroy( cmd );
  4415     CleanupStack::PopAndDestroy( cmd );
  4389     }
  4416     }
  4390 
  4417 
  4391 // -----------------------------------------------------------------------------
  4418 // -----------------------------------------------------------------------------
  4392 // CMPXAppUi::UnMuteVolume
  4419 // CMPXAppUi::UnMuteVolume