Changeset View
Changeset View
Standalone View
Standalone View
src/kcm/package/contents/ui/VolumeSlider.qml
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 30 | Slider { | |||
---|---|---|---|---|---|
80 | Label { | 80 | Label { | ||
81 | id: hundredPercentLabel | 81 | id: hundredPercentLabel | ||
82 | readonly property real hundredPos: (slider.width / slider.maximumValue) * PulseAudio.NormalVolume | 82 | readonly property real hundredPos: (slider.width / slider.maximumValue) * PulseAudio.NormalVolume | ||
83 | z: slider.z - 1 | 83 | z: slider.z - 1 | ||
84 | x: (Qt.application.layoutDirection == Qt.RightToLeft ? slider.width - hundredPos : hundredPos) - width / 2 | 84 | x: (Qt.application.layoutDirection == Qt.RightToLeft ? slider.width - hundredPos : hundredPos) - width / 2 | ||
85 | y: slider.height / 1.2 | 85 | y: slider.height / 1.2 | ||
86 | opacity: 0.5 | 86 | opacity: 0.5 | ||
87 | font.pixelSize: slider.height / 2.2 | 87 | font.pixelSize: slider.height / 2.2 | ||
88 | text: i18n("100%") | 88 | text: i18nd("kcm_pulseaudio", "100%") | ||
89 | } | 89 | } | ||
90 | 90 | | |||
91 | Timer { | 91 | Timer { | ||
92 | id: updateTimer | 92 | id: updateTimer | ||
93 | interval: 200 | 93 | interval: 200 | ||
94 | onTriggered: slider.value = Volume | 94 | onTriggered: slider.value = Volume | ||
95 | } | 95 | } | ||
96 | } | 96 | } | ||
97 | 97 | | |||
98 | Label { | 98 | Label { | ||
99 | id: percentText | 99 | id: percentText | ||
100 | readonly property real value: PulseObject.volume > slider.maximumValue ? PulseObject.volume : slider.value | 100 | readonly property real value: PulseObject.volume > slider.maximumValue ? PulseObject.volume : slider.value | ||
101 | Layout.alignment: Qt.AlignHCenter | 101 | Layout.alignment: Qt.AlignHCenter | ||
102 | Layout.minimumWidth: percentMetrics.advanceWidth | 102 | Layout.minimumWidth: percentMetrics.advanceWidth | ||
103 | horizontalAlignment: Qt.AlignRight | 103 | horizontalAlignment: Qt.AlignRight | ||
104 | text: i18nc("volume percentage", "%1%", Math.round(value / PulseAudio.NormalVolume * 100.0)) | 104 | text: i18ndc("kcm_pulseaudio", "volume percentage", "%1%", Math.round(value / PulseAudio.NormalVolume * 100.0)) | ||
105 | } | 105 | } | ||
106 | 106 | | |||
107 | TextMetrics { | 107 | TextMetrics { | ||
108 | id: percentMetrics | 108 | id: percentMetrics | ||
109 | font: percentText.font | 109 | font: percentText.font | ||
110 | text: i18nc("only used for sizing, should be widest possible string", "100%") | 110 | text: i18ndc("kcm_pulseaudio", "only used for sizing, should be widest possible string", "100%") | ||
111 | } | 111 | } | ||
112 | } | 112 | } |