Use new HCircleProgressBar for HBusyIndicator

This commit is contained in:
miruka 2019-11-06 14:29:32 -04:00
parent f9fd8055f2
commit 8eca875499
7 changed files with 24 additions and 37 deletions

View File

@ -1,6 +0,0 @@
<svg height="18pt" viewBox="0 0 18 18" width="18pt" xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="#000">
<path d="m9 .07593943c-4.9283125 0-8.92406057 3.99574807-8.92406057 8.92406057 0 4.928312 3.99574807 8.924061 8.92406057 8.924061 4.928312 0 8.924061-3.995749 8.924061-8.924061 0-4.9283125-3.995749-8.92406057-8.924061-8.92406057z" stroke-opacity=".117647" stroke-width=".158007"/>
<path d="m12 .1015625c-6.5710833 0-11.8984375 5.3273542-11.8984375 11.8984375 0 6.571083 5.3273542 11.898437 11.8984375 11.898438" stroke-linecap="square" stroke-opacity=".866973" stroke-width=".15" transform="scale(.75)"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 659 B

View File

@ -2,26 +2,7 @@ import QtQuick 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Shapes 1.12 import QtQuick.Shapes 1.12
BusyIndicator { HCircleProgressBar {
id: indicator indeterminate: true
implicitWidth: theme ? theme.controls.loader.defaultDimension : 96 dialWidth: 2
implicitHeight: implicitWidth
contentItem: HIcon {
svgName: "loader"
dimension: indicator.width
property var pr: dimension
colorize: theme ? theme.controls.loader.colorize : "white"
mipmap: true
RotationAnimation on rotation {
id: rotationAnimation
from: 0
to: 360
running: true
loops: Animation.Infinite
duration: theme ? (theme.animationDuration * 6) : 600
easing.type: Easing.Linear
}
}
} }

View File

@ -15,19 +15,22 @@ RadialBar {
showText: true showText: true
suffixText: qsTr("%") suffixText: qsTr("%")
textFont.pixelSize: theme.fontSize.big textFont.pixelSize: theme ? theme.fontSize.big : 22
textColor: theme.controls.circleProgressBar.text textColor: theme ? theme.controls.circleProgressBar.text : "white"
property alias from: bar.minValue property alias from: bar.minValue
property alias to: bar.maxValue property alias to: bar.maxValue
property bool indeterminate: false property bool indeterminate: false
property real indeterminateSpan:
theme.controls.circleProgressBar.indeterminateSpan
Binding { Binding {
target: bar; target: bar;
property: "value"; property: "value";
value: bar.to * theme.controls.circleProgressBar.indeterminateSpan value: bar.to * bar.indeterminateSpan
when: bar.indeterminate when: bar.indeterminate
} }
@ -38,6 +41,13 @@ RadialBar {
when: bar.indeterminate when: bar.indeterminate
} }
Binding {
target: bar
property: "suffixText"
value: ""
when: bar.indeterminate
}
RotationAnimator on rotation { RotationAnimator on rotation {
running: bar.indeterminate running: bar.indeterminate
from: 0 from: 0

View File

@ -46,6 +46,8 @@ HPage {
HLoader { HLoader {
source: ready ? "ChatSplitView.qml" : "../Base/HBusyIndicator.qml" source: ready ? "ChatSplitView.qml" : "../Base/HBusyIndicator.qml"
Layout.preferredWidth: ready ? -1 : 96
Layout.preferredHeight: Layout.preferredWidth
Layout.fillWidth: ready Layout.fillWidth: ready
Layout.fillHeight: ready Layout.fillHeight: ready
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter

View File

@ -18,5 +18,9 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
width: Math.min(160, parent.width - 16, parent.height - 16) width: Math.min(160, parent.width - 16, parent.height - 16)
height: width height: width
indeterminateSpan: 0.5
foregroundColor: Qt.hsla(0, 0, 1, 0.15)
progressColor: Qt.hsla(0, 0, 1, 0.4)
} }
} }

View File

@ -50,7 +50,7 @@ HPage {
HLoader { HLoader {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width width: ready ? parent.width : 96
source: ready ? source: ready ?
modelData : modelData :
(modelData == "Profile.qml" ? (modelData == "Profile.qml" ?

View File

@ -98,10 +98,6 @@ icons:
// Generic UI controls // Generic UI controls
controls: controls:
loader:
int defaultDimension: 80
color colorize: "white"
box: box:
color background: colors.strongBackground color background: colors.strongBackground
int radius: theme.radius int radius: theme.radius
@ -181,7 +177,7 @@ controls:
color background: colors.inputBackground color background: colors.inputBackground
color foreground: colors.accentBackground color foreground: colors.accentBackground
color text: colors.text color text: colors.text
real indeterminateSpan: 0.2 // 0-1 real indeterminateSpan: 0.5 // 0-1
slider: slider:
int radius: 2 int radius: 2