Rework the LoadingScreen and HBusyIndicator

This commit is contained in:
miruka 2019-08-27 19:47:58 -04:00
parent 410a42bc59
commit 0a0e11e1f4
6 changed files with 119 additions and 31 deletions

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created using Krita: http://krita.org -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="18pt"
height="18pt"
viewBox="0 0 18 18"
version="1.1"
id="svg1304"
sodipodi:docname="loader.svg"
inkscape:version="">
<metadata
id="metadata1308">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="640"
inkscape:window-height="480"
id="namedview1306"
showgrid="false"
inkscape:snap-object-midpoints="true"
inkscape:snap-center="true"
inkscape:snap-text-baseline="true"
inkscape:snap-page="true"
showguides="true"
inkscape:guide-bbox="true"
inkscape:zoom="22.627417"
inkscape:cx="4.9912351"
inkscape:cy="12.313093"
inkscape:current-layer="svg1304">
<sodipodi:guide
position="16.125,8.9765625"
orientation="0,1"
id="guide1316"
inkscape:locked="false" />
<sodipodi:guide
position="9,16.382812"
orientation="1,0"
id="guide1318"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs1301" />
<path
id="shape0"
d="M 9,0.07593943 C 4.0716875,0.07593943 0.07593943,4.0716875 0.07593943,9 c 0,4.928312 3.99574807,8.924061 8.92406057,8.924061 4.928312,0 8.924061,-3.995749 8.924061,-8.924061 C 17.924061,4.0716875 13.928312,0.07593943 9,0.07593943 Z"
inkscape:connector-curvature="0"
style="fill:none;stroke:#000000;stroke-width:0.15800691;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.11764706"
sodipodi:nodetypes="sssss" />
<path
style="fill:none;stroke:#000000;stroke-width:0.15;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.8669725"
d="M 12,0.1015625 C 5.4289167,0.1015625 0.1015625,5.4289167 0.1015625,12 0.1015625,18.571083 5.4289167,23.898437 12,23.898438"
transform="scale(0.75)"
id="path1310"
inkscape:connector-curvature="0"
sodipodi:nodetypes="csc" />
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1,36 +1,27 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Shapes 1.12
BusyIndicator { BusyIndicator {
id: indicator id: indicator
implicitWidth: Math.min(192, Math.max(64, parent.width / 5)) implicitWidth: theme ? theme.controls.loader.defaultDimension : 96
implicitHeight: 10 implicitHeight: implicitWidth
contentItem: Item { contentItem: HIcon {
Rectangle { svgName: "loader"
id: circle dimension: indicator.width
width: height property var pr: dimension
height: indicator.height colorize: theme ? theme.controls.loader.colorize : "white"
radius: height / 2 mipmap: true
ColorAnimation on color { RotationAnimation on rotation {
// Can't swap direct colors values id: rotationAnimation
property string c1: "white"
property string c2: theme ? theme.colors.accentText : "cyan"
id: colorAnimation
from: c1
to: c2
duration: 1000
onStopped: {[c1, c2] = [c2, c1]; start()}
}
XAnimator on x {
from: 0 from: 0
to: indicator.width - circle.width to: 360
duration: colorAnimation.duration / 2 running: true
onStopped: {[from, to] = [to, from]; start()} loops: Animation.Infinite
} duration: theme ? (theme.animationDuration * 6) : 600
easing.type: Easing.Linear
} }
} }
} }

View File

@ -8,7 +8,9 @@ HImage {
source: source:
svgName ? svgName ?
("../../icons/" + theme.preferredIconPack + "/" + svgName + ".svg") : ("../../icons/" +
(theme ? theme.preferredIconPack : "light-thin") +
"/" + svgName + ".svg") :
"" ""
sourceSize.width: svgName ? dimension : 0 sourceSize.width: svgName ? dimension : 0

View File

@ -1,12 +1,22 @@
import QtQuick 2.12 import QtQuick 2.12
import "Base" import "Base"
import "utils.js" as Utils
HRectangle { Item {
color: theme ? theme.controls.box.background : "#0f1222" Rectangle {
Behavior on color { HNumberAnimation {} } anchors.fill: parent
scale: Math.max(
1.6, Math.ceil(parent.parent.width / parent.parent.height)
)
rotation: 45 * 3
gradient: Gradient {
GradientStop { position: 0.0; color: Qt.hsla(0.73, 0.25, 0.25, 1) }
GradientStop { position: 1.0; color: Qt.hsla(0.52, 1, 0.08, 1) }
}
}
HBusyIndicator { HBusyIndicator {
anchors.centerIn: parent anchors.centerIn: parent
width: Math.min(160, parent.width - 16, parent.height - 16)
height: width
} }
} }

View File

@ -49,6 +49,7 @@ HPage {
Layout.preferredHeight: childrenRect.height Layout.preferredHeight: childrenRect.height
HLoader { HLoader {
anchors.centerIn: parent
width: parent.width width: parent.width
source: ready ? source: ready ?
modelData : modelData :

View File

@ -79,6 +79,10 @@ colors:
// 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