Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / examples / declarative / flickr / flickr.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
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.
16 **
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.
20 **
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.
28 **
29 ** Other Usage
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.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 import QtQuick 2.0
43 import QtQuick.Particles 2.0
44 import "content"
45
46 Item {
47     id: screen; width: 320; height: 480
48     property bool inGridView : true
49
50     Rectangle {
51         id: background
52         anchors.fill: parent; color: "#343434";
53
54         Image { source: "content/images/stripes.png"; fillMode: Image.Tile; anchors.fill: parent; opacity: 0.3 }
55         ParticleSystem {
56             id: bgParticles
57             anchors.fill: parent
58             ImageParticle {
59                 groups: ["trail"]
60                 source: "content/images/particle.png"
61                 color: "#1A1A6F"
62                 alpha: 0.1
63                 colorVariation: 0.01
64                 blueVariation: 0.8
65             }
66             Emitter {
67                 group: "drops"
68                 width: parent.width
69                 emitRate: 0.5
70                 lifeSpan: 20000
71                 startTime: 16000
72                 speed: PointDirection{
73                     y: {screen.height/18}
74                 }
75             }
76             TrailEmitter {
77                 follow: "drops"
78                 group: "trail"
79                 emitRatePerParticle: 18
80                 size: 32
81                 endSize: 0
82                 sizeVariation: 4
83                 lifeSpan: 1200
84                 anchors.fill: parent
85                 emitWidth: 16
86                 emitHeight: 16
87                 emitShape: EllipseShape{}
88             }
89         }
90
91         VisualDataModel{
92             id: vdm
93             delegate: UnifiedDelegate{}
94             model: RssModel { id: rssModel }
95         }
96
97         Item {
98             id: views
99             width: parent.width
100             anchors.top: titleBar.bottom; anchors.bottom: toolBar.top
101
102             GridView {
103                 id: photoGridView; model: vdm.parts.grid
104                 cacheBuffer: 1000
105                 cellWidth: (parent.width-2)/4; cellHeight: cellWidth; width: parent.width; height: parent.height
106             }
107
108             states: State {
109                 name: "GridView"; when: state.inGridView == true
110             }
111
112             transitions: Transition {
113                 NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
114             }
115
116             ImageDetails { id: imageDetails; width: parent.width; anchors.left: views.right; height: parent.height }
117
118             Item { id: foreground; anchors.fill: parent }
119         }
120
121         TitleBar { id: titleBar; width: parent.width; height: 40; opacity: 0.9 }
122
123         ToolBar {
124             id: toolBar
125             height: 40; anchors.bottom: parent.bottom; width: parent.width; opacity: 0.9
126             button1Label: "Update"; button2Label: "View mode"
127             onButton1Clicked: rssModel.reload()
128             onButton2Clicked: if (screen.inGridView == true) screen.inGridView = false; else screen.inGridView = true
129         }
130
131         Connections {
132             target: imageDetails
133             onClosed: {
134                 if (background.state == "DetailedView") {
135                     background.state = '';
136                     imageDetails.photoUrl = "";
137                 }
138             }
139         }
140
141         states: State {
142             name: "DetailedView"
143             PropertyChanges { target: views; x: -parent.width }
144             PropertyChanges { target: toolBar; button1Label: "View..." }
145             PropertyChanges {
146                 target: toolBar
147                 onButton1Clicked: if (imageDetails.state=='') imageDetails.state='Back'; else imageDetails.state=''
148             }
149             PropertyChanges { target: toolBar; button2Label: "Back" }
150             PropertyChanges { target: toolBar; onButton2Clicked: imageDetails.closed() }
151         }
152
153         transitions: Transition {
154             NumberAnimation { properties: "x"; duration: 500; easing.type: Easing.InOutQuad }
155         }
156
157     }
158 }