2
* Copyright (C) 2012 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Charles Lindsay <chaz@yorba.org>
21
import "../AlbumViewer"
24
// Provides a smooth transition between the album overview and album editor.
26
id: albumEditorTransition
30
signal editorEntered(variant album)
33
signal editorExited(variant album)
37
property alias album: thumbnail.album
41
property Rectangle backgroundGlass
44
property AlbumEditor editor
48
property int duration: 500
53
property bool animationRunning: enterFadeAnimation.running ||
54
exitFadeAnimation.running || enterExpandAnimation.running ||
55
exitExpandAnimation.running;
59
function enterEditor(album, thumbnailRect) {
60
albumEditorTransition.album = album || null;
63
thumbnail.x = thumbnailRect.x;
64
thumbnail.y = thumbnailRect.y;
65
thumbnail.width = thumbnailRect.width;
66
thumbnail.height = thumbnailRect.height;
68
enterExpandAnimation.restart();
70
enterFadeAnimation.restart();
76
function exitEditor(album, thumbnailRect) {
77
albumEditorTransition.album = album || null;
80
exitExpandAnimation.thumbnailRect = thumbnailRect;
82
thumbnail.x = editor.editorRect.x;
83
thumbnail.y = editor.editorRect.y;
84
thumbnail.width = editor.editorRect.width;
85
thumbnail.height = editor.editorRect.height;
87
exitExpandAnimation.restart();
89
exitFadeAnimation.restart();
96
function onExitFinished() {
105
contentHasPreviewFrame: true
112
id: enterFadeAnimation
116
editorEntered(albumEditorTransition.album);
120
target: backgroundGlass
122
duration: albumEditorTransition.duration
127
duration: albumEditorTransition.duration
132
id: exitFadeAnimation
140
target: backgroundGlass
142
duration: albumEditorTransition.duration
147
duration: albumEditorTransition.duration
151
SequentialAnimation {
152
id: enterExpandAnimation
156
editorEntered(albumEditorTransition.album);
159
PropertyAction { target: thumbnail; property: "visible"; value: true; }
164
endX: editor.editorRect.x
165
endY: editor.editorRect.y
166
endWidth: editor.editorRect.width
167
endHeight: editor.editorRect.height
168
duration: albumEditorTransition.duration
169
easingType: Easing.OutQuad
174
property: "openFraction"
175
from: (!album || album.closed ? 0 : 1)
177
duration: albumEditorTransition.duration
178
easing.type: Easing.OutQuad
182
target: backgroundGlass
184
duration: albumEditorTransition.duration
188
PropertyAction { target: thumbnail; property: "visible"; value: false; }
189
PropertyAction { target: editor; property: "visible"; value: true; }
192
SequentialAnimation {
193
id: exitExpandAnimation
195
property variant thumbnailRect: {"x": 0, "y": 0, "width": 0, "height": 0}
202
PropertyAction { target: editor; property: "visible"; value: false; }
203
PropertyAction { target: thumbnail; property: "visible"; value: true; }
208
endX: exitExpandAnimation.thumbnailRect.x
209
endY: exitExpandAnimation.thumbnailRect.y
210
endWidth: exitExpandAnimation.thumbnailRect.width
211
endHeight: exitExpandAnimation.thumbnailRect.height
212
duration: albumEditorTransition.duration
213
easingType: Easing.OutQuad
218
property: "openFraction"
220
to: (!album || album.closed ? 0 : 1)
221
duration: albumEditorTransition.duration
222
easing.type: Easing.InQuad
226
target: backgroundGlass
228
duration: albumEditorTransition.duration
232
PropertyAction { target: thumbnail; property: "visible"; value: false; }