0.1.3: copertina con CPU, RAM e disco in percentuale
This commit is contained in:
1 parent
c73af11575
commit
887d3a6888
4 files changed
+93
-23
No files matched your search
@@ -34,7 +34,7 @@ Requisiti: SDK Sailfish in `~/SailfishOS`, build engine Docker.
|
|||||||
## Installazione sul telefono
|
## Installazione sul telefono
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
devel-su rpm -Uvh harbour-server-0.1.2-1.aarch64.rpm
|
devel-su rpm -Uvh harbour-server-0.1.3-1.aarch64.rpm
|
||||||
```
|
```
|
||||||
|
|
||||||
Poi, all'apertura: indicare indirizzo (es. `http://192.168.3.21:8792`) e token.
|
Poi, all'apertura: indicare indirizzo (es. `http://192.168.3.21:8792`) e token.
|
||||||
|
|||||||
+85
-19
@@ -6,39 +6,105 @@ CoverBackground {
|
|||||||
|
|
||||||
// Guardie: quando lo snapshot non è ancora arrivato i campi mancano e in
|
// Guardie: quando lo snapshot non è ancora arrivato i campi mancano e in
|
||||||
// JS leggere una proprietà di undefined solleva un'eccezione.
|
// JS leggere una proprietà di undefined solleva un'eccezione.
|
||||||
function num(v, fallback) {
|
function cpuPct() {
|
||||||
return (v === undefined || v === null) ? fallback : v
|
var d = statusClient.data
|
||||||
|
return (d && d.cpu && d.cpu.percent !== undefined) ? d.cpu.percent : -1
|
||||||
|
}
|
||||||
|
function memPct() {
|
||||||
|
var d = statusClient.data
|
||||||
|
return (d && d.memory && d.memory.percent !== undefined) ? d.memory.percent : -1
|
||||||
|
}
|
||||||
|
function diskPct() {
|
||||||
|
var d = statusClient.data
|
||||||
|
if (d && d.disks && d.disks.length > 0 && d.disks[0].percent !== undefined)
|
||||||
|
return d.disks[0].percent
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stesse soglie delle card: verde, giallo da 85%, rosso da 95%.
|
||||||
|
function levelColor(p) {
|
||||||
|
if (p < 0) return Theme.secondaryColor
|
||||||
|
if (p >= 95) return "#e53935"
|
||||||
|
if (p >= 85) return "#ffb300"
|
||||||
|
return "#43a047"
|
||||||
|
}
|
||||||
|
function pctText(p) {
|
||||||
|
return p < 0 ? "—" : statusClient.fmtNum(p, 0) + "%"
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: parent.width - 2 * Theme.paddingLarge
|
width: parent.width - 2 * Theme.paddingMedium
|
||||||
spacing: Theme.paddingSmall
|
spacing: Theme.paddingSmall
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Server"
|
text: qsTr("Server")
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
color: Theme.secondaryColor
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: statusClient.error !== "" ? "—" : statusClient.fmtNum(num(statusClient.data.cpu ? statusClient.data.cpu.percent : undefined, -1), 0) + " %"
|
|
||||||
font.pixelSize: Theme.fontSizeExtraLarge
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "CPU"
|
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
color: Theme.secondaryColor
|
color: Theme.secondaryColor
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CPU · RAM · disco: etichetta a sinistra, percentuale a destra.
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.paddingSmall / 2
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
Label {
|
||||||
|
text: qsTr("CPU")
|
||||||
|
width: parent.width * 0.5
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.primaryColor
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: pctText(cpuPct())
|
||||||
|
width: parent.width * 0.5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: levelColor(cpuPct())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
Label {
|
||||||
|
text: qsTr("RAM")
|
||||||
|
width: parent.width * 0.5
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.primaryColor
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: pctText(memPct())
|
||||||
|
width: parent.width * 0.5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: levelColor(memPct())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
width: parent.width
|
||||||
|
Label {
|
||||||
|
text: qsTr("Disco")
|
||||||
|
width: parent.width * 0.5
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.primaryColor
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: pctText(diskPct())
|
||||||
|
width: parent.width * 0.5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: levelColor(diskPct())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: statusClient.fetchedAt !== "" ? statusClient.fetchedAt : ""
|
text: statusClient.error !== "" ? qsTr("errore") : statusClient.fetchedAt
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
color: Theme.secondaryColor
|
color: statusClient.error !== "" ? "#e53935" : Theme.secondaryColor
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Name: harbour-server
|
Name: harbour-server
|
||||||
Summary: Parametri del server in una schermata
|
Summary: Parametri del server in una schermata
|
||||||
Version: 0.1.2
|
Version: 0.1.3
|
||||||
Release: 1
|
Release: 1
|
||||||
Group: Qt/Qt
|
Group: Qt/Qt
|
||||||
License: MIT
|
License: MIT
|
||||||
@@ -23,6 +23,10 @@ schermata sola. Il formato consumato (schema status/1) non dipende dalla
|
|||||||
macchina: qualunque host che serva lo stesso JSON funziona senza modifiche.
|
macchina: qualunque host che serva lo stesso JSON funziona senza modifiche.
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 28 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.1.3-1
|
||||||
|
- Copertina (widget): CPU, RAM e disco con le percentuali d'uso in tre righe,
|
||||||
|
colorate con le stesse soglie delle card (giallo da 85%, rosso da 95%);
|
||||||
|
in basso l'ora dell'ultimo aggiornamento o "errore"
|
||||||
* Wed Oct 28 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.1.2-1
|
* Wed Oct 28 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.1.2-1
|
||||||
- Card Backup: età in GIORNI INTERI (arrotondata, non più "41,5 h" o
|
- Card Backup: età in GIORNI INTERI (arrotondata, non più "41,5 h" o
|
||||||
"1,7 giorni") con soglie verde 1-3 giorni, giallo 4-6, rosso da 7 in su;
|
"1,7 giorni") con soglie verde 1-3 giorni, giallo 4-6, rosso da 7 in su;
|
||||||
|
|||||||
+2
-2
@@ -15,9 +15,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
|||||||
// AppConfigLocation = ~/.config/harbour/server (zona persistente).
|
// AppConfigLocation = ~/.config/harbour/server (zona persistente).
|
||||||
app->setOrganizationName(QStringLiteral("harbour"));
|
app->setOrganizationName(QStringLiteral("harbour"));
|
||||||
app->setApplicationName(QStringLiteral("server"));
|
app->setApplicationName(QStringLiteral("server"));
|
||||||
app->setApplicationVersion(QStringLiteral("0.1.2"));
|
app->setApplicationVersion(QStringLiteral("0.1.3"));
|
||||||
|
|
||||||
qDebug() << "harbour-server v0.1.2 build" << __DATE__ << __TIME__;
|
qDebug() << "harbour-server v0.1.3 build" << __DATE__ << __TIME__;
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
StatusClient status(&settings);
|
StatusClient status(&settings);
|
||||||
|
|||||||
Reference in new issue
Block a user