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_frontRightSpeed{};
float m_backLeftSpeed{};
float m_backRightSpeed;
float m_backRightSpeed{};
float m_frontLeftDcLink{};
float m_frontRightDcLink{};
float m_backLeftDcLink{};

View File

@@ -124,26 +124,6 @@ GamePage {
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 {
Label {
text: 'iMotMax:'
@@ -169,20 +149,6 @@ GamePage {
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 {
id: remoteControlPage
Text {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: container.top
anchors.bottomMargin: GameSettings.fieldMargin
errorMessage: deviceHandler.error
infoMessage: deviceHandler.info
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
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 {
id: container
anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
width: Math.min(remoteControlPage.width, remoteControlPage.height-GameSettings.fieldHeight*4) - 2*GameSettings.fieldMargin
width: parent.width
height: width
radius: GameSettings.buttonRadius
color: GameSettings.viewColor
@@ -80,32 +109,31 @@ GamePage {
}
Grid {
anchors.top: container.bottom
anchors.left: container.left
anchors.right: container.right
width: parent.width
columns: 2
horizontalItemAlignment: Grid.AlignHCenter
SpinBox {
id: frontLeftRightSpinbox
value: 100
editable: true
from: 0
from: -1000
to: 1000
}
SpinBox {
id: frontUpDownSpinbox
value: 100
value: 75
editable: true
from: 0
from: -1000
to: 1000
}
SpinBox {
id: backLeftRightSpinbox
value: 100
value: 0
editable: true
from: 0
from: -1000
to: 1000
}
@@ -113,8 +141,9 @@ GamePage {
id: backUpDownSpinbox
value: 100
editable: true
from: 0
from: -1000
to: 1000
}
}
}
}

View File

@@ -24,10 +24,20 @@ Item {
}
Image {
id: bobbycar
anchors.centerIn: parent
width: Math.min(parent.height, parent.width)*0.6
height: GameSettings.heightForWidth(width, sourceSize)
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 {

View File

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