engine/collectionframework/thumbnailcreator/inc/glxtnfileutility.h
changeset 71 27f2d7aec52a
parent 69 45459746d5e8
child 72 0a8e959402e5
equal deleted inserted replaced
69:45459746d5e8 71:27f2d7aec52a
     1 /*
       
     2 * Copyright (c) 2008-2009 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:   Utility for thumbnail tasks handling files
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  * @internal reviewed 30/07/2007 by Simon Brooks
       
    22  */
       
    23 
       
    24 #ifndef GLXTNFILEUTILITY_H
       
    25 #define GLXTNFILEUTILITY_H
       
    26 
       
    27 #include <e32base.h>
       
    28 #include <f32file.h>
       
    29 
       
    30 /**
       
    31  * Utility for thumbnail tasks handling files.
       
    32  *
       
    33  * @author Dan Rhodes
       
    34  * @ingroup glx_thumbnail_creator
       
    35  */
       
    36 NONSHARABLE_CLASS(CGlxtnFileUtility) : public CBase
       
    37     {
       
    38 public:  // Constructors and destructor
       
    39 
       
    40     /**
       
    41     * Two-phased constructor.
       
    42     */
       
    43     static CGlxtnFileUtility* NewL();
       
    44 
       
    45     /**
       
    46     * Destructor.
       
    47     */
       
    48     ~CGlxtnFileUtility();
       
    49 
       
    50     /**
       
    51     * Provide file server session for opening images from files.
       
    52     */
       
    53     RFs& FsSession();
       
    54 
       
    55     /**
       
    56     * Test whether a file is on the bad file list.  If so this method leaves.
       
    57     * If not the bad file marker is set to the filename, so that if a panic
       
    58     * occurs the file will be added to the bad file list.
       
    59     * @param aFilename Path of file for which a thumbnail is to be generated.
       
    60     */
       
    61     void CheckBadFileListL(const TDesC& aFilename);
       
    62 
       
    63     /**
       
    64     * Clear the bad file marker.  Called when processing a file is complete (no
       
    65     * panic occurred).
       
    66     */
       
    67     void ClearBadFileMarker();
       
    68 
       
    69     /**
       
    70     * Test whether a generated thumbnail should be stored in persistent storage.
       
    71     * @param aSize Requested size of thumbnail.
       
    72     */
       
    73     TBool IsPersistentSize(const TSize& aSize);
       
    74 
       
    75 private:
       
    76 
       
    77     /**
       
    78     * C++ default constructor.
       
    79     */
       
    80     CGlxtnFileUtility();
       
    81 
       
    82     /**
       
    83     * By default Symbian 2nd phase constructor is private.
       
    84     */
       
    85     void ConstructL();
       
    86 
       
    87     /**
       
    88     * Read bad file list from file and add file from marker, if present.
       
    89     */
       
    90     void ReadBadFileListL();
       
    91     /**
       
    92     * Write bad file list to file.
       
    93     */
       
    94     void WriteBadFileListL();
       
    95 
       
    96 private:
       
    97     /** File server session for opening images from files */
       
    98     RFs iFs;
       
    99     /** Directory in which to store bad file list and marker */
       
   100     TFileName iBadFileDir;
       
   101     /** Filenames of media files which cause panics when decoding */
       
   102     RPointerArray<HBufC> iBadFileArray;
       
   103     /** Persistent thumbnail size classes */
       
   104     RArray<TSize> iPersistentSizeClasses;
       
   105     };
       
   106 
       
   107 #endif  // GLXTNFILEUTILITY_H