diff --git a/headers/climbingrace.h b/headers/climbingrace.h index 09b5b55..c64d49c 100644 --- a/headers/climbingrace.h +++ b/headers/climbingrace.h @@ -100,7 +100,7 @@ public slots: Q_INVOKABLE QVariant getAthletes(); Q_INVOKABLE bool createAthlete( QString userName, QString fullName ); Q_INVOKABLE bool deleteAthlete( QString userName ); - Q_INVOKABLE bool selectAthlete( QString userName ); + Q_INVOKABLE bool selectAthlete( QString userName, int timerId ); Q_INVOKABLE QVariant getResults( QString userName ); Q_INVOKABLE bool reloadBaseStationIpAdress(); diff --git a/qml/ErrorDialog.qml b/qml/ErrorDialog.qml deleted file mode 100644 index ef7f328..0000000 --- a/qml/ErrorDialog.qml +++ /dev/null @@ -1,83 +0,0 @@ -/* - 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 . -*/ - -import QtQuick 2.9 -import QtMultimedia 5.8 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 -import com.itsblue.speedclimbingstopwatch 2.0 - - -Popup { - id: root - x: startButt.x - y: startButt.y - width: startButt.width - height: startButt.height - modal: true - - enter: Transition { - NumberAnimation { properties: "scale"; from: 0; to: 1; duration: 300; easing.type: Easing.Linear } - } - - exit: Transition { - NumberAnimation { properties: "scale"; from: 1; to: 0; duration: 300; easing.type: Easing.Linear } - } - - background: Rectangle { - radius: width * 0.5 - color: appTheme.style.viewColor - border.color: appTheme.style.lineColor - border.width: 1 - - Label { - id: head_text - text: "error" - font.pixelSize: headlineUnderline.width * 0.1 - color: enabled ? appTheme.style.textColor:appTheme.style.disabledTextColor - anchors { - horizontalCenter: parent.horizontalCenter - top: parent.top - topMargin: headlineUnderline.anchors.topMargin / 2 - height / 2 - } - } - - Rectangle { - id: headlineUnderline - height: 1 - width: parent.width - color: appTheme.style.lineColor - anchors { - top: parent.top - left: parent.left - right: parent.right - topMargin: parent.height * 0.15 - rightMargin: parent.radius - Math.sqrt(Math.pow(parent.radius,2)-Math.pow(parent.radius-anchors.topMargin,2)) - leftMargin: parent.radius - Math.sqrt(Math.pow(parent.radius,2)-Math.pow(parent.radius-anchors.topMargin,2)) - } - } - - Image { - id: errorIcon - source: "qrc:/graphics/icons/error.png" - anchors.centerIn: parent - height: parent.height * 0.5 - width: height - } - } -} diff --git a/qml/ProfilesDialog/ProfileListPage.qml b/qml/ProfilesDialog/ProfileListPage.qml index 6bef850..8dd109a 100644 --- a/qml/ProfilesDialog/ProfileListPage.qml +++ b/qml/ProfilesDialog/ProfileListPage.qml @@ -60,7 +60,7 @@ RemoteDataListView { delegate: SwipeDelegate { id: swipeDelegate - property bool active: profileList.currentAthlete === profileList.listData[index]["id"] + property int thisIndex: index text: profileList.listData[index]["fullName"] width: profileList.width - (swipeDelegate.x) @@ -86,8 +86,8 @@ RemoteDataListView { verticalCenter: parent.verticalCenter left: parent.left leftMargin: swipeDelegate.width * 0.05 - right: parent.right - rightMargin: swipeDelegate.rightPadding + right: athleteSelectBoxRow.left + rightMargin: leftMargin } text: swipeDelegate.text @@ -114,73 +114,92 @@ RemoteDataListView { } } - CheckBox { - id: control - + Row { + id: athleteSelectBoxRow anchors { verticalCenter: parent.verticalCenter right: parent.right rightMargin: 7 } - height: parent.height * 0.6 + height: parent.height + width: childrenRect.width - checked: swipeDelegate.active + Repeater { + id: athleteSelectBoxRep - onCheckedChanged: { - if(checked && !swipeDelegate.active && speedBackend.selectAthlete(profileList.listData[index]["userName"])){ - profileList.loadData() - } - } + model: speedBackend.timers.length - indicator: Rectangle { - implicitWidth: 26 - implicitHeight: 26 + delegate: CheckBox { + id: control - height: parent.height - width: height + property bool active: speedBackend.timers[index]["id"] === profileList.listData[swipeDelegate.thisIndex]["active"] - x: control.leftPadding - y: parent.height / 2 - height / 2 + anchors.verticalCenter: parent.verticalCenter - radius: width * 0.2 - border.color: control.down ? "#17a81a" : "#21be2b" - color: control.down ? appTheme.style.delegatePressedColor : appTheme.style.delegateBackgroundColor + height: parent.height * 0.6 - Rectangle { - width: parent.width * 0.65 - height: width - anchors.centerIn: parent - radius: control.checked ? width * 0.2:0 - color: control.down ? "#17a81a" : "#21be2b" - opacity: control.checked ? 1:0 - scale: control.checked ? 0.9:0 + enabled: speedBackend.timers[index]["state"] !== "DISABLED" + checked: control.active - Behavior on color { - ColorAnimation { - duration: 200 + onCheckedChanged: { + if(checked && !control.active && speedBackend.selectAthlete(profileList.listData[swipeDelegate.thisIndex]["userName"], speedBackend.timers[index]["id"])){ + profileList.loadData() } } - Behavior on radius { - NumberAnimation { - duration: 200 - } - } + indicator: Rectangle { + implicitWidth: 26 + implicitHeight: 26 - Behavior on opacity { - NumberAnimation { - duration: 200 - } - } + height: parent.height + width: height - Behavior on scale { - NumberAnimation { - duration: 200 + x: control.leftPadding + y: parent.height / 2 - height / 2 + + radius: width * 0.2 + border.color: control.enabled ? control.down ? "#17a81a" : "#21be2b" : "grey" + color: control.down ? appTheme.style.delegatePressedColor : appTheme.style.delegateBackgroundColor + + Rectangle { + width: parent.width * 0.65 + height: width + anchors.centerIn: parent + radius: control.checked ? width * 0.2:0 + color: control.enabled ? control.down ? "#17a81a" : "#21be2b" : "grey" + opacity: control.checked ? 1:0 + scale: control.checked ? 0.9:0 + + Behavior on color { + ColorAnimation { + duration: 200 + } + } + + Behavior on radius { + NumberAnimation { + duration: 200 + } + } + + Behavior on opacity { + NumberAnimation { + duration: 200 + } + } + + Behavior on scale { + NumberAnimation { + duration: 200 + } + } } } } + } + } Rectangle { diff --git a/qml/components/ConnectionDelegate.qml b/qml/components/ConnectionDelegate.qml index 98c56c5..90f9021 100644 --- a/qml/components/ConnectionDelegate.qml +++ b/qml/components/ConnectionDelegate.qml @@ -26,7 +26,7 @@ SmoothItemDelegate { onStatusChanged: { if(oldState !== status.status) { if(status.status === "disconnected" && oldState === "connecting") { - statusIndicator.color_override = "red" + statusIndicator.color_override = appTheme.style.errorColor shortDelay.start() } oldState = status.status @@ -57,11 +57,11 @@ SmoothItemDelegate { id: statusIndicator property string color_override: "" anchors.fill: parent - color: color_override === "" ? status.status === "connected" ? "#c1ff32":"transparent":color_override + color: color_override === "" ? status.status === "connected" ? appTheme.style.successColor:"transparent":color_override opacity: status.status === "connecting" ? 0:1 radius: height * 0.5 - border.color: "grey" - border.width: height * 0.1 + border.color: appTheme.style.lineColor + border.width: 1 Behavior on color { ColorAnimation { @@ -81,11 +81,11 @@ SmoothItemDelegate { id: prog anchors.fill: parent opacity: status.status === "connecting" ? 1:0 - lineWidth: height * 0.1 + lineWidth: 1 arcBegin: 0 arcEnd: 360 * ( status.progress / 100 ) - colorCircle: "grey" + colorCircle: appTheme.style.lineColor onColorCircleChanged: prog.repaint() onArcEndChanged: prog.repaint() diff --git a/qml/main.qml b/qml/main.qml index 170ae86..bac106e 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -31,12 +31,12 @@ Window { visible: true width: 540 height: 960 - title: qsTr("Speedclimbing stw") + title: "Speedclimbing stw" property date currentTime: new Date() property int millis: 0 Page { - id:root + id:app anchors.fill: parent //set default state to IDLE @@ -84,7 +84,7 @@ Window { settingsDialog.close() profilesDialog.close() } - root.state = stateString + app.state = stateString } } @@ -111,10 +111,10 @@ Window { anchors { top: parent.top left: parent.left - 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 + right: app.landscape() ? startButt.left:parent.right + bottom: app.landscape() ? parent.bottom:startButt.top + bottomMargin: app.landscape() ? undefined:parent.height * 0.1 + rightMargin: app.landscape() ? parent.width * 0.05:0 } Rectangle { @@ -137,7 +137,7 @@ Window { width: parent.width * 0.7 - text: qsTr("Click Start to start") + text: "Click Start to start" color: appTheme.style.textColor @@ -146,7 +146,7 @@ Window { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - font.pixelSize: root.landscape() ? parent.width * 0.15 : parent.height * 0.4 + font.pixelSize: app.landscape() ? parent.width * 0.15 : parent.height * 0.4 minimumPixelSize: 1 @@ -162,6 +162,7 @@ Window { id: timerCol anchors.fill: parent + anchors.bottomMargin: app.landscape() ? 0:parent.height * 0.1 opacity: ( speedBackend.state < 3 ) ? 0:1 @@ -187,8 +188,8 @@ Window { height: parent.height elide: "ElideRight" - color: speedBackend.timers[index]["state"] === "WON" ? "green" : - speedBackend.timers[index]["state"] === "LOST" ? "red": + color: speedBackend.timers[index]["state"] === "WON" ? appTheme.style.successColor : + speedBackend.timers[index]["state"] === "LOST" ? appTheme.style.errorColor: appTheme.style.textColor enabled: speedBackend.timers[index]["state"] !== "DISABLED" @@ -200,12 +201,12 @@ Window { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - font.pixelSize: root.landscape() ? parent.width * 0.15 : parent.height * 0.4 + font.pixelSize: app.landscape() ? parent.width * 0.15 : parent.height * 0.4 minimumPixelSize: 1 Behavior on text { - enabled: root.state !== "RUNNING" + enabled: app.state !== "RUNNING" && app.state !== "STOPPED" FadeAnimation { target: timerTextLa } @@ -219,7 +220,7 @@ Window { anchors { centerIn: parent - verticalCenterOffset: parent.height * 0.25 + verticalCenterOffset: timerTextLa.font.pixelSize * 0.5 + react_time.font.pixelSize * 0.5 } width: ( parent.width * 0.6 ) @@ -230,9 +231,9 @@ Window { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - text: qsTr("reaction time (ms): ") + Math.round(rtime) + text: "reaction time (ms): " + Math.round(rtime) - opacity: (root.state === "RUNNING" || root.state === "STOPPED") && rtime !== 0 ? 1:0 + opacity: (app.state === "RUNNING" || app.state === "STOPPED") && rtime !== 0 ? 1:0 color: appTheme.style.textColor @@ -263,8 +264,8 @@ Window { 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 + bottomMargin: app.landscape() ? 0:parent.height * 0.8 + rightMargin: app.landscape() ? parent.width * 0.8:0 } ConnectionIcon { @@ -279,7 +280,7 @@ Window { leftMargin: 10 } scale: 1.3 - height: !root.landscape()? parent.height*0.3:parent.width*0.3 + height: !app.landscape()? parent.height*0.3:parent.width*0.3 } Row { @@ -317,7 +318,7 @@ Window { scale: 0 - height: !root.landscape()? parent.height*0.17:parent.width*0.17 + height: !app.landscape()? parent.height*0.17:parent.width*0.17 width: status === "disconnected" ? 0:height Component.onCompleted: { @@ -342,12 +343,12 @@ Window { Rectangle { id: upper_line - width: root.landscape() ? 1:parent.width - height: root.landscape() ? parent.height:1 + width: app.landscape() ? 1:parent.width + height: app.landscape() ? parent.height:1 color: appTheme.style.lineColor - anchors.left: root.landscape() ? topContainerItm.right:parent.left - anchors.top: root.landscape() ? parent.top:topContainerItm.bottom - anchors.bottom: root.landscape() ? parent.bottom:undefined + anchors.left: app.landscape() ? topContainerItm.right:parent.left + anchors.top: app.landscape() ? parent.top:topContainerItm.bottom + anchors.bottom: app.landscape() ? parent.bottom:undefined visible: false } @@ -357,18 +358,18 @@ Window { FancyButton { id : startButt - text: qsTr("start") - property int size: root.landscape() ? parent.width * 0.5:parent.height * 0.5 + text: "start" + property int size: app.landscape() ? parent.width * 0.5:parent.height * 0.5 anchors { bottom: parent.bottom - bottomMargin: root.height * 0.5 - height * 0.5 + bottomMargin: app.height * 0.5 - height * 0.5 right: parent.right - rightMargin: root.width * 0.5 - width * 0.5 + rightMargin: app.width * 0.5 - width * 0.5 } contentItem: Text { //make text disappear } - height: root.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 Label { @@ -391,15 +392,15 @@ Window { } onClicked: { - switch(root.state) { + switch(app.state) { case "IDLE": - root.start() + app.start() break case "RUNNING": - root.stop(0) + app.stop(0) break case "STOPPED": - root.reset() + app.reset() break } } @@ -408,7 +409,7 @@ Window { ProgressCircle { id: prog anchors.fill: startButt - opacity: root.state === "STARTING" || root.state === "IDLE" ? 1:0 + opacity: app.state === "STARTING" || app.state === "IDLE" ? 1:0 scale: startButt.scale @@ -434,7 +435,7 @@ Window { FancyButton { id: cancelButt - text: qsTr("cancel") + text: "cancel" anchors { right: startButt.right bottom: startButt.bottom @@ -446,10 +447,10 @@ Window { scale: 0 width: height - enabled: root.state === "STARTING" + enabled: app.state === "STARTING" onClicked: { - root.stop(1) + app.stop(1) } Behavior on scale { @@ -485,12 +486,12 @@ Window { ProfilesDialog { id: profilesDialog - property int margin: root.landscape() ? root.height * 0.05:root.width * 0.05 + property int margin: app.landscape() ? app.height * 0.05:app.width * 0.05 - x: root.landscape() ? topContainerItm.width + margin:topContainerItm.x + margin - y: !root.landscape() ? topContainerItm.height + margin:topContainerItm.x + margin - width: root.landscape() ? root.width - topContainerItm.width - menu_container.width - margin * 2 : root.width - margin * 2 - height: !root.landscape() ? root.height - topContainerItm.height - menu_container.height - margin * 2 : root.height - margin * 2 + x: app.landscape() ? topContainerItm.width + margin:topContainerItm.x + margin + y: !app.landscape() ? topContainerItm.height + margin:topContainerItm.x + margin + width: app.landscape() ? app.width - topContainerItm.width - menu_container.width - margin * 2 : app.width - margin * 2 + height: !app.landscape() ? app.height - topContainerItm.height - menu_container.height - margin * 2 : app.height - margin * 2 } /*------------------- @@ -499,12 +500,12 @@ Window { Rectangle { id: lowerLine - width: root.landscape() ? 1:parent.width - height: root.landscape() ? parent.height:1 + width: app.landscape() ? 1:parent.width + height: app.landscape() ? parent.height:1 color: appTheme.style.lineColor - 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 + anchors.right: app.landscape() ? menu_container.left:parent.right + anchors.bottom: app.landscape() ? parent.bottom:menu_container.top + anchors.top: app.landscape() ? parent.top:undefined visible: false } @@ -524,10 +525,10 @@ Window { 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 + left: app.landscape() ? startButt.right:parent.left + top: app.landscape() ? parent.top:startButt.bottom + topMargin: app.landscape() ? undefined:parent.height * 0.1 + leftMargin: app.landscape() ? parent.width * 0.05:0 } Rectangle { @@ -565,10 +566,10 @@ Window { height: childrenRect.height width: childrenRect.width - rows: root.landscape() ? activeChildren:1 - columns: root.landscape() ? 1:activeChildren + rows: app.landscape() ? activeChildren:1 + columns: app.landscape() ? 1:activeChildren - spacing: 0// root.landscape() ? parent.height * spacingMultiplier * 0.001:parent.width * spacingMultiplier * 0.001 + spacing: 0// app.landscape() ? parent.height * spacingMultiplier * 0.001:parent.width * spacingMultiplier * 0.001 Behavior on spacingMultiplier { NumberAnimation { @@ -579,7 +580,7 @@ Window { FancyButton { id: settingsButt - height: root.landscape() ? menu_container.width * 0.7:menu_container.height * 0.7 + height: app.landscape() ? menu_container.width * 0.7:menu_container.height * 0.7 width: height onClicked: { @@ -625,7 +626,7 @@ Window { name: "visible" PropertyChanges { target: profilesButt - height: root.landscape() ? menu_container.width * 0.7:menu_container.height * 0.7 + height: app.landscape() ? menu_container.width * 0.7:menu_container.height * 0.7 } } ] @@ -650,19 +651,19 @@ Window { //state for the start page PropertyChanges { target: topContainerItm; - anchors.bottomMargin: root.landscape() ? undefined:parent.height * 0.1; - anchors.rightMargin: root.landscape() ? parent.height * 0.05:0 + anchors.bottomMargin: app.landscape() ? undefined:parent.height * 0.1; + anchors.rightMargin: app.landscape() ? parent.height * 0.05:0 } PropertyChanges { target: startButt; - enabled: true; text: qsTr("start"); - size: root.landscape() ? parent.width * 0.5:parent.height * 0.5 + enabled: true; text: "start"; + size: app.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 } PropertyChanges { target: topLa - text: qsTr("Click Start to start") + text: "Click Start to start" } }, @@ -670,29 +671,29 @@ Window { name: "WAITING" //state when a false start occured and waiting for time calculation PropertyChanges { - target: startButt; enabled: false; text: qsTr("waiting..."); - 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) + target: startButt; enabled: false; text: "waiting..."; + 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) } PropertyChanges { target: cancelButt; scale: 0; enabled: false} PropertyChanges { target: menu_container; } PropertyChanges { target: topLa - text: qsTr("please wait...") + text: "please wait..." } }, State { name: "STARTING" //state for the start sequence - PropertyChanges { target: startButt; enabled: false; text: qsTr("starting..."); - 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) + PropertyChanges { target: startButt; enabled: false; text: "starting..."; + 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) } PropertyChanges { target: cancelButt; scale: 1} PropertyChanges { target: menu_container; } PropertyChanges { target: topLa - text: qsTr("starting...") + text: "starting..." } }, @@ -701,8 +702,8 @@ Window { //state when the timer is running PropertyChanges { target: startButt; enabled: true; text: "stop" - 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) + 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) } PropertyChanges { target: topLa @@ -715,15 +716,15 @@ Window { //state when the meassuring is over PropertyChanges { target: startButt; - enabled: true; text: qsTr("reset"); - 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 + enabled: true; text: "reset"; + size: app.landscape() ? parent.height * 0.35:parent.height * 0.2; + anchors.bottomMargin: app.landscape() ? parent.height * 0.5 - startButt.height * 0.5:parent.height * 0.2 - startButt.height * 0.5 + anchors.rightMargin: app.landscape() ? parent.height * 0.2 - startButt.height * 0.5:parent.width * 0.5 - startButt.width * 0.5 } PropertyChanges { target: topContainerItm; - anchors.rightMargin: root.landscape() ? 0-startButt.width/2:undefined - anchors.bottomMargin: root.landscape() ? undefined:0-startButt.height/2 + anchors.rightMargin: app.landscape() ? 0-startButt.width/2:undefined + anchors.bottomMargin: app.landscape() ? undefined:0-startButt.height/2 } PropertyChanges { target: topLa @@ -764,7 +765,7 @@ Window { Timer functions ----------------------*/ function landscape(){ - return(root.height < root.width) + return(app.height < app.width) } /*----Functions to control the stopwatch----*/ diff --git a/qml/qml.qrc b/qml/qml.qrc index db55f87..53683b0 100644 --- a/qml/qml.qrc +++ b/qml/qml.qrc @@ -7,7 +7,6 @@ components/FadeAnimation.qml components/ConnectionIcon.qml components/NextPageDelegate.qml - ErrorDialog.qml components/FancyButton.qml components/SmoothItemDelegate.qml components/SmoothSwitchDelegate.qml diff --git a/shared.qrc b/shared.qrc index c430b9e..a34840c 100644 --- a/shared.qrc +++ b/shared.qrc @@ -15,8 +15,6 @@ sounds/at_marks_2.wav graphics/icons/buzzer_black.png graphics/icons/ok_black.png - translations/de_DE.qm - translations/de_DE.ts graphics/icons/settings_black.png graphics/icons/startpad_black.png sounds/false.wav diff --git a/sources/apptheme.cpp b/sources/apptheme.cpp index 799f9d4..57e8907 100644 --- a/sources/apptheme.cpp +++ b/sources/apptheme.cpp @@ -25,8 +25,8 @@ AppTheme::AppTheme(QObject *parent) : QObject(parent) {"sliderColor", "#6ccaf2"}, - {"errorColor", "#ba3f62"}, - {"infoColor", "#3fba62"}, + {"successColor", "#6bd43b"}, + {"errorColor", "#e03b2f"}, {"lineColor", "grey"}, @@ -63,8 +63,8 @@ AppTheme::AppTheme(QObject *parent) : QObject(parent) {"sliderColor", "#6ccaf2"}, - {"errorColor", "#ba3f62"}, - {"infoColor", "#3fba62"}, + {"successColor", "#60de26"}, + {"errorColor", "#ff0000"}, {"lineColor", "grey"}, diff --git a/sources/climbingrace.cpp b/sources/climbingrace.cpp index d5360a8..19523c3 100644 --- a/sources/climbingrace.cpp +++ b/sources/climbingrace.cpp @@ -394,7 +394,7 @@ void ClimbingRace::refreshTimerText() { QVariantList newTimerTextList; foreach(SpeedTimer * timer, this->speedTimers){ - QVariantMap timerMap = {{"text",timer->getText()}, {"reacttime", timer->reactionTime}, {"state", timer->getState()}}; + QVariantMap timerMap = {{"text",timer->getText()}, {"reacttime", timer->reactionTime}, {"state", timer->getState()}, {"id", this->speedTimers.indexOf(timer)}}; newTimerTextList.append(timerMap); } @@ -526,9 +526,9 @@ bool ClimbingRace::deleteAthlete( QString userName ){ } -bool ClimbingRace::selectAthlete( QString userName){ +bool ClimbingRace::selectAthlete( QString userName, int timerId ){ - QVariant requestData = QVariantMap({{"userName", userName}}); + QVariant requestData = QVariantMap({{"userName", userName}, {"timerId", timerId}}); QVariantMap reply = this->baseConn->sendCommand(4000, requestData.toJsonValue()); diff --git a/sources/main.cpp b/sources/main.cpp index 5e51af7..9244717 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -115,26 +115,16 @@ int main(int argc, char *argv[]) qmlRegisterType("com.itsblue.speedclimbingstopwatch", 1, 0, "SqlProfileModel"); qmlRegisterType("com.itsblue.speedclimbingstopwatch", 1, 0, "SqlStorageModel"); - //setup the startpad and buzzer conn qml objects - //qmlRegisterType("com.itsblue.speedclimbingstopwatch", 1, 0, "BuzzerConn"); - //qmlRegisterType("com.itsblue.speedclimbingstopwatch", 1, 0, "StartpadConn"); - //qmlRegisterType("com.itsblue.speedclimbingstopwatch", 1, 0, "BaseStationConn"); - //qmlRegisterType("com.itsblue.speedclimbingstopwatch", 1, 0, "SpeedTimerBackend"); - + // setup speed backend and App themes qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "SpeedBackend"); qmlRegisterType("com.itsblue.speedclimbingstopwatch", 2, 0, "AppTheme"); - //setup translation engine - //to the language of the system - //if the system language is not found the language is set to english - QTranslator translator; - translator.load(":/translations/"+QLocale::system().name()+".qm"); - app.installTranslator(&translator); - QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); QQmlContext *context = engine.rootContext(); + + // stup app settings context->setContextProperty("_cppAppSettings", pAppSettings); if (engine.rootObjects().isEmpty()) diff --git a/sources/speedtimer.cpp b/sources/speedtimer.cpp index ce6a5b1..3a45358 100644 --- a/sources/speedtimer.cpp +++ b/sources/speedtimer.cpp @@ -96,21 +96,21 @@ void SpeedTimer::setState(timerState newState){ QString SpeedTimer::getState(){ switch(state){ case IDLE: - return("IDLE"); + return "IDLE"; case STARTING: - return("STARTING"); + return "STARTING"; case WAITING: - return ("WAITING"); + return "WAITING"; case RUNNING: - return("RUNNING"); + return "RUNNING"; case WON: return "WON"; case LOST: return "LOST"; case FAILED: - return("FAILED"); + return "FAILED"; case CANCELLED: - return("CANCELLED"); + return "CANCELLED"; case DISABLED: return "DISABLED"; } @@ -134,13 +134,13 @@ QString SpeedTimer::getText() { QString newText; switch (this->state) { case SpeedTimer::IDLE: - newText = tr("Click Start to start"); + newText = "0.000 sec"; break; case SpeedTimer::STARTING: newText = "0.000 sec"; break; case SpeedTimer::WAITING: - newText = tr("Please wait..."); + newText = "Please wait..."; break; case SpeedTimer::RUNNING: 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"; break; case SpeedTimer::FAILED: - newText = tr("False Start"); + newText = "False Start"; break; case SpeedTimer::CANCELLED: - newText = tr("Cancelled"); + newText = "Cancelled"; break; case SpeedTimer::DISABLED: newText = "---"; diff --git a/speedclimbing_stopwatch.pro b/speedclimbing_stopwatch.pro index 3afcdd9..cde5770 100644 --- a/speedclimbing_stopwatch.pro +++ b/speedclimbing_stopwatch.pro @@ -43,8 +43,6 @@ RESOURCES += \ shared.qrc \ qml/qml.qrc -TRANSLATIONS = translations/de_DE.ts - # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = @@ -63,8 +61,7 @@ else: unix:!android: target.path = /home/pi/$${TARGET}/bin DISTFILES += \ android-sources/AndroidManifest.xml \ CHANGELOG \ - android-sources/src/MainActivity.java \ -translations/german_de.ts + android-sources/src/MainActivity.java android { ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources diff --git a/translations/de_DE.qm b/translations/de_DE.qm deleted file mode 100644 index 40df268..0000000 Binary files a/translations/de_DE.qm and /dev/null differ diff --git a/translations/de_DE.ts b/translations/de_DE.ts deleted file mode 100644 index 96b648c..0000000 --- a/translations/de_DE.ts +++ /dev/null @@ -1,195 +0,0 @@ - - - - - InputDelegate - - delay (ms) - Verzögerung (ms) - - - - SettingsDialog - - - Options - Optionen - - - connected to buzzer - Mit Buzzer verbunden - - - connect to buzzer - Mit Buzzer verbinden - - - - connecting... - verbinde... - - - success! - Erfolg - - - error! - Fehler - - - - - Base Station - Base Station - - - - start sequence - Start Ablauf - - - - dark mode - dunkler Modus - - - - say 'ready' - sage 'ready' - - - - - delay (ms) - Verzögerung (ms) - - - - - time - Zeit - - - - say 'at your marks' - sage 'at your marks' - - - - disconnect - trennen - - - - connect - verbinden - - - - IP-Adress - IP-Adresse - - - - volume - Lautstärke - - - - connected extensions - verbundene Erweiterungen - - - - connections - Verbindungen - - - say -'at your marks' - sage -'at your marks' - - - - SpeedTimer - - - Click Start to start - Tippe start zum Starten - - - - Please wait... - Bitte warten... - - - - False Start - Fehlstart - - - - Cancelled - Abgebrochen - - - - main - - - Speedclimbing stw - - - - Click start to start - Tippe start zum Starten - - - - reaction time (ms): - Reaktionszeit (ms): - - - - - start - start - - - - cancel - Abbruch - - - - Click Start to start - Tippe start zum Starten - - - - waiting... - warte... - - - - please wait... - Bitte warten... - - - - - starting... - starte... - - - false start - Fehlstart - - - - reset - reset - - - diff --git a/translations/german.ts b/translations/german.ts deleted file mode 100644 index a4c106a..0000000 --- a/translations/german.ts +++ /dev/null @@ -1,58 +0,0 @@ - - - - - SettingsDialog - - - say 'ready' - fertig - - - - say -'at your marks' - auf die Plätze - - - - main - - - Speedclimbing stw - - - - - - Click start to start - - - - - - start - - - - - cancel - - - - - starting... - - - - - false start - - - - - reset - - - - diff --git a/translations/german_de.qm b/translations/german_de.qm deleted file mode 100644 index e8c5c66..0000000 Binary files a/translations/german_de.qm and /dev/null differ diff --git a/translations/german_de.ts b/translations/german_de.ts deleted file mode 100644 index ceb9288..0000000 --- a/translations/german_de.ts +++ /dev/null @@ -1,108 +0,0 @@ - - - - - SettingsDialog - - - Options - Einstellungen - - - - - connected to buzzer - Mit Buzzer verbunden - - - - - connect to buzzer - Mit Buzzer verbinden - - - - connecting... - verbinde... - - - - success! - erfolgreich! - - - - error! - fehler! - - - - start sequence - Start Abfolge - - - - say 'ready' - sage 'ready' - - - - - delay (ms) - Verzögerung (ms) - - - - - time - Zeit - - - - say -'at your marks' - sage -'at your marks' - - - - main - - - Speedclimbing stw - - - - - - Click start to start - Tippe start zum Starten - - - - - start - start - - - - cancel - abbruch - - - - starting... - starte... - - - - false start - Fehlstart - - - - reset - reset - - -