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:
+2
-12
@@ -4,6 +4,7 @@ import QtMultimedia 5.0
|
|||||||
import Lomiri.Components 1.3
|
import Lomiri.Components 1.3
|
||||||
import Lomiri.Components.Popups 1.3
|
import Lomiri.Components.Popups 1.3
|
||||||
import io.thp.pyotherside 1.4
|
import io.thp.pyotherside 1.4
|
||||||
|
import "."
|
||||||
|
|
||||||
MainView {
|
MainView {
|
||||||
id: root
|
id: root
|
||||||
@@ -20,10 +21,6 @@ MainView {
|
|||||||
property bool musicPlaying: false
|
property bool musicPlaying: false
|
||||||
property bool appInitialized: false
|
property bool appInitialized: false
|
||||||
|
|
||||||
// Medien-Player als globale Properties für Zugriff aus Settings
|
|
||||||
property MediaPlayer globalMediaPlayer: mediaPlayer
|
|
||||||
property MediaPlayer globalCrackPlayer: crackMediaPlayer
|
|
||||||
|
|
||||||
Python {
|
Python {
|
||||||
id: py
|
id: py
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
@@ -55,10 +52,6 @@ MainView {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
|
|
||||||
// Medien-Player für Settings zugänglich machen
|
|
||||||
property MediaPlayer stackMediaPlayer: root.globalMediaPlayer
|
|
||||||
property MediaPlayer stackCrackPlayer: root.globalCrackPlayer
|
|
||||||
|
|
||||||
// ================================================================
|
// ================================================================
|
||||||
// SEITE 0: HAUPTSPIELBILDSCHIRM
|
// SEITE 0: HAUPTSPIELBILDSCHIRM
|
||||||
// ================================================================
|
// ================================================================
|
||||||
@@ -241,11 +234,8 @@ MainView {
|
|||||||
// ================================================================
|
// ================================================================
|
||||||
// SEITE 1: EINSTELLUNGEN
|
// SEITE 1: EINSTELLUNGEN
|
||||||
// ================================================================
|
// ================================================================
|
||||||
Settings {
|
SettingsPage {
|
||||||
id: settingsPage
|
id: settingsPage
|
||||||
// Zugriff auf Medien-Player ueber parent
|
|
||||||
property MediaPlayer settingsMediaPlayer: mainStack.stackMediaPlayer
|
|
||||||
property MediaPlayer settingsCrackPlayer: mainStack.stackCrackPlayer
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 2.4
|
import QtQuick.Controls 2.4
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtMultimedia 5.0
|
||||||
import Lomiri.Components 1.3
|
import Lomiri.Components 1.3
|
||||||
import Lomiri.Components.Popups 1.3
|
import Lomiri.Components.Popups 1.3
|
||||||
import io.thp.pyotherside 1.4
|
import io.thp.pyotherside 1.4
|
||||||
@@ -37,13 +38,11 @@ Page {
|
|||||||
|
|
||||||
// Spruchlisten ComboBox füllen
|
// Spruchlisten ComboBox füllen
|
||||||
var lists = py.call_sync("fortunecookie.get_fortune_lists", []);
|
var lists = py.call_sync("fortunecookie.get_fortune_lists", []);
|
||||||
for (var i = 0; i < lists.length; i++) {
|
fortuneListCombo.model = lists;
|
||||||
fortuneListCombo.model.append(lists[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Aktuelle Liste auswählen
|
// Aktuelle Liste auswählen
|
||||||
for (var i = 0; i < fortuneListCombo.count; i++) {
|
for (var i = 0; i < fortuneListCombo.count; i++) {
|
||||||
if (fortuneListCombo.itemAt(i) === currentFortuneList) {
|
if (fortuneListCombo.textAt(i) === currentFortuneList) {
|
||||||
fortuneListCombo.currentIndex = i;
|
fortuneListCombo.currentIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -57,16 +56,6 @@ Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Python {
|
|
||||||
id: py
|
|
||||||
Component.onCompleted: {
|
|
||||||
addImportPath(Qt.resolvedUrl("../src"));
|
|
||||||
importModule("fortunecookie", function() {
|
|
||||||
console.log("Python-Modul in Settings geladen");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: units.gu(2)
|
anchors.margins: units.gu(2)
|
||||||
@@ -86,7 +75,6 @@ Page {
|
|||||||
id: fortuneListCombo
|
id: fortuneListCombo
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: units.gu(8)
|
Layout.preferredHeight: units.gu(8)
|
||||||
fontSize: "medium"
|
|
||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
var newList = fortuneListCombo.currentText;
|
var newList = fortuneListCombo.currentText;
|
||||||
@@ -121,13 +109,6 @@ Page {
|
|||||||
onMoved: {
|
onMoved: {
|
||||||
var volume = musicVolumeSlider.value;
|
var volume = musicVolumeSlider.value;
|
||||||
py.call("fortunecookie.set_music_volume", [volume]);
|
py.call("fortunecookie.set_music_volume", [volume]);
|
||||||
// Aktualisiere MediaPlayer ueber parent
|
|
||||||
if (parent && parent.parent && parent.parent.parent) {
|
|
||||||
var mainView = parent.parent.parent;
|
|
||||||
if (mainView && mainView.globalMediaPlayer) {
|
|
||||||
mainView.globalMediaPlayer.volume = volume;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
musicVolumeLabel.text = Math.round(volume * 100) + "%";
|
musicVolumeLabel.text = Math.round(volume * 100) + "%";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,13 +147,6 @@ Page {
|
|||||||
onMoved: {
|
onMoved: {
|
||||||
var volume = crackVolumeSlider.value;
|
var volume = crackVolumeSlider.value;
|
||||||
py.call("fortunecookie.set_crack_volume", [volume]);
|
py.call("fortunecookie.set_crack_volume", [volume]);
|
||||||
// Aktualisiere MediaPlayer ueber parent
|
|
||||||
if (parent && parent.parent && parent.parent.parent) {
|
|
||||||
var mainView = parent.parent.parent;
|
|
||||||
if (mainView && mainView.globalCrackPlayer) {
|
|
||||||
mainView.globalCrackPlayer.volume = volume;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
crackVolumeLabel.text = Math.round(volume * 100) + "%";
|
crackVolumeLabel.text = Math.round(volume * 100) + "%";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user