Merge lp:~canonical-platform-qa/gallery-app/gallery-app-new_header-autopilot2 into lp:gallery-app
- gallery-app-new_header-autopilot2
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~canonical-platform-qa/gallery-app/gallery-app-new_header-autopilot2 |
Merge into: | lp:gallery-app |
Diff against target: |
2678 lines (+641/-1105) 31 files modified
rc/qml/AlbumEditor/AlbumEditor.qml (+9/-12) rc/qml/AlbumViewer/AlbumViewer.qml (+37/-34) rc/qml/AlbumsOverview.qml (+5/-6) rc/qml/Components/MediaSelector.qml (+12/-17) rc/qml/EventsOverview.qml (+1/-1) rc/qml/GalleryApplication.qml (+2/-3) rc/qml/MainScreen.qml (+2/-0) rc/qml/MediaViewer/GalleryPhotoComponent.qml (+2/-4) rc/qml/MediaViewer/MediaViewer.qml (+103/-149) rc/qml/MediaViewer/PhotoViewerDelegate.qml (+0/-129) rc/qml/MediaViewer/PopupPhotoViewer.qml (+16/-14) rc/qml/MediaViewer/SingleMediaViewer.qml (+246/-0) rc/qml/MediaViewer/VideoViewerDelegate.qml (+0/-125) rc/qml/MediaViewer/ZoomablePhotoComponent.qml (+0/-409) rc/qml/OrganicView/OrganicView.qml (+1/-1) rc/qml/PhotosOverview.qml (+1/-1) rc/qml/PickerScreen.qml (+15/-20) rc/qml/Utility/PhotosToolbarActions.qml (+19/-13) rc/qml/Utility/SelectionToolbarAction.qml (+32/-22) tests/autopilot/gallery_app/emulators/album_view.py (+4/-6) tests/autopilot/gallery_app/emulators/gallery_utils.py (+3/-3) tests/autopilot/gallery_app/emulators/main_screen.py (+27/-12) tests/autopilot/gallery_app/emulators/photo_viewer.py (+4/-5) tests/autopilot/gallery_app/emulators/picker_screen.py (+3/-3) tests/autopilot/gallery_app/tests/__init__.py (+6/-5) tests/autopilot/gallery_app/tests/test_album_editor.py (+14/-18) tests/autopilot/gallery_app/tests/test_album_view.py (+17/-26) tests/autopilot/gallery_app/tests/test_albums_view.py (+16/-11) tests/autopilot/gallery_app/tests/test_events_view.py (+17/-14) tests/autopilot/gallery_app/tests/test_photo_viewer.py (+8/-23) tests/autopilot/gallery_app/tests/test_photos_view.py (+19/-19) |
To merge this branch: | bzr merge lp:~canonical-platform-qa/gallery-app/gallery-app-new_header-autopilot2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Ubuntu Phablet Team | Pending | ||
Review via email: mp+233273@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-09-04.
Commit message
Not ready, just trying jenkins.
Description of the change
NOT READY.
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1077
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
Preview Diff
1 | === modified file 'rc/qml/AlbumEditor/AlbumEditor.qml' |
2 | --- rc/qml/AlbumEditor/AlbumEditor.qml 2014-06-10 00:13:50 +0000 |
3 | +++ rc/qml/AlbumEditor/AlbumEditor.qml 2014-09-03 23:54:36 +0000 |
4 | @@ -20,7 +20,7 @@ |
5 | |
6 | import QtQuick 2.0 |
7 | import Gallery 1.0 |
8 | -import Ubuntu.Components 0.1 |
9 | +import Ubuntu.Components 1.1 |
10 | import "../../js/GalleryUtility.js" as GalleryUtility |
11 | import "../../js/GraphicsRoutines.js" as GraphicsRoutines |
12 | import "../AlbumViewer" |
13 | @@ -33,17 +33,14 @@ |
14 | objectName: "mainAlbumEditor" |
15 | |
16 | title: "Edit album" |
17 | - tools: ToolbarItems { |
18 | - back: Button { |
19 | - objectName: "cancelButton" |
20 | - anchors.verticalCenter: parent.verticalCenter |
21 | - text: i18n.tr("Cancel") |
22 | - width: units.gu(10) |
23 | - onClicked: { |
24 | - if(album.newAlbum) |
25 | - albumModel.destroyAlbum(album); |
26 | - albumEditor.closeRequested(albumEditor.album, false); |
27 | - } |
28 | + head.backAction: Action { |
29 | + objectName: "cancelButton" |
30 | + text: i18n.tr("Cancel") |
31 | + iconName: "back" |
32 | + onTriggered: { |
33 | + if(album.newAlbum) |
34 | + albumModel.destroyAlbum(album); |
35 | + albumEditor.closeRequested(albumEditor.album, false); |
36 | } |
37 | } |
38 | |
39 | |
40 | === modified file 'rc/qml/AlbumViewer/AlbumViewer.qml' |
41 | --- rc/qml/AlbumViewer/AlbumViewer.qml 2014-06-18 17:43:41 +0000 |
42 | +++ rc/qml/AlbumViewer/AlbumViewer.qml 2014-09-03 23:54:36 +0000 |
43 | @@ -19,7 +19,7 @@ |
44 | */ |
45 | |
46 | import QtQuick 2.0 |
47 | -import Ubuntu.Components 0.1 |
48 | +import Ubuntu.Components 1.1 |
49 | import Gallery 1.0 |
50 | import "../../js/Gallery.js" as Gallery |
51 | import "../../js/GalleryUtility.js" as GalleryUtility |
52 | @@ -74,10 +74,6 @@ |
53 | |
54 | onVisibleChanged: { |
55 | if (visible) reopenPicture(); |
56 | - |
57 | - if (albumViewer.header) { |
58 | - albumViewer.header.visible = !visible; |
59 | - } |
60 | } |
61 | |
62 | onCloseRequested: { |
63 | @@ -135,6 +131,11 @@ |
64 | overview.pushPage(component_mediaSelector); |
65 | } |
66 | |
67 | + function toggleHeaderVisibility() |
68 | + { |
69 | + header.visible = !header.visible; |
70 | + } |
71 | + |
72 | AlbumSpreadViewer { |
73 | id: albumSpreadViewer |
74 | objectName: "spreadViewer" |
75 | @@ -188,8 +189,10 @@ |
76 | if (hit.objectName === "addButton") |
77 | showMediaSelector(); |
78 | |
79 | - if (!hit.mediaSource) |
80 | + if (!hit.mediaSource) { |
81 | + albumViewer.toggleHeaderVisibility(); |
82 | return; |
83 | + } |
84 | |
85 | albumViewer.mediaCurrentlyInView = hit.mediaSource.path; |
86 | photoViewerLoader.fadeOpen(hit.mediaSource); |
87 | @@ -302,6 +305,7 @@ |
88 | |
89 | onOpened: { |
90 | overview.pushPage(target); |
91 | + header.visible = false; |
92 | } |
93 | onCloseRequested: { |
94 | albumViewer.mediaCurrentlyInView = ""; |
95 | @@ -353,36 +357,35 @@ |
96 | } |
97 | |
98 | /// Contains the actions for the toolbar in the album view |
99 | - tools: ToolbarItems { |
100 | - ToolbarButton { |
101 | + head.actions: [ |
102 | + Action { |
103 | objectName: "addButton" |
104 | - action: Action { |
105 | - text: i18n.tr("Add to album") // text in HUD |
106 | - iconSource: Qt.resolvedUrl("../../img/add.png") |
107 | - onTriggered: { |
108 | - showMediaSelector(); |
109 | - } |
110 | - } |
111 | - text: i18n.tr("Add") // text in toolbar |
112 | - } |
113 | - ToolbarButton { |
114 | - id: deleteButton |
115 | + text: i18n.tr("Add to album") // text in HUD |
116 | + iconName: "add" |
117 | + onTriggered: showMediaSelector(); |
118 | + }, |
119 | + Action { |
120 | objectName: "deleteButton" |
121 | text: i18n.tr("Delete") |
122 | - iconSource: Qt.resolvedUrl("../../img/delete.png") |
123 | - onTriggered: { |
124 | - albumTrashDialog.album = album |
125 | - albumTrashDialog.caller = deleteButton |
126 | - albumTrashDialog.show() |
127 | - } |
128 | - } |
129 | - back: ToolbarButton { |
130 | - text: i18n.tr("Back") |
131 | - objectName: "backButton" |
132 | - iconSource: Qt.resolvedUrl("../../img/back.png") |
133 | - onTriggered: { |
134 | - __close() |
135 | - } |
136 | - } |
137 | + iconName: "delete" |
138 | + onTriggered: { |
139 | + albumTrashDialog.album = album; |
140 | + albumTrashDialog.show(); |
141 | + } |
142 | + } |
143 | + ] |
144 | + |
145 | + head.backAction: Action { |
146 | + iconName: "back" |
147 | + onTriggered: __close(); |
148 | + } |
149 | + |
150 | + Rectangle { |
151 | + id: headerBackground |
152 | + |
153 | + width: parent.width |
154 | + height: header.height |
155 | + |
156 | + visible: header.visible |
157 | } |
158 | } |
159 | |
160 | === modified file 'rc/qml/AlbumsOverview.qml' |
161 | --- rc/qml/AlbumsOverview.qml 2014-06-10 16:56:56 +0000 |
162 | +++ rc/qml/AlbumsOverview.qml 2014-09-03 23:54:36 +0000 |
163 | @@ -169,10 +169,9 @@ |
164 | root.visible = false; |
165 | |
166 | if (albumViewer.origin) { |
167 | - if (header.visible) |
168 | - header.visible = false; |
169 | albumViewer.visible = true; |
170 | overview.pushPage(albumViewer); |
171 | + header.visible = false; |
172 | } |
173 | else |
174 | albumViewer.visible = true |
175 | @@ -221,10 +220,10 @@ |
176 | tools: ToolbarItems { |
177 | id: albumOverviewTools |
178 | ToolbarButton { |
179 | - objectName: "addButton" |
180 | action: Action { |
181 | + objectName: "addButton" |
182 | text: i18n.tr("Add new album") // Text in HUD |
183 | - iconSource: Qt.resolvedUrl("../img/add.png") |
184 | + iconName: "add" |
185 | onTriggered: { |
186 | var album = albumCollectionModel.createOrphan(); |
187 | albumCollectionModel.addOrphan(album); |
188 | @@ -238,10 +237,10 @@ |
189 | text: "Add" // text in toolbar |
190 | } |
191 | ToolbarButton { |
192 | - objectName: "cameraButton" |
193 | - visible: !APP.desktopMode |
194 | action: Action { |
195 | + objectName: "cameraButton" |
196 | text: i18n.tr("Camera") |
197 | + visible: !APP.desktopMode |
198 | iconSource: Qt.resolvedUrl("../img/camera.png") |
199 | onTriggered: Qt.openUrlExternally("appid://com.ubuntu.camera/camera/current-user-version") |
200 | } |
201 | |
202 | === modified file 'rc/qml/Components/MediaSelector.qml' |
203 | --- rc/qml/Components/MediaSelector.qml 2014-05-23 08:24:38 +0000 |
204 | +++ rc/qml/Components/MediaSelector.qml 2014-09-03 23:54:36 +0000 |
205 | @@ -16,7 +16,7 @@ |
206 | |
207 | import QtQuick 2.0 |
208 | import Gallery 1.0 |
209 | -import Ubuntu.Components 0.1 |
210 | +import Ubuntu.Components 1.1 |
211 | import "../../js/Gallery.js" as Gallery |
212 | import "../OrganicView" |
213 | import "../Utility" |
214 | @@ -74,31 +74,26 @@ |
215 | selection: mediaSelector.selection |
216 | } |
217 | |
218 | - tools: ToolbarItems { |
219 | - Button { |
220 | - anchors.verticalCenter: parent.verticalCenter |
221 | + head.actions: [ |
222 | + Action { |
223 | + objectName: "addButton" |
224 | text: i18n.tr("Add to Album") |
225 | - objectName: "addButton" |
226 | - color: Gallery.HIGHLIGHT_BUTTON_COLOR |
227 | - width: units.gu(16) |
228 | + iconName: "add" |
229 | enabled: mediaSelector.selection.selectedCount |
230 | onTriggered: { |
231 | mediaSelector.addClicked(); |
232 | mediaSelector.hide(); |
233 | } |
234 | } |
235 | + ] |
236 | |
237 | - back: Button { |
238 | - anchors.verticalCenter: parent.verticalCenter |
239 | - text: i18n.tr("Cancel") |
240 | - objectName: "cancelButton" |
241 | - width: units.gu(10) |
242 | - onClicked: { |
243 | - mediaSelector.hide(); |
244 | - } |
245 | + head.backAction: Action { |
246 | + objectName: "cancelButton" |
247 | + text: i18n.tr("Cancel") |
248 | + iconName: "back" |
249 | + onTriggered: { |
250 | + mediaSelector.hide(); |
251 | } |
252 | - opened: true |
253 | - locked: true |
254 | } |
255 | |
256 | PropertyAnimation { |
257 | |
258 | === modified file 'rc/qml/EventsOverview.qml' |
259 | --- rc/qml/EventsOverview.qml 2014-03-10 17:20:03 +0000 |
260 | +++ rc/qml/EventsOverview.qml 2014-09-03 23:54:36 +0000 |
261 | @@ -94,7 +94,7 @@ |
262 | } |
263 | onAddClicked: { |
264 | __albumPicker = PopupUtils.open(Qt.resolvedUrl("Components/PopupAlbumPicker.qml"), |
265 | - caller, |
266 | + null, |
267 | {contentHeight: organicEventView.__pickerContentHeight}); |
268 | } |
269 | onDeleteClicked: { |
270 | |
271 | === modified file 'rc/qml/GalleryApplication.qml' |
272 | --- rc/qml/GalleryApplication.qml 2014-08-14 21:53:31 +0000 |
273 | +++ rc/qml/GalleryApplication.qml 2014-09-03 23:54:36 +0000 |
274 | @@ -190,6 +190,7 @@ |
275 | |
276 | Loader { |
277 | id: loadingScreen |
278 | + objectName: 'loadingScreen' |
279 | anchors.fill: parent |
280 | visible: mainScreenLoader.status !== Loader.Ready |
281 | source: visible ? Qt.resolvedUrl("LoadingScreen.qml") : "" |
282 | @@ -201,9 +202,7 @@ |
283 | source: allLoaded ? ((APP.pickModeEnabled) ? Qt.resolvedUrl("PickerScreen.qml") : |
284 | Qt.resolvedUrl("MainScreen.qml")) : "" |
285 | visible: status === Loader.Ready |
286 | - // FIXME: this causes https://bugs.launchpad.net/bugs/1356841 |
287 | - // even though it fixes the spinner loading animation, comment out for now |
288 | - //asynchronous: true |
289 | + asynchronous: true |
290 | } |
291 | |
292 | Component.onCompleted: { |
293 | |
294 | === modified file 'rc/qml/MainScreen.qml' |
295 | --- rc/qml/MainScreen.qml 2014-06-10 18:54:21 +0000 |
296 | +++ rc/qml/MainScreen.qml 2014-09-03 23:54:36 +0000 |
297 | @@ -31,6 +31,8 @@ |
298 | id: overview |
299 | objectName: "overview" |
300 | |
301 | + useDeprecatedToolbar: false |
302 | + |
303 | anchors.fill: parent |
304 | applicationName: "gallery-app" |
305 | automaticOrientation: application.automaticOrientation |
306 | |
307 | === modified file 'rc/qml/MediaViewer/GalleryPhotoComponent.qml' |
308 | --- rc/qml/MediaViewer/GalleryPhotoComponent.qml 2014-08-11 20:34:23 +0000 |
309 | +++ rc/qml/MediaViewer/GalleryPhotoComponent.qml 2014-09-03 23:54:36 +0000 |
310 | @@ -108,10 +108,8 @@ |
311 | // prevent this segfault & crash from occurring. |
312 | visible: isLoaded; |
313 | |
314 | - sourceSize: { |
315 | - width: width |
316 | - height: height |
317 | - } |
318 | + sourceSize.width: width |
319 | + sourceSize.height: height |
320 | |
321 | // use cache: !isAnimate setting for flicker-free animations and reflows |
322 | asynchronous: !isAnimate |
323 | |
324 | === modified file 'rc/qml/MediaViewer/MediaViewer.qml' |
325 | --- rc/qml/MediaViewer/MediaViewer.qml 2014-07-04 11:29:31 +0000 |
326 | +++ rc/qml/MediaViewer/MediaViewer.qml 2014-09-03 23:54:36 +0000 |
327 | @@ -20,7 +20,7 @@ |
328 | |
329 | import QtQuick 2.0 |
330 | import Gallery 1.0 |
331 | -import Ubuntu.Components 0.1 |
332 | +import Ubuntu.Components 1.1 |
333 | import Ubuntu.Components.Popups 0.1 |
334 | import Ubuntu.Components.ListItems 0.1 as ListItem |
335 | import Ubuntu.Content 0.1 |
336 | @@ -60,13 +60,14 @@ |
337 | // |
338 | // Since there is no current item if there are no more photo objects left in the model, |
339 | // the check catches this before we can inadvertently follow a stale pointer. |
340 | - property bool isReady: model != null && model.count > 0 && |
341 | - (galleryPhotoViewer.currentItem ? galleryPhotoViewer.currentItem.isLoaded : false) |
342 | + property bool isReady: model != null && model.count > 0 && galleryPhotoViewer.currentItem |
343 | |
344 | // tooolbar actions for the full view |
345 | - property Item tools: (media && !sharePicker.visible) ? (media.type === MediaSource.Photo ? |
346 | - d.photoToolbar : d.videoToolbar) |
347 | - : null |
348 | + property variant actions: (media && !sharePicker.visible) ? (media.type === MediaSource.Photo ? |
349 | + d.photoActions : d.videoActions) |
350 | + : [] |
351 | + |
352 | + property variant backAction: d.backAction |
353 | |
354 | /*! |
355 | */ |
356 | @@ -113,6 +114,16 @@ |
357 | galleryPhotoViewer.currentItem.togglePlayPause(); |
358 | } |
359 | |
360 | + function setHeaderVisibility(visible) |
361 | + { |
362 | + header.visible = visible; |
363 | + } |
364 | + |
365 | + function toggleHeaderVisibility() |
366 | + { |
367 | + setHeaderVisibility(!header.visible); |
368 | + } |
369 | + |
370 | Rectangle{ |
371 | color: "black" |
372 | anchors.fill: parent |
373 | @@ -152,37 +163,19 @@ |
374 | media = model.getAt(currentIndex); |
375 | } |
376 | |
377 | - delegate: Item { |
378 | - /// Is true while the media content is loaded |
379 | - property bool isLoaded: delegateView.item.isLoaded |
380 | - /// Is true when the view is in a state, where the user possibly |
381 | - /// interacts with the media (and not swipe to another media) |
382 | - property bool userInteracting: delegateView.item.state === "zoomed" |
383 | - /// Needed as ListView.isCurrentItem can't be used directly |
384 | - property bool isActive: ListView.isCurrentItem |
385 | - /// True if a video is currently played |
386 | - property bool isPlayingVideo: galleryPhotoViewer.currentItem ? |
387 | - galleryPhotoViewer.currentItem.state === "playing" |
388 | - : false |
389 | - |
390 | - // set the view to it's original state |
391 | - function reset() { |
392 | - delegateView.item.reset(); |
393 | - } |
394 | - /// Toggles between play and pause - only usful when a video is shown |
395 | - function togglePlayPause() { |
396 | - if (model.mediaSource.type === MediaSource.Video) |
397 | - delegateView.item.togglePlayPause(); |
398 | - } |
399 | - |
400 | - onIsActiveChanged: { |
401 | - if (!isActive) |
402 | - reset() |
403 | - } |
404 | + delegate: SingleMediaViewer { |
405 | + id: media |
406 | + objectName: "openedMedia" + index |
407 | + mediaFileURL: model.mediaSource.path |
408 | + mediaFileType: model.mediaSource.type |
409 | + maxDimension: Math.max(galleryPhotoViewer.width, galleryPhotoViewer.height) |
410 | |
411 | width: galleryPhotoViewer.width |
412 | height: galleryPhotoViewer.height |
413 | - state: delegateView.item.state |
414 | + |
415 | + // Needed as ListView.isCurrentItem can't be used directly in a change handler |
416 | + property bool isActive: ListView.isCurrentItem |
417 | + onIsActiveChanged: if (!isActive) reset(); |
418 | |
419 | opacity: { |
420 | if (!galleryPhotoViewer.moving || galleryPhotoViewer.contentX < 0 |
421 | @@ -192,26 +185,12 @@ |
422 | return 1.0 - Math.abs((galleryPhotoViewer.contentX - x) / width); |
423 | } |
424 | |
425 | - Component { |
426 | - id: component_delegatePhotoView |
427 | - PhotoViewerDelegate { |
428 | - useInteractivePreview: false |
429 | - mediaSource: model.mediaSource |
430 | - } |
431 | - } |
432 | - Component { |
433 | - id: component_delegateVideoView |
434 | - VideoViewerDelegate { |
435 | - mediaSource: model.mediaSource |
436 | - } |
437 | - } |
438 | - Loader { |
439 | - id: delegateView |
440 | - anchors.fill: parent |
441 | - sourceComponent: model.mediaSource.type === MediaSource.Photo ? |
442 | - component_delegatePhotoView : component_delegateVideoView |
443 | - } |
444 | + onClicked: viewerWrapper.toggleHeaderVisibility() |
445 | |
446 | + Connections { |
447 | + target: model.mediaSource |
448 | + onDataChanged: media.reload() |
449 | + } |
450 | } |
451 | |
452 | // Don't allow flicking while the chrome is actively displaying a popup |
453 | @@ -233,6 +212,8 @@ |
454 | anchors.fill: parent |
455 | visible: false |
456 | |
457 | + onVisibleChanged: viewerWrapper.setHeaderVisibility(!visible) |
458 | + |
459 | ContentPeerPicker { |
460 | objectName: "sharePicker" |
461 | anchors.fill: parent |
462 | @@ -488,123 +469,96 @@ |
463 | Item { |
464 | id: d |
465 | |
466 | - property Item photoToolbar: ToolbarItems { |
467 | - ToolbarButton { |
468 | - id: photoEditButton |
469 | + property list<Action> photoActions: [ |
470 | + Action { |
471 | objectName: "editButton" |
472 | - action: Action { |
473 | - text: i18n.tr("Edit") |
474 | - iconSource: "../../img/edit.png" |
475 | - onTriggered: { |
476 | - PopupUtils.open(editPopoverComponent, photoEditButton); |
477 | - } |
478 | - } |
479 | - } |
480 | - ToolbarButton { |
481 | - id: photoAddButton |
482 | + text: i18n.tr("Edit") |
483 | + iconSource: "../../img/edit.png" |
484 | + onTriggered: PopupUtils.open(editPopoverComponent, null); |
485 | + }, |
486 | + Action { |
487 | objectName: "addButton" |
488 | - action: Action { |
489 | - text: i18n.tr("Add photo to album") |
490 | - iconSource: "../../img/add.png" |
491 | - onTriggered: { |
492 | - __albumPicker = PopupUtils.open(Qt.resolvedUrl("../Components/PopupAlbumPicker.qml"), |
493 | - photoAddButton, |
494 | - {contentHeight: viewerWrapper.__pickerContentHeight}); |
495 | - } |
496 | + text: i18n.tr("Add to album") |
497 | + iconName: "add" |
498 | + onTriggered: { |
499 | + __albumPicker = PopupUtils.open(Qt.resolvedUrl("../Components/PopupAlbumPicker.qml"), |
500 | + null, |
501 | + {contentHeight: viewerWrapper.__pickerContentHeight}); |
502 | } |
503 | - text: i18n.tr("Add") |
504 | - } |
505 | - ToolbarButton { |
506 | + }, |
507 | + Action { |
508 | objectName: "deleteButton" |
509 | - action: Action { |
510 | - text: i18n.tr("Delete") |
511 | - iconSource: "../../img/delete.png" |
512 | - onTriggered: { |
513 | - if (album) |
514 | - PopupUtils.open(removeFromAlbumDialog, null); |
515 | - else |
516 | - PopupUtils.open(deleteDialog, null); |
517 | - } |
518 | - } |
519 | text: i18n.tr("Delete") |
520 | - } |
521 | - ToolbarButton { |
522 | - id: photoShareButton |
523 | + iconName: "delete" |
524 | + onTriggered: { |
525 | + if (album) |
526 | + PopupUtils.open(removeFromAlbumDialog, null); |
527 | + else |
528 | + PopupUtils.open(deleteDialog, null); |
529 | + } |
530 | + }, |
531 | + Action { |
532 | objectName: "shareButton" |
533 | + text: i18n.tr("Share photo") |
534 | + iconName: "share" |
535 | visible: !APP.desktopMode |
536 | - action: Action { |
537 | - text: i18n.tr("Share photo") |
538 | - iconSource: "../../img/share.png" |
539 | - onTriggered: { |
540 | - sharePicker.visible = true; |
541 | - } |
542 | - } |
543 | - text: i18n.tr("Share") |
544 | - } |
545 | - back: ToolbarButton { |
546 | - objectName: "backButton" |
547 | - text: i18n.tr("Back") |
548 | - iconSource: "../../img/back.png" |
549 | - onTriggered: { |
550 | - galleryPhotoViewer.currentItem.reset(); |
551 | - closeRequested(); |
552 | - } |
553 | - } |
554 | - } |
555 | + onTriggered: sharePicker.visible = true; |
556 | + } |
557 | + ] |
558 | + |
559 | |
560 | - property Item videoToolbar: ToolbarItems { |
561 | - ToolbarButton { |
562 | + property list<Action> videoActions: [ |
563 | + Action { |
564 | text: galleryPhotoViewer.currentItem ? |
565 | - (galleryPhotoViewer.currentItem.isPlayingVideo ? |
566 | - i18n.tr("Pause") : i18n.tr("Play")) |
567 | - : "" |
568 | + (galleryPhotoViewer.currentItem.isPlayingVideo ? |
569 | + i18n.tr("Pause") : i18n.tr("Play")) |
570 | + : "" |
571 | iconSource: galleryPhotoViewer.currentItem ? |
572 | - (galleryPhotoViewer.currentItem.isPlayingVideo ? |
573 | - "../../img/icon_pause.png" : "../../img/icon_play.png") |
574 | - : "" |
575 | - onTriggered: { |
576 | - galleryPhotoViewer.currentItem.togglePlayPause(); |
577 | - } |
578 | - } |
579 | - ToolbarButton { |
580 | - id: videoAddButton |
581 | - objectName: "addButton" |
582 | - text: i18n.tr("Add") |
583 | - iconSource: "../../img/add.png" |
584 | + (galleryPhotoViewer.currentItem.isPlayingVideo ? |
585 | + "../../img/icon_pause.png" : "../../img/icon_play.png") |
586 | + : "" |
587 | + onTriggered: galleryPhotoViewer.currentItem.togglePlayPause(); |
588 | + }, |
589 | + Action { |
590 | + text: i18n.tr("Add to album") |
591 | + iconName: "add" |
592 | onTriggered: { |
593 | __albumPicker = PopupUtils.open(Qt.resolvedUrl("../Components/PopupAlbumPicker.qml"), |
594 | - videoAddButton, |
595 | + null, |
596 | {contentHeight: viewerWrapper.__pickerContentHeight}); |
597 | } |
598 | - } |
599 | - ToolbarButton { |
600 | - objectName: "deleteButton" |
601 | + }, |
602 | + Action { |
603 | text: i18n.tr("Delete") |
604 | - iconSource: "../../img/delete.png" |
605 | + iconName: "delete" |
606 | onTriggered: { |
607 | - PopupUtils.open(deleteDialog, null); |
608 | + if (album) |
609 | + PopupUtils.open(removeFromAlbumDialog, null); |
610 | + else |
611 | + PopupUtils.open(deleteDialog, null); |
612 | } |
613 | - } |
614 | - ToolbarButton { |
615 | - id: videoShareButton |
616 | - objectName: "shareButton" |
617 | + }, |
618 | + Action { |
619 | + text: i18n.tr("Share photo") |
620 | + iconName: "share" |
621 | visible: !APP.desktopMode |
622 | - text: i18n.tr("Share") |
623 | - iconSource: "../../img/share.png" |
624 | - onTriggered: { |
625 | - sharePicker.visible = true; |
626 | - } |
627 | + onTriggered: sharePicker.visible = true; |
628 | } |
629 | + ] |
630 | |
631 | - back: ToolbarButton { |
632 | - objectName: "backButton" |
633 | - text: i18n.tr("Back") |
634 | - iconSource: "../../img/back.png" |
635 | - onTriggered: { |
636 | - galleryPhotoViewer.currentItem.reset(); |
637 | - closeRequested(); |
638 | - } |
639 | + property Action backAction: Action { |
640 | + iconName: "back" |
641 | + onTriggered: { |
642 | + galleryPhotoViewer.currentItem.reset(); |
643 | + closeRequested(); |
644 | } |
645 | } |
646 | } |
647 | + |
648 | + Rectangle{ |
649 | + id: headerBackground |
650 | + width: parent.width |
651 | + height: header.height |
652 | + visible: header.visible |
653 | + } |
654 | } |
655 | |
656 | === removed file 'rc/qml/MediaViewer/PhotoViewerDelegate.qml' |
657 | --- rc/qml/MediaViewer/PhotoViewerDelegate.qml 2014-03-19 20:01:31 +0000 |
658 | +++ rc/qml/MediaViewer/PhotoViewerDelegate.qml 1970-01-01 00:00:00 +0000 |
659 | @@ -1,129 +0,0 @@ |
660 | -/* |
661 | - * Copyright (C) 2011-2012 Canonical Ltd |
662 | - * |
663 | - * This program is free software: you can redistribute it and/or modify |
664 | - * it under the terms of the GNU General Public License version 3 as |
665 | - * published by the Free Software Foundation. |
666 | - * |
667 | - * This program is distributed in the hope that it will be useful, |
668 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
669 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
670 | - * GNU General Public License for more details. |
671 | - * |
672 | - * You should have received a copy of the GNU General Public License |
673 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
674 | - * |
675 | - * Authors: |
676 | - * Lucas Beeler <lucas@yorba.org> |
677 | - */ |
678 | - |
679 | -import QtQuick 2.0 |
680 | -import Gallery 1.0 |
681 | -import Ubuntu.Components 0.1 |
682 | -import Ubuntu.Components.Popups 0.1 |
683 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
684 | -import "../../js/Gallery.js" as Gallery |
685 | - |
686 | -/*! |
687 | -*/ |
688 | -Item { |
689 | - id: photoViewerDelegate |
690 | - |
691 | - /// The photo to show |
692 | - property MediaSource mediaSource |
693 | - /*! |
694 | - */ |
695 | - property bool useInteractivePreview |
696 | - /*! |
697 | - */ |
698 | - property alias isLoaded: fullPhotoComponentLoader.isLoaded |
699 | - |
700 | - /*! |
701 | - */ |
702 | - signal clicked() |
703 | - /*! |
704 | - */ |
705 | - signal zoomed() |
706 | - /*! |
707 | - */ |
708 | - signal unzoomed() |
709 | - |
710 | - /// Resets the view to it's initial state |
711 | - function reset() { |
712 | - if (!isLoaded) |
713 | - return; |
714 | - |
715 | - fullPhotoComponentLoader.item.unzoom(); |
716 | - } |
717 | - |
718 | - Connections { |
719 | - target: mediaSource |
720 | - onDataChanged: { |
721 | - // Force the image to be reloaded, to pick up the new thumbnail |
722 | - interactivePreviewImage.active = false; |
723 | - interactivePreviewImage.active = true; |
724 | - } |
725 | - } |
726 | - |
727 | - // Note that we haven't defined a state set in this component, even though |
728 | - // we bind the "state" property here. This is intentional and is necessary |
729 | - // to work around a binding issue on Qt 5.0 beta 1. Given a later version |
730 | - // of Qt, this treatment might not be necessary. |
731 | - state: (fullPhotoComponentLoader.item && |
732 | - !fullPhotoComponentLoader.item.fullyUnzoomed) ? "zoomed" : |
733 | - "unzoomed"; |
734 | - Component { |
735 | - id: interactivePreviewImageSource |
736 | - Image { |
737 | - fillMode: Image.PreserveAspectFit |
738 | - |
739 | - source: mediaSource ? mediaSource.galleryPreviewPath : "" |
740 | - sourceSize.width: 256 |
741 | - cache: false |
742 | - } |
743 | - } |
744 | - |
745 | - Loader { |
746 | - id: interactivePreviewImage |
747 | - z: 0 |
748 | - anchors.fill: parent |
749 | - |
750 | - visible: photoViewerDelegate.state == "unzoomed" |
751 | - sourceComponent: interactivePreviewImageSource |
752 | - } |
753 | - |
754 | - Loader { |
755 | - id: fullPhotoComponentLoader |
756 | - |
757 | - property bool isLoaded: status == Loader.Ready |
758 | - |
759 | - z: 1 |
760 | - asynchronous: true |
761 | - anchors.fill: parent |
762 | - opacity: (isLoaded && !useInteractivePreview) ? 1.0 : 0.0 |
763 | - |
764 | - sourceComponent: (!useInteractivePreview && !sourceComponent) ? |
765 | - fullPhotoComponent : sourceComponent; |
766 | - |
767 | - Component { |
768 | - id: fullPhotoComponent |
769 | - |
770 | - ZoomablePhotoComponent { |
771 | - id: galleryPhotoComponent |
772 | - objectName: "openedPhoto" + index |
773 | - |
774 | - anchors.fill: parent |
775 | - color: "transparent" |
776 | - |
777 | - mediaSource: photoViewerDelegate.mediaSource |
778 | - load: true; |
779 | - |
780 | - ownerName: "photoViewerDelegate" |
781 | - |
782 | - onZoomed: photoViewerDelegate.zoomed() |
783 | - onUnzoomed: photoViewerDelegate.unzoomed() |
784 | - onClicked: photoViewerDelegate.clicked() |
785 | - } |
786 | - } |
787 | - } |
788 | -} |
789 | |
790 | === modified file 'rc/qml/MediaViewer/PopupPhotoViewer.qml' |
791 | --- rc/qml/MediaViewer/PopupPhotoViewer.qml 2014-06-10 15:26:17 +0000 |
792 | +++ rc/qml/MediaViewer/PopupPhotoViewer.qml 2014-09-03 23:54:36 +0000 |
793 | @@ -18,7 +18,7 @@ |
794 | */ |
795 | |
796 | import QtQuick 2.0 |
797 | -import Ubuntu.Components 0.1 |
798 | +import Ubuntu.Components 1.1 |
799 | import "../Utility" |
800 | |
801 | // A PhotoViewer that is opened and closed with the PhotoViewerTransition. |
802 | @@ -40,18 +40,18 @@ |
803 | property bool isPoppedUp: popupPhotoViewer.visible && viewer.visible && !animationRunning |
804 | |
805 | // updating active will automatically set the tools of the toolbar when activating. |
806 | - onActiveChanged: { |
807 | - if (active && popupPhotoViewer.header) { |
808 | - popupPhotoViewer.header.hide(); |
809 | - // FIXME: The hide function of header is not hiding it sometimes. |
810 | - // The issue started after we changed the page title |
811 | - popupPhotoViewer.header.visible = false; |
812 | - } |
813 | - |
814 | - if (!active && popupPhotoViewer.header && popupPhotoViewer.header.visible == false) { |
815 | - popupPhotoViewer.header.visible = true; |
816 | - } |
817 | - } |
818 | + //onActiveChanged: { |
819 | + // if (active && popupPhotoViewer.header) { |
820 | + // popupPhotoViewer.header.hide(); |
821 | + // // FIXME: The hide function of header is not hiding it sometimes. |
822 | + // // The issue started after we changed the page title |
823 | + // popupPhotoViewer.header.visible = false; |
824 | + // } |
825 | + // |
826 | + // if (!active && popupPhotoViewer.header && popupPhotoViewer.header.visible == false) { |
827 | + // popupPhotoViewer.header.visible = true; |
828 | + // } |
829 | + //} |
830 | |
831 | title: i18n.tr("Gallery") |
832 | |
833 | @@ -95,7 +95,8 @@ |
834 | closed(); |
835 | } |
836 | |
837 | - tools: viewer.tools |
838 | + head.actions: viewer.actions |
839 | + head.backAction: viewer.backAction |
840 | |
841 | MediaViewer { |
842 | id: viewer |
843 | @@ -133,6 +134,7 @@ |
844 | setCurrentPhoto(forMediaSource); |
845 | viewer.openCompleted = true; |
846 | overview.pushPage(popupPhotoViewer); |
847 | + header.visible = false; |
848 | opened(); |
849 | viewer.playVideo(); |
850 | } |
851 | |
852 | === added file 'rc/qml/MediaViewer/SingleMediaViewer.qml' |
853 | --- rc/qml/MediaViewer/SingleMediaViewer.qml 1970-01-01 00:00:00 +0000 |
854 | +++ rc/qml/MediaViewer/SingleMediaViewer.qml 2014-09-03 23:54:36 +0000 |
855 | @@ -0,0 +1,246 @@ |
856 | +/* |
857 | + * Copyright 2014 Canonical Ltd. |
858 | + * |
859 | + * This program is free software; you can redistribute it and/or modify |
860 | + * it under the terms of the GNU General Public License as published by |
861 | + * the Free Software Foundation; version 3. |
862 | + * |
863 | + * This program is distributed in the hope that it will be useful, |
864 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
865 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
866 | + * GNU General Public License for more details. |
867 | + * |
868 | + * You should have received a copy of the GNU General Public License |
869 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
870 | + */ |
871 | + |
872 | +import QtQuick 2.2 |
873 | +import QtMultimedia 5.0 |
874 | +import Ubuntu.Components 1.0 |
875 | +import Ubuntu.Components.ListItems 1.0 as ListItems |
876 | +import Ubuntu.Components.Popups 1.0 |
877 | +import Ubuntu.Content 0.1 |
878 | +import Ubuntu.Thumbnailer 0.1 |
879 | +import Gallery 1.0 |
880 | +import "../Components" |
881 | + |
882 | +Item { |
883 | + id: viewer |
884 | + property bool pinchInProgress: zoomPinchArea.active |
885 | + property var mediaFileType |
886 | + property string mediaFileURL |
887 | + property real maxDimension |
888 | + |
889 | + property bool isVideo: mediaFileType === MediaSource.Video |
890 | + property bool isPlayingVideo: isVideo && video.isPlaying |
891 | + property bool userInteracting: pinchInProgress || flickable.sizeScale != 1.0 |
892 | + property bool fullyZoomed: flickable.sizeScale == zoomPinchArea.maximumZoom |
893 | + property bool fullyUnzoomed: flickable.sizeScale == zoomPinchArea.minimumZoom |
894 | + |
895 | + property alias paintedHeight: image.paintedHeight |
896 | + property alias paintedWidth: image.paintedWidth |
897 | + |
898 | + signal clicked() |
899 | + |
900 | + function zoomIn(centerX, centerY, factor) { |
901 | + flickable.scaleCenterX = centerX / (flickable.sizeScale * flickable.width); |
902 | + flickable.scaleCenterY = centerY / (flickable.sizeScale * flickable.height); |
903 | + flickable.sizeScale = factor; |
904 | + } |
905 | + |
906 | + function zoomOut() { |
907 | + if (flickable.sizeScale != 1.0) { |
908 | + flickable.scaleCenterX = flickable.contentX / flickable.width / (flickable.sizeScale - 1); |
909 | + flickable.scaleCenterY = flickable.contentY / flickable.height / (flickable.sizeScale - 1); |
910 | + flickable.sizeScale = 1.0; |
911 | + } |
912 | + } |
913 | + |
914 | + function reload() { |
915 | + if (!viewer.isVideo) { |
916 | + var src = image.source |
917 | + image.asynchronous = false |
918 | + image.source = "" |
919 | + image.asynchronous = true |
920 | + image.source = src; |
921 | + |
922 | + src = highResolutionImage.source |
923 | + highResolutionImage.asynchronous = false |
924 | + highResolutionImage.source = "" |
925 | + highResolutionImage.asynchronous = true |
926 | + highResolutionImage.source = src |
927 | + } |
928 | + } |
929 | + |
930 | + function reset() { |
931 | + if (viewer.isVideo) { |
932 | + if (video.item) { |
933 | + video.item.stop(); |
934 | + video.sourceComponent = null; |
935 | + } |
936 | + } else zoomOut() |
937 | + } |
938 | + |
939 | + function togglePlayPause() { |
940 | + if (video.isPlaying) video.pause(); |
941 | + else video.play(); |
942 | + } |
943 | + |
944 | + ActivityIndicator { |
945 | + anchors.centerIn: parent |
946 | + visible: running |
947 | + running: image.status != Image.Ready |
948 | + } |
949 | + |
950 | + PinchArea { |
951 | + id: zoomPinchArea |
952 | + anchors.fill: parent |
953 | + |
954 | + property real initialZoom |
955 | + property real maximumScale: 3.0 |
956 | + property real minimumZoom: 1.0 |
957 | + property real maximumZoom: 3.0 |
958 | + property bool active: false |
959 | + property var center |
960 | + |
961 | + onPinchStarted: { |
962 | + active = true; |
963 | + initialZoom = flickable.sizeScale; |
964 | + center = zoomPinchArea.mapToItem(media, pinch.startCenter.x, pinch.startCenter.y); |
965 | + zoomIn(center.x, center.y, initialZoom); |
966 | + } |
967 | + onPinchUpdated: { |
968 | + var zoomFactor = MathUtils.clamp(initialZoom * pinch.scale, minimumZoom, maximumZoom); |
969 | + flickable.sizeScale = zoomFactor; |
970 | + } |
971 | + onPinchFinished: { |
972 | + active = false; |
973 | + } |
974 | + |
975 | + Flickable { |
976 | + id: flickable |
977 | + anchors.fill: parent |
978 | + contentWidth: media.width |
979 | + contentHeight: media.height |
980 | + contentX: (sizeScale - 1) * scaleCenterX * width |
981 | + contentY: (sizeScale - 1) * scaleCenterY * height |
982 | + interactive: !viewer.pinchInProgress |
983 | + |
984 | + property real sizeScale: 1.0 |
985 | + property real scaleCenterX: 0.0 |
986 | + property real scaleCenterY: 0.0 |
987 | + Behavior on sizeScale { |
988 | + enabled: !viewer.pinchInProgress |
989 | + UbuntuNumberAnimation {duration: UbuntuAnimation.FastDuration} |
990 | + } |
991 | + Behavior on scaleCenterX { |
992 | + UbuntuNumberAnimation {duration: UbuntuAnimation.FastDuration} |
993 | + } |
994 | + Behavior on scaleCenterY { |
995 | + UbuntuNumberAnimation {duration: UbuntuAnimation.FastDuration} |
996 | + } |
997 | + |
998 | + Item { |
999 | + id: media |
1000 | + |
1001 | + width: flickable.width * flickable.sizeScale |
1002 | + height: flickable.height * flickable.sizeScale |
1003 | + |
1004 | + Image { |
1005 | + id: image |
1006 | + anchors.fill: parent |
1007 | + asynchronous: true |
1008 | + cache: false |
1009 | + source: "image://thumbnailer/" + mediaFileURL.toString() |
1010 | + sourceSize { |
1011 | + width: viewer.maxDimension |
1012 | + height: viewer.maxDimension |
1013 | + } |
1014 | + fillMode: Image.PreserveAspectFit |
1015 | + opacity: status == Image.Ready ? 1.0 : 0.0 |
1016 | + Behavior on opacity { UbuntuNumberAnimation {duration: UbuntuAnimation.FastDuration} } |
1017 | + |
1018 | + } |
1019 | + |
1020 | + Image { |
1021 | + id: highResolutionImage |
1022 | + anchors.fill: parent |
1023 | + asynchronous: true |
1024 | + cache: false |
1025 | + source: flickable.sizeScale > 1.0 ? mediaFileURL : "" |
1026 | + sourceSize { |
1027 | + width: width |
1028 | + height: height |
1029 | + } |
1030 | + fillMode: Image.PreserveAspectFit |
1031 | + } |
1032 | + } |
1033 | + |
1034 | + Loader { |
1035 | + id: video |
1036 | + anchors.fill: parent |
1037 | + visible: viewer.isVideo && video.status == Loader.Ready && |
1038 | + video.item.playbackState !== MediaPlayer.StoppedState |
1039 | + onLoaded: { |
1040 | + item.source = mediaFileURL; |
1041 | + item.play() |
1042 | + } |
1043 | + |
1044 | + property bool isPlaying: item && item.playbackState === MediaPlayer.PlayingState |
1045 | + function play() { |
1046 | + if (item) item.play(); |
1047 | + else sourceComponent = component_video; |
1048 | + } |
1049 | + function pause() { |
1050 | + if (item) item.pause(); |
1051 | + } |
1052 | + } |
1053 | + |
1054 | + Icon { |
1055 | + width: units.gu(5) |
1056 | + height: units.gu(5) |
1057 | + anchors.centerIn: parent |
1058 | + name: "media-playback-start" |
1059 | + color: "white" |
1060 | + opacity: 0.8 |
1061 | + visible: viewer.isVideo && |
1062 | + (!video.item || item.playbackState === MediaPlayer.StoppedState) |
1063 | + } |
1064 | + |
1065 | + MouseArea { |
1066 | + anchors.fill: parent |
1067 | + onDoubleClicked: { |
1068 | + clickTimer.stop(); |
1069 | + if (viewer.isVideo) return; |
1070 | + |
1071 | + if (flickable.sizeScale < zoomPinchArea.maximumZoom) { |
1072 | + zoomIn(mouse.x, mouse.y, zoomPinchArea.maximumZoom); |
1073 | + } else { |
1074 | + zoomOut(); |
1075 | + } |
1076 | + } |
1077 | + onClicked: clickTimer.start() |
1078 | + |
1079 | + Timer { |
1080 | + id: clickTimer |
1081 | + interval: 20 |
1082 | + onTriggered: viewer.clicked() |
1083 | + } |
1084 | + } |
1085 | + |
1086 | + MouseArea { |
1087 | + anchors.centerIn: parent |
1088 | + width: units.gu(10) |
1089 | + height: units.gu(10) |
1090 | + enabled: viewer.isVideo |
1091 | + onClicked: viewer.togglePlayPause() |
1092 | + } |
1093 | + } |
1094 | + |
1095 | + Component { |
1096 | + id: component_video |
1097 | + Video { } |
1098 | + } |
1099 | + } |
1100 | +} |
1101 | + |
1102 | |
1103 | === removed file 'rc/qml/MediaViewer/VideoViewerDelegate.qml' |
1104 | --- rc/qml/MediaViewer/VideoViewerDelegate.qml 2014-03-21 22:11:44 +0000 |
1105 | +++ rc/qml/MediaViewer/VideoViewerDelegate.qml 1970-01-01 00:00:00 +0000 |
1106 | @@ -1,125 +0,0 @@ |
1107 | -/* |
1108 | - * Copyright (C) 2013 Canonical Ltd |
1109 | - * |
1110 | - * This program is free software: you can redistribute it and/or modify |
1111 | - * it under the terms of the GNU General Public License version 3 as |
1112 | - * published by the Free Software Foundation. |
1113 | - * |
1114 | - * This program is distributed in the hope that it will be useful, |
1115 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1116 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1117 | - * GNU General Public License for more details. |
1118 | - * |
1119 | - * You should have received a copy of the GNU General Public License |
1120 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1121 | - */ |
1122 | - |
1123 | -import QtQuick 2.0 |
1124 | -import QtMultimedia 5.0 |
1125 | -import Gallery 1.0 |
1126 | - |
1127 | -/*! |
1128 | -VideoViewerDelegate is an item to show a vide thumbnail, and play the video |
1129 | -if requrested |
1130 | -*/ |
1131 | -Item { |
1132 | - id: videoViewerDelegate |
1133 | - |
1134 | - /// The video item that to be shown by this component |
1135 | - property MediaSource mediaSource |
1136 | - /// Is true, once this component is fully usable |
1137 | - property bool isLoaded: thumbnail.status === Image.Ready |
1138 | - |
1139 | - /// Stops the video playback if running |
1140 | - function reset() { |
1141 | - state = "stopped"; |
1142 | - } |
1143 | - |
1144 | - /// Starts playing the video |
1145 | - function playVideo() { |
1146 | - if (!loader_video.item) |
1147 | - loader_video.sourceComponent = component_video; |
1148 | - |
1149 | - if (loader_video.item.source !== mediaSource.path) |
1150 | - loader_video.item.source = mediaSource.path; |
1151 | - loader_video.item.play(); |
1152 | - } |
1153 | - |
1154 | - /// Toggles between playing and pausing the video playback |
1155 | - function togglePlayPause() { |
1156 | - if (!loader_video.item) |
1157 | - loader_video.sourceComponent = component_video; |
1158 | - |
1159 | - if (videoViewerDelegate.state === "playing") { |
1160 | - loader_video.item.pause(); |
1161 | - } else { |
1162 | - videoViewerDelegate.playVideo(); |
1163 | - } |
1164 | - } |
1165 | - |
1166 | - Image { |
1167 | - id: thumbnail |
1168 | - |
1169 | - anchors.fill: parent |
1170 | - fillMode: Image.PreserveAspectFit |
1171 | - source: mediaSource.galleryPreviewPath |
1172 | - asynchronous: true |
1173 | - } |
1174 | - |
1175 | - Image { |
1176 | - // Display a play icon if the media is a video |
1177 | - source: "../../img/icon_play.png" |
1178 | - anchors.centerIn: parent |
1179 | - } |
1180 | - |
1181 | - MouseArea { |
1182 | - anchors.fill: parent |
1183 | - onClicked: { |
1184 | - videoViewerDelegate.togglePlayPause(); |
1185 | - } |
1186 | - } |
1187 | - |
1188 | - Component { |
1189 | - id: component_video |
1190 | - Video { |
1191 | - id: video |
1192 | - onStopped: { |
1193 | - videoViewerDelegate.state = "stopped"; |
1194 | - } |
1195 | - onPaused: { |
1196 | - videoViewerDelegate.state = "paused" |
1197 | - } |
1198 | - onPlaying: { |
1199 | - videoViewerDelegate.state = "playing" |
1200 | - } |
1201 | - } |
1202 | - } |
1203 | - Loader { |
1204 | - id: loader_video |
1205 | - anchors.fill: parent |
1206 | - } |
1207 | - |
1208 | - |
1209 | - state: "stopped" |
1210 | - states: [ |
1211 | - State { |
1212 | - name: "playing" |
1213 | - PropertyChanges { target: thumbnail; visible: false } |
1214 | - }, |
1215 | - State { |
1216 | - name: "paused" |
1217 | - PropertyChanges { target: thumbnail; visible: false } |
1218 | - }, |
1219 | - State { |
1220 | - name: "stopped" |
1221 | - PropertyChanges { target: thumbnail; visible: true } |
1222 | - } |
1223 | - ] |
1224 | - onStateChanged: { |
1225 | - if (state === "stopped") { |
1226 | - if (loader_video.item) |
1227 | - loader_video.item.stop() |
1228 | - loader_video.sourceComponent = null |
1229 | - } |
1230 | - } |
1231 | -} |
1232 | |
1233 | === removed file 'rc/qml/MediaViewer/ZoomablePhotoComponent.qml' |
1234 | --- rc/qml/MediaViewer/ZoomablePhotoComponent.qml 2014-04-04 13:16:49 +0000 |
1235 | +++ rc/qml/MediaViewer/ZoomablePhotoComponent.qml 1970-01-01 00:00:00 +0000 |
1236 | @@ -1,409 +0,0 @@ |
1237 | -/* |
1238 | - * Copyright (C) 2012 Canonical Ltd |
1239 | - * |
1240 | - * This program is free software: you can redistribute it and/or modify |
1241 | - * it under the terms of the GNU General Public License version 3 as |
1242 | - * published by the Free Software Foundation. |
1243 | - * |
1244 | - * This program is distributed in the hope that it will be useful, |
1245 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1246 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1247 | - * GNU General Public License for more details. |
1248 | - * |
1249 | - * You should have received a copy of the GNU General Public License |
1250 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1251 | - * |
1252 | - * Authors: |
1253 | - * Charles Lindsay <chaz@yorba.org> |
1254 | - * Lucas Beeler <lucas@yorba.org> |
1255 | - */ |
1256 | - |
1257 | -import QtQuick 2.0 |
1258 | -import "../../js/Gallery.js" as Gallery |
1259 | -import "../../js/GalleryUtility.js" as GalleryUtility |
1260 | -import "../../js/GraphicsRoutines.js" as GraphicsRoutines |
1261 | -import "../Components" |
1262 | - |
1263 | -// PhotoComponent that allows you to zoom in on the photo. |
1264 | -Rectangle { |
1265 | - id: zoomablePhotoComponent |
1266 | - |
1267 | - /*! |
1268 | - */ |
1269 | - signal loaded() |
1270 | - /*! |
1271 | - */ |
1272 | - signal clicked() |
1273 | - /*! |
1274 | - */ |
1275 | - signal zoomed() |
1276 | - /*! |
1277 | - */ |
1278 | - signal unzoomed() |
1279 | - |
1280 | - /*! |
1281 | - */ |
1282 | - property var mediaSource |
1283 | - /*! |
1284 | - */ |
1285 | - property bool load: false |
1286 | - /*! |
1287 | - */ |
1288 | - property bool isPreview |
1289 | - /*! |
1290 | - */ |
1291 | - property string ownerName |
1292 | - |
1293 | - // read-only |
1294 | - /*! |
1295 | - */ |
1296 | - property alias paintedWidth: unzoomedPhoto.paintedWidth |
1297 | - /*! |
1298 | - */ |
1299 | - property alias paintedHeight: unzoomedPhoto.paintedHeight |
1300 | - /*! |
1301 | - */ |
1302 | - property alias isLoaded: unzoomedPhoto.isLoaded |
1303 | - /*! |
1304 | - */ |
1305 | - property int zoomFocusX: 0 // Relative to zoomablePhotoComponent. |
1306 | - /*! |
1307 | - */ |
1308 | - property int zoomFocusY: 0 |
1309 | - /*! |
1310 | - */ |
1311 | - property real zoomFactor: 1 |
1312 | - /*! |
1313 | - */ |
1314 | - property bool fullyUnzoomed: (state === "unzoomed" && zoomFactor === 1) |
1315 | - /*! |
1316 | - */ |
1317 | - property bool fullyZoomed: (state === "full_zoom" && zoomFactor === maxZoomFactor) |
1318 | - |
1319 | - // Though little documented, Qt has a dedicated background thread, separate |
1320 | - // from the main GUI thread, in which it renders on-screen objects (see |
1321 | - // http://blog.qt.digia.com/blog/2012/08/20/render-thread-animations-in-qt-quick-2-0/ |
1322 | - // for a discussion of this topic). Unfortunately, animation ticks are timed |
1323 | - // by the main GUI thread, but actual drawing in response to these ticks |
1324 | - // is done in the separate rendering thread. Because of this, you can get |
1325 | - // into a situation in which an animation reports that it has completed but |
1326 | - // the separate rendering thread still has a frame to draw. In all of my |
1327 | - // testing, I've never seen this timing mismatch exceed 1/30th of a second, |
1328 | - // which makes sense because the QML animation clock ticks every 1/60th of a |
1329 | - // second, according to the docs (see http://qt-project.org/doc/qt-5.0/qtqml/qml-qtquick2-timer.html), |
1330 | - // though implementations appear to be free to drop to half this rate |
1331 | - // (see https://bugreports.qt-project.org/browse/QTBUG-28487). So we define |
1332 | - // an animation frame as 1/30th of a second and wait this long before doing |
1333 | - // more drawing in response to the completion of an animation to prevent |
1334 | - // stuttering. |
1335 | - property int oneFrame: Math.ceil(1000 / 30); |
1336 | - |
1337 | - // internal |
1338 | - /*! |
1339 | - */ |
1340 | - property real maxZoomFactor: 2.5 |
1341 | - /*! |
1342 | - */ |
1343 | - property real photoFocusX: zoomFocusX - unzoomedPhoto.leftEdge |
1344 | - /*! |
1345 | - */ |
1346 | - property real photoFocusY: zoomFocusY - unzoomedPhoto.topEdge |
1347 | - /*! |
1348 | - */ |
1349 | - property bool isZoomAnimationInProgress: false |
1350 | - |
1351 | - clip: true |
1352 | - |
1353 | - /*! |
1354 | - */ |
1355 | - function zoom(x, y) { |
1356 | - zoomFocusX = x; |
1357 | - zoomFocusY = y; |
1358 | - state = "full_zoom"; |
1359 | - } |
1360 | - |
1361 | - /*! |
1362 | - */ |
1363 | - function unzoom() { |
1364 | - state = "unzoomed"; |
1365 | - } |
1366 | - |
1367 | - /*! |
1368 | - */ |
1369 | - function toggleZoom(x, y) { |
1370 | - if (state === "unzoomed") |
1371 | - zoom(x, y); |
1372 | - else |
1373 | - unzoom(); |
1374 | - } |
1375 | - |
1376 | - states: [ |
1377 | - State { name: "unzoomed"; |
1378 | - PropertyChanges { target: zoomablePhotoComponent; zoomFactor: 1; } |
1379 | - }, |
1380 | - State { name: "full_zoom"; |
1381 | - PropertyChanges { target: zoomablePhotoComponent; zoomFactor: maxZoomFactor; } |
1382 | - }, |
1383 | - State { name: "pinching"; |
1384 | - // Setting the zoom factor to itself seems odd, but it's necessary to |
1385 | - // prevent zoomFactor from jumping when you start pinching. |
1386 | - PropertyChanges { target: zoomablePhotoComponent; zoomFactor: zoomFactor; |
1387 | - explicit: true; } |
1388 | - } |
1389 | - ] |
1390 | - |
1391 | - transitions: [ |
1392 | - // Double-click transitions. |
1393 | - Transition { from: "full_zoom"; to: "unzoomed"; |
1394 | - SequentialAnimation { |
1395 | - ScriptAction { script: isZoomAnimationInProgress = true; } |
1396 | - NumberAnimation { properties: "zoomFactor"; easing.type: Easing.InQuad; |
1397 | - duration: Gallery.FAST_DURATION; } |
1398 | - PauseAnimation { duration: oneFrame } |
1399 | - ScriptAction { script: isZoomAnimationInProgress = false; } |
1400 | - } |
1401 | - }, |
1402 | - |
1403 | - Transition { from: "unzoomed"; to: "full_zoom"; |
1404 | - SequentialAnimation { |
1405 | - ScriptAction { script: isZoomAnimationInProgress = true; } |
1406 | - NumberAnimation { properties: "zoomFactor"; easing.type: Easing.InQuad; |
1407 | - duration: Gallery.FAST_DURATION; } |
1408 | - PauseAnimation { duration: oneFrame } |
1409 | - ScriptAction { script: isZoomAnimationInProgress = false; } |
1410 | - } |
1411 | - }, |
1412 | - |
1413 | - Transition { from: "pinching"; to: "unzoomed"; |
1414 | - SequentialAnimation { |
1415 | - ScriptAction { script: isZoomAnimationInProgress = true; } |
1416 | - NumberAnimation { properties: "zoomFactor"; easing.type: Easing.Linear; |
1417 | - duration: Gallery.SNAP_DURATION; } |
1418 | - PauseAnimation { duration: oneFrame } |
1419 | - ScriptAction { script: isZoomAnimationInProgress = false; } |
1420 | - } |
1421 | - }, |
1422 | - |
1423 | - Transition { from: "pinching"; to: "full_zoom"; |
1424 | - SequentialAnimation { |
1425 | - ScriptAction { script: isZoomAnimationInProgress = true; } |
1426 | - NumberAnimation { properties: "zoomFactor"; easing.type: Easing.Linear; |
1427 | - duration: Gallery.SNAP_DURATION; } |
1428 | - PauseAnimation { duration: oneFrame } |
1429 | - ScriptAction { script: isZoomAnimationInProgress = false; } |
1430 | - } |
1431 | - } |
1432 | - ] |
1433 | - |
1434 | - state: "unzoomed" |
1435 | - |
1436 | - onStateChanged: { |
1437 | - if (state === "full_zoom") |
1438 | - zoomed(); |
1439 | - else if (state === "unzoomed") |
1440 | - unzoomed(); |
1441 | - } |
1442 | - |
1443 | - GalleryPhotoComponent { |
1444 | - id: unzoomedPhoto |
1445 | - |
1446 | - property real leftEdge: (parent.width - paintedWidth) / 2 |
1447 | - property real topEdge: (parent.height - paintedHeight) / 2 |
1448 | - |
1449 | - function isInsidePhoto(x, y) { |
1450 | - return (x >= leftEdge && x < leftEdge + paintedWidth && |
1451 | - y >= topEdge && y < topEdge + paintedHeight); |
1452 | - } |
1453 | - |
1454 | - anchors.fill: parent |
1455 | - visible: fullyUnzoomed |
1456 | - color: zoomablePhotoComponent.color |
1457 | - |
1458 | - mediaSource: zoomablePhotoComponent.mediaSource |
1459 | - load: zoomablePhotoComponent.load && zoomablePhotoComponent.fullyUnzoomed |
1460 | - isPreview: zoomablePhotoComponent.isPreview |
1461 | - ownerName: zoomablePhotoComponent.ownerName + "unzoomedPhoto" |
1462 | - } |
1463 | - |
1464 | - PinchArea { |
1465 | - id: pinchArea |
1466 | - |
1467 | - property bool zoomingIn // Splaying to zoom in, vs. pinching to zoom out. |
1468 | - property real initialZoomFactor |
1469 | - |
1470 | - anchors.fill: parent |
1471 | - |
1472 | - // QML seems to ignore these, so we have to manually keep scale in check |
1473 | - // inside onPinchUpdated. The 0.9 and 1.1 are just fudge factors to give |
1474 | - // us a little bounce when you go past the zoom limit. |
1475 | - pinch.minimumScale: 1 / initialZoomFactor * 0.9 |
1476 | - pinch.maximumScale: maxZoomFactor / initialZoomFactor * 1.1 |
1477 | - |
1478 | - onPinchStarted: { |
1479 | - zoomingIn = false; |
1480 | - initialZoomFactor = zoomFactor; |
1481 | - |
1482 | - if (fullyUnzoomed) { |
1483 | - if (unzoomedPhoto.isInsidePhoto(pinch.center.x, pinch.center.y)) { |
1484 | - zoomFocusX = pinch.center.x; |
1485 | - zoomFocusY = pinch.center.y; |
1486 | - } else { |
1487 | - zoomFocusX = parent.width / 2; |
1488 | - zoomFocusY = parent.height / 2; |
1489 | - } |
1490 | - } |
1491 | - |
1492 | - zoomablePhotoComponent.state = "pinching"; |
1493 | - } |
1494 | - |
1495 | - onPinchUpdated: { |
1496 | - // Determine if we're still zooming in or out. Allow for a small |
1497 | - // variance to account for touch noise. |
1498 | - if (Math.abs(pinch.scale - pinch.previousScale) > 0.001) |
1499 | - zoomingIn = (pinch.scale > pinch.previousScale); |
1500 | - |
1501 | - // For some reason, the PinchArea ignores these settings. |
1502 | - var scale = GraphicsRoutines.clamp(pinch.scale, |
1503 | - pinchArea.pinch.minimumScale, pinchArea.pinch.maximumScale); |
1504 | - |
1505 | - zoomFactor = initialZoomFactor * scale; |
1506 | - } |
1507 | - |
1508 | - onPinchFinished: zoomablePhotoComponent.state = (zoomingIn ? "full_zoom" : "unzoomed") |
1509 | - |
1510 | - MouseAreaWithMultipoint { |
1511 | - desktop: APP.desktopMode |
1512 | - anchors.fill: parent |
1513 | - enabled: fullyUnzoomed |
1514 | - |
1515 | - onClicked: zoomablePhotoComponent.clicked() |
1516 | - onDoubleClicked: { |
1517 | - if (unzoomedPhoto.isInsidePhoto(mouse.x, mouse.y)) |
1518 | - zoom(mouse.x, mouse.y); |
1519 | - else |
1520 | - zoomablePhotoComponent.clicked(); |
1521 | - } |
1522 | - } |
1523 | - } |
1524 | - |
1525 | - Loader { |
1526 | - id: zoomAssemblyLoader |
1527 | - |
1528 | - anchors.fill: parent |
1529 | - |
1530 | - sourceComponent: (fullyUnzoomed ? undefined : zoomAssemblyComponent) |
1531 | - |
1532 | - Component { |
1533 | - id: zoomAssemblyComponent |
1534 | - |
1535 | - Item { |
1536 | - anchors.fill: parent |
1537 | - |
1538 | - Flickable { |
1539 | - id: zoomArea |
1540 | - |
1541 | - property real zoomAreaZoomFactor: maxZoomFactor |
1542 | - property real minContentFocusX: (contentWidth < parent.width |
1543 | - ? contentWidth : parent.width) / 2 |
1544 | - property real maxContentFocusX: contentWidth - minContentFocusX |
1545 | - property real minContentFocusY: (contentHeight < parent.height |
1546 | - ? contentHeight : parent.height) / 2 |
1547 | - property real maxContentFocusY: contentHeight - minContentFocusY |
1548 | - property real contentFocusX: GraphicsRoutines.clamp( |
1549 | - photoFocusX * zoomAreaZoomFactor, |
1550 | - minContentFocusX, maxContentFocusX) |
1551 | - property real contentFocusY: GraphicsRoutines.clamp( |
1552 | - photoFocusY * zoomAreaZoomFactor, |
1553 | - minContentFocusY, maxContentFocusY) |
1554 | - // Translate between focus point and top/left point. Note: you might think |
1555 | - // that this should take into account the left and top margins, but |
1556 | - // apparently not. |
1557 | - property real contentFocusLeft: contentFocusX - parent.width / 2 |
1558 | - property real contentFocusTop: contentFocusY - parent.height / 2 |
1559 | - |
1560 | - anchors.fill: parent |
1561 | - visible: fullyZoomed && !isZoomAnimationInProgress |
1562 | - |
1563 | - onVisibleChanged: { |
1564 | - if (visible) { |
1565 | - contentX = contentFocusLeft; |
1566 | - contentY = contentFocusTop; |
1567 | - } |
1568 | - } |
1569 | - |
1570 | - onContentXChanged: { |
1571 | - var contentFocusX = contentX + width / 2; |
1572 | - var photoFocusX = contentFocusX / zoomAreaZoomFactor; |
1573 | - zoomFocusX = photoFocusX + unzoomedPhoto.leftEdge; |
1574 | - } |
1575 | - |
1576 | - onContentYChanged: { |
1577 | - var contentFocusY = contentY + height / 2; |
1578 | - var photoFocusY = contentFocusY / zoomAreaZoomFactor; |
1579 | - zoomFocusY = photoFocusY + unzoomedPhoto.topEdge; |
1580 | - } |
1581 | - |
1582 | - flickableDirection: Flickable.HorizontalAndVerticalFlick |
1583 | - contentWidth: unzoomedPhoto.paintedWidth * zoomAreaZoomFactor |
1584 | - contentHeight: unzoomedPhoto.paintedHeight * zoomAreaZoomFactor |
1585 | - |
1586 | - leftMargin: Math.max(0, (parent.width - contentWidth) / 2) |
1587 | - rightMargin: leftMargin |
1588 | - topMargin: Math.max(0, (parent.height - contentHeight) / 2) |
1589 | - bottomMargin: topMargin |
1590 | - |
1591 | - GalleryPhotoComponent { |
1592 | - id: zoomedPhoto |
1593 | - |
1594 | - anchors.fill: parent |
1595 | - color: zoomablePhotoComponent.color |
1596 | - |
1597 | - mediaSource: zoomablePhotoComponent.mediaSource |
1598 | - load: zoomablePhotoComponent.load && fullyZoomed |
1599 | - |
1600 | - isPreview: zoomablePhotoComponent.isPreview |
1601 | - ownerName: zoomablePhotoComponent.ownerName + "zoomedPhoto" |
1602 | - |
1603 | - MouseAreaWithMultipoint { |
1604 | - desktop: APP.desktopMode |
1605 | - anchors.fill: parent |
1606 | - |
1607 | - onClicked: zoomablePhotoComponent.clicked() |
1608 | - onDoubleClicked: unzoom() |
1609 | - } |
1610 | - } |
1611 | - } |
1612 | - |
1613 | - GalleryPhotoComponent { |
1614 | - id: transitionPhoto |
1615 | - |
1616 | - property real unzoomedX: unzoomedPhoto.leftEdge |
1617 | - property real unzoomedY: unzoomedPhoto.topEdge |
1618 | - property real zoomedX: -zoomArea.contentFocusLeft |
1619 | - property real zoomedY: -zoomArea.contentFocusTop |
1620 | - |
1621 | - property real zoomFraction: (zoomFactor - 1) / (maxZoomFactor - 1) |
1622 | - |
1623 | - x: GalleryUtility.interpolate(unzoomedX, zoomedX, zoomFraction) |
1624 | - y: GalleryUtility.interpolate(unzoomedY, zoomedY, zoomFraction) |
1625 | - width: unzoomedPhoto.paintedWidth |
1626 | - height: unzoomedPhoto.paintedHeight |
1627 | - scale: zoomFactor |
1628 | - transformOrigin: Item.TopLeft |
1629 | - |
1630 | - visible: zoomablePhotoComponent.isZoomAnimationInProgress || |
1631 | - zoomablePhotoComponent.state == "pinching" || |
1632 | - !zoomedPhoto.isLoaded |
1633 | - |
1634 | - color: zoomablePhotoComponent.color |
1635 | - |
1636 | - mediaSource: zoomablePhotoComponent.mediaSource |
1637 | - load: zoomablePhotoComponent.load |
1638 | - isPreview: zoomablePhotoComponent.isPreview |
1639 | - isAnimate: true |
1640 | - ownerName: zoomablePhotoComponent.ownerName + "transitionPhoto" |
1641 | - } |
1642 | - } |
1643 | - } |
1644 | - } |
1645 | -} |
1646 | |
1647 | === modified file 'rc/qml/OrganicView/OrganicView.qml' |
1648 | --- rc/qml/OrganicView/OrganicView.qml 2014-03-10 17:20:03 +0000 |
1649 | +++ rc/qml/OrganicView/OrganicView.qml 2014-09-03 23:54:36 +0000 |
1650 | @@ -18,7 +18,7 @@ |
1651 | */ |
1652 | |
1653 | import QtQuick 2.0 |
1654 | -import Ubuntu.Components 0.1 |
1655 | +import Ubuntu.Components 1.1 |
1656 | import "../Utility" |
1657 | import "../../js/Gallery.js" as Gallery |
1658 | |
1659 | |
1660 | === modified file 'rc/qml/PhotosOverview.qml' |
1661 | --- rc/qml/PhotosOverview.qml 2013-09-30 17:01:38 +0000 |
1662 | +++ rc/qml/PhotosOverview.qml 2014-09-03 23:54:36 +0000 |
1663 | @@ -111,7 +111,7 @@ |
1664 | } |
1665 | onAddClicked: { |
1666 | __albumPicker = PopupUtils.open(Qt.resolvedUrl("Components/PopupAlbumPicker.qml"), |
1667 | - caller, |
1668 | + null, |
1669 | {contentHeight: photosOverview.__pickerContentHeight}); |
1670 | } |
1671 | onDeleteClicked: { |
1672 | |
1673 | === modified file 'rc/qml/PickerScreen.qml' |
1674 | --- rc/qml/PickerScreen.qml 2014-08-14 10:59:38 +0000 |
1675 | +++ rc/qml/PickerScreen.qml 2014-09-03 23:54:36 +0000 |
1676 | @@ -15,7 +15,7 @@ |
1677 | */ |
1678 | |
1679 | import QtQuick 2.0 |
1680 | -import Ubuntu.Components 0.1 |
1681 | +import Ubuntu.Components 1.1 |
1682 | import Gallery 1.0 |
1683 | import "Components" |
1684 | import "OrganicView" |
1685 | @@ -29,6 +29,8 @@ |
1686 | id: pickerMainView |
1687 | objectName: "pickerMainView" |
1688 | |
1689 | + useDeprecatedToolbar: false |
1690 | + |
1691 | /// Model of all media |
1692 | property MediaCollectionModel mediaLibrary: MediaCollectionModel { |
1693 | monitored: true |
1694 | @@ -58,7 +60,8 @@ |
1695 | id: eventSelectView |
1696 | objectName: "eventSelectView" |
1697 | |
1698 | - tools: pickTools |
1699 | + head.actions: pickActions |
1700 | + |
1701 | selection: pickerMainView.selection |
1702 | model: EventCollectionModel { |
1703 | mediaTypeFilter: APP.mediaTypeFilter |
1704 | @@ -80,7 +83,7 @@ |
1705 | id: photosOverview |
1706 | objectName: "photosPage" |
1707 | |
1708 | - tools: pickTools |
1709 | + head.actions: pickActions |
1710 | |
1711 | Image { |
1712 | anchors.fill: parent |
1713 | @@ -97,32 +100,24 @@ |
1714 | } |
1715 | } |
1716 | |
1717 | - property ToolbarItems pickTools: ToolbarItems { |
1718 | - Button { |
1719 | - anchors.verticalCenter: parent.verticalCenter |
1720 | + property list<Action> pickActions: [ |
1721 | + Action { |
1722 | text: i18n.tr("Pick") |
1723 | objectName: "pickButton" |
1724 | - color: Gallery.HIGHLIGHT_BUTTON_COLOR |
1725 | - width: units.gu(16) |
1726 | enabled: pickerMainView.selection.selectedCount > 0 |
1727 | - onClicked: { |
1728 | + iconName: "ok" |
1729 | + onTriggered: { |
1730 | if (!enabled) |
1731 | return; |
1732 | |
1733 | APP.returnPickedContent(mediaLibrary.selectedMedias); |
1734 | } |
1735 | - } |
1736 | - |
1737 | - back: Button { |
1738 | - anchors.verticalCenter: parent.verticalCenter |
1739 | + }, |
1740 | + Action { |
1741 | text: i18n.tr("Cancel") |
1742 | objectName: "cancelButton" |
1743 | - width: units.gu(10) |
1744 | - onClicked: { |
1745 | - APP.contentPickingCanceled() |
1746 | - } |
1747 | + iconName: "close" |
1748 | + onTriggered: APP.contentPickingCanceled() |
1749 | } |
1750 | - opened: true |
1751 | - locked: true |
1752 | - } |
1753 | + ] |
1754 | } |
1755 | |
1756 | === modified file 'rc/qml/Utility/PhotosToolbarActions.qml' |
1757 | --- rc/qml/Utility/PhotosToolbarActions.qml 2014-03-19 20:19:57 +0000 |
1758 | +++ rc/qml/Utility/PhotosToolbarActions.qml 2014-09-03 23:54:36 +0000 |
1759 | @@ -29,23 +29,29 @@ |
1760 | signal startCamera() |
1761 | |
1762 | ToolbarButton { |
1763 | - objectName: "selectButton" |
1764 | - text: i18n.tr("Select") |
1765 | - iconSource: Qt.resolvedUrl("../../img/select.png") |
1766 | - enabled: root.selection !== null |
1767 | - onTriggered: root.selection.inSelectionMode = true; |
1768 | + action: Action { |
1769 | + objectName: "selectButton" |
1770 | + text: i18n.tr("Select") |
1771 | + iconSource: Qt.resolvedUrl("../../img/select.png") |
1772 | + enabled: root.selection !== null |
1773 | + onTriggered: root.selection.inSelectionMode = true; |
1774 | + } |
1775 | } |
1776 | ToolbarButton { |
1777 | objectName: "importButton" |
1778 | - text: i18n.tr("Import") |
1779 | - iconSource: Qt.resolvedUrl("../../img/import-image.png") |
1780 | - enabled: false |
1781 | + action: Action { |
1782 | + text: i18n.tr("Import") |
1783 | + iconSource: Qt.resolvedUrl("../../img/import-image.png") |
1784 | + visible: false |
1785 | + } |
1786 | } |
1787 | ToolbarButton { |
1788 | - objectName: "cameraButton" |
1789 | - text: i18n.tr("Camera") |
1790 | - visible: !APP.desktopMode |
1791 | - iconSource: Qt.resolvedUrl("../../img/camera.png") |
1792 | - onTriggered: Qt.openUrlExternally("appid://com.ubuntu.camera/camera/current-user-version") |
1793 | + action: Action { |
1794 | + objectName: "cameraButton" |
1795 | + text: i18n.tr("Camera") |
1796 | + visible: !APP.desktopMode |
1797 | + iconSource: Qt.resolvedUrl("../../img/camera.png") |
1798 | + onTriggered: Qt.openUrlExternally("appid://com.ubuntu.camera/camera/current-user-version") |
1799 | + } |
1800 | } |
1801 | } |
1802 | |
1803 | === modified file 'rc/qml/Utility/SelectionToolbarAction.qml' |
1804 | --- rc/qml/Utility/SelectionToolbarAction.qml 2013-09-19 14:53:09 +0000 |
1805 | +++ rc/qml/Utility/SelectionToolbarAction.qml 2014-09-03 23:54:36 +0000 |
1806 | @@ -33,6 +33,8 @@ |
1807 | signal addClicked(var caller) |
1808 | ///Emitted when delete was clicked |
1809 | signal deleteClicked() |
1810 | + ///Emitted when share was clicked |
1811 | + signal shareClicked() |
1812 | |
1813 | // in selection mode, never hide the toolbar: |
1814 | opened: true |
1815 | @@ -41,32 +43,40 @@ |
1816 | ToolbarButton { |
1817 | id: addButton |
1818 | objectName: "addButton" |
1819 | - text: i18n.tr("Add") |
1820 | - iconSource: Qt.resolvedUrl("../../img/add.png") |
1821 | - enabled: root.selection.selectedCount > 0 |
1822 | - onTriggered: root.addClicked(addButton); |
1823 | - } |
1824 | - ToolbarButton { |
1825 | - objectName: "deleteButton" |
1826 | - text: i18n.tr("Delete") |
1827 | - iconSource: Qt.resolvedUrl("../../img/delete.png") |
1828 | - enabled: root.selection.selectedCount > 0 |
1829 | - onTriggered:root.deleteClicked(); |
1830 | - } |
1831 | - ToolbarButton { |
1832 | - objectName: "shareButton" |
1833 | - text: i18n.tr("Share") |
1834 | - iconSource: Qt.resolvedUrl("../../img/share.png") |
1835 | - enabled: false |
1836 | + action: Action { |
1837 | + text: i18n.tr("Add") |
1838 | + iconName: "add" |
1839 | + enabled: root.selection.selectedCount > 0 |
1840 | + onTriggered: root.addClicked(addButton); |
1841 | + } |
1842 | + } |
1843 | + ToolbarButton { |
1844 | + action: Action { |
1845 | + objectName: "deleteButton" |
1846 | + text: i18n.tr("Delete") |
1847 | + iconName: "delete" |
1848 | + enabled: root.selection.selectedCount > 0 |
1849 | + onTriggered:root.deleteClicked(); |
1850 | + } |
1851 | + } |
1852 | + ToolbarButton { |
1853 | + action: Action { |
1854 | + objectName: "shareButton" |
1855 | + text: i18n.tr("Share") |
1856 | + iconName: "share" |
1857 | + enabled: root.selection.selectedCount > 0 |
1858 | + onTriggered: root.shareClicked(); |
1859 | + } |
1860 | } |
1861 | |
1862 | back: Button { |
1863 | objectName: "cancelButton" |
1864 | - anchors.verticalCenter: parent.verticalCenter |
1865 | - text: i18n.tr("Cancel") |
1866 | - width: units.gu(10) |
1867 | - onClicked: { |
1868 | - root.cancelClicked(); |
1869 | + action: Action { |
1870 | + text: i18n.tr("Cancel") |
1871 | + iconName: "back" |
1872 | + onTriggered: { |
1873 | + root.cancelClicked(); |
1874 | + } |
1875 | } |
1876 | } |
1877 | } |
1878 | |
1879 | === modified file 'tests/autopilot/gallery_app/emulators/album_view.py' |
1880 | --- tests/autopilot/gallery_app/emulators/album_view.py 2014-06-12 16:42:04 +0000 |
1881 | +++ tests/autopilot/gallery_app/emulators/album_view.py 2014-09-03 23:54:36 +0000 |
1882 | @@ -38,10 +38,6 @@ |
1883 | return self.app.wait_select_single("AlbumViewer", |
1884 | objectName="albumViewer") |
1885 | |
1886 | - def get_toolbar_add_button(self): |
1887 | - """Returns the add button of the tollbar in the events view.""" |
1888 | - return self.get_toolbar_named_toolbarbutton("addButton") |
1889 | - |
1890 | def get_first_photo(self): |
1891 | """Returns the first photo in a newly opened album""" |
1892 | return self.app.select_many( |
1893 | @@ -103,14 +99,16 @@ |
1894 | matcher = LessThan |
1895 | self.pointing_device.drag( |
1896 | mid_x, mid_y, # Start |
1897 | - x + w, mid_y # Finish |
1898 | + x + w, mid_y, # Finish |
1899 | + rate=3 |
1900 | ) |
1901 | |
1902 | elif 'right' == direction: |
1903 | matcher = GreaterThan |
1904 | self.pointing_device.drag( |
1905 | mid_x, mid_y, # Start |
1906 | - x, mid_y # Finish |
1907 | + x, mid_y, # Finish |
1908 | + rate=3 |
1909 | ) |
1910 | else: |
1911 | raise GalleryAppException( |
1912 | |
1913 | === modified file 'tests/autopilot/gallery_app/emulators/gallery_utils.py' |
1914 | --- tests/autopilot/gallery_app/emulators/gallery_utils.py 2014-06-13 13:57:20 +0000 |
1915 | +++ tests/autopilot/gallery_app/emulators/gallery_utils.py 2014-09-03 23:54:36 +0000 |
1916 | @@ -85,14 +85,14 @@ |
1917 | |
1918 | def get_first_album(self): |
1919 | """Returns the first album in the albums view.""" |
1920 | - # For some reasons the albums are returned in inverse order, so |
1921 | - # the first album is acutally the last in the array |
1922 | - return self.get_album_at(-1) |
1923 | + return self.get_album_at(0) |
1924 | |
1925 | def get_album_at(self, position): |
1926 | """Returns the albums at this position in the albums view""" |
1927 | albums = self.select_many_retry("CheckerboardDelegate", |
1928 | objectName="checkerboardDelegate") |
1929 | + albums = sorted( |
1930 | + albums, key=lambda album: (album.globalRect.y, album.globalRect.x)) |
1931 | return albums[position] |
1932 | |
1933 | def get_edit_album_button(self): |
1934 | |
1935 | === modified file 'tests/autopilot/gallery_app/emulators/main_screen.py' |
1936 | --- tests/autopilot/gallery_app/emulators/main_screen.py 2014-04-01 19:18:50 +0000 |
1937 | +++ tests/autopilot/gallery_app/emulators/main_screen.py 2014-09-03 23:54:36 +0000 |
1938 | @@ -5,17 +5,32 @@ |
1939 | # under the terms of the GNU General Public License version 3, as published |
1940 | # by the Free Software Foundation. |
1941 | |
1942 | -from ubuntuuitoolkit import emulators as toolkit_emulators |
1943 | -from gallery_app.emulators import toolbar |
1944 | - |
1945 | - |
1946 | -class MainScreen(toolkit_emulators.MainView): |
1947 | +import ubuntuuitoolkit |
1948 | + |
1949 | + |
1950 | +class MainScreen(ubuntuuitoolkit.MainView): |
1951 | """An emulator class that makes it easy to interact with the gallery app""" |
1952 | |
1953 | - def get_toolbar(self): |
1954 | - """Return the Toolbar emulator of the MainView. |
1955 | - |
1956 | - Overriden because the gallery app has custom buttons. |
1957 | - |
1958 | - """ |
1959 | - return self.select_single(toolbar.Toolbar) |
1960 | + def get_header(self): |
1961 | + """Return the Header emulator of the MainView.""" |
1962 | + return self.select_single(AppHeader, objectName='MainView_Header') |
1963 | + |
1964 | + |
1965 | +class AppHeader(ubuntuuitoolkit.Header): |
1966 | + """Header Autopilot helper. |
1967 | + |
1968 | + We override this helper because on the gallery the gesture to show the |
1969 | + header when it's hidden it's not the default. |
1970 | + |
1971 | + """ |
1972 | + |
1973 | + # XXX We are overriding internal methods that may change on the toolkit. |
1974 | + # The helper on the toolkit needs a public method that will be safe to |
1975 | + # override. Reported as bug http://pad.lv/1363591 --elopio - 2014-31-08 |
1976 | + |
1977 | + def _is_visible(self): |
1978 | + return self.visible |
1979 | + |
1980 | + def _show(self): |
1981 | + self.pointing_device.click_object(self._get_top_container()) |
1982 | + self.visible.wait_for(True) |
1983 | |
1984 | === modified file 'tests/autopilot/gallery_app/emulators/photo_viewer.py' |
1985 | --- tests/autopilot/gallery_app/emulators/photo_viewer.py 2014-08-27 20:28:51 +0000 |
1986 | +++ tests/autopilot/gallery_app/emulators/photo_viewer.py 2014-09-03 23:54:36 +0000 |
1987 | @@ -48,9 +48,8 @@ |
1988 | # Was using a list index (lp:1247711). Still needs fixing, I'm not |
1989 | # convinced this is a suitable way to select the correct item. |
1990 | return self.app.wait_select_single( |
1991 | - "ZoomablePhotoComponent", |
1992 | - ownerName="photoViewerDelegate", |
1993 | - objectName="openedPhoto0" |
1994 | + "SingleMediaViewer", |
1995 | + objectName="openedMedia0" |
1996 | ) |
1997 | |
1998 | def get_photos_list(self): |
1999 | @@ -94,8 +93,8 @@ |
2000 | |
2001 | def get_opened_photo(self): |
2002 | """Returns the first opened photo.""" |
2003 | - return self.app.wait_select_single("ZoomablePhotoComponent", |
2004 | - objectName="openedPhoto0") |
2005 | + return self.app.wait_select_single("SingleMediaViewer", |
2006 | + objectName="openedMedia0") |
2007 | |
2008 | def get_crop_interactor(self): |
2009 | """Returns the crop interactor.""" |
2010 | |
2011 | === modified file 'tests/autopilot/gallery_app/emulators/picker_screen.py' |
2012 | --- tests/autopilot/gallery_app/emulators/picker_screen.py 2014-07-10 09:07:34 +0000 |
2013 | +++ tests/autopilot/gallery_app/emulators/picker_screen.py 2014-09-03 23:54:36 +0000 |
2014 | @@ -11,7 +11,7 @@ |
2015 | class PickerScreen(toolkit_emulators.MainView): |
2016 | |
2017 | def pick_button(self): |
2018 | - return self.select_single("Button", objectName="pickButton") |
2019 | + return self.select_single(objectName="pickButton_header_button") |
2020 | |
2021 | def get_photos_tab_button(self): |
2022 | """Returns the photos tab.""" |
2023 | @@ -38,7 +38,7 @@ |
2024 | Return the Page object representing the photos |
2025 | """ |
2026 | self.switch_to_tab('photosTab') |
2027 | - return self.select_single(Page10, objectName='photosPage') |
2028 | + return self.select_single(Page11, objectName='photosPage') |
2029 | |
2030 | def click_pick_button(self): |
2031 | """Click on the pick button""" |
2032 | @@ -51,7 +51,7 @@ |
2033 | self.click_pick_button() |
2034 | |
2035 | |
2036 | -class Page10(PickerScreen): |
2037 | +class Page11(PickerScreen): |
2038 | """Class to represent photos page view from picker screen""" |
2039 | |
2040 | def _get_named_photo_element(self, photo_name): |
2041 | |
2042 | === modified file 'tests/autopilot/gallery_app/tests/__init__.py' |
2043 | --- tests/autopilot/gallery_app/tests/__init__.py 2014-07-14 15:29:11 +0000 |
2044 | +++ tests/autopilot/gallery_app/tests/__init__.py 2014-09-03 23:54:36 +0000 |
2045 | @@ -162,8 +162,11 @@ |
2046 | |
2047 | """ This is needed to wait for the application to start. |
2048 | In the testfarm, the application may take some time to show up.""" |
2049 | - self.assertThat(self.gallery_utils.get_qml_view().visible, |
2050 | - Eventually(Equals(True))) |
2051 | + qml_view = self.gallery_utils.get_qml_view() |
2052 | + self.assertThat(qml_view.visible, Eventually(Equals(True))) |
2053 | + loading_screen = qml_view.select_single( |
2054 | + 'QQuickLoader', objectName='loadingScreen') |
2055 | + loading_screen.visible.wait_for(False) |
2056 | """FIXME somehow on the server gallery sometimes is not fully started |
2057 | for switching to the albums view. Therefore this hack of sleeping""" |
2058 | sleep(2) |
2059 | @@ -262,13 +265,11 @@ |
2060 | |
2061 | def open_album_at(self, position): |
2062 | album = self.album_view.get_album_at(position) |
2063 | - # workaround lp:1247698 |
2064 | - self.main_view.close_toolbar() |
2065 | self.click_item(album) |
2066 | self.ensure_view_is_fully_open() |
2067 | |
2068 | def open_first_album(self): |
2069 | - self.open_album_at(-1) |
2070 | + self.open_album_at(0) |
2071 | |
2072 | def ensure_view_is_fully_open(self): |
2073 | view = self.album_view.get_album_view() |
2074 | |
2075 | === modified file 'tests/autopilot/gallery_app/tests/test_album_editor.py' |
2076 | --- tests/autopilot/gallery_app/tests/test_album_editor.py 2014-06-10 19:00:23 +0000 |
2077 | +++ tests/autopilot/gallery_app/tests/test_album_editor.py 2014-09-03 23:54:36 +0000 |
2078 | @@ -33,13 +33,10 @@ |
2079 | self.ARGS = [] |
2080 | super(TestAlbumEditor, self).setUp() |
2081 | self.switch_to_albums_tab() |
2082 | - self.main_view.close_toolbar() |
2083 | self.edit_first_album() |
2084 | |
2085 | def edit_first_album(self): |
2086 | first_album = self.gallery_utils.get_first_album() |
2087 | - # workaround lp:1247698 |
2088 | - self.main_view.close_toolbar() |
2089 | self.tap_item(first_album) |
2090 | edit_button = self.gallery_utils.get_edit_album_button() |
2091 | self.click_item(edit_button) |
2092 | @@ -58,8 +55,7 @@ |
2093 | text = "Ubuntu" |
2094 | self.assertThat(subtitle_field.text, Eventually(Equals(text))) |
2095 | |
2096 | - # workaround lp:1247698 |
2097 | - self.main_view.close_toolbar() |
2098 | + sleep(5) |
2099 | editor.click_title_field() |
2100 | self.assertThat(title_field.activeFocus, Eventually(Equals(True))) |
2101 | self.keyboard.press_and_release("Ctrl+a") |
2102 | @@ -81,38 +77,41 @@ |
2103 | """Tests adding a photo using the media selector""" |
2104 | # first open, but cancel before adding a photo |
2105 | editor = self.app.select_single(album_editor.AlbumEditor) |
2106 | - # workaround lp:1247698 |
2107 | - self.main_view.close_toolbar() |
2108 | editor.add_photos() |
2109 | self.media_selector.ensure_fully_open() |
2110 | |
2111 | sleep(5) |
2112 | - self.main_view.get_toolbar().click_custom_button("cancelButton") |
2113 | + self.main_view.get_header().click_custom_back_button() |
2114 | + |
2115 | editor.ensure_fully_closed() |
2116 | |
2117 | - self.main_view.close_toolbar() |
2118 | + sleep(5) |
2119 | self.open_first_album() |
2120 | num_photos_start = self.album_view.number_of_photos() |
2121 | self.assertThat(num_photos_start, Equals(1)) |
2122 | - self.main_view.open_toolbar().click_button("backButton") |
2123 | + |
2124 | + # should click away of any photo to toggle header |
2125 | + photo = self.album_view.get_first_photo() |
2126 | + x, y, w, h = photo.globalRect |
2127 | + self.pointing_device.move(x + 40 , y + h + 40) |
2128 | + self.pointing_device.click() |
2129 | + |
2130 | + self.main_view.get_header().click_custom_back_button() |
2131 | self.album_view.ensure_album_view_fully_closed() |
2132 | |
2133 | # now open to add a photo |
2134 | - self.main_view.close_toolbar() |
2135 | self.edit_first_album() |
2136 | editor = self.app.select_single(album_editor.AlbumEditor) |
2137 | - # workaround lp:1247698 |
2138 | - self.main_view.close_toolbar() |
2139 | editor.add_photos() |
2140 | self.media_selector.ensure_fully_open() |
2141 | |
2142 | photo = self.media_selector.get_second_photo() |
2143 | self.click_item(photo) |
2144 | - self.main_view.get_toolbar().click_custom_button("addButton") |
2145 | + self.main_view.get_header().click_action_button("addButton") |
2146 | editor = self.app.select_single(album_editor.AlbumEditor) |
2147 | editor.ensure_fully_closed() |
2148 | |
2149 | - self.main_view.close_toolbar() |
2150 | + self.album_view.ensure_album_view_fully_closed() |
2151 | self.open_first_album() |
2152 | num_photos = self.album_view.number_of_photos() |
2153 | self.assertThat(num_photos, Equals(num_photos_start + 1)) |
2154 | @@ -124,11 +123,8 @@ |
2155 | self.assertThat( |
2156 | cover_image.source.endswith("album-cover-default-large.png"), |
2157 | Equals(True)) |
2158 | - self.main_view.close_toolbar() |
2159 | |
2160 | # click somewhere rather at the bottom of the cover |
2161 | - # workaround lp:1247698 |
2162 | - self.main_view.close_toolbar() |
2163 | x, y, w, h = cover_image.globalRect |
2164 | self.pointing_device.move(x + int(w / 2), y + h - int(h / 10)) |
2165 | self.pointing_device.click() |
2166 | |
2167 | === modified file 'tests/autopilot/gallery_app/tests/test_album_view.py' |
2168 | --- tests/autopilot/gallery_app/tests/test_album_view.py 2014-06-12 16:42:04 +0000 |
2169 | +++ tests/autopilot/gallery_app/tests/test_album_view.py 2014-09-03 23:54:36 +0000 |
2170 | @@ -48,24 +48,17 @@ |
2171 | self.switch_to_albums_tab() |
2172 | |
2173 | def test_album_view_open_photo(self): |
2174 | - self.main_view.close_toolbar() |
2175 | self.open_first_album() |
2176 | - self.main_view.close_toolbar() |
2177 | photo = self.album_view.get_first_photo() |
2178 | - # workaround lp:1247698 |
2179 | - self.main_view.close_toolbar() |
2180 | self.click_item(photo) |
2181 | sleep(5) |
2182 | photo_view = self.main_view.wait_select_single("PopupPhotoViewer") |
2183 | self.assertThat(photo_view.visible, Eventually(Equals(True))) |
2184 | |
2185 | def test_album_view_flipping(self): |
2186 | - self.main_view.close_toolbar() |
2187 | - |
2188 | # For some reason here the album at position 0 in the autopilot list is |
2189 | # actually the second album, they seem to be returned in reverse order. |
2190 | - self.open_album_at(0) |
2191 | - self.main_view.close_toolbar() |
2192 | + self.open_album_at(1) |
2193 | |
2194 | spread = self.album_view.get_spread_view() |
2195 | |
2196 | @@ -84,35 +77,39 @@ |
2197 | self.assertThat(spread.viewingPage, Eventually(GreaterThan(1))) |
2198 | |
2199 | def test_add_photo(self): |
2200 | - self.main_view.close_toolbar() |
2201 | self.open_first_album() |
2202 | num_photos_start = self.album_view.number_of_photos() |
2203 | self.assertThat(num_photos_start, Equals(1)) |
2204 | |
2205 | + # should click away of any photo to toggle header |
2206 | + photo = self.album_view.get_first_photo() |
2207 | + x, y, w, h = photo.globalRect |
2208 | + self.pointing_device.move(x + 40 , y + h + 40) |
2209 | + self.pointing_device.click() |
2210 | + |
2211 | # open media selector but cancel |
2212 | - self.main_view.open_toolbar().click_button("addButton") |
2213 | + self.main_view.get_header().click_action_button("addButton") |
2214 | self.media_selector.ensure_fully_open() |
2215 | |
2216 | - self.main_view.get_toolbar().click_custom_button("cancelButton") |
2217 | + self.main_view.get_header().click_custom_back_button() |
2218 | sleep(1) |
2219 | |
2220 | num_photos = self.album_view.number_of_photos() |
2221 | self.assertThat(num_photos, Equals(num_photos_start)) |
2222 | |
2223 | # open media selector and add a photo |
2224 | - self.main_view.open_toolbar().click_button("addButton") |
2225 | + self.main_view.get_header().click_action_button("addButton") |
2226 | self.media_selector.ensure_fully_open() |
2227 | |
2228 | photo = self.media_selector.get_second_photo() |
2229 | self.click_item(photo) |
2230 | - self.main_view.get_toolbar().click_custom_button("addButton") |
2231 | + self.main_view.get_header().click_action_button("addButton") |
2232 | |
2233 | self.assertThat( |
2234 | lambda: self.album_view.number_of_photos(), |
2235 | Eventually(Equals(num_photos_start + 1))) |
2236 | |
2237 | def test_remove_photo_from_album(self): |
2238 | - self.main_view.close_toolbar() |
2239 | self.open_first_album() |
2240 | num_photos_start = self.album_view.number_of_photos() |
2241 | self.assertThat(num_photos_start, Equals(1)) |
2242 | @@ -125,7 +122,7 @@ |
2243 | photo_view = self.album_view.get_album_photo_view() |
2244 | self.assertThat(photo_view.visible, Eventually(Equals(True))) |
2245 | |
2246 | - self.main_view.open_toolbar().click_button("deleteButton") |
2247 | + self.main_view.get_header().click_action_button("deleteButton") |
2248 | self.album_view.click_remove_from_album_remove_button() |
2249 | |
2250 | self.assertThat(lambda: self.album_view.number_of_photos(), |
2251 | @@ -135,7 +132,6 @@ |
2252 | Eventually(Equals(True))) |
2253 | |
2254 | def test_remove_photo_from_album_and_delete(self): |
2255 | - self.main_view.close_toolbar() |
2256 | self.open_first_album() |
2257 | num_photos_start = self.album_view.number_of_photos() |
2258 | self.assertThat(num_photos_start, Equals(1)) |
2259 | @@ -148,7 +144,7 @@ |
2260 | photo_view = self.album_view.get_album_photo_view() |
2261 | self.assertThat(photo_view.visible, Eventually(Equals(True))) |
2262 | |
2263 | - self.main_view.open_toolbar().click_button("deleteButton") |
2264 | + self.main_view.get_header().click_action_button("deleteButton") |
2265 | self.album_view.click_remove_from_album_delete_button() |
2266 | |
2267 | self.assertThat(lambda: self.album_view.number_of_photos(), |
2268 | @@ -158,7 +154,6 @@ |
2269 | Eventually(Equals(False))) |
2270 | |
2271 | def test_cancel_remove_photo_from_album(self): |
2272 | - self.main_view.close_toolbar() |
2273 | self.open_first_album() |
2274 | num_photos_start = self.album_view.number_of_photos() |
2275 | self.assertThat(num_photos_start, Equals(1)) |
2276 | @@ -171,10 +166,10 @@ |
2277 | photo_view = self.album_view.get_album_photo_view() |
2278 | self.assertThat(photo_view.visible, Eventually(Equals(True))) |
2279 | |
2280 | - self.main_view.open_toolbar().click_button("deleteButton") |
2281 | + self.main_view.get_header().click_action_button("deleteButton") |
2282 | self.album_view.click_remove_from_album_cancel_button() |
2283 | |
2284 | - self.main_view.open_toolbar().click_button("backButton") |
2285 | + self.main_view.get_header().click_custom_back_button() |
2286 | |
2287 | self.assertThat(lambda: self.album_view.number_of_photos(), |
2288 | Eventually(Equals(num_photos_start))) |
2289 | @@ -183,28 +178,24 @@ |
2290 | Eventually(Equals(True))) |
2291 | |
2292 | def test_add_photo_to_new_album(self): |
2293 | - self.main_view.open_toolbar().click_button("addButton") |
2294 | + self.main_view.get_header().click_action_button("addButton") |
2295 | self.ui_update() |
2296 | |
2297 | editor = self.app.select_single(album_editor.AlbumEditor) |
2298 | editor.ensure_fully_open() |
2299 | - self.main_view.close_toolbar() |
2300 | editor.close() |
2301 | |
2302 | self.open_first_album() |
2303 | - self.main_view.close_toolbar() |
2304 | num_photos_start = self.album_view.number_of_photos() |
2305 | self.assertThat(num_photos_start, Equals(0)) |
2306 | |
2307 | plus = self.album_view.get_plus_icon_empty_album() |
2308 | - # workaround lp:1247698 |
2309 | - self.main_view.close_toolbar() |
2310 | self.click_item(plus) |
2311 | self.media_selector.ensure_fully_open() |
2312 | |
2313 | photo = self.media_selector.get_second_photo() |
2314 | self.click_item(photo) |
2315 | - self.main_view.get_toolbar().click_custom_button("addButton") |
2316 | + self.main_view.get_header().click_action_button("addButton") |
2317 | |
2318 | self.assertThat( |
2319 | lambda: self.album_view.number_of_photos(), |
2320 | |
2321 | === modified file 'tests/autopilot/gallery_app/tests/test_albums_view.py' |
2322 | --- tests/autopilot/gallery_app/tests/test_albums_view.py 2014-05-20 15:19:35 +0000 |
2323 | +++ tests/autopilot/gallery_app/tests/test_albums_view.py 2014-09-03 23:54:36 +0000 |
2324 | @@ -11,6 +11,7 @@ |
2325 | from testtools.matchers import Equals |
2326 | from autopilot.matchers import Eventually |
2327 | from autopilot.platform import model |
2328 | +from autopilot.introspection.dbus import StateNotFoundError |
2329 | |
2330 | from gallery_app.tests import GalleryTestCase |
2331 | from gallery_app.emulators.albums_view import AlbumsView |
2332 | @@ -47,10 +48,19 @@ |
2333 | |
2334 | super(TestAlbumsView, self).tearDown() |
2335 | |
2336 | + def check_header_button_exist(self, button): |
2337 | + header = self.main_view.get_header() |
2338 | + buttonName = button + "_header_button" |
2339 | + try: |
2340 | + header.select_single(objectName=buttonName) |
2341 | + except StateNotFoundError: |
2342 | + return False |
2343 | + return True |
2344 | + |
2345 | def test_add_album(self): |
2346 | """Add one album, and checks if the number of albums went up by one""" |
2347 | albums = self.albums_view.number_of_albums_in_albums_view() |
2348 | - self.main_view.open_toolbar().click_button("addButton") |
2349 | + self.main_view.get_header().click_action_button("addButton") |
2350 | self.assertThat( |
2351 | lambda: self.albums_view.number_of_albums_in_albums_view(), |
2352 | Eventually(Equals(albums+1)) |
2353 | @@ -61,10 +71,10 @@ |
2354 | not change |
2355 | """ |
2356 | albums = self.albums_view.number_of_albums_in_albums_view() |
2357 | - self.main_view.open_toolbar().click_button("addButton") |
2358 | + self.main_view.get_header().click_action_button("addButton") |
2359 | editor = self.app.select_single(album_editor.AlbumEditor) |
2360 | editor.ensure_fully_open() |
2361 | - self.main_view.get_toolbar().click_custom_button("cancelButton") |
2362 | + self.main_view.get_header().click_custom_back_button() |
2363 | self.assertThat( |
2364 | lambda: self.albums_view.number_of_albums_in_albums_view(), |
2365 | Eventually(Equals(albums)) |
2366 | @@ -72,13 +82,8 @@ |
2367 | |
2368 | # Check if Camera Button is not visible at Desktop mode |
2369 | def test_camera_button_visible(self): |
2370 | - self.main_view.open_toolbar() |
2371 | - toolbar = self.main_view.get_toolbar() |
2372 | - cameraButton = toolbar.select_single( |
2373 | - "ActionItem", |
2374 | - objectName="cameraButton" |
2375 | - ) |
2376 | + cameraButtonVisible = self.check_header_button_exist("cameraButton") |
2377 | if model() == "Desktop": |
2378 | - self.assertThat(cameraButton.visible, Equals(False)) |
2379 | + self.assertThat(cameraButtonVisible, Equals(False)) |
2380 | else: |
2381 | - self.assertThat(cameraButton.visible, Equals(True)) |
2382 | + self.assertThat(cameraButtonVisible, Equals(True)) |
2383 | |
2384 | === modified file 'tests/autopilot/gallery_app/tests/test_events_view.py' |
2385 | --- tests/autopilot/gallery_app/tests/test_events_view.py 2014-06-16 13:46:21 +0000 |
2386 | +++ tests/autopilot/gallery_app/tests/test_events_view.py 2014-09-03 23:54:36 +0000 |
2387 | @@ -11,6 +11,7 @@ |
2388 | from testtools.matchers import Equals, NotEquals, Is, GreaterThan |
2389 | from autopilot.matchers import Eventually |
2390 | from autopilot.platform import model |
2391 | +from autopilot.introspection.dbus import StateNotFoundError |
2392 | |
2393 | from gallery_app.tests import GalleryTestCase |
2394 | from gallery_app.emulators.events_view import EventsView |
2395 | @@ -59,7 +60,16 @@ |
2396 | objectName="organicEventView") |
2397 | |
2398 | def enable_select_mode(self): |
2399 | - self.main_view.open_toolbar().click_button("selectButton") |
2400 | + self.main_view.get_header().click_action_button("selectButton") |
2401 | + |
2402 | + def check_header_button_exist(self, button): |
2403 | + header = self.main_view.get_header() |
2404 | + buttonName = button + "_header_button" |
2405 | + try: |
2406 | + header.select_single(objectName=buttonName) |
2407 | + except StateNotFoundError: |
2408 | + return False |
2409 | + return True |
2410 | |
2411 | def test_select_button_cancel(self): |
2412 | """Clicking the cancel button after clicking the select button must |
2413 | @@ -70,10 +80,8 @@ |
2414 | self.enable_select_mode() |
2415 | self.assertTrue(events_view.inSelectionMode) |
2416 | |
2417 | - self.main_view.get_toolbar().click_custom_button("cancelButton") |
2418 | + self.main_view.get_header().click_custom_back_button() |
2419 | |
2420 | - toolbar = self.main_view.get_toolbar() |
2421 | - self.assertThat(toolbar.opened, Eventually(Equals(False))) |
2422 | self.assertFalse(events_view.inSelectionMode) |
2423 | |
2424 | def test_delete_a_photo(self): |
2425 | @@ -83,7 +91,7 @@ |
2426 | |
2427 | self.enable_select_mode() |
2428 | self.events_view.click_photo(self.sample_file) |
2429 | - self.main_view.open_toolbar().click_button("deleteButton") |
2430 | + self.main_view.get_header().click_action_button("deleteButton") |
2431 | self.assertThat(self.gallery_utils.delete_dialog_shown, |
2432 | Eventually(Is(True))) |
2433 | |
2434 | @@ -94,7 +102,7 @@ |
2435 | self.assertThat(lambda: exists(self.sample_file), |
2436 | Eventually(Equals(True))) |
2437 | |
2438 | - self.main_view.open_toolbar().click_button("deleteButton") |
2439 | + self.main_view.get_header().click_action_button("deleteButton") |
2440 | self.assertThat(self.gallery_utils.delete_dialog_shown, |
2441 | Eventually(Is(True))) |
2442 | |
2443 | @@ -123,13 +131,8 @@ |
2444 | |
2445 | # Check if Camera Button is not visible at Desktop mode |
2446 | def test_camera_button_visible(self): |
2447 | - self.main_view.open_toolbar() |
2448 | - toolbar = self.main_view.get_toolbar() |
2449 | - cameraButton = toolbar.select_single( |
2450 | - "ActionItem", |
2451 | - objectName="cameraButton" |
2452 | - ) |
2453 | + cameraButtonVisible = self.check_header_button_exist("cameraButton") |
2454 | if model() == "Desktop": |
2455 | - self.assertThat(cameraButton.visible, Equals(False)) |
2456 | + self.assertThat(cameraButtonVisible, Equals(False)) |
2457 | else: |
2458 | - self.assertThat(cameraButton.visible, Equals(True)) |
2459 | + self.assertThat(cameraButtonVisible, Equals(True)) |
2460 | |
2461 | === modified file 'tests/autopilot/gallery_app/tests/test_photo_viewer.py' |
2462 | --- tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-07-02 22:11:12 +0000 |
2463 | +++ tests/autopilot/gallery_app/tests/test_photo_viewer.py 2014-09-03 23:54:36 +0000 |
2464 | @@ -41,7 +41,8 @@ |
2465 | super(TestPhotoViewerBase, self).setUp() |
2466 | self.main_view.switch_to_tab("eventsTab") |
2467 | self.open_first_photo() |
2468 | - self.main_view.open_toolbar() |
2469 | + # Need to click on the photo to toggle header |
2470 | + self.pointing_device.click() |
2471 | |
2472 | def open_first_photo(self): |
2473 | self.assertThat( |
2474 | @@ -49,10 +50,6 @@ |
2475 | Eventually(GreaterThan(0)) |
2476 | ) |
2477 | |
2478 | - # workaround lp:1247698 |
2479 | - # toolbar needs to be gone to click on an image. |
2480 | - self.main_view.close_toolbar() |
2481 | - |
2482 | self.events_view.click_photo(self.sample_file) |
2483 | |
2484 | photo_viewer_loader = self.photo_viewer.get_main_photo_viewer_loader() |
2485 | @@ -107,7 +104,7 @@ |
2486 | |
2487 | def test_nav_bar_back_button(self): |
2488 | """Clicking the back button must close the photo.""" |
2489 | - self.main_view.open_toolbar().click_button("backButton") |
2490 | + self.main_view.get_header().click_custom_back_button() |
2491 | photo_viewer = self.photo_viewer.get_main_photo_viewer() |
2492 | self.assertThat(photo_viewer.visible, Eventually(Equals(False))) |
2493 | |
2494 | @@ -115,7 +112,7 @@ |
2495 | def test_share_button(self): |
2496 | """Clicking the share button must show the ContentPeerPicker.""" |
2497 | photo_viewer = self.photo_viewer.get_main_photo_viewer() |
2498 | - self.main_view.open_toolbar().click_button("shareButton") |
2499 | + self.main_view.get_header().click_action_button("shareButton") |
2500 | share_picker = self.photo_viewer.get_share_peer_picker() |
2501 | self.assertThat(share_picker.visible, Eventually(Equals(True))) |
2502 | cancel_button = self.photo_viewer.get_content_peer_picker_cancel_button() |
2503 | @@ -123,7 +120,7 @@ |
2504 | self.assertThat(share_picker.visible, Eventually(Equals(False))) |
2505 | |
2506 | def delete_one_picture(self): |
2507 | - self.main_view.open_toolbar().click_button("deleteButton") |
2508 | + self.main_view.get_header().click_action_button("deleteButton") |
2509 | self.get_delete_dialog() |
2510 | delete_item = self.photo_viewer.get_delete_popover_delete_item() |
2511 | self.click_item(delete_item) |
2512 | @@ -131,7 +128,7 @@ |
2513 | |
2514 | def test_photo_delete_works(self): |
2515 | """Clicking the trash button must show the delete dialog.""" |
2516 | - self.main_view.open_toolbar().click_button("deleteButton") |
2517 | + self.main_view.get_header().click_action_button("deleteButton") |
2518 | self.get_delete_dialog() |
2519 | |
2520 | photo_viewer = self.photo_viewer.get_main_photo_viewer() |
2521 | @@ -157,7 +154,7 @@ |
2522 | |
2523 | def test_nav_bar_album_picker_button(self): |
2524 | """Clicking the album picker must show the picker dialog.""" |
2525 | - self.main_view.open_toolbar().click_button("addButton") |
2526 | + self.main_view.get_header().click_action_button("addButton") |
2527 | album_picker = self.photo_viewer.get_popup_album_picker() |
2528 | self.assertThat(album_picker.visible, Eventually(Equals(True))) |
2529 | |
2530 | @@ -169,19 +166,11 @@ |
2531 | self.pointing_device.click() |
2532 | self.pointing_device.click() |
2533 | |
2534 | - self.assertThat( |
2535 | - opened_photo.isZoomAnimationInProgress, |
2536 | - Eventually(Equals(False)) |
2537 | - ) |
2538 | self.assertThat(opened_photo.fullyZoomed, Eventually(Equals(True))) |
2539 | |
2540 | self.pointing_device.click() |
2541 | self.pointing_device.click() |
2542 | |
2543 | - self.assertThat( |
2544 | - opened_photo.isZoomAnimationInProgress, |
2545 | - Eventually(Equals(False)) |
2546 | - ) |
2547 | self.assertThat(opened_photo.fullyUnzoomed, Eventually(Equals(True))) |
2548 | |
2549 | def test_swipe_change_image(self): |
2550 | @@ -219,7 +208,7 @@ |
2551 | self.media_view = self.app.select_single(MediaViewer) |
2552 | |
2553 | def click_edit_button(self): |
2554 | - self.main_view.open_toolbar().click_button("editButton") |
2555 | + self.main_view.get_header().click_action_button("editButton") |
2556 | edit_dialog = self.photo_viewer.get_photo_edit_dialog() |
2557 | self.assertThat(edit_dialog.visible, (Eventually(Equals(True)))) |
2558 | self.assertThat(edit_dialog.opacity, (Eventually(Equals(1)))) |
2559 | @@ -281,7 +270,6 @@ |
2560 | self.assertThat(lambda: is_landscape(), |
2561 | Eventually(Equals(False))) |
2562 | |
2563 | - self.main_view.open_toolbar() |
2564 | self.click_edit_button() |
2565 | self.photo_viewer.click_undo_item() |
2566 | self.media_view.ensure_spinner_not_running() |
2567 | @@ -291,7 +279,6 @@ |
2568 | self.assertThat(lambda: is_landscape(), |
2569 | Eventually(Equals(True))) |
2570 | |
2571 | - self.main_view.open_toolbar() |
2572 | self.click_edit_button() |
2573 | self.photo_viewer.click_redo_item() |
2574 | self.media_view.ensure_spinner_not_running() |
2575 | @@ -301,10 +288,8 @@ |
2576 | is_landscape = opened_photo.paintedWidth > opened_photo.paintedHeight |
2577 | self.assertThat(is_landscape, Equals(False)) |
2578 | |
2579 | - self.main_view.open_toolbar() |
2580 | self.click_edit_button() |
2581 | self.photo_viewer.click_rotate_item() |
2582 | - self.main_view.open_toolbar() |
2583 | self.click_edit_button() |
2584 | self.photo_viewer.click_revert_item() |
2585 | |
2586 | |
2587 | === modified file 'tests/autopilot/gallery_app/tests/test_photos_view.py' |
2588 | --- tests/autopilot/gallery_app/tests/test_photos_view.py 2014-05-20 20:59:52 +0000 |
2589 | +++ tests/autopilot/gallery_app/tests/test_photos_view.py 2014-09-03 23:54:36 +0000 |
2590 | @@ -12,6 +12,7 @@ |
2591 | from testtools import skipUnless |
2592 | from autopilot.matchers import Eventually |
2593 | from autopilot.platform import model |
2594 | +from autopilot.introspection.dbus import StateNotFoundError |
2595 | |
2596 | from gallery_app.tests import GalleryTestCase |
2597 | from gallery_app.emulators.photos_view import PhotosView |
2598 | @@ -56,8 +57,16 @@ |
2599 | photo = self.photos_view.get_first_photo_in_photos_view() |
2600 | self.click_item(photo) |
2601 | |
2602 | + def check_header_button_exist(self, button): |
2603 | + header = self.main_view.get_header() |
2604 | + buttonName = button + "_header_button" |
2605 | + try: |
2606 | + header.select_single(objectName=buttonName) |
2607 | + except StateNotFoundError: |
2608 | + return False |
2609 | + return True |
2610 | + |
2611 | def test_open_photo(self): |
2612 | - self.main_view.close_toolbar() |
2613 | self.click_first_photo() |
2614 | sleep(5) |
2615 | photo_viewer = self.photos_view.get_main_photo_viewer() |
2616 | @@ -69,13 +78,11 @@ |
2617 | photos_overview = self.app.select_single("PhotosOverview") |
2618 | self.assertFalse(photos_overview.inSelectionMode) |
2619 | |
2620 | - self.main_view.open_toolbar().click_button("selectButton") |
2621 | + self.main_view.get_header().click_action_button("selectButton") |
2622 | self.assertTrue(photos_overview.inSelectionMode) |
2623 | |
2624 | - self.main_view.open_toolbar().click_custom_button("cancelButton") |
2625 | + self.main_view.get_header().click_custom_back_button() |
2626 | |
2627 | - toolbar = self.main_view.get_toolbar() |
2628 | - self.assertThat(toolbar.opened, Eventually(Equals(False))) |
2629 | self.assertFalse(photos_overview.inSelectionMode) |
2630 | |
2631 | first_photo = self.photos_view.get_first_photo_in_photos_view() |
2632 | @@ -84,9 +91,9 @@ |
2633 | |
2634 | def test_delete_photo_dialog_appears(self): |
2635 | """Selecting a photo must make the delete button clickable.""" |
2636 | - self.main_view.open_toolbar().click_button("selectButton") |
2637 | + self.main_view.get_header().click_action_button("selectButton") |
2638 | self.click_first_photo() |
2639 | - self.main_view.open_toolbar().click_button("deleteButton") |
2640 | + self.main_view.get_header().click_action_button("deleteButton") |
2641 | |
2642 | self.assertThat(self.gallery_utils.delete_dialog_shown, |
2643 | Eventually(Is(True))) |
2644 | @@ -99,15 +106,13 @@ |
2645 | def test_delete_a_photo(self): |
2646 | """Must be able to select a photo and use the dialog to delete it.""" |
2647 | number_of_photos = self.photos_view.number_of_photos() |
2648 | - self.main_view.open_toolbar().click_button("selectButton") |
2649 | + self.main_view.get_header().click_action_button("selectButton") |
2650 | self.click_first_photo() |
2651 | - self.main_view.open_toolbar().click_button("deleteButton") |
2652 | + self.main_view.get_header().click_action_button("deleteButton") |
2653 | |
2654 | self.assertThat(self.gallery_utils.delete_dialog_shown, |
2655 | Eventually(Is(True))) |
2656 | |
2657 | - self.main_view.open_toolbar().click_button("deleteButton") |
2658 | - |
2659 | delete_item = self.photos_view.get_delete_dialog_delete_button() |
2660 | self.click_item(delete_item) |
2661 | self.assertThat( |
2662 | @@ -157,13 +162,8 @@ |
2663 | |
2664 | # Check if Camera Button is not visible at Desktop mode |
2665 | def test_camera_button_visible(self): |
2666 | - self.main_view.open_toolbar() |
2667 | - toolbar = self.main_view.get_toolbar() |
2668 | - cameraButton = toolbar.select_single( |
2669 | - "ActionItem", |
2670 | - objectName="cameraButton" |
2671 | - ) |
2672 | + cameraButtonVisible = self.check_header_button_exist("cameraButton") |
2673 | if model() == "Desktop": |
2674 | - self.assertThat(cameraButton.visible, Equals(False)) |
2675 | + self.assertThat(cameraButtonVisible, Equals(False)) |
2676 | else: |
2677 | - self.assertThat(cameraButton.visible, Equals(True)) |
2678 | + self.assertThat(cameraButtonVisible, Equals(True)) |
FAILED: Continuous integration, rev:1076 jenkins. qa.ubuntu. com/job/ gallery- app-ci/ 981/ jenkins. qa.ubuntu. com/job/ gallery- app-utopic- amd64-ci/ 156 jenkins. qa.ubuntu. com/job/ gallery- app-utopic- armhf-ci/ 156 jenkins. qa.ubuntu. com/job/ gallery- app-utopic- armhf-ci/ 156/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ gallery- app-utopic- i386-ci/ 156 jenkins. qa.ubuntu. com/job/ generic- click-autopilot -utopic- touch/332 jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 3304 jenkins. qa.ubuntu. com/job/ generic- click-autopilot -runner- mako/473 jenkins. qa.ubuntu. com/job/ generic- click-builder- utopic- armhf/528 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 12586 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic/ 2712 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/3598 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/3598/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/gallery- app-ci/ 981/rebuild
http://