lots of improvements and launch screen

This commit is contained in:
2021-07-27 18:40:46 +02:00
parent 55a37897c0
commit 1f29eb8ff1
5 changed files with 128 additions and 123 deletions

View File

@@ -146,7 +146,7 @@ private:
float m_frontLeftSpeed{}; float m_frontLeftSpeed{};
float m_frontRightSpeed{}; float m_frontRightSpeed{};
float m_backLeftSpeed{}; float m_backLeftSpeed{};
float m_backRightSpeed; float m_backRightSpeed{};
float m_frontLeftDcLink{}; float m_frontLeftDcLink{};
float m_frontRightDcLink{}; float m_frontRightDcLink{};
float m_backLeftDcLink{}; float m_backLeftDcLink{};

View File

@@ -124,26 +124,6 @@ GamePage {
font.pixelSize: GameSettings.mediumFontSize font.pixelSize: GameSettings.mediumFontSize
} }
Image {
id: bobbycar
//anchors.horizontalCenter: flickable.horizontalCenter
//anchors.verticalCenter: flickable.bottom
width: parent.width * 0.2
height: width
source: "images/logo.png"
smooth: true
antialiasing: true
SequentialAnimation{
id: bobbycarAnim
running: deviceHandler.alive
loops: Animation.Infinite
alwaysRunToEnd: true
PropertyAnimation { target: bobbycar; property: "scale"; to: 1.2; duration: 500; easing.type: Easing.InQuad }
PropertyAnimation { target: bobbycar; property: "scale"; to: 1.0; duration: 500; easing.type: Easing.OutQuad }
}
}
Row { Row {
Label { Label {
text: 'iMotMax:' text: 'iMotMax:'
@@ -169,20 +149,6 @@ GamePage {
value: 50 value: 50
} }
} }
Repeater {
model: 20
Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
text: "Placeholder"
//visible: deviceHandler.alive
color: GameSettings.textColor
minimumPixelSize: 10
font.pixelSize: GameSettings.mediumFontSize
}
}
} }
} }
} }

View File

@@ -4,21 +4,50 @@ import QtQuick.Controls 2.15
GamePage { GamePage {
id: remoteControlPage id: remoteControlPage
Text { errorMessage: deviceHandler.error
anchors.horizontalCenter: parent.horizontalCenter infoMessage: deviceHandler.info
anchors.bottom: container.top
anchors.bottomMargin: GameSettings.fieldMargin
property real avgSpeed: (deviceHandler.frontLeftSpeed + deviceHandler.frontRightSpeed + deviceHandler.backLeftSpeed + deviceHandler.backRightSpeed) / 4
property real avgVoltage: (deviceHandler.frontVoltage + deviceHandler.backVoltage) / 2
property real totalCurrent: deviceHandler.frontLeftDcLink + deviceHandler.frontRightDcLink + deviceHandler.backLeftDcLink + deviceHandler.backRightDcLink
property real totalPower: totalCurrent * avgVoltage
Column {
anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
width: Math.min(remoteControlPage.width, remoteControlPage.height-GameSettings.fieldHeight*4) - 2*GameSettings.fieldMargin
Column {
width: parent.width
Text {
font.pixelSize: GameSettings.hugeFontSize font.pixelSize: GameSettings.hugeFontSize
color: GameSettings.textColor color: GameSettings.textColor
text: qsTr("REMOTE CONTROL") text: Number(avgSpeed).toLocaleString(Qt.locale()) + 'km/h'
}
Text {
font.pixelSize: GameSettings.hugeFontSize
color: GameSettings.textColor
text: Number(totalCurrent).toLocaleString(Qt.locale()) + 'A'
}
Text {
font.pixelSize: GameSettings.hugeFontSize
color: GameSettings.textColor
text: Number(totalPower>1000?(totalPower/1000):totalPower).toLocaleString(Qt.locale()) + (totalPower > 1000 ? "kW" : "W")
}
Text {
font.pixelSize: GameSettings.hugeFontSize
color: GameSettings.textColor
text: Number(avgVoltage).toLocaleString(Qt.locale()) + 'V'
}
} }
Rectangle { Rectangle {
id: container id: container
anchors.centerIn: parent width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
width: Math.min(remoteControlPage.width, remoteControlPage.height-GameSettings.fieldHeight*4) - 2*GameSettings.fieldMargin
height: width height: width
radius: GameSettings.buttonRadius radius: GameSettings.buttonRadius
color: GameSettings.viewColor color: GameSettings.viewColor
@@ -80,32 +109,31 @@ GamePage {
} }
Grid { Grid {
anchors.top: container.bottom width: parent.width
anchors.left: container.left
anchors.right: container.right
columns: 2 columns: 2
horizontalItemAlignment: Grid.AlignHCenter
SpinBox { SpinBox {
id: frontLeftRightSpinbox id: frontLeftRightSpinbox
value: 100 value: 100
editable: true editable: true
from: 0 from: -1000
to: 1000 to: 1000
} }
SpinBox { SpinBox {
id: frontUpDownSpinbox id: frontUpDownSpinbox
value: 100 value: 75
editable: true editable: true
from: 0 from: -1000
to: 1000 to: 1000
} }
SpinBox { SpinBox {
id: backLeftRightSpinbox id: backLeftRightSpinbox
value: 100 value: 0
editable: true editable: true
from: 0 from: -1000
to: 1000 to: 1000
} }
@@ -113,8 +141,9 @@ GamePage {
id: backUpDownSpinbox id: backUpDownSpinbox
value: 100 value: 100
editable: true editable: true
from: 0 from: -1000
to: 1000 to: 1000
} }
} }
}
} }

View File

@@ -24,10 +24,20 @@ Item {
} }
Image { Image {
id: bobbycar
anchors.centerIn: parent anchors.centerIn: parent
width: Math.min(parent.height, parent.width)*0.6 width: Math.min(parent.height, parent.width)*0.6
height: GameSettings.heightForWidth(width, sourceSize) height: GameSettings.heightForWidth(width, sourceSize)
source: "images/logo.png" source: "images/logo.png"
SequentialAnimation{
id: bobbycarAnim
running: true
loops: Animation.Infinite
alwaysRunToEnd: true
PropertyAnimation { target: bobbycar; property: "scale"; to: 1.2; duration: 500; easing.type: Easing.InQuad }
PropertyAnimation { target: bobbycar; property: "scale"; to: 1.0; duration: 500; easing.type: Easing.OutQuad }
}
} }
Timer { Timer {

View File

@@ -31,7 +31,7 @@ Window {
Connections { Connections {
target: splashLoader.item target: splashLoader.item
onReadyToGo: { function onReadyToGo() {
appLoader.visible = true appLoader.visible = true
appLoader.item.init() appLoader.item.init()
splashLoader.visible = false splashLoader.visible = false