Merge lp:~ken-vandine/ubuntu-system-settings/brightness_slider into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 1158
Merged at revision: 1177
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/brightness_slider
Merge into: lp:ubuntu-system-settings
Diff against target: 176 lines (+38/-105)
3 files modified
plugins/brightness/BrightnessSlider.qml (+0/-103)
plugins/brightness/CMakeLists.txt (+0/-1)
plugins/brightness/PageComponent.qml (+38/-1)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/brightness_slider
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Sebastien Bacher (community) Approve
Review via email: mp+240131@code.launchpad.net

Commit message

Use the SliderMenu component instead of the Slider component, it matches
the design and doesn't flicker while changing the brightness.

Description of the change

Use the SliderMenu component instead of the Slider component, it matches
the design and doesn't flicker while changing the brightness.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1157. By Ken VanDine

Change the icons used in the brightness slider, use display-brightness-{min,max} instead of torch-{off,on}.

1158. By Ken VanDine

Added a bug reference comment for the SliderMenu use.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

thanks

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'plugins/brightness/BrightnessSlider.qml'
--- plugins/brightness/BrightnessSlider.qml 2014-08-11 16:13:17 +0000
+++ plugins/brightness/BrightnessSlider.qml 1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
1/*
2 * This file is part of system-settings
3 *
4 * Copyright (C) 2013-14 Canonical Ltd.
5 *
6 * Contact: Iain Lane <iain.lane@canonical.com>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21import Ubuntu.Components 0.1
22import Ubuntu.Components.ListItems 0.1 as ListItem
23import QtQuick 2.0
24import QMenuModel 0.1
25
26Column {
27 signal pressed
28 readonly property bool pressed: sliderId.pressed
29
30 anchors {
31 left: parent.left
32 right: parent.right
33 }
34
35 QDBusActionGroup {
36 id: indicatorPower
37 busType: 1
38 busName: "com.canonical.indicator.power"
39 objectPath: "/com/canonical/indicator/power"
40
41 property variant brightness: action("brightness").state
42 onBrightnessChanged: {
43 sliderId.enabled = brightness != null
44 sliderId.value = sliderId.enabled ? brightness * 100 : 0.0
45 }
46 }
47
48 Component.onCompleted: indicatorPower.start()
49
50 ListItem.Standard {
51 text: i18n.tr("Display brightness")
52 showDivider: false
53 }
54
55 ListItem.Base {
56
57 Icon {
58 id: iconLeft
59 anchors.verticalCenter: parent.verticalCenter
60 height: sliderId.height - units.gu(1)
61 name: "torch-off"
62 width: height
63
64 MouseArea {
65 anchors.fill: parent
66 onClicked: sliderId.value = 0.0
67 }
68 }
69 Slider {
70 id: sliderId
71 function formatValue(v) {
72 return "%1%".arg(v.toFixed(0))
73 }
74
75 anchors {
76 left: iconLeft.right
77 right: iconRight.left
78 leftMargin: units.gu(1)
79 rightMargin: units.gu(1)
80 verticalCenter: parent.verticalCenter
81 }
82 height: parent.height - units.gu(2)
83 minimumValue: 0.0
84 maximumValue: 100.0
85 live: true
86
87 onValueChanged: indicatorPower.action('brightness').updateState(value / 100.0)
88 }
89 Icon {
90 id: iconRight
91 anchors.right: parent.right
92 anchors.verticalCenter: parent.verticalCenter
93 height: sliderId.height - units.gu(1)
94 name: "torch-on"
95 width: height
96
97 MouseArea {
98 anchors.fill: parent
99 onClicked: sliderId.value = 100.0
100 }
101 }
102 }
103}
1040
=== modified file 'plugins/brightness/CMakeLists.txt'
--- plugins/brightness/CMakeLists.txt 2014-08-11 16:13:17 +0000
+++ plugins/brightness/CMakeLists.txt 2014-10-31 15:08:12 +0000
@@ -1,7 +1,6 @@
1add_subdirectory(plugin)1add_subdirectory(plugin)
22
3set(QML_SOURCES3set(QML_SOURCES
4 BrightnessSlider.qml
5 PageComponent.qml4 PageComponent.qml
6)5)
76
87
=== modified file 'plugins/brightness/PageComponent.qml'
--- plugins/brightness/PageComponent.qml 2014-08-12 13:32:30 +0000
+++ plugins/brightness/PageComponent.qml 2014-10-31 15:08:12 +0000
@@ -24,6 +24,8 @@
24import Ubuntu.Components 0.124import Ubuntu.Components 0.1
25import Ubuntu.Components.ListItems 0.1 as ListItem25import Ubuntu.Components.ListItems 0.1 as ListItem
26import Ubuntu.SystemSettings.Brightness 1.026import Ubuntu.SystemSettings.Brightness 1.0
27import Ubuntu.Settings.Menus 0.1 as Menus
28import QMenuModel 0.1
2729
28ItemPage {30ItemPage {
29 id: root31 id: root
@@ -39,7 +41,42 @@
39 anchors.left: parent.left41 anchors.left: parent.left
40 anchors.right: parent.right42 anchors.right: parent.right
4143
42 BrightnessSlider {}44 QDBusActionGroup {
45 id: indicatorPower
46 busType: 1
47 busName: "com.canonical.indicator.power"
48 objectPath: "/com/canonical/indicator/power"
49
50 property variant brightness: action("brightness")
51
52 Component.onCompleted: start()
53 }
54
55 Binding {
56 target: sliderMenu
57 property: "value"
58 value: sliderMenu.enabled ? indicatorPower.action("brightness").state * 100 : 0.0
59 }
60
61 ListItem.Standard {
62 text: i18n.tr("Display brightness")
63 showDivider: false
64 }
65
66 /* Use the SliderMenu component instead of the Slider to avoid binding
67 issues on valueChanged until LP: #1388094 is fixed.
68 */
69 Menus.SliderMenu {
70 id: sliderMenu
71 objectName: "sliderMenu"
72 enabled: indicatorPower.action("brightness").state != null
73 live: true
74 minimumValue: 0.0
75 maximumValue: 100.0
76 minIcon: "image://theme/display-brightness-min"
77 maxIcon: "image://theme/display-brightness-max"
78 onUpdated: indicatorPower.action("brightness").updateState(value / 100.0)
79 }
4380
44 Binding {81 Binding {
45 target: autoAdjustCheck82 target: autoAdjustCheck

Subscribers

People subscribed via source and target branches