feat: v1.0.8 mit Lautstärke-Fix und neuen Listen
This commit is contained in:
+51
-111
@@ -20,8 +20,7 @@ MainView {
|
||||
property string currentFortune: ""
|
||||
property bool musicPlaying: false
|
||||
property bool appInitialized: false
|
||||
property real musicVolume: 0.5
|
||||
property real crackVolume: 1.0
|
||||
property string currentFortuneListDescription: ""
|
||||
|
||||
Python {
|
||||
id: py
|
||||
@@ -49,14 +48,14 @@ MainView {
|
||||
objectName: "mediaPlayer"
|
||||
source: Qt.resolvedUrl("../assets/chinese_music.mp3")
|
||||
loops: MediaPlayer.Infinite
|
||||
volume: root.musicVolume
|
||||
volume: 1.0
|
||||
}
|
||||
|
||||
MediaPlayer {
|
||||
id: crackMediaPlayer
|
||||
objectName: "crackMediaPlayer"
|
||||
source: Qt.resolvedUrl("../assets/cookie_crack.mp3")
|
||||
volume: root.crackVolume
|
||||
volume: 1.0
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
@@ -107,15 +106,16 @@ MainView {
|
||||
}
|
||||
});
|
||||
|
||||
// Volumes laden
|
||||
py.call("fortunecookie.get_music_volume", [], function(result) {
|
||||
root.musicVolume = result;
|
||||
mediaPlayer.volume = result;
|
||||
});
|
||||
|
||||
py.call("fortunecookie.get_crack_volume", [], function(result) {
|
||||
root.crackVolume = result;
|
||||
crackMediaPlayer.volume = result;
|
||||
// Aktuelle Liste laden und Beschreibung setzen
|
||||
py.call("fortunecookie.get_current_fortune_list", [], function(listName) {
|
||||
var descriptions = {
|
||||
"fortune": "Glückskeks-Sprüche",
|
||||
"farmer wisdom": "Bauernweisheiten",
|
||||
"UNfortune": "Darkside-Sprüche",
|
||||
"sandman": "Bettgehzeit!",
|
||||
"famous quotes": "Berühmte Zitate"
|
||||
};
|
||||
root.currentFortuneListDescription = descriptions[listName] || listName;
|
||||
});
|
||||
|
||||
appInitialized = true;
|
||||
@@ -214,6 +214,20 @@ MainView {
|
||||
}
|
||||
}
|
||||
|
||||
// AKTIVE LISTE ANZEIGE (unten links)
|
||||
Label {
|
||||
id: activeListLabel
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: musicButton.verticalCenter
|
||||
leftMargin: units.gu(2)
|
||||
}
|
||||
text: currentFortuneListDescription
|
||||
fontSize: "medium"
|
||||
color: theme.palette.normalText || "white"
|
||||
visible: currentFortuneListDescription !== ""
|
||||
}
|
||||
|
||||
// MUSIK-BUTTON
|
||||
Label {
|
||||
id: musicButton
|
||||
@@ -222,10 +236,10 @@ MainView {
|
||||
bottom: parent.bottom
|
||||
margins: units.gu(2)
|
||||
}
|
||||
width: units.gu(10)
|
||||
height: units.gu(10)
|
||||
width: units.gu(8)
|
||||
height: units.gu(8)
|
||||
text: musicPlaying ? "\uD83D\uDD0A" : "\uD83D\uDD07"
|
||||
fontSize: "xxx-large"
|
||||
fontSize: "xx-large"
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: theme.palette.normalText || "white"
|
||||
@@ -265,29 +279,20 @@ MainView {
|
||||
// Verzögerte Initialisierung
|
||||
Qt.callLater(function() {
|
||||
try {
|
||||
// Einstellungen laden
|
||||
// Spruchlisten ComboBox füllen
|
||||
py.call("fortunecookie.get_current_fortune_list", [], function(currentFortuneList) {
|
||||
py.call("fortunecookie.get_music_volume", [], function(musicVol) {
|
||||
py.call("fortunecookie.get_crack_volume", [], function(crackVol) {
|
||||
// Slider Werte setzen
|
||||
musicVolumeSlider.value = musicVol;
|
||||
crackVolumeSlider.value = crackVol;
|
||||
py.call("fortunecookie.get_fortune_lists_with_description", [], function(lists) {
|
||||
fortuneListCombo.model = lists;
|
||||
|
||||
// Spruchlisten ComboBox füllen
|
||||
py.call("fortunecookie.get_fortune_lists_with_description", [], function(lists) {
|
||||
fortuneListCombo.model = lists;
|
||||
|
||||
// Aktuelle Liste auswählen
|
||||
for (var i = 0; i < fortuneListCombo.count; i++) {
|
||||
var text = fortuneListCombo.textAt(i);
|
||||
var listName = text.split(" - ")[0];
|
||||
if (listName === currentFortuneList) {
|
||||
fortuneListCombo.currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
// Aktuelle Liste auswählen
|
||||
for (var i = 0; i < fortuneListCombo.count; i++) {
|
||||
var text = fortuneListCombo.textAt(i);
|
||||
var listName = text.split(" - ")[0];
|
||||
if (listName === currentFortuneList) {
|
||||
fortuneListCombo.currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -326,84 +331,19 @@ MainView {
|
||||
py.call("fortunecookie.set_fortune_list", [newList], function() {
|
||||
console.log("Spruchliste gewaehlt: " + newList);
|
||||
reloadFortune();
|
||||
// Aktualisiere die Anzeige im Hauptbildschirm
|
||||
var descriptions = {
|
||||
"fortune": "Glückskeks-Sprüche",
|
||||
"farmer wisdom": "Bauernweisheiten",
|
||||
"UNfortune": "Darkside-Sprüche",
|
||||
"sandman": "Bettgehzeit!",
|
||||
"famous quotes": "Berühmte Zitate"
|
||||
};
|
||||
root.currentFortuneListDescription = descriptions[newList] || newList;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// LAUTSTÄRKE - MUSIK
|
||||
Label {
|
||||
text: "Musik-Lautstärke:"
|
||||
Layout.fillWidth: true
|
||||
fontSize: "large"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: units.gu(2)
|
||||
|
||||
Slider {
|
||||
id: musicVolumeSlider
|
||||
Layout.fillWidth: true
|
||||
minimumValue: 0.0
|
||||
maximumValue: 1.0
|
||||
stepSize: 0.1
|
||||
value: 0.5
|
||||
|
||||
onValueChanged: {
|
||||
var volume = musicVolumeSlider.value;
|
||||
root.musicVolume = volume;
|
||||
mediaPlayer.volume = volume;
|
||||
py.call("fortunecookie.set_music_volume", [volume]);
|
||||
musicVolumeLabel.text = Math.round(volume * 100) + "%";
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: musicVolumeLabel
|
||||
text: Math.round(musicVolumeSlider.value * 100) + "%"
|
||||
width: units.gu(10)
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
fontSize: "medium"
|
||||
}
|
||||
}
|
||||
|
||||
// LAUTSTÄRKE - KNACK-GERÄUSCH
|
||||
Label {
|
||||
text: "Knack-Lautstärke:"
|
||||
Layout.fillWidth: true
|
||||
fontSize: "large"
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: units.gu(2)
|
||||
|
||||
Slider {
|
||||
id: crackVolumeSlider
|
||||
Layout.fillWidth: true
|
||||
minimumValue: 0.0
|
||||
maximumValue: 1.0
|
||||
stepSize: 0.1
|
||||
value: 1.0
|
||||
|
||||
onValueChanged: {
|
||||
var volume = crackVolumeSlider.value;
|
||||
root.crackVolume = volume;
|
||||
crackMediaPlayer.volume = volume;
|
||||
py.call("fortunecookie.set_crack_volume", [volume]);
|
||||
crackVolumeLabel.text = Math.round(volume * 100) + "%";
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: crackVolumeLabel
|
||||
text: Math.round(crackVolumeSlider.value * 100) + "%"
|
||||
width: units.gu(10)
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
fontSize: "medium"
|
||||
}
|
||||
}
|
||||
|
||||
// ZURÜCK-BUTTON
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
|
||||
Reference in New Issue
Block a user