mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2026-06-10 00:09:12 -04:00
feat: Improve BusyIndicator
This commit is contained in:
@@ -356,10 +356,9 @@ Rectangle {
|
|||||||
smooth: true
|
smooth: true
|
||||||
mipmap: true
|
mipmap: true
|
||||||
|
|
||||||
BusyIndicator {
|
QoABusyIndicator {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
running: imageDisplay.status === Image.Loading
|
running: imageDisplay.status === Image.Loading
|
||||||
visible: running
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ Rectangle {
|
|||||||
visible: root.isCompressing
|
visible: root.isCompressing
|
||||||
spacing: 6
|
spacing: 6
|
||||||
|
|
||||||
BusyIndicator {
|
QoABusyIndicator {
|
||||||
id: compressBusyIndicator
|
id: compressBusyIndicator
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
@@ -168,7 +168,7 @@ Rectangle {
|
|||||||
width: 15
|
width: 15
|
||||||
}
|
}
|
||||||
|
|
||||||
BusyIndicator {
|
QoABusyIndicator {
|
||||||
id: sendBusyIndicator
|
id: sendBusyIndicator
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@@ -177,7 +177,6 @@ Rectangle {
|
|||||||
width: 14
|
width: 14
|
||||||
height: 14
|
height: 14
|
||||||
running: root.isProcessing
|
running: root.isProcessing
|
||||||
visible: root.isProcessing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QoAToolTip {
|
QoAToolTip {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ qt_add_qml_module(QodeAssistUIControls
|
|||||||
QML_FILES
|
QML_FILES
|
||||||
qml/Badge.qml
|
qml/Badge.qml
|
||||||
qml/QoAButton.qml
|
qml/QoAButton.qml
|
||||||
|
qml/QoABusyIndicator.qml
|
||||||
qml/QoABusyOverlay.qml
|
qml/QoABusyOverlay.qml
|
||||||
qml/QoATextSlider.qml
|
qml/QoATextSlider.qml
|
||||||
qml/QoAComboBox.qml
|
qml/QoAComboBox.qml
|
||||||
|
|||||||
76
UIControls/qml/QoABusyIndicator.qml
Normal file
76
UIControls/qml/QoABusyIndicator.qml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
// Copyright (C) 2024-2026 Petr Mironychev
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
// Additional attribution terms under GPLv3 §7(b) apply — see LICENSE
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
property bool running: true
|
||||||
|
property color color: palette.highlightedText
|
||||||
|
property real lineWidth: Math.max(1.5, Math.min(width, height) * 0.13)
|
||||||
|
|
||||||
|
implicitWidth: 24
|
||||||
|
implicitHeight: 24
|
||||||
|
|
||||||
|
visible: opacity > 0
|
||||||
|
opacity: running ? 1.0 : 0.0
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation { duration: 150 }
|
||||||
|
}
|
||||||
|
|
||||||
|
Canvas {
|
||||||
|
id: canvas
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
antialiasing: true
|
||||||
|
|
||||||
|
onPaint: {
|
||||||
|
const ctx = getContext("2d")
|
||||||
|
ctx.reset()
|
||||||
|
|
||||||
|
const cx = width / 2
|
||||||
|
const cy = height / 2
|
||||||
|
const lw = root.lineWidth
|
||||||
|
const radius = Math.min(width, height) / 2 - lw / 2 - 1
|
||||||
|
if (radius <= 0)
|
||||||
|
return
|
||||||
|
|
||||||
|
const segments = 90
|
||||||
|
const sweep = Math.PI * 1.5
|
||||||
|
|
||||||
|
ctx.lineCap = "butt"
|
||||||
|
ctx.lineWidth = lw
|
||||||
|
for (let i = 0; i < segments; ++i) {
|
||||||
|
const a0 = (i / segments) * sweep
|
||||||
|
const a1 = ((i + 1) / segments) * sweep + 0.012
|
||||||
|
const t = i / (segments - 1)
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.strokeStyle = Qt.rgba(root.color.r, root.color.g, root.color.b, 0.08 + 0.92 * t)
|
||||||
|
ctx.arc(cx, cy, radius, a0, a1, false)
|
||||||
|
ctx.stroke()
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.lineCap = "round"
|
||||||
|
ctx.strokeStyle = root.color
|
||||||
|
ctx.beginPath()
|
||||||
|
ctx.arc(cx, cy, radius, sweep - 0.001, sweep, false)
|
||||||
|
ctx.stroke()
|
||||||
|
}
|
||||||
|
|
||||||
|
RotationAnimator {
|
||||||
|
target: canvas
|
||||||
|
from: 0
|
||||||
|
to: 360
|
||||||
|
duration: 850
|
||||||
|
loops: Animation.Infinite
|
||||||
|
running: root.visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onColorChanged: canvas.requestPaint()
|
||||||
|
onLineWidthChanged: canvas.requestPaint()
|
||||||
|
onWidthChanged: canvas.requestPaint()
|
||||||
|
onHeightChanged: canvas.requestPaint()
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
// Additional attribution terms under GPLv3 §7(b) apply — see LICENSE
|
// Additional attribution terms under GPLv3 §7(b) apply — see LICENSE
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
@@ -26,11 +25,11 @@ Rectangle {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 10
|
spacing: 10
|
||||||
|
|
||||||
BusyIndicator {
|
QoABusyIndicator {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
running: root.active
|
running: root.active
|
||||||
implicitWidth: 36
|
width: 36
|
||||||
implicitHeight: 36
|
height: 36
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|||||||
Reference in New Issue
Block a user