Skip to content

Commit d25aab0

Browse files
committed
Change the mock mode 'a' key handling to avoid global property
1 parent f7af7ca commit d25aab0

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

data/mock/config/MockDataSimulator.qml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ QtObject {
1212
property bool timersActive: !Global.splashScreenVisible
1313
property int deviceCount
1414
property bool levelsEnabled: true
15+
property bool animationEnabled: true
1516

1617
signal setBatteryRequested(config : var)
1718
signal setAcInputsRequested(config : var)
@@ -111,10 +112,8 @@ QtObject {
111112
}
112113
break
113114
case Qt.Key_A:
114-
if (!!Global) {
115-
Global.animationEnabled = !Global.animationEnabled
116-
event.accepted = true
117-
}
115+
root.animationEnabled = !root.animationEnabled
116+
event.accepted = true
118117
break
119118
case Qt.Key_C:
120119
Theme.colorScheme = Theme.colorScheme == Theme.Dark ? Theme.Light : Theme.Dark
@@ -326,4 +325,18 @@ QtObject {
326325
root.keyPressed(event)
327326
}
328327
}
328+
329+
property Binding _pageAnimationsBinding: Binding {
330+
when: !animationEnabled
331+
target: !!Global.mainView ? Global.mainView : null
332+
property: "allowPageAnimations"
333+
value: false
334+
}
335+
336+
property Binding _statusBarAnimationsBinding: Binding {
337+
when: !animationEnabled
338+
target: !!Global.pageManager ? Global.pageManager.statusBar : null
339+
property: "animationEnabled"
340+
value: false
341+
}
329342
}

pages/MainView.qml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ 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
3029

3130
property int _loadedPages: 0
3231

@@ -340,7 +339,7 @@ Item {
340339
return customButton
341340
}
342341
rightButton: !!root.currentPage ? root.currentPage.topRightButton : VenusOS.StatusBar_RightButton_None
343-
animationEnabled: BackendConnection.applicationVisible && (!!Global ? Global.animationEnabled : true)
342+
animationEnabled: BackendConnection.applicationVisible
344343
color: root.backgroundColor
345344

346345
onLeftButtonClicked: {

0 commit comments

Comments
 (0)