summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-07-29 17:54:31 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-07-29 17:56:57 +0800
commite0b139d4afe566f57574fae15668ba297ed7334e (patch)
tree8a503433041eb3cc6b5bb3f98c1f94b217adfa77
parentdb6f779b1a8781b659838e5fcf929f5d3215cb4f (diff)
chore: reorganize component
rm: circularprogress as its unused
-rw-r--r--bar/Resources.qml1
-rw-r--r--bar/components/SimpleResource.qml (renamed from components/SimpleResource.qml)0
-rw-r--r--components/CircularProgress.qml91
3 files changed, 1 insertions, 91 deletions
diff --git a/bar/Resources.qml b/bar/Resources.qml
index c902a92..9d115d9 100644
--- a/bar/Resources.qml
+++ b/bar/Resources.qml
@@ -1,6 +1,7 @@
import QtQuick
import QtQuick.Layouts
+import "components"
import qs.components
import qs.config as Config
import qs.services as Services
diff --git a/components/SimpleResource.qml b/bar/components/SimpleResource.qml
index 818327d..818327d 100644
--- a/components/SimpleResource.qml
+++ b/bar/components/SimpleResource.qml
diff --git a/components/CircularProgress.qml b/components/CircularProgress.qml
deleted file mode 100644
index 240e520..0000000
--- a/components/CircularProgress.qml
+++ /dev/null
@@ -1,91 +0,0 @@
-// From https://github.com/rafzby/circular-progressbar with modifications
-// License: LGPL-3.0 - A copy can be found in `licenses` folder of repo
-
-import QtQuick
-
-/**
- * Material 3 circular progress. See https://m3.material.io/components/progress-indicators/specs
- */
-Item {
- id: root
-
- property int size: 30
- property int lineWidth: 2
- property real value: 0
- // property color primaryColor: Appearance.m3colors.m3onSecondaryContainer
- // property color secondaryColor: Appearance.colors.colSecondaryContainer
- property real gapAngle: Math.PI / 9
- property bool fill: false
- property int fillOverflow: 2
- property int animationDuration: 1000
- property var easingType: Easing.OutCubic
-
- width: size
- height: size
-
- signal animationFinished
-
- onValueChanged: {
- canvas.degree = value * 360;
- }
- // onPrimaryColorChanged: {
- // canvas.requestPaint();
- // }
- // onSecondaryColorChanged: {
- // canvas.requestPaint();
- // }
-
- Canvas {
- id: canvas
-
- property real degree: 0
-
- anchors.fill: parent
- antialiasing: true
-
- onDegreeChanged: {
- requestPaint();
- }
-
- onPaint: {
- var ctx = getContext("2d");
- var x = root.width / 2;
- var y = root.height / 2;
- var radius = root.size / 2 - root.lineWidth;
- var startAngle = (Math.PI / 180) * 270;
- var fullAngle = (Math.PI / 180) * (270 + 360);
- var progressAngle = (Math.PI / 180) * (270 + degree);
- var epsilon = 0.01; // Small angle in radians
-
- ctx.reset();
- if (root.fill) {
- // ctx.fillStyle = root.secondaryColor;
- ctx.beginPath();
- ctx.arc(x, y, radius + fillOverflow, startAngle, fullAngle);
- ctx.fill();
- }
- ctx.lineCap = 'round';
- ctx.lineWidth = root.lineWidth;
-
- // Secondary
- ctx.beginPath();
- ctx.arc(x, y, radius, progressAngle + gapAngle, fullAngle - gapAngle);
- // ctx.strokeStyle = root.secondaryColor;
- ctx.stroke();
-
- // Primary (value indication)
- var endAngle = progressAngle + (value > 0 ? 0 : epsilon);
- ctx.beginPath();
- ctx.arc(x, y, radius, startAngle, endAngle);
- // ctx.strokeStyle = root.primaryColor;
- ctx.stroke();
- }
-
- Behavior on degree {
- NumberAnimation {
- duration: root.animationDuration
- easing.type: root.easingType
- }
- }
- }
-}