-
Notifications
You must be signed in to change notification settings - Fork 0
/
OsdItem.qml
67 lines (53 loc) · 1.74 KB
/
OsdItem.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* This QML file replaces the look of the default
* KDE/KWin On-Screen-Display (OSD) for Volume or
* Brightness adjustments.
* Instead of a big square, this displays as a
* sleek bar showing only icon (volume or
* brightness) and the actual value as a bar.
*
* This adjustment was written by Zren
* Source: https://reddit.com/r/kde/comments/5zyd1a/i_hate_the_new_volume_osd/df24wg0/
*
* This file should replace the file in
* /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/osd/OsdItem.qml
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtra
import QtQuick.Window 2.2
Row {
property QtObject rootItem
property int iconWidth: units.iconSizes.medium
property int progressBarWidth: Screen.desktopAvailableWidth / 5
height: iconWidth
width: iconWidth + progressBarWidth
PlasmaCore.IconItem {
id: icon
height: parent.height
width: iconWidth
source: rootItem.icon
}
PlasmaComponents.ProgressBar {
id: progressBar
width: progressBarWidth
height: parent.height
visible: rootItem.showingProgress
minimumValue: 0
maximumValue: 100
value: Number(rootItem.osdValue)
}
PlasmaExtra.Heading {
id: label
width: progressBarWidth
height: parent.height
visible: !rootItem.showingProgress
text: rootItem.showingProgress ? "" : (rootItem.osdValue ? rootItem.osdValue : "")
horizontalAlignment: Text.AlignHCenter
maximumLineCount: 1
elide: Text.ElideLeft
minimumPointSize: theme.defaultFont.pointSize
fontSizeMode: Text.Fit
}
}