Merge lp:~lukas-kde/unity8/brightnessControl into lp:unity8

Proposed by Lukáš Tinkl
Status: Merged
Approved by: Michael Zanetti
Approved revision: 2613
Merged at revision: 2717
Proposed branch: lp:~lukas-kde/unity8/brightnessControl
Merge into: lp:unity8
Diff against target: 92 lines (+57/-5)
3 files modified
plugins/Unity/Indicators/indicatorsmanager.cpp (+1/-4)
qml/Components/BrightnessControl.qml (+54/-0)
qml/Shell.qml (+2/-1)
To merge this branch: bzr merge lp:~lukas-kde/unity8/brightnessControl
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+308695@code.launchpad.net

Commit message

Enable brightness (laptop backlight) handling on desktop/laptop PCs

Description of the change

Enable brightness (laptop backlight) handling on desktop/laptop PCs

This merely puts the indicator-power back to phone mode (to display the brightness slider) and introduces 2 global keyboard shortcuts to handle it.

Best way to test is to install silo https://bileto.ubuntu.com/#/ticket/2221 and then:

$ sudo systemctl start repowerd.service

* Are there any related MPs required for this MP to build/function as expected? Please list.

Yes, needs repowerd from https://code.launchpad.net/~afrantzis/repowerd/+git/repowerd/+merge/311015

 * Did you perform an exploratory manual test run of your code change and any related functionality?

Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

N/A

 * If you changed the UI, has there been a design review?

N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2613
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2528/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3334
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1907
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1907
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1907
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3362
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3214/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3214
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3214/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2528/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

tested, works.

code looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/Unity/Indicators/indicatorsmanager.cpp'
--- plugins/Unity/Indicators/indicatorsmanager.cpp 2016-08-03 15:52:42 +0000
+++ plugins/Unity/Indicators/indicatorsmanager.cpp 2016-11-22 09:39:38 +0000
@@ -282,13 +282,10 @@
282 // convergence:282 // convergence:
283 // 1) enable session indicator283 // 1) enable session indicator
284 // 2) enable keyboard indicator284 // 2) enable keyboard indicator
285 // 3) on a PC, switch the battery/power indicator to desktop mode,
286 // can't control brightness for now and phone-on-desktop broken (FIXME)
287 //285 //
288 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)286 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
289 if ((new_indicator->identifier() == QStringLiteral("indicator-session"))287 if ((new_indicator->identifier() == QStringLiteral("indicator-session"))
290 || new_indicator->identifier() == QStringLiteral("indicator-keyboard")288 || new_indicator->identifier() == QStringLiteral("indicator-keyboard")) {
291 || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
292 new_indicator->setProfile(QString(m_profile).replace(QStringLiteral("phone"), QStringLiteral("desktop")));289 new_indicator->setProfile(QString(m_profile).replace(QStringLiteral("phone"), QStringLiteral("desktop")));
293 } else {290 } else {
294 new_indicator->setProfile(m_profile);291 new_indicator->setProfile(m_profile);
295292
=== added file 'qml/Components/BrightnessControl.qml'
--- qml/Components/BrightnessControl.qml 1970-01-01 00:00:00 +0000
+++ qml/Components/BrightnessControl.qml 2016-11-22 09:39:38 +0000
@@ -0,0 +1,54 @@
1/*
2 * Copyright (C) 2016 Canonical, Ltd.
3 *
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.
7 *
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.
12 *
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/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19import QMenuModel 0.1
20import GlobalShortcut 1.0
21
22QtObject {
23 objectName: "brightnessControl"
24
25 property GlobalShortcut brightnessUp: GlobalShortcut {
26 shortcut: Qt.Key_MonBrightnessUp
27 onTriggered: stepUp();
28 }
29
30 property GlobalShortcut brightnessDown: GlobalShortcut {
31 shortcut: Qt.Key_MonBrightnessDown
32 onTriggered: stepDown();
33 }
34
35 function stepUp() {
36 actionGroup.brightness.updateState(MathUtils.clamp(actionGroup.brightness.state + 0.1, 0.01, 1.0));
37 }
38
39 function stepDown() {
40 actionGroup.brightness.updateState(MathUtils.clamp(actionGroup.brightness.state - 0.1, 0.01, 1.0));
41 }
42
43 property QDBusActionGroup actionGroup: QDBusActionGroup {
44 busType: DBus.SessionBus
45 busName: "com.canonical.indicator.power"
46 objectPath: "/com/canonical/indicator/power"
47
48 property variant brightness: action("brightness")
49
50 Component.onCompleted: {
51 actionGroup.start();
52 }
53 }
54}
055
=== modified file 'qml/Shell.qml'
--- qml/Shell.qml 2016-11-09 15:07:26 +0000
+++ qml/Shell.qml 2016-11-22 09:39:38 +0000
@@ -786,8 +786,9 @@
786 Behavior on opacity { UbuntuNumberAnimation {} }786 Behavior on opacity { UbuntuNumberAnimation {} }
787 }787 }
788788
789 // non-visual object789 // non-visual objects
790 KeymapSwitcher {}790 KeymapSwitcher {}
791 BrightnessControl {}
791792
792 Rectangle {793 Rectangle {
793 id: shutdownFadeOutRectangle794 id: shutdownFadeOutRectangle

Subscribers

People subscribed via source and target branches