- changed some spelling

- the button to cancel a remote race is a delay button now, to prevent canceling a race by accident
This commit is contained in:
dorian 2019-10-02 19:12:06 +02:00
parent c990791306
commit 99ebdaa992
3 changed files with 95 additions and 30 deletions

View file

@ -208,7 +208,7 @@ Popup {
Column { Column {
id: settings_col id: settings_col
property string title: qsTr("Options") property string title: qsTr("options")
spacing: options_stack.rowSpacing spacing: options_stack.rowSpacing
/*----Connect to external devices----*/ /*----Connect to external devices----*/
@ -217,7 +217,7 @@ Popup {
height: options_stack.delegateHeight height: options_stack.delegateHeight
text: qsTr("Base Station") text: qsTr("base station")
onClicked: { onClicked: {
options_stack.push(connect) options_stack.push(connect)
} }
@ -229,7 +229,7 @@ Popup {
height: options_stack.delegateHeight height: options_stack.delegateHeight
text: qsTr("Start sequence") text: qsTr("start sequence")
onClicked: { onClicked: {
options_stack.push(autostart) options_stack.push(autostart)
@ -239,7 +239,7 @@ Popup {
/*----Style Settings----*/ /*----Style Settings----*/
SmoothSwitchDelegate { SmoothSwitchDelegate {
id: styleDel id: styleDel
text: qsTr("Dark mode") text: qsTr("dark mode")
width: parent.width width: parent.width
height: options_stack.delegateHeight height: options_stack.delegateHeight
@ -262,7 +262,7 @@ Popup {
spacing: options_stack.rowSpacing spacing: options_stack.rowSpacing
property string title: "Autostart" property string title: "autostart"
function updateSetting(key, val, del){ function updateSetting(key, val, del){
speedBackend.writeSetting(key, val) speedBackend.writeSetting(key, val)
@ -278,7 +278,7 @@ Popup {
width: parent.width width: parent.width
height: options_stack.delegateHeight height: options_stack.delegateHeight
text: qsTr("Say 'ready'") text: qsTr("say 'ready'")
checked: parent.loadSetting("ready_en", ready_del) === "true" checked: parent.loadSetting("ready_en", ready_del) === "true"
@ -295,7 +295,7 @@ Popup {
enabled: ready_del.checked enabled: ready_del.checked
text: qsTr("Delay (ms)") text: qsTr("delay (ms)")
inputHint: qsTr("time") inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly inputMethodHints: Qt.ImhFormattedNumbersOnly
@ -312,7 +312,7 @@ Popup {
width: parent.width width: parent.width
height: options_stack.delegateHeight height: options_stack.delegateHeight
text: qsTr("Say 'at your marks'") text: qsTr("say 'at your marks'")
checked: autostart_col.loadSetting("at_marks_en", ready_del) === "true" checked: autostart_col.loadSetting("at_marks_en", ready_del) === "true"
@ -327,7 +327,7 @@ Popup {
width: parent.width width: parent.width
height: options_stack.delegateHeight height: options_stack.delegateHeight
text: qsTr("Delay (ms)") text: qsTr("delay (ms)")
inputHint: qsTr("time") inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly inputMethodHints: Qt.ImhFormattedNumbersOnly
@ -347,15 +347,17 @@ Popup {
id: connect id: connect
Column { Column {
id: connectCol id: connectCol
property string title: qsTr("Base Station") property string title: qsTr("base station")
spacing: options_stack.rowSpacing spacing: options_stack.rowSpacing
property bool baseConnected: speedBackend.baseStationState === "connected" property bool baseConnected: speedBackend.baseStationState === "connected"
opacity: 0
ConnectionDelegate { ConnectionDelegate {
id: connectToBaseDel id: connectToBaseDel
text: status.status === "connected" ? qsTr("Disconnect"): status.status === "disconnected" ? qsTr("Connect"):qsTr("Connecting...") text: status.status === "connected" ? qsTr("disconnect"): status.status === "disconnected" ? qsTr("connect"):qsTr("connecting...")
status: { "status": speedBackend.baseStationState, "progress": 100 } status: { "status": speedBackend.baseStationState, "progress": 100 }
connect: speedBackend.connectBaseStation connect: speedBackend.connectBaseStation
@ -475,7 +477,7 @@ Popup {
width: parent.width width: parent.width
height: options_stack.delegateHeight height: options_stack.delegateHeight
text: qsTr("What is this for?") text: qsTr("what is this for?")
onClicked: { onClicked: {
Qt.openUrlExternally("https://itsblue.de/index.php/speed-climbing?ref=ScStwApp") Qt.openUrlExternally("https://itsblue.de/index.php/speed-climbing?ref=ScStwApp")
@ -499,7 +501,7 @@ Popup {
SmoothSliderDelegate { SmoothSliderDelegate {
id: baseStationVolumeDel id: baseStationVolumeDel
text: qsTr("Volume") text: qsTr("volume")
width: parent.width width: parent.width
height: options_stack.delegateHeight height: options_stack.delegateHeight
@ -528,7 +530,7 @@ Popup {
NextPageDelegate { NextPageDelegate {
id: baseStationConnectionsDel id: baseStationConnectionsDel
text: qsTr("Connected extensions") text: qsTr("connected extensions")
width: parent.width width: parent.width
height: options_stack.delegateHeight height: options_stack.delegateHeight

View file

@ -137,7 +137,7 @@ Window {
width: parent.width * 0.7 width: parent.width * 0.7
text: "Click Start to start" text: "click start to start"
color: appTheme.style.textColor color: appTheme.style.textColor
@ -189,8 +189,8 @@ Window {
elide: "ElideRight" elide: "ElideRight"
color: ["WON"].includes(speedBackend.timers[index]["state"]) ? appTheme.style.successColor : color: ["WON"].includes(speedBackend.timers[index]["state"]) ? appTheme.style.successColor :
["LOST", "FAILED"].includes(speedBackend.timers[index]["state"]) ? appTheme.style.errorColor: ["LOST", "FAILED"].includes(speedBackend.timers[index]["state"]) ? appTheme.style.errorColor:
appTheme.style.textColor appTheme.style.textColor
enabled: speedBackend.timers[index]["state"] !== "DISABLED" enabled: speedBackend.timers[index]["state"] !== "DISABLED"
@ -355,20 +355,22 @@ Window {
// ---------------------------------- // ----------------------------------
// -- Start / Stop / Reset button --- // -- Start / Stop / Reset button ---
// ---------------------------------- // ----------------------------------
FancyButton { DelayButton {
id : startButt id : startButt
text: "start" text: "start"
property int size: app.landscape() ? parent.width * 0.5:parent.height * 0.5 property int size: app.landscape() ? parent.width * 0.5:parent.height * 0.5
property color backgroundColor: appTheme.style.buttonColor
property bool progressControlActivated: speedBackend.baseStationState === "connected" && app.state === "RUNNING"
delay: progressControlActivated ? 2000:0
anchors { anchors {
bottom: parent.bottom bottom: parent.bottom
bottomMargin: app.height * 0.5 - height * 0.5 bottomMargin: app.height * 0.5 - height * 0.5
right: parent.right right: parent.right
rightMargin: app.width * 0.5 - width * 0.5 rightMargin: app.width * 0.5 - width * 0.5
} }
contentItem: Text {
//make text disappear
}
height: app.landscape() ? (size > parent.height * 0.9 ? parent.height * 0.9:size) : (size > parent.width * 0.9 ? parent.width * 0.9:size) height: app.landscape() ? (size > parent.height * 0.9 ? parent.height * 0.9:size) : (size > parent.width * 0.9 ? parent.width * 0.9:size)
width: height width: height
@ -381,8 +383,6 @@ Window {
color: enabled ? appTheme.style.textColor:appTheme.style.disabledTextColor color: enabled ? appTheme.style.textColor:appTheme.style.disabledTextColor
} }
backgroundColor: appTheme.style.buttonColor
Behavior on text { Behavior on text {
//animate a text change //animate a text change
enabled: true enabled: true
@ -392,6 +392,9 @@ Window {
} }
onClicked: { onClicked: {
if(startButt.progressControlActivated && progress < 1.0)
return
startButt.progress = 0
switch(app.state) { switch(app.state) {
case "IDLE": case "IDLE":
app.start() app.start()
@ -404,7 +407,67 @@ Window {
break break
} }
} }
}
contentItem: Text {
}
background: Item {
RectangularGlow {
glowRadius: 0.001
spread: 0.2
color: "black"
visible: true
cornerRadius: startButtBackground.radius
anchors.fill: startButtBackground
scale: 0.75
opacity: Math.pow( control.opacity, 100 )
}
Rectangle {
id: startButtBackground
implicitWidth: 100
implicitHeight: 100
color: startButt.down ? Qt.darker(startButt.backgroundColor, 1.2) : startButt.backgroundColor
radius: size / 2
readonly property real size: Math.min(startButt.width, startButt.height)
width: size
height: size
anchors.fill: parent
Behavior on color {
ColorAnimation {
duration: 200
}
}
Canvas {
id: canvas
anchors.fill: parent
visible: startButt.progressControlActivated
Connections {
target: startButt
onProgressChanged: canvas.requestPaint()
}
onPaint: {
var ctx = getContext("2d")
ctx.clearRect(0, 0, width, height)
ctx.strokeStyle = "grey"
ctx.lineWidth = parent.width * 0.02
ctx.beginPath()
var startAngle = Math.PI * 0.5
var endAngle = startAngle + startButt.progress * Math.PI * 2
ctx.arc(width / 2, height / 2, width / 2 - ctx.lineWidth / 2 - 2, startAngle, endAngle)
ctx.stroke()
}
}
}
}}
ProgressCircle { ProgressCircle {
id: prog id: prog
@ -413,7 +476,7 @@ Window {
scale: startButt.scale scale: startButt.scale
lineWidth: 5 lineWidth: prog.width * 0.02
arcBegin: 0 arcBegin: 0
arcEnd: 360 * speedBackend.nextStartActionDelayProgress arcEnd: 360 * speedBackend.nextStartActionDelayProgress
@ -663,7 +726,7 @@ Window {
} }
PropertyChanges { PropertyChanges {
target: topLa target: topLa
text: "Click Start to start" text: "click start to start"
} }
}, },
@ -701,7 +764,7 @@ Window {
name: "RUNNING" name: "RUNNING"
//state when the timer is running //state when the timer is running
PropertyChanges { target: startButt; enabled: true; PropertyChanges { target: startButt; enabled: true;
text: "stop" text: speedBackend.baseStationState === "connected" ? "cancel":"stop"
anchors.rightMargin: app.landscape() ? parent.width * 0.05:parent.width * 0.5 - startButt.width * 0.5 //put the button more to the right to hide the menu (only in landscape mode) anchors.rightMargin: app.landscape() ? parent.width * 0.05:parent.width * 0.5 - startButt.width * 0.5 //put the button more to the right to hide the menu (only in landscape mode)
anchors.bottomMargin: app.landscape() ? parent.height * 0.5 - startButt.height * 0.5:parent.height * 0.1 //put the button lower to hide the menu (only in portrait mode) anchors.bottomMargin: app.landscape() ? parent.height * 0.5 - startButt.height * 0.5:parent.height * 0.1 //put the button lower to hide the menu (only in portrait mode)
} }

View file

@ -140,7 +140,7 @@ QString SpeedTimer::getText() {
newText = "0.000 sec"; newText = "0.000 sec";
break; break;
case SpeedTimer::WAITING: case SpeedTimer::WAITING:
newText = "Please wait..."; newText = "please wait...";
break; break;
case SpeedTimer::RUNNING: case SpeedTimer::RUNNING:
newText = QString::number( this->getCurrTime() / 1000.0, 'f', 3 ) + " sec"; newText = QString::number( this->getCurrTime() / 1000.0, 'f', 3 ) + " sec";
@ -152,10 +152,10 @@ QString SpeedTimer::getText() {
newText = QString::number( this->stoppedTime / 1000.0, 'f', 3 ) + " sec"; newText = QString::number( this->stoppedTime / 1000.0, 'f', 3 ) + " sec";
break; break;
case SpeedTimer::FAILED: case SpeedTimer::FAILED:
newText = "False Start"; newText = "false start";
break; break;
case SpeedTimer::CANCELLED: case SpeedTimer::CANCELLED:
newText = "Cancelled"; newText = "cancelled";
break; break;
case SpeedTimer::DISABLED: case SpeedTimer::DISABLED:
newText = "---"; newText = "---";