|
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 IMAGICAPPUI_H |
|
19 #define IMAGICAPPUI_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <eikapp.h> |
|
23 #include <eikdoc.h> |
|
24 #include <e32std.h> |
|
25 #include <coeccntx.h> |
|
26 #include <aknviewappui.h> // View AppUi adds View handling to AppUi |
|
27 #include <aknnavide.h> |
|
28 #include <BAUTILS.H> |
|
29 #include <exifmodify.h> |
|
30 #include "ImagicConsts.h" |
|
31 #include "HLPLCH.H" |
|
32 //#include <oommonitorclient.h> |
|
33 //#include <oommonitorsession.h> |
|
34 |
|
35 //Hitchcock |
|
36 #ifdef HITCHCOCK |
|
37 #include <hitchcock.h> |
|
38 #include "ImagicHUIViewRotate.h" |
|
39 #endif |
|
40 // Image converter library API header |
|
41 #include <ImageConversion.h> |
|
42 // Bitmap transforms API header |
|
43 #include <BitmapTransforms.h> |
|
44 //#include "IEFileLoader.h" |
|
45 |
|
46 //IE engine header |
|
47 #include <IEEngine.h> |
|
48 #include "debug.h" |
|
49 #include <aknwaitdialog.h> |
|
50 #include "ImagicContainerBrowser.h" |
|
51 #include "IEImage.h" |
|
52 |
|
53 // UID of view |
|
54 //const TUid EditMainView = {1}; |
|
55 const TUid DummyUID = {1}; |
|
56 const TUid BrightnessAdjustment = {2}; |
|
57 const TUid ContrastAdjustement = {3}; |
|
58 const TUid BrowserView = {4}; |
|
59 const TUid Crop = {5}; |
|
60 const TUid SharpnessAdjustement = {6}; |
|
61 const TUid Resize = {7}; |
|
62 const TUid Zoom = {8}; |
|
63 const TUid Rotate = {9}; |
|
64 const TUid ColorAdjustement = {10}; |
|
65 const TUid GammaAdjustement = {11}; |
|
66 const TUid LocalContrastAdjustement = {12}; |
|
67 const TUid HUIRotate = {13}; |
|
68 const TUid HUICrop = {14}; |
|
69 |
|
70 //Error IDs |
|
71 const TUid KErrorId= { -1 }; // MessageUid to send |
|
72 |
|
73 |
|
74 // FORWARD DECLARATIONS |
|
75 class CImagicHUIViewRotate; |
|
76 class CImagicHUIViewCrop; |
|
77 class CImagicViewBrowser; |
|
78 class CImagicContainerBrowser; |
|
79 class CImagicContainerCrop; |
|
80 class CImagicViewWizardEdit; |
|
81 //IE Engine |
|
82 class MIEEngineObserver; |
|
83 class CIEEngine; |
|
84 |
|
85 class CImagicUtils; |
|
86 |
|
87 |
|
88 enum TStatus |
|
89 { |
|
90 ENormal = 1, |
|
91 EProcessing, |
|
92 EDone, |
|
93 ESaving, |
|
94 EError |
|
95 }; |
|
96 |
|
97 enum TImageQuality |
|
98 { |
|
99 ELQTextIndex,//OpenGL 128x128 texture index |
|
100 EHQTextIndex,//OpenGL 512x512 texture index |
|
101 ESuperHQTextIndex//OpenGL 2048x2048 texture index |
|
102 }; |
|
103 |
|
104 /** |
|
105 * Application UI class. CAknViewAppUi derives from CAknAppUi and has view handling methods added. |
|
106 * Provides support for the following features: |
|
107 * - EIKON control architecture |
|
108 * - view architecture |
|
109 * - status pane |
|
110 * |
|
111 */ |
|
112 //CAknViewAppUi derived from CEikAppUi |
|
113 class CImagicAppUi : public CAknViewAppUi, public MIEEngineObserver |
|
114 { |
|
115 public: // // Constructors and destructor |
|
116 |
|
117 /** |
|
118 * EPOC default constructor. |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 /** |
|
123 * Destructor. |
|
124 */ |
|
125 ~CImagicAppUi(); |
|
126 |
|
127 private: |
|
128 // From MEikMenuObserver |
|
129 // With this, we can dynamically activate/deactivate menu items. |
|
130 void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); |
|
131 |
|
132 CArrayFix<TCoeHelpContext>* CImagicAppUi::HelpContextL() const; |
|
133 void ScreenImmeadetaUpdate(); |
|
134 |
|
135 public: |
|
136 void DestructEngine(); |
|
137 void SetActiveView(TUid aViewNro); |
|
138 TUid GetActiveView(); |
|
139 |
|
140 TInt GetImageIndex(); |
|
141 void SetImageIndex(TInt aIndex); |
|
142 #ifdef _ACCELEROMETER_SUPPORTED_ |
|
143 void ImageRotated(TImagicDeviceOrientation aDeviceOrientation); |
|
144 #endif |
|
145 CIEEngine* GetEngine(); |
|
146 |
|
147 void GetWizardImagesL(TInt aIndex, TIEFeature aFeature); |
|
148 void SavedImageReady(CFbsBitmap* croppedBitmap); |
|
149 //TInt GetTotalImages(); |
|
150 |
|
151 void SetFileNameForEditing(TFileName aFileName); |
|
152 TFileName GetFileNameForEditing(); |
|
153 static TInt TimerCallBack(TAny* aPtr); |
|
154 |
|
155 static TInt ExitTimerCallBack(TAny* aPtr); |
|
156 //void SetFont(); |
|
157 |
|
158 //from class MIEEngineObserver |
|
159 void WizardImagesReadyL(); |
|
160 void FeatureCompleteL(TIEFeature aFeature, TInt aError); |
|
161 void FeatureErrorL(TIEFeature aFeature, TInt aError); |
|
162 void ImagesLoadedL(TInt aError); |
|
163 void EditedImageSavedL(TInt aError); |
|
164 //void SetNumberOfImages(TInt aCount); |
|
165 //void SetNumberOfFaceImages(TInt aCount); |
|
166 void TNCreationCompleteL(TThumbSize aTnRes); |
|
167 void SingleTNCreationCompletedL(TInt aIndex, TThumbSize aTnRes); |
|
168 void FaceDetectionComplete(); |
|
169 void SingleFaceDetectionComplete(); |
|
170 void AllFilesScanned(); |
|
171 void ImageListChanged(TInt aIndex, TBool aAdded); |
|
172 |
|
173 CImagicUtils *GetImagicUtils(); |
|
174 TInt GetErrorCode(); |
|
175 //TRgb GetTransparentWhite(); |
|
176 //TRgb GetTransparentBlack(); |
|
177 //const CFont* GetFont(); |
|
178 |
|
179 public: |
|
180 TInt DeleteImage(TInt aIndex); |
|
181 void SetTNGenerationFlag(TBool aValue); |
|
182 void SetUIDrawMode(TImageArrayMode aMode); |
|
183 //TImageArrayMode GetUIDrawMode(); |
|
184 void CImagicAppUiReady(); |
|
185 void BrowserContainerInitialized(); |
|
186 TInt GetGleMaxRes(); |
|
187 TBool IsAppOnTop(); |
|
188 |
|
189 private: |
|
190 |
|
191 TInt iNoOfFacesDetected; |
|
192 RArray<TRect> iFaceCoOrdinates; |
|
193 |
|
194 private: |
|
195 /** |
|
196 * From CEikAppUi, takes care of command handling. |
|
197 * @param aCommand command to be handled |
|
198 */ |
|
199 void HandleCommandL(TInt aCommand); |
|
200 |
|
201 |
|
202 /** |
|
203 * From CEikAppUi, handles key events. |
|
204 * @param aKeyEvent Event to handled. |
|
205 * @param aType Type of the key event. |
|
206 * @return Response code (EKeyWasConsumed, EKeyWasNotConsumed). |
|
207 */ |
|
208 virtual TKeyResponse HandleKeyEventL( |
|
209 const TKeyEvent& aKeyEvent,TEventCode aType); |
|
210 |
|
211 void HandleForegroundEventL(TBool aForeground); |
|
212 |
|
213 /** |
|
214 * From CEikAppUi, handles key events. |
|
215 * @param aType The type of resources that have changed |
|
216 */ |
|
217 virtual void HandleResourceChangeL( TInt aType ); |
|
218 |
|
219 |
|
220 private: //Data |
|
221 /** Active object that is the timing source for the clearing OpenGL memory. */ |
|
222 CPeriodic* iPeriodic; |
|
223 CImagicContainerBrowser* iBrowserContainer; |
|
224 CImagicContainerCrop* iCropContainer; |
|
225 CImagicUtils* iImagicUtils; |
|
226 CIEEngine* iIEngine; |
|
227 |
|
228 TUid iViewIdEditorMain; |
|
229 TUid iViewIdBrowser; |
|
230 TUid iViewIdWizardEdit; |
|
231 TUid iViewIdCrop; |
|
232 TUid iViewIdRotate; |
|
233 TUid iViewHUIIdRotate; |
|
234 TUid iViewHUIIdCrop; |
|
235 TInt iImageIndex; |
|
236 TUid iViewNro; |
|
237 |
|
238 //TInt iTotalNumOfImages; |
|
239 //TInt iNumOfImagesLoaded; |
|
240 //TInt iNumOfFacesLoaded; |
|
241 RArray<CFbsBitmap*> iWizardBitmapArray; |
|
242 //TIEFeature iFeature; |
|
243 TInt iFeatureError; |
|
244 |
|
245 const CFont* iFont; |
|
246 TRgb iTransparentWhite; |
|
247 TRgb iTransparentBlack; |
|
248 TBool iImagesLoaded; |
|
249 TFileName iFileName; |
|
250 CAknWaitDialog* iWaitDialog; |
|
251 |
|
252 TBool iWzContainerSatus; |
|
253 TBool iAppActiveState; |
|
254 |
|
255 TBool iWaitingForIdleTimer; |
|
256 TBool iWaitingForTimer; |
|
257 |
|
258 RFs iFileServer; |
|
259 TBool iTNGenerationOnGoing; |
|
260 |
|
261 CAknWaitDialog* iExitWaitDialog; |
|
262 |
|
263 CPeriodic* iExitPeriodic; |
|
264 TInt iNumberOfIterations; |
|
265 |
|
266 RArray<TRect> iCoordinates; |
|
267 TImageArrayMode iUIDrawMode; |
|
268 TBool iMenuOn; |
|
269 TBool iAppForeGround; |
|
270 |
|
271 //ROomMonitorSession* iMemoryRequester; |
|
272 }; |
|
273 |
|
274 #endif |
|
275 |
|
276 // End of File |