Revision: 201025 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 18:35:42 +0300
branchRCL_3
changeset 23 455f89b7fcc5
parent 21 cb96c29156b2
child 24 26a1709b9fec
Revision: 201025 Kit: 2010127
mpxmusicplayer/app/src/mpxappui.cpp
mpxmusicplayer/metadatahandler/inc/mpxmetadatahandlerimp.h
mpxmusicplayer/metadatahandler/src/mpxmetadatahandlerimp.cpp
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhg.hrh
mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp
--- a/mpxmusicplayer/app/src/mpxappui.cpp	Mon Jun 21 15:37:19 2010 +0300
+++ b/mpxmusicplayer/app/src/mpxappui.cpp	Thu Jul 15 18:35:42 2010 +0300
@@ -120,13 +120,18 @@
 #include <iaupdateparameters.h>
 #include <iaupdateresult.h>
 
+#include <mpxparameter.h>               // CMPXParameter
+
 // CONSTANTS
 _LIT( KMPXLineChange, "\n" );
 _LIT(KMPXMusicplayerPrivateFolder, "\\private\\");
 _LIT(KMPXMusicPlayerExec, "mpx.exe" );
+_LIT8(KRemConTspControllerPlayParam, "play");
 
 const TInt KMPXMusicPlayerAlreadySaved( -5000 );
 
+const TInt KPlayerMusicPlayerParameterGranularity = 50;
+
 // Application Uid for Active Idle app
 #ifdef __ACTIVE_IDLE
 const TUid KMPXUidIdleApp = { 0x101FD64C };
@@ -4099,7 +4104,35 @@
     const TPtrC8 command = aCommandLine.TailEnd();
         if ( command.Size() > 0 )
         {
-        HandleCommandParametersL( command );
+        // Play command from RemConTspController
+        if (command.Compare(KRemConTspControllerPlayParam) == 0) 
+            {
+            RWsSession wsSession = iEikonEnv->WsSession();
+            CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+            CleanupStack::PushL( taskList );
+            TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+            CMPXParameter* param = new ( ELeave ) CMPXParameter();
+            CleanupStack::PushL( param );
+            param->iType.iUid = KMPXPluginTypeLastPlayedUid; 
+            param->iCmdForward = EMPXCmdFwdNone;
+            CBufBase* buffer = CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+            CleanupStack::PushL( buffer );
+            RBufWriteStream writeStream( *buffer );
+            CleanupClosePushL( writeStream );
+            param->ExternalizeL( writeStream );
+            writeStream.CommitL();
+            buffer->Compress();
+            CleanupStack::PopAndDestroy( &writeStream );
+            wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                             buffer->Ptr( 0 ) );
+            CleanupStack::PopAndDestroy( buffer);
+            CleanupStack::PopAndDestroy( param );
+            CleanupStack::PopAndDestroy( taskList );
+            } 
+        else 
+            {
+            HandleCommandParametersL( command );
+            }
         }
     return ETrue;
     }
--- a/mpxmusicplayer/metadatahandler/inc/mpxmetadatahandlerimp.h	Mon Jun 21 15:37:19 2010 +0300
+++ b/mpxmusicplayer/metadatahandler/inc/mpxmetadatahandlerimp.h	Thu Jul 15 18:35:42 2010 +0300
@@ -112,6 +112,15 @@
 	void ConstructL(CRemConInterfaceSelector &aInterfaceSelector);
 
 	/**
+	 * Sends currently playing metadata
+	 * see MrcmitoGetCurrentlyPlayingMetadata 
+	 *
+	 * @since Symbian^3
+	 * @param aAttributeIter Attribute iterator
+	 */
+	void SendCurrentlyPlayingMetadata(TMediaAttributeIter& aAttributeIter );
+	
+	/**
 	 * Handle playback message
 	 *
      * @since S60 v5.1
@@ -335,6 +344,12 @@
     CEqualizerPresetChangeListener* iEqPresetListener;
 
     /**
+     * Metadata iterator
+     * Own.
+     */
+    TMediaAttributeIter *iMetadataIter;
+    
+    /**
      * Main interface to the player.
      * Not own.
      */
--- a/mpxmusicplayer/metadatahandler/src/mpxmetadatahandlerimp.cpp	Mon Jun 21 15:37:19 2010 +0300
+++ b/mpxmusicplayer/metadatahandler/src/mpxmetadatahandlerimp.cpp	Thu Jul 15 18:35:42 2010 +0300
@@ -186,6 +186,7 @@
     delete iArtist;
     delete iAlbum;
     delete iGenre;
+    delete iMetadataIter;
     }
 
 // ---------------------------------------------------------------------------
