Merge lp:~artmello/gallery-app/gallery-app-fix_1445755 into lp:gallery-app
- gallery-app-fix_1445755
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Bill Filler |
Approved revision: | 1334 |
Merged at revision: | 1328 |
Proposed branch: | lp:~artmello/gallery-app/gallery-app-fix_1445755 |
Merge into: | lp:gallery-app |
Diff against target: |
475 lines (+142/-35) 12 files modified
src/database/database.cpp (+5/-5) src/database/database.h (+2/-1) src/database/media-table.cpp (+54/-2) src/database/media-table.h (+4/-1) src/gallery-manager.cpp (+2/-3) src/media/media-monitor.cpp (+25/-8) src/media/media-monitor.h (+4/-3) src/util/resource.cpp (+35/-4) src/util/resource.h (+2/-0) tests/unittests/mediamonitor/tst_mediamonitor.cpp (+1/-1) tests/unittests/stubs/database_stub.cpp (+5/-5) tests/unittests/stubs/media-table_stub.cpp (+3/-2) |
To merge this branch: | bzr merge lp:~artmello/gallery-app/gallery-app-fix_1445755 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
system-apps-ci-bot | continuous-integration | Needs Fixing | |
Ubuntu Phablet Team | Pending | ||
Review via email: mp+304034@code.launchpad.net |
Commit message
Add support to blacklist directories from scan process based on regexp
Description of the change
Add support to blacklist directories from scan process based on regexp
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
- 1327. By Arthur Mello
-
Initialize blacklisted list correctly
- 1328. By Arthur Mello
-
Fix typo
- 1329. By Arthur Mello
-
Fix var name
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:1328
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:1329
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 1330. By Arthur Mello
-
Save conffig on the correct conf file
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:1330
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 1331. By Arthur Mello
-
Fix typo
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:1331
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 1332. By Arthur Mello
-
Delete from database entries that were added to blacklist afteralready scanned
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:1332
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 1333. By Arthur Mello
-
If regexp is a valid path add that to the SQL LIKE format
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:1333
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Bill Filler (bfiller) : | # |
- 1334. By Arthur Mello
-
Do not stop processing blacklist if there is no sdcard inserted
system-apps-ci-bot (system-apps-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:1334
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'src/database/database.cpp' |
2 | --- src/database/database.cpp 2014-11-25 16:24:12 +0000 |
3 | +++ src/database/database.cpp 2016-09-02 15:54:54 +0000 |
4 | @@ -21,6 +21,7 @@ |
5 | #include "database.h" |
6 | #include "album-table.h" |
7 | #include "media-table.h" |
8 | +#include "resource.h" |
9 | |
10 | #include <QFile> |
11 | #include <QSqlTableModel> |
12 | @@ -32,11 +33,10 @@ |
13 | * \param schemaDirectory directory of the SQL schema for the database |
14 | * \param parent |
15 | */ |
16 | -Database::Database(const QString &databaseDir, const QString &schemaDirectory, |
17 | - QObject* parent) : |
18 | +Database::Database(Resource *resource, QObject* parent) : |
19 | QObject(parent), |
20 | - m_databaseDirectory(databaseDir), |
21 | - m_sqlSchemaDirectory(schemaDirectory), |
22 | + m_databaseDirectory(resource->databaseDirectory()), |
23 | + m_sqlSchemaDirectory(resource->getRcUrl("sql").path()), |
24 | m_db(new QSqlDatabase()) |
25 | { |
26 | if (!QFile::exists(m_databaseDirectory)) { |
27 | @@ -47,7 +47,7 @@ |
28 | } |
29 | |
30 | m_albumTable = new AlbumTable(this, this); |
31 | - m_mediaTable = new MediaTable(this, this); |
32 | + m_mediaTable = new MediaTable(this, resource, this); |
33 | |
34 | // Open the database. |
35 | if (!openDB()) |
36 | |
37 | === modified file 'src/database/database.h' |
38 | --- src/database/database.h 2014-11-25 16:24:12 +0000 |
39 | +++ src/database/database.h 2016-09-02 15:54:54 +0000 |
40 | @@ -29,6 +29,7 @@ |
41 | |
42 | class QSqlDatabase; |
43 | class QSqlQuery; |
44 | +class Resource; |
45 | |
46 | const qint64 INVALID_ID = -1; |
47 | |
48 | @@ -40,7 +41,7 @@ |
49 | Q_OBJECT |
50 | |
51 | public: |
52 | - Database(const QString& databaseDir, const QString &schemaDirectory, QObject* parent = 0); |
53 | + Database(Resource *resource, QObject* parent = 0); |
54 | |
55 | ~Database(); |
56 | |
57 | |
58 | === modified file 'src/database/media-table.cpp' |
59 | --- src/database/media-table.cpp 2015-01-14 15:19:05 +0000 |
60 | +++ src/database/media-table.cpp 2016-09-02 15:54:54 +0000 |
61 | @@ -19,6 +19,7 @@ |
62 | |
63 | #include "media-table.h" |
64 | #include "database.h" |
65 | +#include "resource.h" |
66 | |
67 | #include <QApplication> |
68 | #include <QtSql> |
69 | @@ -28,8 +29,8 @@ |
70 | * \param db |
71 | * \param parent |
72 | */ |
73 | -MediaTable::MediaTable(Database* db, QObject* parent) |
74 | - : QObject(parent), m_db(db) |
75 | +MediaTable::MediaTable(Database* db, Resource *resource, QObject* parent) |
76 | + : QObject(parent), m_db(db), m_resource(resource) |
77 | { |
78 | } |
79 | |
80 | @@ -225,12 +226,63 @@ |
81 | return exposure_time; |
82 | } |
83 | |
84 | +void MediaTable::removeBlacklistedRows() |
85 | +{ |
86 | + if (!m_resource) |
87 | + return; |
88 | + |
89 | + // Get list of current /media external drives connected |
90 | + QString extDrivesPath("/media/" + qgetenv("USER") + "/"); |
91 | + QStringList extDrives; |
92 | + |
93 | + if (QDir(extDrivesPath).exists()) { |
94 | + extDrives = QDir(extDrivesPath).entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time); |
95 | + } |
96 | + |
97 | + // Expand current regular expressions to use existing external drives |
98 | + QStringList replacedRegExpList; |
99 | + foreach (const QString& regExp, m_resource->blacklistedDirectories()) { |
100 | + // If regular expression is a valid path add that to the support LIKE format |
101 | + if (QDir(regExp).exists()) { |
102 | + replacedRegExpList << regExp + "%"; |
103 | + continue; |
104 | + } |
105 | + |
106 | + // If regular expression is in the default format replace it with sdcard path |
107 | + if (!regExp.startsWith("/media/" + qgetenv("USER") + "/[^/]*")) |
108 | + continue; |
109 | + |
110 | + foreach (const QString &extDrive, extDrives) { |
111 | + QString replacedRegExp(regExp); |
112 | + replacedRegExp.replace("/media/" + qgetenv("USER") + "/[^/]*", "/media/" + qgetenv("USER") + "/" + extDrive); |
113 | + |
114 | + if (replacedRegExp.endsWith("/")) { |
115 | + replacedRegExpList << replacedRegExp + "%"; |
116 | + } else { |
117 | + replacedRegExpList << replacedRegExp + "/%"; |
118 | + } |
119 | + } |
120 | + } |
121 | + |
122 | + QSqlQuery query(*m_db->getDB()); |
123 | + query.prepare("DELETE FROM MediaTable WHERE filename LIKE :blacklisted"); |
124 | + |
125 | + foreach (const QString &blacklisted, replacedRegExpList) { |
126 | + query.bindValue(":blacklisted", blacklisted); |
127 | + if (!query.exec()) { |
128 | + m_db->logSqlError(query); |
129 | + } |
130 | + } |
131 | +} |
132 | + |
133 | /*! |
134 | * \brief MediaTable::emitAllRows goes through the whole DB and emits a row() signal |
135 | * for every single row with all the Database |
136 | */ |
137 | void MediaTable::emitAllRows() |
138 | { |
139 | + removeBlacklistedRows(); |
140 | + |
141 | QSqlQuery query(*m_db->getDB()); |
142 | query.prepare("SELECT * FROM MediaTable"); |
143 | if (!query.exec()) |
144 | |
145 | === modified file 'src/database/media-table.h' |
146 | --- src/database/media-table.h 2015-01-14 15:19:05 +0000 |
147 | +++ src/database/media-table.h 2016-09-02 15:54:54 +0000 |
148 | @@ -26,6 +26,7 @@ |
149 | #include <QObject> |
150 | |
151 | class Database; |
152 | +class Resource; |
153 | |
154 | /*! |
155 | * \brief The MediaTable class |
156 | @@ -35,7 +36,7 @@ |
157 | Q_OBJECT |
158 | |
159 | public: |
160 | - explicit MediaTable(Database* db, QObject *parent = 0); |
161 | + explicit MediaTable(Database* db, Resource *resource, QObject *parent = 0); |
162 | |
163 | qint64 getIdForMedia(const QString& filename); |
164 | |
165 | @@ -61,6 +62,7 @@ |
166 | |
167 | QDateTime getExposureTime(qint64 mediaId); |
168 | |
169 | + void removeBlacklistedRows(); |
170 | void emitAllRows(); |
171 | |
172 | signals: |
173 | @@ -70,6 +72,7 @@ |
174 | |
175 | private: |
176 | Database* m_db; |
177 | + Resource* m_resource; |
178 | }; |
179 | |
180 | #endif // MEDIATABLE_H |
181 | |
182 | === modified file 'src/gallery-manager.cpp' |
183 | --- src/gallery-manager.cpp 2016-01-18 22:09:06 +0000 |
184 | +++ src/gallery-manager.cpp 2016-09-02 15:54:54 +0000 |
185 | @@ -138,8 +138,7 @@ |
186 | |
187 | Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); |
188 | |
189 | - m_database = new Database(m_resource->databaseDirectory(), |
190 | - m_resource->getRcUrl("sql").path()); |
191 | + m_database = new Database(m_resource); |
192 | m_mediaFactory->setMediaTable(m_database->getMediaTable()); |
193 | m_defaultTemplate = new AlbumDefaultTemplate(); |
194 | m_mediaCollection = new MediaCollection(m_database->getMediaTable()); |
195 | @@ -240,7 +239,7 @@ |
196 | QObject::connect(m_monitor, SIGNAL(consistencyCheckFinished()), |
197 | this, SIGNAL(consistencyCheckFinished())); |
198 | |
199 | - m_monitor->startMonitoring(m_resource->mediaDirectories()); |
200 | + m_monitor->startMonitoring(m_resource->mediaDirectories(), m_resource->blacklistedDirectories()); |
201 | m_monitor->checkConsistency(m_mediaCollection); |
202 | } |
203 | |
204 | |
205 | === modified file 'src/media/media-monitor.cpp' |
206 | --- src/media/media-monitor.cpp 2016-04-12 19:38:05 +0000 |
207 | +++ src/media/media-monitor.cpp 2016-09-02 15:54:54 +0000 |
208 | @@ -63,10 +63,11 @@ |
209 | * new and delted files |
210 | * \param targetDirectories |
211 | */ |
212 | -void MediaMonitor::startMonitoring(const QStringList &targetDirectories) |
213 | +void MediaMonitor::startMonitoring(const QStringList &targetDirectories, const QStringList &blacklistedDirectories) |
214 | { |
215 | QMetaObject::invokeMethod(m_worker, "startMonitoring", Qt::QueuedConnection, |
216 | - Q_ARG(QStringList, targetDirectories)); |
217 | + Q_ARG(QStringList, targetDirectories), |
218 | + Q_ARG(QStringList, blacklistedDirectories)); |
219 | } |
220 | |
221 | /*! |
222 | @@ -104,6 +105,7 @@ |
223 | MediaMonitorWorker::MediaMonitorWorker(QObject *parent) |
224 | : QObject(parent), |
225 | m_targetDirectories(), |
226 | + m_blacklistedDirectories(), |
227 | m_watcher(this), |
228 | m_manifest(), |
229 | m_fileActivityTimer(this), |
230 | @@ -156,13 +158,27 @@ |
231 | * that are not on the current directories list |
232 | * \param currentDirectories |
233 | */ |
234 | -QStringList MediaMonitorWorker::findNewSubDirectories(const QStringList& currentDirectories) |
235 | +QStringList MediaMonitorWorker::findNewSubDirectories(const QStringList& currentDirectories, const QStringList& blacklistedDirectories) |
236 | { |
237 | + QList<QRegExp> blacklistedRegExp; |
238 | + foreach (const QString& regExp, blacklistedDirectories) { |
239 | + blacklistedRegExp.append(QRegExp(regExp)); |
240 | + } |
241 | + |
242 | QStringList newDirectories; |
243 | foreach (const QString& dirPath, currentDirectories) { |
244 | foreach (const QString& d, expandSubDirectories(dirPath)) { |
245 | - if (!m_targetDirectories.contains(d)) { |
246 | - newDirectories.append(d); |
247 | + bool blacklisted = false; |
248 | + foreach (QRegExp re, blacklistedRegExp) { |
249 | + if (re.indexIn(d) != -1) { |
250 | + blacklisted = true; |
251 | + break; |
252 | + } |
253 | + } |
254 | + if (!blacklisted){ |
255 | + if (!m_targetDirectories.contains(d)) { |
256 | + newDirectories.append(d); |
257 | + } |
258 | } |
259 | } |
260 | } |
261 | @@ -216,10 +232,11 @@ |
262 | * \brief MediaMonitor::startMonitoring |
263 | * \param targetDirectories |
264 | */ |
265 | -void MediaMonitorWorker::startMonitoring(const QStringList &targetDirectories) |
266 | +void MediaMonitorWorker::startMonitoring(const QStringList &targetDirectories, const QStringList &blacklistedDirectories) |
267 | { |
268 | - QStringList newDirectories = findNewSubDirectories(targetDirectories); |
269 | + QStringList newDirectories = findNewSubDirectories(targetDirectories, blacklistedDirectories); |
270 | m_targetDirectories += newDirectories; |
271 | + m_blacklistedDirectories = blacklistedDirectories; |
272 | m_manifest = generateManifest(m_targetDirectories); |
273 | m_watcher.addPaths(newDirectories); |
274 | } |
275 | @@ -254,7 +271,7 @@ |
276 | } |
277 | |
278 | QStringList currentDirectories = QStringList(m_targetDirectories); |
279 | - QStringList newDirectories = findNewSubDirectories(currentDirectories); |
280 | + QStringList newDirectories = findNewSubDirectories(currentDirectories, m_blacklistedDirectories); |
281 | |
282 | m_targetDirectories += newDirectories; |
283 | m_watcher.addPaths(newDirectories); |
284 | |
285 | === modified file 'src/media/media-monitor.h' |
286 | --- src/media/media-monitor.h 2015-01-25 16:36:04 +0000 |
287 | +++ src/media/media-monitor.h 2016-09-02 15:54:54 +0000 |
288 | @@ -42,7 +42,7 @@ |
289 | MediaMonitor(QObject *parent=0); |
290 | virtual ~MediaMonitor(); |
291 | |
292 | - void startMonitoring(const QStringList& targetDirectories); |
293 | + void startMonitoring(const QStringList& targetDirectories, const QStringList& blacklistedDirectories); |
294 | void checkConsistency(const MediaCollection *mediaCollection); |
295 | QStringList manifest(); |
296 | |
297 | @@ -77,8 +77,8 @@ |
298 | QStringList getManifest(); |
299 | |
300 | public slots: |
301 | - void startMonitoring(const QStringList& targetDirectories); |
302 | - QStringList findNewSubDirectories(const QStringList& currentDirectories); |
303 | + void startMonitoring(const QStringList& targetDirectories, const QStringList &blacklistedDirectories); |
304 | + QStringList findNewSubDirectories(const QStringList& currentDirectories, const QStringList& blacklistedDirectories); |
305 | QStringList expandSubDirectories(const QString& dirPath); |
306 | void checkConsistency(); |
307 | |
308 | @@ -97,6 +97,7 @@ |
309 | void checkForNewMedias(); |
310 | |
311 | QStringList m_targetDirectories; |
312 | + QStringList m_blacklistedDirectories; |
313 | QFileSystemWatcher m_watcher; |
314 | QStringList m_manifest; |
315 | QTimer m_fileActivityTimer; |
316 | |
317 | === modified file 'src/util/resource.cpp' |
318 | --- src/util/resource.cpp 2015-01-08 19:05:50 +0000 |
319 | +++ src/util/resource.cpp 2016-09-02 15:54:54 +0000 |
320 | @@ -24,6 +24,7 @@ |
321 | #include <QtGui/QOpenGLContext> |
322 | #include <QtQuick/QQuickView> |
323 | #include <QStandardPaths> |
324 | +#include <QSettings> |
325 | |
326 | const QLatin1String Resource::DATABASE_DIR = QLatin1String("database"); |
327 | const QLatin1String Resource::THUMBNAIL_DIR = QLatin1String("thumbnails"); |
328 | @@ -36,6 +37,7 @@ |
329 | */ |
330 | Resource::Resource(bool desktopMode, const QString &pictureDir) |
331 | : m_mediaDirectories(), |
332 | + m_blacklistedDirectories(), |
333 | m_databaseDirectory(""), |
334 | m_thumbnailDirectory("") |
335 | { |
336 | @@ -56,6 +58,34 @@ |
337 | m_mediaDirectories.append(QString("/media/" + userName)); |
338 | m_videoDirectories.append(QString("/media/" + userName)); |
339 | } |
340 | + |
341 | + QSettings settings("com.ubuntu.gallery", "com.ubuntu.gallery"); |
342 | + int size = settings.beginReadArray("BlacklistedDirs"); |
343 | + if (size <= 0) { |
344 | + settings.endArray(); |
345 | + |
346 | + settings.beginWriteArray("BlacklistedDirs"); |
347 | + |
348 | + //By default blacklist Music and Documents |
349 | + QString reMusic = "/media/phablet/[^/]*/Music"; |
350 | + QString reDocuments = "/media/phablet/[^/]*/Documents"; |
351 | + |
352 | + settings.setArrayIndex(0); |
353 | + settings.setValue("regexp", reMusic); |
354 | + m_blacklistedDirectories.append(reMusic); |
355 | + |
356 | + settings.setArrayIndex(1); |
357 | + settings.setValue("regexp", reDocuments); |
358 | + m_blacklistedDirectories.append(reDocuments); |
359 | + settings.endArray(); |
360 | + |
361 | + } else { |
362 | + for (int i = 0; i < size; ++i) { |
363 | + settings.setArrayIndex(i); |
364 | + m_blacklistedDirectories.append(settings.value("regexp").toString()); |
365 | + } |
366 | + settings.endArray(); |
367 | + } |
368 | } |
369 | |
370 | /*! |
371 | @@ -74,15 +104,16 @@ |
372 | } |
373 | } |
374 | |
375 | -/*! |
376 | - * \brief Resource::picturesDirectory |
377 | - * \return Returns the directory for the pictures |
378 | - */ |
379 | const QStringList &Resource::mediaDirectories() const |
380 | { |
381 | return m_mediaDirectories; |
382 | } |
383 | |
384 | +const QStringList &Resource::blacklistedDirectories() const |
385 | +{ |
386 | + return m_blacklistedDirectories; |
387 | +} |
388 | + |
389 | /*! |
390 | * \brief Resource::databaseDirectory directory for the database |
391 | * \return the directory the database is stored |
392 | |
393 | === modified file 'src/util/resource.h' |
394 | --- src/util/resource.h 2014-09-17 08:42:47 +0000 |
395 | +++ src/util/resource.h 2016-09-02 15:54:54 +0000 |
396 | @@ -37,6 +37,7 @@ |
397 | static QUrl getRcUrl(const QString& path); |
398 | |
399 | const QStringList &mediaDirectories() const; |
400 | + const QStringList &blacklistedDirectories() const; |
401 | const QString &databaseDirectory() const; |
402 | const QString &thumbnailDirectory() const; |
403 | |
404 | @@ -47,6 +48,7 @@ |
405 | private: |
406 | QStringList m_mediaDirectories; |
407 | QStringList m_videoDirectories; |
408 | + QStringList m_blacklistedDirectories; |
409 | mutable QString m_databaseDirectory; |
410 | mutable QString m_thumbnailDirectory; |
411 | |
412 | |
413 | === modified file 'tests/unittests/mediamonitor/tst_mediamonitor.cpp' |
414 | --- tests/unittests/mediamonitor/tst_mediamonitor.cpp 2014-08-19 13:26:41 +0000 |
415 | +++ tests/unittests/mediamonitor/tst_mediamonitor.cpp 2016-09-02 15:54:54 +0000 |
416 | @@ -67,7 +67,7 @@ |
417 | m_monitor = new MediaMonitor(); |
418 | |
419 | // Launch the monitoring process |
420 | - m_monitor->startMonitoring(QStringList(m_tmpDir->path())); |
421 | + m_monitor->startMonitoring(QStringList(m_tmpDir->path()), QStringList()); |
422 | |
423 | // Save sample image allover the tree |
424 | m_sampleImage->save(m_tmpDir->path() + "/A/A/sample_AA.jpg", "JPG"); |
425 | |
426 | === modified file 'tests/unittests/stubs/database_stub.cpp' |
427 | --- tests/unittests/stubs/database_stub.cpp 2014-11-25 16:24:12 +0000 |
428 | +++ tests/unittests/stubs/database_stub.cpp 2016-09-02 15:54:54 +0000 |
429 | @@ -21,18 +21,18 @@ |
430 | #include "database.h" |
431 | #include "album-table.h" |
432 | #include "media-table.h" |
433 | +#include "resource.h" |
434 | |
435 | #include <QFile> |
436 | |
437 | -Database::Database(const QString &databaseDir, const QString &schemaDirectory, |
438 | - QObject* parent) : |
439 | +Database::Database(Resource *resource, QObject* parent) : |
440 | QObject(parent), |
441 | - m_databaseDirectory(databaseDir), |
442 | - m_sqlSchemaDirectory(schemaDirectory), |
443 | + m_databaseDirectory(resource->databaseDirectory()), |
444 | + m_sqlSchemaDirectory(resource->getRcUrl("sql").path()), |
445 | m_db(0) |
446 | { |
447 | m_albumTable = new AlbumTable(this, this); |
448 | - m_mediaTable = new MediaTable(this, this); |
449 | + m_mediaTable = new MediaTable(this, resource, this); |
450 | } |
451 | |
452 | Database::~Database() |
453 | |
454 | === modified file 'tests/unittests/stubs/media-table_stub.cpp' |
455 | --- tests/unittests/stubs/media-table_stub.cpp 2015-01-14 15:19:05 +0000 |
456 | +++ tests/unittests/stubs/media-table_stub.cpp 2016-09-02 15:54:54 +0000 |
457 | @@ -19,6 +19,7 @@ |
458 | |
459 | #include "media-table.h" |
460 | #include "database.h" |
461 | +#include "resource.h" |
462 | |
463 | #include <QDateTime> |
464 | #include <QDebug> |
465 | @@ -46,8 +47,8 @@ |
466 | mediaFakeTable[0].originalOrientation = orientation; |
467 | } |
468 | |
469 | -MediaTable::MediaTable(Database* db, QObject* parent) |
470 | - : QObject(parent), m_db(db) |
471 | +MediaTable::MediaTable(Database* db, Resource *resource, QObject* parent) |
472 | + : QObject(parent), m_db(db), m_resource(resource) |
473 | { |
474 | mediaLastId = 0; |
475 | mediaFakeTable.clear(); |
PASSED: Continuous integration, rev:1326 /jenkins. canonical. com/system- apps/job/ lp-gallery- app-ci/ 12/ /jenkins. canonical. com/system- apps/job/ build/1323 /jenkins. canonical. com/system- apps/job/ test-0- autopkgtest/ label=phone- armhf,release= vivid+overlay, testname= default/ 299 /jenkins. canonical. com/system- apps/job/ build-0- fetch/1323 /jenkins. canonical. com/system- apps/job/ build-1- sourcepkg/ release= vivid+overlay/ 1186 /jenkins. canonical. com/system- apps/job/ build-1- sourcepkg/ release= xenial+ overlay/ 1186 /jenkins. canonical. com/system- apps/job/ build-1- sourcepkg/ release= yakkety/ 1186 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1166/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= yakkety/ 1166 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= yakkety/ 1166/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- apps/job/ lp-gallery- app-ci/ 12/rebuild
https:/