21 import org.kde.plasma.core 0.1 as PlasmaCore
22 import org.kde.qtextracomponents 0.1
38 property alias minimumValue: range.minimumValue
40 property alias maximumValue: range.maximumValue
42 property alias value: range.value
55 property alias indeterminate: indeterminateAnimation.running
61 property int orientation: Qt.Horizontal
65 opacity: enabled ? 1.0 : 0.5
76 positionAtMaximum: backgroundPixmapItem.width
82 property bool _isVertical: orientation == Qt.Vertical
83 property int _tileWidth: width
85 width: _isVertical ? progressBar.height : progressBar.width
86 height: _isVertical ? progressBar.width : progressBar.height
87 rotation: _isVertical ? 90 : 0
88 anchors.centerIn: parent
96 contents._tileWidth = Math.floor(contents.width/(Math.floor(contents.width/(contents.height/1.6))))
99 if (barFrameSvg.hasElement(
"hint-bar-stretch")) {
100 barFrameSvg.resizeFrame(Qt.size(barPixmapItem.width, barPixmapItem.height))
102 barFrameSvg.resizeFrame(Qt.size(contents._tileWidth, contents.height))
104 barPixmapItem.pixmap = barFrameSvg.framePixmap()
106 if (backgroundFrameSvg.hasElement(
"hint-bar-stretch")) {
107 backgroundFrameSvg.resizeFrame(Qt.size(backgroundPixmapItem.width, backgroundPixmapItem.height))
109 backgroundFrameSvg.resizeFrame(Qt.size(contents._tileWidth, contents.height))
111 backgroundPixmapItem.pixmap = backgroundFrameSvg.framePixmap()
114 PlasmaCore.FrameSvg {
116 Component.onCompleted: {
117 barFrameSvg.setImagePath(
"widgets/bar_meter_horizontal")
118 barFrameSvg.setElementPrefix(
"bar-active")
119 resizeTimer.restart()
122 PlasmaCore.FrameSvg {
123 id: backgroundFrameSvg
124 Component.onCompleted: {
125 backgroundFrameSvg.setImagePath(
"widgets/bar_meter_horizontal")
126 backgroundFrameSvg.setElementPrefix(
"bar-inactive")
127 resizeTimer.restart()
131 id: backgroundPixmapItem
133 fillMode: QPixmapItem.TileHorizontally
134 onWidthChanged: resizeTimer.restart()
135 onHeightChanged: resizeTimer.restart()
141 fillMode: QPixmapItem.TileHorizontally
142 width: indeterminate ? contents._tileWidth*2 : range.position
143 height: contents.height
145 visible: indeterminate || value > 0
146 onWidthChanged: resizeTimer.restart()
147 onHeightChanged: resizeTimer.restart()
149 SequentialAnimation {
150 id: indeterminateAnimation
152 loops: Animation.Infinite
161 target: barPixmapItem
167 target: barPixmapItem
170 to: backgroundPixmapItem.width - barPixmapItem.width