Merge lp:~phablet-team/camera-app/photo-editor into lp:camera-app

Proposed by Bill Filler
Status: Merged
Approved by: Bill Filler
Approved revision: 443
Merged at revision: 502
Proposed branch: lp:~phablet-team/camera-app/photo-editor
Merge into: lp:camera-app
Diff against target: 177 lines (+77/-36)
2 files modified
PhotoEditorLoader.qml (+32/-0)
SlideshowView.qml (+45/-36)
To merge this branch: bzr merge lp:~phablet-team/camera-app/photo-editor
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+249436@code.launchpad.net

Commit message

dynamically check for editor

Description of the change

dynamically check for editor

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

fix merge conflict

443. By Bill Filler

revert

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'PhotoEditorLoader.qml'
2--- PhotoEditorLoader.qml 1970-01-01 00:00:00 +0000
3+++ PhotoEditorLoader.qml 2015-02-12 02:59:57 +0000
4@@ -0,0 +1,32 @@
5+/*
6+ * Copyright 2014 Canonical Ltd.
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License as published by
10+ * the Free Software Foundation; version 3.
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ * You should have received a copy of the GNU General Public License
18+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19+ */
20+
21+import QtQuick 2.0
22+import Ubuntu.Components.Extras 0.2
23+
24+PhotoEditor {
25+ id: photoEditor
26+ objectName: "photoEditor"
27+
28+ Connections {
29+ target: header
30+ onExitEditor: photoEditor.close(true);
31+ }
32+
33+ function start(url) {
34+ item.open(url.replace("file://", ""));
35+ }
36+}
37
38=== modified file 'SlideshowView.qml'
39--- SlideshowView.qml 2015-02-06 20:51:21 +0000
40+++ SlideshowView.qml 2015-02-12 02:59:57 +0000
41@@ -18,7 +18,6 @@
42 import Ubuntu.Components 1.0
43 import Ubuntu.Components.ListItems 1.0 as ListItems
44 import Ubuntu.Components.Popups 1.0
45-import Ubuntu.Components.Extras 0.1
46 import Ubuntu.Content 0.1
47 import Ubuntu.Thumbnailer 0.1
48 import CameraApp 0.1
49@@ -32,6 +31,7 @@
50 property bool touchAcquired: listView.currentItem ? listView.currentItem.pinchInProgress ||
51 editor.active : false
52 property bool inView
53+ property bool editingAvailable: false
54 signal toggleHeader
55 property list<Action> actions: [
56 Action {
57@@ -43,14 +43,29 @@
58 text: i18n.tr("Delete")
59 iconName: "delete"
60 onTriggered: PopupUtils.open(deleteDialogComponent)
61- },
62- Action {
63- text: i18n.tr("Edit")
64- iconName: "edit"
65- onTriggered: editor.start()
66 }
67 ]
68
69+ Action {
70+ id: editAction
71+ text: i18n.tr("Edit")
72+ iconName: "edit"
73+ onTriggered: editor.start(listView.currentItem.url)
74+ }
75+
76+ Component.onCompleted: {
77+ // The PhotoEditor is only available in Ubuntu.Components.Extras 0.2
78+ // If we succeed here we add the edit button to the list of actions.
79+ try { Qt.createQmlObject('import QtQuick 2.0; import Ubuntu.Components.Extras 0.2; Item {}', slideshowView) }
80+ catch (e) { return; }
81+
82+ editingAvailable = true;
83+ var newActions = [];
84+ for (var i = 0; i < actions.length; i++) newActions.push(actions[i]);
85+ newActions.push(editAction);
86+ actions = newActions;
87+ }
88+
89 function showPhotoAtIndex(index) {
90 listView.positionViewAtIndex(index, ListView.Contain);
91 }
92@@ -192,13 +207,15 @@
93 height: flickable.height * flickable.sizeScale
94
95 property bool isVideo: MimeTypeMapper.mimeTypeToContentType(fileType) === ContentType.Videos
96+ property string photoUrl: editingAvailable ? "image://photo/%1".arg(fileURL.toString()) : fileURL.toString().replace("file://", "")
97
98 Image {
99 id: image
100 anchors.fill: parent
101 asynchronous: true
102 cache: false
103- source: slideshowView.inView ? "image://" + (media.isVideo ? "thumbnailer/" : "photo/") + fileURL.toString() : ""
104+ source: slideshowView.inView ? (media.isVideo ? "image://thumbnail/%1".arg(fileURL.toString())
105+ : media.photoUrl) : ""
106 sourceSize {
107 width: listView.maxDimension
108 height: listView.maxDimension
109@@ -213,7 +230,7 @@
110 anchors.fill: parent
111 asynchronous: true
112 cache: false
113- source: flickable.sizeScale > 1.0 ? "image://photo/" + fileURL.toString() : ""
114+ source: flickable.sizeScale > 1.0 ? media.photoUrl : ""
115 sourceSize {
116 width: width
117 height: height
118@@ -321,34 +338,6 @@
119 }
120 }
121
122- Loader {
123- id: editor
124- anchors.fill: parent
125-
126- active: false
127- sourceComponent: Component {
128- PhotoEditor {
129- id: editorItem
130- objectName: "photoEditor"
131-
132- Connections {
133- target: header
134- onExitEditor: editorItem.close(true);
135- }
136-
137- onClosed: {
138- editor.active = false;
139- if (photoWasModified) listView.currentItem.reload()
140- }
141- }
142- }
143-
144- function start() {
145- editor.active = true;
146- editor.item.open(listView.currentItem.url.replace("file://", ""));
147- }
148- }
149-
150 Binding { target: header; property: "editMode"; value: editor.active }
151 Binding { target: header; property: "editModeActions"; value: editor.item.actions; when: editor.active }
152
153@@ -360,4 +349,24 @@
154 image.asynchronous = async;
155 image.source = source;
156 }
157+
158+ Loader {
159+ id: editor
160+ source: "PhotoEditorLoader.qml"
161+ active: false
162+ anchors.fill: parent
163+
164+ function start(url) {
165+ editor.active = true;
166+ editor.item.start(url);
167+ }
168+
169+ Connections {
170+ target: editor.item
171+ onClosed: {
172+ editor.active = false;
173+ if (photoWasModified) listView.currentItem.reload();
174+ }
175+ }
176+ }
177 }

Subscribers

People subscribed via source and target branches