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:
@@ -1,7 +1,10 @@
|
||||
/*
|
||||
* Nixie tube display mode — retro amber glowing digits in glass tubes.
|
||||
* Glow is faked with layered text copies, so no QtGraphicalEffects
|
||||
* dependency. Pure QtQuick: testable outside the plasmoid shell.
|
||||
* dependency. Tubes flicker randomly (nixie cathode style); the
|
||||
* flicker intensity is configurable (0 = off, 100 = nervous).
|
||||
* The euro sign is rendered as plain text (default font, white).
|
||||
* Pure QtQuick: testable outside the plasmoid shell.
|
||||
*/
|
||||
|
||||
import QtQuick 2.15
|
||||
@@ -12,12 +15,26 @@ Row {
|
||||
// wired by the parent loader
|
||||
property string display: "--"
|
||||
property color trendColor: "#9e9e9e"
|
||||
// 0 = no flicker, 100 = frequent and deep flicker
|
||||
property int flickerIntensity: 40
|
||||
|
||||
spacing: height * 0.05
|
||||
|
||||
readonly property string digits: display.replace(/[^0-9]/g, "")
|
||||
function digitsOf(s) {
|
||||
var out = "";
|
||||
for (var i = 0; i < s.length; i++) {
|
||||
var ch = s.charAt(i);
|
||||
if (ch >= "0" && ch <= "9") {
|
||||
out += ch;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
readonly property string digits: digitsOf(display)
|
||||
readonly property real tubeWidth: height * 0.52
|
||||
readonly property real glowFont: height * 0.80
|
||||
readonly property bool flickerOn: flickerIntensity > 0 && digits.length > 0
|
||||
|
||||
Repeater {
|
||||
model: root.digits.length
|
||||
@@ -48,71 +65,86 @@ Row {
|
||||
opacity: 0.06
|
||||
}
|
||||
|
||||
Text {
|
||||
id: glowText
|
||||
anchors.centerIn: parent
|
||||
text: root.digits[index]
|
||||
color: "#ffb648"
|
||||
font.family: "DejaVu Serif"
|
||||
font.pixelSize: root.glowFont
|
||||
// digit + glow layers, flickered as one group
|
||||
Item {
|
||||
id: glowGroup
|
||||
anchors.fill: parent
|
||||
|
||||
// layered glow: two scaled copies behind the crisp digit
|
||||
Text {
|
||||
id: glowText
|
||||
anchors.centerIn: parent
|
||||
text: parent.text
|
||||
color: "#ff8c00"
|
||||
opacity: 0.30
|
||||
font: parent.font
|
||||
scale: 1.24
|
||||
text: root.digits[index]
|
||||
color: "#ffb648"
|
||||
font.family: "DejaVu Serif"
|
||||
font.pixelSize: root.glowFont
|
||||
|
||||
// layered glow: two scaled copies behind the crisp digit
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: parent.text
|
||||
color: "#ff8c00"
|
||||
opacity: 0.30
|
||||
font: parent.font
|
||||
scale: 1.24
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: parent.text
|
||||
color: "#ff9d1e"
|
||||
opacity: 0.50
|
||||
font: parent.font
|
||||
scale: 1.10
|
||||
}
|
||||
}
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: parent.text
|
||||
color: "#ff9d1e"
|
||||
opacity: 0.50
|
||||
font: parent.font
|
||||
scale: 1.10
|
||||
}
|
||||
|
||||
// nixie flicker: random dropout of the cathode glow
|
||||
Timer {
|
||||
id: flickTimer
|
||||
repeat: false
|
||||
running: root.flickerOn
|
||||
onTriggered: {
|
||||
flick.restart();
|
||||
scheduleNext();
|
||||
}
|
||||
|
||||
// occasional gentle nixie flicker
|
||||
Timer {
|
||||
interval: 2200 + Math.random() * 3200
|
||||
repeat: false
|
||||
running: root.visible && root.digits.length > 0
|
||||
onTriggered: {
|
||||
flick.stop();
|
||||
flick.start();
|
||||
interval = 2200 + Math.random() * 3200;
|
||||
restart();
|
||||
function scheduleNext() {
|
||||
// intensity 40 -> ~4 s between flicks, 100 -> ~1.5 s
|
||||
var base = 6000 - root.flickerIntensity * 45;
|
||||
interval = Math.max(700, base * (0.6 + Math.random() * 0.8));
|
||||
}
|
||||
|
||||
Component.onCompleted: scheduleNext()
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: flick
|
||||
ScriptAction {
|
||||
script: {
|
||||
var range = root.flickerIntensity / 100 * 0.75;
|
||||
glowGroup.opacity = 1 - (0.15 + Math.random() * range);
|
||||
}
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: flick
|
||||
NumberAnimation {
|
||||
target: glowText
|
||||
property: "opacity"
|
||||
to: 0.82
|
||||
duration: 70
|
||||
}
|
||||
NumberAnimation {
|
||||
target: glowText
|
||||
property: "opacity"
|
||||
to: 1.0
|
||||
duration: 140
|
||||
}
|
||||
PauseAnimation { duration: 40 + Math.random() * 140 }
|
||||
NumberAnimation {
|
||||
target: glowGroup
|
||||
property: "opacity"
|
||||
to: 1.0
|
||||
duration: 90 + Math.random() * 160
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// currency indicator, dim amber like an indicator lamp
|
||||
// euro sign in the plain-text font, white
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "\u20AC"
|
||||
color: "#8a5a20"
|
||||
font.family: "DejaVu Serif"
|
||||
font.pixelSize: root.glowFont * 0.6
|
||||
visible: root.digits.length > 0
|
||||
color: "#ffffff"
|
||||
font.family: Qt.application.font.family
|
||||
font.pixelSize: root.height * 0.60
|
||||
}
|
||||
|
||||
// error / empty state
|
||||
|
||||
Reference in New Issue
Block a user