|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef VIDEOEDITORUTILS_H |
|
21 #define VIDEOEDITORUTILS_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <coemain.h> |
|
26 #include <VedCommon.h> |
|
27 #include "VideoEditorCommon.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class RFs; |
|
31 class TVeiSettings; |
|
32 |
|
33 // CONSTANTS |
|
34 const TInt KManualVideoEditorIconFileId = 0; |
|
35 const TInt KVideoEditorUiComponentsIconFileId = 1; |
|
36 const TInt KVeiNonScalableIconFileId = 2; |
|
37 |
|
38 /** CLASS: VideoEditorUtils |
|
39 * |
|
40 * Static utility class. |
|
41 * |
|
42 */ |
|
43 NONSHARABLE_CLASS( VideoEditorUtils ) |
|
44 { |
|
45 public: |
|
46 |
|
47 /** @name Methods:*/ |
|
48 //@{ |
|
49 |
|
50 /** GenerateNewDocumentNameL |
|
51 * |
|
52 * Generates a new name for the loaded document at the startup. |
|
53 * |
|
54 * The generated file is located on the MMC dy default. If the |
|
55 * MMC is full or not present, the file will be in phone memory. |
|
56 * Uses internally VideoFitsToDriveL to check the space. |
|
57 * |
|
58 * Media gallery album id list now obsolete after Media Gallery removal. |
|
59 * If an invalid album list is passed the behaviour is undefined. |
|
60 * |
|
61 * @param aFsSession - |
|
62 * @param aSourceFileName - |
|
63 * @param aTargetFileName - |
|
64 * @param aOutputFormat - video format of the target file |
|
65 * @param aTargetSizeEstimate - the expected target file size. |
|
66 * This value is used to check whether there is enough space on the disks. |
|
67 * @param aMemoryInUse - where the target file is created. |
|
68 * @return - KErrNone if successfully generated file name |
|
69 * KSIEENotEnoughDiskSpace if no disk space to save the file |
|
70 * (size of aSourceFileName used to check the space) |
|
71 * KSIEEOpenFile if the source filename is invalid |
|
72 */ |
|
73 IMPORT_C static TInt GenerateNewDocumentNameL ( |
|
74 RFs& aFsSession, |
|
75 const TDesC& aSourceFileName, |
|
76 TDes& aTargetFileName, |
|
77 TVedVideoFormat aOutputFormat, |
|
78 TInt aTargetSizeEstimate, |
|
79 VideoEditor::TMemory aMemoryInUse = VideoEditor::EMemAutomatic |
|
80 ); |
|
81 |
|
82 /** GenerateFileNameL |
|
83 * |
|
84 * Generates a new file name. |
|
85 * |
|
86 * Generates a file name into a given drive. Increments a running number |
|
87 * at the end of the file name until a file with the same name doesn't exist. |
|
88 * Uses internally VideoFitsToDriveL to check the space. |
|
89 * |
|
90 * |
|
91 * @param aFsSession - |
|
92 * @param aSourceFileName - name of the source file |
|
93 * @param aTargetFileName - name of the new file |
|
94 * @param aOutputFormat - video format of the target file |
|
95 * @param aTargetSizeEstimate - the expected target file size. |
|
96 * This value is used to check whether there is enough space on the disks. |
|
97 * @param aDrive - drive where the target file is created. |
|
98 * @return - KErrNone if successfully generated file name |
|
99 * KSIEENotEnoughDiskSpace if no disk space to save the file |
|
100 * (size of aSourceFileName used to check the space) |
|
101 * KSIEEOpenFile if the source filename is invalid |
|
102 */ |
|
103 IMPORT_C static TInt GenerateFileNameL ( |
|
104 RFs& aFsSession, |
|
105 const TDesC& aSourceFileName, |
|
106 TDes& aTargetFileName, |
|
107 TVedVideoFormat aOutputFormat, |
|
108 TInt aTargetSizeEstimate, |
|
109 TFileName aDrive ); |
|
110 |
|
111 |
|
112 /** NotifyNewMediaDocumentL |
|
113 * |
|
114 * Notifies the system that a new media file has been saved, |
|
115 * making it visible in the Media Gallery. |
|
116 * |
|
117 * @param aFileName - |
|
118 * @return - |
|
119 */ |
|
120 IMPORT_C static void NotifyNewMediaDocumentL ( |
|
121 RFs& aFsSession, |
|
122 const TDesC& aFileName |
|
123 ); |
|
124 |
|
125 /** GetMGAlbumsListForMediaFileL |
|
126 * |
|
127 * Finds out which Media Gallery Albums the file belongs to. |
|
128 * (if compiled without album support, this function |
|
129 * returns an empty array). Album support is now removed. |
|
130 * |
|
131 * @param aFileName - The media file |
|
132 * @param aAlbumList - |
|
133 * On return, contains the ID:s of the Media Gallery |
|
134 * albums the file belongs to. |
|
135 * If the list is not empty, it is retained and |
|
136 * new IDs are appended into the list. |
|
137 * @return - |
|
138 */ |
|
139 IMPORT_C static void GetMGAlbumsListForMediaFileL ( |
|
140 RArray<TInt>& aAlbumIdList, |
|
141 const TDesC& aFilename |
|
142 ); |
|
143 |
|
144 /** AddMediaFileToMGAlbumL |
|
145 * |
|
146 * Add the given media file to the given album. |
|
147 * (if compiled without album support, this function |
|
148 * does nothing) |
|
149 * |
|
150 * @param aFileName - |
|
151 * @param aAlbumId - |
|
152 * @return - |
|
153 */ |
|
154 IMPORT_C static void AddMediaFileToMGAlbumL ( |
|
155 const TDesC& aFileName, |
|
156 TInt aAlbumId |
|
157 ); |
|
158 |
|
159 /** IsEnoughFreeSpaceToSaveL |
|
160 * |
|
161 * Checks whether there is enough disk space to save |
|
162 * the given file. |
|
163 * |
|
164 * @param aFsSession - |
|
165 * @param aFileName - The path to save (only drive part needed) |
|
166 * @param aSizeEstimate - The space required for the file to save |
|
167 * @return - TBool |
|
168 */ |
|
169 IMPORT_C static TBool IsEnoughFreeSpaceToSaveL( |
|
170 RFs& aFsSession, |
|
171 const TDesC& aFileName, |
|
172 TInt aSizeEstimate ); |
|
173 |
|
174 /** IsDrmProtectedL |
|
175 * |
|
176 * Checks whether the given file is DRM protected. |
|
177 * |
|
178 * @param aFileName - The path of the file to check |
|
179 * @return - TBool |
|
180 */ |
|
181 IMPORT_C static TBool IsDrmProtectedL( const TDesC& aFileName ); |
|
182 |
|
183 /** IconFileNameAndPath |
|
184 * |
|
185 * Returns file name and path for one of the icon files used in this module. |
|
186 * Currently there is the primary icon file (MIF file), and the secondary |
|
187 * icon file (a MBM file), which contains the non-scalable (bitmap) graphics. |
|
188 * |
|
189 * @param TInt aInconFileIndex - Which file. Supported values: |
|
190 * KManualVideoEditorIconFileId |
|
191 * KVideoEditorUiComponentsIconFileId |
|
192 * KVeiNonScalableIconFileId |
|
193 * @return TFileName - |
|
194 */ |
|
195 IMPORT_C static TFileName IconFileNameAndPath( TInt aInconFileIndex ); |
|
196 |
|
197 /** IsLandscapeScreenOrientation |
|
198 * |
|
199 * Check if the screen is in landscape mode. In other words, see |
|
200 * if the X dimension of the screen is greater than the Y dimendion. |
|
201 * |
|
202 * @param - |
|
203 * @return - TBool |
|
204 */ |
|
205 IMPORT_C static TBool IsLandscapeScreenOrientation(); |
|
206 |
|
207 |
|
208 /** LaunchQueryDialogL |
|
209 * |
|
210 * Launches a confirmation query dialog. |
|
211 * |
|
212 * @param aPrompt - dialog prompt descriptor |
|
213 * @return - |
|
214 */ |
|
215 IMPORT_C static TInt LaunchQueryDialogL (const TDesC & aPrompt); |
|
216 |
|
217 /** LaunchListQueryDialogL |
|
218 * |
|
219 * Launches a confirmation query dialog. |
|
220 * |
|
221 * @param aPrompt - dialog prompt descriptor |
|
222 * @return 0 if user selects "No", otherwise 1 |
|
223 */ |
|
224 IMPORT_C static TInt LaunchListQueryDialogL (MDesCArray * aTextItems, |
|
225 const TDesC & aPrompt); |
|
226 |
|
227 /* LaunchSaveVideoQueryL |
|
228 * |
|
229 * Launches a query dialog "Save video:" with items |
|
230 * "Replace original" and "Save with a new name" |
|
231 * |
|
232 * @param - |
|
233 * @return - list query id or -1 if the user selects No |
|
234 */ |
|
235 IMPORT_C static TInt LaunchSaveVideoQueryL (); |
|
236 |
|
237 |
|
238 /* LaunchSaveChangesQueryL |
|
239 * |
|
240 * Launches a query dialog "Save changes?" query. |
|
241 * |
|
242 * @param - |
|
243 * @return 0 if user selects "No", otherwise 1 |
|
244 */ |
|
245 IMPORT_C static TInt LaunchSaveChangesQueryL (); |
|
246 |
|
247 //@} |
|
248 |
|
249 private: |
|
250 |
|
251 /** @name Methods:*/ |
|
252 //@{ |
|
253 |
|
254 /** FindSuffix |
|
255 * |
|
256 * Finds the offset of the edited file name suffix of form "-NNN", where |
|
257 * NNN is the edit sequence number. |
|
258 * |
|
259 * @param aName - File name without extension |
|
260 * @return - |
|
261 */ |
|
262 static TInt FindSuffix ( |
|
263 const TDesC & aName |
|
264 ); |
|
265 |
|
266 /** FileAlreadyExistsL |
|
267 * |
|
268 * Check if a file with the specified name already exista on the system. |
|
269 * |
|
270 * @param - aFs |
|
271 * @param - aFileName |
|
272 * @return - TBool |
|
273 */ |
|
274 static TBool FileAlreadyExistsL ( |
|
275 RFs& aFsSession, |
|
276 const TDesC& aFileName |
|
277 ); |
|
278 |
|
279 //@} |
|
280 }; |
|
281 |
|
282 #endif |
|
283 |
|
284 // End of File |
|
285 |