Merge lp:~bfiller/gallery-app/multiple-bug-fixes into lp:gallery-app

Proposed by Bill Filler
Status: Merged
Merged at revision: 928
Proposed branch: lp:~bfiller/gallery-app/multiple-bug-fixes
Merge into: lp:gallery-app
Diff against target: 2286 lines (+380/-1082)
44 files modified
CMakeLists.txt (+0/-1)
debian/control (+0/-3)
rc/qml/AlbumViewer/AlbumInternals/FramePortrait.qml (+16/-0)
rc/qml/AlbumsOverview.qml (+1/-0)
rc/qml/Components/MediaGrid.qml (+19/-0)
rc/qml/MediaViewer/PhotoViewerDelegate.qml (+21/-8)
rc/qml/MediaViewer/ZoomablePhotoComponent.qml (+2/-1)
rc/qml/OrganicView/OrganicMediaList.qml (+24/-0)
rc/qml/Utility/PhotosToolbarActions.qml (+1/-0)
src/album/CMakeLists.txt (+3/-0)
src/gallery-application.cpp (+2/-5)
src/gallery-manager.cpp (+0/-53)
src/gallery-manager.h (+0/-6)
src/media/media-monitor.cpp (+38/-3)
src/media/media-monitor.h (+1/-0)
src/media/media-source.cpp (+19/-4)
src/medialoader/CMakeLists.txt (+1/-4)
src/medialoader/gallery-standard-image-provider.cpp (+11/-49)
src/medialoader/gallery-standard-image-provider.h (+0/-4)
src/medialoader/gallery-thumbnail-image-provider.cpp (+0/-102)
src/medialoader/gallery-thumbnail-image-provider.h (+0/-59)
src/medialoader/preview-manager.cpp (+0/-423)
src/medialoader/preview-manager.h (+0/-87)
src/photo/photo-caches.cpp (+3/-0)
src/photo/photo.cpp (+2/-17)
src/video/video.cpp (+3/-2)
tests/autopilot/gallery_app/tests/__init__.py (+4/-1)
tests/autopilot/gallery_app/tests/test_albums_view.py (+29/-1)
tests/autopilot/gallery_app/tests/test_events_view.py (+26/-1)
tests/autopilot/gallery_app/tests/test_photo_viewer.py (+2/-2)
tests/autopilot/gallery_app/tests/test_photos_view.py (+16/-7)
tests/unittests/CMakeLists.txt (+1/-1)
tests/unittests/gallerystandardimageprovider/CMakeLists.txt (+0/-2)
tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp (+0/-5)
tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt (+0/-34)
tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp (+0/-54)
tests/unittests/mediamonitor/CMakeLists.txt (+36/-0)
tests/unittests/mediamonitor/tst_mediamonitor.cpp (+96/-0)
tests/unittests/mediaobjectfactory/CMakeLists.txt (+0/-3)
tests/unittests/stubs/gallery-manager_stub.cpp (+0/-9)
tests/unittests/stubs/gallery-standard-image-provider_stub.cpp (+1/-9)
tests/unittests/stubs/gallery-thumbnail-image-provider_stub.cpp (+0/-55)
tests/unittests/stubs/preview-manager_stub.cpp (+0/-65)
tests/unittests/video/tst_video.cpp (+2/-2)
To merge this branch: bzr merge lp:~bfiller/gallery-app/multiple-bug-fixes
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+210013@code.launchpad.net

This proposal supersedes a proposal from 2014-03-07.

Commit message

multiple gallery-app bug fixes Bug #907870: [desktop] Gallery does not display photos in sub folders, Bug #1221968: use libthumbnailer for gallery thumbnails, Bug #1268748: videos are not displayed when running on desktop, Bug #1271327: disable switching between camera and gallery on desktop, Bug #1287272: Black flash at the end of the zoom animation"

Description of the change

[MERGE] lp:~amanzi-team/gallery-app/gallery-app-sdk-thumbnailer
Use the SDK thumbnailer to generate thumbnails instead of the custom internal one

[MERGE] lp:~artmello/gallery-app/display_photos_in_sub_folders/
Add support for monitoring media on sub folders of the target ones.

[MERGE] lp:~artmello/gallery-app/switching_to_camera
Disable Camera Button on every view when on Desktop Mode

[MERGE] lp:~artmello/gallery-app/gallery-app-not_display_video
Fix the check if a file is a video or a photo

[MERGE] lp:~artmello/gallery-app/gallery-app-overlay_video_icon
Add play icon if thumbnail is from video

[MERGE] lp:~amanzi-team/gallery-app/gallery-app-black-flash-zoom
Prevent a black flash at the end of the zoom animation by ensuring the transition image isn't hidden until the final one has fully loaded.

Remove gstreamer deps

To prevent issues while rotating one image the following branch should be used:
lp:~jpakkane/thumbnailer/manual-orient

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
929. By Bill Filler

