- removed some things that have moved to the new ScStwAdminClient

- created simple BaseStation info page
This commit is contained in:
Dorian Zedler 2020-05-16 13:09:24 +02:00
parent 7305693275
commit d085f382c7
Signed by: dorian
GPG key ID: 989DE36109AFA354
6 changed files with 55 additions and 310 deletions

View file

@ -1,30 +0,0 @@
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "../components"
ListView {
id: control
property string title: qsTr("connections")
property var parentObj
spacing: parentObj.rowSpacing
boundsBehavior: Flickable.StopAtBounds
model: speedBackend.scStwClient.extensions.length
delegate: ConnectionDelegate {
opacity: 1
width: parent.width
height: parentObj.delegateHeight
text: speedBackend.scStwClient.extensions[index]["name"]
status: {'status': speedBackend.scStwClient.extensions[index]["state"], 'progress': speedBackend.scStwClient.extensions[index]["progress"]}
}
}

View file

@ -21,24 +21,6 @@ Column {
opacity: 0
function doFirmwareUpdate() {
doFirmwareUpdateTimer.start()
}
Timer {
id: doFirmwareUpdateTimer
interval: 10
repeat: false
running: false
onTriggered: {
busyDl.open()
var ret = speedBackend.scStwClient.updateFirmware()
busyDl.displayMessageAndClose(ret ? "OK":"error", ret ? "#6bd43b":"#e03b2f" )
}
}
ConnectionDelegate {
id: connectToBaseDel
@ -188,33 +170,47 @@ Column {
Component {
id: baseStationConnectedOptionsComp
ScrollView{
id: flickable
contentHeight: baseStationConnectedOptions.childrenRect.height
contentWidth: -1
width: parentComp.width
height: control.height - baseStationOptionsLd.y
clip: true
opacity: 0 // opacity and scale are adjusted by baseStationOptionsLd
scale: 0.95
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical: ScrollBar {
parent: flickable.parent
anchors.top: flickable.top
anchors.left: flickable.right
anchors.bottom: flickable.bottom
policy: ScrollBar.AlwaysOn
interactive: false
}
Column {
id: baseStationConnectedOptions
width: parentComp.width
Label {
id: headerLabel
width: parent.width
height: parentObj.delegateHeight
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
fontSizeMode: Text.Fit
font.pixelSize: height
minimumPixelSize: 1
text: "ScStwBaseStation"
}
Label {
id: firmwareVersionLabel
width: parent.width
height: parentObj.delegateHeight * 0.3
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignHCenter
fontSizeMode: Text.Fit
font.pixelSize: height
minimumPixelSize: 1
color: appTheme.style.lineColor
text: "Firmware: " + speedBackend.scStwClient.getFirmwareVersion() + " API: " + speedBackend.scStwClient.getApiVersion()
}
SmoothSliderDelegate {
id: baseStationVolumeDel
text: qsTr("volume")
@ -237,209 +233,6 @@ Column {
}
}
}
NextPageDelegate {
id: baseStationConnectionsDel
text: qsTr("connected extensions")
width: parent.width
height: parentObj.delegateHeight
visible: height > 5
onClicked: {
parentObj.push(baseStationConnections)
}
}
SmoothItemDelegate {
id: connectUsbExtensionsDel
width: parent.width
height: parentObj.delegateHeight
text: "pair extensions"
onClicked: {
busyDl.open()
var ret = speedBackend.scStwClient.pairConnectedUsbExtensions()
busyDl.displayMessageAndClose(ret === 200 ? "OK":"error", ret === 200 ? "#6bd43b":"#e03b2f" )
}
}
SmoothItemDelegate {
id: baseStationUpdateDel
// 0: hidden 1: update firmware 2: sync time
property int mode: speedBackend.scStwClient.isFirmwareUpToDate() ?
(Math.abs(parseInt(speedBackend.scStwClient.getTimeOffset())) > 10000 ? 2:0)
:1
width: parent.width
height: mode > 0 ? parentObj.delegateHeight:0
visible: height > 5
text: mode === 2 ? qsTr("sync time"):qsTr("update firmware")
onClicked: {
if(mode === 1) {
control.doFirmwareUpdate()
}
else if(mode === 2){
busyDl.open()
var ret = speedBackend.scStwClient.updateTime()
busyDl.displayMessageAndClose(ret ? "OK":"error", ret ? "#6bd43b":"#e03b2f" )
}
}
}
Rectangle {
anchors.left: parent.left
width: parent.width
height: 1
color: appTheme.style.lineColor
}
Item {
anchors.left: parent.left
width: parent.width
height: parentObj.delegateHeight * 0.5
Label {
anchors {
top: parent.top
left: parent.left
}
width: parent.width * 0.5
height: parent.height * 0.5
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignLeft
fontSizeMode: Text.Fit
font.pixelSize: height
minimumPixelSize: 1
color: appTheme.style.lineColor
text: "version: " + speedBackend.scStwClient.getFirmwareVersion()
}
Label {
property var date: new Date(new Date().getTime() + parseInt(speedBackend.scStwClient.getTimeOffset()))
anchors {
top: parent.top
right: parent.right
}
width: parent.width * 0.5
height: parent.height
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignRight
fontSizeMode: Text.Fit
minimumPixelSize: 1
font.pixelSize: height
color: appTheme.style.lineColor
text: date.toLocaleDateString() + "\n" + date.toLocaleTimeString()
}
}
}
}
}
Popup {
id: busyDl
property string message: ""
property color messageColor: "transparent"
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
width: app.width
height: app.height
modal: true
dim: true
closePolicy: Dialog.NoAutoClose
function displayMessageAndClose(message, messageColor) {
busyDl.message = message
busyDl.messageColor = messageColor
closeDelayTimer.start()
}
Timer {
id: closeDelayTimer
interval: 1000
repeat: false
running: false
onTriggered: {
busyDl.close()
busyDl.message = ""
busyDl.messageColor = "transparent"
}
}
background: Item {
FancyBusyIndicator {
anchors.centerIn: parent
opacity: busyDl.message === "" ? 1:0
lineColor: "white"
Behavior on opacity { NumberAnimation { duration: 150 } }
}
Label {
anchors.centerIn: parent
width: parent.width * 0.5
height: parent.height * 0.5
opacity: busyDl.message === "" ? 0:1
color: busyDl.messageColor
text: busyDl.message
fontSizeMode: Text.Fit
font.pixelSize: height
minimumPixelSize: 1
font.bold: true
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
Behavior on opacity { NumberAnimation { duration: 150 } }
}
}
T.Overlay.modal: Rectangle {
id: modalRect
color: "#80404040"
Behavior on opacity { NumberAnimation { duration: 150 } }
}
}
}

View file

@ -47,16 +47,6 @@ StackView {
}
/*-----Page to view devices that core connected to the pase startion-----*/
Component{
id: baseStationConnections
SettingsBaseStationConnectionsPage {
parentObj: control
}
}
/*-----Custom animations-----*/
pushEnter: Transition {
NumberAnimation {

View file

@ -23,6 +23,5 @@
<file>SettingsDialog/StartPage.qml</file>
<file>SettingsDialog/SettingsStartSequencePage.qml</file>
<file>SettingsDialog/SettingsBaseStationPage.qml</file>
<file>SettingsDialog/SettingsBaseStationConnectionsPage.qml</file>
</qresource>
</RCC>

View file

@ -223,13 +223,6 @@ void ScStwAppBackend::reloadRaceSettings() {
}
// TODO: move to client
/*
QVariantMap ScStwAppBackend::getBaseStationProperties() {
QVariantMap firmware = {{"version", this->scStwClient->getFirmwareVersion()}, {"upToDate", this->scStwClient->isFirmwareUpToDate()}};
return {{"firmware", firmware}, {"timeOffset", this->scStwClient->getTimeOffset()}};
}
*/
void ScStwAppBackend::reloadBaseStationIpAdress() {
this->scStwClient->setIP(pGlobalAppSettings->loadSetting("baseStationIpAdress"));
}

@ -1 +1 @@
Subproject commit 2893d341c2542ffae2c88cb976763fa599ff6622
Subproject commit 3f199b151131775e572c964bd3bb64120940c153