ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h
changeset 69 45459746d5e8
parent 65 ccee5c4b0de4
child 71 27f2d7aec52a
--- a/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h	Mon Sep 20 12:39:08 2010 +0530
+++ b/ui/uiengine/medialistwrapper/inc/glxmlwrapper_p.h	Mon Sep 27 15:13:20 2010 +0530
@@ -1,19 +1,19 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: 
+ *
+ */
 
 /*glxmlwrapper_p.h*/
 
@@ -40,207 +40,237 @@
 class CGlxDefaultListAttributeContext;
 class CGlxTitleFetcher;
 class CGlxDRMUtility;
-//to use first call GlxMLWrapperPrivate::Instance then set the mode by calling GlxMLWrapperPrivate::SetContextMode()
-//CLASS Declaration
-class GlxMLWrapperPrivate : public QObject,public MGlxTitleFetcherObserver
+
+
+/**
+ * Class Description
+ * Medialist wrapper private class to acess the media property and thumbnail data
+ * To use first call GlxMLWrapperPrivate::Instance then set the mode by calling GlxMLWrapperPrivate::SetContextMode()
+ */
+class GlxMLWrapperPrivate: public QObject, public MGlxTitleFetcherObserver
 {
-    
+
 public:
-	/**
+    /**
      * Two-phased constructor.
      *
      * @return Pointer to newly created object. NULL if creation fails. Avoiding Leave as would be called by a QT wrapper Class
      */
-    static GlxMLWrapperPrivate* Instance(GlxMLWrapper* aMLWrapper, int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri,GlxFetcherFilterType fetcherFilterType);								
+    static GlxMLWrapperPrivate* Instance( GlxMLWrapper* aMLWrapper, int aCollectionId,
+        int aHierarchyId, TGlxFilterItemType aFilterType, QString uri,
+        GlxFetcherFilterType fetcherFilterType );
     /**
      * Destructor.
      */
-   ~GlxMLWrapperPrivate();
+    ~GlxMLWrapperPrivate();
     /**
      * for setting the attribute context mode will be used mainly for retreiving thumbnail of different sizes.
      */
-	 void SetContextMode(GlxContextMode aContextMode);
-	 
-	 /*
-	  * For removing the contect used
-	  */
-	 void RemoveContextMode(GlxContextMode aContextMode);
-	 
-	 /**
+    void SetContextMode( GlxContextMode aContextMode );
+
+    /**
+     * For removing the contect used
+     */
+    void RemoveContextMode( GlxContextMode aContextMode );
+
+    /**
      * for retreiving the Media List Count.
      */
-	 int GetItemCount();
-	 /*
-	  * for retrieving the focus Index
-	  */  
-	 int GetFocusIndex() const;
-	 /*
-	  * for setting the focus Index
-	  */
-	 void SetFocusIndex(int aItemIndex);
+    int GetItemCount();
+    
+    /**
+     * for retrieving the focus Index
+     */
+    int GetFocusIndex() const;
+    
+    /**
+     * for setting the focus Index
+     */
+    void SetFocusIndex( int aItemIndex );
 
-	 /*
-	  * for setting the focus Index
-	  */
-	 void SetSelectedIndex(int aItemIndex);
+    /**
+     * for setting the focus Index
+     */
+    void SetSelectedIndex( int aItemIndex );
 
-	 /*
-	  * for retrieving the visible window Index
-	  */  
-	 int GetVisibleWindowIndex();
-	/*
-	 * for setting the visible window Index
-	 */
-	 void SetVisibleWindowIndex(int aItemIndex);
+    /**
+     * for retrieving the visible window Index
+     */
+    int GetVisibleWindowIndex();
+    
+    /**
+     * for setting the visible window Index
+     */
+    void SetVisibleWindowIndex( int aItemIndex );
+
+public:
+    // From MGlxTitleFetcherObserver
+    IMPORT_C void HandleTitleAvailableL( const TDesC& aTitle );
 
 public:
-	 // From MGlxTitleFetcherObserver
-    IMPORT_C void HandleTitleAvailableL(const TDesC& aTitle);
-
-public: 
     void HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList );
     void HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList*/* aList */);
