Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kde/plasma/look-and-feel/Sweet-Mars/contents/osd/Osd.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ PlasmaCore.Dialog {
// Set to true if the value is meant for progress bar,
// false for displaying the value as normal text
property bool showingProgress: false
// Maximum value of progress bar (overriden for volume amplification)
property int osdMaxValue: 100

mainItem: OsdItem {
rootItem: root
Expand Down
25 changes: 23 additions & 2 deletions kde/plasma/look-and-feel/Sweet-Mars/contents/osd/OsdItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Item {
// | | | |
// | \----------------/ |
// | spacing |
// | percentage |
// | spacing |
// | [progressbar/text] |
// | spacing |
// \--------------------/
Expand All @@ -61,10 +63,30 @@ Item {

visible: rootItem.showingProgress
minimumValue: 0
maximumValue: 100
maximumValue: rootItem.osdMaxValue

value: Number(rootItem.osdValue)

PlasmaExtra.Heading {
anchors {
bottom: progressBar.top
bottomMargin: units.smallSpacing
horizontalCenter: parent.horizontalCenter
}
level: 4
text: Math.round(progressBar.value) + "%"
color: {
if (progressBar.value <= 100) {
return theme.textColor
} else if (progressBar.value <= 125) {
return theme.neutralTextColor
} else {
return theme.negativeTextColor
}
}
}
}

PlasmaExtra.Heading {
id: label
anchors {
Expand All @@ -73,7 +95,6 @@ Item {
right: parent.right
margins: Math.floor(units.smallSpacing / 2)
}

visible: !rootItem.showingProgress
text: rootItem.showingProgress ? "" : (rootItem.osdValue ? rootItem.osdValue : "")
horizontalAlignment: Text.AlignHCenter
Expand Down