132 lines
3.2 KiB
QML
132 lines
3.2 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
|
|
|
|
Material.accent: "#0094ff"
|
|
Material.theme: Material.System
|
|
|
|
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)
|
|
}
|
|
|
|
initialItem: connectedPageComp
|
|
|
|
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.Initing
|
|
PropertyChanges {
|
|
target: mainStack
|
|
currentComponent: connectPageComp
|
|
}
|
|
},
|
|
|
|
State {
|
|
name: OmobiDisplayBackend.Connected
|
|
PropertyChanges {
|
|
target: mainStack
|
|
currentComponent: connectedPageComp
|
|
}
|
|
},
|
|
|
|
State {
|
|
name: OmobiDisplayBackend.Loading
|
|
PropertyChanges {
|
|
target: mainStack
|
|
currentComponent: connectedPageComp
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|