2020-10-11 15:50:13 +02:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.0
|
|
|
|
import QtQuick.Window 2.12
|
|
|
|
import de.itsblue.omobidisplayapp 1.0
|
|
|
|
import de.itsblue.bluetoothleuart 1.0
|
|
|
|
import QtQuick.Controls.Material 2.0
|
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
width: 540
|
|
|
|
height: 960
|
|
|
|
visible: true
|
|
|
|
title: qsTr("Hello World")
|
|
|
|
|
|
|
|
Page {
|
|
|
|
id: app
|
|
|
|
|
|
|
|
state: backend.state
|
|
|
|
|
|
|
|
onStateChanged: {
|
|
|
|
console.log("new state: " + state)
|
|
|
|
}
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
header: ToolBar {
|
|
|
|
Material.background: "white"
|
|
|
|
|
|
|
|
Image {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: parent.height * 0.1
|
|
|
|
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
source: "qrc:/omobi.png"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
OmobiDisplayBackend {
|
|
|
|
id: backend
|
|
|
|
}
|
|
|
|
|
|
|
|
StackView {
|
|
|
|
id: mainStack
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
property Component currentComponent
|
|
|
|
|
|
|
|
onCurrentComponentChanged: {
|
2020-10-11 21:01:21 +02:00
|
|
|
//if(currentComponent != currentItem)
|
|
|
|
//mainStack.replace(currentComponent)
|
2020-10-11 15:50:13 +02:00
|
|
|
}
|
|
|
|
|
2020-10-11 21:01:21 +02:00
|
|
|
initialItem: connectedPageComp
|
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
Component {
|
|
|
|
id: connectPageComp
|
|
|
|
ConnectPage {
|
|
|
|
state: app.state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: connectedPageComp
|
|
|
|
ConnectedPage {
|
|
|
|
state: app.state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: OmobiDisplayBackend.Idle
|
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
|
|
|
name: OmobiDisplayBackend.Scanning
|
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
|
|
|
name: OmobiDisplayBackend.ReadyToConnect
|
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
|
|
|
name: OmobiDisplayBackend.Connecting
|
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
|
|
|
name: OmobiDisplayBackend.Connected
|
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectedPageComp
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|