musichomescreen_multiview/musiccontentpublisher/inc/musiccontentpublisher.h
branchRCL_3
changeset 13 c8156a91d13c
parent 2 b70d77332e66
child 24 26a1709b9fec
equal deleted inserted replaced
12:171e07ac910f 13:c8156a91d13c
    23 #include <mcppluginobserver.h>
    23 #include <mcppluginobserver.h>
    24 #include <libc/stddef.h>  // For wchar_t
    24 #include <libc/stddef.h>  // For wchar_t
    25 #include <e32hashtab.h>
    25 #include <e32hashtab.h>
    26 #include <AknsSrvClient.h>
    26 #include <AknsSrvClient.h>
    27 
    27 
       
    28 #include "musiccontentmap.h"
       
    29 
    28 class MLiwInterface;
    30 class MLiwInterface;
    29 class CLiwGenericParamList;
       
    30 class CPluginManager;
    31 class CPluginManager;
    31 class CFbsBitmap;
    32 class CFbsBitmap;
    32 class CCoeEnv;
    33 class CCoeEnv;
    33 class TAknsItemID;
    34 class TAknsItemID;
    34 class CMCPHarvesterPublisherObserver;
    35 class CMCPHarvesterPublisherObserver;
    37 struct TMCPDestinationItem
    38 struct TMCPDestinationItem
    38     {
    39     {
    39     const TInt id;
    40     const TInt id;
    40     const wchar_t* type;
    41     const wchar_t* type;
    41     const char* dataKey;
    42     const char* dataKey;
    42     const wchar_t* content;
    43     const char* maskKey;
    43     };
    44     };
    44 
    45 
    45 struct TMCPImageDestinationInfoItem
    46 struct TMCPImageDestinationInfoItem
    46     {
    47     {
    47     const TMCPImageDestination id;
    48     const TMCPImageDestination id;
    54     {
    55     {
    55     CFbsBitmap *bitmap;
    56     CFbsBitmap *bitmap;
    56     CFbsBitmap *mask;
    57     CFbsBitmap *mask;
    57     };
    58     };
    58 
    59 
    59 struct TMyBufferItem
       
    60     {
       
    61     TAny* buf;
       
    62     TInt size;
       
    63     };
       
    64 
       
    65 
    60 
    66 const TMCPDestinationItem KMCPDestinationInfo[] =
    61 const TMCPDestinationItem KMCPDestinationInfo[] =
    67     {
    62     {
    68      { EMusicWidgetImage1,      L"area1_image1", "area1_image1_data",       L"*" }
    63      { EMusicWidgetImage1,      L"area1_image1", "area1_image1_data", "area1_image1_data_mask" }
    69     ,{ EMusicWidgetText1,       L"area2_text1",  "area2_text1_data",        L"*" }
    64     ,{ EMusicWidgetText1,       L"area2_text1",  "area2_text1_data", ""}
    70     ,{ EMusicWidgetToolbarB1,   L"toolbar_b1", "toolbar_b1_data",         L"*" }
    65     ,{ EMusicWidgetToolbarB1,   L"toolbar_b1", "toolbar_b1_data", "toolbar_b1_data_mask" }
    71     ,{ EMusicWidgetToolbarB2,   L"toolbar_b2", "toolbar_b2_data",         L"*" }
    66     ,{ EMusicWidgetToolbarB2,   L"toolbar_b2", "toolbar_b2_data", "toolbar_b2_data_mask" }
    72     ,{ EMusicWidgetToolbarB3,   L"toolbar_b3", "toolbar_b3_data",         L"*" }
    67     ,{ EMusicWidgetToolbarB3,   L"toolbar_b3", "toolbar_b3_data", "toolbar_b3_data_mask" }
    73     ,{ EMusicWidgetDefaultText, L"default_text",  "default_text_data",       L"*" }
    68     ,{ EMusicWidgetDefaultText, L"default_text",  "default_text_data", "" }
    74     
    69     
    75     ,{ EMusicWidgetTrigger1,    L"area1_image1", "MWTrigger1",  L"*" }
    70     ,{ EMusicWidgetTrigger1,    L"area1_image1", "MWTrigger1", "" }
    76     ,{ EMusicWidgetTrigger2,    L"default_text",  "MWTrigger2", L"*" }
    71     ,{ EMusicWidgetTrigger2,    L"default_text",  "MWTrigger2", "" }
    77     ,{ EMusicWidgetTB1Trigger,  L"toolbar_b1", "TB1Trigger",    L"*" }
    72     ,{ EMusicWidgetTB1Trigger,  L"toolbar_b1", "TB1Trigger", "" }
    78     ,{ EMusicWidgetTB2Trigger,  L"toolbar_b2", "TB2Trigger",    L"*" }
    73     ,{ EMusicWidgetTB2Trigger,  L"toolbar_b2", "TB2Trigger", "" }
    79     ,{ EMusicWidgetTB3Trigger,  L"toolbar_b3", "TB3Trigger",    L"*" }
    74     ,{ EMusicWidgetTB3Trigger,  L"toolbar_b3", "TB3Trigger", "" }
    80             
       
    81     ,{ EMusicMenuMusicInfoImage1,   L"image",  "musicmenu_musicinfo_imagedata", L"musicmenu_musicinfo_image" }
       
    82     ,{ EMusicMenuMusicInfoLine1,        L"text",   "musicmenu_musicinfo_text1data",  L"musicmenu_musicinfo_text1" }
       
    83     ,{ EMusicMenuMusicInfoLine2,        L"text",   "musicmenu_musicinfo_text2data",  L"musicmenu_musicinfo_text2" }
       
    84     ,{ EMusicMenuMusicInfoTrigger, L"text",   "MMInfoTrigger",  L"musicmenu_musicinfo_text1" }
       
    85     };
    75     };
    86 
    76 
    87 
    77 
    88 const TMCPImageDestinationInfoItem KMCPImageDestinationInfo[] =
    78 const TMCPImageDestinationInfoItem KMCPImageDestinationInfo[] =
    89 
    79 
    90     {
    80     {
    91         {EMusicWidgetImage1, 70,70}
    81         {EMusicWidgetImage1, 70, 70}
    92     ,
    82     ,
    93         {EMusicWidgetToolbarB1, 41,41}
    83         {EMusicWidgetToolbarB1, 41,41}
    94     ,
    84     ,
    95         {EMusicWidgetToolbarB2, 41,41}
    85         {EMusicWidgetToolbarB2, 41,41}
    96     ,
    86     ,
    97         {EMusicWidgetToolbarB3, 41,41}
    87         {EMusicWidgetToolbarB3, 41,41}
    98     ,
    88 
    99         {EMusicMenuMusicInfoImage1, 70,70} 
       
   100     };
    89     };
   101 
    90 
   102 /**
    91 /**
   103  *  Music Content Publisher (a Content Harvester plugin)
    92  *  Music Content Publisher (a Content Harvester plugin)
   104  *
    93  *
   272      * Perform the second phase construction 
   261      * Perform the second phase construction 
   273      */
   262      */
   274     void ConstructL();
   263     void ConstructL();
   275     
   264     
   276     /**
   265     /**
       
   266      * Publish default content
       
   267      */
       
   268     void PublishDefaultL();
       
   269 
       
   270     /**
   277      * Installs an action, mainly for readability purposes.
   271      * Installs an action, mainly for readability purposes.
   278      *
   272      *
   279      * @since S60 5.0
   273      * @since S60 5.0
   280      * @param aDestination Destination trigger that should launch the action.
   274      * @param aDestination Destination trigger that should launch the action.
   281      */
   275      */
   294      *
   288      *
   295      * @since S60 5.0
   289      * @since S60 5.0
   296      * @param aDestination Destination trigger that should launch the action.
   290      * @param aDestination Destination trigger that should launch the action.
   297      */
   291      */
   298     void InstallEmptyActionL(TMCPTriggerDestination aDestination);
   292     void InstallEmptyActionL(TMCPTriggerDestination aDestination);
   299     
   293    
   300     
       
   301     /**
       
   302      * Maps an enum from TMCPImageDestination, TMCPTextDestination and 
       
   303      * TMCPTriggerDestination to it's keys on CPS.
       
   304      * @param aEnum the enum/destination
       
   305      * @param aType the type key is loaded here
       
   306      * @param aDataKey the data key is loaded here
       
   307      * @param aContent the content key is loaded here
       
   308      *
       
   309      * @since S60 5.0
       
   310      */
       
   311     void MapEnumToDestinationInfoL(TInt aEnum,TPtrC& aType, TPtrC8& aDataKey, 
       
   312             TPtrC& aContent);
       
   313     
       
   314     /**
   294     /**
   315      * Resets the Bitmap cache.
   295      * Resets the Bitmap cache.
   316      *
   296      *
   317      * @since S60 5.0
   297      * @since S60 5.0
   318      */
   298      */
   319     void ResetBitmapCache();
   299     void ResetBitmapCache();
   320     
       
   321     /**
       
   322      * Resets the publishing buffers.
       
   323      *
       
   324      * @since S60 5.0
       
   325      */
       
   326     void ResetPublishingBuffers();
       
   327     
   300     
   328     TUint RegisterPublisherL( 
   301     TUint RegisterPublisherL( 
   329         const TDesC& aPublisherId, 
   302         const TDesC& aPublisherId, 
   330         const TDesC& aContentId,
   303         const TDesC& aContentId,
   331         const TDesC& aContentType );
   304         const TDesC& aContentType );
   332     
   305     
   333     TUint CMusicContentPublisher::ExtractItemId( const CLiwGenericParamList& aInParamList );
   306     TUint ExtractItemId( const CLiwGenericParamList& aInParamList );
   334     
   307    
   335     void RemoveL( TInt aDestination );
       
   336     
       
   337     /**
   308     /**
   338      * Get a heap descriptor from the resource file
   309      * Get a heap descriptor from the resource file
   339      *
   310      *
   340      * @since S60 5.0
   311      * @since S60 5.0
   341      */
   312      */
   342     void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf,
   313     void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf,
   343             TInt aResourceId);
   314             TInt aResourceId);
   344     
   315 
   345     void DoPublishL();
   316     void PublishDeferred();
       
   317     static TInt DoPublish(TAny * aMusicContentPublisher);
       
   318     void DoPublishAllL();
       
   319     void DoPublishModifiedL();
       
   320     void DoPublishDeleteAllL();
       
   321     void DoPublishCmdL(const TDesC8& aCmd, const TDesC8& aKey, const CLiwMap * aValue);
       
   322 
   346     
   323     
   347 
   324 
   348 private: // data
   325 private: // data
   349 
   326 
   350     /**
   327     /**
   366     CMCPPlugin* iActivePlugin;
   343     CMCPPlugin* iActivePlugin;
   367     
   344     
   368     /**
   345     /**
   369      * mapping for the destination translation.
   346      * mapping for the destination translation.
   370      */    
   347      */    
   371     RHashMap<TInt, TMCPDestinationItem> iDestinationMap;
   348     struct TDestinationItem {
       
   349     	  explicit TDestinationItem(const TMCPDestinationItem& aItem);
       
   350         TPtrC  iType;
       
   351         TPtrC8 iDataKey;
       
   352         TPtrC8 iMaskKey;
       
   353     };
       
   354     RHashMap<TInt, TDestinationItem>    iDestinationMap;
   372     
   355     
   373     /**
   356     /**
   374      * mapping for the destination  image info translation.
   357      * mapping for the destination  image info translation.
   375      */    
   358      */    
   376     RHashMap<TInt, TSize> iImageDestinationSizeMap;
   359     RHashMap<TInt, TSize> iImageDestinationSizeMap;
   379      * bitmap cache map.
   362      * bitmap cache map.
   380      */    
   363      */    
   381     RHashMap<TInt, TBmpMsk> iBitmapCache;
   364     RHashMap<TInt, TBmpMsk> iBitmapCache;
   382     
   365     
   383     /**
   366     /**
   384      * To keep the unpublished data.
   367      * The published data
   385      */
   368      */
   386     RHashMap<TInt, TMyBufferItem> iPublishingDataBuffers;
   369     RMusicContentMap iPublishingDataMap;
   387     
   370     RMusicContentMap iPublishingActionMap;
   388     /**
   371     
   389      * To keep the unpublished actions.
   372     /**
   390      */
   373     * Deferred callback to DoPublishL
   391     RHashMap<TInt, TMyBufferItem> iPublishingActionBuffers;
   374     */
       
   375     CAsyncCallBack * iDeferredPublish;
   392     
   376     
   393     /**
   377     /**
   394     * Skin server session.
   378     * Skin server session.
   395     */
   379     */
   396     RAknsSrvSession iAknsSrvSession;
   380     RAknsSrvSession iAknsSrvSession;
   402     HBufC* iLastPlayedBuffer;
   386     HBufC* iLastPlayedBuffer;
   403     HBufC* iGoToMusicBuffer;
   387     HBufC* iGoToMusicBuffer;
   404 
   388 
   405     CMCPHarvesterPublisherObserver* iHPObserver;
   389     CMCPHarvesterPublisherObserver* iHPObserver;
   406     TBool iWidgetForeground;
   390     TBool iWidgetForeground;
   407     TBool iWidgetActivated;
       
   408 
   391 
   409     HBufC* iInstanceId;
   392     HBufC* iInstanceId;
   410    
   393    
   411     };
   394     };
   412 
   395