|
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 |
|
19 // INCLUDE FILES |
|
20 #include "ImagicAppUi.h" |
|
21 #include <IEImage.h> |
|
22 #include "ImagicViewBrowser.h" |
|
23 #include "Imagic.hrh" |
|
24 #include "MSVSTD.HRH" |
|
25 #include <avkon.hrh> |
|
26 #include <ImageConversion.h> |
|
27 #include <aknutils.h> |
|
28 #include "ImagicContainerBrowser.h" |
|
29 |
|
30 //statuspane |
|
31 #include <eikbtgpc.h> |
|
32 #include <avkon.rsg> |
|
33 |
|
34 //for loading text from resource |
|
35 #include <aknnotewrappers.h> |
|
36 #include <stringloader.h> |
|
37 |
|
38 #include <PhotoBrowser.rsg> |
|
39 #include "ImagicUtils.h" |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 // ================= MEMBER FUNCTIONS ======================= |
|
45 // |
|
46 // ---------------------------------------------------------- |
|
47 // CImagicAppUi::ConstructL() |
|
48 // ---------------------------------------------------------- |
|
49 // |
|
50 void CImagicAppUi::ConstructL() |
|
51 { |
|
52 DP0_IMAGIC(_L("CImagicAppUi::ConstructL++")); |
|
53 |
|
54 //CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL(); |
|
55 //HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf); |
|
56 |
|
57 |
|
58 iTNGenerationOnGoing = ETrue; |
|
59 iMenuOn = EFalse; |
|
60 iAppForeGround = ETrue; |
|
61 |
|
62 //Set the font |
|
63 //SetFont(); |
|
64 |
|
65 iImagesLoaded = EFalse; |
|
66 iImageIndex = 0; |
|
67 iWzContainerSatus = EFalse; |
|
68 //iTotalNumOfImages = 0; |
|
69 //iNumOfImagesLoaded = 0; |
|
70 //iNumOfFacesLoaded = 0; |
|
71 iNumberOfIterations = 0; |
|
72 iUIDrawMode = EImages; |
|
73 iBrowserContainer = NULL; |
|
74 #ifdef USE_OOM |
|
75 ROomMonitorSession oomMonitor; |
|
76 oomMonitor.Connect(); |
|
77 TInt errorCode = oomMonitor.RequestFreeMemory( 1024*12 ); |
|
78 |
|
79 if ( errorCode != KErrNone ) |
|
80 { |
|
81 // try one more time |
|
82 errorCode = oomMonitor.RequestFreeMemory( 1024*12 ); |
|
83 } |
|
84 oomMonitor.Close(); |
|
85 #endif |
|
86 User::LeaveIfError(iFileServer.Connect()); |
|
87 |
|
88 //Initialises this app UI with standard values. |
|
89 //The application’s standard resource file will be read unless |
|
90 //the ENoAppResourceFile or ENonStandardResourceFile flags are passed. |
|
91 BaseConstructL(0x08 | EAknEnableSkin); // Use ELayoutAwareAppFlag (0x08) to make the application support scalable UI on FP3 devices. |
|
92 |
|
93 //Create engine and trap if there is error |
|
94 iIEngine = CIEEngine::NewL(*this); |
|
95 CleanupStack::PushL(iIEngine); |
|
96 |
|
97 //Browser view |
|
98 CImagicViewBrowser* viewBrowser = new (ELeave) CImagicViewBrowser; |
|
99 CleanupStack::PushL( viewBrowser ); |
|
100 viewBrowser->ConstructL(this); |
|
101 AddViewL( viewBrowser ); // transfer ownership to CAknViewAppUi |
|
102 CleanupStack::Pop( viewBrowser ); |
|
103 iViewIdBrowser = viewBrowser->Id(); // view id to get view from CAknViewAppUi |
|
104 |
|
105 SetDefaultViewL( *viewBrowser ); |
|
106 SetActiveView(BrowserView); |
|
107 |
|
108 //disable statuspane to get full screen |
|
109 StatusPane()->MakeVisible(EFalse); |
|
110 |
|
111 //Creating Utility class |
|
112 iImagicUtils = CImagicUtils::NewL(iFileServer); |
|
113 |
|
114 //Create timer to release Browser view resources and init opengl |
|
115 iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle ); |
|
116 |
|
117 //Force orientation to be always landscape |
|
118 SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); |
|
119 //SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait); |
|
120 |
|
121 CleanupStack::Pop(iIEngine); |
|
122 |
|
123 DP0_IMAGIC(_L("CImagicAppUi::ConstructL--")); |
|
124 } |
|
125 |
|
126 |
|
127 CArrayFix<TCoeHelpContext>* CImagicAppUi::HelpContextL() const |
|
128 { |
|
129 /* |
|
130 //#warning "Please see comment about help and UID3..." |
|
131 CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1); |
|
132 CleanupStack::PushL(array); |
|
133 array->AppendL(TCoeHelpContext(KUidrsdApp, KGeneral_Information)); |
|
134 CleanupStack::Pop(array); |
|
135 return array; |
|
136 */ |
|
137 } |
|
138 |
|
139 void CImagicAppUi::CImagicAppUiReady() |
|
140 { |
|
141 iIEngine->AppUIReady(); |
|
142 } |
|
143 |
|
144 // ---------------------------------------------------- |
|
145 // CImagicAppUi::~CImagicAppUi() |
|
146 // Destructor |
|
147 // Frees reserved resources |
|
148 // ---------------------------------------------------- |
|
149 // |
|
150 CImagicAppUi::~CImagicAppUi() |
|
151 { |
|
152 DP0_IMAGIC(_L("CImagicAppUi::~CImagicAppUi++")); |
|
153 if(iImagicUtils) |
|
154 { |
|
155 delete iImagicUtils; |
|
156 iImagicUtils = NULL; |
|
157 } |
|
158 |
|
159 iWizardBitmapArray.Close(); |
|
160 |
|
161 if(iPeriodic->IsActive()) |
|
162 iPeriodic->Cancel(); |
|
163 delete iPeriodic; |
|
164 |
|
165 // Doesn't delete engine yet, since container needs it when destroyed! |
|
166 //DestructEngine(); |
|
167 |
|
168 iFileServer.Close(); |
|
169 |
|
170 DP0_IMAGIC(_L("CImagicAppUi::~CImagicAppUi--")); |
|
171 } |
|
172 |
|
173 void CImagicAppUi::DestructEngine() |
|
174 { |
|
175 DP0_IMAGIC(_L("CImagicAppUi::DestructEngine++")); |
|
176 delete iIEngine; |
|
177 iIEngine = NULL; |
|
178 DP0_IMAGIC(_L("CImagicAppUi::DestructEngine--")); |
|
179 } |
|
180 |
|
181 |
|
182 /*TInt CImagicAppUi::GetErrorCode() |
|
183 { |
|
184 return iEngineCreationError; |
|
185 }*/ |
|
186 |
|
187 // ------------------------------------------------------------------------------ |
|
188 // CImagicAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
189 // This function is called by the EIKON framework just before it displays |
|
190 // a menu pane. Its default implementation is empty, and by overriding it, |
|
191 // the application can set the state of menu items dynamically according |
|
192 // to the state of application data. |
|
193 // ------------------------------------------------------------------------------ |
|
194 // |
|
195 void CImagicAppUi::DynInitMenuPaneL( |
|
196 TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/) |
|
197 { |
|
198 DP0_IMAGIC(_L("CImagicAppUi::DynInitMenuPaneL")); |
|
199 } |
|
200 |
|
201 |
|
202 void CImagicAppUi::BrowserContainerInitialized() |
|
203 { |
|
204 if(((CImagicViewBrowser*) View(iViewIdBrowser))->GetContainer() != NULL) |
|
205 { |
|
206 iBrowserContainer = ((CImagicViewBrowser*) View(iViewIdBrowser))->GetContainer(); |
|
207 iBrowserContainer->ImageListChanged(0, EFalse); // TODO: cheap trick to update coords |
|
208 } |
|
209 } |
|
210 |
|
211 |
|
212 // ------------------------------------------------------------------------------ |
|
213 // CImagicAppUi::HandleForegroundEventL(TBool aForeground) |
|
214 // This function is called by the framework when the screen loses or gains focus. |
|
215 // i.e. when it goes to the background or to the foreground. Incoming call |
|
216 // softnote is an example. |
|
217 // This event applies to the entire application, all views. |
|
218 // ------------------------------------------------------------------------------ |
|
219 // |
|
220 void CImagicAppUi::HandleForegroundEventL(TBool aForeground) |
|
221 { |
|
222 DP0_IMAGIC(_L("CImagicAppUi::HandleForegroundEventL++")); |
|
223 |
|
224 //SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait); |
|
225 if(iBrowserContainer) |
|
226 if (aForeground) |
|
227 { |
|
228 DP0_IMAGIC(_L("CImagicAppUi::HandleForegroundEventL - App Foreground")); |
|
229 |
|
230 //We were switched to foreground |
|
231 iAppForeGround = ETrue; |
|
232 //ScreenImmeadetaUpdate(); |
|
233 |
|
234 if(iPeriodic->IsActive()) |
|
235 iPeriodic->Cancel(); |
|
236 |
|
237 iIEngine->StartAccSensorMonitoring(); |
|
238 |
|
239 iBrowserContainer->SetDeleteTextures(EFalse); |
|
240 |
|
241 iAppActiveState = ETrue; |
|
242 |
|
243 if(iViewNro == BrowserView) |
|
244 { |
|
245 if(iBrowserContainer && !iBrowserContainer->IsOpenGLInit()) |
|
246 { |
|
247 iBrowserContainer->InitAfterPowerSaveL(); |
|
248 } |
|
249 else |
|
250 { |
|
251 if(iBrowserContainer) |
|
252 iBrowserContainer->EnableDisplayDraw(); |
|
253 } |
|
254 } |
|
255 |
|
256 if(iBrowserContainer) |
|
257 { |
|
258 iBrowserContainer->DrawNow(); |
|
259 iBrowserContainer->EnableDisplayDraw(); |
|
260 } |
|
261 } |
|
262 else |
|
263 {//We were switched to background |
|
264 DP0_IMAGIC(_L("CImagicAppUi::HandleForegroundEventL - App Background")); |
|
265 |
|
266 iAppForeGround = EFalse; |
|
267 //ScreenImmeadetaUpdate(); |
|
268 |
|
269 if(iViewNro == BrowserView) |
|
270 { |
|
271 //... disable frame loop timer ... |
|
272 //iBrowserContainer->DisableDisplayDraw(); |
|
273 |
|
274 //... start a timer for 3 seconds to call to a power save callback ... |
|
275 iPeriodic->Start( 3000000, 1000000000, TCallBack( CImagicAppUi::TimerCallBack, this ) ); |
|
276 //iBrowserContainer = ((CImagicViewBrowser*) View(iViewIdBrowser))->GetContainer(); |
|
277 } |
|
278 |
|
279 //iIEngine->StopAccSensorMonitoring(); |
|
280 |
|
281 iAppActiveState = EFalse; |
|
282 if(iBrowserContainer) |
|
283 { |
|
284 iBrowserContainer->DrawNow(); |
|
285 iBrowserContainer->DisableDisplayDraw(); |
|
286 } |
|
287 } |
|
288 |
|
289 DP0_IMAGIC(_L("CImagicAppUi::HandleForegroundEventL--")); |
|
290 } |
|
291 |
|
292 //Power save timer callback function |
|
293 //Cleans memory allocations for openGl draving |
|
294 TInt CImagicAppUi::TimerCallBack(TAny* aInstance) |
|
295 { |
|
296 DP0_IMAGIC(_L("CImagicAppUi::TimerCallBack++")); |
|
297 |
|
298 CImagicAppUi* instance = (CImagicAppUi*) aInstance; |
|
299 |
|
300 instance->iIEngine->StopAccSensorMonitoring(); |
|
301 |
|
302 if(instance->iViewNro == BrowserView) |
|
303 { |
|
304 if(instance->iBrowserContainer && instance->iBrowserContainer->IsOpenGLInit()) |
|
305 { |
|
306 DP0_IMAGIC(_L("CImagicAppUi::TimerCallBack - DeleteTextures")); |
|
307 //instance->iBrowserContainer->DeleteTextures(); |
|
308 instance->iBrowserContainer->SetDeleteTextures(ETrue); |
|
309 } |
|
310 } |
|
311 |
|
312 DP0_IMAGIC(_L("CImagicAppUi::TimerCallBack--")); |
|
313 return 0; |
|
314 } |
|
315 |
|
316 void CImagicAppUi::SetTNGenerationFlag(TBool aValue) |
|
317 { |
|
318 iTNGenerationOnGoing = aValue; |
|
319 } |
|
320 |
|
321 // ---------------------------------------------------- |
|
322 // CImagicAppUi::HandleKeyEventL( |
|
323 // const TKeyEvent& aKeyEvent,TEventCode /*aType*/) |
|
324 // Here we handle key events: Right and left arrow key |
|
325 // to change view. |
|
326 // ---------------------------------------------------- |
|
327 // |
|
328 TKeyResponse CImagicAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) |
|
329 { |
|
330 DP0_IMAGIC(_L("CImagicAppUi::HandleKeyEventL")); |
|
331 //No need to handle events here |
|
332 return EKeyWasNotConsumed; |
|
333 } |
|
334 |
|
335 // ---------------------------------------------------- |
|
336 // CImagicAppUi::HandleCommandL(TInt aCommand) |
|
337 // Here we handle commands on the application level. |
|
338 // In addition, each view has their own HandleCommandL() |
|
339 // ---------------------------------------------------- |
|
340 // |
|
341 void CImagicAppUi::HandleCommandL(TInt aCommand) |
|
342 { |
|
343 DP0_IMAGIC(_L("CImagicAppUi::HandleCommandL")); |
|
344 |
|
345 switch ( aCommand ) |
|
346 { |
|
347 case EEikCmdExit: |
|
348 { |
|
349 iIEngine->Stop(); |
|
350 |
|
351 // send to background |
|
352 TApaTask apaTask( CEikonEnv::Static()->WsSession() ); |
|
353 apaTask.SetWgId( iCoeEnv->RootWin().Identifier() ); |
|
354 apaTask.SendToBackground(); |
|
355 |
|
356 // Wait until engine is stopped |
|
357 while (iIEngine->IsRunning()) |
|
358 { |
|
359 User::After(200000); // 200ms |
|
360 } |
|
361 DP0_IMAGIC(_L("CImagicAppUi::HandleCommandL end wait")); |
|
362 if(iTNGenerationOnGoing) |
|
363 { |
|
364 TInt i = KErrNone; |
|
365 //iIEngine->StopFaceDetection(i); |
|
366 iIEngine->StopTNGeneration(i); |
|
367 } |
|
368 |
|
369 Exit(); |
|
370 break; |
|
371 } |
|
372 |
|
373 case EImagicCmdViewCmd1: |
|
374 { |
|
375 break; |
|
376 } |
|
377 // You can add your all application applying commands here. |
|
378 // You would handle here menu commands that are valid for all views. |
|
379 } |
|
380 |
|
381 } |
|
382 |
|
383 TInt CImagicAppUi::ExitTimerCallBack(TAny* aInstance) |
|
384 { |
|
385 CImagicAppUi* instance = (CImagicAppUi*) aInstance; |
|
386 instance->iNumberOfIterations++; |
|
387 if(instance->iTNGenerationOnGoing) |
|
388 { |
|
389 if(instance->iNumberOfIterations == 10) |
|
390 { |
|
391 instance->iNumberOfIterations = 0; |
|
392 instance->iPeriodic->Cancel(); |
|
393 //instance->CancelExitDialog(); |
|
394 instance->iImagicUtils->CancelWaitDialog(); |
|
395 User::Exit(KErrNone); |
|
396 } |
|
397 else |
|
398 { |
|
399 //nothing.. continue... |
|
400 } |
|
401 } |
|
402 else |
|
403 { |
|
404 instance->iPeriodic->Cancel(); |
|
405 //instance->CancelExitDialog(); |
|
406 instance->iImagicUtils->CancelWaitDialog(); |
|
407 |
|
408 User::Exit(KErrNone); |
|
409 } |
|
410 |
|
411 return 0; |
|
412 } |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // CImagicAppUi::HandleResourceChangeL( TInt aType ) |
|
416 // Called by framework when layout is changed. |
|
417 // ----------------------------------------------------------------------------- |
|
418 // |
|
419 void CImagicAppUi::HandleResourceChangeL( TInt aType ) |
|
420 { |
|
421 DP0_IMAGIC(_L("CImagicAppUi::HandleResourceChangeL")); |
|
422 |
|
423 //on = aType = 268457666, off = aType = 268457667 |
|
424 |
|
425 if(iBrowserContainer != NULL) |
|
426 { |
|
427 if(aType == 268457666) |
|
428 { |
|
429 iMenuOn = ETrue; |
|
430 //ScreenImmeadetaUpdate(); |
|
431 if(iBrowserContainer) |
|
432 { |
|
433 iBrowserContainer->SetScreenImmeadetaUpdate(ETrue); |
|
434 iBrowserContainer->DisableDisplayDraw(); |
|
435 } |
|
436 } |
|
437 else if(aType == 268457667) |
|
438 { |
|
439 iMenuOn = EFalse; |
|
440 //ScreenImmeadetaUpdate(); |
|
441 |
|
442 if(iBrowserContainer) |
|
443 { |
|
444 iBrowserContainer->SetScreenImmeadetaUpdate(EFalse); |
|
445 iBrowserContainer->EnableDisplayDraw(); |
|
446 } |
|
447 |
|
448 } |
|
449 |
|
450 iBrowserContainer->DrawNow(); |
|
451 } |
|
452 |
|
453 CAknAppUi::HandleResourceChangeL( aType ); |
|
454 |
|
455 // ADDED FOR SCALABLE UI SUPPORT |
|
456 // ***************************** |
|
457 if ( aType==KEikDynamicLayoutVariantSwitch ) |
|
458 { |
|
459 ((CImagicViewBrowser*) View( iViewIdBrowser) )->HandleClientRectChange( ); |
|
460 } |
|
461 |
|
462 } |
|
463 |
|
464 TBool CImagicAppUi::IsAppOnTop() |
|
465 { |
|
466 if(iMenuOn) |
|
467 { |
|
468 DP0_IMAGIC(_L("CImagicAppUi::IsAppOnTop: EFalse")); |
|
469 return EFalse; |
|
470 } |
|
471 else if(!iAppForeGround) |
|
472 { |
|
473 DP0_IMAGIC(_L("CImagicAppUi::IsAppOnTop: EFalse")); |
|
474 return EFalse; |
|
475 } |
|
476 else |
|
477 { |
|
478 DP0_IMAGIC(_L("CImagicAppUi::IsAppOnTop: ETrue")); |
|
479 return ETrue; |
|
480 } |
|
481 } |
|
482 |
|
483 void CImagicAppUi::ScreenImmeadetaUpdate() |
|
484 { |
|
485 if(iMenuOn || !iAppForeGround) |
|
486 iBrowserContainer->SetScreenImmeadetaUpdate(ETrue); |
|
487 else |
|
488 iBrowserContainer->SetScreenImmeadetaUpdate(EFalse); |
|
489 } |
|
490 |
|
491 |
|
492 void CImagicAppUi::SetImageIndex(TInt aIndex) |
|
493 { |
|
494 DP0_IMAGIC(_L("CImagicAppUi::SetImageIndex")); |
|
495 |
|
496 if(aIndex >= iIEngine->GetTotalNumOfImages()) |
|
497 aIndex = 0; |
|
498 if(aIndex < 0) |
|
499 aIndex = iIEngine->GetTotalNumOfImages()-1; |
|
500 |
|
501 iImageIndex = aIndex; |
|
502 } |
|
503 |
|
504 TInt CImagicAppUi::GetImageIndex() |
|
505 { |
|
506 DP0_IMAGIC(_L("CImagicAppUi::GetImageIndex")); |
|
507 return iImageIndex; |
|
508 } |
|
509 |
|
510 #ifdef _ACCELEROMETER_SUPPORTED_ |
|
511 void CImagicAppUi::ImageRotated(TImagicDeviceOrientation aDeviceOrientation) |
|
512 { |
|
513 DP1_IMAGIC(_L("CImagicAppUi::ImageRotated, angle: %d"),aDeviceOrientation); |
|
514 iBrowserContainer->PhoneRotated(aDeviceOrientation); |
|
515 } |
|
516 #endif |
|
517 |
|
518 void CImagicAppUi::SetActiveView(TUid aViewNro) |
|
519 { |
|
520 DP0_IMAGIC(_L("CImagicAppUi::SetActiveView")); |
|
521 iViewNro = aViewNro; |
|
522 } |
|
523 |
|
524 TUid CImagicAppUi::GetActiveView() |
|
525 { |
|
526 DP0_IMAGIC(_L("CImagicAppUi::GetActiveView")); |
|
527 return iViewNro; |
|
528 } |
|
529 |
|
530 |
|
531 //Callback from engine that loaded Bitmap image is ready for drawing |
|
532 void CImagicAppUi::ImagesLoadedL(TInt aError) |
|
533 { |
|
534 DP0_IMAGIC(_L("CImagicAppUi::ImagesLoaded++")); |
|
535 |
|
536 if(iViewNro == BrowserView) |
|
537 { |
|
538 ((CImagicViewBrowser*) View(iViewIdBrowser))->BitmapLoadedByEngineL(aError); |
|
539 } |
|
540 |
|
541 DP0_IMAGIC(_L("CImagicAppUi::ImagesLoaded--")); |
|
542 } |
|
543 |
|
544 |
|
545 //To get engine interface for other class usage |
|
546 CIEEngine* CImagicAppUi::GetEngine() |
|
547 { |
|
548 DP0_IMAGIC(_L("CImagicAppUi::GetEngine")); |
|
549 |
|
550 return iIEngine; |
|
551 } |
|
552 |
|
553 |
|
554 void CImagicAppUi::SetUIDrawMode(TImageArrayMode aMode) |
|
555 { |
|
556 iUIDrawMode = aMode; |
|
557 } |
|
558 |
|
559 /* |
|
560 TImageArrayMode CImagicAppUi::GetUIDrawMode() |
|
561 { |
|
562 return iUIDrawMode; |
|
563 } |
|
564 |
|
565 TRgb CImagicAppUi::GetTransparentWhite() |
|
566 { |
|
567 return iTransparentWhite; |
|
568 } |
|
569 |
|
570 TRgb CImagicAppUi::GetTransparentBlack() |
|
571 { |
|
572 return iTransparentBlack; |
|
573 } |
|
574 |
|
575 const CFont* CImagicAppUi::GetFont() |
|
576 { |
|
577 return iFont; |
|
578 } |
|
579 */ |
|
580 |
|
581 CImagicUtils* CImagicAppUi::GetImagicUtils() |
|
582 { |
|
583 return iImagicUtils; |
|
584 } |
|
585 |
|
586 |
|
587 /*void CImagicAppUi::SetFont() |
|
588 { |
|
589 DP0_IMAGIC(_L("CImagicAppUi::SetFont")); |
|
590 |
|
591 // set the font |
|
592 iFont = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont); |
|
593 //Set alpha colors |
|
594 iTransparentWhite=TRgb(KRgbWhite); |
|
595 iTransparentWhite.SetAlpha(128); |
|
596 iTransparentBlack=TRgb(KRgbBlack); |
|
597 iTransparentBlack.SetAlpha(128+64); |
|
598 }*/ |
|
599 |
|
600 |
|
601 void CImagicAppUi::ImageListChanged(TInt aIndex, TBool aAdded) |
|
602 { |
|
603 DP2_IMAGIC(_L("CImagicAppUi::ImageListChanged %d %d"), aIndex, aAdded); |
|
604 if (iBrowserContainer) |
|
605 iBrowserContainer->ImageListChanged(aIndex, aAdded); |
|
606 } |
|
607 |
|
608 //This is called when single face Detection has been completed |
|
609 void CImagicAppUi::SingleFaceDetectionComplete() |
|
610 { |
|
611 DP0_IMAGIC(_L("CImagicAppUi::SingleFaceDetectionComplete")); |
|
612 |
|
613 //((CImagicViewBrowser*) View(iViewIdBrowser))->SingleFaceDetectionComplete(); |
|
614 } |
|
615 |
|
616 //Callback function from engine that BackGround Face Detection has been completed |
|
617 void CImagicAppUi::FaceDetectionComplete() |
|
618 { |
|
619 DP0_IMAGIC(_L("CImagicAppUi::FaceDetectionComplete")); |
|
620 |
|
621 ((CImagicViewBrowser*) View(iViewIdBrowser))->FaceDetectionComplete(); |
|
622 } |
|
623 |
|
624 //Callback function from engine that Face Browsing creation has been completed |
|
625 |
|
626 void CImagicAppUi::SingleTNCreationCompletedL(TInt /*aIndex*/, TThumbSize aTnRes) |
|
627 { |
|
628 DP1_IMAGIC(_L("CImagicAppUi::SingleTNCreationCompletedL - res: %d"),aTnRes); |
|
629 |
|
630 iBrowserContainer->NewImageAdded(); |
|
631 iBrowserContainer->SetLoadingOn(ETrue); |
|
632 //iBrowserContainer->DrawScreen(); |
|
633 iBrowserContainer->DrawNow(); |
|
634 } |
|
635 |
|
636 //Callback function from engine that TN creation has been completed |
|
637 void CImagicAppUi::TNCreationCompleteL(TThumbSize aTnRes) |
|
638 { |
|
639 DP0_IMAGIC(_L("CImagicAppUi::TNCreationComplete++")); |
|
640 |
|
641 iTNGenerationOnGoing = EFalse; |
|
642 ((CImagicViewBrowser*) View(iViewIdBrowser))->TNCreationComplete(); |
|
643 |
|
644 iBrowserContainer->DrawNow(); |
|
645 |
|
646 |
|
647 /*TApplicationFeature appFeature = ((CImagicViewBrowser*)View(iViewIdBrowser))->GetAppFeature(); |
|
648 |
|
649 //This is in case we were editing and we did not have 320x320 tn created |
|
650 if(appFeature == EAppFeatureEditing && aTnRes == ESize32x32) |
|
651 { |
|
652 iTNGenerationOnGoing = EFalse; |
|
653 ((CImagicViewBrowser*) View(iViewIdBrowser))->TNCreationComplete(); |
|
654 } |
|
655 |
|
656 else if(appFeature == EAppFeatureNone ) |
|
657 { |
|
658 iTNGenerationOnGoing = EFalse; |
|
659 ((CImagicViewBrowser*) View(iViewIdBrowser))->TNCreationComplete(); |
|
660 } |
|
661 |
|
662 else if((appFeature == EAppFeatureEditing || appFeature == EAppFeatureCropping) && (aTnRes == ESize512x512 || aTnRes == ENotDefined)) |
|
663 { |
|
664 iTNGenerationOnGoing = EFalse; |
|
665 ((CImagicViewBrowser*) View(iViewIdBrowser))->TNCreationComplete(); |
|
666 |
|
667 }*/ |
|
668 DP0_IMAGIC(_L("CImagicAppUi::TNCreationComplete--")); |
|
669 } |
|
670 |
|
671 |
|
672 TInt CImagicAppUi::DeleteImage(TInt aIndex) |
|
673 { |
|
674 DP0_IMAGIC(_L("CImagicAppUi::DeleteImage++")); |
|
675 |
|
676 TInt err = iIEngine->DeleteFile(aIndex); |
|
677 |
|
678 DP0_IMAGIC(_L("CImagicAppUi::DeleteImage--")); |
|
679 |
|
680 return err; |
|
681 } |
|
682 |
|
683 void CImagicAppUi::AllFilesScanned() |
|
684 { |
|
685 DP0_IMAGIC(_L("CImagicAppUi::AllFilesScanned++")); |
|
686 |
|
687 if(iIEngine->GetTotalNumOfImages() <= 0) |
|
688 GetImagicUtils()->ExecuteQueryDialog(0/*GetErrorCode()*/, R_NO_IMAGES_DIALOG); |
|
689 |
|
690 iBrowserContainer->DrawNow(); |
|
691 |
|
692 DP0_IMAGIC(_L("CImagicAppUi::AllFilesScanned--")); |
|
693 } |
|
694 |
|
695 TInt CImagicAppUi::GetGleMaxRes() |
|
696 { |
|
697 return iBrowserContainer->GetGleMaxRes(); |
|
698 } |
|
699 |
|
700 |
|
701 |
|
702 // End of File |