Commit a4b6a9da authored by Nate Graham's avatar Nate Graham
Browse files

Show percentage in OSD when a progress bar is visible

The new design makes this visually simple, and in fact I think it
improves the composition to have the progrss bar anchored by dark-colored
elements on both sides.

OSDs without progress bars are unaffected.

BUG: 385602
FIXED-IN: 5.20

Merge Request: !15
parent 161309cd
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtQuick 2.14
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
......@@ -51,6 +51,27 @@ RowLayout {
value: Number(rootItem.osdValue)
}
// Get the width of a three-digit number so we can size the label
// to the maximum width to avoid the progress bad resizing itself
TextMetrics {
id: widestLabelSize
text: i18n("100%")
font: percentageLabel.font
}
// Numerical display of progress bar value
PlasmaExtra.Heading {
id: percentageLabel
Layout.fillHeight: true
Layout.preferredWidth: widestLabelSize.width
Layout.rightMargin: units.smallSpacing
level: 3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: i18nc("Percentage value", "%1%", progressBar.value)
visible: rootItem.showingProgress
}
PlasmaExtra.Heading {
id: label
Layout.fillWidth: true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment