21 |
21 |
22 #include <QString> |
22 #include <QString> |
23 #include <QList> |
23 #include <QList> |
24 #include <QStringList> |
24 #include <QStringList> |
25 |
25 |
26 class FmDriveDetailsDataGroup |
26 /* |
27 { |
27 \class FmDriveDetailsSize |
28 public: |
28 \brief The class FmDriveDetailsSize used to store view details result. |
29 enum TDataGroups{ |
29 */ |
30 EGroupImages = 0, |
|
31 EGroupSoundFiles, |
|
32 EGroupMidpJava, |
|
33 EGroupNativeApps, |
|
34 EGroupVideos, |
|
35 EGroupDocuments, |
|
36 EGroupCalendar, |
|
37 EGroupContacts, |
|
38 EGroupMessages, |
|
39 EGroupOthers |
|
40 }; |
|
41 |
|
42 public: |
|
43 FmDriveDetailsDataGroup( TDataGroups dataGroups, QStringList typeFilters ) |
|
44 : mDataGroups( dataGroups ), mTypeFilters( typeFilters ) {} |
|
45 FmDriveDetailsDataGroup( const FmDriveDetailsDataGroup &other ) |
|
46 { |
|
47 *this = other; |
|
48 } |
|
49 |
|
50 FmDriveDetailsDataGroup &operator= ( const FmDriveDetailsDataGroup &rhs ) |
|
51 { |
|
52 this->mDataGroups = rhs.mDataGroups; |
|
53 this->mTypeFilters = rhs.mTypeFilters; |
|
54 return *this; |
|
55 } |
|
56 |
|
57 TDataGroups dataGroups() const { return mDataGroups; } |
|
58 QStringList typeFilters() const { return mTypeFilters; } |
|
59 |
|
60 private: |
|
61 TDataGroups mDataGroups; |
|
62 QStringList mTypeFilters; |
|
63 }; |
|
64 |
|
65 class FmDriveDetailsSize |
30 class FmDriveDetailsSize |
66 { |
31 { |
67 public: |
32 public: |
68 FmDriveDetailsSize( FmDriveDetailsDataGroup::TDataGroups dataGroups, quint64 size ) |
33 enum TDataType{ |
69 : mDataGroups( dataGroups ), mSize( size ) {} |
34 ETypeImages = 0, |
|
35 ETypeSoundFiles, |
|
36 ETypeMidpJava, |
|
37 ETypeNativeApps, |
|
38 ETypeVideos, |
|
39 ETypeDocuments, |
|
40 ETypeCalendar, |
|
41 ETypeContacts, |
|
42 ETypeMessages, |
|
43 ETypeOthers |
|
44 }; |
|
45 |
|
46 public: |
|
47 FmDriveDetailsSize( TDataType dataType, quint64 size ) |
|
48 : mDataType( dataType ), mSize( size ) {} |
70 FmDriveDetailsSize( const FmDriveDetailsSize &other ) |
49 FmDriveDetailsSize( const FmDriveDetailsSize &other ) |
71 { |
50 { |
72 *this = other; |
51 *this = other; |
73 } |
52 } |
74 |
53 |
75 FmDriveDetailsSize &operator= ( const FmDriveDetailsSize &rhs ) |
54 FmDriveDetailsSize &operator= ( const FmDriveDetailsSize &rhs ) |
76 { |
55 { |
77 this->mDataGroups = rhs.mDataGroups; |
56 this->mDataType = rhs.mDataType; |
78 this->mSize = rhs.mSize; |
57 this->mSize = rhs.mSize; |
79 return *this; |
58 return *this; |
80 } |
59 } |
81 |
60 |
82 FmDriveDetailsDataGroup::TDataGroups dataGroups() const { return mDataGroups; } |
61 /*! |
|
62 request the stored data type |
|
63 */ |
|
64 TDataType dataType() const { return mDataType; } |
|
65 |
|
66 /*! |
|
67 request the stored size that related to data type |
|
68 */ |
83 quint64 size() const { return mSize; } |
69 quint64 size() const { return mSize; } |
84 |
70 |
85 private: |
71 private: |
86 FmDriveDetailsDataGroup::TDataGroups mDataGroups; |
72 /*! |
|
73 store the data type |
|
74 */ |
|
75 TDataType mDataType; |
|
76 |
|
77 /*! |
|
78 store the size that related to mDataType |
|
79 */ |
87 quint64 mSize; |
80 quint64 mSize; |
88 }; |
81 }; |
89 |
82 |
|
83 /* |
|
84 \class FmDriveDetailsDataGroup |
|
85 \brief The class FmDriveDetailsDataGroup used to store command of get size of absolute file path. |
|
86 */ |
|
87 class FmDriveDetailsDataGroup |
|
88 { |
|
89 public: |
|
90 FmDriveDetailsDataGroup( FmDriveDetailsSize::TDataType dataType, |
|
91 QStringList filePathList ) |
|
92 : mDataType( dataType ), mFilePath( filePathList ) |
|
93 { |
|
94 } |
|
95 FmDriveDetailsDataGroup( const FmDriveDetailsDataGroup &other ) |
|
96 { |
|
97 *this = other; |
|
98 } |
|
99 |
|
100 FmDriveDetailsDataGroup &operator= ( const FmDriveDetailsDataGroup &rhs ) |
|
101 { |
|
102 this->mDataType = rhs.mDataType; |
|
103 this->mFilePath = rhs.mFilePath; |
|
104 return *this; |
|
105 } |
|
106 |
|
107 FmDriveDetailsSize::TDataType dataType() const { return mDataType; } |
|
108 QStringList pathList() const { return mFilePath; } |
|
109 private: |
|
110 /*! |
|
111 Store which data type does mFilePath belong to. |
|
112 */ |
|
113 FmDriveDetailsSize::TDataType mDataType; |
|
114 |
|
115 /*! |
|
116 Store absolute file path that will used to calcuate whole data size related to mDataType |
|
117 */ |
|
118 QStringList mFilePath; |
|
119 }; |
|
120 |
|
121 /* |
|
122 \class FmDriveDetailsContent |
|
123 \brief The class FmDriveDetailsContent is the interface of view details feature |
|
124 */ |
90 class FmDriveDetailsContent |
125 class FmDriveDetailsContent |
91 { |
126 { |
92 public: |
127 public: |
93 static QList<FmDriveDetailsDataGroup*> queryDetailsContent(); |
128 /*! |
|
129 Gets data size for drive |
|
130 \a driveName which drive is searching |
|
131 \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList |
|
132 \a isStopped isStopped will be set as true if user cancel this operation |
|
133 return Filemanage wide error. Please refer to fmdefine.h |
|
134 */ |
94 static int querySizeofContent( |
135 static int querySizeofContent( |
95 const QString &driveName, QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped ); |
136 const QString &driveName, QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped ); |
96 |
137 |
|
138 private: |
|
139 /*! |
|
140 Gets data size(related to file type,e.g. image, sound) by traverse designated drive name. |
|
141 provide size except the path related to absolute path(getDataSizeByAbsolutePath) |
|
142 \sa driveName which drive is searching |
|
143 \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList |
|
144 \a isStopped isStopped will be set as true if user cancel this operation |
|
145 return Filemanage wide error. Please refer to fmdefine.h |
|
146 */ |
|
147 static int getDataSizeByTraversePath( const QString &driveName, |
|
148 QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped ); |
|
149 |
|
150 /*! |
|
151 Gets data size for single FmDriveDetailsDataGroup, the method is find file of absolute path |
|
152 \a driveName which drive is searching |
|
153 \a dataGroup which dataGroup is searching, for example, EGroupContacts... |
|
154 \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList |
|
155 \a isStopped isStopped will be set as true if user cancel this operation |
|
156 return Filemanage wide error. Please refer to fmdefine.h |
|
157 */ |
|
158 static int getDataSizeByAbsolutePath( const QString &driveName, const FmDriveDetailsDataGroup &dataGroup, |
|
159 QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped ); |
97 }; |
160 }; |
98 |
161 |
99 class FmFolderDetails |
162 class FmFolderDetails |
100 { |
163 { |
101 public: |
164 public: |
102 |
165 |
|
166 /*! |
|
167 Gets details for a list of folders |
|
168 \a folderPathList folder path list |
|
169 \a numofFolders output how many folders and subfolders in the list |
|
170 \a numofFiles output how many files in the list |
|
171 \a totalSize output the total size |
|
172 \a isStopped isStopped will be set as true if user cancel this operation |
|
173 \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true |
|
174 return Filemanage wide error. Please refer to fmdefine.h |
|
175 */ |
103 static int queryDetailOfContentList( const QStringList folderPathList,int &numofFolders, |
176 static int queryDetailOfContentList( const QStringList folderPathList,int &numofFolders, |
104 int &numofFiles, quint64 &totalSize, volatile bool *isStopped, bool isSysHiddenIncluded = false ); |
177 int &numofFiles, quint64 &totalSize, volatile bool *isStopped, bool isSysHiddenIncluded = false ); |
105 |
178 /*! |
|
179 Gets details for a folder |
|
180 \a folderPath path of the folder |
|
181 \a numofSubFolders output how many subfolders in the list, not include itself |
|
182 \a numofFiles output how many files in the folder |
|
183 \a sizeofFolder output the size of folder |
|
184 \a isStopped isStopped will be set as true if user cancel this operation |
|
185 \a isSysHiddenIncluded will add QDir::Hidden | QDir::System into filter if true |
|
186 return Filemanage wide error. Please refer to fmdefine.h |
|
187 */ |
106 static int getNumofSubfolders( const QString &folderPath, int &numofSubFolders, |
188 static int getNumofSubfolders( const QString &folderPath, int &numofSubFolders, |
107 int &numofFiles, quint64 &sizeofFolder, |
189 int &numofFiles, quint64 &sizeofFolder, |
108 volatile bool *isStopped, bool isSysHiddenIncluded = false ); |
190 volatile bool *isStopped, bool isSysHiddenIncluded = false ); |
109 |
|
110 |
|
111 }; |
191 }; |
112 |
192 |
113 #endif /* FMDRIVEDETAILSTYPE_H */ |
193 #endif /* FMDRIVEDETAILSTYPE_H */ |
114 |
194 |