|
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 __IEBGPSCONTROLLER_H__ |
|
19 #define __IEBGPSCONTROLLER_H__ |
|
20 |
|
21 // Include files |
|
22 #include <e32base.h> |
|
23 #include <IEImageProcessing.h> |
|
24 #include <IEImage.h> |
|
25 |
|
26 #include "IEFileloader.h" |
|
27 #include "IEEngineUtils.h" |
|
28 |
|
29 |
|
30 // Forward Class Declaration |
|
31 class CIEFileLoader; |
|
32 class CIEEngineUtils; |
|
33 |
|
34 // Class Declartion |
|
35 class MIEBgpsControllerObserver |
|
36 { |
|
37 public: |
|
38 //virtual void Something() = 0; |
|
39 virtual void TNGenerationComplete(TThumbSize aTNRes) = 0; |
|
40 virtual void SingleTNGenerationComplete(TInt aIndex, TThumbSize aTNRes) = 0; |
|
41 virtual void FaceDetectionComplete() = 0; |
|
42 virtual void SingleFaceDetectionComplete() = 0; |
|
43 virtual TInt GetSelectedImageIndex() = 0; |
|
44 virtual CImageData* GetImageData(TInt aIndex) = 0; |
|
45 }; |
|
46 |
|
47 class CIEBgpsController : public CBase, public MIETNObserver |
|
48 { |
|
49 public: // First phase constructor and destructor |
|
50 static CIEBgpsController* NewL( |
|
51 RFs& aFileServer, |
|
52 MIEBgpsControllerObserver& aIEBgpsControllerObserver, |
|
53 CIEEngineUtils& aEngineUtils, |
|
54 RCriticalSection* aCritical); |
|
55 ~CIEBgpsController(); |
|
56 |
|
57 private: // Second phase constructor and C++ default constructor |
|
58 void ConstructL(); |
|
59 CIEBgpsController( |
|
60 RFs& aFileServer, |
|
61 MIEBgpsControllerObserver& aIEBgpsControllerObserver, |
|
62 CIEEngineUtils& aEngineUtils, |
|
63 RCriticalSection* aCritical); |
|
64 |
|
65 public: // From MIETNObserver |
|
66 void ThumbnailGenerationCompleted(TInt aErrorCode); |
|
67 void ThumbnailGenerationCancelled(TInt aErrorCode); |
|
68 void HandleError(TInt aError); |
|
69 |
|
70 public: // New functions |
|
71 // TN generation related |
|
72 void SetFileLoader(CIEFileLoader* aFileLoader); |
|
73 void CreateImageProcessing(); |
|
74 //void StartTNGeneration(RArray<CImageData*>& aImageArray); |
|
75 //void StopTNGeneration(TInt &aValue); |
|
76 void GenerateThumbNailL(const TDes &aOrgFile, TThumbSize /*aTNResolution*/); |
|
77 void AllFilesAddedToFilenameArrayL(); |
|
78 TReal GetAspectRatio(TInt aIndex); |
|
79 TReal GetFacesAspectRatio(TInt aIndex); |
|
80 void GenerateTNForEditedImage(const TFileName aEditedFileName, const TReal aAspectRatio); |
|
81 void FilenameArrayCountChanged(const RArray<CImageData*>& aImageDataArray); |
|
82 CImageData* GetImageData(const TInt aIndex); |
|
83 |
|
84 // Face Detection related |
|
85 void GetFaceCoordinates(const TFileName a128x128TNFileName, RArray<TRect>& aFaceCoordinateArray); |
|
86 void StartFaceCropping(TInt aIndex, RArray<TFileName>& aFilenames); |
|
87 void RemoveFaceCoordinate(const TFileName a128x128TNFileName, RArray<TRect>& aCordArray); |
|
88 void AddFaceCoordinate(const TFileName a128x128TNFileName, RArray<TRect>& aCordArray); |
|
89 void GetSingleFaceCoordinates(TInt aIndex, const TFileName aTNFileName, RArray<TRect>& aFaceCoordinateArray); |
|
90 void CancelTNGeneration(); |
|
91 |
|
92 private: // Private functions |
|
93 void CreateSingleTNL(); |
|
94 void DeleteCorruptedThumbNailFile(TFileName aFileName); |
|
95 void CheckOptimalFileFor128x128TnCreation(TInt aIndex, TFileName& aFilename); |
|
96 void CheckOptimalFileFor32x32TnCreation(TInt aIndex, TFileName& aFilename); |
|
97 |
|
98 void Generate128x128Thumbnails(TInt aIndex); |
|
99 void Generate32x32Thumbnails(TInt aIndex); |
|
100 void Generate512x512Thumbnails(TInt aIndex); |
|
101 |
|
102 //TReal ReadAspectRatioL(TFileName& aFileName); |
|
103 //void CheckFileNamesExits(TInt aIndex, TDes& aFilename); |
|
104 void StartTNCreatorL(); |
|
105 TInt FindMissingTN(TThumbSize& aRes); |
|
106 |
|
107 private: // Data members |
|
108 RFs& iFileServer; |
|
109 MIEBgpsControllerObserver& iIEBgpsControllerObserver; |
|
110 CIEImageProcessing* iIEBgpsClient; |
|
111 CIEFileLoader* iFileLoader; |
|
112 CIEEngineUtils& iIEEngineUtils; |
|
113 |
|
114 RArray<CImageData*> iImageDataArray; |
|
115 RArray<CImageData*> iFaceCropImageDataArray; |
|
116 |
|
117 TBool i128x128TNCreationOn; |
|
118 TBool i32x32TNCreationOn; |
|
119 TBool i512x512TNCreationOn; |
|
120 |
|
121 |
|
122 TBool iSingleTNGeneration; |
|
123 |
|
124 TBool iSingleFaceDetectionOn; |
|
125 TBool iBackGroundFaceDetectionOn; |
|
126 TBool iBackGroundFaceDetectionComplete; |
|
127 |
|
128 TSize iTNSize; |
|
129 |
|
130 TInt iImageIndex; |
|
131 TInt iStopTN; |
|
132 |
|
133 TReal iAspectRatio; |
|
134 |
|
135 TFileName iTNFilename; |
|
136 TFileName iJpegFilename; |
|
137 TFileName iSavedFileName; |
|
138 |
|
139 TThumbSize iLatestCreatedTNSize; |
|
140 CImageData* iTmpImageData; |
|
141 CImageData* iImageData; |
|
142 |
|
143 TInt iSingleFBIndex; |
|
144 RArray<TRect>* iSingleFBCoordinateArray; |
|
145 RArray<TRect> iFBCoordinateArray; |
|
146 |
|
147 TInt iTnCreationIndex; |
|
148 TBool iAllTNsDone; |
|
149 TBool iTnCreationCancelled; |
|
150 RCriticalSection* iCritical; |
|
151 CFbsBitmap* i512x512TnBitmap; |
|
152 }; |
|
153 |
|
154 #endif // __IEBGPSCONTROLLER_H__ |