Improve even more zoom transitions

This commit is contained in:
2024-07-12 22:21:41 +02:00
parent 2b85dce86a
commit 4da0e784ca
11 changed files with 347 additions and 323 deletions

View File

@@ -4,6 +4,10 @@ import QtQuick.Layouts
import EVChargerApp import EVChargerApp
NavigationPage { NavigationPage {
function backPressed() {
return false
}
title: qsTr("Setup or add device") title: qsTr("Setup or add device")
WhiteBox { WhiteBox {

View File

@@ -3,41 +3,28 @@ import QtQuick.Controls.Material
import QtQuick.Layouts import QtQuick.Layouts
import EVChargerApp import EVChargerApp
Loader { AnimatedStackView {
id: loader id: stackView
sourceComponent: deviceList
function backPressed() { function backPressed() {
return loader.item.backPressed() if (stackView.currentItem.backPressed())
return true
if (depth > 1) {
pop()
return true
}
return false
} }
DevicesModel { initialItem: DeviceListScreen {
id: devicesModel onDeviceSelected: (url, password) => stackView.push(deviceScreenComponent, { url, password })
settings: theSettings
Component.onCompleted: start()
} }
Component { Component {
id: deviceList id: deviceScreenComponent
DeviceListScreen {
//onDeviceSelected: (url, password) => loader.setSource("DeviceScreen.qml", { url, password })
onDeviceSelected: function(url, password) {
loader.sourceComponent = deviceScreen
loader.item.url = url;
loader.item.password = password;
}
}
}
Component {
id: deviceScreen
DeviceScreen { DeviceScreen {
onClose: loader.sourceComponent = deviceList onCloseRequested: stackView.pop()
} }
} }
} }

View File

@@ -7,6 +7,10 @@ import EVChargerApp
NavigationPage { NavigationPage {
title: qsTr("App Settings") title: qsTr("App Settings")
function backPressed() {
return false
}
WhiteBox { WhiteBox {
Layout.fillWidth: true Layout.fillWidth: true

View File

@@ -6,6 +6,8 @@ import EVChargerApp
AnimatedStackView { AnimatedStackView {
id: stackView id: stackView
signal closeRequested()
function backPressed() { function backPressed() {
if (depth > 1) { if (depth > 1) {
pop() pop()
@@ -46,7 +48,7 @@ AnimatedStackView {
Layout.fillHeight: true Layout.fillHeight: true
text: qsTr("Devices") text: qsTr("Devices")
onClicked: loader.close() onClicked: closeRequested()
} }
} }
} }

View File

@@ -9,8 +9,7 @@ ColumnLayout {
required property DeviceConnection deviceConnection required property DeviceConnection deviceConnection
function backPressed() { function backPressed() {
close() return false
return true
} }
Connections { Connections {
@@ -47,6 +46,6 @@ ColumnLayout {
Button { Button {
text: qsTr("Cancel") text: qsTr("Cancel")
onClicked: close() onClicked: stackView.pop()
} }
} }

View File

@@ -3,23 +3,16 @@ import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import EVChargerApp import EVChargerApp
AnimatedStackView { BaseNavigationPage {
id: stackView id: page
title: qsTr("Device list")
signal deviceSelected(url: string, password: string) signal deviceSelected(url: string, password: string)
function backPressed() { function backPressed() {
if (depth > 1) {
pop()
return true
}
return false return false
} }
initialItem: BaseNavigationPage {
id: page
title: qsTr("Device list")
CloudUrlsModel { CloudUrlsModel {
id: cloudUrlsModel id: cloudUrlsModel
} }
@@ -306,4 +299,3 @@ AnimatedStackView {
} }
} }
} }
}

View File

@@ -6,7 +6,7 @@ import EVChargerApp
Loader { Loader {
id: loader id: loader
signal close signal closeRequested()
property alias url: theDeviceConnection.url property alias url: theDeviceConnection.url
property alias password: theDeviceConnection.password property alias password: theDeviceConnection.password
@@ -61,6 +61,7 @@ Loader {
MainScreen { MainScreen {
deviceConnection: theDeviceConnection deviceConnection: theDeviceConnection
onCloseRequested: loader.closeRequested()
} }
} }

View File

@@ -16,6 +16,14 @@ ApplicationWindow {
id: theSettings id: theSettings
} }
DevicesModel {
id: devicesModel
settings: theSettings
Component.onCompleted: start()
}
FontLoader { FontLoader {
id: materialIcons id: materialIcons
source: "ui-icons/MaterialIcons-Regular.ttf" source: "ui-icons/MaterialIcons-Regular.ttf"
@@ -33,6 +41,7 @@ ApplicationWindow {
AppInstance { AppInstance {
width: view.width width: view.width
height: view.height
} }
} }
} }

View File

@@ -6,6 +6,8 @@ import EVChargerApp
ColumnLayout { ColumnLayout {
id: mainScreen id: mainScreen
signal closeRequested
required property DeviceConnection deviceConnection required property DeviceConnection deviceConnection
function backPressed() { function backPressed() {
@@ -16,8 +18,7 @@ ColumnLayout {
stackLayout.currentIndex = Qt.binding(() => tabBar.currentIndex) stackLayout.currentIndex = Qt.binding(() => tabBar.currentIndex)
return true return true
} }
loader.close() return false
return true
} }
ApiKeyValueHelper { ApiKeyValueHelper {
@@ -187,6 +188,10 @@ ColumnLayout {
delegate: Loader { delegate: Loader {
source: model.source source: model.source
onLoaded: {
if (item.closeRequested)
item.closeRequested.connect(closeRequested)
}
} }
} }
} }

View File

@@ -60,10 +60,17 @@ WhiteBox {
description: qsTr("Specific energy and time") description: qsTr("Specific energy and time")
onClicked: { onClicked: {
if (selectedMode) if (selectedMode)
stackView.push("DailyTripPage.qml") stackView.push(dailyTripPageComponent)
else else
valueChanger.sendMessage({type: "setValue", key: "lmo", value: 5}) valueChanger.sendMessage({type: "setValue", key: "lmo", value: 5})
} }
Component {
id: dailyTripPageComponent
DailyTripPage {
}
}
} }
BusyIndicator { BusyIndicator {

View File

@@ -54,8 +54,15 @@ NavigationPage {
} }
text: qsTr("(%0) Wi-Fi Scan").arg(wifiScanResult.value == null ? 0 : wifiScanResult.value.length) text: qsTr("(%0) Wi-Fi Scan").arg(wifiScanResult.value == null ? 0 : wifiScanResult.value.length)
onClicked: stackView.push("WiFiScanPage.qml", {wifiScanResult} ) onClicked: stackView.push(wiFiScanPageComponent, {wifiScanResult} )
enabled: wifiScanResult.value != null enabled: wifiScanResult.value != null
Component {
id: wiFiScanPageComponent
WiFiScanPage {
}
}
} }
Button { Button {
@@ -66,8 +73,15 @@ NavigationPage {
} }
text: qsTr("(%0) Wi-Fi Errors").arg(wifiErrorLog.value == null ? 0 : wifiErrorLog.value.length) text: qsTr("(%0) Wi-Fi Errors").arg(wifiErrorLog.value == null ? 0 : wifiErrorLog.value.length)
onClicked: stackView.push("WiFiErrorsPage.qml", {wifiErrorLog} ) onClicked: stackView.push(wiFiErrorsPageComponent, {wifiErrorLog} )
enabled: wifiErrorLog.value != null enabled: wifiErrorLog.value != null
Component {
id: wiFiErrorsPageComponent
WiFiErrorsPage {
}
}
} }
Item { Item {