Changeset View
Changeset View
Standalone View
Standalone View
applets/batterymonitor/package/contents/ui/BrightnessItem.qml
Show All 17 Lines | |||||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.0 | 21 | import QtQuick 2.0 | ||
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
23 | 23 | | |||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | import org.kde.plasma.components 2.0 as Components | 25 | import org.kde.plasma.components 2.0 as Components | ||
26 | import org.kde.plasma.components 3.0 as Components3 | ||||
26 | 27 | | |||
27 | RowLayout { | 28 | RowLayout { | ||
29 | id: item | ||||
28 | property alias icon: brightnessIcon.source | 30 | property alias icon: brightnessIcon.source | ||
29 | property alias label: brightnessLabel.text | 31 | property alias label: brightnessLabel.text | ||
30 | property alias value: brightnessSlider.value | 32 | property alias value: brightnessSlider.value | ||
31 | property alias maximumValue: brightnessSlider.maximumValue | 33 | property alias maximumValue: brightnessSlider.to | ||
34 | property alias stepSize: brightnessSlider.stepSize | ||||
35 | signal moved() | ||||
32 | 36 | | |||
33 | spacing: units.gridUnit | 37 | spacing: units.gridUnit | ||
34 | 38 | | |||
35 | PlasmaCore.IconItem { | 39 | PlasmaCore.IconItem { | ||
36 | id: brightnessIcon | 40 | id: brightnessIcon | ||
37 | Layout.alignment: Qt.AlignTop | 41 | Layout.alignment: Qt.AlignTop | ||
38 | Layout.preferredWidth: units.iconSizes.medium | 42 | Layout.preferredWidth: units.iconSizes.medium | ||
39 | Layout.preferredHeight: width | 43 | Layout.preferredHeight: width | ||
40 | } | 44 | } | ||
41 | 45 | | |||
42 | Column { | 46 | Column { | ||
43 | id: brightnessColumn | 47 | id: brightnessColumn | ||
44 | Layout.fillWidth: true | 48 | Layout.fillWidth: true | ||
45 | Layout.alignment: Qt.AlignTop | 49 | Layout.alignment: Qt.AlignTop | ||
46 | spacing: 0 | 50 | spacing: 0 | ||
47 | 51 | | |||
48 | Components.Label { | 52 | Components.Label { | ||
49 | id: brightnessLabel | 53 | id: brightnessLabel | ||
50 | width: parent.width | 54 | width: parent.width | ||
51 | height: paintedHeight | 55 | height: paintedHeight | ||
52 | } | 56 | } | ||
53 | 57 | | |||
54 | Components.Slider { | 58 | Components3.Slider { | ||
55 | id: brightnessSlider | 59 | id: brightnessSlider | ||
56 | width: parent.width | 60 | width: parent.width | ||
57 | // Don't allow the slider to turn off the screen | 61 | // Don't allow the slider to turn off the screen | ||
58 | // Please see https://git.reviewboard.kde.org/r/122505/ for more information | 62 | // Please see https://git.reviewboard.kde.org/r/122505/ for more information | ||
59 | minimumValue: maximumValue > 100 ? 1 : 0 | 63 | from: to > 100 ? 1 : 0 | ||
60 | stepSize: 1 | 64 | stepSize: 1 | ||
65 | onMoved: item.moved() | ||||
61 | } | 66 | } | ||
62 | } | 67 | } | ||
63 | } | 68 | } |