|
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 #include "IEImageProcessingImp.h" |
|
19 |
|
20 #include "IEImagicBGPSAO.h" |
|
21 #include "debug.h" |
|
22 |
|
23 EXPORT_C CIEImageProcessing* CIEImageProcessing::NewL(MIETNObserver& aObserver) |
|
24 { |
|
25 DP0_IMAGIC((_L("CIEImageProcessing::NewL ++"))); |
|
26 return CIEImageProcessingImp::NewL(aObserver); |
|
27 } |
|
28 |
|
29 CIEImageProcessingImp* CIEImageProcessingImp::NewL(MIETNObserver& aObserver) |
|
30 { |
|
31 CIEImageProcessingImp* self = new (ELeave) CIEImageProcessingImp(aObserver); |
|
32 CleanupStack::PushL(self); |
|
33 self->ConstructL(); |
|
34 CleanupStack::Pop(); |
|
35 return self; |
|
36 } |
|
37 |
|
38 CIEImageProcessingImp::~CIEImageProcessingImp() |
|
39 { |
|
40 DP0_IMAGIC((_L("CIEImageProcessingImp::~CIEImageProcessingImp ++"))); |
|
41 |
|
42 if(iImagicBGPSAO) |
|
43 { |
|
44 delete iImagicBGPSAO; |
|
45 iImagicBGPSAO = NULL; |
|
46 } |
|
47 |
|
48 iIEBgpClient.Close(); |
|
49 |
|
50 DP0_IMAGIC((_L("CIEImageProcessingImp::~CIEImageProcessingImp --"))); |
|
51 } |
|
52 |
|
53 CIEImageProcessingImp::CIEImageProcessingImp(MIETNObserver& aObserver) |
|
54 : iObserver(aObserver) |
|
55 { |
|
56 DP0_IMAGIC((_L("CIEImageProcessingImp::CIEImageProcessingImp ++"))); |
|
57 DP0_IMAGIC((_L("CIEImageProcessingImp::CIEImageProcessingImp --"))); |
|
58 } |
|
59 |
|
60 void CIEImageProcessingImp::ConstructL() |
|
61 { |
|
62 DP0_IMAGIC((_L("CIEImageProcessingImp::ConstructL ++"))); |
|
63 User::LeaveIfError(iIEBgpClient.Connect()); |
|
64 iImagicBGPSAO = CImagicBGPSAO::NewL(*this); |
|
65 } |
|
66 |
|
67 void CIEImageProcessingImp::HandleEvents(TInt aErrorCode) |
|
68 { |
|
69 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents++"))); |
|
70 |
|
71 switch(aErrorCode) |
|
72 { |
|
73 case ETNGenerationCancelled: |
|
74 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - ETNGenerationCancelled"))); |
|
75 iObserver.ThumbnailGenerationCancelled(KErrNone); |
|
76 break; |
|
77 case ETNGenerationcomplete: |
|
78 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - ETNGenerationcomplete"))); |
|
79 iObserver.ThumbnailGenerationCompleted(KErrNone); |
|
80 break; |
|
81 /*case EFaceDetectionComplete: |
|
82 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - EFaceDetectionComplete"))); |
|
83 iObserver.FaceDetectionComplete(KErrNone); |
|
84 break; |
|
85 case EFaceCroppingComplete: |
|
86 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - EFaceCroppingComplete"))); |
|
87 iObserver.FaceCroppingComplete(KErrNone); |
|
88 break; |
|
89 case EFaceAddedToExif: |
|
90 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - EFaceAddedToExif"))); |
|
91 iObserver.FaceCoordinatesAdded(aErrorCode); |
|
92 break; |
|
93 case EFaceRemovedFromExif: |
|
94 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - EFaceRemovedFromExif"))); |
|
95 iObserver.FaceCoordinatesRemoved(aErrorCode); |
|
96 break; |
|
97 case ESingleFaceDetectionComplete: |
|
98 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - ESingleFaceDetectionComplete"))); |
|
99 iObserver.SingleFaceDetectionComplete(KErrNone); |
|
100 break; |
|
101 case EFaceDetectionCancelled: |
|
102 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - EFaceDetectionCancelled"))); |
|
103 iObserver.StartSingleFaceDetection();*/ |
|
104 default: |
|
105 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents - Error in BGPS processing"))); |
|
106 iObserver.HandleError(aErrorCode); |
|
107 break; |
|
108 } |
|
109 DP0_IMAGIC((_L("CIEImageProcessingImp::HandleEvents--"))); |
|
110 } |
|
111 |
|
112 |
|
113 void CIEImageProcessingImp::GenerateTN(const TDesC& aMGDir, const TDesC& aTNDir) |
|
114 { |
|
115 DP0_IMAGIC((_L("CIEImageProcessingImp::GenerateTN ++"))); |
|
116 |
|
117 iIEBgpClient.GenerateThumbnails(iImagicBGPSAO->iStatus,aMGDir,aTNDir); |
|
118 iImagicBGPSAO->ActivateTNCreatorAO(); |
|
119 |
|
120 DP0_IMAGIC((_L("CIEImageProcessingImp::GenerateTN --"))); |
|
121 } |
|
122 |
|
123 void CIEImageProcessingImp::CancelTNGeneration() |
|
124 { |
|
125 DP0_IMAGIC((_L("CIEImageProcessingImp::CancelTNGeneration ++"))); |
|
126 |
|
127 iIEBgpClient.CancelTNGeneration(); |
|
128 |
|
129 DP0_IMAGIC((_L("CIEImageProcessingImp::CancelTNGeneration --"))); |
|
130 } |
|
131 |
|
132 |
|
133 void CIEImageProcessingImp::GenerateTN(const TDesC& aMGDir, const TDesC& aTNDir, const TSize &aSize) |
|
134 { |
|
135 DP0_IMAGIC((_L("CIEImageProcessingImp::GenerateTN ++"))); |
|
136 |
|
137 iIEBgpClient.GenerateThumbnails(iImagicBGPSAO->iStatus,aMGDir,aTNDir,aSize); |
|
138 iImagicBGPSAO->ActivateTNCreatorAO(); |
|
139 |
|
140 DP0_IMAGIC((_L("CIEImageProcessingImp::GenerateTN --"))); |
|
141 } |
|
142 |
|
143 void CIEImageProcessingImp::GenerateTN(const TDesC& aMGDir, const TDesC& aTNDir, const TSize &aSize, CFbsBitmap* aSrcBitmap) |
|
144 { |
|
145 DP0_IMAGIC((_L("CIEImageProcessingImp::GenerateTN ++"))); |
|
146 |
|
147 iIEBgpClient.GenerateThumbnails(iImagicBGPSAO->iStatus,aMGDir,aTNDir,aSize,aSrcBitmap); |
|
148 iImagicBGPSAO->ActivateTNCreatorAO(); |
|
149 |
|
150 DP0_IMAGIC((_L("CIEImageProcessingImp::GenerateTN --"))); |
|
151 } |
|
152 |
|
153 |
|
154 // EOF |