|
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 generates thumbnail for media (image/video) |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MGTHUMBNAILGENERATION_H_ |
|
19 #define MGTHUMBNAILGENERATION_H_ |
|
20 |
|
21 #include<e32base.h> |
|
22 #include<e32cmn.h> |
|
23 #include<e32def.h> |
|
24 |
|
25 const TInt KNegVal = -1; |
|
26 |
|
27 |
|
28 class MThumbnailObserver; |
|
29 class MResolution; |
|
30 class CThumbnailManager; |
|
31 class CThumbnailObserver; |
|
32 |
|
33 /** |
|
34 * CThumbnailGeneration class This class can be used to create instance of CThumbnailGeneration |
|
35 * |
|
36 * @since Series60 v3.2 |
|
37 */ |
|
38 class CThumbnailGeneration: public CBase |
|
39 { |
|
40 |
|
41 public : |
|
42 |
|
43 /** |
|
44 * Two-phased constructor |
|
45 * @return CThumbnailGeneration* Returns the instance of |
|
46 * CThumbnailGeneration. |
|
47 */ |
|
48 |
|
49 |
|
50 static CThumbnailGeneration* NewL(); |
|
51 /** |
|
52 * This method gives request to generate thumbnail of media file |
|
53 * @param aObserver Pointer to Observer |
|
54 * @param aTransactionID transaction id of thumbnail generation request |
|
55 * @param aUrl It is url of media file whose thumbnail is to be generated |
|
56 * @param aHeight It is required height of thumbnail |
|
57 * @param aWidth It is required width of thumbnail |
|
58 * @ return void |
|
59 */ |
|
60 |
|
61 void GetThumbnailL(MThumbnailObserver* aObserver,TInt32 aTransactionID, TDesC& aUrl, TInt aHeight =KNegVal, TInt aWidth =KNegVal); |
|
62 |
|
63 /** |
|
64 * Destructor |
|
65 * |
|
66 */ |
|
67 ~CThumbnailGeneration(); |
|
68 |
|
69 /** |
|
70 * Cancel method cancels the request of thumbnail generation |
|
71 * |
|
72 */ |
|
73 TInt Cancel(TInt32 aTransactionId); |
|
74 private : |
|
75 /** |
|
76 * Constructor |
|
77 * |
|
78 */ |
|
79 CThumbnailGeneration(); |
|
80 /** |
|
81 * Two phase constructor |
|
82 * |
|
83 */ |
|
84 void ConstructL(); |
|
85 private: |
|
86 |
|
87 /** |
|
88 * It gets the required size of thumbnail |
|
89 *@param aUrl Url of media file |
|
90 *@param aHeight height of the thumbnail |
|
91 *@param aWidth width of thumbnail |
|
92 *@return TSize Size of the thumbnail |
|
93 */ |
|
94 |
|
95 TSize GetthumbsizeL(TDesC& aUrl,TInt aHeight=KNegVal, TInt aWidth=KNegVal); |
|
96 |
|
97 /** |
|
98 * It calculates the size of thumbnail |
|
99 *@param aRes Resolution of media file |
|
100 *@param aHeight height of the thumbnail |
|
101 *@param aWidth width of thumbnail |
|
102 *@return TSize Size of the thumbnail |
|
103 */ |
|
104 TSize CalculateSize(TSize aRes, TInt aHeight = KNegVal, TInt aWidth = KNegVal); |
|
105 |
|
106 /** |
|
107 * It calculates the size of thumbnail |
|
108 *@param aUrl Url of media file |
|
109 *@return MResolution* Instance of media resolution |
|
110 */ |
|
111 MResolution* GetResolutionobjL(TDesC& aUrl); |
|
112 /** |
|
113 * Checks wehter the url is valid or not |
|
114 *@param aUrl Url of media file |
|
115 *@return void |
|
116 */ |
|
117 void IsUrlValidL(TDesC& aUrl); |
|
118 /** |
|
119 * Checks wehter the url is valid or not |
|
120 *@param aThumbpath Url of media file |
|
121 *@param aRefDir A refrence directory where thumbnail will be saved |
|
122 *@return TBool If thumbnail exists then it is true else false |
|
123 */ |
|
124 TBool IsThumbnailExistL(const TDesC& aThumbpath,const TDesC& aRefDir); |
|
125 /** |
|
126 * Creates the thumbnail path |
|
127 *@param aUrl Url of the media file |
|
128 *@param aThumbsize Thumbnail size |
|
129 *@param aRefDir A refrence directory where thumbnail will be saved |
|
130 *@param aThumbnailPath Path where thumbnail need to be saved |
|
131 *@return void |
|
132 */ |
|
133 void CreateThumbnailPathL(TDesC& aUrl, TSize aThumbsize,TDes& aRefDir ,TDes& aThumbnailPath); |
|
134 |
|
135 private: |
|
136 |
|
137 /** |
|
138 *Pointer to instance of CThumbnailObserver |
|
139 */ |
|
140 CThumbnailObserver* iThumbnailObserver; |
|
141 |
|
142 /** |
|
143 *Pointer to instance of CThumbnailManager |
|
144 */ |
|
145 CThumbnailManager* iThumbnailManager; |
|
146 |
|
147 }; |
|
148 |
|
149 #endif /* MGTHUMBNAILGENERATION_H_ */ |