fix: SettingsPage import und Python-ID-Kollision beheben

- Import '.' hinzugefügt, um SettingsPage.qml in Main.qml verfügbar zu machen
- Doppelte Python-Definition aus SettingsPage.qml entfernt (verwendet py von Main.qml)
- Settings.qml durch SettingsPage.qml ersetzt

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
darklithium
2026-06-03 00:12:27 +02:00
parent c4e7d4bd55
commit 7c32796712
2 changed files with 5 additions and 41 deletions
+184
View File
@@ -0,0 +1,184 @@
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3
import QtMultimedia 5.0
import Lomiri.Components 1.3
import Lomiri.Components.Popups 1.3
import io.thp.pyotherside 1.4
Page {
id: settingsPage
objectName: 'settingsPage'
property bool settingsInitialized: false
property var currentFortuneList: "classic"
property real musicVolume: 0.5
property real crackVolume: 1.0
header: PageHeader {
title: "Einstellungen"
}
// Timer für PyOtherSide Initialisierung
Timer {
id: initTimer
interval: 1000
running: true
repeat: false
onTriggered: {
try {
// Einstellungen laden
currentFortuneList = py.call_sync("fortunecookie.get_current_fortune_list", []);
musicVolume = py.call_sync("fortunecookie.get_music_volume", []);
crackVolume = py.call_sync("fortunecookie.get_crack_volume", []);
// Slider Werte setzen
musicVolumeSlider.value = musicVolume;
crackVolumeSlider.value = crackVolume;
// Spruchlisten ComboBox füllen
var lists = py.call_sync("fortunecookie.get_fortune_lists", []);
fortuneListCombo.model = lists;
// Aktuelle Liste auswählen
for (var i = 0; i < fortuneListCombo.count; i++) {
if (fortuneListCombo.textAt(i) === currentFortuneList) {
fortuneListCombo.currentIndex = i;
break;
}
}
settingsInitialized = true;
} catch (e) {
console.log("ERROR: Einstellungen nicht geladen: " + e);
}
}
}
ColumnLayout {
anchors.fill: parent
anchors.margins: units.gu(2)
spacing: units.gu(2)
// ============================================================
// SPRUCHLISTEN-AUSWAHL
// ============================================================
Label {
text: "Spruchliste:"
Layout.fillWidth: true
fontSize: "large"
}
ComboBox {
id: fortuneListCombo
Layout.fillWidth: true
Layout.preferredHeight: units.gu(8)
onActivated: {
var newList = fortuneListCombo.currentText;
py.call("fortunecookie.set_fortune_list", [newList], function() {
console.log("Spruchliste gewaehlt: " + 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
onMoved: {
var volume = musicVolumeSlider.value;
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
onMoved: {
var volume = crackVolumeSlider.value;
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
Layout.preferredHeight: units.gu(10)
}
Button {
text: "Zurück"
Layout.fillWidth: false
Layout.preferredWidth: units.gu(20)
Layout.preferredHeight: units.gu(8)
Layout.alignment: Qt.AlignHCenter
onClicked: {
mainStack.currentIndex = 0;
}
}
}
}