Skip to content

Commit

Permalink
Change the mock mode 'a' key handling to avoid global property
Browse files Browse the repository at this point in the history
  • Loading branch information
chriadam committed Jun 5, 2024
1 parent fb4ba6c commit ba3e0b0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
21 changes: 17 additions & 4 deletions data/mock/config/MockDataSimulator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ QtObject {
property bool timersActive: !Global.splashScreenVisible
property int deviceCount
property bool levelsEnabled: true
property bool animationEnabled: true

signal setBatteryRequested(config : var)
signal setAcInputsRequested(config : var)
Expand Down Expand Up @@ -111,10 +112,8 @@ QtObject {
}
break
case Qt.Key_A:
if (!!Global) {
Global.animationEnabled = !Global.animationEnabled
event.accepted = true
}
root.animationEnabled = !root.animationEnabled
event.accepted = true
break
case Qt.Key_C:
Theme.colorScheme = Theme.colorScheme == Theme.Dark ? Theme.Light : Theme.Dark
Expand Down Expand Up @@ -326,4 +325,18 @@ QtObject {
root.keyPressed(event)
}
}

property Binding _pageAnimationsBinding: Binding {
when: !animationEnabled
target: !!Global.mainView ? Global.mainView : null
property: "allowPageAnimations"
value: false
}

property Binding _statusBarAnimationsBinding: Binding {
when: !animationEnabled
target: !!Global.pageManager ? Global.pageManager.statusBar : null
property: "animationEnabled"
value: false
}
}
5 changes: 2 additions & 3 deletions pages/MainView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ Item {
// between pages, or when flicking between the main pages. Note that animations are still
// allowed when dragging between the main pages, as it looks odd if animations stop abruptly
// when the user drags slowly between pages.
readonly property bool allowPageAnimations: BackendConnection.applicationVisible
property bool allowPageAnimations: BackendConnection.applicationVisible
&& !pageStack.busy && (!swipeView || !swipeView.flicking)
&& !Global.splashScreenVisible
&& Global.animationEnabled

property int _loadedPages: 0

Expand Down Expand Up @@ -340,7 +339,7 @@ Item {
return customButton
}
rightButton: !!root.currentPage ? root.currentPage.topRightButton : VenusOS.StatusBar_RightButton_None
animationEnabled: BackendConnection.applicationVisible && (!!Global ? Global.animationEnabled : true)
animationEnabled: BackendConnection.applicationVisible
color: root.backgroundColor

onLeftButtonClicked: {
Expand Down

0 comments on commit ba3e0b0

Please sign in to comment.