|
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: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef CXEFILENAMEGENERATORSYMBIAN_H |
|
18 #define CXEFILENAMEGENERATORSYMBIAN_H |
|
19 |
|
20 #include <QString> |
|
21 #include "cxefilenamegenerator.h" |
|
22 #include "cxenamespace.h" |
|
23 #include "cxeerror.h" |
|
24 |
|
25 class RFs; |
|
26 class CxeSettings; |
|
27 static const int KCamMonthFolderNameLength = 8; |
|
28 |
|
29 /** |
|
30 * CxeFilenameGeneratorSymbian provides file names for saving images and videos. |
|
31 */ |
|
32 class CxeFilenameGeneratorSymbian : public CxeFilenameGenerator |
|
33 { |
|
34 public: |
|
35 |
|
36 CxeFilenameGeneratorSymbian(CxeSettings &settings, Cxe::CameraMode mode); |
|
37 virtual ~CxeFilenameGeneratorSymbian(); |
|
38 |
|
39 public: |
|
40 |
|
41 CxeError::Id init(Cxe::CameraMode mode); |
|
42 void startNewImageFilenameSequence(); |
|
43 CxeError::Id nextImageFilenameInSequence(QString &filename, const QString &fileExt); |
|
44 CxeError::Id generateFilename(QString &filename, const QString &fileExt); |
|
45 void raiseCounterValue(); |
|
46 |
|
47 private: |
|
48 |
|
49 // Private methods |
|
50 |
|
51 int checkExistence(const QString& path); |
|
52 int ensureExists(const QString& path, bool& created); |
|
53 bool spaceAvailable(int &driveIndex, TInt64 minSpaceInBytes); |
|
54 int selectDrive(int &drive); |
|
55 void initBasePath(QString &path, int drive); |
|
56 int initMonthFolders(); |
|
57 int computeMonthCounter(QString &path, QString& monthFolder, int &monthCounter); |
|
58 void computeFolderSuffix(int folderNumber, QString &suffix); |
|
59 int selectFolder(QString &path); |
|
60 void resetCounters(QString &monthFolder); |
|
61 int generateUniqueFileName(QString &filePath, QString &fileName, const QString &ext); |
|
62 |
|
63 private: |
|
64 |
|
65 // FileSystem object |
|
66 RFs &mFs; |
|
67 |
|
68 // Reference of SettingsImp (not owned) |
|
69 CxeSettings &mSettings; |
|
70 // Current mode: image/video |
|
71 Cxe::CameraMode mCurrentMode; |
|
72 |
|
73 /** |
|
74 * Base paths for image and video files: (E:\images\camera\). |
|
75 */ |
|
76 QString mImagesPath; |
|
77 QString mVideosPath; |
|
78 |
|
79 // Month folder name: YYMMDD - common for image and video |
|
80 QString mCurrentMonth; |
|
81 |
|
82 // Month counters for image and video modes. |
|
83 // Used for computing two digit postfix for month folders |
|
84 int mMonthCounterImage; |
|
85 int mMonthCounterVideo; |
|
86 |
|
87 // Last used image and video numbers |
|
88 int mImageCounter; |
|
89 int mVideoCounter; |
|
90 |
|
91 }; |
|
92 |
|
93 #endif // CXEFILENAMEGENERATORSYMBIAN_H |