ui/uiengine/medialistwrapper/src/glxmlwrapper_p.cpp
changeset 70 a91aa46552be
parent 67 199e6e1e0b54
equal deleted inserted replaced
67:199e6e1e0b54 70:a91aa46552be
    59 const TInt KGridTNPTHeight (103);
    59 const TInt KGridTNPTHeight (103);
    60 const TInt KFullScreenTNLSWidth (640);
    60 const TInt KFullScreenTNLSWidth (640);
    61 const TInt KFullScreenTNLSHeight (360);
    61 const TInt KFullScreenTNLSHeight (360);
    62 const TInt KFullScreenTNPTWidth (360);
    62 const TInt KFullScreenTNPTWidth (360);
    63 const TInt KFullScreenTNPTHeight (640);
    63 const TInt KFullScreenTNPTHeight (640);
       
    64 _LIT(KMymeTypeJpeg, "jpeg");
       
    65 _LIT(KMymeTypeJp2, "jp2");
    64 
    66 
    65 // ======== MEMBER FUNCTIONS ========
    67 // ======== MEMBER FUNCTIONS ========
    66 
    68 
    67 // ---------------------------------------------------------------------------
    69 // ---------------------------------------------------------------------------
    68 // Two-phased constructor.
    70 // Two-phased constructor.
    69 // ---------------------------------------------------------------------------
    71 // ---------------------------------------------------------------------------
    70 //
    72 //
    71 GlxMLWrapperPrivate* GlxMLWrapperPrivate::Instance(GlxMLWrapper* aMLWrapper,
    73 GlxMLWrapperPrivate* GlxMLWrapperPrivate::Instance(GlxMLWrapper* aMLWrapper,
    72     int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri)
    74     int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType)
    73     {
    75     {
    74     TRACER("GlxMLWrapperPrivate::NewLC()");
    76     TRACER("GlxMLWrapperPrivate::NewLC()");
    75 
    77 
    76     GlxMLWrapperPrivate* self = new GlxMLWrapperPrivate(aMLWrapper);
    78     GlxMLWrapperPrivate* self = new GlxMLWrapperPrivate(aMLWrapper);
    77    if(self){
    79    if(self){
    78 	   TRAPD(err,self->ConstructL(aCollectionId, aHierarchyId, aFilterType,uri));
    80 	   TRAPD(err,self->ConstructL(aCollectionId, aHierarchyId, aFilterType,uri,fetcherFilterType));
    79 	   if(err != KErrNone){
    81 	   if(err != KErrNone){
    80 		   delete self;
    82 		   delete self;
    81 		   self = NULL;
    83 		   self = NULL;
    82 		   }
    84 		   }
    83 	   }
    85 	   }
   114 
   116 
   115 // ---------------------------------------------------------------------------
   117 // ---------------------------------------------------------------------------
   116 // Symbian 2nd phase constructor can leave.
   118 // Symbian 2nd phase constructor can leave.
   117 // ---------------------------------------------------------------------------
   119 // ---------------------------------------------------------------------------
   118 //  
   120 //  
   119 void GlxMLWrapperPrivate::ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri)
   121 void GlxMLWrapperPrivate::ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType)
   120     {
   122     {
   121     TRACER("GlxMLWrapperPrivate::ConstructL");
   123     TRACER("GlxMLWrapperPrivate::ConstructL");
   122      if(aCollectionId == KGlxCollectionPluginFavoritesAlbumId)
   124      if(aCollectionId == KGlxCollectionPluginFavoritesAlbumId)
   123          {
   125          {
   124          CreateMediaListFavoritesItemL(aCollectionId, aHierarchyId,aFilterType,uri);
   126          CreateMediaListFavoritesItemL(aCollectionId, aHierarchyId,aFilterType,uri);
   125          }
   127          }
   126      else if(aCollectionId != KGlxAlbumsMediaId)
   128      else if(aCollectionId != KGlxAlbumsMediaId)
   127 		{
   129 		{
   128 		CreateMediaListL(aCollectionId, aHierarchyId,aFilterType);
   130 		CreateMediaListL(aCollectionId, aHierarchyId,aFilterType,fetcherFilterType);
   129 		}
   131 		}
   130 	else
   132 	else
   131 		{
   133 		{
   132 		//for creating Medial List for Albums Media path Items
   134 		//for creating Medial List for Albums Media path Items
   133 		CreateMediaListAlbumItemL(aCollectionId, aHierarchyId,aFilterType);
   135 		CreateMediaListAlbumItemL(aCollectionId, aHierarchyId,aFilterType,fetcherFilterType);
   134 		}
   136 		}
   135 	iMLGenericObserver = CGlxMLGenericObserver::NewL(*iMediaList,this);
   137 	iMLGenericObserver = CGlxMLGenericObserver::NewL(*iMediaList,this);
   136 	iBlockyIteratorForFilmStrip.SetRangeOffsets(0,0);
   138 	iBlockyIteratorForFilmStrip.SetRangeOffsets(0,0);
   137 	iDrmUtility = CGlxDRMUtility::InstanceL();
   139 	iDrmUtility = CGlxDRMUtility::InstanceL();
   138     }
   140     }
   550 
   552 
   551 // ---------------------------------------------------------------------------
   553 // ---------------------------------------------------------------------------
   552 // CreateMediaListAlbumItemL()
   554 // CreateMediaListAlbumItemL()
   553 // Creates the media list for the album Item 
   555 // Creates the media list for the album Item 
   554 // ---------------------------------------------------------------------------
   556 // ---------------------------------------------------------------------------
   555 void GlxMLWrapperPrivate::CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType)
   557 void GlxMLWrapperPrivate::CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType)
   556 	{
   558 	{
   557 	TRACER("GlxMLWrapperPrivate::CreateMediaListAlbumItemL");
   559 	TRACER("GlxMLWrapperPrivate::CreateMediaListAlbumItemL");
   558 	Q_UNUSED(aCollectionId);
   560 	Q_UNUSED(aCollectionId);
   559 	Q_UNUSED(aHierarchyId);
   561 	Q_UNUSED(aHierarchyId);
   560 	//retrieve the instance of Media list for ALBUMS LIST which will be saved in iMediaList
   562 	//retrieve the instance of Media list for ALBUMS LIST which will be saved in iMediaList
   563 	CMPXCollectionPath* path = iMediaList->PathLC(NGlxListDefs:: EPathFocusOrSelection);
   565 	CMPXCollectionPath* path = iMediaList->PathLC(NGlxListDefs:: EPathFocusOrSelection);
   564 	//close the existing instance of Media List
   566 	//close the existing instance of Media List
   565 	iMediaList->Close();
   567 	iMediaList->Close();
   566 	iMediaList = NULL;
   568 	iMediaList = NULL;
   567 	//create new media list with the derived path
   569 	//create new media list with the derived path
   568 	CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);   //todo take actual filter type
   570     GLX_LOG_INFO1("GlxMLWrapperPrivate::CreateMediaListAlbumItemL  - Filter Type = %d",aFilterType);
       
   571     CMPXFilter* filter = NULL;
       
   572     if( EGlxFilterExcludeCamera == aFilterType)
       
   573         {
       
   574         filter = TGlxFilterFactory::CreateCameraAlbumExclusionFilterL();
       
   575         }
       
   576     else if(EGlxFilterImage == aFilterType)
       
   577         {
       
   578         filter = TGlxFilterFactory::CreateExcludeDrmImageTypeFilterL(aFilterType);   
       
   579         }
       
   580     else if( EGlxFilterFetcherMimeType == aFilterType )
       
   581         {
       
   582         if(fetcherFilterType == EGlxFetcherFilterJpeg)
       
   583             {
       
   584             filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJpeg);
       
   585             }
       
   586         else if(fetcherFilterType == EGlxFetcherFilterJp2){
       
   587             filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJp2);
       
   588             }
       
   589         }
       
   590     else 
       
   591         {
       
   592         filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);   //todo take actual filter type
       
   593         }
   569 	CleanupStack::PushL(filter);
   594 	CleanupStack::PushL(filter);
   570 	iMediaList = MGlxMediaList::InstanceL( *path, 
   595 	iMediaList = MGlxMediaList::InstanceL( *path, 
   571 	                  TGlxHierarchyId(0), filter );  //todo take actual hierarchy
   596 	                  TGlxHierarchyId(0), filter );  //todo take actual hierarchy
   572 	CleanupStack::PopAndDestroy( filter );
   597 	CleanupStack::PopAndDestroy( filter );
   573 	
   598 	
   579 // CreateMediaListL()
   604 // CreateMediaListL()
   580 // Creates a collection path
   605 // Creates a collection path
   581 // Create a filter as requested filtertype
   606 // Create a filter as requested filtertype
   582 // Creates the medialist
   607 // Creates the medialist
   583 // ---------------------------------------------------------------------------
   608 // ---------------------------------------------------------------------------
   584 void GlxMLWrapperPrivate::CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) 
   609 void GlxMLWrapperPrivate::CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType) 
   585 	{
   610 	{
   586 	TRACER("GlxMLWrapperPrivate::CreateMediaListL");
   611 	TRACER("GlxMLWrapperPrivate::CreateMediaListL");
   587   	Q_UNUSED(aHierarchyId);	
   612   	Q_UNUSED(aHierarchyId);	
   588 	// Create path to the list of images and videos
   613 	// Create path to the list of images and videos
   589 	CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   614 	CMPXCollectionPath* path = CMPXCollectionPath::NewL();
   601 	else if(EGlxFilterImage == aFilterType)
   626 	else if(EGlxFilterImage == aFilterType)
   602 		{
   627 		{
   603 		filter = TGlxFilterFactory::CreateExcludeDrmImageTypeFilterL(aFilterType);   
   628 		filter = TGlxFilterFactory::CreateExcludeDrmImageTypeFilterL(aFilterType);   
   604 		CleanupStack::PushL(filter);
   629 		CleanupStack::PushL(filter);
   605 		}
   630 		}
       
   631 	else if( EGlxFilterFetcherMimeType == aFilterType )
       
   632 	    {
       
   633         if(fetcherFilterType == EGlxFetcherFilterJpeg)
       
   634             {
       
   635             filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJpeg);
       
   636             }
       
   637         else if(fetcherFilterType == EGlxFetcherFilterJp2){
       
   638             filter = TGlxFilterFactory::CreateMimeTypeFilterL(KMymeTypeJp2);
       
   639             }
       
   640         CleanupStack::PushL(filter);
       
   641 	    }
   606 	else 
   642 	else 
   607 		{
   643 		{
   608 		filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);   //todo take actual filter type
   644 		filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType);   //todo take actual filter type
   609 		CleanupStack::PushL(filter);
   645 		CleanupStack::PushL(filter);
   610 		}
   646 		}