2020-10-09 15:44:24 +02:00
|
|
|
import QtQuick 2.12
|
2019-11-02 15:22:50 +01:00
|
|
|
import QtMultimedia 5.8
|
|
|
|
import QtQuick.Window 2.2
|
2019-11-09 23:10:17 +01:00
|
|
|
import QtQuick.Controls 2.12
|
2019-11-02 15:22:50 +01:00
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import QtQuick.Controls.Styles 1.4
|
|
|
|
import QtQuick.Templates 2.12 as T
|
2020-04-19 13:09:46 +02:00
|
|
|
|
2020-05-26 17:57:54 +02:00
|
|
|
|
|
|
|
import de.itsblue.ScStw 2.0
|
|
|
|
import de.itsblue.ScStw.Styling 2.0
|
|
|
|
import de.itsblue.ScStw.Styling.Components 1.0
|
|
|
|
import de.itsblue.ScStwApp 2.0
|
2020-04-19 13:09:46 +02:00
|
|
|
|
2019-11-02 15:22:50 +01:00
|
|
|
import "../components"
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: control
|
|
|
|
|
|
|
|
property string title: qsTr("base station")
|
|
|
|
|
2020-04-19 13:09:46 +02:00
|
|
|
property bool baseConnected: speedBackend.scStwClient.state === ScStwClient.CONNECTED
|
2019-11-02 15:22:50 +01:00
|
|
|
property var parentObj
|
|
|
|
|
|
|
|
opacity: 0
|
|
|
|
|
|
|
|
ConnectionDelegate {
|
|
|
|
id: connectToBaseDel
|
2020-04-19 13:09:46 +02:00
|
|
|
|
|
|
|
function clientStateToString(state) {
|
|
|
|
switch(state) {
|
|
|
|
case ScStwClient.DISCONNECTED:
|
|
|
|
return "disconnected"
|
|
|
|
case ScStwClient.CONNECTING:
|
|
|
|
return "connecting"
|
|
|
|
case ScStwClient.INITIALISING:
|
|
|
|
return "connecting"
|
|
|
|
case ScStwClient.CONNECTED:
|
|
|
|
return "connected"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-02 15:22:50 +01:00
|
|
|
text: status.status === "connected" ? qsTr("disconnect"): status.status === "disconnected" ? qsTr("connect"):qsTr("connecting...")
|
|
|
|
|
2020-04-19 13:09:46 +02:00
|
|
|
status: { "status": clientStateToString(speedBackend.scStwClient.state), "progress": 100 }
|
|
|
|
connect: speedBackend.scStwClient.connectToHost
|
|
|
|
disconnect: speedBackend.scStwClient.closeConnection
|
2019-11-02 15:22:50 +01:00
|
|
|
type: "baseStation"
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: parentObj.delegateHeight
|
|
|
|
}
|
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
Item {
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height * 0.05
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
}
|
|
|
|
|
|
|
|
height: 2
|
|
|
|
color: appTheme.theme.colors.line
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StackView {
|
2019-11-02 15:22:50 +01:00
|
|
|
id: baseStationOptionsLd
|
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
|
2019-11-02 15:22:50 +01:00
|
|
|
property alias parentComp: control
|
2020-10-09 15:44:24 +02:00
|
|
|
property Component sourceComponent: control.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
onSourceComponentChanged: {
|
|
|
|
baseStationOptionsLd.replace(sourceComponent)
|
2019-11-02 15:22:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2020-10-09 15:44:24 +02:00
|
|
|
baseStationOptionsLd.replace(sourceComponent)
|
2019-11-02 15:22:50 +01:00
|
|
|
}
|
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
replaceExit: Transition {
|
|
|
|
ParallelAnimation {
|
|
|
|
id: disappearAnim
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity"
|
|
|
|
to: 0
|
|
|
|
duration: 100
|
|
|
|
}
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
NumberAnimation {
|
|
|
|
property: "scale"
|
|
|
|
to: 0.95
|
|
|
|
duration: 100
|
2019-11-02 15:22:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
replaceEnter: Transition {
|
|
|
|
ParallelAnimation {
|
|
|
|
id: appearAnim
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
NumberAnimation {
|
|
|
|
property: "opacity"
|
|
|
|
from: 0
|
|
|
|
to: 1
|
|
|
|
duration: 100
|
|
|
|
}
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-10-09 15:44:24 +02:00
|
|
|
NumberAnimation {
|
|
|
|
property: "scale"
|
|
|
|
from: 0.95
|
|
|
|
to: 1
|
|
|
|
duration: 100
|
|
|
|
}
|
2019-11-02 15:22:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: baseStationDisconnectedOptionsComp
|
|
|
|
|
|
|
|
Column {
|
|
|
|
id: baseStationDisconnectedOptions
|
|
|
|
|
|
|
|
opacity: 0 // opacity and scale are adjusted by baseStationOptionsLd
|
|
|
|
scale: 0.95
|
|
|
|
|
|
|
|
InputDelegate {
|
|
|
|
id: baseStationIpDel
|
|
|
|
|
|
|
|
text: qsTr("IP")
|
|
|
|
|
|
|
|
inputHint: "IP"
|
2020-10-09 15:44:24 +02:00
|
|
|
inputText: scStwAppSettings.readSetting(ScStwAppSettings.BaseStationIpSetting)
|
2019-11-02 15:22:50 +01:00
|
|
|
inputTextFieldWidth: width * 0.7
|
|
|
|
|
|
|
|
onInputTextChanged: {
|
2020-10-09 15:44:24 +02:00
|
|
|
scStwAppSettings.writeSetting(ScStwAppSettings.BaseStationIpSetting, inputText)
|
2019-11-02 15:22:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: parentObj.delegateHeight
|
|
|
|
|
|
|
|
visible: height > 5
|
|
|
|
|
|
|
|
Behavior on height {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 400
|
|
|
|
easing.type: Easing.Linear
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SmoothItemDelegate {
|
|
|
|
id: baseStationHelpDel
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: parentObj.delegateHeight
|
|
|
|
|
|
|
|
text: qsTr("what is this for?")
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
Qt.openUrlExternally("https://itsblue.de/index.php/speed-climbing?ref=ScStwApp")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: baseStationConnectedOptionsComp
|
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
Column {
|
|
|
|
id: baseStationConnectedOptions
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
width: parentComp.width
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
Label {
|
|
|
|
id: headerLabel
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
width: parent.width
|
|
|
|
height: parentObj.delegateHeight
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2021-01-09 23:13:45 +01:00
|
|
|
visible: true
|
2020-10-09 15:44:24 +02:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
font.pixelSize: height
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
minimumPixelSize: 1
|
2019-11-09 23:10:17 +01:00
|
|
|
|
2020-05-19 12:43:32 +02:00
|
|
|
color: appTheme.theme.colors.text
|
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
text: "ScStwBaseStation"
|
|
|
|
}
|
2019-11-09 23:10:17 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
Label {
|
|
|
|
id: firmwareVersionLabel
|
2019-11-09 23:10:17 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
width: parent.width
|
|
|
|
height: parentObj.delegateHeight * 0.3
|
2019-11-09 23:10:17 +01:00
|
|
|
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
verticalAlignment: Text.AlignTop
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
fontSizeMode: Text.Fit
|
|
|
|
font.pixelSize: height
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
minimumPixelSize: 1
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-19 12:43:32 +02:00
|
|
|
color: appTheme.theme.colors.line
|
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
text: "Firmware: " + speedBackend.scStwClient.getFirmwareVersion() + " API: " + speedBackend.scStwClient.getApiVersion()
|
|
|
|
}
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2021-01-09 23:13:45 +01:00
|
|
|
NextPageDelegate {
|
|
|
|
text: qsTr("settings")
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2020-05-16 13:09:24 +02:00
|
|
|
width: parent.width
|
2020-09-22 15:44:57 +02:00
|
|
|
height: parentObj.delegateHeight * 0.8
|
|
|
|
|
|
|
|
font.pixelSize: height * 0.5
|
2019-11-02 15:22:50 +01:00
|
|
|
|
2021-01-09 23:13:45 +01:00
|
|
|
onClicked: {
|
|
|
|
parentObj.push(baseStationSettings)
|
2020-10-09 15:44:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-22 15:44:57 +02:00
|
|
|
NextPageDelegate {
|
|
|
|
text: qsTr("extensions")
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: parentObj.delegateHeight * 0.8
|
|
|
|
|
|
|
|
font.pixelSize: height * 0.5
|
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
parentObj.push(extensions)
|
|
|
|
}
|
|
|
|
}
|
2019-11-02 15:22:50 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|