-    void HandleAttributesAvailableL( TInt aItemIndex, 
-        const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList );    
-    void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList );
-    void HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList );
+    void HandleAttributesAvailableL( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes,
+        MGlxMediaList* aList );
+    void HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, TInt aNewIndex, TInt aOldIndex,
+        MGlxMediaList* aList );
+    void HandleItemSelectedL( TInt aIndex, TBool aSelected, MGlxMediaList* aList );
     void HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList );
     void HandleError( TInt aError );
-  //todo remove comment  void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError,MGlxMediaList* aList );
+    //todo remove comment  void HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError,MGlxMediaList* aList );
     void HandleMediaL( TInt aListIndex, MGlxMediaList* aList );
     void HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList );
-    void HandlePopulatedL(MGlxMediaList* aList);
+    void HandlePopulatedL( MGlxMediaList* aList );
 
 public:
-	/**
-	* RetrieveItemIcon()
-	*/
-	HbIcon* RetrieveItemIcon(int index, GlxTBContextType aTBContextType);
-	QImage  RetrieveItemImage(int index, GlxTBContextType aTBContextType);
-	QString RetrieveListTitle(int index);
-	QString RetrieveListDesc(int index);
-	QString RetrieveListSubTitle(int index);
-	QString RetrieveItemUri(int index);
-	QSize   RetrieveItemDimension(int index);
-	int     RetrieveItemSize(int index);
-	QDate   RetrieveItemDate(int index);
-	QTime   RetrieveItemTime(int index);
-	int     RetrieveItemFrameCount(int aItemIndex);
-	CFbsBitmap* RetrieveBitmap(int aItemIndex);
-	int     RetrieveListItemCount( int aItemIndex );
-	bool    isSystemItem( int aItemIndex );
-	/*
-	 *Sets the context for fetcing comments
-	 */
-	void SetDescontextL();
-	QString RetrieveViewTitle();
-	bool IsPopulated();
-	bool IsDrmProtected(int index );
-	bool IsDrmValid(int index);
-	void setDrmValid(int index,bool valid);			
-	bool IsCorruptedImage( int aItemIndex );				
+    /**
+     * RetrieveItemIcon() -  To retreive the full screen and grid thumbnail
+     */
+    HbIcon* RetrieveItemIcon( int index, GlxTBContextType aTBContextType );    
+    QImage RetrieveItemImage( int index, GlxTBContextType aTBContextType );
+    QString RetrieveListTitle( int index );
+    QString RetrieveListDesc( int index );
+    QString RetrieveListSubTitle( int index );
+    QString RetrieveItemUri( int index );
+    QSize RetrieveItemDimension( int index );
+    int RetrieveItemSize( int index );
+    QDate RetrieveItemDate( int index );
+    QTime RetrieveItemTime( int index );
+    int RetrieveItemFrameCount( int aItemIndex );
+    CFbsBitmap* RetrieveBitmap( int aItemIndex );
+    int RetrieveListItemCount( int aItemIndex );
+    bool isSystemItem( int aItemIndex );
+    /*
+     *Sets the context for fetcing comments
+     */
+    void SetDescontextL();
+    QString RetrieveViewTitle();
+    bool IsPopulated();
+    bool IsDrmProtected( int index );
+    bool IsDrmValid( int index );
+    void setDrmValid( int index, bool valid );
+    bool IsCorruptedImage( int aItemIndex );
 private:
 
     /**
      * C++ default constructor.
      */
-    GlxMLWrapperPrivate(GlxMLWrapper* aMLWrapper);
+    GlxMLWrapperPrivate( GlxMLWrapper* aMLWrapper );
 
     /**
      * By default Symbian 2nd phase constructor is private.
      */
-    void ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri=NULL,GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone);
-	/**
+    void ConstructL( int aCollectionId, 
+                          int aHierarchyId, 
+                          TGlxFilterItemType aFilterType,
+                          QString uri = NULL, 
+                          GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone );
+    /**
      * Create an instance of Media List.
      *
      * @leave with error code if creation fails.
      */
