Merge lp:~artmello/gallery-app/gallery-app-improve_album_editor_load into lp:gallery-app

Proposed by Arthur Mello
Status: Merged
Approved by: Bill Filler
Approved revision: 1117
Merged at revision: 1117
Proposed branch: lp:~artmello/gallery-app/gallery-app-improve_album_editor_load
Merge into: lp:gallery-app
Diff against target: 412 lines (+8/-362)
3 files modified
rc/qml/AlbumEditor/AlbumEditorAnimated.qml (+0/-115)
rc/qml/AlbumEditor/AlbumEditorTransition.qml (+0/-239)
rc/qml/AlbumsOverview.qml (+8/-8)
To merge this branch: bzr merge lp:~artmello/gallery-app/gallery-app-improve_album_editor_load
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
Review via email: mp+244078@code.launchpad.net

Commit message

Load the AlbumEditor without the animation to improve the load time

Description of the change

Load the AlbumEditor without the animation to improve the load time

To post a comment you must log in.
Revision history for this message
Bill Filler (bfiller) wrote :

approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'rc/qml/AlbumEditor/AlbumEditorAnimated.qml'
2--- rc/qml/AlbumEditor/AlbumEditorAnimated.qml 2014-10-13 09:26:44 +0000
3+++ rc/qml/AlbumEditor/AlbumEditorAnimated.qml 1970-01-01 00:00:00 +0000
4@@ -1,115 +0,0 @@
5-/*
6- * Copyright (C) 2013 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 version 3 as
10- * published by the Free Software Foundation.
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 Gallery 1.0
23-import Ubuntu.Components 0.1
24-
25-/*! @brief AlbumEditorAnimated opens the editor for the album
26- *
27- * The album editor enable to edit the title, sub-title and the cover image.
28- * Set the album and origin properties befor calling open()
29- * The first call of open() is slow, as the lazy loading is used for the album editor which is a
30- * big component.
31- */
32-Item {
33- id: root
34-
35- // True if the album editor is opened
36- property bool isOpen: false
37- /// The album to be shown in that editor
38- property Album album
39- /// Origin (rectangle) where this view is animated from when calling open()
40- /// And where it is animated to when this view is closed
41- property variant origin
42- /// The preview item that was used to open the view, or null, if it was opend another way
43- /// This item will be hidden when this view is opened. And shown again after closing this view
44- property Item previewItem: null
45- /// Is true if the opne or close animation is running
46- property bool animationRunning: loader_albumEditor.status === Loader.Ready ?
47- loader_albumEditor.item.albumEditorTransition.animationRunning ||
48- loader_albumEditor.item.albumEditor.animationRunning
49- : false
50-
51- /// Opens the editor for the album with an animation
52- function open() {
53- loader_albumEditor.load()
54- loader_albumEditor.item.albumEditor.album = album
55- loader_albumEditor.item.albumEditorTransition.enterEditor(root.album, root.origin)
56- if (previewItem)
57- previewItem.visible = false
58- isOpen = true;
59- }
60-
61- Component {
62- id: component_EditorItem
63- Item {
64- property alias albumEditorTransition: inner_albumEditorTransition
65- property alias albumEditor: inner_albumEditor
66-
67- AlbumEditor {
68- id: inner_albumEditor
69- anchors.fill: parent
70- visible: false
71-
72- onMediaSelectorHidden: {
73- albumEditorCheckerboardHidden(newScrollPos);
74- }
75-
76- onCloseRequested: {
77- root.isOpen = false;
78- if (album && album.newAlbum && album.containedCount == 0) {
79- inner_albumEditor.model.destroyAlbum(album);
80- album = null;
81- }
82- if (album) {
83- inner_albumEditorTransition.exitEditor(album, root.origin);
84- } else {
85- inner_albumEditorTransition.exitEditor(null, null);
86- }
87- }
88- }
89-
90- AlbumEditorTransition {
91- id: inner_albumEditorTransition
92- anchors.fill: parent
93- backgroundGlass: inner_albumEditor.backgroundGlass
94- editor: inner_albumEditor
95- onEditorExited: {
96- if (previewItem)
97- previewItem.visible = true;
98- loader_albumEditor.sourceComponent = undefined;
99- }
100- }
101- }
102- }
103- Loader {
104- id: loader_albumEditor
105- anchors.fill: parent
106-
107- function load() {
108- if (sourceComponent == undefined) {
109- sourceComponent = component_EditorItem
110- }
111- }
112- }
113-
114- MouseArea {
115- id: transitionClickBlocker
116- anchors.fill: parent
117- enabled: root.animationRunning
118- }
119-}
120
121=== removed file 'rc/qml/AlbumEditor/AlbumEditorTransition.qml'
122--- rc/qml/AlbumEditor/AlbumEditorTransition.qml 2014-05-20 09:34:10 +0000
123+++ rc/qml/AlbumEditor/AlbumEditorTransition.qml 1970-01-01 00:00:00 +0000
124@@ -1,239 +0,0 @@
125-/*
126- * Copyright (C) 2012 Canonical Ltd
127- *
128- * This program is free software: you can redistribute it and/or modify
129- * it under the terms of the GNU General Public License version 3 as
130- * published by the Free Software Foundation.
131- *
132- * This program is distributed in the hope that it will be useful,
133- * but WITHOUT ANY WARRANTY; without even the implied warranty of
134- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
135- * GNU General Public License for more details.
136- *
137- * You should have received a copy of the GNU General Public License
138- * along with this program. If not, see <http://www.gnu.org/licenses/>.
139- *
140- * Authors:
141- * Charles Lindsay <chaz@yorba.org>
142- */
143-
144-import QtQuick 2.0
145-import "../AlbumViewer"
146-import "../Utility"
147-
148-// Provides a smooth transition between the album overview and album editor.
149-Item {
150- id: albumEditorTransition
151-
152- /*!
153- */
154- signal editorEntered(variant album)
155- /*!
156- */
157- signal editorExited(variant album)
158-
159- /*!
160- */
161- property alias album: thumbnail.album
162-
163- /*!
164- */
165- property Rectangle backgroundGlass
166- /*!
167- */
168- property AlbumEditor editor
169-
170- /*!
171- */
172- property int duration: 500
173-
174- // Read-only
175- /*!
176- */
177- property bool animationRunning: enterFadeAnimation.running ||
178- exitFadeAnimation.running || enterExpandAnimation.running ||
179- exitExpandAnimation.running;
180-
181- /*!
182- */
183- function enterEditor(album, thumbnailRect) {
184- albumEditorTransition.album = album || null;
185-
186- if (thumbnailRect) {
187- thumbnail.x = thumbnailRect.x;
188- thumbnail.y = thumbnailRect.y;
189- thumbnail.width = thumbnailRect.width;
190- thumbnail.height = thumbnailRect.height;
191-
192- overview.pushPage(editor);
193- enterExpandAnimation.restart();
194- } else {
195- overview.pushPage(editor);
196- enterFadeAnimation.restart();
197- }
198- }
199-
200- /*!
201- */
202- function exitEditor(album, thumbnailRect) {
203- albumEditorTransition.album = album || null;
204-
205- if (thumbnailRect) {
206- exitExpandAnimation.thumbnailRect = thumbnailRect;
207-
208- thumbnail.x = editor.editorRect.x;
209- thumbnail.y = editor.editorRect.y;
210- thumbnail.width = editor.editorRect.width;
211- thumbnail.height = editor.editorRect.height;
212-
213- overview.popPage();
214- exitExpandAnimation.restart();
215- } else {
216- overview.popPage();
217- exitFadeAnimation.restart();
218- }
219- }
220-
221- // internal
222- /*!
223- */
224- function onExitFinished() {
225- editorExited(album);
226- album = null;
227- }
228-
229- AlbumOpener {
230- id: thumbnail
231-
232- isPreview: true
233- contentHasPreviewFrame: true
234-
235- visible: false
236- load: visible
237- }
238-
239- ParallelAnimation {
240- id: enterFadeAnimation
241-
242- onRunningChanged: {
243- if (!running)
244- editorEntered(albumEditorTransition.album);
245- }
246-
247- FadeInAnimation {
248- target: backgroundGlass
249- endOpacity: 0.75
250- duration: albumEditorTransition.duration
251- }
252-
253- FadeInAnimation {
254- target: editor
255- duration: albumEditorTransition.duration
256- }
257- }
258-
259- ParallelAnimation {
260- id: exitFadeAnimation
261-
262- onRunningChanged: {
263- if (!running)
264- onExitFinished();
265- }
266-
267- FadeOutAnimation {
268- target: backgroundGlass
269- startOpacity: 0.75
270- duration: albumEditorTransition.duration
271- }
272-
273- FadeOutAnimation {
274- target: editor
275- duration: albumEditorTransition.duration
276- }
277- }
278-
279- SequentialAnimation {
280- id: enterExpandAnimation
281-
282- onRunningChanged: {
283- if (!running)
284- editorEntered(albumEditorTransition.album);
285- }
286-
287- PropertyAction { target: thumbnail; property: "visible"; value: true; }
288- PropertyAction { target: editor; property: "showAlbumCover"; value: false; }
289-
290- ParallelAnimation {
291- ExpandAnimation {
292- target: thumbnail
293- endX: editor.editorRect.x
294- endY: editor.editorRect.y
295- endWidth: editor.editorRect.width
296- endHeight: editor.editorRect.height
297- duration: albumEditorTransition.duration
298- easingType: Easing.OutQuad
299- }
300-
301- NumberAnimation {
302- target: thumbnail
303- property: "openFraction"
304- from: (!album || album.closed ? 0 : 1)
305- to: 0
306- duration: albumEditorTransition.duration
307- easing.type: Easing.OutQuad
308- }
309-
310- FadeInAnimation {
311- target: backgroundGlass
312- endOpacity: 0.75
313- duration: albumEditorTransition.duration
314- }
315- }
316-
317- PropertyAction { target: thumbnail; property: "visible"; value: false; }
318- PropertyAction { target: editor; property: "showAlbumCover"; value: true; }
319- }
320-
321- SequentialAnimation {
322- id: exitExpandAnimation
323-
324- property variant thumbnailRect: {"x": 0, "y": 0, "width": 0, "height": 0}
325-
326- onRunningChanged: {
327- if (!running)
328- onExitFinished();
329- }
330-
331- PropertyAction { target: editor; property: "visible"; value: false; }
332- PropertyAction { target: thumbnail; property: "visible"; value: true; }
333-
334- ParallelAnimation {
335- ExpandAnimation {
336- target: thumbnail
337- endX: exitExpandAnimation.thumbnailRect.x
338- endY: exitExpandAnimation.thumbnailRect.y
339- endWidth: exitExpandAnimation.thumbnailRect.width
340- endHeight: exitExpandAnimation.thumbnailRect.height
341- duration: albumEditorTransition.duration
342- easingType: Easing.OutQuad
343- }
344-
345- NumberAnimation {
346- target: thumbnail
347- property: "openFraction"
348- from: 0
349- to: (!album || album.closed ? 0 : 1)
350- duration: albumEditorTransition.duration
351- easing.type: Easing.InQuad
352- }
353-
354- FadeOutAnimation {
355- target: backgroundGlass
356- startOpacity: 0.75
357- duration: albumEditorTransition.duration
358- }
359- }
360-
361- PropertyAction { target: thumbnail; property: "visible"; value: false; }
362- }
363-}
364
365=== modified file 'rc/qml/AlbumsOverview.qml'
366--- rc/qml/AlbumsOverview.qml 2014-11-06 14:43:21 +0000
367+++ rc/qml/AlbumsOverview.qml 2014-12-09 03:00:14 +0000
368@@ -130,7 +130,6 @@
369 onLongPressed: {
370 albumMenu.album = album
371 albumMenu.caller = content
372- albumEditor.previewItem = thisDelegate
373 albumMenu.show()
374 }
375
376@@ -209,8 +208,7 @@
377
378 onEditClicked: {
379 albumEditor.album = album
380- albumEditor.origin = root.getRectOfAlbumPreview(album, albumEditor)
381- albumEditor.open()
382+ overview.pushPage(albumEditor)
383 }
384
385 onDeleteClicked: {
386@@ -242,9 +240,7 @@
387 albumCollectionModel.addOrphan(album);
388
389 albumEditor.album = album;
390- albumEditor.origin = null;
391- albumEditor.previewItem = null;
392- albumEditor.open();
393+ overview.pushPage(albumEditor);
394 }
395 }
396 text: i18n.tr("Add") // text in toolbar
397@@ -271,9 +267,13 @@
398 onQuickCloseRequested: isAlbumOpened = false;
399 }
400
401- AlbumEditorAnimated {
402+ AlbumEditor {
403 id: albumEditor
404- objectName: "albumEditorAnimated"
405+ objectName: "albumEditor"
406 anchors.fill: parent
407+ visible: false
408+
409+ onMediaSelectorHidden: albumEditorCheckerboardHidden(newScrollPos);
410+ onCloseRequested: overview.popPage();
411 }
412 }

Subscribers

People subscribed via source and target branches