fix: Musik-Button Icon vergrößert + Lautstärke-Timer + Listenwechsel sofort aktiv

- Musik-Button: 10GU mit fontSize: xxx-large (Icon vergrößert)
- Slider: showValue: false (Popup-Zahl 0/1 entfernt, Prozent-Anzeige bleibt)
- Listenwechsel: open_fortune() lädt aktuelle Liste neu
- Lautstärke: Timer (200ms) prüft Einstellungen und aktualisiert MediaPlayer
- Settings: root.reloadFortune() entfernt (funktioniert nicht zwischen Komponenten)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
darklithium
2026-06-03 01:55:37 +02:00
parent b458953cbe
commit fbbb67167e
3 changed files with 28 additions and 7 deletions
+21 -3
View File
@@ -133,6 +133,24 @@ MainView {
} }
} }
// Timer zum regelmäßigen Prüfen der Lautstärke-Einstellungen
Timer {
id: volumeCheckTimer
interval: 200 // Prüfen alle 200ms
running: true
repeat: true
onTriggered: {
var musicVol = py.call_sync("fortunecookie.get_music_volume", []);
var crackVol = py.call_sync("fortunecookie.get_crack_volume", []);
if (musicVol !== root.musicVolume) {
root.musicVolume = musicVol;
}
if (crackVol !== root.crackVolume) {
root.crackVolume = crackVol;
}
}
}
Image { Image {
id: cookieImage id: cookieImage
anchors.centerIn: parent anchors.centerIn: parent
@@ -225,10 +243,10 @@ MainView {
bottom: parent.bottom bottom: parent.bottom
margins: units.gu(2) margins: units.gu(2)
} }
width: units.gu(14) width: units.gu(10)
height: units.gu(14) height: units.gu(10)
text: musicPlaying ? "\uD83D\uDD0A" : "\uD83D\uDD07" text: musicPlaying ? "\uD83D\uDD0A" : "\uD83D\uDD07"
fontSize: "xx-large" fontSize: "xxx-large"
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: theme.palette.normalText color: theme.palette.normalText
+4 -3
View File
@@ -90,7 +90,6 @@ Page {
var newList = newListFull.split(" - ")[0]; var newList = newListFull.split(" - ")[0];
py.call("fortunecookie.set_fortune_list", [newList], function() { py.call("fortunecookie.set_fortune_list", [newList], function() {
console.log("Spruchliste gewaehlt: " + newList); console.log("Spruchliste gewaehlt: " + newList);
root.reloadFortune();
}); });
} }
} }
@@ -116,10 +115,11 @@ Page {
maximumValue: 1.0 maximumValue: 1.0
stepSize: 0.1 stepSize: 0.1
value: 0.5 value: 0.5
showValue: false
onValueChanged: { onValueChanged: {
var volume = musicVolumeSlider.value; var volume = musicVolumeSlider.value;
root.setMusicVolume(volume); py.call("fortunecookie.set_music_volume", [volume]);
musicVolumeLabel.text = Math.round(volume * 100) + "%"; musicVolumeLabel.text = Math.round(volume * 100) + "%";
} }
} }
@@ -154,10 +154,11 @@ Page {
maximumValue: 1.0 maximumValue: 1.0
stepSize: 0.1 stepSize: 0.1
value: 1.0 value: 1.0
showValue: false
onValueChanged: { onValueChanged: {
var volume = crackVolumeSlider.value; var volume = crackVolumeSlider.value;
root.setCrackVolume(volume); py.call("fortunecookie.set_crack_volume", [volume]);
crackVolumeLabel.text = Math.round(volume * 100) + "%"; crackVolumeLabel.text = Math.round(volume * 100) + "%";
} }
} }
+3 -1
View File
@@ -130,8 +130,10 @@ def get_initial_fortune():
def open_fortune(): def open_fortune():
"""Oeffnet den Fortune Cookie (neuer Spruch aus aktueller Liste).""" """Oeffnet den Fortune Cookie (neuer Spruch aus aktueller Liste)."""
global _current_fortune global _current_fortune, _current_fortune_list
_init() _init()
# Aktuelle Liste neu laden, falls sie in Settings geändert wurde
_current_fortune_list = load_setting("fortune_list", default_value="fortune")
_current_fortune = _get_random_fortune() _current_fortune = _get_random_fortune()
return True return True