mirror of
https://github.com/logos-storage/logos-storage-app-skeleton.git
synced 2026-06-16 05:19:27 +00:00
Add qml files
This commit is contained in:
parent
d5d7bf7af3
commit
4db25d4c24
56
src/qml/ArcGauge.qml
Normal file
56
src/qml/ArcGauge.qml
Normal 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
12
src/qml/DownloadIcon.qml
Normal 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
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user