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
NavigationPage {
function backPressed() {
return false
}
title: qsTr("Setup or add device")
WhiteBox {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -54,8 +54,15 @@ NavigationPage {
}
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
Component {
id: wiFiScanPageComponent
WiFiScanPage {
}
}
}
Button {
@@ -66,8 +73,15 @@ NavigationPage {
}
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
Component {
id: wiFiErrorsPageComponent
WiFiErrorsPage {
}
}
}
Item {