From 030ed9d827439bdd90c9f9c06aa88757092c1052 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Tue, 10 Jan 2023 21:26:06 +0100 Subject: [PATCH 1/2] [MobileUI] Work around some issues with the initial swipe index Sometimes ListView doesn't react to positionViewAtIndex even after completion. Set currentIndex to the drawer works around that. To avoid seeing the initial state briefly, make it invisible at first. Additionally, show the config page for the initial setup. --- qml/MobileUI.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/qml/MobileUI.qml b/qml/MobileUI.qml index 05138f02..9f833808 100644 --- a/qml/MobileUI.qml +++ b/qml/MobileUI.qml @@ -139,6 +139,13 @@ ApplicationWindow { model: [ "MobileUIConfig.qml", "MobileUIDrawer.qml", "MobileUIFront.qml" ] + // Start with the drawer open, otherwise positionViewAtIndex does sometimes + // not work... + currentIndex: 1 + + // Stay invisible until the initial index is set + visible: false + /* The delegates write their X offsets into this array, so that we can use them as values for contentX. */ property var pageX: [] @@ -146,12 +153,15 @@ ApplicationWindow { Component.onCompleted: { // Open drawer if emulation does not start automatically Emu.useDefaultKit(); // We need this here to get the default values - if(!Emu.autostart - || Emu.getBoot1Path() === "" + if(Emu.getBoot1Path() === "" || Emu.getFlashPath() === "") + positionViewAtIndex(0, ListView.SnapPosition); + else if(!Emu.autostart) positionViewAtIndex(1, ListView.SnapPosition); else positionViewAtIndex(2, ListView.SnapPosition); + + visible = true } NumberAnimation { From fb39f9355813bdf8ab0c831370e1d6a41b9105ca Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Tue, 10 Jan 2023 21:35:01 +0100 Subject: [PATCH 2/2] [MobileUI] Don't darken the drawer Somehow it looks odd if an area gets brighter while an adjacent area gets darker. Avoid that by just not darkening the drawer. --- qml/MobileUI.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qml/MobileUI.qml b/qml/MobileUI.qml index 9f833808..09a476ab 100644 --- a/qml/MobileUI.qml +++ b/qml/MobileUI.qml @@ -214,7 +214,8 @@ ApplicationWindow { var xOffset = listView.contentX - parent.x; return Math.min(Math.max(0.0, Math.abs(xOffset) / listView.width), 0.6); } - visible: opacity > 0.01 + // Don't darken the drawer + visible: modelData === "MobileUIDrawer.qml" ? false : (opacity > 0.01) MouseArea { anchors.fill: parent