lots of improvements and launch screen
This commit is contained in:
@ -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{};
|
||||||
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,117 +4,146 @@ 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
|
|
||||||
|
|
||||||
font.pixelSize: GameSettings.hugeFontSize
|
property real avgSpeed: (deviceHandler.frontLeftSpeed + deviceHandler.frontRightSpeed + deviceHandler.backLeftSpeed + deviceHandler.backRightSpeed) / 4
|
||||||
color: GameSettings.textColor
|
property real avgVoltage: (deviceHandler.frontVoltage + deviceHandler.backVoltage) / 2
|
||||||
text: qsTr("REMOTE CONTROL")
|
property real totalCurrent: deviceHandler.frontLeftDcLink + deviceHandler.frontRightDcLink + deviceHandler.backLeftDcLink + deviceHandler.backRightDcLink
|
||||||
}
|
property real totalPower: totalCurrent * avgVoltage
|
||||||
|
|
||||||
Rectangle {
|
Column {
|
||||||
id: container
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
width: Math.min(remoteControlPage.width, remoteControlPage.height-GameSettings.fieldHeight*4) - 2*GameSettings.fieldMargin
|
width: Math.min(remoteControlPage.width, remoteControlPage.height-GameSettings.fieldHeight*4) - 2*GameSettings.fieldMargin
|
||||||
height: width
|
|
||||||
radius: GameSettings.buttonRadius
|
|
||||||
color: GameSettings.viewColor
|
|
||||||
|
|
||||||
property real remoteControlFrontLeft: (handler.relativeX * frontLeftRightSpinbox.value) + (handler.relativeY * frontUpDownSpinbox.value)
|
Column {
|
||||||
property real remoteControlFrontRight: (-handler.relativeX * frontLeftRightSpinbox.value) + (handler.relativeY * frontUpDownSpinbox.value)
|
width: parent.width
|
||||||
property real remoteControlBackLeft: (handler.relativeX * backLeftRightSpinbox.value) + (handler.relativeY * backUpDownSpinbox.value)
|
|
||||||
property real remoteControlBackRight: (-handler.relativeX * backLeftRightSpinbox.value) + (handler.relativeY * backUpDownSpinbox.value)
|
|
||||||
|
|
||||||
onRemoteControlFrontLeftChanged: deviceHandler.remoteControlFrontLeft = remoteControlFrontLeft
|
Text {
|
||||||
onRemoteControlFrontRightChanged: deviceHandler.remoteControlFrontRight = remoteControlFrontRight
|
font.pixelSize: GameSettings.hugeFontSize
|
||||||
onRemoteControlBackLeftChanged: deviceHandler.remoteControlBackLeft = remoteControlBackLeft
|
color: GameSettings.textColor
|
||||||
onRemoteControlBackRightChanged: deviceHandler.remoteControlBackRight = remoteControlBackRight
|
text: Number(avgSpeed).toLocaleString(Qt.locale()) + 'km/h'
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Text {
|
||||||
parent: container
|
font.pixelSize: GameSettings.hugeFontSize
|
||||||
color: "white"
|
color: GameSettings.textColor
|
||||||
anchors.centerIn: parent
|
text: Number(totalCurrent).toLocaleString(Qt.locale()) + 'A'
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
}
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: 20
|
|
||||||
height: width
|
|
||||||
radius: width / 2
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.top: parent.top
|
font.pixelSize: GameSettings.hugeFontSize
|
||||||
minimumPixelSize: 10
|
color: GameSettings.textColor
|
||||||
font.pixelSize: GameSettings.mediumFontSize
|
text: Number(totalPower>1000?(totalPower/1000):totalPower).toLocaleString(Qt.locale()) + (totalPower > 1000 ? "kW" : "W")
|
||||||
color: GameSettings.textColor
|
}
|
||||||
text: {
|
|
||||||
return "x:" + handler.relativeX.toFixed(1) + " y:" + handler.relativeY.toFixed(1) + "\n" +
|
Text {
|
||||||
"fl:" + Math.round(container.remoteControlFrontLeft) + " fr:" + Math.round(container.remoteControlFrontRight) + "\n" +
|
font.pixelSize: GameSettings.hugeFontSize
|
||||||
"bl:" + Math.round(container.remoteControlBackLeft) + " br:" + Math.round(container.remoteControlBackRight);
|
color: GameSettings.textColor
|
||||||
|
text: Number(avgVoltage).toLocaleString(Qt.locale()) + 'V'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PointHandler {
|
Rectangle {
|
||||||
id: handler
|
id: container
|
||||||
//acceptedDevices: PointerDevice.TouchScreen
|
width: parent.width
|
||||||
property real clampedX: handler.active ? Math.min(Math.max(handler.point.position.x, 0), container.width) : (container.width / 2)
|
height: width
|
||||||
property real clampedY: handler.active ? Math.min(Math.max(handler.point.position.y, 0), container.height) : (container.height / 2)
|
radius: GameSettings.buttonRadius
|
||||||
property real relativeX: ((clampedX / container.width) - 0.5) * 2
|
color: GameSettings.viewColor
|
||||||
property real relativeY: ((clampedY / container.height) - 0.5) * -2
|
|
||||||
|
|
||||||
target: Rectangle {
|
property real remoteControlFrontLeft: (handler.relativeX * frontLeftRightSpinbox.value) + (handler.relativeY * frontUpDownSpinbox.value)
|
||||||
|
property real remoteControlFrontRight: (-handler.relativeX * frontLeftRightSpinbox.value) + (handler.relativeY * frontUpDownSpinbox.value)
|
||||||
|
property real remoteControlBackLeft: (handler.relativeX * backLeftRightSpinbox.value) + (handler.relativeY * backUpDownSpinbox.value)
|
||||||
|
property real remoteControlBackRight: (-handler.relativeX * backLeftRightSpinbox.value) + (handler.relativeY * backUpDownSpinbox.value)
|
||||||
|
|
||||||
|
onRemoteControlFrontLeftChanged: deviceHandler.remoteControlFrontLeft = remoteControlFrontLeft
|
||||||
|
onRemoteControlFrontRightChanged: deviceHandler.remoteControlFrontRight = remoteControlFrontRight
|
||||||
|
onRemoteControlBackLeftChanged: deviceHandler.remoteControlBackLeft = remoteControlBackLeft
|
||||||
|
onRemoteControlBackRightChanged: deviceHandler.remoteControlBackRight = remoteControlBackRight
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
parent: container
|
parent: container
|
||||||
color: "red"
|
color: "white"
|
||||||
visible: handler.active
|
anchors.centerIn: parent
|
||||||
x: handler.clampedX - width / 2
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
y: handler.clampedY - height / 2
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: 50
|
width: 20
|
||||||
height: width
|
height: width
|
||||||
radius: width / 2
|
radius: width / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
onActiveChanged: deviceHandler.remoteControlActive = handler.active
|
Text {
|
||||||
}
|
anchors.top: parent.top
|
||||||
}
|
minimumPixelSize: 10
|
||||||
|
font.pixelSize: GameSettings.mediumFontSize
|
||||||
|
color: GameSettings.textColor
|
||||||
|
text: {
|
||||||
|
return "x:" + handler.relativeX.toFixed(1) + " y:" + handler.relativeY.toFixed(1) + "\n" +
|
||||||
|
"fl:" + Math.round(container.remoteControlFrontLeft) + " fr:" + Math.round(container.remoteControlFrontRight) + "\n" +
|
||||||
|
"bl:" + Math.round(container.remoteControlBackLeft) + " br:" + Math.round(container.remoteControlBackRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Grid {
|
PointHandler {
|
||||||
anchors.top: container.bottom
|
id: handler
|
||||||
anchors.left: container.left
|
//acceptedDevices: PointerDevice.TouchScreen
|
||||||
anchors.right: container.right
|
property real clampedX: handler.active ? Math.min(Math.max(handler.point.position.x, 0), container.width) : (container.width / 2)
|
||||||
columns: 2
|
property real clampedY: handler.active ? Math.min(Math.max(handler.point.position.y, 0), container.height) : (container.height / 2)
|
||||||
|
property real relativeX: ((clampedX / container.width) - 0.5) * 2
|
||||||
|
property real relativeY: ((clampedY / container.height) - 0.5) * -2
|
||||||
|
|
||||||
SpinBox {
|
target: Rectangle {
|
||||||
id: frontLeftRightSpinbox
|
parent: container
|
||||||
value: 100
|
color: "red"
|
||||||
editable: true
|
visible: handler.active
|
||||||
from: 0
|
x: handler.clampedX - width / 2
|
||||||
to: 1000
|
y: handler.clampedY - height / 2
|
||||||
|
width: 50
|
||||||
|
height: width
|
||||||
|
radius: width / 2
|
||||||
|
}
|
||||||
|
|
||||||
|
onActiveChanged: deviceHandler.remoteControlActive = handler.active
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SpinBox {
|
Grid {
|
||||||
id: frontUpDownSpinbox
|
width: parent.width
|
||||||
value: 100
|
columns: 2
|
||||||
editable: true
|
horizontalItemAlignment: Grid.AlignHCenter
|
||||||
from: 0
|
|
||||||
to: 1000
|
|
||||||
}
|
|
||||||
|
|
||||||
SpinBox {
|
SpinBox {
|
||||||
id: backLeftRightSpinbox
|
id: frontLeftRightSpinbox
|
||||||
value: 100
|
value: 100
|
||||||
editable: true
|
editable: true
|
||||||
from: 0
|
from: -1000
|
||||||
to: 1000
|
to: 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
SpinBox {
|
SpinBox {
|
||||||
id: backUpDownSpinbox
|
id: frontUpDownSpinbox
|
||||||
value: 100
|
value: 75
|
||||||
editable: true
|
editable: true
|
||||||
from: 0
|
from: -1000
|
||||||
to: 1000
|
to: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: backLeftRightSpinbox
|
||||||
|
value: 0
|
||||||
|
editable: true
|
||||||
|
from: -1000
|
||||||
|
to: 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
SpinBox {
|
||||||
|
id: backUpDownSpinbox
|
||||||
|
value: 100
|
||||||
|
editable: true
|
||||||
|
from: -1000
|
||||||
|
to: 1000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
@ -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
|
||||||
|
Reference in New Issue
Block a user