Add qml files

This commit is contained in:
Arnaud 2026-02-21 07:27:12 +04:00
parent d5d7bf7af3
commit 4db25d4c24
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F
2 changed files with 68 additions and 0 deletions

56
src/qml/ArcGauge.qml Normal file
View File

@ -0,0 +1,56 @@
import QtQuick
import Logos.Theme
// Reusable arc gauge same visual style as the Nothing OS ring widgets.
//
// Usage:
// ArcGauge {
// anchors.fill: parent
// fraction: 0.65
// fillColor: Theme.palette.success
// }
Canvas {
id: root
// 0.0 1.0 (clamped internally)
property real fraction: 0.0
property color trackColor: Theme.palette.textMuted
property color fillColor: Theme.palette.text
property real arcRadius: 46
property real arcWidth: 8
onFractionChanged: requestPaint()
onTrackColorChanged: requestPaint()
onFillColorChanged: requestPaint()
Component.onCompleted: requestPaint()
onPaint: {
var ctx = getContext("2d")
ctx.reset()
var cx = width / 2
var cy = height / 2
var startRad = 130 * Math.PI / 180
var totalRad = 280 * Math.PI / 180
// Track (full arc, muted)
ctx.beginPath()
ctx.arc(cx, cy, root.arcRadius, startRad, startRad + totalRad)
ctx.strokeStyle = root.trackColor.toString()
ctx.lineWidth = root.arcWidth
ctx.lineCap = "round"
ctx.stroke()
// Fill (proportional)
var f = Math.min(Math.max(root.fraction, 0.0), 1.0)
if (f > 0) {
ctx.beginPath()
ctx.arc(cx, cy, root.arcRadius, startRad, startRad + totalRad * f)
ctx.strokeStyle = root.fillColor.toString()
ctx.lineWidth = root.arcWidth
ctx.lineCap = "round"
ctx.stroke()
}
}
}

12
src/qml/DownloadIcon.qml Normal file
View File

@ -0,0 +1,12 @@
import QtQuick
// Downward arrow download (mirrored UploadIcon)
DotIcon {
pattern: [
0, 0, 1, 0, 0,
0, 0, 1, 0, 0,
1, 1, 1, 1, 1,
0, 1, 1, 1, 0,
0, 0, 1, 0, 0
]
}