Changeset View
Changeset View
Standalone View
Standalone View
src/file/fileindexerconfig.h
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef BALOO_FILEINDEXER_CONFIG_H_ | 21 | #ifndef BALOO_FILEINDEXER_CONFIG_H_ | ||
22 | #define BALOO_FILEINDEXER_CONFIG_H_ | 22 | #define BALOO_FILEINDEXER_CONFIG_H_ | ||
23 | 23 | | |||
24 | #include <QObject> | 24 | #include <QObject> | ||
25 | #include <QList> | 25 | #include <QList> | ||
26 | #include <QSet> | 26 | #include <QSet> | ||
27 | #include <QDebug> | ||||
27 | 28 | | |||
28 | #include "regexpcache.h" | 29 | #include "regexpcache.h" | ||
29 | 30 | | |||
30 | class BalooSettings; | 31 | class BalooSettings; | ||
31 | 32 | | |||
32 | namespace Baloo | 33 | namespace Baloo | ||
33 | { | 34 | { | ||
34 | 35 | | |||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | |||||
163 | private: | 164 | private: | ||
164 | 165 | | |||
165 | void buildFolderCache(); | 166 | void buildFolderCache(); | ||
166 | void buildExcludeFilterRegExpCache(); | 167 | void buildExcludeFilterRegExpCache(); | ||
167 | void buildMimeTypeCache(); | 168 | void buildMimeTypeCache(); | ||
168 | 169 | | |||
169 | BalooSettings *m_settings; | 170 | BalooSettings *m_settings; | ||
170 | 171 | | |||
171 | /// Caching cleaned up list (no duplicates, no useless entries, etc.) | 172 | struct FolderConfig | ||
172 | QList<QPair<QString, bool> > m_folderCache; | 173 | { | ||
174 | QString path; | ||||
175 | bool isIncluded; | ||||
176 | | ||||
177 | /// Sort by path length, and on ties lexicographically. | ||||
178 | /// Longest path first | ||||
179 | bool operator<(const FolderConfig& other) const; | ||||
180 | }; | ||||
181 | | ||||
182 | class FolderCache : public std::vector<FolderConfig> | ||||
183 | { | ||||
184 | public: | ||||
185 | void cleanup(); | ||||
186 | | ||||
187 | bool addFolderConfig(const FolderConfig&); | ||||
188 | bool updateFolderConfig(const FolderConfig&); | ||||
189 | }; | ||||
190 | friend QDebug operator<<(QDebug dbg, const FolderConfig& config); | ||||
191 | | ||||
192 | /// Caching cleaned up list (no duplicates, no non-default entries, etc.) | ||||
193 | FolderCache m_folderCache; | ||||
173 | /// Whether the folder cache needs to be rebuilt the next time it is used | 194 | /// Whether the folder cache needs to be rebuilt the next time it is used | ||
174 | bool m_folderCacheDirty; | 195 | bool m_folderCacheDirty; | ||
175 | 196 | | |||
176 | /// cache of regexp objects for all exclude filters | 197 | /// cache of regexp objects for all exclude filters | ||
177 | /// to prevent regexp parsing over and over | 198 | /// to prevent regexp parsing over and over | ||
178 | RegExpCache m_excludeFilterRegExpCache; | 199 | RegExpCache m_excludeFilterRegExpCache; | ||
179 | 200 | | |||
180 | /// A set of mimetypes which should never be indexed | 201 | /// A set of mimetypes which should never be indexed | ||
181 | QSet<QString> m_excludeMimetypes; | 202 | QSet<QString> m_excludeMimetypes; | ||
182 | 203 | | |||
183 | bool m_indexHidden; | 204 | bool m_indexHidden; | ||
184 | bool m_onlyBasicIndexing; | 205 | bool m_onlyBasicIndexing; | ||
185 | 206 | | |||
186 | StorageDevices* m_devices; | 207 | StorageDevices* m_devices; | ||
187 | 208 | | |||
188 | const uint m_maxUncomittedFiles; | 209 | const uint m_maxUncomittedFiles; | ||
189 | }; | 210 | }; | ||
190 | 211 | | |||
212 | QDebug operator<<(QDebug dbg, const FileIndexerConfig::FolderCache::value_type&); | ||||
213 | | ||||
191 | } | 214 | } | ||
192 | 215 | | |||
193 | #endif | 216 | #endif |