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"
23 property alias header: header.title
33 function setItems(items) {
34 while (actionItems.count > 0) {
35 var item = actionItems.get(0).item
41 var sliderCreator = Qt.createComponent("SliderLabel.qml");
43 var topAnchor = header.bottom
44 for (var i = 0; i < items.length; i++) {
46 if (item["parameter-type"] == "slider")
48 var slider = sliderCreator.createObject(flickableColumn);
49 slider.anchors.left = flickableColumn.left
50 slider.anchors.right = flickableColumn.right
51 slider.anchors.topMargin = first ? units.gu(1) : units.gu(2)
52 slider.anchors.top = topAnchor
53 slider.tooltip = tooltip
54 slider.sliderData = item
55 topAnchor = slider.bottom
56 actionItems.append({"item": slider})
57 slider.onValueChanged.connect(valueChanged)
63 function valueChanged()
70 for (var i = 0; i < actionItems.count; ++i) {
71 var item = actionItems.get(i).item
72 values[item.action] = item.value
78 anchors.top: parent.top
79 anchors.bottom: buttons.top
80 anchors.left: parent.left
81 anchors.right: parent.right
84 flickableDirection: Flickable.VerticalFlick
85 interactive: !tooltip.visible
89 anchors.top: parent.top
90 anchors.left: parent.left
91 anchors.right: parent.right
95 anchors.top: parent.top
96 anchors.left: parent.left
97 anchors.right: parent.right
98 anchors.topMargin: units.gu(1)
100 contentHeight: height
102 property var styledItem: header
103 property string title
104 property var config: PageHeadConfiguration { }
110 anchors.bottom: parent.bottom
111 anchors.left: parent.left
112 anchors.right: parent.right
113 anchors.margins: units.gu(1)
114 height: confirmButton.height
118 anchors.left: parent.left
119 anchors.top: parent.top
120 anchors.bottom: parent.bottom
126 onClicked: backPressed()
130 anchors.centerIn: backButton
131 source: "graphics/icon_arrow.png"
136 anchors.right: parent.right
139 text: i18n.tr("Confirm")
141 onClicked: confirmPressed()
147 property variant target: undefined
148 visible: target != undefined
149 y: visible ? root.mapFromItem(target.parent, 0, target.y).y - height : 0
150 x: visible ? target.anchors.leftMargin + target.__internals.thumb.x + target.__internals.thumb.width / 2 - width / 2 : 0
152 width: childrenRect.width
153 height: childrenRect.height
160 radius: units.gu(0.5)
164 text: tooltip.target ? tooltip.target.realFormatValue(tooltip.target.value) : ""
165 horizontalAlignment: Text.AlignHCenter
166 verticalAlignment: Text.AlignVCenter
172 source: "graphics/popup_triangle.png"
174 anchors.top: tooltipRectangle.bottom
175 anchors.horizontalCenter: parent.horizontalCenter