2018-08-12 20:51:57 +02:00
/ *
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
Copyright ( C ) 2018 Itsblue Development - Dorian Zeder
This program is free software: you can redistribute it and / or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation , version 3 of the License .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU Affero General Public License for more details .
You should have received a copy of the GNU Affero General Public License
along with this program . If not , see < https: //www.gnu.org/licenses/>.
* /
2018-07-17 19:17:25 +02:00
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick . Window 2.2
import QtQuick . Controls 2.2
2019-03-08 15:36:32 +01:00
import QtGraphicalEffects 1.0
2018-08-28 23:03:35 +02:00
import "."
import "./components"
2018-07-22 21:08:11 +02:00
//import QtQuick.Layouts 1.11
2018-07-22 16:47:55 +02:00
2019-03-07 17:18:24 +01:00
import com . itsblue . speedclimbingstopwatch 2.0
2018-07-17 19:17:25 +02:00
Window {
visible: true
width: 540
height: 960
2018-07-18 14:06:04 +02:00
title: qsTr ( "Speedclimbing stw" )
2018-07-17 19:17:25 +02:00
property date currentTime: new Date ( )
property int millis: 0
Page {
id:root
anchors.fill: parent
property double startTime: 0
property double stoppedTime: 0
2018-07-26 14:54:11 +02:00
property double currTime
2018-07-17 19:17:25 +02:00
2018-08-14 17:07:42 +02:00
//set default state to IDLE
2018-07-22 16:47:55 +02:00
state: "IDLE"
2018-08-28 23:03:35 +02:00
Rectangle {
id: backgroundRect
anchors.fill: parent
2019-03-08 18:03:27 +01:00
color: appTheme . style . backgroundColor
2019-03-24 21:31:59 +01:00
Behavior on color {
ColorAnimation {
duration: 200
}
}
2018-07-25 00:32:20 +02:00
}
2019-03-07 17:18:24 +01:00
SpeedBackend {
id: speedBackend
onStateChanged: {
var stateString
switch ( state ) {
case 0 :
stateString = "IDLE"
break ;
case 1 :
stateString = "STARTING"
2019-03-08 15:36:32 +01:00
settingsDialog . close ( )
2019-03-07 17:18:24 +01:00
break ;
case 2 :
stateString = "RUNNING"
2019-03-08 15:36:32 +01:00
settingsDialog . close ( )
2019-03-07 17:18:24 +01:00
break ;
case 3 :
stateString = "STOPPED"
2019-03-08 15:36:32 +01:00
settingsDialog . close ( )
2019-03-07 17:18:24 +01:00
}
root . state = stateString
2018-10-04 18:35:29 +02:00
}
2018-08-28 23:03:35 +02:00
}
2019-03-08 18:03:27 +01:00
AppTheme {
id: appTheme
}
2018-07-22 16:47:55 +02:00
/ * - - - - - - - - - - - - - - - - - - - - - - - -
Timer text an upper line
-- -- -- -- -- -- -- -- -- -- -- -- * /
2019-03-08 15:36:32 +01:00
RectangularGlow {
id: effect_2
glowRadius: 7
spread: 0.02
color: "black"
opacity: 0.18
anchors.fill: time_container
scale: 1
}
2018-07-17 19:17:25 +02:00
Item {
id: time_container
anchors {
top: parent . top
left: parent . left
2018-07-22 16:47:55 +02:00
right: root . landscape ( ) ? startButt.left: parent . right
bottom: root . landscape ( ) ? parent.bottom: startButt . top
bottomMargin: root . landscape ( ) ? undefined: parent . height * 0.1
rightMargin: root . landscape ( ) ? parent . width * 0.05 : 0
2018-07-17 19:17:25 +02:00
}
2018-08-28 23:03:35 +02:00
Rectangle {
anchors.fill: parent
2019-03-08 18:03:27 +01:00
color: appTheme . style . menuColor
2019-03-24 21:31:59 +01:00
Behavior on color {
ColorAnimation {
duration: 200
}
}
2018-08-28 23:03:35 +02:00
}
2019-03-07 17:18:24 +01:00
Label {
2018-10-04 18:35:29 +02:00
id: timer_1
2018-07-17 19:17:25 +02:00
anchors.centerIn: parent
2018-07-22 16:47:55 +02:00
elide: "ElideRight"
2019-03-08 18:03:27 +01:00
color: appTheme . style . textColor
2018-10-04 18:35:29 +02:00
2019-03-07 17:18:24 +01:00
font.pixelSize: 100
2018-10-14 18:39:39 +02:00
2019-03-07 17:18:24 +01:00
text: speedBackend . timers [ 0 ] [ "text" ]
2018-10-04 18:35:29 +02:00
2019-03-07 17:18:24 +01:00
Behavior on text {
enabled: root . state !== "RUNNING"
FadeAnimation {
target: timer_1
2018-08-14 17:07:42 +02:00
}
}
2018-07-17 19:17:25 +02:00
}
2018-08-29 18:33:39 +02:00
Label {
id: react_time
2019-03-07 17:18:24 +01:00
property int rtime: speedBackend . timers [ 0 ] [ "reacttime" ]
2018-08-29 18:33:39 +02:00
text: qsTr ( "reaction time (ms): " ) + Math . round ( rtime )
2019-03-07 17:18:24 +01:00
opacity: ( root . state === "RUNNING" || root . state === "STOPPED" ) && rtime !== 0 ? 1 : 0
2019-03-08 18:03:27 +01:00
color: appTheme . style . textColor
2018-08-29 18:33:39 +02:00
anchors {
horizontalCenter: parent . horizontalCenter
2018-10-04 18:35:29 +02:00
top: timer_1 . bottom
2018-08-29 18:33:39 +02:00
topMargin: parent . height * 0.1
}
}
2018-08-02 12:50:55 +02:00
}
2019-03-24 21:16:16 +01:00
Item {
id: connectionIconContainer
anchors {
top: parent . top
left: parent . left
right: parent . right
bottom: parent . bottom
bottomMargin: root . landscape ( ) ? 0 : parent . height * 0.8
rightMargin: root . landscape ( ) ? parent . width * 0.8 : 0
}
ConnectionIcon {
id: baseConnConnIcon
status: speedBackend . baseStationState
2019-03-24 21:31:59 +01:00
source: appTheme . style . baseStationIcon
2019-03-24 21:16:16 +01:00
anchors {
top: parent . top
topMargin: 10
left: parent . left
leftMargin: 10
}
scale: 1.3
height: ! root . landscape ( ) ? parent . height * 0.3 : parent . width * 0.3
}
ConnectionIcon {
id: buzzerConnIcon
status: speedBackend . baseStationConnections [ 1 ] [ "state" ]
2019-03-24 21:31:59 +01:00
source: appTheme . style . buzzerIcon
2019-03-24 21:16:16 +01:00
anchors {
top: parent . top
topMargin: 10
left: baseConnConnIcon . right
leftMargin: 1
}
height: ! root . landscape ( ) ? parent . height * 0.17 : parent . width * 0.17
}
ConnectionIcon {
id: startpadConnIcon
status: speedBackend . baseStationConnections [ 0 ] [ "state" ]
2019-03-24 21:31:59 +01:00
source: appTheme . style . startpadIcon
2019-03-24 21:16:16 +01:00
anchors {
top: parent . top
topMargin: 10
left: buzzerConnIcon . right
leftMargin: 0
}
height: ! root . landscape ( ) ? parent . height * 0.17 : parent . width * 0.17
}
}
2018-08-02 12:50:55 +02:00
Rectangle {
id: upper_line
2018-07-22 16:47:55 +02:00
width: root . landscape ( ) ? 1 : parent . width
height: root . landscape ( ) ? parent.height: 1
2019-03-08 18:03:27 +01:00
color: appTheme . style . lineColor
2018-07-22 16:47:55 +02:00
anchors.left: root . landscape ( ) ? time_container.right: parent . left
anchors.top: root . landscape ( ) ? parent.top: time_container . bottom
anchors.bottom: root . landscape ( ) ? parent.bottom: undefined
2019-03-08 15:36:32 +01:00
visible: false
2018-07-17 19:17:25 +02:00
}
2018-07-22 16:47:55 +02:00
/ * - - - - - - - - - - - - - - - - - - - - - -
2018-08-14 17:07:42 +02:00
Start / Stop / Reset button
2018-07-22 16:47:55 +02:00
-- -- -- -- -- -- -- -- -- -- -- * /
2019-03-08 15:36:32 +01:00
FancyButton {
2018-07-25 00:32:20 +02:00
id : startButt
2018-07-17 19:17:25 +02:00
2018-08-14 17:07:42 +02:00
text: qsTr ( "start" )
2018-07-22 16:47:55 +02:00
property int size: root . landscape ( ) ? parent . width * 0.5 : parent . height * 0.5
2018-07-17 19:17:25 +02:00
anchors {
bottom: parent . bottom
2018-07-25 00:32:20 +02:00
bottomMargin: root . height * 0.5 - height * 0.5
2018-07-22 16:47:55 +02:00
right: parent . right
2018-07-25 00:32:20 +02:00
rightMargin: root . width * 0.5 - width * 0.5
}
contentItem: Text {
//make text disappear
2018-07-17 19:17:25 +02:00
}
2018-07-22 16:47:55 +02:00
height: root . landscape ( ) ? size > parent . height * 0.9 ? parent . height * 0.9 : size : size
width: root . landscape ( ) ? size : size > parent . width * 0.9 ? parent . width * 0.9 : size
2018-07-17 19:17:25 +02:00
2019-03-08 15:36:32 +01:00
Label {
id: startButt_text
text: startButt . text
anchors.centerIn: parent
font.pixelSize: parent . height * 0.16
font.family: "Helvetica"
2019-03-08 18:03:27 +01:00
color: enabled ? appTheme.style.textColor: appTheme . style . disabledTextColor
2018-07-17 19:17:25 +02:00
}
2018-07-22 16:47:55 +02:00
2019-03-08 18:03:27 +01:00
backgroundColor: appTheme . style . buttonColor
2019-03-08 15:36:32 +01:00
2018-08-14 17:07:42 +02:00
Behavior on text {
//animate a text change
enabled: true
FadeAnimation {
target: startButt_text
}
}
2018-07-25 00:32:20 +02:00
onClicked: {
switch ( root . state ) {
case "IDLE" :
2018-08-14 17:07:42 +02:00
root . start ( )
2018-07-25 00:32:20 +02:00
break
case "RUNNING" :
2019-03-07 17:18:24 +01:00
root . stop ( 0 )
2018-07-25 00:32:20 +02:00
break
case "STOPPED" :
2018-08-14 17:07:42 +02:00
root . reset ( )
2018-07-25 00:32:20 +02:00
break
2018-07-22 16:47:55 +02:00
}
}
2018-07-28 21:17:41 +02:00
}
ProgressCircle {
id: prog
anchors.fill: startButt
2019-03-07 17:18:24 +01:00
opacity: root . state === "STARTING" || root . state === "IDLE" ? 1 : 0
2019-03-08 15:36:32 +01:00
scale: startButt . scale
2018-07-28 21:17:41 +02:00
lineWidth: 5
2019-03-07 17:18:24 +01:00
2018-07-28 21:17:41 +02:00
arcBegin: 0
2019-03-07 17:18:24 +01:00
arcEnd: 360 * speedBackend . nextStartActionDelayProgress
2018-07-28 21:17:41 +02:00
2019-03-07 17:18:24 +01:00
colorCircle: "grey"
2018-07-28 21:17:41 +02:00
2019-03-07 17:18:24 +01:00
Behavior on opacity {
NumberAnimation {
duration: 200
2018-07-28 21:17:41 +02:00
}
}
2019-03-07 17:18:24 +01:00
2019-03-24 21:16:16 +01:00
animationDuration: speedBackend . mode === 1 ? 150 : 0
2018-07-22 16:47:55 +02:00
}
/ * - - - - - - - - - - - - - - - - - - - - - -
Cancel button
-- -- -- -- -- -- -- -- -- -- -- * /
2019-03-08 15:36:32 +01:00
FancyButton {
2018-07-22 16:47:55 +02:00
id: cancelButt
2018-08-14 17:07:42 +02:00
text: qsTr ( "cancel" )
2018-07-22 16:47:55 +02:00
anchors {
right: startButt . right
bottom: startButt . bottom
}
2018-07-25 00:32:20 +02:00
contentItem: Text {
//make text disappear
}
2018-07-22 16:47:55 +02:00
height: startButt . height * 0.3
scale: 0
width: height
2018-07-28 21:17:41 +02:00
enabled: root . state === "STARTING"
2018-07-22 16:47:55 +02:00
2018-07-25 00:32:20 +02:00
onClicked: {
2019-03-07 17:18:24 +01:00
root . stop ( 1 )
2018-07-25 00:32:20 +02:00
}
2018-07-22 16:47:55 +02:00
Behavior on scale {
PropertyAnimation {
duration: 200
}
}
2019-03-08 15:36:32 +01:00
Label {
id: cancelButt_text
text: cancelButt . text
anchors.centerIn: parent
font.pixelSize: parent . height * 0.16
font.family: "Helvetica"
2019-03-08 18:03:27 +01:00
color: appTheme . style . textColor
2018-07-25 00:32:20 +02:00
}
2019-03-08 15:36:32 +01:00
2019-03-08 18:03:27 +01:00
backgroundColor: appTheme . style . buttonColor
2018-07-25 00:32:20 +02:00
}
/ * - - - - - -
Popups
-- -- -- * /
SettingsDialog {
2018-08-02 12:50:55 +02:00
id: settingsDialog
2018-08-28 23:03:35 +02:00
connections: root . connections
2018-08-18 21:27:18 +02:00
onConnectRequested: {
switch ( type ) {
case "buzzer" :
2018-08-28 23:03:35 +02:00
buzzerConn . connect ( )
break
case "startpad" :
startpadConn . connect ( )
2018-08-18 21:27:18 +02:00
break
2018-10-04 18:35:29 +02:00
case "baseStation" :
baseConn . connectToHost ( )
break
2018-08-18 21:27:18 +02:00
}
}
2018-07-22 16:47:55 +02:00
}
2019-01-01 15:23:15 +01:00
ErrorDialog {
id: errorDialog
}
2018-08-28 23:03:35 +02:00
// ProfilesDialog {
// id: profilesDialog
// }
2018-07-25 00:32:20 +02:00
2018-07-22 16:47:55 +02:00
/ * - - - - - - - - - - - - - - - - - - -
lower line and menu
-- -- -- -- -- -- -- -- -- - * /
2019-03-08 15:36:32 +01:00
2018-07-22 16:47:55 +02:00
Rectangle {
2019-03-08 15:36:32 +01:00
id: lowerLine
2018-07-22 16:47:55 +02:00
width: root . landscape ( ) ? 1 : parent . width
height: root . landscape ( ) ? parent.height: 1
2019-03-08 18:03:27 +01:00
color: appTheme . style . lineColor
2018-07-22 16:47:55 +02:00
anchors.right: root . landscape ( ) ? menu_container.left: parent . right
anchors.bottom: root . landscape ( ) ? parent.bottom: menu_container . top
anchors.top: root . landscape ( ) ? parent.top: undefined
2019-03-08 15:36:32 +01:00
visible: false
}
RectangularGlow {
id: effect
glowRadius: 7
spread: 0.02
color: "black"
opacity: 0.18
anchors.fill: menu_container
scale: 1
2018-07-22 16:47:55 +02:00
}
Item {
id: menu_container
anchors {
bottom: parent . bottom
right: parent . right
left: root . landscape ( ) ? startButt.right: parent . left
top: root . landscape ( ) ? parent.top: startButt . bottom
topMargin: root . landscape ( ) ? undefined: parent . height * 0.1
leftMargin: root . landscape ( ) ? parent . width * 0.05 : 0
}
2018-08-28 23:03:35 +02:00
Rectangle {
2019-03-08 15:36:32 +01:00
id: lowerMenuBackground
2018-08-28 23:03:35 +02:00
anchors.fill: parent
2019-03-08 18:03:27 +01:00
color: appTheme . style . menuColor
2019-03-24 21:31:59 +01:00
Behavior on color {
ColorAnimation {
duration: 200
}
}
2018-08-28 23:03:35 +02:00
}
2019-03-08 15:36:32 +01:00
FancyButton {
2018-07-22 16:47:55 +02:00
id: settingsButt
anchors {
//center
verticalCenter: root . landscape ( ) ? undefined: parent . verticalCenter
horizontalCenter: root . landscape ( ) ? parent.horizontalCenter: undefined
//set anchors
left: root . landscape ( ) ? undefined: parent . left
top: root . landscape ( ) ? parent.top: undefined
//align in landscape mode
2018-08-11 23:54:34 +02:00
//for two buttons: topMargin: root.landscape() ? (parent.height - (height * 2)) / 3:undefined
topMargin: root . landscape ( ) ? ( parent . height * 0.5 - ( height * 0.5 ) ) : undefined
2018-07-22 16:47:55 +02:00
//align in portrait mode
2018-08-11 23:54:34 +02:00
//for two buttons: leftMargin: root.landscape() ? undefined:(parent.width - width * 2) / 3
leftMargin: root . landscape ( ) ? undefined: ( parent . width * 0.5 - width * 0.5 )
2018-07-22 16:47:55 +02:00
}
2018-07-25 00:32:20 +02:00
2018-07-22 16:47:55 +02:00
height: root . landscape ( ) ? parent . width * 0.7 : parent . height * 0.7
width: height
2018-07-25 00:32:20 +02:00
onClicked: {
2018-08-28 23:03:35 +02:00
settingsDialog . open ( )
2018-07-22 16:47:55 +02:00
}
2019-03-08 18:03:27 +01:00
image: appTheme . style . settIcon
2019-03-08 15:36:32 +01:00
2019-03-08 18:03:27 +01:00
backgroundColor: parent . pressed ? appTheme.style.buttonPressedColor: appTheme . style . buttonColor
2019-03-08 15:36:32 +01:00
2018-07-22 16:47:55 +02:00
}
2018-07-25 00:32:20 +02:00
2018-08-11 23:54:34 +02:00
/ *
2018-07-25 00:32:20 +02:00
RoundButton {
2018-07-22 16:47:55 +02:00
id: profilesButt
anchors {
verticalCenter: root . landscape ( ) ? undefined: parent . verticalCenter
horizontalCenter: root . landscape ( ) ? parent.horizontalCenter: undefined
left: root . landscape ( ) ? undefined: settingsButt . right
top: root . landscape ( ) ? settingsButt.bottom: undefined
topMargin: root . landscape ( ) ? ( parent . height - ( height * 2 ) ) / 3 : undefined
leftMargin: root . landscape ( ) ? undefined: ( parent . width - width * 2 ) / 3
}
2018-07-25 00:32:20 +02:00
height: root . landscape ( ) ? parent . width * 0.7 : parent . height * 0.7
2018-07-22 16:47:55 +02:00
width: height
2018-07-25 00:32:20 +02:00
onPressedChanged: {
if ( pressed ) {
background . color = "lightgrey"
}
else {
background . color = "white"
}
2018-07-22 16:47:55 +02:00
}
2018-07-25 00:32:20 +02:00
onClicked: {
2018-08-02 12:50:55 +02:00
profilesDialog . open ( )
2018-07-22 16:47:55 +02:00
}
2018-07-17 19:17:25 +02:00
2018-07-25 00:32:20 +02:00
background: Rectangle {
color: "white"
border.color: "grey"
border.width: 1
radius: width / 2
Image {
id: profilesButt_Image
source: "qrc:/graphics/icons/user.png"
anchors.centerIn: parent
height: parent . height * 0.5
width: parent . width * 0.5
mipmap: true
2018-07-22 16:47:55 +02:00
}
2018-07-17 19:17:25 +02:00
}
}
2018-08-11 23:54:34 +02:00
* /
2018-07-17 19:17:25 +02:00
}
2018-07-22 16:47:55 +02:00
/ * - - - - - - - - - - - - - - - - - - - - - -
Timer states
-- -- -- -- -- -- -- -- -- -- -- * /
2018-07-17 19:17:25 +02:00
states: [
2018-07-22 16:47:55 +02:00
State {
name: "IDLE"
//state for the start page
2019-03-07 17:18:24 +01:00
PropertyChanges { target: timer_1 ; font.pixelSize: root . landscape ( ) ? parent . width * 0.1 : parent . height * 0.3 ; scale: 1 }
2018-07-22 16:47:55 +02:00
PropertyChanges {
target: time_container ;
anchors.bottomMargin: root . landscape ( ) ? undefined: parent . height * 0.1 ;
anchors.rightMargin: root . landscape ( ) ? parent . height * 0.05 : 0
}
PropertyChanges {
target: startButt ;
2018-08-14 17:07:42 +02:00
enabled: true ; text: qsTr ( "start" ) ;
2018-07-22 16:47:55 +02:00
size: root . landscape ( ) ? parent . width * 0.5 : parent . height * 0.5
anchors.bottomMargin: parent . height * 0.5 - startButt . height * 0.5
anchors.rightMargin: parent . width * 0.5 - startButt . width * 0.5
}
} ,
State {
name: "STARTING"
//state for the start sequence
2018-08-14 17:07:42 +02:00
PropertyChanges { target: startButt ; enabled: false ; text: qsTr ( "starting..." ) ;
2018-07-29 11:23:32 +02:00
anchors.rightMargin: root . 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: root . 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)
2018-07-22 16:47:55 +02:00
}
2019-03-07 17:18:24 +01:00
PropertyChanges { target: timer_1 ; font.pixelSize: root . landscape ( ) ? parent . width * 0.2 : parent . height * 0.3 ; scale: 1 }
2018-07-22 16:47:55 +02:00
PropertyChanges { target: cancelButt ; scale: 1 }
PropertyChanges { target: menu_container ; }
} ,
State {
name: "RUNNING"
//state when the timer is running
2019-03-07 17:18:24 +01:00
PropertyChanges { target: timer_1 ; font.pixelSize: root . landscape ( ) ? parent . width * 0.2 : parent . height * 0.3 ; scale: 1 }
2018-07-22 16:47:55 +02:00
PropertyChanges { target: startButt ; enabled: true ;
text: "stop"
2018-07-29 11:23:32 +02:00
anchors.rightMargin: root . 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: root . 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)
2018-07-22 16:47:55 +02:00
}
} ,
State {
name: "STOPPED"
//state when the meassuring is over
PropertyChanges {
2018-10-04 18:35:29 +02:00
target: timer_1 ;
2019-03-07 17:18:24 +01:00
font.pixelSize: root . landscape ( ) ? parent . width * 0.15 : parent . height * 0.1 ;
2018-07-22 16:47:55 +02:00
scale: 1
}
PropertyChanges {
target: startButt ;
2018-08-14 17:07:42 +02:00
enabled: true ; text: qsTr ( "reset" ) ;
2018-07-22 16:47:55 +02:00
size: root . landscape ( ) ? parent . height * 0.35 : parent . height * 0.2 ;
anchors.bottomMargin: root . landscape ( ) ? parent . height * 0.5 - startButt . height * 0.5 : parent . height * 0.2 - startButt . height * 0.5
anchors.rightMargin: root . landscape ( ) ? parent . height * 0.2 - startButt . height * 0.5 : parent . width * 0.5 - startButt . width * 0.5
}
PropertyChanges {
target: time_container ;
anchors.rightMargin: root . landscape ( ) ? 0 - startButt . width / 2 : undefined
anchors.bottomMargin: root . landscape ( ) ? undefined: 0 - startButt . height / 2
}
}
]
/ * - - - - - - - - - - - - - - - - - - - - - -
Timer animations
-- -- -- -- -- -- -- -- -- -- -- * /
2018-07-17 19:17:25 +02:00
transitions: [
Transition {
2018-10-04 18:35:29 +02:00
NumberAnimation { properties: "size,rightMargin,height,width,bottomMargin,font.pixelSize,pixelSize" ; easing.type: Easing . InOutQuad ; duration: 700 }
2018-07-17 19:17:25 +02:00
} ,
Transition {
2018-07-18 14:06:04 +02:00
to: "STOPPED"
2018-10-04 18:35:29 +02:00
NumberAnimation { properties: "size,rightMargin,height,width,bottomMargin,font.pixelSize,pixelSize" ; easing.type: Easing . InOutQuad ; duration: 700 }
2018-07-18 14:06:04 +02:00
} ,
Transition {
to: "IDLE"
2018-10-04 18:35:29 +02:00
NumberAnimation { properties: "size,rightMargin,height,width,bottomMargin,font.pixelSize,pixelSize" ; easing.type: Easing . InOutQuad ; duration: 700 }
2018-07-18 14:06:04 +02:00
} ,
Transition {
2019-03-09 15:06:48 +01:00
from: "STARTING"
2018-07-18 14:06:04 +02:00
to: "RUNNING"
//disable transitions for the RUNNING state
2018-07-17 19:17:25 +02:00
}
]
2018-07-22 16:47:55 +02:00
/ * - - - - - - - - - - - - - - - - - - - - - -
Timer functions
-- -- -- -- -- -- -- -- -- -- -- * /
function landscape ( ) {
return ( root . height < root . width )
}
2018-08-14 17:07:42 +02:00
/*----Functions to control the stopwatch----*/
function start ( ) {
2019-03-07 17:18:24 +01:00
var ret = speedBackend . startRace ( )
if ( ret !== 200 ) {
console . log ( "+ --- error starting race: " + ret )
}
2018-08-14 17:07:42 +02:00
}
function stop ( type ) {
2019-03-07 17:18:24 +01:00
var ret = speedBackend . stopRace ( type )
if ( ret !== 200 ) {
console . log ( "+ --- error stopping race: " + ret )
}
2018-08-14 17:07:42 +02:00
}
function reset ( ) {
2019-03-07 17:18:24 +01:00
var ret = speedBackend . resetRace ( )
if ( ret !== 200 ) {
console . log ( "+ --- error resetting race: " + ret )
}
2018-08-14 17:07:42 +02:00
}
2018-07-17 19:17:25 +02:00
}
}