2
* This file is part of unity-2d
4
* Copyright 2010-2011 Canonical Ltd.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
import "../common/units.js" as Units
23
import "../common/utils.js" as Utils
27
currentItem: flow.currentItem
28
/* FIXME: should be defined as a property of Renderer */
29
property int contentHeight: Units.tvPx(540)
34
property real margin: Units.tvPx(90)
35
property real itemWidth: Units.tvPx(210)
37
property int duration: 120
40
anchors.topMargin: Units.tvPx(140)
41
anchors.bottomMargin: Units.tvPx(60)
42
/* Make sure the first and last items are offsetted by margin */
43
anchors.leftMargin: margin
44
anchors.rightMargin: margin
47
orientation: ListView.Horizontal
48
spacing: Units.tvPx(80)
49
highlightMoveSpeed: -1
50
highlightMoveDuration: 230
51
highlightRangeMode: ListView.ApplyRange
52
preferredHighlightBegin: margin + itemWidth
53
preferredHighlightEnd: width - margin - itemWidth
54
snapMode: ListView.SnapToItem
57
delegate: AbstractButton {
60
property string uri: column_0
61
property string iconHint: column_1
62
property string categoryIndex: column_2
63
property string mimetype: column_3
64
property string name: column_4
65
property string comment: column_5
66
property string dndUri: column_6
71
property variant segments: [-flow.itemWidth, 0.0, flow.width-flow.itemWidth, flow.width-flow.itemWidth+flow.itemWidth]
72
property real absoluteX: button.x-flow.contentX
75
angle: Utils.segmentsLinearInterpolation(segments, [63.0, 0.0, 0.0, -63.0], absoluteX)
77
origin: Utils.segmentsLinearInterpolation(segments, [width, width, 0.0, 0.0], absoluteX)
78
//Behavior on angle {SmoothedAnimation {durshadowation: flow.duration; velocity: -1}}
79
transform: Rotation { origin.x: button.origin; origin.y: height/2; axis { x: 0; y: 1; z: 0 } angle: button.angle}
81
scale: Utils.segmentsLinearInterpolation(segments, [0.8, 1.0, 1.0, 0.8], absoluteX)
82
//Behavior on scale {SmoothedAnimation {duration: flow.duration; velocity: -1}}
84
onClicked: dash.activateUriWithLens(lens, categoryId, uri, mimetype)
89
anchors.top: parent.top
90
anchors.topMargin: Units.tvPx(-10)
91
height: Units.tvPx(225)
92
anchors.left: parent.left
93
anchors.right: parent.right
100
//anchors.verticalCenter: parent.bottom
101
anchors.horizontalCenter: parent.horizontalCenter
102
anchors.top: parent.top
103
anchors.topMargin: Units.tvPx(350)
104
width: Units.tvPx(380)
105
height: Units.tvPx(120)
106
source: "artwork/coverflow_shadow.png"
107
fillMode: Image.Center
111
source: "artwork/selection_glow.png"
113
// height: Units.tvPx(350)
114
anchors.margins: Units.tvPx(-45)
115
opacity: button.activeFocus ? 1.0 : 0.0
116
Behavior on opacity {NumberAnimation {duration: 200; easing.type: Easing.OutQuad}}
122
anchors.margins: Units.tvPx(-2)
125
border.width: Units.tvPx(1)
126
border.color: "transparent"
127
radius: Units.tvPx(2)
133
anchors.centerIn: parent
134
anchors.top: parent.top
135
anchors.topMargin: Units.tvPx(120)
136
width: Units.tvPx(250)
137
height: Units.tvPx(400)
138
fillMode: Image.Stretch
140
source:if(status == Image.Error ){
143
source: "image://icons/"+iconHint;
145
//source: status == Image.Error ? iconHint : "image://icons/"+iconHint
146
sourceSize.width: width
147
sourceSize.height: height
150
// scale: status == Image.Ready ? 1.0 : 0.0
151
// Behavior on scale {
156
// easing.type: Easing.OutBounce
163
anchors.fill: image.Center
164
anchors.top: parent.top
165
anchors.topMargin: Units.tvPx(250)
166
opacity: button.state == "hovered" || button.state == "selected-hovered" ? 0.4 : 0.0
167
Behavior on opacity { NumberAnimation { duration: 100 } }
172
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
173
anchors.top: txtrectangle.bottom
174
// anchors.bottom: parent.bottom
175
anchors.right: parent.right
176
anchors.left: parent.left
177
anchors.topMargin: Units.tvPx(80)
180
opacity: Utils.segmentsLinearInterpolation(segments, [0.0, 1.0, 1.0, 0.0], absoluteX)
181
//Behavior on opacity {SmoothedAnimation {duration: flow.duration; velocity: -1}}
183
horizontalAlignment: Text.AlignHCenter
186
styleColor: "#1e1e1e"