-	void CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone);
-	void CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,GlxFetcherFilterType fetcherFilterType);
-	void CreateMediaListFavoritesItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri);
-	void SetThumbnailContextL(GlxContextMode aContextMode);
-	void SetListContextL(GlxContextMode aContextMode);
-	void SetFavouriteContextL();
-	void CreateGridContextL();
-	void CreateLsFsContextL();
-	void CreatePtFsContextL();
-	void RemoveGridContext();
-	void RemoveLsFsContext();
-	void RemovePtFsContext();
-	void RemoveListContext();
-	void RemoveFavouriteContext();
-	void RemoveDescContext();
-	//for the attribute filtering
-	TInt CheckTBAttributesPresenceandSanity(TInt aItemIndex,
-		const RArray<TMPXAttribute>& aAttributes, TMPXAttribute aThumbnailAttribute );
-	void CheckGridTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
-	void CheckPtFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
-	void CheckLsFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
-	void CheckListAttributes(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
-	/*
-	 * to check the attributes returned for details view is present
-	 */
-	void CheckDetailsAttributes(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes);
-	/*
-	 * convert the CFbsbitmap to HbIcon
-	 */
-	HbIcon *convertFBSBitmapToHbIcon(CFbsBitmap* aBitmap);
-	/*
-	 * convert the CFbsbitmap to HbIcon and scale down upto itemWidth and itemHeight
-	 */
-	HbIcon * convertFBSBitmapToHbIcon(CFbsBitmap* aBitmap, TInt itemWidth, TInt itemHeight);
+    void CreateMediaListL( int aCollectionId, 
+                              int aHierarchyId, 
+                              TGlxFilterItemType aFilterType,
+                              GlxFetcherFilterType fetcherFilterType = EGlxFetcherFilterNone );
+    
+    void CreateMediaListAlbumItemL( int aCollectionId, 
+                                      int aHierarchyId,
+                                      TGlxFilterItemType aFilterType, GlxFetcherFilterType fetcherFilterType );
+    
+    void CreateMediaListFavoritesItemL( int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType, QString uri );
+    void SetThumbnailContextL( GlxContextMode aContextMode );
+    void SetListContextL( GlxContextMode aContextMode );
+    void SetFavouriteContextL();
+    void CreateGridContextL();
+    void CreateLsFsContextL();
+    void CreatePtFsContextL();
+    void RemoveGridContext();
+    void RemoveLsFsContext();
+    void RemovePtFsContext();
+    void RemoveListContext();
+    void RemoveFavouriteContext();
+    void RemoveDescContext();
+    //for the attribute filtering
+    TInt CheckTBAttributesPresenceandSanity( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes, TMPXAttribute aThumbnailAttribute );
+    void CheckGridTBAttribute( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
+    void CheckPtFsTBAttribute( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
+    void CheckLsFsTBAttribute( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
+    void CheckListAttributes( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
+    /*
+     * to check the attributes returned for details view is present
+     */
+    void CheckDetailsAttributes( TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes );
+    
+    /**
+     * convertFBSBitmapToHbIcon() - convert the CFbsbitmap to HbIcon
+     * @param - bitmap of media
+     * @return - Hbicon of the modia.
+     */
+    HbIcon *convertFBSBitmapToHbIcon( CFbsBitmap* aBitmap );
+    
+    /*
+     * convertFBSBitmapToHbIcon() - convert the CFbsbitmap to HbIcon and scale down upto itemWidth and itemHeight
+     * @param - bitmap of media
+     * @param - expected HbIcon width
+     * @param - expected HbIcon height
+     * @param - aspect ratio parameter in the case of scaling the thumbnail
+     * @return - Hbicon of the modia.
+     */
+    HbIcon * convertFBSBitmapToHbIcon( CFbsBitmap* aBitmap, TInt itemWidth, TInt itemHeight, Qt::AspectRatioMode aspectRatio = Qt::KeepAspectRatio );
 
 private:
     // Instance of Media List
     MGlxMediaList* iMediaList;
-	//observer for ML
-	CGlxMLGenericObserver* iMLGenericObserver;
-	GlxContextMode iContextMode;
-	//Parent QT based Wrapper
-	GlxMLWrapper* iMLWrapper;
-	//contexts
-	// Thumbnail context
-	CGlxThumbnailContext* iGridThumbnailContext;
+    //observer for ML
+    CGlxMLGenericObserver* iMLGenericObserver;
+    GlxContextMode iContextMode;
+    //Parent QT based Wrapper
+    GlxMLWrapper* iMLWrapper;
+    //contexts
+    // Thumbnail context
+    CGlxThumbnailContext* iGridThumbnailContext;
 
-	// FS related thumbnail contexts
-	CGlxDefaultThumbnailContext* iPtFsThumbnailContext;
-	CGlxDefaultThumbnailContext* iLsFsThumbnailContext; 
-	CGlxDefaultThumbnailContext* iFocusFsThumbnailContext;
-	CGlxDefaultThumbnailContext* iFocusGridThumbnailContext;
+    // FS related thumbnail contexts
+    CGlxDefaultThumbnailContext* iPtFsThumbnailContext;
+    CGlxDefaultThumbnailContext* iLsFsThumbnailContext;
+    CGlxDefaultThumbnailContext* iFocusFsThumbnailContext;
+    CGlxDefaultThumbnailContext* iFocusGridThumbnailContext;
 
-	//List related contexts
-	// Fetch context for retrieving title attribute
+    //List related contexts
+    // Fetch context for retrieving title attribute
     CGlxDefaultListAttributeContext* iTitleAttributeContext;
 
     // Fetch context for retrieving subtitle
     CGlxDefaultListAttributeContext* iSubtitleAttributeContext;
 
     //to find if the image is in favorites or not
-   	CGlxDefaultAttributeContext *iFavouriteContext;	
-	
-	//To fetch the details
+    CGlxDefaultAttributeContext *iFavouriteContext;
+
+    //To fetch the details
     CGlxDefaultAttributeContext *iDescContext;
-	
+
     CGlxThumbnailContext* iListThumbnailContext;
     // for thumbnail context
     TGlxFromVisibleIndexOutwardListIterator iThumbnailIterator;
 
-	// Iterators for Grid and FS
+    // Iterators for Grid and FS
     TGlxScrollingDirectionIterator iBlockyIterator;
     TGlxFromManualIndexBlockyIterator iBlockyIteratorForFilmStrip;
 
-	//Variables for checking the active contexts
-	//todo merge all these variables into 1 and have bitwise operation on them
-	TBool iGridContextActivated;
-	TBool iLsFsContextActivated;
-	TBool iPtFsContextActivated;
-	TBool iLsListContextActivated; //currently not used as we have not implemented the logic for 3 thumbnails
-	TBool iPtListContextActivated; 
-	TBool iDetailsContextActivated; //this is to fetch the comments attributes
-	TBool iSelectionListContextActivated;
-	CGlxTitleFetcher* iTitleFetcher;
-	QImage iCorruptImage;
-	QString iViewTitle;
-	CGlxDRMUtility * iDrmUtility;
+    //Variables for checking the active contexts
+    //todo merge all these variables into 1 and have bitwise operation on them
+    TBool iGridContextActivated;
+    TBool iLsFsContextActivated;
+    TBool iPtFsContextActivated;
+    TBool iLsListContextActivated; //currently not used as we have not implemented the logic for 3 thumbnails
+    TBool iPtListContextActivated;
+    TBool iDetailsContextActivated; //this is to fetch the comments attributes
+    TBool iSelectionListContextActivated;
+    CGlxTitleFetcher* iTitleFetcher;
+    QImage iCorruptImage;
+    QString iViewTitle;
+    CGlxDRMUtility * iDrmUtility;
 };
 #endif //GLXMLWRAPPER_P_H