v1.4.0: digit-only flaps with white euro text, nixie white euro + configurable flicker, mode-conditional config fields; fix stale derived-property reads in change handler

This commit is contained in:
ArnoldCordewiner
2026-09-05 20:51:05 +02:00
parent bb9bed4184
commit b040eb8c47
8 changed files with 154 additions and 60 deletions
+37 -6
View File
@@ -1,7 +1,9 @@
/*
* Split-flap display mode — airport departure board style.
* White characters on black cells with a flap split line;
* changed characters flip with a cascading animation.
* Only digits are shown as flaps; the euro sign is rendered as plain
* text (default font, white) next to the board, and the trend shows
* on a small LED. Changed characters flip with a cascading animation
* spread over the configured number of seconds.
* Pure QtQuick so it can be tested outside the plasmoid shell.
*/
@@ -18,6 +20,23 @@ Row {
spacing: height * 0.06
function digitsOf(s) {
var out = "";
for (var i = 0; i < s.length; i++) {
var ch = s.charAt(i);
if ((ch >= "0" && ch <= "9") || ch === "-") {
out += ch;
}
}
return out;
}
// UI-only derived values (euro visibility); logic must not rely on these —
// QML gives no ordering guarantee between a change handler and the
// re-evaluation of dependent bindings.
readonly property string digitsOnly: digitsOf(display)
readonly property string boardText: digitsOnly.length > 0 ? digitsOnly : "--"
property var chars: []
property bool ready: false
readonly property real cellFont: height * 0.72
@@ -26,7 +45,7 @@ Row {
readonly property int flapDuration: 260
Component.onCompleted: {
chars = display.split("");
chars = boardText.split("");
ready = true;
}
@@ -34,7 +53,10 @@ Row {
if (!ready) {
return;
}
var nc = display.split("");
// compute from display directly: derived bindings may still be
// stale at this point (QML makes no ordering guarantee)
var digits = digitsOf(display);
var nc = (digits.length > 0 ? digits : "--").split("");
var n = Math.max(chars.length, nc.length);
// spread the changed cells evenly across flapSeconds
var changed = [];
@@ -141,8 +163,17 @@ Row {
}
}
// trend LED (green/red/grey) — boards are monochrome, so the
// trend shows here instead of in the letter color
// euro sign in the plain-text font, white
Text {
anchors.verticalCenter: parent.verticalCenter
text: "\u20AC"
visible: root.digitsOnly.length > 0
color: "#ffffff"
font.family: Qt.application.font.family
font.pixelSize: root.height * 0.66
}
// trend LED (green/red/grey)
Rectangle {
width: root.height * 0.14
height: width