imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h
branchRCL_3
changeset 19 f759b6186ab5
parent 17 ff2fb7658ff7
child 20 2b4b06654caa
--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h	Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/inc/thumbagprocessor.h	Thu Jul 15 18:59:26 2010 +0300
@@ -32,10 +32,46 @@
 #include "tmactivitymanager.h"
 #include "tmformatobserver.h"
 #include "tmrpropertyobserver.h"
+#include "thumbnailmanagerconstants.h"
 
 //FORWARD DECLARATIONS
 class MMPXCollectionUtility;
 
+
+enum TThumbnailGenerationItemType
+      {
+      EGenerationItemTypeUnknown,
+      EGenerationItemTypeNotFound,
+      EGenerationItemTypeCamera,
+      EGenerationItemTypeAny,
+      EGenerationItemTypeAudio,
+      EGenerationItemTypeVideo,
+      EGenerationItemTypeImage,
+      EGenerationItemTypeItemCount
+      };
+
+  enum TThumbnailGenerationItemAction
+      {
+      EGenerationItemActionAdd,
+      EGenerationItemActionDelete,
+      EGenerationItemActionModify,
+      EGenerationItemAction2ndAdd,
+      EGenerationItemActionResolveType,
+      EGenerationItemActionCount
+      };
+
+  struct TThumbnailGenerationItem
+      {
+      inline TThumbnailGenerationItem(): iItemId( KErrNotFound ), iItemType(EGenerationItemTypeUnknown), iItemAction(EGenerationItemActionAdd), iPlaceholder(EFalse), iUri(NULL){}
+      inline ~TThumbnailGenerationItem(){delete iUri; iUri = NULL;}
+      
+      TItemId iItemId;
+      TThumbnailGenerationItemType iItemType;
+      TThumbnailGenerationItemAction iItemAction;
+      TBool iPlaceholder;
+      HBufC* iUri;
+      };
+
 /**
  *  Processor object for handling thumb generation
  *
@@ -119,17 +155,18 @@
      * @since S60 v5.0
      * @param aMdESession MdE Session
      */
-    void SetMdESession( CMdESession* aMdESession );    
+    void SetMdESessionL( CMdESession* aMdESession );    
     
     /**
      * Adds new IDs to queue
      *
      * @since S60 v5.0
      * @param aType TObserverNotificationType
+	 * @param TThumbnailGenerationItemType
      * @param aIDArray IDs for thumbnail creation
      * @param aForce pass ETrue if processor is forced to run without waiting harvesting complete
      */
