From fbbb67167e26af9985e300bd6a94de94f470d75f Mon Sep 17 00:00:00 2001 From: darklithium Date: Wed, 3 Jun 2026 01:55:37 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Musik-Button=20Icon=20vergr=C3=B6=C3=9Fe?= =?UTF-8?q?rt=20+=20Lautst=C3=A4rke-Timer=20+=20Listenwechsel=20sofort=20a?= =?UTF-8?q?ktiv=20-=20Musik-Button:=2010GU=20mit=20fontSize:=20xxx-large?= =?UTF-8?q?=20(Icon=20vergr=C3=B6=C3=9Fert)=20-=20Slider:=20showValue:=20f?= =?UTF-8?q?alse=20(Popup-Zahl=200/1=20entfernt,=20Prozent-Anzeige=20bleibt?= =?UTF-8?q?)=20-=20Listenwechsel:=20open=5Ffortune()=20l=C3=A4dt=20aktuell?= =?UTF-8?q?e=20Liste=20neu=20-=20Lautst=C3=A4rke:=20Timer=20(200ms)=20pr?= =?UTF-8?q?=C3=BCft=20Einstellungen=20und=20aktualisiert=20MediaPlayer=20-?= =?UTF-8?q?=20Settings:=20root.reloadFortune()=20entfernt=20(funktioniert?= =?UTF-8?q?=20nicht=20zwischen=20Komponenten)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe --- qml/Main.qml | 24 +++++++++++++++++++++--- qml/Settings.qml | 7 ++++--- src/fortunecookie.py | 4 +++- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/qml/Main.qml b/qml/Main.qml index d3e993c..d4ce635 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -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 { id: cookieImage anchors.centerIn: parent @@ -225,10 +243,10 @@ MainView { bottom: parent.bottom margins: units.gu(2) } - width: units.gu(14) - height: units.gu(14) + width: units.gu(10) + height: units.gu(10) text: musicPlaying ? "\uD83D\uDD0A" : "\uD83D\uDD07" - fontSize: "xx-large" + fontSize: "xxx-large" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: theme.palette.normalText diff --git a/qml/Settings.qml b/qml/Settings.qml index 136e238..cc47c74 100644 --- a/qml/Settings.qml +++ b/qml/Settings.qml @@ -90,7 +90,6 @@ Page { var newList = newListFull.split(" - ")[0]; py.call("fortunecookie.set_fortune_list", [newList], function() { console.log("Spruchliste gewaehlt: " + newList); - root.reloadFortune(); }); } } @@ -116,10 +115,11 @@ Page { maximumValue: 1.0 stepSize: 0.1 value: 0.5 + showValue: false onValueChanged: { var volume = musicVolumeSlider.value; - root.setMusicVolume(volume); + py.call("fortunecookie.set_music_volume", [volume]); musicVolumeLabel.text = Math.round(volume * 100) + "%"; } } @@ -154,10 +154,11 @@ Page { maximumValue: 1.0 stepSize: 0.1 value: 1.0 + showValue: false onValueChanged: { var volume = crackVolumeSlider.value; - root.setCrackVolume(volume); + py.call("fortunecookie.set_crack_volume", [volume]); crackVolumeLabel.text = Math.round(volume * 100) + "%"; } } diff --git a/src/fortunecookie.py b/src/fortunecookie.py index c05e0d1..6f73938 100644 --- a/src/fortunecookie.py +++ b/src/fortunecookie.py @@ -130,8 +130,10 @@ def get_initial_fortune(): def open_fortune(): """Oeffnet den Fortune Cookie (neuer Spruch aus aktueller Liste).""" - global _current_fortune + global _current_fortune, _current_fortune_list _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() return True