v1.5.0: bigger spaced euro sign, trend arrows on flip/nixie, two-phase flip cascade (reset to 0 over 2s then new values), fix nixie flicker endurance
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
* Glow is faked with layered text copies, so no QtGraphicalEffects
|
||||
* 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).
|
||||
* The euro sign is plain text (default font, white), followed by a
|
||||
* trend arrow (green up / red down; unchanged keeps the last arrow).
|
||||
* Pure QtQuick: testable outside the plasmoid shell.
|
||||
*/
|
||||
|
||||
@@ -14,7 +15,14 @@ Row {
|
||||
|
||||
// wired by the parent loader
|
||||
property string display: "--"
|
||||
property color trendColor: "#9e9e9e"
|
||||
// 1 = up, -1 = down, 0 = unchanged -> keep showing the last arrow
|
||||
property int trendDir: 0
|
||||
property int lastDir: 0
|
||||
onTrendDirChanged: {
|
||||
if (trendDir !== 0) {
|
||||
lastDir = trendDir;
|
||||
}
|
||||
}
|
||||
// 0 = no flicker, 100 = frequent and deep flicker
|
||||
property int flickerIntensity: 40
|
||||
|
||||
@@ -98,18 +106,21 @@ Row {
|
||||
}
|
||||
}
|
||||
|
||||
// nixie flicker: random dropout of the cathode glow
|
||||
// nixie flicker: random dropout of the cathode glow.
|
||||
// repeat: true keeps the cycle alive; each trigger reschedules
|
||||
// the next interval (intensity 40 -> ~4 s between flicks,
|
||||
// 100 -> ~1.5 s).
|
||||
Timer {
|
||||
id: flickTimer
|
||||
repeat: false
|
||||
repeat: true
|
||||
running: root.flickerOn
|
||||
interval: 1500
|
||||
onTriggered: {
|
||||
flick.restart();
|
||||
scheduleNext();
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -137,6 +148,12 @@ Row {
|
||||
}
|
||||
}
|
||||
|
||||
// breathing room between the tubes and the currency sign
|
||||
Item {
|
||||
width: root.height * 0.22
|
||||
height: 1
|
||||
}
|
||||
|
||||
// euro sign in the plain-text font, white
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -144,7 +161,17 @@ Row {
|
||||
visible: root.digits.length > 0
|
||||
color: "#ffffff"
|
||||
font.family: Qt.application.font.family
|
||||
font.pixelSize: root.height * 0.60
|
||||
font.pixelSize: root.height * 0.85
|
||||
}
|
||||
|
||||
// trend arrow: green up / red down; unchanged keeps the last arrow
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.lastDir > 0 ? "\u25B2" : "\u25BC"
|
||||
visible: root.digits.length > 0 && root.lastDir !== 0
|
||||
color: root.lastDir > 0 ? "#2ecc71" : "#e74c3c"
|
||||
font.family: Qt.application.font.family
|
||||
font.pixelSize: root.height * 0.45
|
||||
}
|
||||
|
||||
// error / empty state
|
||||
@@ -156,15 +183,4 @@ Row {
|
||||
font.pixelSize: root.glowFont * 0.8
|
||||
visible: root.digits.length === 0
|
||||
}
|
||||
|
||||
// trend LED (green/red/grey)
|
||||
Rectangle {
|
||||
width: root.height * 0.11
|
||||
height: width
|
||||
radius: width / 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: root.trendColor
|
||||
border.color: "#4a2e12"
|
||||
border.width: 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user