@@ -368,6 +369,13 @@
             iColId = colId;
             iTrackNumber = lastTrackNumber;
             iPlayerEventsObserver->TrackChanged(iColId.iUid, iPlayingTime);
+            
+            if ( iMetadataIter )
+                {
+                SendCurrentlyPlayingMetadata( *iMetadataIter );
+                delete iMetadataIter;
+                iMetadataIter = NULL;
+                }
             }
         else
             {
@@ -569,17 +577,14 @@
     }
 
 // -----------------------------------------------------------------------------
-// From MRemConMediaInformationTargetObserver
-// For each element in aAttributeList the client should respond by calling 
-// CRemConMediaInformationTarget::AttributeValue(). After all attributes have 
-// been supplied the client should call CRemConMediaInformationTarget::Completed().
-// @param aAttributeList A list of TAttributeID requested by the controller
+// Sends currently playing metadata.
+// see MrcmitoGetCurrentlyPlayingMetadata
 // -----------------------------------------------------------------------------
 //
-void CMPXMetaDataHandlerImp::MrcmitoGetCurrentlyPlayingMetadata( 
+void CMPXMetaDataHandlerImp::SendCurrentlyPlayingMetadata( 
     TMediaAttributeIter& aAttributeIter )
     {
-    MPX_FUNC( "CMPXMetaDataHandlerImp::MrcmitoGetCurrentlyPlayingMetadata" );
+    MPX_FUNC( "CMPXMetaDataHandlerImp::SendCurrentlyPlayingMetadata" );
     const TInt KMaxMediaAttrLen = 300;  // >110 is required for AVRCP fragmentation
     TBuf8<KMaxMediaAttrLen> attrBuf;
     TMediaAttributeId attrId;
@@ -675,7 +680,31 @@
     iMediaInfoTarget->Completed();
     }
 
-
+// -----------------------------------------------------------------------------
+// From MRemConMediaInformationTargetObserver
+// For each element in aAttributeList the client should respond by calling 
+// CRemConMediaInformationTarget::AttributeValue(). After all attributes have 
+// been supplied the client should call CRemConMediaInformationTarget::Completed().
+// @param aAttributeList A list of TAttributeID requested by the controller
+// -----------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::MrcmitoGetCurrentlyPlayingMetadata( 
+    TMediaAttributeIter& aAttributeIter )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::MrcmitoGetCurrentlyPlayingMetadata" );
+    
+    if ( iTrackTitle ) 
+        {
+        SendCurrentlyPlayingMetadata( aAttributeIter );
+        delete iMetadataIter;
+        iMetadataIter = NULL;
+        }
+    else
+        {
+        delete iMetadataIter;
+        iMetadataIter = new TMediaAttributeIter( aAttributeIter );
+        }
+    }
 
 // ---------------------------------------------------------------------------
 // From class MRemConGroupNavigationTargetObserver.
--- a/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhg.hrh	Mon Jun 21 15:37:19 2010 +0300
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhg.hrh	Thu Jul 15 18:35:42 2010 +0300
@@ -147,7 +147,7 @@
 // Different state of educating User Popup
 enum TMPXEducatingPopup 
     {
-    EMPXInitialEducatingPopup,   // Initial state
+    // EMPXInitialEducatingPopup,   // Initial state
     EMPXShowEducatingPopup,      // Show popup at manual refresh, if any new songs added
     EMPXDonotShowEducatingPopup  // User doesn't want to see popup
     };
--- a/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp	Mon Jun 21 15:37:19 2010 +0300
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp	Thu Jul 15 18:35:42 2010 +0300
@@ -7295,6 +7295,7 @@
         case EMPXCmdReorderDone:
             {
             DeactivateReorderGrabbedModeL( ETrue );
+            iHandlingKeyEvent = EFalse;            
             break;
             }
         case EMPXCmdUpArrow:
@@ -8467,8 +8468,8 @@
 TBool CMPXCollectionViewHgImp::NeedToShowEducatingDialog()
     {
     if(iEducateUserURI->Length() > 0 && iCollectionReady && //If educating user URI is in cenrep and Collection is Ready
-      (iEducatingPopupState == EMPXInitialEducatingPopup || //If Music Player is launched first time after phone flash 
-      (iEducatingPopupState == EMPXShowEducatingPopup && iPopuponRefresh))) //If user pressed yes on "Remind me later" and its manual refresh with some song added
+      //(iEducatingPopupState == EMPXInitialEducatingPopup || //If Music Player is launched first time after phone flash 
+      (iEducatingPopupState == EMPXShowEducatingPopup && iPopuponRefresh)) //If user pressed yes on "Remind me later" and its manual refresh with some song added
         {
         return ETrue;
         }