2
* Copyright (C) 2012, 2013 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 as published by
6
* the Free Software Foundation; version 3.
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/>.
18
import Ubuntu.Components 1.1
19
import Ubuntu.Components.Themes.Ambiance 1.1
20
import "../Components"
21
import "../Components/Flickables" as Flickables
24
property alias header: header.title
34
function setItems(items) {
35
while (actionItems.count > 0) {
36
var item = actionItems.get(0).item
42
var sliderCreator = Qt.createComponent("SliderLabel.qml");
44
var topAnchor = header.bottom
45
for (var i = 0; i < items.length; i++) {
47
if (item["parameter-type"] == "slider")
49
var slider = sliderCreator.createObject(flickableColumn);
50
slider.anchors.left = flickableColumn.left
51
slider.anchors.right = flickableColumn.right
52
slider.anchors.topMargin = first ? units.gu(1) : units.gu(2)
53
slider.anchors.top = topAnchor
54
slider.tooltip = tooltip
55
slider.sliderData = item
56
topAnchor = slider.bottom
57
actionItems.append({"item": slider})
58
slider.onValueChanged.connect(valueChanged)
64
function valueChanged()
71
for (var i = 0; i < actionItems.count; ++i) {
72
var item = actionItems.get(i).item
73
values[item.action] = item.value
78
Flickables.Flickable {
79
anchors.top: parent.top
80
anchors.bottom: buttons.top
81
anchors.left: parent.left
82
anchors.right: parent.right
85
flickableDirection: Flickable.VerticalFlick
86
interactive: !tooltip.visible
90
anchors.top: parent.top
91
anchors.left: parent.left
92
anchors.right: parent.right
96
anchors.top: parent.top
97
anchors.left: parent.left
98
anchors.right: parent.right
99
anchors.topMargin: units.gu(1)
100
height: units.gu(6.5)
101
contentHeight: height
103
property var styledItem: header
104
property string title
105
property var config: PageHeadConfiguration { }
111
anchors.bottom: parent.bottom
112
anchors.left: parent.left
113
anchors.right: parent.right
114
anchors.margins: units.gu(1)
115
height: confirmButton.height
119
anchors.left: parent.left
120
anchors.top: parent.top
121
anchors.bottom: parent.bottom
127
onClicked: backPressed()
131
anchors.centerIn: backButton
132
source: "graphics/icon_arrow.png"
137
anchors.right: parent.right
140
text: i18n.tr("Confirm")
142
onClicked: confirmPressed()
148
property variant target: undefined
149
visible: target != undefined
150
y: visible ? root.mapFromItem(target.parent, 0, target.y).y - height : 0
151
x: visible ? target.anchors.leftMargin + target.__internals.thumb.x + target.__internals.thumb.width / 2 - width / 2 : 0
153
width: childrenRect.width
154
height: childrenRect.height
161
radius: units.gu(0.5)
165
text: tooltip.target ? tooltip.target.realFormatValue(tooltip.target.value) : ""
166
horizontalAlignment: Text.AlignHCenter
167
verticalAlignment: Text.AlignVCenter
173
source: "graphics/popup_triangle.png"
175
anchors.top: tooltipRectangle.bottom
176
anchors.horizontalCenter: parent.horizontalCenter