112 lines
2.6 KiB
QML
112 lines
2.6 KiB
QML
|
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: {
|
||
|
if(currentComponent != currentItem)
|
||
|
mainStack.replace(currentComponent)
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|