ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h
changeset 69 45459746d5e8
parent 65 ccee5c4b0de4
child 71 27f2d7aec52a
equal deleted inserted replaced
65:ccee5c4b0de4 69:45459746d5e8
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description: 
    14  * Description: 
    15 *
    15  *
    16 */
    16  */
    17 
    17 
    18 /*glxmlwrapper_p.h*/
    18 /*glxmlwrapper_p.h*/
    19 
    19 
    20 #ifndef GLXMLWRAPPER_P_H
    20 #ifndef GLXMLWRAPPER_P_H
    21 #define GLXMLWRAPPER_P_H
    21 #define GLXMLWRAPPER_P_H
    38 class CGlxDefaultAttributeContext;
    38 class CGlxDefaultAttributeContext;
    39 class CGlxDefaultThumbnailContext;
    39 class CGlxDefaultThumbnailContext;
    40 class CGlxDefaultListAttributeContext;
    40 class CGlxDefaultListAttributeContext;
    41 class CGlxTitleFetcher;
    41 class CGlxTitleFetcher;
    42 class CGlxDRMUtility;
    42 class CGlxDRMUtility;
    43 //to use first call GlxMLWrapperPrivate::Instance then set the mode by calling GlxMLWrapperPrivate::SetContextMode()
    43 
    44 //CLASS Declaration
    44 
    45 class GlxMLWrapperPrivate : public QObject,public MGlxTitleFetcherObserver
    45 /**
       
    46  * Class Description
       
    47  * Medialist wrapper private class to acess the media property and thumbnail data
       
    48  * To use first call GlxMLWrapperPrivate::Instance then set the mode by calling GlxMLWrapperPrivate::SetContextMode()
       
    49  */
       
    50 class GlxMLWrapperPrivate: public QObject, public MGlxTitleFetcherObserver
    46 {
    51 {
    47     
    52 
    48 public:
    53 public:
    49 	/**
    54     /**
    50      * Two-phased constructor.
    55      * Two-phased constructor.
    51      *
    56      *
    52      * @return Pointer to newly created object. NULL if creation fails. Avoiding Leave as would be called by a QT wrapper Class
    57      * @return Pointer to newly created object. NULL if creation fails. Avoiding Leave as would be called by a QT wrapper Class
    53      */
    58      */
    54     static GlxMLWrapperPrivate* Instance(GlxMLWrapper* aMLWrapper, int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType);								
    59     static GlxMLWrapperPrivate* Instance( GlxMLWrapper* aMLWrapper, int aCollectionId,
       
    60         int aHierarchyId, TGlxFilterItemType aFilterType, QString uri,
       
    61         GlxFetcherFilterType fetcherFilterType );
    55     /**
    62     /**
    56      * Destructor.
    63      * Destructor.
    57      */
    64      */
    58    ~GlxMLWrapperPrivate();
    65     ~GlxMLWrapperPrivate();
    59     /**
    66     /**
    60      * for setting the attribute context mode will be used mainly for retreiving thumbnail of different sizes.
    67      * for setting the attribute context mode will be used mainly for retreiving thumbnail of different sizes.
    61      */
    68      */
    62 	 void SetContextMode(GlxContextMode aContextMode);
    69     void SetContextMode( GlxContextMode aContextMode );
    63 	 
    70 
    64 	 /*
    71     /**
    65 	  * For removing the contect used
    72      * For removing the contect used
    66 	  */
    73      */
    67 	 void RemoveContextMode(GlxContextMode aContextMode);
    74     void RemoveContextMode( GlxContextMode aContextMode );
    68 	 
    75 
    69 	 /**
    76     /**
    70      * for retreiving the Media List Count.
    77      * for retreiving the Media List Count.
    71      */
    78      */
    72 	 int GetItemCount();
    79     int GetItemCount();
    73 	 /*
    80     
    74 	  * for retrieving the focus Index
    81     /**
    75 	  */  
    82      * for retrieving the focus Index
    76 	 int GetFocusIndex() const;
    83      */
    77 	 /*
    84     int GetFocusIndex() const;
    78 	  * for setting the focus Index
    85     
    79 	  */
    86     /**
    80 	 void SetFocusIndex(int aItemIndex);
    87      * for setting the focus Index
    81 
    88      */
    82 	 /*
    89     void SetFocusIndex( int aItemIndex );
    83 	  * for setting the focus Index
    90 
    84 	  */
    91     /**
    85 	 void SetSelectedIndex(int aItemIndex);
    92      * for setting the focus Index
    86 
    93      */
    87 	 /*
    94     void SetSelectedIndex( int aItemIndex );
    88 	  * for retrieving the visible window Index
    95 
    89 	  */  
    96     /**
    90 	 int GetVisibleWindowIndex();
    97      * for retrieving the visible window Index
    91 	/*
    98      */
    92 	 * for setting the visible window Index
    99     int GetVisibleWindowIndex();
    93 	 */
   100     
    94 	 void SetVisibleWindowIndex(int aItemIndex);
   101     /**
    95 
   102      * for setting the visible window Index
    96 public:
   103      */
    97 	 // From MGlxTitleFetcherObserver
   104     void SetVisibleWindowIndex( int aItemIndex );
    98     IMPORT_C void HandleTitleAvailableL(const TDesC& aTitle);
   105 
    99 
   106 public:
   100 public: 
   107     // From MGlxTitleFetcherObserver
       
   108     IMPORT_C void HandleTitleAvailableL( const TDesC& aTitle );
       
   109 
       
   110 public:
   101     void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
   111     void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
   102     void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */);
   112     void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */);
   103     void HandleAttributesAvailableL( TInt aItemIndex, 
   113     void HandleAttributesAvailableL( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes,
   104         const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList );    
   114         MGlxMediaList* aList );
   105     void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList );
   115     void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex,
   106     void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList );
   116         MGlxMediaList* aList );
       
   117     void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList );
   107     void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList );
   118     void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList );
   108     void HandleError( TInt aError );
   119     void HandleError( TInt aError );
   109   //todo remove comment  void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError,MGlxMediaList* aList );
   120     //todo remove comment  void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError,MGlxMediaList* aList );
   110     void HandleMediaL( TInt aListIndex, MGlxMediaList* aList );
   121     void HandleMediaL( TInt aListIndex, MGlxMediaList* aList );
   111     void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList );
   122     void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList );
   112     void HandlePopulatedL(MGlxMediaList* aList);
   123     void HandlePopulatedL( MGlxMediaList* aList );
   113 
   124 
   114 public:
   125 public:
   115 	/**
   126     /**
   116 	* RetrieveItemIcon()
   127      * RetrieveItemIcon() -  To retreive the full screen and grid thumbnail
   117 	*/
   128      */
   118 	HbIcon* RetrieveItemIcon(int index, GlxTBContextType aTBContextType);
   129     HbIcon* RetrieveItemIcon( int index, GlxTBContextType aTBContextType );    
   119 	QImage  RetrieveItemImage(int index, GlxTBContextType aTBContextType);
   130     QImage RetrieveItemImage( int index, GlxTBContextType aTBContextType );
   120 	QString RetrieveListTitle(int index);
   131     QString RetrieveListTitle( int index );
   121 	QString RetrieveListDesc(int index);
   132     QString RetrieveListDesc( int index );
   122 	QString RetrieveListSubTitle(int index);
   133     QString RetrieveListSubTitle( int index );
   123 	QString RetrieveItemUri(int index);
   134     QString RetrieveItemUri( int index );
   124 	QSize   RetrieveItemDimension(int index);
   135     QSize RetrieveItemDimension( int index );
   125 	int     RetrieveItemSize(int index);
   136     int RetrieveItemSize( int index );
   126 	QDate   RetrieveItemDate(int index);
   137     QDate RetrieveItemDate( int index );
   127 	QTime   RetrieveItemTime(int index);
   138     QTime RetrieveItemTime( int index );
   128 	int     RetrieveItemFrameCount(int aItemIndex);
   139     int RetrieveItemFrameCount( int aItemIndex );
   129 	CFbsBitmap* RetrieveBitmap(int aItemIndex);
   140     CFbsBitmap* RetrieveBitmap( int aItemIndex );
   130 	int     RetrieveListItemCount( int aItemIndex );
   141     int RetrieveListItemCount( int aItemIndex );
   131 	bool    isSystemItem( int aItemIndex );
   142     bool isSystemItem( int aItemIndex );
   132 	/*
   143     /*
   133 	 *Sets the context for fetcing comments
   144      *Sets the context for fetcing comments
   134 	 */
   145      */
   135 	void SetDescontextL();
   146     void SetDescontextL();
   136 	QString RetrieveViewTitle();
   147     QString RetrieveViewTitle();
   137 	bool IsPopulated();
   148     bool IsPopulated();
   138 	bool IsDrmProtected(int index );
   149     bool IsDrmProtected( int index );
   139 	bool IsDrmValid(int index);
   150     bool IsDrmValid( int index );
   140 	void setDrmValid(int index,bool valid);			
   151     void setDrmValid( int index, bool valid );
   141 	bool IsCorruptedImage( int aItemIndex );				
   152     bool IsCorruptedImage( int aItemIndex );
   142 private:
   153 private:
   143 
   154 
   144     /**
   155     /**
   145      * C++ default constructor.
   156      * C++ default constructor.
   146      */
   157      */
   147     GlxMLWrapperPrivate(GlxMLWrapper* aMLWrapper);
   158     GlxMLWrapperPrivate( GlxMLWrapper* aMLWrapper );
   148 
   159 
   149     /**
   160     /**
   150      * By default Symbian 2nd phase constructor is private.
   161      * By default Symbian 2nd phase constructor is private.
   151      */
   162      */
   152     void ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri=NULL,GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone);
   163     void ConstructL( int aCollectionId, 
   153 	/**
   164                           int aHierarchyId, 
       
   165                           TGlxFilterItemType aFilterType,
       
   166                           QString uri = NULL, 
       
   167                           GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone );
       
   168     /**
   154      * Create an instance of Media List.
   169      * Create an instance of Media List.
   155      *
   170      *
   156      * @leave with error code if creation fails.
   171      * @leave with error code if creation fails.
   157      */
   172      */
   158 	void CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone);
   173     void CreateMediaListL( int aCollectionId, 
   159 	void CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType);
   174                               int aHierarchyId, 
   160 	void CreateMediaListFavoritesItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri);
   175                               TGlxFilterItemType aFilterType,
   161 	void SetThumbnailContextL(GlxContextMode aContextMode);
   176                               GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone );
   162 	void SetListContextL(GlxContextMode aContextMode);
   177     
   163 	void SetFavouriteContextL();
   178     void CreateMediaListAlbumItemL( int aCollectionId, 
   164 	void CreateGridContextL();
   179                                       int aHierarchyId,
   165 	void CreateLsFsContextL();
   180                                       TGlxFilterItemType aFilterType, GlxFetcherFilterType fetcherFilterType );
   166 	void CreatePtFsContextL();
   181     
   167 	void RemoveGridContext();
   182     void CreateMediaListFavoritesItemL( int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType, QString uri );
   168 	void RemoveLsFsContext();
   183     void SetThumbnailContextL( GlxContextMode aContextMode );
   169 	void RemovePtFsContext();
   184     void SetListContextL( GlxContextMode aContextMode );
   170 	void RemoveListContext();
   185     void SetFavouriteContextL();
   171 	void RemoveFavouriteContext();
   186     void CreateGridContextL();
   172 	void RemoveDescContext();
   187     void CreateLsFsContextL();
   173 	//for the attribute filtering
   188     void CreatePtFsContextL();
   174 	TInt CheckTBAttributesPresenceandSanity(TInt aItemIndex,
   189     void RemoveGridContext();
   175 		const RArray<TMPXAttribute>& aAttributes, TMPXAttribute aThumbnailAttribute );
   190     void RemoveLsFsContext();
   176 	void CheckGridTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
   191     void RemovePtFsContext();
   177 	void CheckPtFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
   192     void RemoveListContext();
   178 	void CheckLsFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
   193     void RemoveFavouriteContext();
   179 	void CheckListAttributes(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
   194     void RemoveDescContext();
   180 	/*
   195     //for the attribute filtering
   181 	 * to check the attributes returned for details view is present
   196     TInt CheckTBAttributesPresenceandSanity( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes, TMPXAttribute aThumbnailAttribute );
   182 	 */
   197     void CheckGridTBAttribute( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
   183 	void CheckDetailsAttributes(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
   198     void CheckPtFsTBAttribute( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
   184 	/*
   199     void CheckLsFsTBAttribute( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
   185 	 * convert the CFbsbitmap to HbIcon
   200     void CheckListAttributes( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
   186 	 */
   201     /*
   187 	HbIcon *convertFBSBitmapToHbIcon(CFbsBitmap* aBitmap);
   202      * to check the attributes returned for details view is present
   188 	/*
   203      */
   189 	 * convert the CFbsbitmap to HbIcon and scale down upto itemWidth and itemHeight
   204     void CheckDetailsAttributes( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
   190 	 */
   205     
   191 	HbIcon * convertFBSBitmapToHbIcon(CFbsBitmap* aBitmap, TInt itemWidth, TInt itemHeight);
   206     /**
       
   207      * convertFBSBitmapToHbIcon() - convert the CFbsbitmap to HbIcon
       
   208      * @param - bitmap of media
       
   209      * @return - Hbicon of the modia.
       
   210      */
       
   211     HbIcon *convertFBSBitmapToHbIcon( CFbsBitmap* aBitmap );
       
   212     
       
   213     /*
       
   214      * convertFBSBitmapToHbIcon() - convert the CFbsbitmap to HbIcon and scale down upto itemWidth and itemHeight
       
   215      * @param - bitmap of media
       
   216      * @param - expected HbIcon width
       
   217      * @param - expected HbIcon height
       
   218      * @param - aspect ratio parameter in the case of scaling the thumbnail
       
   219      * @return - Hbicon of the modia.
       
   220      */
       
   221     HbIcon * convertFBSBitmapToHbIcon( CFbsBitmap* aBitmap, TInt itemWidth, TInt itemHeight, Qt::AspectRatioMode aspectRatio = Qt::KeepAspectRatio );
   192 
   222 
   193 private:
   223 private:
   194     // Instance of Media List
   224     // Instance of Media List
   195     MGlxMediaList* iMediaList;
   225     MGlxMediaList* iMediaList;
   196 	//observer for ML
   226     //observer for ML
   197 	CGlxMLGenericObserver* iMLGenericObserver;
   227     CGlxMLGenericObserver* iMLGenericObserver;
   198 	GlxContextMode iContextMode;
   228     GlxContextMode iContextMode;
   199 	//Parent QT based Wrapper
   229     //Parent QT based Wrapper
   200 	GlxMLWrapper* iMLWrapper;
   230     GlxMLWrapper* iMLWrapper;
   201 	//contexts
   231     //contexts
   202 	// Thumbnail context
   232     // Thumbnail context
   203 	CGlxThumbnailContext* iGridThumbnailContext;
   233     CGlxThumbnailContext* iGridThumbnailContext;
   204 
   234 
   205 	// FS related thumbnail contexts
   235     // FS related thumbnail contexts
   206 	CGlxDefaultThumbnailContext* iPtFsThumbnailContext;
   236     CGlxDefaultThumbnailContext* iPtFsThumbnailContext;
   207 	CGlxDefaultThumbnailContext* iLsFsThumbnailContext; 
   237     CGlxDefaultThumbnailContext* iLsFsThumbnailContext;
   208 	CGlxDefaultThumbnailContext* iFocusFsThumbnailContext;
   238     CGlxDefaultThumbnailContext* iFocusFsThumbnailContext;
   209 	CGlxDefaultThumbnailContext* iFocusGridThumbnailContext;
   239     CGlxDefaultThumbnailContext* iFocusGridThumbnailContext;
   210 
   240 
   211 	//List related contexts
   241     //List related contexts
   212 	// Fetch context for retrieving title attribute
   242     // Fetch context for retrieving title attribute
   213     CGlxDefaultListAttributeContext* iTitleAttributeContext;
   243     CGlxDefaultListAttributeContext* iTitleAttributeContext;
   214 
   244 
   215     // Fetch context for retrieving subtitle
   245     // Fetch context for retrieving subtitle
   216     CGlxDefaultListAttributeContext* iSubtitleAttributeContext;
   246     CGlxDefaultListAttributeContext* iSubtitleAttributeContext;
   217 
   247 
   218     //to find if the image is in favorites or not
   248     //to find if the image is in favorites or not
   219    	CGlxDefaultAttributeContext *iFavouriteContext;	
   249     CGlxDefaultAttributeContext *iFavouriteContext;
   220 	
   250 
   221 	//To fetch the details
   251     //To fetch the details
   222     CGlxDefaultAttributeContext *iDescContext;
   252     CGlxDefaultAttributeContext *iDescContext;
   223 	
   253 
   224     CGlxThumbnailContext* iListThumbnailContext;
   254     CGlxThumbnailContext* iListThumbnailContext;
   225     // for thumbnail context
   255     // for thumbnail context
   226     TGlxFromVisibleIndexOutwardListIterator iThumbnailIterator;
   256     TGlxFromVisibleIndexOutwardListIterator iThumbnailIterator;
   227 
   257 
   228 	// Iterators for Grid and FS
   258     // Iterators for Grid and FS
   229     TGlxScrollingDirectionIterator iBlockyIterator;
   259     TGlxScrollingDirectionIterator iBlockyIterator;
   230     TGlxFromManualIndexBlockyIterator iBlockyIteratorForFilmStrip;
   260     TGlxFromManualIndexBlockyIterator iBlockyIteratorForFilmStrip;
   231 
   261 
   232 	//Variables for checking the active contexts
   262     //Variables for checking the active contexts
   233 	//todo merge all these variables into 1 and have bitwise operation on them
   263     //todo merge all these variables into 1 and have bitwise operation on them
   234 	TBool iGridContextActivated;
   264     TBool iGridContextActivated;
   235 	TBool iLsFsContextActivated;
   265     TBool iLsFsContextActivated;
   236 	TBool iPtFsContextActivated;
   266     TBool iPtFsContextActivated;
   237 	TBool iLsListContextActivated; //currently not used as we have not implemented the logic for 3 thumbnails
   267     TBool iLsListContextActivated; //currently not used as we have not implemented the logic for 3 thumbnails
   238 	TBool iPtListContextActivated; 
   268     TBool iPtListContextActivated;
   239 	TBool iDetailsContextActivated; //this is to fetch the comments attributes
   269     TBool iDetailsContextActivated; //this is to fetch the comments attributes
   240 	TBool iSelectionListContextActivated;
   270     TBool iSelectionListContextActivated;
   241 	CGlxTitleFetcher* iTitleFetcher;
   271     CGlxTitleFetcher* iTitleFetcher;
   242 	QImage iCorruptImage;
   272     QImage iCorruptImage;
   243 	QString iViewTitle;
   273     QString iViewTitle;
   244 	CGlxDRMUtility * iDrmUtility;
   274     CGlxDRMUtility * iDrmUtility;
   245 };
   275 };
   246 #endif //GLXMLWRAPPER_P_H 
   276 #endif //GLXMLWRAPPER_P_H