camerauis/cameraapp/generic/inc/camfolderutility.h
changeset 0 1ddebce53859
equal deleted inserted replaced
-1:000000000000 0:1ddebce53859
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *                
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef CAM_FOLDERUTILITY_H
       
    24 #define CAM_FOLDERUTILITY_H
       
    25 
       
    26 // ===========================================================================
       
    27 // Included headers
       
    28 #include <e32base.h>
       
    29 
       
    30 #include "CamSettingsInternal.hrh"
       
    31 #include "CamSettings.hrh"
       
    32 
       
    33 // ===========================================================================
       
    34 
       
    35 /**
       
    36 * Utility class for folder naming
       
    37 */
       
    38 class CCamFolderUtility : public CBase
       
    39   {
       
    40   // =======================================================
       
    41   // Types and constants
       
    42   public:
       
    43 
       
    44     static const TInt KMaxGuaranteedBurstGroup   = 20;
       
    45     static const TInt KMaxFilesPerFolder         = 100;
       
    46     
       
    47     enum TCamFolderType
       
    48         {
       
    49         ECamFolderTypeImageMMC,
       
    50         ECamFolderTypeImagePhone,
       
    51         ECamFolderTypeVideoMMC,
       
    52         ECamFolderTypeVideoPhone,
       
    53         ECamFolderTypeLast
       
    54         };
       
    55 
       
    56   // =======================================================
       
    57   public:
       
    58 
       
    59     /**
       
    60     * Get the base path to be used for greating the next filename
       
    61     * @since 2.8
       
    62     * @param aMonthCounters Array with counter for every storage type folders.
       
    63     *        Must have ECamFolderTypeLast number of items (or more).
       
    64     * @param aStorage Whether storing to Phone or MMC
       
    65     * @param aPath On return will contain the new path, if the final destination
       
    66     * (month counter) folder does not exist then this will contain the parent
       
    67     * folder (month folder)
       
    68     * @param aCaptureMode image or video mode (used to determine folder path/name)
       
    69     * @param aCreateAll whether or not the destination folder should be created
       
    70     * if it does not already exist. The folders at higher levels than this are 
       
    71     * always ensured to exist (unless the function returns an error, when existence is 
       
    72     * undetermined). If aCreateAll is ETrue the remaining space (max 100 files) in the
       
    73     * destination folder is checked, 
       
    74     * @param aRequiredFileCount Folders will contain a maximum of 100 files. If there is 
       
    75     * not enough space for the specified count then a new folder will be created.
       
    76     * @param aTime provides the month and year used to determine the folder name (ensures
       
    77     * that all images in a sequence are placed in the same month parent folder). If aTime 
       
    78     * is 0 GetBasePathL uses the current system time.
       
    79     */
       
    80     static void GetBasePathL( TInt*          aMonthCounters,
       
    81                               TInt           aStorage, // TCamMediaStorage
       
    82                               TDes&          aPath, 
       
    83                               TCamCameraMode aCaptureMode, 
       
    84                               TBool          aCreateAll,
       
    85                               TInt           aRequiredFileCount = 1,
       
    86                               TTime          aTime              = TInt64( 0 ) );
       
    87 
       
    88     /**
       
    89     * Reset certain month folder counters.
       
    90     * @param The array containing month folder counters for every storage type.
       
    91     *        Must have ECamFolderTypeLast number of items (or more).
       
    92     * @param aFrom The index of first counter which is resetted.
       
    93     * @param aTo   The index of last counter which is resetted.
       
    94     */
       
    95     static void ResetCounters( TInt* aMonthCounters,
       
    96                                TInt  aFrom = ECamFolderTypeImageMMC,
       
    97                                TInt  aTo   = ECamFolderTypeLast - 1 );
       
    98 
       
    99   private:
       
   100     
       
   101     /**
       
   102     * Set up the counters used to create mulitple month folders
       
   103     * @since 3.0
       
   104     * @param aMonthCounters Array with counter for every storage type folders.
       
   105     *        Must have ECamFolderTypeLast number of items (or more).
       
   106     * @param aPath the current path.
       
   107     * @param aMonthFolder the name of the month folder parent directory
       
   108     * @param aFs file server session
       
   109     * @param aFolderType Index into the array of folder counters (image/video, mmc/phone)                
       
   110     * @return KErrNone or another system wide error code
       
   111     */                        
       
   112     static TInt InitialiseMonthCounter( TInt*  aMonthCounters,
       
   113                                         TDes&  aPath,
       
   114                                         TDesC& aMonthFolder,
       
   115                                         RFs&   aFs,
       
   116                                         TInt   aFolderType );   
       
   117                                             
       
   118     /**
       
   119     * Create the destination folder for the next image or video. 
       
   120     * @since 3.0
       
   121     * @param aMonthCounters Array with counter for every storage type folders.
       
   122     *        Must have ECamFolderTypeLast number of items (or more).
       
   123     * @param aPath If returning without error this will contain the new path.
       
   124     * @param aFs file server session
       
   125     * @param aFolderType Index into the array of folder counters (image/video, mmc/phone)
       
   126     * @param aRequiredFileCount Folders will contain a maximum of 100 files. If there is 
       
   127     * not enough space for the specified count then a new folder will be created. When the
       
   128     * highest possible folder number is reached (Z9) the 100 file limit is ignored
       
   129     * @return KErrNone or another system wide error code
       
   130     */                           
       
   131     static TInt CreateDestinationFolder( TInt* aMonthCounters,
       
   132                                          TDes& aPath, 
       
   133                                          RFs&  aFs,
       
   134                                          TInt  aFolderType, // TCamMediaStorage
       
   135                                          TInt  aRequiredFileCount );
       
   136 
       
   137     
       
   138   // =======================================================
       
   139   };
       
   140 
       
   141 
       
   142 #endif // CAM_FOLDERUTILITY_H
       
   143 
       
   144 // ===========================================================================
       
   145 // end of file