89 lines
1.9 KiB
QML
89 lines
1.9 KiB
QML
// --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
|
|
import Quickshell
|
|
|
|
ShellWindow {
|
|
id: root
|
|
width: 600
|
|
height: 380
|
|
visible: true
|
|
|
|
property int currentStep: 0
|
|
property int totalSteps: 4
|
|
property string status: "idle"
|
|
|
|
Column {
|
|
anchors.fill: parent
|
|
anchors.margins: 16
|
|
spacing: 10
|
|
|
|
Text {
|
|
text: "System Updater"
|
|
font.pixelSize: 20
|
|
}
|
|
|
|
ProgressBar {
|
|
from: 0
|
|
to: root.totalSteps
|
|
value: root.currentStep
|
|
width: parent.width
|
|
}
|
|
|
|
Text {
|
|
text: "Step " + root.currentStep + " / " + root.totalSteps
|
|
}
|
|
|
|
Rectangle {
|
|
width: parent.width
|
|
height: 180
|
|
|
|
ListView {
|
|
id: logView
|
|
anchors.fill: parent
|
|
model: logModel
|
|
}
|
|
|
|
ListModel {
|
|
id: logModel
|
|
}
|
|
}
|
|
|
|
Row {
|
|
spacing: 10
|
|
|
|
Button {
|
|
text: "Run update"
|
|
onClicked: updater.start()
|
|
}
|
|
|
|
Button {
|
|
text: "Close"
|
|
onClicked: root.visible = false
|
|
}
|
|
}
|
|
}
|
|
|
|
Process {
|
|
id: updater
|
|
command: ["bash", "/home/henrov/.config/scripts/update-engine.sh"]
|
|
|
|
onStdout: function(data) {
|
|
let line = data.trim()
|
|
|
|
logModel.append({ text: line })
|
|
|
|
if (line.startsWith("STEP:")) {
|
|
let parts = line.split(":")
|
|
root.currentStep = parseInt(parts[1])
|
|
}
|
|
|
|
if (line.startsWith("DONE")) {
|
|
root.status = "done"
|
|
}
|
|
|
|
if (line.startsWith("FAIL")) {
|
|
root.status = "error"
|
|
}
|
|
}
|
|
}
|
|
}
|