52 lines
1.2 KiB
QML
52 lines
1.2 KiB
QML
// --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
|
|
Window {
|
|
width: 500
|
|
height: 200
|
|
visible: true
|
|
title: "System Updater"
|
|
|
|
property int progress: 0
|
|
property string status: "Waiting..."
|
|
|
|
Timer {
|
|
interval: 300
|
|
running: true
|
|
repeat: true
|
|
|
|
onTriggered: {
|
|
let file = "/tmp/nixos-updater-status"
|
|
|
|
let xhr = new XMLHttpRequest()
|
|
xhr.open("GET", "file://" + file)
|
|
xhr.onreadystatechange = function() {
|
|
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
let parts = xhr.responseText.trim().split("|")
|
|
|
|
if (parts.length === 2) {
|
|
progress = parseInt(parts[0])
|
|
status = parts[1]
|
|
}
|
|
}
|
|
}
|
|
xhr.send()
|
|
}
|
|
}
|
|
|
|
Column {
|
|
anchors.centerIn: parent
|
|
spacing: 10
|
|
|
|
Text { text: status }
|
|
|
|
ProgressBar {
|
|
from: 0
|
|
to: 100
|
|
value: progress
|
|
width: 300
|
|
}
|
|
}
|
|
}
|