Merge lp:~schwann/gallery-app/gallery-content-hub into lp:gallery-app
- gallery-content-hub
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Gustavo Pichorim Boiko |
Approved revision: | 824 |
Merged at revision: | 827 |
Proposed branch: | lp:~schwann/gallery-app/gallery-content-hub |
Merge into: | lp:gallery-app |
Diff against target: |
622 lines (+313/-23) 14 files modified
CMakeLists.txt (+5/-0) debian/control (+1/-0) rc/qml/GalleryApplication.qml (+10/-12) rc/qml/PickerScreen.qml (+0/-2) src/CMakeLists.txt (+4/-1) src/content-communicator.cpp (+96/-0) src/content-communicator.h (+51/-0) src/gallery-application.cpp (+2/-1) src/gallery-application.h (+0/-1) src/gallery-manager.cpp (+69/-4) src/gallery-manager.h (+15/-1) tests/unittests/stubs/content-communicator_stub.cpp (+43/-0) tests/unittests/stubs/gallery-manager_stub.cpp (+10/-1) tests/unittests/video/CMakeLists.txt (+7/-0) |
To merge this branch: | bzr merge lp:~schwann/gallery-app/gallery-content-hub |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Gustavo Pichorim Boiko (community) | Approve | ||
Bill Filler (community) | Needs Fixing | ||
Review via email: mp+180378@code.launchpad.net |
Commit message
Use content hub for content picking
Description of the change
Use content hub for content picking
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:815
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 816. By Günter Schwann
-
Minor cmake improvement
- 817. By Günter Schwann
-
Trunk merged
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:817
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:817
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 818. By Günter Schwann
-
trunk merged
Bill Filler (bfiller) wrote : | # |
looks like typo in line 13
+set(CONTENTHUB
Also is Nick D'Offay intentionally listed as author of new files?
- 819. By Günter Schwann
-
* remove (wrong) author of copyright
* mark the cmake variables for the content hub as fixme
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:818
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:819
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:819
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:819
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 820. By Günter Schwann
-
Trunk merged
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:820
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:820
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 821. By Günter Schwann
-
Dynamicly switch to pick mode if needed
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:821
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 822. By Günter Schwann
-
Fix to start with --pick-mode
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:822
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:822
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Gustavo Pichorim Boiko (boiko) wrote : | # |
275 + * Simple class which encapsulates instantiates objects which require only one instance.
The "encapsulates instantiates" part seems to be a typo?
Gustavo Pichorim Boiko (boiko) wrote : | # |
285 + virtual void handle_
Just nitpicking, can you fix the coding style in there so that it is the same as used in the other methods of the same file?
Gustavo Pichorim Boiko (boiko) wrote : | # |
236 + foreach (const QUrl url, urls) {
can this be a const reference instead? (const QUrl &url)
Gustavo Pichorim Boiko (boiko) wrote : | # |
437 + * \brief GalleryManager:
That should read GalleryManager:
- 823. By Günter Schwann
-
Better name for "normal" mode of gallery
- 824. By Günter Schwann
-
Fix comments from MR
Gustavo Pichorim Boiko (boiko) wrote : | # |
Looks good now!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:823
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2013-08-16 12:55:55 +0000 |
3 | +++ CMakeLists.txt 2013-08-28 19:23:56 +0000 |
4 | @@ -38,10 +38,15 @@ |
5 | endif() |
6 | |
7 | find_package(PkgConfig REQUIRED) |
8 | +#pkg_check_modules(CONTENTHUB REQUIRED libcontent-hub) |
9 | pkg_check_modules(EXIV2 REQUIRED exiv2) |
10 | pkg_check_modules(GSTLIB REQUIRED gstreamer-0.10) |
11 | pkg_check_modules(MEDIAINFO REQUIRED libmediainfo) |
12 | |
13 | +# FIXME use cmake to find the proper variables |
14 | +set(CONTENTHUB_INCLUDE_DIRS "/usr/include/com/ubuntu/content") |
15 | +set(CONTENTHUB_LIBRARIES "content-hub") |
16 | + |
17 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror") |
18 | |
19 | # Standard install paths |
20 | |
21 | === modified file 'debian/control' |
22 | --- debian/control 2013-08-26 09:28:46 +0000 |
23 | +++ debian/control 2013-08-28 19:23:56 +0000 |
24 | @@ -5,6 +5,7 @@ |
25 | Build-Depends: debhelper (>= 9), |
26 | cmake, |
27 | dh-translations, |
28 | + libcontent-hub-dev, |
29 | libgstreamer0.10-dev, |
30 | libexiv2-dev, |
31 | libgl1-mesa-dev | libgl-dev, |
32 | |
33 | === modified file 'rc/qml/GalleryApplication.qml' |
34 | --- rc/qml/GalleryApplication.qml 2013-06-26 08:59:08 +0000 |
35 | +++ rc/qml/GalleryApplication.qml 2013-08-28 19:23:56 +0000 |
36 | @@ -37,6 +37,9 @@ |
37 | |
38 | property bool automaticOrientation: true |
39 | |
40 | + /// Indicates if the backend is loaded and the UI can be shown |
41 | + property bool allLoaded: false |
42 | + |
43 | // Big list of form factor-specific values. 'default' is used if the key |
44 | // can't be found under any other form_factor (otherwise, form_factors should |
45 | // match the FORM_FACTOR values passed from main.cpp). Just add Portrait to |
46 | @@ -141,8 +144,7 @@ |
47 | /*! |
48 | */ |
49 | function onLoaded() { |
50 | - mainScreenLoader.load(); |
51 | - loadingScreen.visible = false; |
52 | + allLoaded = true; |
53 | } |
54 | |
55 | width: units.gu(DEVICE_WIDTH) |
56 | @@ -161,26 +163,22 @@ |
57 | } |
58 | } |
59 | |
60 | - LoadingScreen { |
61 | + Loader { |
62 | id: loadingScreen |
63 | - |
64 | anchors.fill: parent |
65 | + visible: mainScreenLoader.status !== Loader.Ready |
66 | + source: visible ? Qt.resolvedUrl("LoadingScreen.qml") : "" |
67 | } |
68 | |
69 | Loader { |
70 | id: mainScreenLoader |
71 | - |
72 | // find the loader with autopilot: |
73 | objectName: "mainLoader" |
74 | |
75 | - function load() { |
76 | - if (PICK_MODE_ENABLED) |
77 | - source = "PickerScreen.qml"; |
78 | - else |
79 | - source = "MainScreen.qml"; |
80 | - } |
81 | - |
82 | anchors.fill: parent |
83 | + source: allLoaded ? (MANAGER.pickModeEnabled ? Qt.resolvedUrl("PickerScreen.qml") |
84 | + : Qt.resolvedUrl("MainScreen.qml")) |
85 | + : "" |
86 | } |
87 | |
88 | HUD.HUD { |
89 | |
90 | === modified file 'rc/qml/PickerScreen.qml' |
91 | --- rc/qml/PickerScreen.qml 2013-08-27 06:48:42 +0000 |
92 | +++ rc/qml/PickerScreen.qml 2013-08-28 19:23:56 +0000 |
93 | @@ -102,7 +102,6 @@ |
94 | return; |
95 | |
96 | MANAGER.returnPickedContent(mediaLibrary.selectedMedias); |
97 | - Qt.quit(); |
98 | } |
99 | } |
100 | |
101 | @@ -113,7 +112,6 @@ |
102 | width: units.gu(10) |
103 | onClicked: { |
104 | MANAGER.contentPickingCanceled() |
105 | - Qt.quit(); |
106 | } |
107 | } |
108 | opened: true |
109 | |
110 | === modified file 'src/CMakeLists.txt' |
111 | --- src/CMakeLists.txt 2013-08-14 20:19:09 +0000 |
112 | +++ src/CMakeLists.txt 2013-08-28 19:23:56 +0000 |
113 | @@ -31,15 +31,18 @@ |
114 | ${gallery_video_src_SOURCE_DIR} |
115 | ${gallery_qml_src_SOURCE_DIR} |
116 | ${CMAKE_BINARY_DIR} |
117 | + ${CONTENTHUB_INCLUDE_DIRS} |
118 | ) |
119 | |
120 | set(gallery_HDRS |
121 | + content-communicator.h |
122 | gallery-application.h |
123 | gallery-manager.h |
124 | media-object-factory.h |
125 | ) |
126 | |
127 | set(gallery_SRCS |
128 | + content-communicator.cpp |
129 | gallery-application.cpp |
130 | gallery-manager.cpp |
131 | main.cpp |
132 | @@ -63,7 +66,7 @@ |
133 | gallery-qml |
134 | gallery-util |
135 | gallery-video |
136 | - ${GSTLIB_LDFLAGS} |
137 | + ${CONTENTHUB_LIBRARIES} |
138 | ) |
139 | |
140 | install(TARGETS ${GALLERY} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
141 | |
142 | === added file 'src/content-communicator.cpp' |
143 | --- src/content-communicator.cpp 1970-01-01 00:00:00 +0000 |
144 | +++ src/content-communicator.cpp 2013-08-28 19:23:56 +0000 |
145 | @@ -0,0 +1,96 @@ |
146 | +/* |
147 | + * Copyright (C) 2013 Canonical, Ltd. |
148 | + * |
149 | + * This program is free software; you can redistribute it and/or modify |
150 | + * it under the terms of the GNU General Public License as published by |
151 | + * the Free Software Foundation; version 3. |
152 | + * |
153 | + * This program is distributed in the hope that it will be useful, |
154 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
155 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
156 | + * GNU General Public License for more details. |
157 | + * |
158 | + * You should have received a copy of the GNU General Public License |
159 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
160 | + * |
161 | + */ |
162 | + |
163 | +#include <content-communicator.h> |
164 | + |
165 | +#include <QDebug> |
166 | +#include <QFileInfo> |
167 | + |
168 | +#include <com/ubuntu/content/hub.h> |
169 | +#include <com/ubuntu/content/item.h> |
170 | +#include <com/ubuntu/content/transfer.h> |
171 | + |
172 | +using namespace com::ubuntu::content; |
173 | + |
174 | +/*! |
175 | + * \brief ContentCommunicator::ContentCommunicator |
176 | + * \param parent |
177 | + */ |
178 | +ContentCommunicator::ContentCommunicator(QObject *parent) |
179 | + : ImportExportHandler(parent), |
180 | + m_transfer(nullptr) |
181 | +{ |
182 | + Hub *hub = Hub::Client::instance(); |
183 | + hub->register_import_export_handler(this); |
184 | +} |
185 | + |
186 | +/*! |
187 | + * \brief \reimp |
188 | + */ |
189 | +void ContentCommunicator::handle_import(content::Transfer *) |
190 | +{ |
191 | + qDebug() << Q_FUNC_INFO << "gallery does not import content"; |
192 | +} |
193 | + |
194 | +/*! |
195 | + * \brief \reimp |
196 | + */ |
197 | +void ContentCommunicator::handle_export(content::Transfer *transfer) |
198 | +{ |
199 | + if (m_transfer != nullptr) { |
200 | + qWarning() << "gallery-app does only one content export at a time"; |
201 | + transfer->abort(); |
202 | + return; |
203 | + } |
204 | + |
205 | + m_transfer = transfer; |
206 | + emit photoRequested(); |
207 | +} |
208 | + |
209 | +/*! |
210 | + * \brief ContentCommunicator::cancelTransfer aborts the current transfer |
211 | + */ |
212 | +void ContentCommunicator::cancelTransfer() |
213 | +{ |
214 | + if (!m_transfer) { |
215 | + qWarning() << "No ongoing transfer to cancel"; |
216 | + return; |
217 | + } |
218 | + |
219 | + m_transfer->abort(); |
220 | +} |
221 | + |
222 | +/*! |
223 | + * \brief ContentCommunicator::returnPhoto returns the given photos |
224 | + * via content hub to the requester |
225 | + * \param urls |
226 | + */ |
227 | +void ContentCommunicator::returnPhotos(const QVector<QUrl> &urls) |
228 | +{ |
229 | + if (!m_transfer) { |
230 | + qWarning() << "No ongoing transfer to return a photo"; |
231 | + return; |
232 | + } |
233 | + |
234 | + QVector<Item> items; |
235 | + items.reserve(urls.size()); |
236 | + foreach (const QUrl &url, urls) { |
237 | + items.append(Item(url)); |
238 | + } |
239 | + m_transfer->charge(items); |
240 | + m_transfer = nullptr; |
241 | +} |
242 | |
243 | === added file 'src/content-communicator.h' |
244 | --- src/content-communicator.h 1970-01-01 00:00:00 +0000 |
245 | +++ src/content-communicator.h 2013-08-28 19:23:56 +0000 |
246 | @@ -0,0 +1,51 @@ |
247 | +/* |
248 | + * Copyright (C) 2013 Canonical, Ltd. |
249 | + * |
250 | + * This program is free software; you can redistribute it and/or modify |
251 | + * it under the terms of the GNU General Public License as published by |
252 | + * the Free Software Foundation; version 3. |
253 | + * |
254 | + * This program is distributed in the hope that it will be useful, |
255 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
256 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
257 | + * GNU General Public License for more details. |
258 | + * |
259 | + * You should have received a copy of the GNU General Public License |
260 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
261 | + * |
262 | + */ |
263 | + |
264 | +#ifndef CONTENTCOMMUNICATOR_H |
265 | +#define CONTENTCOMMUNICATOR_H |
266 | + |
267 | +#include <com/ubuntu/content/import_export_handler.h> |
268 | + |
269 | +#include <QUrl> |
270 | +#include <QVector> |
271 | + |
272 | +using namespace com::ubuntu; |
273 | + |
274 | +/*! |
275 | + * Class to handle the communication with the content manager |
276 | + */ |
277 | +class ContentCommunicator : public content::ImportExportHandler |
278 | +{ |
279 | + Q_OBJECT |
280 | + |
281 | +public: |
282 | + ContentCommunicator(QObject *parent = nullptr); |
283 | + |
284 | + virtual void handle_import(content::Transfer*); |
285 | + virtual void handle_export(content::Transfer *transfer); |
286 | + |
287 | + void cancelTransfer(); |
288 | + void returnPhotos(const QVector<QUrl> &urls); |
289 | + |
290 | +signals: |
291 | + void photoRequested(); |
292 | + |
293 | +private: |
294 | + content::Transfer *m_transfer; |
295 | +}; |
296 | + |
297 | +#endif // CONTENTCOMMUNICATOR_H |
298 | |
299 | === modified file 'src/gallery-application.cpp' |
300 | --- src/gallery-application.cpp 2013-08-27 06:48:42 +0000 |
301 | +++ src/gallery-application.cpp 2013-08-28 19:23:56 +0000 |
302 | @@ -81,6 +81,8 @@ |
303 | |
304 | m_galleryManager = new GalleryManager(m_cmdLineParser->picturesDir(), m_view); |
305 | m_galleryManager->logImageLoading(m_cmdLineParser->logImageLoading()); |
306 | + if (m_cmdLineParser->pickModeEnabled()) |
307 | + m_galleryManager->setDefaultUiMode(GalleryManager::PickContentMode); |
308 | |
309 | if (m_cmdLineParser->startupTimer()) |
310 | qDebug() << "Construct GalleryApplication" << m_timer->elapsed() << "ms"; |
311 | @@ -161,7 +163,6 @@ |
312 | rootContext->setContextProperty("DEVICE_WIDTH", QVariant(size.width())); |
313 | rootContext->setContextProperty("DEVICE_HEIGHT", QVariant(size.height())); |
314 | rootContext->setContextProperty("FORM_FACTOR", QVariant(m_cmdLineParser->formFactor())); |
315 | - rootContext->setContextProperty("PICK_MODE_ENABLED", QVariant(m_cmdLineParser->pickModeEnabled())); |
316 | rootContext->setContextProperty("MAX_GL_TEXTURE_SIZE", |
317 | QVariant(m_galleryManager->resource()->maxTextureSize())); |
318 | |
319 | |
320 | === modified file 'src/gallery-application.h' |
321 | --- src/gallery-application.h 2013-06-28 11:53:54 +0000 |
322 | +++ src/gallery-application.h 2013-08-28 19:23:56 +0000 |
323 | @@ -56,7 +56,6 @@ |
324 | void registerQML(); |
325 | void createView(); |
326 | |
327 | - |
328 | QQuickView *m_view; |
329 | GalleryManager *m_galleryManager; |
330 | CommandLineParser* m_cmdLineParser; |
331 | |
332 | === modified file 'src/gallery-manager.cpp' |
333 | --- src/gallery-manager.cpp 2013-08-13 09:31:23 +0000 |
334 | +++ src/gallery-manager.cpp 2013-08-28 19:23:56 +0000 |
335 | @@ -19,6 +19,7 @@ |
336 | */ |
337 | |
338 | #include "gallery-manager.h" |
339 | +#include "content-communicator.h" |
340 | #include "media-object-factory.h" |
341 | |
342 | // album |
343 | @@ -45,6 +46,7 @@ |
344 | // util |
345 | #include "resource.h" |
346 | |
347 | +#include <QApplication> |
348 | #include <QElapsedTimer> |
349 | |
350 | #include <exiv2/exiv2.hpp> |
351 | @@ -70,6 +72,9 @@ |
352 | m_eventCollection(0), |
353 | m_previewManager(0), |
354 | m_monitor(0), |
355 | + m_contentCommunicator(new ContentCommunicator(this)), |
356 | + m_pickModeEnabled(false), |
357 | + m_defaultUiMode(BrowseContentMode), |
358 | m_mediaLibrary(0) |
359 | { |
360 | const int maxTextureSize = m_resource->maxTextureSize(); |
361 | @@ -77,6 +82,9 @@ |
362 | m_mediaFactory = new MediaObjectFactory(); |
363 | |
364 | m_galleryManager = this; |
365 | + |
366 | + QObject::connect(m_contentCommunicator, SIGNAL(photoRequested()), |
367 | + this, SLOT(switchToPickMode())); |
368 | } |
369 | |
370 | /*! |
371 | @@ -125,10 +133,18 @@ |
372 | } |
373 | |
374 | QList<MediaSource*> sources = qvariant_cast<QList<MediaSource*> >(variant); |
375 | - |
376 | + QVector<QUrl> selectedMedias; |
377 | + selectedMedias.reserve(sources.size()); |
378 | foreach (const MediaSource *media, sources) { |
379 | - //FIXME call content manager API |
380 | - qDebug() << "Picked media:" << media->path(); |
381 | + QUrl url(media->path().toLocalFile()); |
382 | + selectedMedias.append(url); |
383 | + } |
384 | + m_contentCommunicator->returnPhotos(selectedMedias); |
385 | + |
386 | + if (m_defaultUiMode == BrowseContentMode) { |
387 | + setUiMode(BrowseContentMode); |
388 | + } else { |
389 | + qApp->quit(); |
390 | } |
391 | } |
392 | |
393 | @@ -138,7 +154,13 @@ |
394 | */ |
395 | void GalleryManager::contentPickingCanceled() |
396 | { |
397 | - //FIXME call content manager API |
398 | + m_contentCommunicator->cancelTransfer(); |
399 | + |
400 | + if (m_defaultUiMode == BrowseContentMode) { |
401 | + setUiMode(BrowseContentMode); |
402 | + } else { |
403 | + qApp->quit(); |
404 | + } |
405 | } |
406 | |
407 | /*! |
408 | @@ -240,6 +262,41 @@ |
409 | } |
410 | |
411 | /*! |
412 | + * \brief GalleryManager::setDefaultUiMode set the default UI mode. This might |
413 | + * get overridden during the lifetime |
414 | + * \param mode |
415 | + */ |
416 | +void GalleryManager::setDefaultUiMode(GalleryManager::UiMode mode) |
417 | +{ |
418 | + m_defaultUiMode = mode; |
419 | + m_pickModeEnabled = true; |
420 | +} |
421 | + |
422 | +/*! |
423 | + * \brief GalleryManager::setUiMode set's the current UI mode |
424 | + * \param mode |
425 | + */ |
426 | +void GalleryManager::setUiMode(GalleryManager::UiMode mode) |
427 | +{ |
428 | + bool enablePickMode = (mode == PickContentMode); |
429 | + |
430 | + if (enablePickMode != m_pickModeEnabled) { |
431 | + m_pickModeEnabled = enablePickMode; |
432 | + Q_EMIT pickModeEnabledChanged(); |
433 | + } |
434 | +} |
435 | + |
436 | +/*! |
437 | + * \brief GalleryManager::pickModeEnabled returns if the current UI mode should be for |
438 | + * picking acontent |
439 | + * \return |
440 | + */ |
441 | +bool GalleryManager::pickModeEnabled() const |
442 | +{ |
443 | + return m_pickModeEnabled; |
444 | +} |
445 | + |
446 | +/*! |
447 | * \brief GalleryManager::logImageLoading enabled or disbaled logging image load |
448 | * times to stdout |
449 | * \param log |
450 | @@ -343,6 +400,14 @@ |
451 | } |
452 | |
453 | /*! |
454 | + * \brief GalleryManager::switchToPickMode |
455 | + */ |
456 | +void GalleryManager::switchToPickMode() |
457 | +{ |
458 | + setUiMode(PickContentMode); |
459 | +} |
460 | + |
461 | +/*! |
462 | * \brief GalleryManager::takeGalleryStandardImageProvider returns the standard image provider |
463 | * and gives up the owndership |
464 | */ |
465 | |
466 | === modified file 'src/gallery-manager.h' |
467 | --- src/gallery-manager.h 2013-08-13 09:31:23 +0000 |
468 | +++ src/gallery-manager.h 2013-08-28 19:23:56 +0000 |
469 | @@ -32,6 +32,7 @@ |
470 | |
471 | class AlbumCollection; |
472 | class AlbumDefaultTemplate; |
473 | +class ContentCommunicator; |
474 | class Database; |
475 | class EventCollection; |
476 | class GalleryManager; |
477 | @@ -51,9 +52,13 @@ |
478 | { |
479 | Q_OBJECT |
480 | Q_PROPERTY(QmlMediaCollectionModel* mediaLibrary READ mediaLibrary NOTIFY mediaLibraryChanged) |
481 | - |
482 | + Q_PROPERTY(bool pickModeEnabled READ pickModeEnabled NOTIFY pickModeEnabledChanged) |
483 | |
484 | public: |
485 | + enum UiMode{ |
486 | + BrowseContentMode, |
487 | + PickContentMode |
488 | + }; |
489 | GalleryManager(const QString &picturesDir, QQuickView *view); |
490 | ~GalleryManager(); |
491 | |
492 | @@ -78,12 +83,18 @@ |
493 | |
494 | QmlMediaCollectionModel *mediaLibrary() const; |
495 | |
496 | + void setDefaultUiMode(UiMode mode); |
497 | + void setUiMode(UiMode mode); |
498 | + bool pickModeEnabled() const; |
499 | + |
500 | signals: |
501 | void mediaLibraryChanged(); |
502 | + void pickModeEnabledChanged(); |
503 | |
504 | private slots: |
505 | void onMediaItemAdded(QString file); |
506 | void onMediaItemRemoved(qint64 mediaId); |
507 | + void switchToPickMode(); |
508 | |
509 | private: |
510 | GalleryManager(const GalleryManager&); |
511 | @@ -108,6 +119,9 @@ |
512 | PreviewManager* m_previewManager; |
513 | MediaObjectFactory *m_mediaFactory; |
514 | MediaMonitor *m_monitor; |
515 | + ContentCommunicator *m_contentCommunicator; |
516 | + bool m_pickModeEnabled; |
517 | + UiMode m_defaultUiMode; |
518 | |
519 | mutable QmlMediaCollectionModel *m_mediaLibrary; |
520 | }; |
521 | |
522 | === added file 'tests/unittests/stubs/content-communicator_stub.cpp' |
523 | --- tests/unittests/stubs/content-communicator_stub.cpp 1970-01-01 00:00:00 +0000 |
524 | +++ tests/unittests/stubs/content-communicator_stub.cpp 2013-08-28 19:23:56 +0000 |
525 | @@ -0,0 +1,43 @@ |
526 | +/* |
527 | + * Copyright (C) 2013 Canonical, Ltd. |
528 | + * |
529 | + * This program is free software; you can redistribute it and/or modify |
530 | + * it under the terms of the GNU General Public License as published by |
531 | + * the Free Software Foundation; version 3. |
532 | + * |
533 | + * This program is distributed in the hope that it will be useful, |
534 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
535 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
536 | + * GNU General Public License for more details. |
537 | + * |
538 | + * You should have received a copy of the GNU General Public License |
539 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
540 | + * |
541 | + */ |
542 | + |
543 | +#include <content-communicator.h> |
544 | + |
545 | +using namespace com::ubuntu::content; |
546 | + |
547 | +ContentCommunicator::ContentCommunicator(QObject *parent) |
548 | + : ImportExportHandler(parent), |
549 | + m_transfer(nullptr) |
550 | +{ |
551 | +} |
552 | + |
553 | +void ContentCommunicator::handle_import(content::Transfer *) |
554 | +{ |
555 | +} |
556 | + |
557 | +void ContentCommunicator::handle_export(content::Transfer *) |
558 | +{ |
559 | +} |
560 | + |
561 | +void ContentCommunicator::cancelTransfer() |
562 | +{ |
563 | +} |
564 | + |
565 | +void ContentCommunicator::returnPhotos(const QVector<QUrl> &urls) |
566 | +{ |
567 | + Q_UNUSED(urls); |
568 | +} |
569 | |
570 | === modified file 'tests/unittests/stubs/gallery-manager_stub.cpp' |
571 | --- tests/unittests/stubs/gallery-manager_stub.cpp 2013-08-13 09:31:23 +0000 |
572 | +++ tests/unittests/stubs/gallery-manager_stub.cpp 2013-08-28 19:23:56 +0000 |
573 | @@ -119,6 +119,15 @@ |
574 | Q_UNUSED(mediaId); |
575 | } |
576 | |
577 | +bool GalleryManager::pickModeEnabled() const |
578 | +{ |
579 | + return false; |
580 | +} |
581 | + |
582 | +void GalleryManager::switchToPickMode() |
583 | +{ |
584 | +} |
585 | + |
586 | GalleryStandardImageProvider* GalleryManager::takeGalleryStandardImageProvider() |
587 | { |
588 | return 0; |
589 | @@ -127,4 +136,4 @@ |
590 | GalleryThumbnailImageProvider* GalleryManager::takeGalleryThumbnailImageProvider() |
591 | { |
592 | return 0; |
593 | -} |
594 | \ No newline at end of file |
595 | +} |
596 | |
597 | === modified file 'tests/unittests/video/CMakeLists.txt' |
598 | --- tests/unittests/video/CMakeLists.txt 2013-08-14 07:26:50 +0000 |
599 | +++ tests/unittests/video/CMakeLists.txt 2013-08-28 19:23:56 +0000 |
600 | @@ -24,10 +24,16 @@ |
601 | ${gallery_video_src_SOURCE_DIR} |
602 | ) |
603 | |
604 | +QT_WRAP_CPP(mediaobjectfactory TST_VIDEO_MOCS |
605 | + ${gallery_src_SOURCE_DIR}/content-communicator.h |
606 | + ) |
607 | + |
608 | add_executable(video |
609 | tst_video.cpp |
610 | ${gallery_src_SOURCE_DIR}/gallery-manager.cpp |
611 | ${gallery_src_SOURCE_DIR}/media-object-factory.cpp |
612 | + ../stubs/content-communicator_stub.cpp |
613 | + ${TST_VIDEO_MOCS} |
614 | ) |
615 | |
616 | qt5_use_modules(video Widgets Core Qml Quick Test) |
617 | @@ -48,4 +54,5 @@ |
618 | gallery-qml |
619 | gallery-util |
620 | gallery-video |
621 | + "content-hub" |
622 | ) |
FAILED: Continuous integration, rev:815 jenkins. qa.ubuntu. com/job/ gallery- app-ci/ 429/ jenkins. qa.ubuntu. com/job/ gallery- app-saucy- amd64-ci/ 239/console jenkins. qa.ubuntu. com/job/ gallery- app-saucy- armhf-ci/ 239/console jenkins. qa.ubuntu. com/job/ gallery- app-saucy- i386-ci/ 239/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/2294/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/61/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy/2300/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 63/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ gallery- app-ci/ 429/rebuild
http://