Skip to content

Commit 866c191

Browse files
committed
Change the mock mode 'a' key handling to avoid global property
1 parent 98d2b7f commit 866c191

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

data/mock/config/MockDataSimulator.qml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,17 @@ QtObject {
112112
break
113113
case Qt.Key_A:
114114
if (!!Global) {
115-
Global.animationEnabled = !Global.animationEnabled
115+
if (Global.mainView._statusBar.animationEnabled) {
116+
Global.mainView._statusBar.animationEnabled = false
117+
Global.mainView.allowPageAnimations = false
118+
} else {
119+
Global.mainView._statusBar.animationEnabled = Qt.binding(function() { return BackendConnection.applicationVisible })
120+
Global.mainView.allowPageAnimations = Qt.binding(function() {
121+
return BackendConnection.applicationVisible
122+
&& !Global.mainView._pageStack.busy && (!Global.mainView.swipeView || !Global.mainView.swipeView.flicking)
123+
&& !Global.splashScreenVisible
124+
})
125+
}
116126
event.accepted = true
117127
}
118128
break

pages/MainView.qml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ Item {
2323
// between pages, or when flicking between the main pages. Note that animations are still
2424
// allowed when dragging between the main pages, as it looks odd if animations stop abruptly
2525
// when the user drags slowly between pages.
26-
readonly property bool allowPageAnimations: BackendConnection.applicationVisible
26+
property bool allowPageAnimations: BackendConnection.applicationVisible
2727
&& !pageStack.busy && (!swipeView || !swipeView.flicking)
2828
&& !Global.splashScreenVisible
29-
&& Global.animationEnabled
29+
30+
// to allow the mock data simulator to replace the allowPageAnimations binding.
31+
property alias _statusBar: statusBar
32+
property alias _pageStack: pageStack
3033

3134
property int _loadedPages: 0
3235

@@ -340,7 +343,7 @@ Item {
340343
return customButton
341344
}
342345
rightButton: !!root.currentPage ? root.currentPage.topRightButton : VenusOS.StatusBar_RightButton_None
343-
animationEnabled: BackendConnection.applicationVisible && (!!Global ? Global.animationEnabled : true)
346+
animationEnabled: BackendConnection.applicationVisible
344347
color: root.backgroundColor
345348

346349
onLeftButtonClicked: {

0 commit comments

Comments
 (0)