2020-10-11 15:50:13 +02:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.0
|
|
|
|
import QtQuick.Window 2.12
|
2020-10-18 15:08:12 +02:00
|
|
|
import de.itsblue.LedDisplayController 1.0
|
2020-10-11 15:50:13 +02:00
|
|
|
import de.itsblue.bluetoothleuart 1.0
|
|
|
|
import QtQuick.Controls.Material 2.0
|
2020-10-17 21:51:33 +02:00
|
|
|
import QtQuick.Layouts 1.0
|
2020-10-11 15:50:13 +02:00
|
|
|
|
|
|
|
ApplicationWindow {
|
|
|
|
width: 540
|
|
|
|
height: 960
|
|
|
|
visible: true
|
2020-10-17 21:51:33 +02:00
|
|
|
title: qsTr("Itsblue smart display")
|
2020-10-11 15:50:13 +02:00
|
|
|
|
|
|
|
Page {
|
|
|
|
id: app
|
|
|
|
|
|
|
|
state: backend.state
|
|
|
|
|
|
|
|
onStateChanged: {
|
|
|
|
console.log("new state: " + state)
|
|
|
|
}
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
Material.accent: "#0094ff"
|
2020-10-18 15:20:55 +02:00
|
|
|
Material.theme: Material.Light
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
header: ToolBar {
|
2020-10-17 21:51:33 +02:00
|
|
|
id: headerToolBar
|
|
|
|
|
|
|
|
height: 50
|
|
|
|
implicitWidth: parent.width
|
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
Material.background: "white"
|
|
|
|
|
2020-10-17 21:51:33 +02:00
|
|
|
RowLayout {
|
2020-10-11 15:50:13 +02:00
|
|
|
anchors.fill: parent
|
|
|
|
|
2020-10-17 21:51:33 +02:00
|
|
|
ToolButton {
|
|
|
|
id: backToolButton
|
|
|
|
|
|
|
|
enabled: false
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.preferredWidth: height
|
|
|
|
|
|
|
|
opacity: mainStack.currentItem.backButtonVisible ? 1:0
|
|
|
|
|
2020-10-18 01:39:59 +02:00
|
|
|
font.family: fontAwesome.name
|
2020-10-17 21:51:33 +02:00
|
|
|
font.pixelSize: height * 0.6
|
|
|
|
Material.foreground: "black"
|
|
|
|
|
|
|
|
text: "\uf104"
|
|
|
|
|
|
|
|
contentItem: Item {}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
font.pixelSize: parent.font.pixelSize
|
|
|
|
text: parent.text
|
|
|
|
}
|
|
|
|
|
|
|
|
onClicked: mainStack.currentItem.backButtonClicked()
|
|
|
|
}
|
|
|
|
|
2020-10-18 01:39:59 +02:00
|
|
|
Label {
|
2020-10-17 21:51:33 +02:00
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Layout.Center
|
|
|
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
2020-10-18 01:39:59 +02:00
|
|
|
color: "black"
|
2020-10-17 21:51:33 +02:00
|
|
|
text: mainStack.currentItem.title
|
|
|
|
}
|
|
|
|
|
|
|
|
ToolButton {
|
|
|
|
id: actionToolButton
|
|
|
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.preferredWidth: height
|
|
|
|
|
|
|
|
opacity: mainStack.currentItem.actionButtonVisible ? 1:0
|
2020-10-11 15:50:13 +02:00
|
|
|
|
2020-10-18 01:39:59 +02:00
|
|
|
font.family: fontAwesome.name
|
2020-10-17 21:51:33 +02:00
|
|
|
font.pixelSize: height * 0.4
|
|
|
|
Material.foreground: "black"
|
|
|
|
|
|
|
|
flat: true
|
|
|
|
|
|
|
|
text: "\uf013"
|
|
|
|
|
|
|
|
onClicked: mainStack.currentItem.actionButtonClicked()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2020-10-11 15:50:13 +02:00
|
|
|
}
|
|
|
|
|
2020-10-18 15:08:12 +02:00
|
|
|
LedDisplayBackend {
|
2020-10-11 15:50:13 +02:00
|
|
|
id: backend
|
|
|
|
}
|
|
|
|
|
2020-10-17 03:22:37 +02:00
|
|
|
FontLoader {
|
|
|
|
id: fontAwesome
|
2020-10-18 01:39:59 +02:00
|
|
|
source: "qrc:/fa5solid.woff"
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
console.log("Font name: " + fontAwesome.name)
|
|
|
|
}
|
2020-10-17 03:22:37 +02:00
|
|
|
}
|
|
|
|
|
2020-10-18 03:26:02 +02:00
|
|
|
FontLoader {
|
|
|
|
id: fontAwesomeBrands
|
|
|
|
source: "qrc:/fa5brands.woff"
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
console.log("Font name: " + fontAwesome.name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
StackView {
|
|
|
|
id: mainStack
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
property Component currentComponent
|
|
|
|
|
|
|
|
onCurrentComponentChanged: {
|
2020-10-13 01:58:14 +02:00
|
|
|
if(currentComponent != currentItem)
|
|
|
|
mainStack.replace(currentComponent)
|
2020-10-11 15:50:13 +02:00
|
|
|
}
|
|
|
|
|
2020-10-18 01:39:59 +02:00
|
|
|
onCurrentItemChanged: {
|
|
|
|
currentItem.opened()
|
|
|
|
}
|
|
|
|
|
2020-10-14 23:54:12 +02:00
|
|
|
initialItem: connectedPageComp
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-17 21:51:33 +02:00
|
|
|
replaceEnter: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "opacity"
|
|
|
|
from: 0
|
|
|
|
to: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
replaceExit: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "opacity"
|
|
|
|
from: 1
|
|
|
|
to: 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
Component {
|
|
|
|
id: connectPageComp
|
|
|
|
ConnectPage {
|
|
|
|
state: app.state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: connectedPageComp
|
|
|
|
ConnectedPage {
|
2020-10-17 21:51:33 +02:00
|
|
|
opacity: 0
|
2020-10-11 15:50:13 +02:00
|
|
|
state: app.state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Idle
|
2020-10-11 15:50:13 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-18 03:26:02 +02:00
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.BluetoothOff
|
2020-10-18 03:26:02 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.LocationPermissionDenied
|
2020-10-18 03:26:02 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Scanning
|
2020-10-11 15:50:13 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
2020-10-17 21:51:33 +02:00
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.ReadyToConnect
|
2020-10-11 15:50:13 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Connecting
|
2020-10-11 15:50:13 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-17 01:08:23 +02:00
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.AuthenticationRequired
|
2020-10-17 01:08:23 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Authenticating
|
2020-10-17 01:08:23 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-14 23:54:12 +02:00
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Initing
|
2020-10-14 23:54:12 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectPageComp
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-11 15:50:13 +02:00
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Connected
|
2020-10-11 15:50:13 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectedPageComp
|
|
|
|
}
|
2020-10-17 21:51:33 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: headerToolBar
|
|
|
|
state: "open"
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: backToolButton
|
|
|
|
enabled: true
|
|
|
|
}
|
2020-10-14 23:54:12 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
State {
|
2020-10-18 15:08:12 +02:00
|
|
|
name: LedDisplayBackend.Loading
|
2020-10-14 23:54:12 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: mainStack
|
|
|
|
currentComponent: connectedPageComp
|
|
|
|
}
|
2020-10-17 21:51:33 +02:00
|
|
|
PropertyChanges {
|
|
|
|
target: headerToolBar
|
|
|
|
state: "open"
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: backToolButton
|
|
|
|
enabled: true
|
|
|
|
}
|
2020-10-11 15:50:13 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|