fix: ID Duplikate und Sync-Aufrufe behoben, Settings inline integriert
- Doppelte Timer-ID in Main.qml (initTimer) durch Umbenennung behoben - Settings.qml in Main.qml inline integriert - Sync-Aufrufe durch async Callbacks ersetzt, um Deadlocks zu vermeiden - addImportPath für PyOtherSide wiederhergestellt - color-Property mit Fallback-Wert für Theme-Palette - Version auf 1.0.7 erhöht Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "fortunecookie.darklithium",
|
"name": "fortunecookie.darklithium",
|
||||||
"title": "Fortune Cookie",
|
"title": "Fortune Cookie",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"description": "Glückskeks App mit Sprüchen, Musik und einfacher Listenverwaltung",
|
"description": "Glückskeks App mit Sprüchen, Musik und einfacher Listenverwaltung",
|
||||||
"maintainer": "darklithium <dev@darklithium.de>",
|
"maintainer": "darklithium <dev@darklithium.de>",
|
||||||
"architecture": "all",
|
"architecture": "all",
|
||||||
|
|||||||
+58
-95
@@ -14,12 +14,14 @@ MainView {
|
|||||||
theme.name: "Lomiri.Components.Themes.SuruDark"
|
theme.name: "Lomiri.Components.Themes.SuruDark"
|
||||||
|
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
// PROPERTIES (am Anfang definieren!)
|
// PROPERTIES
|
||||||
// ====================================================================
|
// ====================================================================
|
||||||
property bool fortuneOpened: false
|
property bool fortuneOpened: false
|
||||||
property string currentFortune: ""
|
property string currentFortune: ""
|
||||||
property bool musicPlaying: false
|
property bool musicPlaying: false
|
||||||
property bool appInitialized: false
|
property bool appInitialized: false
|
||||||
|
property real musicVolume: 0.5
|
||||||
|
property real crackVolume: 1.0
|
||||||
|
|
||||||
Python {
|
Python {
|
||||||
id: py
|
id: py
|
||||||
@@ -31,26 +33,15 @@ MainView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property real musicVolume: 0.5
|
// Funktionen
|
||||||
property real crackVolume: 1.0
|
|
||||||
|
|
||||||
// Funktionen zum Setzen der Lautstärke
|
|
||||||
function setMusicVolume(volume) {
|
|
||||||
root.musicVolume = volume;
|
|
||||||
py.call("fortunecookie.set_music_volume", [volume]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCrackVolume(volume) {
|
|
||||||
root.crackVolume = volume;
|
|
||||||
py.call("fortunecookie.set_crack_volume", [volume]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadFortune() {
|
function reloadFortune() {
|
||||||
currentFortune = py.call_sync("fortunecookie.get_current_fortune", []);
|
py.call("fortunecookie.get_current_fortune", [], function(result) {
|
||||||
|
currentFortune = result;
|
||||||
currentFortuneLabel.text = currentFortune;
|
currentFortuneLabel.text = currentFortune;
|
||||||
if (fortuneOpened) {
|
if (fortuneOpened) {
|
||||||
currentFortuneLabel.visible = true;
|
currentFortuneLabel.visible = true;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
@@ -96,59 +87,43 @@ MainView {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
Component.onCompleted: {
|
||||||
// INITIALISIERUNGS-TIMER
|
// Verzögerte Initialisierung
|
||||||
// ============================================================
|
Qt.callLater(function() {
|
||||||
Timer {
|
|
||||||
id: initTimer
|
|
||||||
interval: 1000
|
|
||||||
running: true
|
|
||||||
repeat: false
|
|
||||||
onTriggered: {
|
|
||||||
try {
|
try {
|
||||||
currentFortune = py.call_sync("fortunecookie.get_initial_fortune", []);
|
// Initialisierung mit async Aufrufen
|
||||||
|
py.call("fortunecookie.get_initial_fortune", [], function(result) {
|
||||||
|
currentFortune = result;
|
||||||
currentFortuneLabel.text = currentFortune;
|
currentFortuneLabel.text = currentFortune;
|
||||||
cookieImage.source = Qt.resolvedUrl("../assets/cookie_closed2.png");
|
cookieImage.source = Qt.resolvedUrl("../assets/cookie_closed2.png");
|
||||||
|
});
|
||||||
|
|
||||||
// Musik-Status laden
|
// Musik-Status laden
|
||||||
musicPlaying = py.call_sync("fortunecookie.get_music_enabled", []);
|
py.call("fortunecookie.get_music_enabled", [], function(result) {
|
||||||
|
musicPlaying = result;
|
||||||
console.log("DEBUG QML: musicPlaying geladen: " + musicPlaying);
|
console.log("DEBUG QML: musicPlaying geladen: " + musicPlaying);
|
||||||
|
|
||||||
// MediaPlayer Zustand synchronisieren
|
|
||||||
if (musicPlaying) {
|
if (musicPlaying) {
|
||||||
mediaPlayer.play();
|
mediaPlayer.play();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Volumes laden und Properties setzen
|
// Volumes laden
|
||||||
var musicVol = py.call_sync("fortunecookie.get_music_volume", []);
|
py.call("fortunecookie.get_music_volume", [], function(result) {
|
||||||
var crackVol = py.call_sync("fortunecookie.get_crack_volume", []);
|
root.musicVolume = result;
|
||||||
root.musicVolume = musicVol;
|
mediaPlayer.volume = result;
|
||||||
root.crackVolume = crackVol;
|
});
|
||||||
|
|
||||||
|
py.call("fortunecookie.get_crack_volume", [], function(result) {
|
||||||
|
root.crackVolume = result;
|
||||||
|
crackMediaPlayer.volume = result;
|
||||||
|
});
|
||||||
|
|
||||||
appInitialized = true;
|
appInitialized = true;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("ERROR QML: Initialisierung fehlgeschlagen: " + e);
|
console.log("ERROR QML: Initialisierung fehlgeschlagen: " + e);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// 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 {
|
||||||
@@ -170,11 +145,13 @@ MainView {
|
|||||||
py.call("fortunecookie.open_fortune", [], function() {
|
py.call("fortunecookie.open_fortune", [], function() {
|
||||||
crackMediaPlayer.play();
|
crackMediaPlayer.play();
|
||||||
fortuneOpened = true;
|
fortuneOpened = true;
|
||||||
currentFortune = py.call_sync("fortunecookie.get_current_fortune", []);
|
py.call("fortunecookie.get_current_fortune", [], function(result) {
|
||||||
|
currentFortune = result;
|
||||||
currentFortuneLabel.text = currentFortune;
|
currentFortuneLabel.text = currentFortune;
|
||||||
currentFortuneLabel.visible = true;
|
currentFortuneLabel.visible = true;
|
||||||
cookieImage.source = Qt.resolvedUrl("../assets/cookie_open2.png");
|
cookieImage.source = Qt.resolvedUrl("../assets/cookie_open2.png");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,11 +165,13 @@ MainView {
|
|||||||
py.call("fortunecookie.open_fortune", [], function() {
|
py.call("fortunecookie.open_fortune", [], function() {
|
||||||
crackMediaPlayer.play();
|
crackMediaPlayer.play();
|
||||||
fortuneOpened = true;
|
fortuneOpened = true;
|
||||||
currentFortune = py.call_sync("fortunecookie.get_current_fortune", []);
|
py.call("fortunecookie.get_current_fortune", [], function(result) {
|
||||||
|
currentFortune = result;
|
||||||
currentFortuneLabel.text = currentFortune;
|
currentFortuneLabel.text = currentFortune;
|
||||||
currentFortuneLabel.visible = true;
|
currentFortuneLabel.visible = true;
|
||||||
cookieImage.source = Qt.resolvedUrl("../assets/cookie_open2.png");
|
cookieImage.source = Qt.resolvedUrl("../assets/cookie_open2.png");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
fortuneOpened = false;
|
fortuneOpened = false;
|
||||||
currentFortuneLabel.text = "";
|
currentFortuneLabel.text = "";
|
||||||
@@ -225,17 +204,17 @@ MainView {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
py.call("fortunecookie.get_new_fortune", [], function() {
|
py.call("fortunecookie.get_new_fortune", [], function() {
|
||||||
fortuneOpened = false;
|
fortuneOpened = false;
|
||||||
currentFortune = py.call_sync("fortunecookie.get_current_fortune", []);
|
py.call("fortunecookie.get_current_fortune", [], function(result) {
|
||||||
|
currentFortune = result;
|
||||||
currentFortuneLabel.text = currentFortune;
|
currentFortuneLabel.text = currentFortune;
|
||||||
cookieImage.source = Qt.resolvedUrl("../assets/cookie_closed2.png");
|
cookieImage.source = Qt.resolvedUrl("../assets/cookie_closed2.png");
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================================================================
|
|
||||||
// MUSIK-BUTTON
|
// MUSIK-BUTTON
|
||||||
// ================================================================
|
|
||||||
Label {
|
Label {
|
||||||
id: musicButton
|
id: musicButton
|
||||||
anchors {
|
anchors {
|
||||||
@@ -249,7 +228,7 @@ MainView {
|
|||||||
fontSize: "xxx-large"
|
fontSize: "xxx-large"
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
color: theme.palette.normalText
|
color: theme.palette.normalText || "white"
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
@@ -278,37 +257,27 @@ MainView {
|
|||||||
id: settingsPage
|
id: settingsPage
|
||||||
objectName: 'settingsPage'
|
objectName: 'settingsPage'
|
||||||
|
|
||||||
property bool settingsInitialized: false
|
|
||||||
property var currentFortuneList: "classic"
|
|
||||||
property real musicVolume: 0.5
|
|
||||||
property real crackVolume: 1.0
|
|
||||||
|
|
||||||
header: PageHeader {
|
header: PageHeader {
|
||||||
title: "Einstellungen"
|
title: "Einstellungen"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timer für PyOtherSide Initialisierung
|
Component.onCompleted: {
|
||||||
Timer {
|
// Verzögerte Initialisierung
|
||||||
id: initTimer
|
Qt.callLater(function() {
|
||||||
interval: 1000
|
|
||||||
running: true
|
|
||||||
repeat: false
|
|
||||||
onTriggered: {
|
|
||||||
try {
|
try {
|
||||||
// Einstellungen laden
|
// Einstellungen laden
|
||||||
currentFortuneList = py.call_sync("fortunecookie.get_current_fortune_list", []);
|
py.call("fortunecookie.get_current_fortune_list", [], function(currentFortuneList) {
|
||||||
musicVolume = py.call_sync("fortunecookie.get_music_volume", []);
|
py.call("fortunecookie.get_music_volume", [], function(musicVol) {
|
||||||
crackVolume = py.call_sync("fortunecookie.get_crack_volume", []);
|
py.call("fortunecookie.get_crack_volume", [], function(crackVol) {
|
||||||
|
|
||||||
// Slider Werte setzen
|
// Slider Werte setzen
|
||||||
musicVolumeSlider.value = musicVolume;
|
musicVolumeSlider.value = musicVol;
|
||||||
crackVolumeSlider.value = crackVolume;
|
crackVolumeSlider.value = crackVol;
|
||||||
|
|
||||||
// Spruchlisten ComboBox füllen
|
// Spruchlisten ComboBox füllen
|
||||||
var lists = py.call_sync("fortunecookie.get_fortune_lists_with_description", []);
|
py.call("fortunecookie.get_fortune_lists_with_description", [], function(lists) {
|
||||||
fortuneListCombo.model = lists;
|
fortuneListCombo.model = lists;
|
||||||
|
|
||||||
// Aktuelle Liste auswählen (vergleiche nur den Listennamen, nicht die Beschreibung)
|
// Aktuelle Liste auswählen
|
||||||
for (var i = 0; i < fortuneListCombo.count; i++) {
|
for (var i = 0; i < fortuneListCombo.count; i++) {
|
||||||
var text = fortuneListCombo.textAt(i);
|
var text = fortuneListCombo.textAt(i);
|
||||||
var listName = text.split(" - ")[0];
|
var listName = text.split(" - ")[0];
|
||||||
@@ -317,13 +286,15 @@ MainView {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
settingsInitialized = true;
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("ERROR: Einstellungen nicht geladen: " + e);
|
console.log("ERROR: Einstellungen nicht geladen: " + e);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
@@ -337,10 +308,7 @@ MainView {
|
|||||||
Layout.preferredHeight: units.gu(2)
|
Layout.preferredHeight: units.gu(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
|
||||||
// SPRUCHLISTEN-AUSWAHL
|
// SPRUCHLISTEN-AUSWAHL
|
||||||
// ============================================================
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Spruchliste:"
|
text: "Spruchliste:"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -354,18 +322,15 @@ MainView {
|
|||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
var newListFull = fortuneListCombo.currentText;
|
var newListFull = fortuneListCombo.currentText;
|
||||||
// Extrahiere den Listennamen (Teil vor " - ")
|
|
||||||
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);
|
||||||
|
reloadFortune();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
|
||||||
// LAUTSTÄRKE - MUSIK
|
// LAUTSTÄRKE - MUSIK
|
||||||
// ============================================================
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Musik-Lautstärke:"
|
text: "Musik-Lautstärke:"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -386,6 +351,8 @@ MainView {
|
|||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
var volume = musicVolumeSlider.value;
|
var volume = musicVolumeSlider.value;
|
||||||
|
root.musicVolume = volume;
|
||||||
|
mediaPlayer.volume = volume;
|
||||||
py.call("fortunecookie.set_music_volume", [volume]);
|
py.call("fortunecookie.set_music_volume", [volume]);
|
||||||
musicVolumeLabel.text = Math.round(volume * 100) + "%";
|
musicVolumeLabel.text = Math.round(volume * 100) + "%";
|
||||||
}
|
}
|
||||||
@@ -400,10 +367,7 @@ MainView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
|
||||||
// LAUTSTÄRKE - KNACK-GERÄUSCH
|
// LAUTSTÄRKE - KNACK-GERÄUSCH
|
||||||
// ============================================================
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Knack-Lautstärke:"
|
text: "Knack-Lautstärke:"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -424,6 +388,8 @@ MainView {
|
|||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
var volume = crackVolumeSlider.value;
|
var volume = crackVolumeSlider.value;
|
||||||
|
root.crackVolume = volume;
|
||||||
|
crackMediaPlayer.volume = volume;
|
||||||
py.call("fortunecookie.set_crack_volume", [volume]);
|
py.call("fortunecookie.set_crack_volume", [volume]);
|
||||||
crackVolumeLabel.text = Math.round(volume * 100) + "%";
|
crackVolumeLabel.text = Math.round(volume * 100) + "%";
|
||||||
}
|
}
|
||||||
@@ -438,10 +404,7 @@ MainView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================
|
|
||||||
// ZURÜCK-BUTTON
|
// ZURÜCK-BUTTON
|
||||||
// ============================================================
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: units.gu(10)
|
Layout.preferredHeight: units.gu(10)
|
||||||
|
|||||||
@@ -1,196 +0,0 @@
|
|||||||
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_with_description", []);
|
|
||||||
fortuneListCombo.model = lists;
|
|
||||||
|
|
||||||
// Aktuelle Liste auswählen (vergleiche nur den Listennamen, nicht die Beschreibung)
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsInitialized = true;
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
console.log("ERROR: Einstellungen nicht geladen: " + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: units.gu(2)
|
|
||||||
spacing: units.gu(2)
|
|
||||||
|
|
||||||
// Spacer für Header
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 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 newListFull = fortuneListCombo.currentText;
|
|
||||||
// Extrahiere den Listennamen (Teil vor " - ")
|
|
||||||
var newList = newListFull.split(" - ")[0];
|
|
||||||
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
|
|
||||||
showValue: false
|
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
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
|
|
||||||
showValue: false
|
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user