AppInc/ImagicViewBrowser.h
changeset 3 93fff7023be8
equal deleted inserted replaced
2:e1e28b0273b0 3:93fff7023be8
       
     1 /*
       
     2 * Copyright (c) 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: Juha Kauppinen, Mika Hokkanen
       
    13 * 
       
    14 * Description: Photo Browser
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef IMAGICVIEWBROWSER_H
       
    19 #define IMAGICVIEWBROWSER_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <aknview.h>
       
    23 #include "TextureLoader.h"
       
    24 #include "ImagicAppUi.h"
       
    25 
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CImagicContainerBrowser;
       
    29 class CImagicAppUi;
       
    30 class CTextureLoader;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 //Face browsing states
       
    35 enum TFaceBrowsingModes
       
    36     {
       
    37      EFaceBrowserNone = 1,
       
    38      EFaceBrowsingShowRect,
       
    39      EFaceBrowsing,
       
    40      EFaceBrowsingRemoveFace,
       
    41      EFaceBrowsingAddNewFace,
       
    42      EFaceBrowsingAddThisAsNewFace
       
    43     };
       
    44 
       
    45 enum TApplicationFeature
       
    46     {
       
    47     EAppFeatureCropping = 1,
       
    48     EAppFeatureEditing,
       
    49     EAppFeatureFaceBrowsing,
       
    50     EAppFeatureNone
       
    51     };
       
    52 
       
    53 
       
    54 class CSettings
       
    55 {
       
    56 public :
       
    57     enum TSettingsValue {
       
    58         ESettingImageIndex = 0,
       
    59         ESettingGridMode = 1
       
    60     };
       
    61     
       
    62     CSettings();
       
    63     void ExternalizeL(RWriteStream& aStream) const;
       
    64     void InternalizeL(RReadStream& aStream);
       
    65     void SetValue(TSettingsValue aIndex, TInt aValue);
       
    66     TInt GetValue(TSettingsValue aIndex) const;
       
    67     TBool IsChanged() const;
       
    68 
       
    69 private :
       
    70     TInt    iValues[2];
       
    71     TBool   iChanged;
       
    72 };
       
    73  
       
    74 /**
       
    75 *  CImagicViewBrowser view class.
       
    76 * 
       
    77 */
       
    78 class CImagicViewBrowser : public CAknView
       
    79     {
       
    80     public: // Constructors and destructor
       
    81 
       
    82         /**
       
    83         * EPOC default constructor.
       
    84         */
       
    85         void ConstructL(CImagicAppUi*	aImagicAppUi);
       
    86 
       
    87         /**
       
    88         * Destructor.
       
    89         */
       
    90         ~CImagicViewBrowser();
       
    91 
       
    92     public: // Functions from base classes
       
    93         
       
    94         /**
       
    95         * Return Uid
       
    96         */
       
    97         TUid Id() const;
       
    98 
       
    99         /**
       
   100         * Handle Commands
       
   101         */
       
   102         void HandleCommandL(TInt aCommand);
       
   103 
       
   104         /**
       
   105         * Handle size change
       
   106         */
       
   107         void HandleClientRectChange();
       
   108         
       
   109         void SetActiveViewL(TUid aViewNro);
       
   110         void LoadBitmapsToBrowserL(CImageData* aImageData, TThumbSize aImageResolution);
       
   111         CImagicContainerBrowser* GetContainer();
       
   112         void BitmapLoadedByEngineL(TInt aError);
       
   113         void TNCreationComplete();
       
   114         void FaceDetectionComplete();
       
   115         void TNCreationBegin();
       
   116         void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
   117         
       
   118         void WriteSettingsFileL(const TDesC& aName);
       
   119         void ReadSettingsFileL(const TDesC& aName);
       
   120         //TBool FindFileName(const TDesC& aName);
       
   121         TApplicationFeature GetAppFeature();
       
   122         
       
   123         void EditImageL();
       
   124         void CropImageL();
       
   125         
       
   126         //void SetFaceCoords(RArray<TRect>& aCoordinates);
       
   127         void ResetFaceCoords();
       
   128         void SetFaceBrowsingMode(TFaceBrowsingModes aMode);
       
   129         TFaceBrowsingModes GetFaceBrowsingMode();
       
   130         
       
   131     private:
       
   132 
       
   133         /**
       
   134         * From AknView, activates view
       
   135         */
       
   136         void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId,
       
   137             const TDesC8& aCustomMessage);
       
   138 
       
   139         /**
       
   140         * From AknView, deactivates view
       
   141         */
       
   142         void DoDeactivate();
       
   143         void DisplayAddFacesQueryDialogL(TInt aResourceId);
       
   144         void SetGridMode(TGridMode aGridMode);
       
   145         
       
   146     private: // Data
       
   147         CImagicContainerBrowser*    iContainer;
       
   148         CImagicAppUi*	            iImagicAppUi;
       
   149         CFbsBitmap*                 iBitmap;
       
   150         TBool                       iHighRes;
       
   151         TBool                       iTNCreationComplete;//Set TRue if TNs are created
       
   152         TBool                       iFaceBrowsingComplete;//Set TRue if background Face Browsing is complete
       
   153         TBool                       iFaceCroppingComplete;//Set TRue if background Face Cropping is complete
       
   154         TBool                       iEditModeEnabledCmd1;
       
   155         RFs                         iFsSession;
       
   156         RArray<TRect>               iCoordinates;
       
   157         TFileName                   iFaceTNFilename;
       
   158         TFaceBrowsingModes          iFaceBrowsingMode;
       
   159         RArray<TRect>               iTempCordArray;
       
   160         TApplicationFeature         iApplicationFeature;
       
   161         //TFileName                   tmpFileName;
       
   162         TThumbSize                  iImageResolution;
       
   163         CSettings                   iSettings;        
       
   164     };
       
   165 
       
   166 #endif
       
   167 
       
   168 // End of File