1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtQml module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
43 import "script/script.js" as Script
46 Item { id: stackItem; Package.name: 'stack'; width: 160; height: 153; z: stackItem.PathView.z }
47 Item { id: listItem; Package.name: 'list'; width: mainWindow.width + 40; height: 153 }
48 Item { id: gridItem; Package.name: 'grid'; width: 160; height: 153 }
51 width: 160; height: 153
56 property double randomAngle: Math.random() * (2 * 6 + 1) - 6
57 property double randomAngle2: Math.random() * (2 * 6 + 1) - 6
59 x: 0; y: 0; width: 140; height: 133
60 z: stackItem.PathView.z; rotation: photoWrapper.randomAngle
64 fill: originalImage.status == Image.Ready ? border : placeHolder
65 leftMargin: -6; topMargin: -6; rightMargin: -8; bottomMargin: -8
67 source: 'images/box-shadow.png'; smooth: true
68 border.left: 10; border.top: 10; border.right: 10; border.bottom: 10
73 property int w: Script.getWidth(content)
74 property int h: Script.getHeight(content)
75 property double s: Script.calculateScale(w, h, photoWrapper.width)
77 color: 'white'; anchors.centerIn: parent; smooth: true
78 width: w * s; height: h * s; visible: originalImage.status != Image.Ready
80 color: "#878787"; smooth: true
81 anchors { fill: parent; topMargin: 3; bottomMargin: 3; leftMargin: 3; rightMargin: 3 }
85 id: border; color: 'white'; anchors.centerIn: parent; smooth: true
86 width: originalImage.paintedWidth + 6; height: originalImage.paintedHeight + 6
87 visible: !placeHolder.visible
89 BusyIndicator { anchors.centerIn: parent; on: originalImage.status != Image.Ready }
91 id: originalImage; smooth: true; source: "http://" + Script.getImagePath(content); cache: false
92 fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height
95 id: hqImage; smooth: true; source: ""; visible: false; cache: false
96 fillMode: Image.PreserveAspectFit; width: photoWrapper.width; height: photoWrapper.height
99 target: mainWindow; property: "downloadProgress"; value: hqImage.progress
100 when: listItem.ListView.isCurrentItem
103 target: mainWindow; property: "imageLoading"
104 value: (hqImage.status == Image.Loading) ? 1 : 0; when: listItem.ListView.isCurrentItem
107 width: originalImage.paintedWidth; height: originalImage.paintedHeight; anchors.centerIn: originalImage
109 if (albumWrapper.state == 'inGrid') {
110 gridItem.GridView.view.currentIndex = index;
111 albumWrapper.state = 'fullscreen'
113 gridItem.GridView.view.currentIndex = index;
114 albumWrapper.state = 'inGrid'
121 name: 'stacked'; when: albumWrapper.state == ''
122 ParentChange { target: photoWrapper; parent: stackItem; x: 10; y: 10 }
123 PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 }
126 name: 'inGrid'; when: albumWrapper.state == 'inGrid'
127 ParentChange { target: photoWrapper; parent: gridItem; x: 10; y: 10; rotation: photoWrapper.randomAngle2 }
130 name: 'fullscreen'; when: albumWrapper.state == 'fullscreen'
132 target: photoWrapper; parent: listItem; x: 0; y: 0; rotation: 0
133 width: mainWindow.width; height: mainWindow.height
135 PropertyChanges { target: border; opacity: 0 }
136 PropertyChanges { target: hqImage; source: listItem.ListView.isCurrentItem ? hq : ""; visible: true }
142 from: 'stacked'; to: 'inGrid'
143 SequentialAnimation {
144 PauseAnimation { duration: 10 * index }
146 target: photoWrapper; via: foreground
148 target: photoWrapper; properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart'
154 from: 'inGrid'; to: 'stacked'
156 target: photoWrapper; via: foreground
157 NumberAnimation { properties: 'x,y,rotation,opacity'; duration: 600; easing.type: 'OutQuart' }
161 from: 'inGrid'; to: 'fullscreen'
162 SequentialAnimation {
163 PauseAnimation { duration: gridItem.GridView.isCurrentItem ? 0 : 600 }
165 target: photoWrapper; via: foreground
167 targets: [ photoWrapper, border ]
168 properties: 'x,y,width,height,opacity,rotation'
169 duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart'
175 from: 'fullscreen'; to: 'inGrid'
177 target: photoWrapper; via: foreground
179 targets: [ photoWrapper, border ]
180 properties: 'x,y,width,height,rotation,opacity'
181 duration: gridItem.GridView.isCurrentItem ? 600 : 1; easing.type: 'OutQuart'