Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MobileUI] Work around some issues with the initial swipe index #302

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 14 additions & 3 deletions qml/MobileUI.qml
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,29 @@ 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: []

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 {
Expand Down Expand Up @@ -204,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
Expand Down