-    void AddToQueueL( TObserverNotificationType aType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
+    void AddToQueueL( TObserverNotificationType aType, TThumbnailGenerationItemType aItemType, const RArray<TItemId>& aIDArray, const RPointerArray<HBufC>& aObjectUriArray, TBool aPresent );
     
     /**
      * Calls Thumbnail Manager to create thumbnails
@@ -160,16 +197,17 @@
      * QueryL
      *
      * @since S60 v5.0
-     * @param aIDArray Item IDs to query
+     * @param TThumbnailGenerationItemAction
      */
-    void QueryL( RArray<TItemId>& aIDArray );
+    void QueryL( TThumbnailGenerationItemAction aType);
     
 	 /**
      * QueryPlaceholdersL
      *
      * @since S60 v5.0
+	 * @param aPresent item should not be present item
      */
-    void QueryPlaceholdersL();
+    void QueryPlaceholdersL(const TBool aPresent);
 
    	 /**
      * DeleteAndCancelQuery
@@ -260,14 +298,58 @@
      * @since S60 v5.0
  	 * @param aDefine (re)define PS key before setting value
      */
-    void UpdatePSValues(const TBool aDefine = EFalse);
+    void UpdatePSValues(const TBool aDefine, const TBool aForce);
        
     /**
      * Comparison function for logaritmic use of queue arrays
      * 
+     * @since S60 S^3
+     */
+    static TInt Compare(const TThumbnailGenerationItem& aLeft, const TThumbnailGenerationItem& aRight);
+	
+	 /**
+     * Comparison function for logaritmic use of queue arrays
+     * 
+     * @since S60 S^3
+     */
+    static TInt CompareId(const TItemId& aLeft, const TItemId& aRight);
+    
+	/**
+     * Recalculate item counts
+     * 
+     * @since S60 S^3
+     */
+    void UpdateItemCounts();
+	
+    /**
+     * Callback for mount timeout
+     *
      * @since S60 v5.0
      */
-    static TInt Compare(const TItemId& aLeft, const TItemId& aRight);
+    static TInt MountTimerCallBack(TAny* aAny);
+    
+	 /**
+     * Set item's action from type
+     *
+     * @since S^3
+     */
+    void SetGenerationItemAction( TThumbnailGenerationItem& aGenerationItem, const TThumbnailGenerationItemType aItemType );
+	
+     /**
+     * Set item type property from TDedIf
+     * @param aGenerationItem TThumbnailGenerationItem
+     * @param aItemType TThumbnailGenerationItemType
+     * @since S^3
+     */
+    void SetGenerationItemType( TThumbnailGenerationItem& aGenerationItem, const TDefId aDefId );
+ 
+     /**
+     * Append item to processing queue or update existing
+     * @param aGenerationItem modified TThumbnailGenerationItem
+     * @param aDefId items MDS object definition ID
+     * @since S^3
+     */
+    void AppendProcessingQueue(TThumbnailGenerationItem& item );
         
 private:
     
@@ -281,20 +363,19 @@
     CMdEObjectQuery* iQueryAllItems;
     CMdEObjectQuery* iQueryPlaceholders;
     
-    RArray<TItemId> iAddQueue;
-    RArray<TItemId> iModifyQueue;
-    RPointerArray<HBufC> iRemoveQueue;
+    RArray<TThumbnailGenerationItem> iGenerationQueue;
+    //RPointerArray<HBufC> iRemoveQueue;
     RArray<TItemId> iQueryQueue;
-    RArray<TItemId> iPlaceholderQueue;
-    //not processing queue, used to keep KItemsLeft PS correct
-    RArray<TItemId> i2ndRoundGenerateQueue;
-	//reference to current processing queue
-    RArray<TItemId>* iLastQueue;
     
 	//background generation state
 	// EFalse = 1st round, create only grid size thumbnail for images and videos
 	// ETrue = 2nds round, create all missing sizes for all media items
     TBool i2ndRound;    
+	
+	// query state
+	// EFalse = normal mode
+	// ETrue = querying unknown items
+    TBool iUnknown;
     
 	//MDS query issues
     TBool iQueryActive;
@@ -303,7 +384,7 @@
     
 	//Processing MDS itens which are modified
     TBool iModify;
-    TInt iProcessingCount;
+    TUint iProcessingCount;
 
     //MDS harvester's overall state
     TBool iHarvesting;
@@ -318,6 +399,7 @@
     TBool iMMCHarvestingTemp;
     
     CPeriodic* iPeriodicTimer;
+    CPeriodic* iMountTimer;
 
 	//MDS Harvester client
     RHarvesterClient iHarvesterClient;
@@ -328,7 +410,7 @@
     //2nd phase init after MDE session is open
     TBool iInit2;
     
-    // auto create
+    // auto create values from centrep
     TBool iAutoImage;
     TBool iAutoVideo;
     TBool iAutoAudio;
@@ -338,14 +420,16 @@
     // controlled by Photos application to run TN generation on foreground
     TBool iForegroundRun;
 	//request pending in TNM side
-    TBool iActive;
    
     CTMFormatObserver* iFormatObserver;
    
+   //formating started
     TBool iFormatting;
+	//TNM server session died
     TBool iSessionDied;
    
-    TInt iActiveCount;
+   //pending request count
+    TUint iActiveCount;
     
     MMPXCollectionUtility* iCollectionUtility; // own
     
@@ -355,6 +439,7 @@
     //overall status of device
     TBool iIdle;
     
+	//monitors device activity
     CTMActivityManager* iActivityManager;
     
 	//Observer foreground generation 
@@ -367,6 +452,28 @@
     TBool iDoQueryAllItems;
     
     TBool iShutdown;
-};
+	
+	//item counts
+    TUint32 iModifyItemCount;
+    TUint32 iImageItemCount;
+    TUint32 iVideoItemCount;
+    TUint32 iAudioItemCount;
+    TUint32 iDeleteItemCount;
+    TUint32 iAddItemCount;
+    TUint32 iCameraItemCount;
+    TUint32 iUnknownItemCount;
+    TUint32 i2ndAddItemCount;
+    TUint32 iPlaceholderItemCount;
+    
+    //for book keeping previous items left count got from MDS harvester
+    TUint32 iMMCHarvestingItemsLeftTemp;
+    TUint32 iPHHarvestingItemsLeftTemp;
+    
+	//MdE object definitons used in query
+    CMdEObjectDef* iImageObjectDef;
+    CMdEObjectDef* iVideoObjectDef;
+    CMdEObjectDef* iAudioObjectDef;
+    TBool iHarvesterActivated;
+  };
 
 #endif // THUMBAGPROCESSOR_H