2 * Copyright 2013 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 * Nick Dedekind <nick.dedekind@canonical.com>
22import Ubuntu.Components 0.1 as Components
23import Unity.Indicators 0.1 as Indicators
27 objectName: menuAction.name
28 enabled: menuAction.active
30 property alias minimumValue: slider.minimumValue
31 property alias maximumValue: slider.maximumValue
32 readonly property double value: menu ? menuAction.state : 0.0
34 property QtObject d: QtObject {
35 property bool enableValueConnection: true
39 // TODO: look into adding a component to manage bi-directional bindings.
40 var oldEnable = d.enableValueConnection
41 d.enableValueConnection = false;
43 // Can't rely on binding. Slider value is assigned by user slide.
46 d.enableValueConnection = oldEnable;
51 width: sliderMenu.text ? units.gu(20) : menuItem.width - (2 * menuItem.__contentsMargins)
57 anchors.left: row.left
58 anchors.verticalCenter: row.verticalCenter
61 source: menu.ext.minIcon
67 left: leftImage.visible ? leftImage.right : row.left
68 right: rightImage.visible ? rightImage.left : row.right
69 leftMargin: leftImage.visible ? units.gu(0.5) : 0
70 rightMargin: rightImage.visible ? units.gu(0.5) : 0
74 Component.onCompleted: {
75 value = menuItem.value
78 // FIXME: The interval should be [0.0 - 1.0]. Unfortunately, when
79 // reaching the boundaries (0.0 or 1.0), the value is converted
80 // to an integer when automatically wrapped in a variant when
81 // passed to QStateAction::updateState(…). The server chokes on
82 // those values, complaining that they’re not of the right type…
83 minimumValue: menu.ext.minValue ? menu.ext.minValue * 1.000001 : 0.0000001
85 var maximum = menu.ext.maxValue ? menu.ext.maxValue * 1.000001 : 0.9999999
86 if (maximum <= minimumValue) {
87 return minimumValue + 1;
92 // FIXME - to be deprecated in Ubuntu.Components.
93 // Use this to disable the label, since there is not way to do it on the component.
94 function formatValue(v) {
99 target: d.enableValueConnection ? slider : null
101 menuItem.changeState(slider.value);
108 anchors.right: row.right
109 anchors.verticalCenter: row.verticalCenter
112 source: menu.ext.maxIcon
116 Indicators.MenuAction {
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list