fixes lp:907870

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-01-11 21:58:24 +0000
3+++ CMakeLists.txt 2014-03-07 20:39:27 +0000
4@@ -41,7 +41,6 @@
5 find_package(PkgConfig REQUIRED)
6 pkg_check_modules(CONTENTHUB REQUIRED libcontent-hub)
7 pkg_check_modules(EXIV2 REQUIRED exiv2)
8-pkg_check_modules(GSTLIB REQUIRED gstreamer-0.10)
9 pkg_check_modules(MEDIAINFO REQUIRED libmediainfo)
10
11 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
12
13=== modified file 'debian/control'
14--- debian/control 2014-01-14 08:01:56 +0000
15+++ debian/control 2014-03-07 20:39:27 +0000
16@@ -7,7 +7,6 @@
17 pkg-config,
18 dh-translations,
19 libcontent-hub-dev (>= 0.0+13.10.20130930.1),
20- libgstreamer0.10-dev,
21 libexiv2-dev,
22 libgl1-mesa-dev | libgl-dev,
23 libgles2-mesa-dev,
24@@ -30,8 +29,6 @@
25 Conflicts: ubuntu-gallery
26 Depends: ${misc:Depends},
27 ${shlibs:Depends},
28- gstreamer0.10-plugins-base,
29- gstreamer0.10-plugins-good,
30 qtdeclarative5-accounts-plugin,
31 libqt5sql5-sqlite,
32 qtdeclarative5-qtquick2-plugin,
33
34=== modified file 'rc/qml/AlbumViewer/AlbumInternals/FramePortrait.qml'
35--- rc/qml/AlbumViewer/AlbumInternals/FramePortrait.qml 2013-04-08 14:55:34 +0000
36+++ rc/qml/AlbumViewer/AlbumInternals/FramePortrait.qml 2014-03-07 20:39:27 +0000
37@@ -18,6 +18,7 @@
38 */
39
40 import QtQuick 2.0
41+import Gallery 1.0
42 import "../../../js/Gallery.js" as Gallery
43
44 /*!
45@@ -45,6 +46,15 @@
46 visible: fullImage.opacity < 1
47 source: load && mediaSource ? mediaSource.galleryPreviewPath : ""
48 fillMode: fullImage.fillMode
49+
50+ Connections {
51+ target: mediaSource ? mediaSource : null
52+ onDataChanged: {
53+ // data changed but filename didn't, so we need to bypass the qml image
54+ // cache by tacking a timestamp to the filename so sees it as different.
55+ preview.source = mediaSource.galleryPreviewPath + "?at=" + Date.now()
56+ }
57+ }
58 }
59 Image {
60 id: fullImage
61@@ -62,4 +72,10 @@
62 NumberAnimation { duration: Gallery.SNAP_DURATION }
63 }
64 }
65+ Image {
66+ // Display a play icon if the thumbnail is from a video
67+ source: "../../../img/icon_play.png"
68+ anchors.centerIn: parent
69+ visible: isLoaded && mediaSource.type === MediaSource.Video
70+ }
71 }
72
73=== modified file 'rc/qml/AlbumsOverview.qml'
74--- rc/qml/AlbumsOverview.qml 2014-02-11 21:03:40 +0000
75+++ rc/qml/AlbumsOverview.qml 2014-03-07 20:39:27 +0000
76@@ -199,6 +199,7 @@
77 }
78 ToolbarButton {
79 objectName: "cameraButton"
80+ visible: !APP.desktopMode
81 action: Action {
82 text: i18n.tr("Camera")
83 iconSource: Qt.resolvedUrl("../img/camera.png")
84
85=== modified file 'rc/qml/Components/MediaGrid.qml'
86--- rc/qml/Components/MediaGrid.qml 2013-06-26 08:59:08 +0000
87+++ rc/qml/Components/MediaGrid.qml 2014-03-07 20:39:27 +0000
88@@ -16,6 +16,7 @@
89
90 import QtQuick 2.0
91 import Ubuntu.Components 0.1
92+import Gallery 1.0
93 import "../OrganicView"
94 import "../Utility"
95 import "../../js/Gallery.js" as Gallery
96@@ -80,8 +81,26 @@
97 radius: "medium"
98
99 image: Image {
100+ id: thumbImage
101 source: mediaSource.galleryThumbnailPath
102 asynchronous: true
103+ fillMode: Image.PreserveAspectCrop
104+
105+ Connections {
106+ target: mediaSource
107+ onDataChanged: {
108+ // data changed but filename didn't, so we need to bypass the qml image
109+ // cache by tacking a timestamp to the filename so sees it as different.
110+ thumbImage.source = mediaSource.galleryThumbnailPath + "?at=" + Date.now()
111+ }
112+ }
113+ }
114+
115+ Image {
116+ // Display a play icon if the thumbnail is from a video
117+ source: "../../img/icon_play.png"
118+ anchors.centerIn: parent
119+ visible: mediaSource.type === MediaSource.Video
120 }
121
122 OrganicItemInteraction {
123
124=== modified file 'rc/qml/MediaViewer/PhotoViewerDelegate.qml'
125--- rc/qml/MediaViewer/PhotoViewerDelegate.qml 2014-02-04 16:53:39 +0000
126+++ rc/qml/MediaViewer/PhotoViewerDelegate.qml 2014-03-07 20:39:27 +0000
127@@ -56,6 +56,15 @@
128 fullPhotoComponentLoader.item.unzoom();
129 }
130
131+ Connections {
132+ target: mediaSource
133+ onDataChanged: {
134+ // Force the image to be reloaded, to pick up the new thumbnail
135+ interactivePreviewImage.active = false;
136+ interactivePreviewImage.active = true;
137+ }
138+ }
139+
140 // Note that we haven't defined a state set in this component, even though
141 // we bind the "state" property here. This is intentional and is necessary
142 // to work around a binding issue on Qt 5.0 beta 1. Given a later version
143@@ -63,19 +72,23 @@
144 state: (fullPhotoComponentLoader.item &&
145 !fullPhotoComponentLoader.item.fullyUnzoomed) ? "zoomed" :
146 "unzoomed";
147-
148- Image {
149+ Component {
150+ id: interactivePreviewImageSource
151+ Image {
152+ fillMode: Image.PreserveAspectFit
153+
154+ source: mediaSource ? mediaSource.galleryPreviewPath : ""
155+ cache: false
156+ }
157+ }
158+
159+ Loader {
160 id: interactivePreviewImage
161-
162 z: 0
163-
164 anchors.fill: parent
165
166 visible: photoViewerDelegate.state == "unzoomed"
167-
168- fillMode: Image.PreserveAspectFit
169-
170- source: mediaSource ? mediaSource.galleryPreviewPath : ""
171+ sourceComponent: interactivePreviewImageSource
172 }
173
174 Loader {
175
176=== modified file 'rc/qml/MediaViewer/ZoomablePhotoComponent.qml'
177--- rc/qml/MediaViewer/ZoomablePhotoComponent.qml 2013-06-14 09:02:15 +0000
178+++ rc/qml/MediaViewer/ZoomablePhotoComponent.qml 2014-03-07 20:39:27 +0000
179@@ -389,7 +389,8 @@
180 transformOrigin: Item.TopLeft
181
182 visible: zoomablePhotoComponent.isZoomAnimationInProgress ||
183- zoomablePhotoComponent.state == "pinching"
184+ zoomablePhotoComponent.state == "pinching" ||
185+ !zoomedPhoto.isLoaded
186
187 color: zoomablePhotoComponent.color
188
189
190=== modified file 'rc/qml/OrganicView/OrganicMediaList.qml'
191--- rc/qml/OrganicView/OrganicMediaList.qml 2013-06-26 13:46:56 +0000
192+++ rc/qml/OrganicView/OrganicMediaList.qml 2014-03-07 20:39:27 +0000
193@@ -161,8 +161,32 @@
194 radius: "medium"
195
196 image: Image {
197+ id: thumbImage
198 source: model.mediaSource.galleryThumbnailPath
199 asynchronous: true
200+
201+ /* The SDK thumbnailer respects the freedesktop.org standard and uses 128 for the small
202+ * thumbnail size, while the previous thumbnailer used 216. To maintain the same visual
203+ * result as the previous thumbnailer, we force it to generate a large thumbnail, which
204+ * is closer to the older one in size and looks identical when downscaled */
205+ sourceSize.width: 256
206+ fillMode: Image.PreserveAspectCrop
207+ }
208+
209+ Connections {
210+ target: model.mediaSource
211+ onDataChanged: {
212+ // data changed but filename didn't, so we need to bypass the qml image
213+ // cache by tacking a timestamp to the filename so sees it as different.
214+ thumbImage.source = model.mediaSource.galleryThumbnailPath + "?at=" + Date.now()
215+ }
216+ }
217+
218+ Image {
219+ // Display a play icon if the thumbnail is from a video
220+ source: "../../img/icon_play.png"
221+ anchors.centerIn: parent
222+ visible: mediaSource.type === MediaSource.Video
223 }
224
225 OrganicItemInteraction {
226
227=== modified file 'rc/qml/Utility/PhotosToolbarActions.qml'
228--- rc/qml/Utility/PhotosToolbarActions.qml 2014-01-10 17:48:56 +0000
229+++ rc/qml/Utility/PhotosToolbarActions.qml 2014-03-07 20:39:27 +0000
230@@ -44,6 +44,7 @@
231 ToolbarButton {
232 objectName: "cameraButton"
233 text: i18n.tr("Camera")
234+ visible: !APP.desktopMode
235 iconSource: Qt.resolvedUrl("../../img/camera.png")
236 onTriggered: Qt.openUrlExternally("appid://com.ubuntu.camera/camera/current-user-version")
237 }
238
239=== modified file 'src/album/CMakeLists.txt'
240--- src/album/CMakeLists.txt 2013-08-15 06:40:15 +0000
241+++ src/album/CMakeLists.txt 2014-03-07 20:39:27 +0000
242@@ -36,3 +36,6 @@
243
244 qt5_use_modules(${GALLERY_ALBUM_LIB} Widgets Core Qml)
245
246+target_link_libraries( ${GALLERY_ALBUM_LIB}
247+ gallery-core
248+ )
249
250=== modified file 'src/gallery-application.cpp'
251--- src/gallery-application.cpp 2014-02-20 17:53:20 +0000
252+++ src/gallery-application.cpp 2014-03-07 20:39:27 +0000
253@@ -38,7 +38,6 @@
254
255 // qml
256 #include "gallery-standard-image-provider.h"
257-#include "gallery-thumbnail-image-provider.h"
258 #include "qml-album-collection-model.h"
259 #include "qml-event-collection-model.h"
260 #include "qml-event-overview-model.h"
261@@ -143,7 +142,7 @@
262 */
263 bool GalleryApplication::isDesktopMode() const
264 {
265- return (qEnvironmentVariableIsSet("DESKTOP_MODE") && (qgetenv("DESKTOP_MODE") == "1"));
266+ return(qEnvironmentVariableIsSet("DESKTOP_MODE") && (qgetenv("DESKTOP_MODE") == "1"));
267 }
268
269 /*!
270@@ -169,7 +168,7 @@
271 size.transpose();
272
273 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
274- if (m_cmdLineParser->formFactor() == "desktop" || isDesktopMode()) {
275+ if (isDesktopMode()) {
276 m_view->setMinimumSize(QSize(60 * m_bguSize, 60 * m_bguSize));
277 }
278
279@@ -213,8 +212,6 @@
280 m_galleryManager->postInit();
281 m_view->engine()->addImageProvider(GalleryStandardImageProvider::PROVIDER_ID,
282 m_galleryManager->takeGalleryStandardImageProvider());
283- m_view->engine()->addImageProvider(GalleryThumbnailImageProvider::PROVIDER_ID,
284- m_galleryManager->takeGalleryThumbnailImageProvider());
285
286 QApplication::processEvents();
287 if (m_cmdLineParser->startupTimer())
288
289=== modified file 'src/gallery-manager.cpp'
290--- src/gallery-manager.cpp 2013-09-06 16:10:25 +0000
291+++ src/gallery-manager.cpp 2014-03-07 20:39:27 +0000
292@@ -35,11 +35,9 @@
293 // media
294 #include "media-collection.h"
295 #include "media-monitor.h"
296-#include "preview-manager.h"
297
298 // qml
299 #include "gallery-standard-image-provider.h"
300-#include "gallery-thumbnail-image-provider.h"
301 #include "qml-media-collection-model.h"
302
303 // util
304@@ -63,13 +61,11 @@
305 : collectionsInitialised(false),
306 m_resource(new Resource(picturesDir, view)),
307 m_standardImageProvider(new GalleryStandardImageProvider()),
308- m_thumbnailImageProvider(new GalleryThumbnailImageProvider()),
309 m_database(0),
310 m_defaultTemplate(0),
311 m_mediaCollection(0),
312 m_albumCollection(0),
313 m_eventCollection(0),
314- m_previewManager(0),
315 m_monitor(0),
316 m_mediaLibrary(0)
317 {
318@@ -94,9 +90,7 @@
319 delete m_defaultTemplate;
320 delete m_resource;
321 delete m_mediaCollection;
322- delete m_previewManager;
323 delete m_standardImageProvider;
324- delete m_thumbnailImageProvider;
325 }
326
327 /*!
328@@ -145,7 +139,6 @@
329 m_defaultTemplate = new AlbumDefaultTemplate();
330 m_mediaCollection = new MediaCollection(m_database->getMediaTable());
331
332- initPreviewManager();
333 fillMediaCollection();
334 startFileMonitoring();
335
336@@ -219,41 +212,6 @@
337 void GalleryManager::logImageLoading(bool log)
338 {
339 m_standardImageProvider->setLogging(log);
340- m_thumbnailImageProvider->setLogging(log);
341-}
342-
343-/*!
344- * \brief GalleryManager::initPreviewManager creates the PreviewManager,
345- * assigns it to all needed objects and creates all signal slot connection.
346- */
347-void GalleryManager::initPreviewManager()
348-{
349- Q_ASSERT(m_resource);
350- Q_ASSERT(m_mediaCollection);
351- Q_ASSERT(m_standardImageProvider);
352- Q_ASSERT(m_thumbnailImageProvider);
353-
354- if (m_previewManager)
355- return;
356-
357- m_previewManager = new PreviewManager(m_resource->thumbnailDirectory());
358-
359- m_standardImageProvider->setPreviewManager(m_previewManager);
360- m_thumbnailImageProvider->setPreviewManager(m_previewManager);
361-
362- // Monitor MediaCollection for all new MediaSources
363- QObject::connect(m_mediaCollection,
364- SIGNAL(contentsChanged(const QSet<DataObject*>*,const QSet<DataObject*>*)),
365- m_previewManager,
366- SLOT(onMediaAddedRemoved(const QSet<DataObject*>*,const QSet<DataObject*>*)));
367-
368- QObject::connect(m_mediaCollection,
369- SIGNAL(destroying(const QSet<DataObject*>*)),
370- m_previewManager,
371- SLOT(onMediaDestroying(const QSet<DataObject*>*)));
372-
373- // Verify previews for all existing added MediaSources
374- m_previewManager->onMediaAddedRemoved(&m_mediaCollection->getAsSet(), NULL);
375 }
376
377 /*!
378@@ -324,14 +282,3 @@
379 m_standardImageProvider = 0;
380 return provider;
381 }
382-
383-/*!
384- * \brief GalleryManager::takeGalleryThumbnailImageProvider returns the thumbnail image provider
385- * and gives up the owndership
386- */
387-GalleryThumbnailImageProvider* GalleryManager::takeGalleryThumbnailImageProvider()
388-{
389- GalleryThumbnailImageProvider *provider = m_thumbnailImageProvider;
390- m_thumbnailImageProvider = 0;
391- return provider;
392-}
393
394=== modified file 'src/gallery-manager.h'
395--- src/gallery-manager.h 2013-09-06 16:10:25 +0000
396+++ src/gallery-manager.h 2014-03-07 20:39:27 +0000
397@@ -36,11 +36,9 @@
398 class EventCollection;
399 class GalleryManager;
400 class GalleryStandardImageProvider;
401-class GalleryThumbnailImageProvider;
402 class MediaCollection;
403 class MediaMonitor;
404 class MediaObjectFactory;
405-class PreviewManager;
406 class QmlMediaCollectionModel;
407 class Resource;
408
409@@ -68,7 +66,6 @@
410 EventCollection *eventCollection();
411 Resource *resource() { return m_resource; }
412 GalleryStandardImageProvider *takeGalleryStandardImageProvider();
413- GalleryThumbnailImageProvider *takeGalleryThumbnailImageProvider();
414
415 void logImageLoading(bool log);
416
417@@ -85,7 +82,6 @@
418 GalleryManager(const GalleryManager&);
419 void operator=(const GalleryManager&);
420
421- void initPreviewManager();
422 void fillMediaCollection();
423 void startFileMonitoring();
424
425@@ -95,13 +91,11 @@
426
427 Resource* m_resource;
428 GalleryStandardImageProvider* m_standardImageProvider;
429- GalleryThumbnailImageProvider* m_thumbnailImageProvider;
430 Database* m_database;
431 AlbumDefaultTemplate* m_defaultTemplate;
432 MediaCollection* m_mediaCollection;
433 AlbumCollection* m_albumCollection;
434 EventCollection* m_eventCollection;
435- PreviewManager* m_previewManager;
436 MediaObjectFactory *m_mediaFactory;
437 MediaMonitor *m_monitor;
438
439
440=== modified file 'src/media/media-monitor.cpp'
441--- src/media/media-monitor.cpp 2013-08-09 15:13:08 +0000
442+++ src/media/media-monitor.cpp 2014-03-07 20:39:27 +0000
443@@ -135,15 +135,50 @@
444 }
445
446 /*!
447+ * \brief MediaMonitor::expandSubDirectories List all sub directories under
448+ * the base one. Use it to add to watch list
449+ * \param dirPath
450+ */
451+QStringList MediaMonitorWorker::expandSubDirectories(const QString& dirPath)
452+{
453+ QStack<QString> dirStack;
454+ dirStack.push(dirPath);
455+
456+ QStringList dirList;
457+ while(!dirStack.isEmpty()) {
458+ QDir dir(dirStack.pop());
459+ dirList.append(dir.absolutePath());
460+
461+ foreach(const QFileInfo &info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs)) {
462+ QString path(info.absoluteFilePath());
463+ if (info.isSymLink() && info.exists()) {
464+ // If it's a SymLink and points to a valid target need to get the target path
465+ path = info.symLinkTarget();
466+ }
467+ if(!dirList.contains(path)) {
468+ // In case we already visited the folder we didn't expand it anymore
469+ dirStack.push(path);
470+ }
471+ }
472+ }
473+
474+ return dirList;
475+}
476+
477+/*!
478 * \brief MediaMonitor::startMonitoring
479 * \param targetDirectories
480 */
481 void MediaMonitorWorker::startMonitoring(const QStringList &targetDirectories)
482 {
483 QStringList newDirectories;
484- foreach (const QString& dir, targetDirectories) {
485- if (!m_targetDirectories.contains(dir))
486- newDirectories.append(dir);
487+ foreach (const QString& dirPath, targetDirectories) {
488+ foreach (const QString& d, expandSubDirectories(dirPath)) {
489+ // Add all sub folders from target directory on watch list
490+ if (!m_targetDirectories.contains(d)) {
491+ newDirectories.append(d);
492+ }
493+ }
494 }
495 m_targetDirectories += newDirectories;
496 m_manifest = getManifest(m_targetDirectories);
497
498=== modified file 'src/media/media-monitor.h'
499--- src/media/media-monitor.h 2013-07-05 08:12:31 +0000
500+++ src/media/media-monitor.h 2014-03-07 20:39:27 +0000
501@@ -75,6 +75,7 @@
502
503 public slots:
504 void startMonitoring(const QStringList& targetDirectories);
505+ QStringList expandSubDirectories(const QString& dirPath);
506 void checkConsitency();
507
508 signals:
509
510=== modified file 'src/media/media-source.cpp'
511--- src/media/media-source.cpp 2013-08-16 12:55:55 +0000
512+++ src/media/media-source.cpp 2014-03-07 20:39:27 +0000
513@@ -25,7 +25,8 @@
514
515 // qml
516 #include "gallery-standard-image-provider.h"
517-#include "gallery-thumbnail-image-provider.h"
518+
519+#include <QUrl>
520
521 /*!
522 * \brief MediaSource::MediaSource
523@@ -84,7 +85,17 @@
524 */
525 QUrl MediaSource::galleryPath() const
526 {
527- return GalleryStandardImageProvider::toURL(m_file);
528+ /* At the moment the only video files we recognize are mp4
529+ * files. This was maintained hardcoded from the previous
530+ * version of gallery app, and should be fixed in the future.
531+ * For those files the full image is the thumbnail/preview itself */
532+ if (m_file.suffix().toLower() == "mp4") {
533+ QString path("image://thumbnailer/");
534+ path.append(m_file.absoluteFilePath());
535+ return QUrl(path);
536+ } else {
537+ return GalleryStandardImageProvider::toURL(m_file);
538+ }
539 }
540
541 /*!
542@@ -93,7 +104,9 @@
543 */
544 QUrl MediaSource::galleryPreviewPath() const
545 {
546- return GalleryStandardImageProvider::toURL(m_file);
547+ QString path("image://thumbnailer/");
548+ path.append(m_file.absoluteFilePath());
549+ return QUrl(path);
550 }
551
552 /*!
553@@ -102,7 +115,9 @@
554 */
555 QUrl MediaSource::galleryThumbnailPath() const
556 {
557- return GalleryThumbnailImageProvider::toURL(m_file);
558+ QString path("image://thumbnailer/");
559+ path.append(m_file.absoluteFilePath());
560+ return QUrl(path);
561 }
562
563 /*!
564
565=== modified file 'src/medialoader/CMakeLists.txt'
566--- src/medialoader/CMakeLists.txt 2013-08-19 06:45:36 +0000
567+++ src/medialoader/CMakeLists.txt 2014-03-07 20:39:27 +0000
568@@ -16,17 +16,13 @@
569
570 set(gallery_medialoader_HDRS
571 gallery-standard-image-provider.h
572- gallery-thumbnail-image-provider.h
573 photo-metadata.h
574- preview-manager.h
575 video-metadata.h
576 )
577
578 set(gallery_medialoader_SRCS
579 gallery-standard-image-provider.cpp
580- gallery-thumbnail-image-provider.cpp
581 photo-metadata.cpp
582- preview-manager.cpp
583 video-metadata.cpp
584 )
585
586@@ -43,4 +39,5 @@
587 ${EXIV2_LIBRARIES}
588 ${GSTLIB_LDFLAGS}
589 ${MEDIAINFO_LIBRARIES}
590+ gallery-util
591 )
592
593=== modified file 'src/medialoader/gallery-standard-image-provider.cpp'
594--- src/medialoader/gallery-standard-image-provider.cpp 2013-08-12 08:51:09 +0000
595+++ src/medialoader/gallery-standard-image-provider.cpp 2014-03-07 20:39:27 +0000
596@@ -20,7 +20,6 @@
597
598 #include "gallery-standard-image-provider.h"
599 #include "photo-metadata.h"
600-#include "preview-manager.h"
601
602 #include <QDebug>
603 #include <QElapsedTimer>
604@@ -38,9 +37,7 @@
605
606 const long MAX_CACHE_BYTES = 20L * 1024L * 1024L;
607
608-// fully load previews into memory when requested
609-const int SCALED_LOAD_FLOOR_DIM_PIXELS =
610- qMax(PreviewManager::PREVIEW_SIZE, PreviewManager::PREVIEW_SIZE);
611+const int SCALED_LOAD_FLOOR_DIM_PIXELS = 360;
612
613 /*!
614 * \brief GalleryStandardImageProvider::GalleryStandardImageProvider
615@@ -48,7 +45,6 @@
616 GalleryStandardImageProvider::GalleryStandardImageProvider()
617 : QQuickImageProvider(QQuickImageProvider::Image),
618 m_cachedBytes(0),
619- m_previewManager(0),
620 m_logImageLoading(false),
621 m_maxLoadResolution(INT_MAX)
622 {
623@@ -89,11 +85,6 @@
624 QImage GalleryStandardImageProvider::requestImage(const QString& id,
625 QSize* size, const QSize& requestedSize)
626 {
627- if (!m_previewManager) {
628- qWarning() << Q_FUNC_INFO << "no PreviewManager set";
629- return QImage();
630- }
631-
632 // for LOG_IMAGE_STATUS
633 QString loggingStr = "";
634 QElapsedTimer timer;
635@@ -101,26 +92,21 @@
636
637 QUrl url(id);
638 QFileInfo photoFile(url.path());
639- m_previewManager->ensurePreview(photoFile);
640
641 QImage readyImage;
642 uint bytesLoaded = 0;
643 long currentCachedBytes = 0;
644 int currentCacheEntries = 0;
645
646- if (photoFile.suffix().compare("mp4", Qt::CaseInsensitive) == 0) {
647- readyImage = QImage(m_previewManager->previewFileName(photoFile.absoluteFilePath()));
648- } else {
649- CachedImage* cachedImage = claimCachedImageEntry(id, loggingStr);
650- Q_ASSERT(cachedImage != NULL);
651-
652- readyImage = fetchCachedImage(cachedImage, requestedSize, &bytesLoaded,
653- loggingStr);
654- if (readyImage.isNull())
655- LOG_IMAGE_STATUS("load-failure ");
656-
657- releaseCachedImageEntry(cachedImage, bytesLoaded, &currentCachedBytes, &currentCacheEntries);
658- }
659+ CachedImage* cachedImage = claimCachedImageEntry(id, loggingStr);
660+ Q_ASSERT(cachedImage != NULL);
661+
662+ readyImage = fetchCachedImage(cachedImage, requestedSize, &bytesLoaded,
663+ loggingStr);
664+ if (readyImage.isNull())
665+ LOG_IMAGE_STATUS("load-failure ");
666+
667+ releaseCachedImageEntry(cachedImage, bytesLoaded, &currentCachedBytes, &currentCacheEntries);
668
669 if (m_logImageLoading) {
670 if (bytesLoaded > 0) {
671@@ -142,15 +128,6 @@
672 }
673
674 /*!
675- * \brief GalleryStandardImageProvider::setPreviewManager
676- * \param previewManager
677- */
678-void GalleryStandardImageProvider::setPreviewManager(PreviewManager *previewManager)
679-{
680- m_previewManager = previewManager;
681-}
682-
683-/*!
684 * \brief GalleryStandardImageProvider::setLogging enables to print photo loading
685 * times to stout
686 * \param enableLogging
687@@ -414,30 +391,15 @@
688 */
689 QString GalleryStandardImageProvider::idToFile(const QString& id) const
690 {
691- if (!m_previewManager) {
692- qWarning() << Q_FUNC_INFO << "no PreviewManager set";
693- return QString();
694- }
695-
696 QUrl url = QUrl(id);
697 QString fileName = url.path();
698-
699- //Get our item value from our query by it's key.
700- QUrlQuery url_query(url);
701- url_query.hasQueryItem(GalleryStandardImageProvider::SIZE_KEY);
702- QString value = url_query.queryItemValue(GalleryStandardImageProvider::SIZE_KEY);
703-
704- if (value == "1") {
705- fileName = m_previewManager->previewFileName(fileName);
706- }
707-
708 return fileName;
709 }
710
711 /*!
712 * \brief GalleryStandardImageProvider::CachedImage::CachedImage
713 * \param id the full URI of the image
714- * \param fileName the filename for the URI (can be the file itself or the preview)
715+ * \param fileName the filename for the URI (the file itself)
716 */
717 GalleryStandardImageProvider::CachedImage::CachedImage(const QString& fileId,
718 const QString& filename)
719
720=== modified file 'src/medialoader/gallery-standard-image-provider.h'
721--- src/medialoader/gallery-standard-image-provider.h 2013-06-10 10:59:47 +0000
722+++ src/medialoader/gallery-standard-image-provider.h 2014-03-07 20:39:27 +0000
723@@ -34,8 +34,6 @@
724 #include <QString>
725 #include <QUrl>
726
727-class PreviewManager;
728-
729 /*!
730 * Gallery uses a custom image provider for three reasons:
731 *
732@@ -73,7 +71,6 @@
733 virtual QImage requestImage(const QString& id, QSize* size,
734 const QSize& requestedSize);
735
736- void setPreviewManager(PreviewManager* previewManager);
737 void setLogging(bool enableLogging);
738 void setMaxLoadResolution(int resolution);
739
740@@ -109,7 +106,6 @@
741 QList<QString> m_fifo;
742 QMutex m_cacheMutex;
743 long m_cachedBytes;
744- PreviewManager* m_previewManager;
745 bool m_logImageLoading;
746 int m_maxLoadResolution;
747
748
749=== removed file 'src/medialoader/gallery-thumbnail-image-provider.cpp'
750--- src/medialoader/gallery-thumbnail-image-provider.cpp 2013-06-10 06:20:05 +0000
751+++ src/medialoader/gallery-thumbnail-image-provider.cpp 1970-01-01 00:00:00 +0000
752@@ -1,102 +0,0 @@
753-/*
754- * Copyright (C) 2012 Canonical Ltd
755- *
756- * This program is free software: you can redistribute it and/or modify
757- * it under the terms of the GNU General Public License version 3 as
758- * published by the Free Software Foundation.
759- *
760- * This program is distributed in the hope that it will be useful,
761- * but WITHOUT ANY WARRANTY; without even the implied warranty of
762- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
763- * GNU General Public License for more details.
764- *
765- * You should have received a copy of the GNU General Public License
766- * along with this program. If not, see <http://www.gnu.org/licenses/>.
767- *
768- * Authors:
769- * Guenter Schwann <guenter.schwann@canonical.com>
770-*/
771-
772-#include "gallery-thumbnail-image-provider.h"
773-
774-// media
775-#include "preview-manager.h"
776-
777-#include <QDebug>
778-#include <QElapsedTimer>
779-
780-const char* GalleryThumbnailImageProvider::PROVIDER_ID = "gallery-thumbnail";
781-const char* GalleryThumbnailImageProvider::PROVIDER_ID_SCHEME = "image://gallery-thumbnail/";
782-const char* GalleryThumbnailImageProvider::REVISION_PARAM_NAME = "edit";
783-
784-/*!
785- * @brief GalleryThumbnailImageProvider::GalleryThumbnailImageProvider
786- */
787-GalleryThumbnailImageProvider::GalleryThumbnailImageProvider()
788- : QQuickImageProvider(QQuickImageProvider::Image),
789- m_previewManager(0),
790- m_logImageLoading(false)
791-{
792-}
793-
794-/*!
795- * \brief GalleryThumbnailImageProvider::toURL return the URL to this image provider for a local file
796- * \param file is the file that you want the url for
797- * \return URL to be used to load a local image usign this image provider
798- */
799-QUrl GalleryThumbnailImageProvider::toURL(const QFileInfo &file)
800-{
801- return QUrl::fromUserInput(PROVIDER_ID_SCHEME + file.absoluteFilePath());
802-}
803-
804-/*!
805- * @brief GalleryThumbnailImageProvider::requestImage @reimp of QQuickImageProvider::requestImage
806- * @param id is the requested image source
807- * @param size must be set to the original size of the image
808- * @param requestedSize is not used here, as thumbnails have a fixed size
809- * @return the image with id
810- */
811-QImage GalleryThumbnailImageProvider::requestImage(const QString &id, QSize *size,
812- const QSize &requestedSize)
813-{
814- Q_UNUSED(requestedSize);
815-
816- if (!m_previewManager) {
817- qWarning() << Q_FUNC_INFO << "no PreviewManager set";
818- return QImage();
819- }
820-
821- QElapsedTimer timer;
822- timer.start();
823-
824- QUrl url(id);
825- QFileInfo photoFile(url.path());
826- m_previewManager->ensurePreview(photoFile);
827-
828- QString fileName = m_previewManager->thumbnailFileName(photoFile);
829-
830- QImage thumbnail;
831- thumbnail.load(fileName);
832- if (thumbnail.isNull()) {
833- qWarning() << "Could not load thumbnail:" << id;
834- }
835-
836- if (size != NULL)
837- *size = thumbnail.size();
838-
839- if (m_logImageLoading) {
840- qDebug() << id << thumbnail.size() << "time:" << timer.elapsed() << "ms";
841- }
842-
843- return thumbnail;
844-}
845-
846-void GalleryThumbnailImageProvider::setPreviewManager(PreviewManager *previewManager)
847-{
848- m_previewManager = previewManager;
849-}
850-
851-void GalleryThumbnailImageProvider::setLogging(bool enableLogging)
852-{
853- m_logImageLoading = enableLogging;
854-}
855
856=== removed file 'src/medialoader/gallery-thumbnail-image-provider.h'
857--- src/medialoader/gallery-thumbnail-image-provider.h 2013-06-10 06:20:05 +0000
858+++ src/medialoader/gallery-thumbnail-image-provider.h 1970-01-01 00:00:00 +0000
859@@ -1,59 +0,0 @@
860-/*
861- * Copyright (C) 2012 Canonical Ltd
862- *
863- * This program is free software: you can redistribute it and/or modify
864- * it under the terms of the GNU General Public License version 3 as
865- * published by the Free Software Foundation.
866- *
867- * This program is distributed in the hope that it will be useful,
868- * but WITHOUT ANY WARRANTY; without even the implied warranty of
869- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
870- * GNU General Public License for more details.
871- *
872- * You should have received a copy of the GNU General Public License
873- * along with this program. If not, see <http://www.gnu.org/licenses/>.
874- *
875- * Authors:
876- * Guenter Schwann <guenter.schwann@canonical.com>
877-*/
878-
879-#ifndef GALLERYTHUMBNAILIMAGEPROVIDER_H
880-#define GALLERYTHUMBNAILIMAGEPROVIDER_H
881-
882-#include <QFileInfo>
883-#include <QQuickImageProvider>
884-#include <QSize>
885-#include <QString>
886-
887-class PreviewManager;
888-
889-/*!
890- * @brief The GalleryThumbailImageProvider class is used to load the small square thumbnails
891- *
892- * An extra image provider is used, so the image can be updated by adding parameters to the URL,
893- * to update the image. As for local URL, no parameters are used (internally).
894- * In future it might be used for more functionality, like custom caching of images.
895- */
896-class GalleryThumbnailImageProvider : public QQuickImageProvider
897-{
898-public:
899- static const char* PROVIDER_ID;
900- static const char* PROVIDER_ID_SCHEME;
901- static const char* REVISION_PARAM_NAME;
902-
903- GalleryThumbnailImageProvider();
904-
905- static QUrl toURL(const QFileInfo& file);
906-
907- virtual QImage requestImage(const QString& id, QSize* size,
908- const QSize& requestedSize);
909-
910- void setPreviewManager(PreviewManager* previewManager);
911- void setLogging(bool enableLogging);
912-
913-private:
914- PreviewManager* m_previewManager;
915- bool m_logImageLoading;
916-};
917-
918-#endif // GALLERYTHUMBNAILIMAGEPROVIDER_H
919
920=== removed file 'src/medialoader/preview-manager.cpp'
921--- src/medialoader/preview-manager.cpp 2013-09-04 14:39:39 +0000
922+++ src/medialoader/preview-manager.cpp 1970-01-01 00:00:00 +0000
923@@ -1,423 +0,0 @@
924-/*
925- * Copyright (C) 2012 Canonical Ltd
926- *
927- * This program is free software: you can redistribute it and/or modify
928- * it under the terms of the GNU General Public License version 3 as
929- * published by the Free Software Foundation.
930- *
931- * This program is distributed in the hope that it will be useful,
932- * but WITHOUT ANY WARRANTY; without even the implied warranty of
933- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
934- * GNU General Public License for more details.
935- *
936- * You should have received a copy of the GNU General Public License
937- * along with this program. If not, see <http://www.gnu.org/licenses/>.
938- *
939- * Authors:
940- * Jim Nelson <jim@yorba.org>
941- */
942-
943-#include "preview-manager.h"
944-#include "photo-metadata.h"
945-#include "video-metadata.h"
946-
947-// media
948-#include "media-source.h"
949-
950-#include <QCryptographicHash>
951-#include <QDir>
952-#include <QImageReader>
953-#include <QMutexLocker>
954-
955-#include <gst/gst.h>
956-
957-// FIXME adapt to different sizes. This is fixed size for the demo device
958-const int PreviewManager::PREVIEW_SIZE = 360; // in pixel
959-const int PreviewManager::THUMBNAIL_SIZE = 216; // in pixel
960-const int PreviewManager::PREVIEW_QUALITY = 70;
961-const char* PreviewManager::PREVIEW_FILE_FORMAT = "JPEG";
962-const char* PreviewManager::PREVIEW_FILE_EXT = ".jpg";
963-const QString PreviewManager::PREVIEW_DIR = "preview";
964-const QString PreviewManager::THUMBNAIL_DIR = "square";
965-
966-QMutex PreviewManager::m_createMutex;
967-
968-/*!
969- * \brief PreviewManager::PreviewManager
970- */
971-PreviewManager::PreviewManager(const QString &thumbnailDirectory, QObject *parent)
972- : QObject(parent),
973- m_thumbnailDir(thumbnailDirectory)
974-{
975- if (m_thumbnailDir.right(1) != QDir::separator())
976- m_thumbnailDir += QDir::separator();
977-
978- // create the thumbnail directory if not already present
979- QDir dir;
980- dir.mkpath(m_thumbnailDir + PREVIEW_DIR);
981- dir.mkpath(m_thumbnailDir + THUMBNAIL_DIR);
982-
983- gst_init(0, 0);
984-}
985-
986-/*!
987- * \brief PreviewManager::onMediaAddedRemoved
988- * \param added
989- * \param removed
990- */
991-void PreviewManager::onMediaAddedRemoved(const QSet<DataObject*>* added,
992- const QSet<DataObject*>* removed)
993-{
994- if (added != NULL) {
995- DataObject* object;
996- foreach (object, *added) {
997- MediaSource* source = qobject_cast<MediaSource*>(object);
998-
999- QObject::connect(source, SIGNAL(dataChanged()),
1000- this, SLOT(updatePreview()), Qt::UniqueConnection);
1001- }
1002- }
1003-
1004- if (removed != NULL) {
1005- DataObject* object;
1006- foreach (object, *removed) {
1007- MediaSource* source = qobject_cast<MediaSource*>(object);
1008- QObject::disconnect(source, SIGNAL(dataChanged()),
1009- this, SLOT(updatePreview()));
1010- }
1011- }
1012-}
1013-
1014-/*!
1015- * \brief PreviewManager::onMediaDestroying
1016- * \param destroying
1017- */
1018-void PreviewManager::onMediaDestroying(const QSet<DataObject*>* destroying)
1019-{
1020- if (destroying != NULL) {
1021- DataObject* object;
1022- foreach (object, *destroying)
1023- destroyPreviews(qobject_cast<MediaSource*>(object));
1024- }
1025-}
1026-
1027-/*!
1028- * \brief PreviewManager::updatePreview
1029- */
1030-void PreviewManager::updatePreview()
1031-{
1032- QObject* object = QObject::sender();
1033- MediaSource* source = qobject_cast<MediaSource*>(object);
1034-
1035- ensurePreview(source->file(), true);
1036-}
1037-
1038-/*!
1039- * \brief PreviewManager::previewFileName
1040- * \param file
1041- * \return
1042- */
1043-QString PreviewManager::previewFileName(const QFileInfo& file) const
1044-{
1045- return thumbnailFileName(file.canonicalFilePath(), PREVIEW_DIR);
1046-}
1047-
1048-/*!
1049- * \brief PreviewManager::thumbnailFileName
1050- * \param file
1051- * \return
1052- */
1053-QString PreviewManager::thumbnailFileName(const QFileInfo& file) const
1054-{
1055- return thumbnailFileName(file.canonicalFilePath(), THUMBNAIL_DIR);
1056-}
1057-
1058-/*!
1059- * \brief PreviewManager::ensurePreview
1060- * \param file
1061- * \param regen
1062- * \return
1063- */
1064-bool PreviewManager::ensurePreview(QFileInfo file, bool regen)
1065-{
1066- QMutexLocker locker(&m_createMutex);
1067-
1068- // If preview file exists, considered valid (unless we're regenerating it).
1069- QString preview = previewFileName(file);
1070- QString thumbnail = thumbnailFileName(file);
1071-
1072- QImage thumbMaster;
1073- if (updateNeeded(file, QFileInfo(preview)) || regen) {
1074- QSize previewSize(PREVIEW_SIZE, PREVIEW_SIZE);
1075- QImage fullsized;
1076- if (file.suffix().compare("mp4", Qt::CaseInsensitive) == 0) {
1077- fullsized = grabVideoThumbnail(file.canonicalFilePath());
1078- } else {
1079- fullsized = loadPhoto(file.canonicalFilePath(), previewSize);
1080- }
1081- if (fullsized.isNull()) {
1082- qDebug() << "Unable to generate fullsized image for " << file.filePath()
1083- << "not generating preview";
1084- return false;
1085- }
1086-
1087- fullsized.setText("Thumb::URI", QUrl::fromLocalFile(file.canonicalFilePath()).toEncoded());
1088- // scale the preview so it will fill the viewport specified by PREVIEW_*_MAX
1089- // these values are replicated in the QML so that the preview will fill each
1090- // grid cell, cropping down to the center of the image if necessary
1091- QImage scaled = (fullsized.height() > fullsized.width())
1092- ? fullsized.scaledToWidth(PREVIEW_SIZE, Qt::SmoothTransformation)
1093- : fullsized.scaledToHeight(PREVIEW_SIZE, Qt::SmoothTransformation);
1094-
1095- if (scaled.isNull()) {
1096- qDebug() << "Unable to scale " << file.filePath() << "for preview";
1097- return false;
1098- }
1099-
1100- if (!saveThumbnail(scaled, preview)) {
1101- qDebug("Unable to save preview %s", qPrintable(preview));
1102- return false;
1103- }
1104- thumbMaster = scaled;
1105- }
1106-
1107- if (updateNeeded(file, QFileInfo(thumbnail)) || regen) {
1108- if (thumbMaster.isNull()) {
1109- thumbMaster.load(preview);
1110- if (thumbMaster.isNull()) {
1111- qDebug("Unable load preview image for %s, not generating thumbnail",
1112- qPrintable(preview));
1113- return false;
1114- }
1115- }
1116-
1117- QImage square = generateThumbnail(thumbMaster);
1118- if (!saveThumbnail(square, thumbnail)) {
1119- qDebug("Unable to save preview %s", qPrintable(thumbnail));
1120- return false;
1121- }
1122- }
1123-
1124- return true;
1125-}
1126-
1127-/*!
1128- * \brief PreviewManager::saveThumbnail saves the thumbnail in a safe way
1129- * The image is written to a temporary file, and then moved (the move is atomic)
1130- * \param image thumbnail to save
1131- * \param fileName filename of the thumbnail
1132- * \return true, if saving the file was successful
1133- */
1134-bool PreviewManager::saveThumbnail(const QImage &image, const QString &fileName) const
1135-{
1136- QString temporaryName(fileName+".tmp");
1137- bool ok;
1138- ok = image.save(temporaryName, PREVIEW_FILE_FORMAT, PREVIEW_QUALITY);
1139- if (!ok) {
1140- qWarning() << "Unanble to save the thumbnail" << temporaryName;
1141- return false;
1142- }
1143-
1144- if (QFile::exists(fileName)) {
1145- QFile::remove(fileName);
1146- }
1147-
1148- QFile thumbnail(temporaryName);
1149- return thumbnail.rename(fileName);
1150-}
1151-
1152-/*!
1153- * \brief PreviewManager::destroyPreviews
1154- * \param media
1155- */
1156-void PreviewManager::destroyPreviews(MediaSource* media)
1157-{
1158- QString filename = previewFileName(media->file());
1159- if (!QFile::remove(filename))
1160- qDebug("Unable to remove preview %s", qPrintable(filename));
1161- filename = thumbnailFileName(media->file());
1162- if (!QFile::remove(filename))
1163- qDebug("Unable to remove thumbnail %s", qPrintable(filename));
1164-}
1165-
1166-/*!
1167- * \brief PreviewManager::generateThumbnail
1168- * \param master
1169- * \return
1170- */
1171-QImage PreviewManager::generateThumbnail(const QImage &master) const
1172-{
1173- int xOffset = 0;
1174- int yOffset = 0;
1175- int size = 0;
1176- if (master.width() > master.height()) {
1177- size = master.height();
1178- xOffset = (master.width() - size) / 2;
1179- } else {
1180- size = master.width();
1181- yOffset = (master.height() - size) / 2;
1182- }
1183- QImage square = master.copy(xOffset, yOffset, size, size);
1184-
1185- QImage thumbnail = square.scaled(THUMBNAIL_SIZE, THUMBNAIL_SIZE);
1186- return thumbnail;
1187-}
1188-
1189-/*!
1190- * \brief PreviewManager::thumbnailFileName generates the file name for a given
1191- * file and it's level (size/type)
1192- * \param fileName full filename URI (file:///directory/file.name.png)
1193- * \param levelName correclates to the sub directory inside of the thumbnail directory
1194- * \return full filePath of the thumbnail
1195- */
1196-QString PreviewManager::thumbnailFileName(const QString &fileName,
1197- const QString &levelName) const
1198-{
1199- QCryptographicHash md5(QCryptographicHash::Md5);
1200- md5.addData(QUrl::fromLocalFile(fileName).toEncoded());
1201- QString previewDir = m_thumbnailDir + levelName + QDir::separator();
1202- return QString(previewDir + md5.result().toHex() + PREVIEW_FILE_EXT);
1203-}
1204-
1205-/*!
1206- * \brief PreviewManager::updateNeeded checks if the thumbnail needs to be (re-)created
1207- * \param mediaFile the original photo/video
1208- * \param previewFile the preview file
1209- * \return true if the thumbnail needs to be created
1210- */
1211-bool PreviewManager::updateNeeded(const QFileInfo &mediaFile, const QFileInfo &previewFile) const
1212-{
1213- if (!previewFile.exists())
1214- return true;
1215-
1216- return mediaFile.lastModified() > previewFile.lastModified();
1217-}
1218-
1219-/*!
1220- * \brief PreviewManager::loadPhoto load a photo with correct orientation
1221- * The size can be limited as well, to speed upt the loading
1222- * \param fileName file name of the photo
1223- * \param maxSize limits the size, so that one side fits into maxSize. If an
1224- * invalid size is passed, the image is loaded in full size.
1225- * \return the photo corrctly sized and oriented
1226- */
1227-QImage PreviewManager::loadPhoto(const QString &fileName, const QSize& maxSize) const
1228-{
1229- QImageReader imageReader(fileName);
1230-
1231- QSize imageSize = imageReader.size();
1232- if (maxSize.isValid()) {
1233- QSize size = imageSize;
1234- size.scale(maxSize, Qt::KeepAspectRatioByExpanding);
1235- imageReader.setScaledSize(size);
1236- }
1237-
1238- QImage image = imageReader.read();
1239- if (!image.isNull()) {
1240- PhotoMetadata* metadata = PhotoMetadata::fromFile(fileName.toStdString().c_str());
1241- image = image.transformed(
1242- OrientationCorrection::fromOrientation(metadata->orientation())
1243- .toTransform());
1244- delete metadata;
1245- } else {
1246- qWarning() << "Could not load the image" << fileName << "for thumbnail generation";
1247- }
1248-
1249- return image;
1250-}
1251-
1252-/*!
1253- * \brief destroyFrameData cleanup function for the video thumbnail QImage
1254- * \param data
1255- */
1256-static void destroyFrameData (void *data)
1257-{
1258- gst_buffer_unref(GST_BUFFER (data));
1259-}
1260-
1261-/*!
1262- * \brief PreviewManager::grabVideoThumbnail grabs a frame from the given video file
1263- * \param fileName
1264- * \return
1265- */
1266-QImage PreviewManager::grabVideoThumbnail(const QString &fileName) const
1267-{
1268- QUrl url("file://"+fileName);
1269- gchar *guri = g_strdup(url.toString().toUtf8().data());
1270-
1271- GstElement *asink;
1272- GstElement *vsink;
1273-
1274- GstElement *pipeline = gst_element_factory_make("playbin2", "play");
1275- GstCaps *caps = gst_caps_new_simple("video/x-raw-rgb",
1276- "bpp", G_TYPE_INT, 24,
1277- "depth", G_TYPE_INT, 24,
1278- "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
1279- "endianness", G_TYPE_INT, G_BIG_ENDIAN,
1280- "red_mask", G_TYPE_INT, 0xff0000,
1281- "green_mask", G_TYPE_INT, 0x00ff00,
1282- "blue_mask", G_TYPE_INT, 0x0000ff,
1283- NULL);
1284- asink = gst_element_factory_make("fakesink", "audio-fake-sink");
1285- vsink = gst_element_factory_make("fakesink", "video-fake-sink");
1286- g_object_set(vsink, "sync", TRUE, NULL);
1287- g_object_set(pipeline,
1288- "flags", 0x00000001, // Make sure to render only the video stream (we do not need audio here)
1289- "audio-sink", asink,
1290- "video-sink", vsink,
1291- NULL);
1292-
1293- g_object_set(pipeline, "uri", guri, NULL);
1294- GstStateChangeReturn ret = gst_element_set_state(pipeline, GST_STATE_PAUSED);
1295- switch (ret)
1296- {
1297- case GST_STATE_CHANGE_FAILURE:
1298- qWarning() << "Fail to start thumbnail pipeline";
1299- return QImage();
1300- case GST_STATE_CHANGE_NO_PREROLL:
1301- qWarning() << "Thumbnail not supported for live sources";
1302- return QImage();
1303- default:
1304- break;
1305- }
1306-
1307- gst_element_seek(pipeline, 1.0,
1308- GST_FORMAT_TIME, static_cast<GstSeekFlags>(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT),
1309- GST_SEEK_TYPE_SET, 100 * GST_MSECOND,
1310- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
1311- /* And wait for this seek to complete */
1312- gst_element_get_state(pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
1313-
1314- GstBuffer *buf = 0;
1315- g_signal_emit_by_name(pipeline, "convert-frame", caps, &buf);
1316-
1317- QImage thumb;
1318- if (buf && GST_BUFFER_CAPS(buf)) {
1319- gint width, height;
1320- GstStructure *s = gst_caps_get_structure(GST_BUFFER_CAPS (buf), 0);
1321- gboolean res = gst_structure_get_int(s, "width", &width);
1322- res |= gst_structure_get_int (s, "height", &height);
1323- if (!res) {
1324- qWarning() << "could not get snapshot dimension";
1325- return QImage();
1326- }
1327-
1328- thumb = QImage(GST_BUFFER_DATA(buf), width, height, QImage::Format_RGB888, destroyFrameData, buf);
1329- }
1330-
1331- gst_caps_unref(caps);
1332- gst_element_set_state(pipeline, GST_STATE_NULL);
1333- gst_object_unref(pipeline);
1334- g_free(guri);
1335-
1336- VideoMetadata metadata;
1337- metadata.parseMetadata(QFileInfo(fileName));
1338- int rotation = metadata.rotation();
1339- if (rotation != 0) {
1340- QTransform transform;
1341- transform.rotate(rotation);
1342- thumb = thumb.transformed(transform);
1343- }
1344-
1345- return thumb;
1346-}
1347
1348=== removed file 'src/medialoader/preview-manager.h'
1349--- src/medialoader/preview-manager.h 2013-08-12 08:51:09 +0000
1350+++ src/medialoader/preview-manager.h 1970-01-01 00:00:00 +0000
1351@@ -1,87 +0,0 @@
1352-/*
1353- * Copyright (C) 2012 Canonical Ltd
1354- *
1355- * This program is free software: you can redistribute it and/or modify
1356- * it under the terms of the GNU General Public License version 3 as
1357- * published by the Free Software Foundation.
1358- *
1359- * This program is distributed in the hope that it will be useful,
1360- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1361- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1362- * GNU General Public License for more details.
1363- *
1364- * You should have received a copy of the GNU General Public License
1365- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1366- *
1367- * Authors:
1368- * Jim Nelson <jim@yorba.org>
1369- */
1370-
1371-#ifndef GALLERY_PREVIEW_MANAGER_H_
1372-#define GALLERY_PREVIEW_MANAGER_H_
1373-
1374-#include <QFileInfo>
1375-#include <QMutex>
1376-#include <QObject>
1377-#include <QSet>
1378-#include <QSize>
1379-#include <QString>
1380-
1381-class QImage;
1382-class DataObject;
1383-class MediaSource;
1384-
1385-/*!
1386- * \brief The PreviewManager class creates and removes thumbnails
1387- *
1388- * The thumbnail storage and creation is inspired by
1389- * http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html
1390- * But it uses jpeg (for performance),
1391- * uses different sizes,
1392- * not the standard sub directoy name (because of the sizes),
1393- * does not save any meta information in the thumbnails,
1394- * does not use the fail directory
1395- */
1396-class PreviewManager : public QObject
1397-{
1398- Q_OBJECT
1399-
1400-public:
1401- static const int PREVIEW_SIZE;
1402- static const int THUMBNAIL_SIZE;
1403- static const int PREVIEW_QUALITY;
1404- static const char* PREVIEW_FILE_FORMAT;
1405- static const char* PREVIEW_FILE_EXT;
1406-
1407- static const QString PREVIEW_DIR;
1408- static const QString THUMBNAIL_DIR;
1409-
1410- PreviewManager(const QString& thumbnailDirectory, QObject* parent = 0);
1411-
1412- QString previewFileName(const QFileInfo& file) const;
1413- QString thumbnailFileName(const QFileInfo& file) const;
1414-
1415- bool ensurePreview(QFileInfo file, bool regen = false);
1416-
1417-public slots:
1418- void onMediaAddedRemoved(const QSet<DataObject*>* added,
1419- const QSet<DataObject*>* removed);
1420- void onMediaDestroying(const QSet<DataObject*>* destroying);
1421-
1422-private slots:
1423- void updatePreview();
1424-
1425-private:
1426- bool saveThumbnail(const QImage& image, const QString& fileName) const;
1427- void destroyPreviews(MediaSource* media);
1428- QImage generateThumbnail(const QImage& master) const;
1429- QString thumbnailFileName(const QString& fileName, const QString& levelName) const;
1430- bool updateNeeded(const QFileInfo& mediaFile, const QFileInfo& previewFile) const;
1431- QImage loadPhoto(const QString& fileName, const QSize &maxSize) const;
1432- QImage grabVideoThumbnail(const QString& fileName) const;
1433-
1434- static QMutex m_createMutex;
1435- QString m_thumbnailDir;
1436-};
1437-
1438-#endif // GALLERY_PREVIEW_MANAGER_H_
1439
1440=== modified file 'src/photo/photo-caches.cpp'
1441--- src/photo/photo-caches.cpp 2013-07-05 08:12:31 +0000
1442+++ src/photo/photo-caches.cpp 2014-03-07 20:39:27 +0000
1443@@ -20,6 +20,7 @@
1444 #include "photo-caches.h"
1445
1446 #include <QDir>
1447+#include <utime.h>
1448
1449 const QString PhotoCaches::ORIGINAL_DIR = ".original";
1450 const QString PhotoCaches::ENHANCED_DIR = ".enhanced";
1451@@ -118,6 +119,8 @@
1452 }
1453
1454 remove(m_file);
1455+ // touch the file so that the thumbnails will correctly regenerate
1456+ utime(m_originalFile.absoluteFilePath().toUtf8(), NULL);
1457 return rename(m_originalFile, m_file);
1458 }
1459
1460
1461=== modified file 'src/photo/photo.cpp'
1462--- src/photo/photo.cpp 2013-07-26 16:06:14 +0000
1463+++ src/photo/photo.cpp 2014-03-07 20:39:27 +0000
1464@@ -35,7 +35,6 @@
1465
1466 // medialoader
1467 #include "gallery-standard-image-provider.h"
1468-#include "gallery-thumbnail-image-provider.h"
1469 #include "photo-metadata.h"
1470
1471 // util
1472@@ -274,12 +273,7 @@
1473 */
1474 QUrl Photo::galleryPreviewPath() const
1475 {
1476- QUrl url = MediaSource::galleryPreviewPath();
1477- // previews are always stored fully transformed
1478-
1479- appendPathParams(&url, TOP_LEFT_ORIGIN, 1);
1480-
1481- return url;
1482+ return MediaSource::galleryPreviewPath();
1483 }
1484
1485 /*!
1486@@ -287,16 +281,7 @@
1487 */
1488 QUrl Photo::galleryThumbnailPath() const
1489 {
1490- QUrl url = MediaSource::galleryThumbnailPath();
1491- // same as in append_path_params() this is needed to trigger an update of the image in QML
1492- // so the URL is changed by adding/chageing the edit parameter
1493- QUrlQuery query;
1494- if (m_editRevision != 0) {
1495- query.addQueryItem(GalleryThumbnailImageProvider::REVISION_PARAM_NAME,
1496- QString::number(m_editRevision));
1497- }
1498- url.setQuery(query);
1499- return url;
1500+ return MediaSource::galleryThumbnailPath();
1501 }
1502
1503 /*!
1504
1505=== modified file 'src/video/video.cpp'
1506--- src/video/video.cpp 2013-08-12 08:51:09 +0000
1507+++ src/video/video.cpp 2014-03-07 20:39:27 +0000
1508@@ -56,8 +56,9 @@
1509 */
1510 bool Video::isCameraVideo(const QFileInfo &file)
1511 {
1512- if (file.suffix() == QLatin1String("mp4") &&
1513- file.baseName().startsWith("video")) {
1514+ QMimeDatabase mimedb;
1515+ QMimeType mimeType = mimedb.mimeTypeForFile(file);
1516+ if (mimeType.name().contains("video")) {
1517 return true;
1518 }
1519
1520
1521=== added file 'tests/autopilot/gallery_app/data/option01/clip_0001.mkv'
1522Binary files tests/autopilot/gallery_app/data/option01/clip_0001.mkv 1970-01-01 00:00:00 +0000 and tests/autopilot/gallery_app/data/option01/clip_0001.mkv 2014-03-07 20:39:27 +0000 differ
1523=== modified file 'tests/autopilot/gallery_app/tests/__init__.py'
1524--- tests/autopilot/gallery_app/tests/__init__.py 2014-03-07 10:57:54 +0000
1525+++ tests/autopilot/gallery_app/tests/__init__.py 2014-03-07 20:39:27 +0000
1526@@ -320,9 +320,12 @@
1527 video_file = "video20130618_0002.mp4"
1528 shutil.copyfile(self.sample_dir+"/option01/"+video_file,
1529 self.sample_destination_dir+"/"+video_file)
1530+ video_file = "clip_0001.mkv"
1531+ shutil.copyfile(self.sample_dir+"/option01/"+video_file,
1532+ self.sample_destination_dir+"/"+video_file)
1533 self.assertThat(
1534 lambda: self.gallery_utils.number_of_photos_in_events(),
1535- Eventually(Equals(3)))
1536+ Eventually(Equals(4)))
1537
1538 def get_delete_dialog(self):
1539 """Raises StateNotFoundError if get_delete_dialog fails."""
1540
1541=== modified file 'tests/autopilot/gallery_app/tests/test_albums_view.py'
1542--- tests/autopilot/gallery_app/tests/test_albums_view.py 2013-08-09 13:55:35 +0000
1543+++ tests/autopilot/gallery_app/tests/test_albums_view.py 2014-03-07 20:39:27 +0000
1544@@ -11,14 +11,16 @@
1545 from __future__ import absolute_import
1546
1547 from testtools.matchers import Equals
1548+from autopilot.platform import model
1549
1550 from gallery_app.tests import GalleryTestCase
1551 from gallery_app.emulators.albums_view import AlbumsView
1552
1553 from time import sleep
1554-
1555+from os import environ as env
1556
1557 class TestAlbumsView(GalleryTestCase):
1558+ envDesktopMode = None
1559
1560 @property
1561 def albums_view(self):
1562@@ -26,9 +28,25 @@
1563
1564 def setUp(self):
1565 self.ARGS = []
1566+
1567+ self.envDesktopMode = env.get("DESKTOP_MODE")
1568+
1569+ if model() == "Desktop":
1570+ env["DESKTOP_MODE"] = "1"
1571+ else:
1572+ env["DESKTOP_MODE"] = "0"
1573+
1574 super(TestAlbumsView, self).setUp()
1575 self.switch_to_albums_tab()
1576
1577+ def tearDown(self):
1578+ if self.envDesktopMode:
1579+ env["DESKTOP_MODE"] = self.envDesktopMode
1580+ else:
1581+ del env["DESKTOP_MODE"]
1582+
1583+ super(TestAlbumsView, self).tearDown()
1584+
1585 def compare_number_of_albums(self, target):
1586 """Test if the number of albums is correct. For robustness (timing
1587 issues), the test is repeated after one second in case it fails"""
1588@@ -44,3 +62,13 @@
1589 self.compare_number_of_albums(1)
1590 self.main_view.open_toolbar().click_button("addButton")
1591 self.compare_number_of_albums(2)
1592+
1593+ # Check if Camera Button is not visible at Desktop mode
1594+ def test_camera_button_visible(self):
1595+ self.main_view.open_toolbar()
1596+ toolbar = self.main_view.get_toolbar()
1597+ cameraButton = toolbar.select_single("ActionItem", objectName="cameraButton")
1598+ if model() == "Desktop":
1599+ self.assertThat(cameraButton.visible, Equals(False))
1600+ else:
1601+ self.assertThat(cameraButton.visible, Equals(True))
1602
1603=== modified file 'tests/autopilot/gallery_app/tests/test_events_view.py'
1604--- tests/autopilot/gallery_app/tests/test_events_view.py 2013-10-30 05:01:48 +0000
1605+++ tests/autopilot/gallery_app/tests/test_events_view.py 2014-03-07 20:39:27 +0000
1606@@ -12,22 +12,37 @@
1607
1608 from testtools.matchers import Equals, Is
1609 from autopilot.matchers import Eventually
1610+from autopilot.platform import model
1611
1612 from gallery_app.tests import GalleryTestCase
1613
1614 from os.path import exists
1615-
1616+from os import environ as env
1617
1618 class TestEventsView(GalleryTestCase):
1619 """Tests the main gallery features"""
1620+ envDesktopMode = None
1621
1622 def setUp(self):
1623 self.ARGS = []
1624+
1625+ self.envDesktopMode = env.get("DESKTOP_MODE")
1626+
1627+ if model() == "Desktop":
1628+ env["DESKTOP_MODE"] = "1"
1629+ else:
1630+ env["DESKTOP_MODE"] = "0"
1631+
1632 # This is needed to wait for the application to start.
1633 # In the testfarm, the application may take some time to show up.
1634 super(TestEventsView, self).setUp()
1635
1636 def tearDown(self):
1637+ if self.envDesktopMode:
1638+ env["DESKTOP_MODE"] = self.envDesktopMode
1639+ else:
1640+ del env["DESKTOP_MODE"]
1641+
1642 super(TestEventsView, self).tearDown()
1643
1644 def get_events_view(self):
1645@@ -102,3 +117,13 @@
1646
1647 def test_adding_a_video(self):
1648 self.add_video_sample()
1649+
1650+ # Check if Camera Button is not visible at Desktop mode
1651+ def test_camera_button_visible(self):
1652+ self.main_view.open_toolbar()
1653+ toolbar = self.main_view.get_toolbar()
1654+ cameraButton = toolbar.select_single("ActionItem", objectName="cameraButton")
1655+ if model() == "Desktop":
1656+ self.assertThat(cameraButton.visible, Equals(False))
1657+ else:
1658+ self.assertThat(cameraButton.visible, Equals(True))
1659
1660=== modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py'
1661--- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-02-05 11:15:13 +0000
1662+++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-03-07 20:39:27 +0000
1663@@ -261,8 +261,8 @@
1664 # wait for new photo being set/reloaded, so saving thumbnailing etc.
1665 # is done
1666 edit_preview = self.photo_viewer.get_edit_preview()
1667- new_source = "image://gallery-standard/" + self.sample_file + \
1668- "?size_level=1&orientation=1&edit=2"
1669+ new_source = "image://thumbnailer/" + self.sample_file
1670+
1671 self.assertThat(edit_preview.source, Eventually(Equals(new_source)))
1672
1673 new_file_size = os.path.getsize(self.sample_file)
1674
1675=== modified file 'tests/autopilot/gallery_app/tests/test_photos_view.py'
1676--- tests/autopilot/gallery_app/tests/test_photos_view.py 2014-02-14 10:43:17 +0000
1677+++ tests/autopilot/gallery_app/tests/test_photos_view.py 2014-03-07 20:39:27 +0000
1678@@ -19,8 +19,7 @@
1679 from gallery_app.emulators.photos_view import PhotosView
1680
1681 from os.path import exists
1682-from os import environ
1683-
1684+from os import environ as env
1685 import unittest
1686
1687 class TestPhotosView(GalleryTestCase):
1688@@ -32,21 +31,21 @@
1689
1690 def setUp(self):
1691 self.ARGS = []
1692- self.envDesktopMode = environ.get("DESKTOP_MODE")
1693+ self.envDesktopMode = env.get("DESKTOP_MODE")
1694
1695 if model() == "Desktop":
1696- environ["DESKTOP_MODE"] = "1"
1697+ env["DESKTOP_MODE"] = "1"
1698 else:
1699- environ["DESKTOP_MODE"] = "0"
1700+ env["DESKTOP_MODE"] = "0"
1701
1702 super(TestPhotosView, self).setUp()
1703 self.switch_to_photos_tab()
1704
1705 def tearDown(self):
1706 if self.envDesktopMode:
1707- environ["DESKTOP_MODE"] = self.envDesktopMode
1708+ env["DESKTOP_MODE"] = self.envDesktopMode
1709 else:
1710- del environ["DESKTOP_MODE"]
1711+ del env["DESKTOP_MODE"]
1712
1713 super(TestPhotosView, self).tearDown()
1714
1715@@ -152,3 +151,13 @@
1716 self.assertThat(view.fullScreen, Eventually(Equals(False)))
1717 self.keyboard.press_and_release('Escape')
1718 self.assertThat(view.fullScreen, Eventually(Equals(False)))
1719+
1720+ # Check if Camera Button is not visible at Desktop mode
1721+ def test_camera_button_visible(self):
1722+ self.main_view.open_toolbar()
1723+ toolbar = self.main_view.get_toolbar()
1724+ cameraButton = toolbar.select_single("ActionItem", objectName="cameraButton")
1725+ if model() == "Desktop":
1726+ self.assertThat(cameraButton.visible, Equals(False))
1727+ else:
1728+ self.assertThat(cameraButton.visible, Equals(True))
1729
1730=== modified file 'tests/unittests/CMakeLists.txt'
1731--- tests/unittests/CMakeLists.txt 2013-06-14 17:59:27 +0000
1732+++ tests/unittests/CMakeLists.txt 2014-03-07 20:39:27 +0000
1733@@ -1,7 +1,7 @@
1734 add_subdirectory(command-line-parser)
1735 add_subdirectory(gallerystandardimageprovider)
1736-add_subdirectory(gallerythumbnailimageprovider)
1737 add_subdirectory(imaging)
1738+add_subdirectory(mediamonitor)
1739 add_subdirectory(mediaobjectfactory)
1740 add_subdirectory(resource)
1741 add_subdirectory(video)
1742
1743=== modified file 'tests/unittests/gallerystandardimageprovider/CMakeLists.txt'
1744--- tests/unittests/gallerystandardimageprovider/CMakeLists.txt 2013-12-16 21:49:56 +0000
1745+++ tests/unittests/gallerystandardimageprovider/CMakeLists.txt 2014-03-07 20:39:27 +0000
1746@@ -14,7 +14,6 @@
1747 )
1748
1749 QT5_WRAP_CPP(GALLERYSTANDARDIMAGEPROVIDIER_MOCS
1750- ${gallery_medialoader_src_SOURCE_DIR}/preview-manager.h
1751 ${gallery_medialoader_src_SOURCE_DIR}/photo-metadata.h
1752 )
1753
1754@@ -22,7 +21,6 @@
1755 tst_gallerystandardimageprovidertest.cpp
1756 ${gallery_src_SOURCE_DIR}/medialoader/gallery-standard-image-provider.cpp
1757 ../stubs/orientation_stub.cpp
1758- ../stubs/preview-manager_stub.cpp
1759 ../stubs/photometa-data_stub.cpp
1760 ${GALLERYSTANDARDIMAGEPROVIDIER_MOCS}
1761 )
1762
1763=== modified file 'tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp'
1764--- tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp 2013-07-03 11:53:48 +0000
1765+++ tests/unittests/gallerystandardimageprovider/tst_gallerystandardimageprovidertest.cpp 2014-03-07 20:39:27 +0000
1766@@ -24,7 +24,6 @@
1767 #include <QUrl>
1768
1769 #include "gallery-standard-image-provider.h"
1770-#include "preview-manager.h"
1771 #include "media-collection.h"
1772
1773 class tst_GalleryStandardImageProvider : public QObject
1774@@ -63,8 +62,6 @@
1775
1776 QTest::newRow("FullSize") << "/home/user/Pictures/logo.jpg?size_level=0&orientation=1" <<
1777 "/home/user/Pictures/logo.jpg";
1778- QTest::newRow("Thumbnail") << "/home/user/Pictures/logo.jpg?size_level=1&orientation=1" <<
1779- "/home/user/Pictures/.thumbs/logo_th.JPG";
1780 }
1781
1782 void tst_GalleryStandardImageProvider::idToFile()
1783@@ -72,9 +69,7 @@
1784 QFETCH(QString, id);
1785 QFETCH(QString, fileName);
1786
1787- PreviewManager previewManager("/home/user/thumbnails");
1788 GalleryStandardImageProvider provider;
1789- provider.setPreviewManager(&previewManager);
1790 QCOMPARE(provider.idToFile(id), fileName);
1791 }
1792
1793
1794=== removed directory 'tests/unittests/gallerythumbnailimageprovider'
1795=== removed file 'tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt'
1796--- tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt 2013-12-16 21:49:56 +0000
1797+++ tests/unittests/gallerythumbnailimageprovider/CMakeLists.txt 1970-01-01 00:00:00 +0000
1798@@ -1,34 +0,0 @@
1799-add_definitions(-DTEST_SUITE)
1800-
1801-if(NOT CTEST_TESTING_TIMEOUT)
1802- set(CTEST_TESTING_TIMEOUT 60)
1803-endif()
1804-
1805-include_directories(
1806- ${gallery_core_src_SOURCE_DIR}
1807- ${gallery_media_src_SOURCE_DIR}
1808- ${gallery_medialoader_src_SOURCE_DIR}
1809- ${gallery_util_src_SOURCE_DIR}
1810- ${CMAKE_BINARY_DIR}
1811- )
1812-
1813-QT5_WRAP_CPP(GALLERYTHUMBNAILIMAGEPROVIDIER_MOCS
1814- ${gallery_medialoader_src_SOURCE_DIR}/preview-manager.h
1815- )
1816-
1817-add_executable(gallerythumbnailimageprovider
1818- tst_gallerythumbnailimageprovider.cpp
1819- ../stubs/preview-manager_stub.cpp
1820- ${gallery_src_SOURCE_DIR}/medialoader/gallery-thumbnail-image-provider.cpp
1821- ${GALLERYTHUMBNAILIMAGEPROVIDIER_MOCS}
1822- )
1823-
1824-qt5_use_modules(gallerythumbnailimageprovider Quick Test)
1825-add_test(gallerythumbnailimageprovider gallerythumbnailimageprovider
1826- -xunitxml -o test_gallerythumbnailimageprovider.xml
1827- )
1828-set_tests_properties(gallerythumbnailimageprovider PROPERTIES
1829- TIMEOUT ${CTEST_TESTING_TIMEOUT}
1830- ENVIRONMENT "QT_QPA_PLATFORM=minimal"
1831- )
1832-
1833
1834=== removed file 'tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp'
1835--- tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp 2013-06-10 06:20:05 +0000
1836+++ tests/unittests/gallerythumbnailimageprovider/tst_gallerythumbnailimageprovider.cpp 1970-01-01 00:00:00 +0000
1837@@ -1,54 +0,0 @@
1838-/*
1839- * Copyright (C) 2012 Canonical, Ltd.
1840- *
1841- * Authors:
1842- * Guenter Schwann <guenter.schwann@canonical.com>
1843- *
1844- * This program is free software; you can redistribute it and/or modify
1845- * it under the terms of the GNU General Public License as published by
1846- * the Free Software Foundation; version 3.
1847- *
1848- * This program is distributed in the hope that it will be useful,
1849- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1850- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1851- * GNU General Public License for more details.
1852- *
1853- * You should have received a copy of the GNU General Public License
1854- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1855- */
1856-
1857-#include <QtTest/QtTest>
1858-#include <QFileInfo>
1859-#include <QUrl>
1860-
1861-#include "gallery-thumbnail-image-provider.h"
1862-
1863-class tst_GalleryThumbnailImageProvider : public QObject
1864-{
1865- Q_OBJECT
1866-public:
1867- tst_GalleryThumbnailImageProvider();
1868-
1869-private slots:
1870- void ToURL();
1871-
1872-private:
1873- GalleryThumbnailImageProvider gallery_thumbnail_image_provider;
1874-};
1875-
1876-tst_GalleryThumbnailImageProvider::tst_GalleryThumbnailImageProvider()
1877- : gallery_thumbnail_image_provider()
1878-{
1879-}
1880-
1881-void tst_GalleryThumbnailImageProvider::ToURL()
1882-{
1883- QFileInfo fi("/tmp/test.jpg");
1884- QUrl url = gallery_thumbnail_image_provider.toURL(fi);
1885- QUrl expect("image://gallery-thumbnail//tmp/test.jpg");
1886- QCOMPARE(url, expect);
1887-}
1888-
1889-QTEST_MAIN(tst_GalleryThumbnailImageProvider);
1890-
1891-#include "tst_gallerythumbnailimageprovider.moc"
1892
1893=== added directory 'tests/unittests/mediamonitor'
1894=== added file 'tests/unittests/mediamonitor/CMakeLists.txt'
1895--- tests/unittests/mediamonitor/CMakeLists.txt 1970-01-01 00:00:00 +0000
1896+++ tests/unittests/mediamonitor/CMakeLists.txt 2014-03-07 20:39:27 +0000
1897@@ -0,0 +1,36 @@
1898+add_definitions(-DTEST_SUITE)
1899+
1900+if(NOT CTEST_TESTING_TIMEOUT)
1901+ set(CTEST_TESTING_TIMEOUT 60)
1902+endif()
1903+
1904+include_directories(
1905+ ${gallery_media_src_SOURCE_DIR}
1906+ ${gallery_core_src_SOURCE_DIR}
1907+ ${gallery_util_src_SOURCE_DIR}
1908+ ${gallery_medialoader_src_SOURCE_DIR}
1909+ ${gallery_database_src_SOURCE_DIR}
1910+ ${gallery_album_src_SOURCE_DIR}
1911+ ${gallery_src_SOURCE_DIR}
1912+ ${CMAKE_BINARY_DIR}
1913+ )
1914+
1915+add_executable(mediamonitor tst_mediamonitor.cpp)
1916+
1917+qt5_use_modules(mediamonitor Quick Test)
1918+
1919+add_test(mediamonitor mediamonitor -xunitxml -o test_mediamonitor.xml)
1920+
1921+set_tests_properties(mediamonitor PROPERTIES
1922+ TIMEOUT ${CTEST_TESTING_TIMEOUT}
1923+ ENVIRONMENT "QT_QPA_PLATFORM=minimal"
1924+ )
1925+
1926+target_link_libraries(mediamonitor
1927+ gallery-util
1928+ gallery-media
1929+ gallery-core
1930+ gallery-medialoader
1931+ gallery-database
1932+ gallery-album
1933+ )
1934
1935=== added file 'tests/unittests/mediamonitor/tst_mediamonitor.cpp'
1936--- tests/unittests/mediamonitor/tst_mediamonitor.cpp 1970-01-01 00:00:00 +0000
1937+++ tests/unittests/mediamonitor/tst_mediamonitor.cpp 2014-03-07 20:39:27 +0000
1938@@ -0,0 +1,96 @@
1939+/* * Copyright (C) 2014 Canonical, Ltd. *
1940+ * This program is free software; you can redistribute it and/or modify
1941+ * it under the terms of the GNU General Public License as published by
1942+ * the Free Software Foundation; version 3.
1943+ *
1944+ * This program is distributed in the hope that it will be useful,
1945+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1946+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1947+ * GNU General Public License for more details.
1948+ *
1949+ * You should have received a copy of the GNU General Public License
1950+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1951+ *
1952+ */
1953+
1954+#include <QtTest>
1955+
1956+#include <QDir>
1957+#include <QTemporaryDir>
1958+#include <QImage>
1959+#include <QColor>
1960+#include <QStringList>
1961+
1962+#include "media-monitor.h"
1963+
1964+class tst_MediaMonitor : public QObject
1965+{
1966+ Q_OBJECT
1967+
1968+private slots:
1969+ void initTestCase();
1970+ void tst_scanning_sub_folders();
1971+ void cleanupTestCase();
1972+
1973+private:
1974+ QTemporaryDir *m_tmpDir;
1975+ QImage *m_sampleImage;
1976+ MediaMonitor *m_monitor;
1977+};
1978+
1979+void tst_MediaMonitor::initTestCase()
1980+{
1981+ m_tmpDir = new QTemporaryDir();
1982+
1983+ // Create a simple directories tree
1984+ QDir *dir = new QDir(m_tmpDir->path());
1985+ dir->mkpath("A/A");
1986+ dir->mkpath("A/B");
1987+ dir->mkpath("B/A");
1988+ dir->mkpath("B/B");
1989+
1990+ // Create sample image
1991+ m_sampleImage = new QImage(400, 600, QImage::Format_RGB32);
1992+ m_sampleImage->fill(QColor(Qt::red));
1993+}
1994+
1995+void tst_MediaMonitor::tst_scanning_sub_folders()
1996+{
1997+ // Create a Media Monitor
1998+ m_monitor = new MediaMonitor();
1999+
2000+ // Emitted every time a new photo/video found
2001+ QSignalSpy filesFound(m_monitor, SIGNAL(mediaItemAdded(QString)));
2002+
2003+ // Add some debug to check which media was found
2004+ connect(m_monitor, &MediaMonitor::mediaItemAdded, [](const QString &file) {
2005+ qDebug() << "File Found:" << file;
2006+ });
2007+
2008+ // Launch the monitoring process
2009+ m_monitor->startMonitoring(QStringList(m_tmpDir->path()));
2010+
2011+ // Save sample image allover the tree
2012+ m_sampleImage->save(m_tmpDir->path() + "/A/A/sample_AA.jpg", "JPG");
2013+ m_sampleImage->save(m_tmpDir->path() + "/A/B/sample_AB.jpg", "JPG");
2014+ m_sampleImage->save(m_tmpDir->path() + "/B/A/sample_BA.jpg", "JPG");
2015+ m_sampleImage->save(m_tmpDir->path() + "/B/B/sample_BB.jpg", "JPG");
2016+
2017+ m_sampleImage->save(m_tmpDir->path() + "/A/sample_A.jpg", "JPG");
2018+ m_sampleImage->save(m_tmpDir->path() + "/B/sample_B.jpg", "JPG");
2019+
2020+ m_sampleImage->save(m_tmpDir->path() + "/sample.jpg", "JPG");
2021+
2022+ QTRY_COMPARE_WITH_TIMEOUT(filesFound.count(), 7, 10000);
2023+}
2024+
2025+void tst_MediaMonitor::cleanupTestCase()
2026+{
2027+ //Remove the previously created files
2028+ QDir *dir = new QDir(m_tmpDir->path());
2029+ dir->removeRecursively();
2030+}
2031+
2032+QTEST_MAIN(tst_MediaMonitor)
2033+
2034+#include "tst_mediamonitor.moc"
2035
2036=== modified file 'tests/unittests/mediaobjectfactory/CMakeLists.txt'
2037--- tests/unittests/mediaobjectfactory/CMakeLists.txt 2013-12-16 21:49:56 +0000
2038+++ tests/unittests/mediaobjectfactory/CMakeLists.txt 2014-03-07 20:39:27 +0000
2039@@ -26,7 +26,6 @@
2040 ${gallery_database_src_SOURCE_DIR}/photo-edit-table.h
2041 ${gallery_medialoader_src_SOURCE_DIR}/gallery-standard-image-provider.h
2042 ${gallery_medialoader_src_SOURCE_DIR}/photo-metadata.h
2043- ${gallery_medialoader_src_SOURCE_DIR}/preview-manager.h
2044 ${gallery_medialoader_src_SOURCE_DIR}/video-metadata.h
2045 ${gallery_photo_src_SOURCE_DIR}/photo.h
2046 )
2047@@ -41,10 +40,8 @@
2048 ../stubs/photo-caches_stub.cpp
2049 ../stubs/photo-edit-table_stub.cpp
2050 ../stubs/photometa-data_stub.cpp
2051- ../stubs/preview-manager_stub.cpp
2052 ../stubs/video-metadata_stub.cpp
2053 ../stubs/gallery-standard-image-provider_stub.cpp
2054- ../stubs/gallery-thumbnail-image-provider_stub.cpp
2055 ../stubs/gallery-manager_stub.cpp
2056 ${MEDIAOBJECTFACTORY_MOCS}
2057 )
2058
2059=== modified file 'tests/unittests/stubs/gallery-manager_stub.cpp'
2060--- tests/unittests/stubs/gallery-manager_stub.cpp 2013-09-06 16:10:25 +0000
2061+++ tests/unittests/stubs/gallery-manager_stub.cpp 2014-03-07 20:39:27 +0000
2062@@ -35,7 +35,6 @@
2063
2064 // qml
2065 #include "gallery-standard-image-provider.h"
2066-#include "gallery-thumbnail-image-provider.h"
2067
2068 GalleryManager* GalleryManager::m_galleryManager = NULL;
2069
2070@@ -43,13 +42,11 @@
2071 : collectionsInitialised(false),
2072 m_resource(0),
2073 m_standardImageProvider(new GalleryStandardImageProvider()),
2074- m_thumbnailImageProvider(new GalleryThumbnailImageProvider()),
2075 m_database(0),
2076 m_defaultTemplate(0),
2077 m_mediaCollection(0),
2078 m_albumCollection(0),
2079 m_eventCollection(0),
2080- m_previewManager(0),
2081 m_monitor(0),
2082 m_mediaLibrary(0)
2083 {
2084@@ -93,7 +90,6 @@
2085 GalleryManager::~GalleryManager()
2086 {
2087 delete m_standardImageProvider;
2088- delete m_thumbnailImageProvider;
2089 delete m_defaultTemplate;
2090 delete m_mediaCollection;
2091 delete m_albumCollection;
2092@@ -114,8 +110,3 @@
2093 {
2094 return 0;
2095 }
2096-
2097-GalleryThumbnailImageProvider* GalleryManager::takeGalleryThumbnailImageProvider()
2098-{
2099- return 0;
2100-}
2101
2102=== modified file 'tests/unittests/stubs/gallery-standard-image-provider_stub.cpp'
2103--- tests/unittests/stubs/gallery-standard-image-provider_stub.cpp 2013-06-14 17:59:27 +0000
2104+++ tests/unittests/stubs/gallery-standard-image-provider_stub.cpp 2014-03-07 20:39:27 +0000
2105@@ -19,7 +19,6 @@
2106 */
2107
2108 #include "gallery-standard-image-provider.h"
2109-#include "preview-manager.h"
2110
2111 const char* GalleryStandardImageProvider::PROVIDER_ID = "gallery-standard";
2112 const char* GalleryStandardImageProvider::PROVIDER_ID_SCHEME = "image://gallery-standard/";
2113@@ -32,13 +31,11 @@
2114 const long MAX_CACHE_BYTES = 20L * 1024L * 1024L;
2115
2116 // fully load previews into memory when requested
2117-const int SCALED_LOAD_FLOOR_DIM_PIXELS =
2118- qMax(PreviewManager::PREVIEW_SIZE, PreviewManager::PREVIEW_SIZE);
2119+const int SCALED_LOAD_FLOOR_DIM_PIXELS = 360;
2120
2121 GalleryStandardImageProvider::GalleryStandardImageProvider()
2122 : QQuickImageProvider(QQuickImageProvider::Image),
2123 m_cachedBytes(0),
2124- m_previewManager(0),
2125 m_logImageLoading(false),
2126 m_maxLoadResolution(INT_MAX)
2127 {
2128@@ -62,11 +59,6 @@
2129 return QUrl::fromUserInput(PROVIDER_ID_SCHEME + file.absoluteFilePath());
2130 }
2131
2132-void GalleryStandardImageProvider::setPreviewManager(PreviewManager *previewManager)
2133-{
2134- m_previewManager = previewManager;
2135-}
2136-
2137 void GalleryStandardImageProvider::setLogging(bool enableLogging)
2138 {
2139 m_logImageLoading = enableLogging;
2140
2141=== removed file 'tests/unittests/stubs/gallery-thumbnail-image-provider_stub.cpp'
2142--- tests/unittests/stubs/gallery-thumbnail-image-provider_stub.cpp 2013-06-14 17:59:27 +0000
2143+++ tests/unittests/stubs/gallery-thumbnail-image-provider_stub.cpp 1970-01-01 00:00:00 +0000
2144@@ -1,55 +0,0 @@
2145-/*
2146- * Copyright (C) 2012 Canonical Ltd
2147- *
2148- * This program is free software: you can redistribute it and/or modify
2149- * it under the terms of the GNU General Public License version 3 as
2150- * published by the Free Software Foundation.
2151- *
2152- * This program is distributed in the hope that it will be useful,
2153- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2154- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2155- * GNU General Public License for more details.
2156- *
2157- * You should have received a copy of the GNU General Public License
2158- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2159- *
2160- * Authors:
2161- * Guenter Schwann <guenter.schwann@canonical.com>
2162-*/
2163-
2164-#include "gallery-thumbnail-image-provider.h"
2165-
2166-const char* GalleryThumbnailImageProvider::PROVIDER_ID = "gallery-thumbnail";
2167-const char* GalleryThumbnailImageProvider::PROVIDER_ID_SCHEME = "image://gallery-thumbnail/";
2168-const char* GalleryThumbnailImageProvider::REVISION_PARAM_NAME = "edit";
2169-
2170-GalleryThumbnailImageProvider::GalleryThumbnailImageProvider()
2171- : QQuickImageProvider(QQuickImageProvider::Image),
2172- m_previewManager(0),
2173- m_logImageLoading(false)
2174-{
2175-}
2176-
2177-QImage GalleryThumbnailImageProvider::requestImage(const QString& id,
2178- QSize* size, const QSize& requestedSize)
2179-{
2180- Q_UNUSED(id);
2181- Q_UNUSED(size);
2182- Q_UNUSED(requestedSize);
2183- return QImage();
2184-}
2185-
2186-QUrl GalleryThumbnailImageProvider::toURL(const QFileInfo &file)
2187-{
2188- return QUrl::fromUserInput(PROVIDER_ID_SCHEME + file.absoluteFilePath());
2189-}
2190-
2191-void GalleryThumbnailImageProvider::setPreviewManager(PreviewManager *previewManager)
2192-{
2193- m_previewManager = previewManager;
2194-}
2195-
2196-void GalleryThumbnailImageProvider::setLogging(bool enableLogging)
2197-{
2198- m_logImageLoading = enableLogging;
2199-}
2200
2201=== removed file 'tests/unittests/stubs/preview-manager_stub.cpp'
2202--- tests/unittests/stubs/preview-manager_stub.cpp 2013-06-18 06:16:55 +0000
2203+++ tests/unittests/stubs/preview-manager_stub.cpp 1970-01-01 00:00:00 +0000
2204@@ -1,65 +0,0 @@
2205-/*
2206- * Copyright (C) 2013 Canonical, Ltd.
2207- *
2208- * Authors:
2209- * Nicolas d'Offay <nicolas.doffay@canonical.com>
2210- *
2211- * This program is free software; you can redistribute it and/or modify
2212- * it under the terms of the GNU General Public License as published by
2213- * the Free Software Foundation; version 3.
2214- *
2215- * This program is distributed in the hope that it will be useful,
2216- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2217- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2218- * GNU General Public License for more details.
2219- *
2220- * You should have received a copy of the GNU General Public License
2221- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2222- *
2223- */
2224-
2225-#include <QDir>
2226-
2227-#include "preview-manager.h"
2228-#include "media-collection.h"
2229-
2230-const int PreviewManager::PREVIEW_SIZE = 360;
2231-const QString PreviewManager::PREVIEW_DIR = ".thumbs";
2232-const char* PreviewManager::PREVIEW_FILE_EXT = "JPG";
2233-
2234-PreviewManager::PreviewManager(const QString &thumbnailDirectory, QObject *parent)
2235-{
2236- Q_UNUSED(thumbnailDirectory);
2237-}
2238-
2239-bool PreviewManager::ensurePreview(QFileInfo file, bool regen)
2240-{
2241- file = QFileInfo();
2242- regen = false;
2243-
2244- return regen;
2245-}
2246-
2247-void PreviewManager::onMediaAddedRemoved(const QSet<DataObject *> *, const QSet<DataObject *> *)
2248-{
2249-}
2250-
2251-void PreviewManager::onMediaDestroying(const QSet<DataObject *> *)
2252-{
2253-}
2254-
2255-void PreviewManager::updatePreview()
2256-{
2257-}
2258-
2259-QString PreviewManager::previewFileName(const QFileInfo &file) const
2260-{
2261- return QString(file.absolutePath() + QDir::separator() + PREVIEW_DIR +
2262- QDir::separator() + file.completeBaseName() + "_th." + PREVIEW_FILE_EXT);
2263-}
2264-
2265-QString PreviewManager::thumbnailFileName(const QFileInfo& file) const
2266-{
2267- return QString(file.absolutePath() + PREVIEW_DIR + QDir::separator() +
2268- file.completeBaseName() + "_th_s." + PREVIEW_FILE_EXT);
2269-}
2270
2271=== modified file 'tests/unittests/video/tst_video.cpp'
2272--- tests/unittests/video/tst_video.cpp 2013-08-12 09:29:34 +0000
2273+++ tests/unittests/video/tst_video.cpp 2014-03-07 20:39:27 +0000
2274@@ -33,10 +33,10 @@
2275 QVERIFY(Video::isCameraVideo(fi));
2276
2277 fi.setFileName("/dir/video20130612_0001.avi");
2278- QVERIFY(!Video::isCameraVideo(fi));
2279+ QVERIFY(Video::isCameraVideo(fi));
2280
2281 fi.setFileName("/dir/home_video.mp4");
2282- QVERIFY(!Video::isCameraVideo(fi));
2283+ QVERIFY(Video::isCameraVideo(fi));
2284 }
2285
2286 QTEST_MAIN(tst_Video);

Subscribers

People subscribed via source and target branches