5
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2007 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 the License "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:
|
|
13 |
*
|
|
14 |
* Description: This Class is observer class for thumbnail generation request
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef MGTHUMBOBSERVER_H_
|
|
19 |
#define MGTHUMBOBSERVER_H_
|
|
20 |
|
|
21 |
#include<e32base.h>
|
|
22 |
#include<e32cmn.h>
|
|
23 |
#include<thumbnailmanager.h>
|
|
24 |
#include<thumbnailmanagerobserver.h>
|
|
25 |
|
|
26 |
class CThumbnailManager;
|
|
27 |
class MThumbnailObserver;
|
|
28 |
const TInt KNegative = -1;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* TThumbnailRequestInfo class This class contains the information of thumbanil generation request
|
|
32 |
*
|
|
33 |
* @since Series60 v3.2
|
|
34 |
*/
|
|
35 |
|
|
36 |
class TThumbnailRequestInfo
|
|
37 |
{
|
|
38 |
public:
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Constructor
|
|
42 |
*/
|
|
43 |
|
|
44 |
TThumbnailRequestInfo():iObserver(NULL),iThumbnailPath(NULL),iTransactionId(KNegative),iThumbnailRequestId(KNegative)
|
|
45 |
{
|
|
46 |
|
|
47 |
}
|
|
48 |
|
|
49 |
public:
|
|
50 |
/**
|
|
51 |
*Pointer to instance of MThumbnailObserver
|
|
52 |
*/
|
|
53 |
MThumbnailObserver* iObserver;
|
|
54 |
/**
|
|
55 |
*Thumbnail path
|
|
56 |
*/
|
|
57 |
HBufC* iThumbnailPath;
|
|
58 |
/**
|
|
59 |
*Transaction Id
|
|
60 |
*/
|
|
61 |
TInt32 iTransactionId;
|
|
62 |
/**
|
|
63 |
*It is thumbanil request id
|
|
64 |
*/
|
|
65 |
|
|
66 |
TThumbnailRequestId iThumbnailRequestId;
|
|
67 |
|
|
68 |
};
|
|
69 |
|
|
70 |
/**
|
|
71 |
* CThumbnailObserver class
|
|
72 |
* @since Series60 v3.2
|
|
73 |
*/
|
|
74 |
class CThumbnailObserver: public CActive ,public MThumbnailManagerObserver
|
|
75 |
{
|
|
76 |
public:
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Two-phased constructor
|
|
80 |
* @return CThumbnailObserver* Returns the instance of
|
|
81 |
* CThumbnailObserver.
|
|
82 |
*/
|
|
83 |
|
|
84 |
static CThumbnailObserver* NewL();
|
|
85 |
/**
|
|
86 |
* This method adds the thumbnail request information to observer
|
|
87 |
*@param aObserver Observer
|
|
88 |
*@param aTransactionID TransactionId
|
|
89 |
*@param aThumbnailPath Path where thumbnail will be saved
|
|
90 |
*@param aThumbnailRequestId It request id of thumbnail generation request
|
|
91 |
* @return void
|
|
92 |
*/
|
|
93 |
void AddToObserverL(MThumbnailObserver* aObserver,TInt32 aTransactionID ,TDesC& aThumbnailPath , TThumbnailRequestId aThumbnailRequestId);
|
|
94 |
/**
|
|
95 |
* This method is derived from MThumbnailManagerObserver
|
|
96 |
*@param aThumbnail Thumbnaildata
|
|
97 |
*@param aThumbnailRequestId It request id of thumbnail generation request
|
|
98 |
* @return void
|
|
99 |
*/
|
|
100 |
virtual void ThumbnailPreviewReady(MThumbnailData& aThumbnail, TThumbnailRequestId aId);
|
|
101 |
/**
|
|
102 |
* This method is derived from MThumbnailManagerObserver
|
|
103 |
*@param aError Error returned to callback method
|
|
104 |
*@param aThumbnail Thumbnaildata
|
|
105 |
*@param aThumbnailRequestId It request id of thumbnail generation request
|
|
106 |
* @return void
|
|
107 |
*/
|
|
108 |
virtual void ThumbnailReady(TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId);
|
|
109 |
/**
|
|
110 |
* Destructor
|
|
111 |
*/
|
|
112 |
~CThumbnailObserver();
|
|
113 |
/**
|
|
114 |
* This method cancels the thumbnail generation request
|
|
115 |
*@param aTransactionID Transaction Id
|
|
116 |
* @return TInt it returns KErrNone if request is canceled otherwise system wide error
|
|
117 |
*/
|
|
118 |
TInt Cancel(TInt32 aTransactionID);
|
|
119 |
/**
|
|
120 |
* This method sets the thumbnail manager to observer class
|
|
121 |
*@param aThumbnailManager pointer to thumbnail manager
|
|
122 |
* @return void
|
|
123 |
*/
|
|
124 |
void SetThumbnailMangager(CThumbnailManager* aThumbnailManager);
|
|
125 |
/**
|
|
126 |
* User will call this method when thumbnail already exists
|
|
127 |
* @return void
|
|
128 |
*/
|
|
129 |
void ThumbnailAlreadyExists();
|
|
130 |
public:
|
|
131 |
/**
|
|
132 |
* Methods derived from CActive
|
|
133 |
* @return void
|
|
134 |
*/
|
|
135 |
|
|
136 |
void DoCancel();
|
|
137 |
/**
|
|
138 |
* Methods derived from CActive
|
|
139 |
* @return void
|
|
140 |
*/
|
|
141 |
|
|
142 |
void RunL();
|
|
143 |
|
|
144 |
private:
|
|
145 |
/**
|
|
146 |
* Constructor
|
|
147 |
*/
|
|
148 |
|
|
149 |
CThumbnailObserver();
|
|
150 |
private:
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Pointer to thumbnailManager
|
|
154 |
*/
|
|
155 |
|
|
156 |
CThumbnailManager* iThumbnailManager;
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Array of TThumbnailRequestInfo
|
|
160 |
*/
|
|
161 |
|
|
162 |
RArray<TThumbnailRequestInfo> iThumbnailRequestArray;
|
|
163 |
|
|
164 |
};
|
|
165 |
|
|
166 |
#endif /* MGTHUMBOBSERVER_H_ */
|