Library migration #36
13 changed files with 158 additions and 338 deletions
|
@ -15,25 +15,18 @@ class ScStwAppBackend : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(ScStwRace* race READ getRace NOTIFY raceChanged)
|
||||
Q_PROPERTY(ScStwClient *scStwClient READ getScStwClient NOTIFY scStwClientChanged)
|
||||
Q_PROPERTY(ScStwAppSettings *settings READ getSettings NOTIFY settingsChanged)
|
||||
Q_PROPERTY(ScStwClient *scStwClient READ getScStwClient WRITE setScStwClient NOTIFY scStwClientChanged)
|
||||
|
||||
public:
|
||||
explicit ScStwAppBackend(QObject *parent = nullptr);
|
||||
|
||||
private:
|
||||
ScStwAppSettings * appSettings;
|
||||
ScStwClient * scStwClient;
|
||||
|
||||
QTimer * timerTextRefreshTimer;
|
||||
ScStwRemoteRace * race;
|
||||
|
||||
public slots:
|
||||
// functions for qml
|
||||
Q_INVOKABLE ScStwRace *getRace();
|
||||
Q_INVOKABLE ScStwClient *getScStwClient();
|
||||
Q_INVOKABLE ScStwAppSettings *getSettings();
|
||||
Q_INVOKABLE void setScStwClient(ScStwClient *client);
|
||||
|
||||
// athlete management
|
||||
Q_INVOKABLE QVariant getAthletes();
|
||||
|
@ -42,13 +35,8 @@ public slots:
|
|||
Q_INVOKABLE bool selectAthlete( QString userName, int timerId );
|
||||
Q_INVOKABLE QVariant getResults( QString userName );
|
||||
|
||||
private slots:
|
||||
void refreshTimerText();
|
||||
|
||||
signals:
|
||||
void raceChanged();
|
||||
void scStwClientChanged();
|
||||
void settingsChanged();
|
||||
};
|
||||
|
||||
#endif // SCSTWAPPBACKEND_H
|
||||
|
|
|
@ -10,6 +10,7 @@ class ScStwAppSettings : public ScStwRemoteSettings
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScStwAppSettings(QObject *parent = nullptr);
|
||||
explicit ScStwAppSettings(ScStwClient * scStwClient, QObject *parent = nullptr);
|
||||
|
||||
enum AppInternalSetting {
|
||||
|
|
|
@ -106,12 +106,12 @@ Item {
|
|||
Repeater {
|
||||
id: stateIndicatorRepeater
|
||||
|
||||
model: speedBackend.race.timers.length
|
||||
model: scStwRemoteRace.timers.length
|
||||
|
||||
delegate: ColumnLayout {
|
||||
id: timerStatusColumn
|
||||
|
||||
property var thisTimer: speedBackend.race.timers[index]
|
||||
property var thisTimer: scStwRemoteRace.timers[index]
|
||||
|
||||
width: parent.delegateWidth
|
||||
height: parent.delegateHeight
|
||||
|
@ -152,7 +152,7 @@ Item {
|
|||
onClicked: {
|
||||
var disabled = timerStatusColumn.thisTimer["state"] !== ScStwTimer.DISABLED
|
||||
console.log("setting timer to disabled: " + disabled)
|
||||
speedBackend.race.setTimerDisabled(timerStatusColumn.thisTimer["id"], disabled)
|
||||
scStwRemoteRace.setTimerDisabled(timerStatusColumn.thisTimer["id"], disabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ Item {
|
|||
id: mainActionButton
|
||||
|
||||
property double size
|
||||
startProgress: speedBackend.race.currentStartDelay["progress"]
|
||||
startProgress: scStwRemoteRace.currentStartDelay["progress"]
|
||||
|
||||
Layout.alignment: Layout.Center
|
||||
|
||||
|
@ -213,26 +213,26 @@ Item {
|
|||
|
||||
var ret;
|
||||
|
||||
switch(speedBackend.race.state) {
|
||||
switch(scStwRemoteRace.state) {
|
||||
case ScStwRace.IDLE:
|
||||
ret = speedBackend.race.start()
|
||||
ret = scStwRemoteRace.start()
|
||||
break;
|
||||
case ScStwRace.WAITING:
|
||||
if(!speedBackend.race.readySoundEnabled && speedBackend.race.isReadyForNextState)
|
||||
ret = speedBackend.race.start()
|
||||
if(!scStwRemoteRace.readySoundEnabled && scStwRemoteRace.isReadyForNextState)
|
||||
ret = scStwRemoteRace.start()
|
||||
else
|
||||
ret = speedBackend.race.cancel()
|
||||
ret = scStwRemoteRace.cancel()
|
||||
break;
|
||||
case ScStwRace.PREPAIRING:
|
||||
case ScStwRace.STARTING:
|
||||
ret = speedBackend.race.cancel()
|
||||
ret = scStwRemoteRace.cancel()
|
||||
break;
|
||||
case ScStwRace.RUNNING:
|
||||
ret = speedBackend.race.stop()
|
||||
ret = scStwRemoteRace.stop()
|
||||
break;
|
||||
case ScStwRace.STOPPED:
|
||||
case ScStwRace.INCIDENT:
|
||||
ret = speedBackend.race.reset()
|
||||
ret = scStwRemoteRace.reset()
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -299,27 +299,27 @@ Item {
|
|||
|
||||
PropertyChanges {
|
||||
target: mainActionButton
|
||||
size: speedBackend.race.competitionMode ? 0.3:0.9
|
||||
text: speedBackend.race.readySoundEnabled ? "cancel": speedBackend.race.isReadyForNextState ? "ready":"cancel"
|
||||
progressControlActivated: speedBackend.race.competitionMode && !speedBackend.race.readySoundEnabled && !speedBackend.race.isReadyForNextState
|
||||
size: scStwRemoteRace.competitionMode ? 0.3:0.9
|
||||
text: scStwRemoteRace.readySoundEnabled ? "cancel": scStwRemoteRace.isReadyForNextState ? "ready":"cancel"
|
||||
progressControlActivated: scStwRemoteRace.competitionMode && !scStwRemoteRace.readySoundEnabled && !scStwRemoteRace.isReadyForNextState
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: centerExtraContentTop
|
||||
|
||||
size: speedBackend.race.competitionMode ? 0.7:0
|
||||
size: scStwRemoteRace.competitionMode ? 0.7:0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: centerExtraContentBottom
|
||||
|
||||
size: speedBackend.race.competitionMode ? 0.05:0
|
||||
size: scStwRemoteRace.competitionMode ? 0.05:0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: centerExtraContentTopStack
|
||||
|
||||
newItem: speedBackend.race.competitionMode ? waitingDetailsComp:emptyComp
|
||||
newItem: scStwRemoteRace.competitionMode ? waitingDetailsComp:emptyComp
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -337,8 +337,8 @@ Item {
|
|||
PropertyChanges {
|
||||
target: mainActionButton
|
||||
size: 0.9
|
||||
text: speedBackend.race.competitionMode ? "cancel":"stop"
|
||||
progressControlActivated: speedBackend.race.competitionMode
|
||||
text: scStwRemoteRace.competitionMode ? "cancel":"stop"
|
||||
progressControlActivated: scStwRemoteRace.competitionMode
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -375,19 +375,19 @@ Item {
|
|||
PropertyChanges {
|
||||
target: centerExtraContentTop
|
||||
|
||||
size: speedBackend.race.competitionMode ? 0.7:0
|
||||
size: scStwRemoteRace.competitionMode ? 0.7:0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: centerExtraContentBottom
|
||||
|
||||
size: speedBackend.race.competitionMode ? 0.05:0
|
||||
size: scStwRemoteRace.competitionMode ? 0.05:0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: centerExtraContentTopStack
|
||||
|
||||
newItem: speedBackend.race.competitionMode ? incidentDetailsComp:emptyComp
|
||||
newItem: scStwRemoteRace.competitionMode ? incidentDetailsComp:emptyComp
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ ToolBar {
|
|||
anchors.topMargin: app.landscape() ? 0:parent.height * 0.1
|
||||
anchors.bottomMargin: app.landscape() ? 0:parent.height * 0.1
|
||||
|
||||
timers: speedBackend.race.timers
|
||||
timers: scStwRemoteRace.timers
|
||||
colors: appTheme.theme.colors
|
||||
fontName: appTheme.theme.fonts.timers
|
||||
showTimerLetter: true
|
||||
|
@ -94,7 +94,7 @@ ToolBar {
|
|||
rightMargin: app.landscape() ? 0:parent.width * 0.8
|
||||
}
|
||||
|
||||
opacity: speedBackend.race.state === ScStwRace.IDLE ? 1:0
|
||||
opacity: scStwRemoteRace.state === ScStwRace.IDLE ? 1:0
|
||||
|
||||
ConnectionIcon {
|
||||
id: baseConnConnIcon
|
||||
|
|
|
@ -132,22 +132,22 @@ RemoteDataListView {
|
|||
Repeater {
|
||||
id: athleteSelectBoxRep
|
||||
|
||||
model: speedBackend.race.timers.length
|
||||
model: scStwRemoteRace.timers.length
|
||||
|
||||
delegate: CheckBox {
|
||||
id: control
|
||||
|
||||
property bool active: speedBackend.race.timers[index]["id"] === profileList.listData[swipeDelegate.thisIndex]["active"]
|
||||
property bool active: scStwRemoteRace.timers[index]["id"] === profileList.listData[swipeDelegate.thisIndex]["active"]
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
height: parent.height * 0.6
|
||||
|
||||
enabled: speedBackend.race.timers[index]["state"] !== ScStwTimer.DISABLED
|
||||
enabled: scStwRemoteRace.timers[index]["state"] !== ScStwTimer.DISABLED
|
||||
checked: control.active
|
||||
|
||||
onCheckedChanged: {
|
||||
if(checked && !control.active && speedBackend.selectAthlete(profileList.listData[swipeDelegate.thisIndex]["userName"], speedBackend.race.timers[index]["id"])){
|
||||
if(checked && !control.active && speedBackend.selectAthlete(profileList.listData[swipeDelegate.thisIndex]["userName"], scStwRemoteRace.timers[index]["id"])){
|
||||
profileList.loadData()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import QtQuick 2.9
|
||||
import QtQuick 2.12
|
||||
import QtMultimedia 5.8
|
||||
import QtQuick.Window 2.2
|
||||
import QtQuick.Controls 2.12
|
||||
|
@ -52,69 +52,76 @@ Column {
|
|||
height: parentObj.delegateHeight
|
||||
}
|
||||
|
||||
Loader {
|
||||
Item {
|
||||
width: parent.width
|
||||
height: parent.height * 0.05
|
||||
|
||||
Rectangle {
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
height: 2
|
||||
color: appTheme.theme.colors.line
|
||||
}
|
||||
}
|
||||
|
||||
StackView {
|
||||
id: baseStationOptionsLd
|
||||
|
||||
property alias parentComp: control
|
||||
property alias baseConnected: control.baseConnected
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
onBaseConnectedChanged: {
|
||||
disappearAnim.start()
|
||||
property alias parentComp: control
|
||||
property Component sourceComponent: control.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp
|
||||
|
||||
onSourceComponentChanged: {
|
||||
baseStationOptionsLd.replace(sourceComponent)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
baseStationOptionsLd.sourceComponent = control.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp
|
||||
item.opacity = 1
|
||||
item.scale = 1
|
||||
baseStationOptionsLd.replace(sourceComponent)
|
||||
}
|
||||
|
||||
sourceComponent: null
|
||||
replaceExit: Transition {
|
||||
ParallelAnimation {
|
||||
id: disappearAnim
|
||||
|
||||
ParallelAnimation {
|
||||
id: disappearAnim
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
to: 0
|
||||
duration: 100
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
to: 0
|
||||
duration: 100
|
||||
target: baseStationOptionsLd.item
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
property: "scale"
|
||||
to: 0.95
|
||||
duration: 100
|
||||
target: baseStationOptionsLd.item
|
||||
}
|
||||
|
||||
onRunningChanged: {
|
||||
if(!running) {
|
||||
baseStationOptionsLd.sourceComponent = control.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp
|
||||
appearAnim.start()
|
||||
NumberAnimation {
|
||||
property: "scale"
|
||||
to: 0.95
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
id: appearAnim
|
||||
replaceEnter: Transition {
|
||||
ParallelAnimation {
|
||||
id: appearAnim
|
||||
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: 100
|
||||
target: baseStationOptionsLd.item
|
||||
}
|
||||
NumberAnimation {
|
||||
property: "opacity"
|
||||
from: 0
|
||||
to: 1
|
||||
duration: 100
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
property: "scale"
|
||||
from: 0.95
|
||||
to: 1
|
||||
duration: 100
|
||||
target: baseStationOptionsLd.item
|
||||
NumberAnimation {
|
||||
property: "scale"
|
||||
from: 0.95
|
||||
to: 1
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component {
|
||||
|
@ -123,8 +130,6 @@ Column {
|
|||
Column {
|
||||
id: baseStationDisconnectedOptions
|
||||
|
||||
width: parentComp.width
|
||||
|
||||
opacity: 0 // opacity and scale are adjusted by baseStationOptionsLd
|
||||
scale: 0.95
|
||||
|
||||
|
@ -134,11 +139,11 @@ Column {
|
|||
text: qsTr("IP")
|
||||
|
||||
inputHint: "IP"
|
||||
inputText: speedBackend.settings.readSetting(ScStwAppSettings.BaseStationIpSetting)
|
||||
inputText: scStwAppSettings.readSetting(ScStwAppSettings.BaseStationIpSetting)
|
||||
inputTextFieldWidth: width * 0.7
|
||||
|
||||
onInputTextChanged: {
|
||||
speedBackend.settings.writeSetting(ScStwAppSettings.BaseStationIpSetting, inputText)
|
||||
scStwAppSettings.writeSetting(ScStwAppSettings.BaseStationIpSetting, inputText)
|
||||
}
|
||||
|
||||
width: parent.width
|
||||
|
@ -185,6 +190,9 @@ Column {
|
|||
width: parent.width
|
||||
height: parentObj.delegateHeight
|
||||
|
||||
scale: 0
|
||||
visible: false
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
|
@ -221,7 +229,7 @@ Column {
|
|||
SmoothSliderDelegate {
|
||||
id: baseStationVolumeDel
|
||||
|
||||
property ScStwSetting setting: speedBackend.settings.getSetting(ScStwSettings.SoundVolumeSetting, ScStwSettings.KeyLevel)
|
||||
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.SoundVolumeSetting, ScStwSettings.KeyLevel)
|
||||
|
||||
text: qsTr("volume")
|
||||
|
||||
|
@ -239,6 +247,23 @@ Column {
|
|||
}
|
||||
}
|
||||
|
||||
SmoothSwitchDelegate {
|
||||
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.CompetitionModeSetting, ScStwSettings.KeyLevel)
|
||||
|
||||
width: parent.width
|
||||
height: parentObj.delegateHeight
|
||||
|
||||
checked: setting.value
|
||||
|
||||
onCheckedChanged: {
|
||||
enabled = false
|
||||
setting.value = checked
|
||||
enabled = true
|
||||
}
|
||||
|
||||
text: qsTr("competition mode")
|
||||
}
|
||||
|
||||
NextPageDelegate {
|
||||
text: qsTr("extensions")
|
||||
|
||||
|
|
|
@ -23,18 +23,18 @@ Column {
|
|||
|
||||
function updateSetting(key, val, del){
|
||||
del.busy = true
|
||||
speedBackend.settings.writeSetting(key, val, ScStwSettings.KeyLevel)
|
||||
scStwAppSettings.writeSetting(key, val, ScStwSettings.KeyLevel)
|
||||
del.busy = false
|
||||
}
|
||||
|
||||
function loadSetting(key, del){
|
||||
return speedBackend.settings.readSetting(key, ScStwSettings.KeyLevel)
|
||||
return scStwAppSettings.readSetting(key, ScStwSettings.KeyLevel)
|
||||
}
|
||||
|
||||
SmoothSwitchDelegate {
|
||||
id: ready_del
|
||||
|
||||
property ScStwSetting setting: speedBackend.settings.getSetting(ScStwSettings.ReadySoundEnableSetting, ScStwSettings.KeyLevel)
|
||||
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.ReadySoundEnableSetting, ScStwSettings.KeyLevel)
|
||||
|
||||
width: parent.width
|
||||
height: parentObj.delegateHeight
|
||||
|
@ -54,7 +54,7 @@ Column {
|
|||
id: ready_delay_del
|
||||
|
||||
property bool busy: false
|
||||
property ScStwSetting setting: speedBackend.settings.getSetting(ScStwSettings.ReadySoundDelaySetting, ScStwSettings.KeyLevel)
|
||||
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.ReadySoundDelaySetting, ScStwSettings.KeyLevel)
|
||||
|
||||
width: parent.width
|
||||
height: parentObj.delegateHeight
|
||||
|
@ -78,7 +78,7 @@ Column {
|
|||
SmoothSwitchDelegate {
|
||||
id: at_marks_del
|
||||
|
||||
property ScStwSetting setting: speedBackend.settings.getSetting(ScStwSettings.AtYourMarksSoundEnableSetting, ScStwSettings.KeyLevel)
|
||||
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.AtYourMarksSoundEnableSetting, ScStwSettings.KeyLevel)
|
||||
|
||||
width: parent.width
|
||||
height: parentObj.delegateHeight
|
||||
|
@ -98,7 +98,7 @@ Column {
|
|||
id: at_marks_delay_del
|
||||
|
||||
property bool busy: false
|
||||
property ScStwSetting setting: speedBackend.settings.getSetting(ScStwSettings.AtYourMarksSoundDelaySetting, ScStwSettings.KeyLevel)
|
||||
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.AtYourMarksSoundDelaySetting, ScStwSettings.KeyLevel)
|
||||
|
||||
width: parent.width
|
||||
height: parentObj.delegateHeight
|
||||
|
|
|
@ -45,8 +45,7 @@ ApplicationWindow {
|
|||
id: app
|
||||
anchors.fill: parent
|
||||
|
||||
//set default state to IDLE
|
||||
state: ScStwRace.IDLE
|
||||
state: scStwRemoteRace.state
|
||||
|
||||
Rectangle {
|
||||
id: backgroundRect
|
||||
|
@ -64,28 +63,50 @@ ApplicationWindow {
|
|||
id: scStw
|
||||
}
|
||||
|
||||
SpeedBackend {
|
||||
id: speedBackend
|
||||
ScStwClient {
|
||||
id: scStwClient
|
||||
|
||||
property ScStwSetting ipSetting: scStwAppSettings.getSetting(ScStwAppSettings.BaseStationIpSetting, ScStwAppSettings.KeyLevel)
|
||||
ipAddress: ipSetting.value
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: speedBackend.race
|
||||
onStateChanged: {
|
||||
var stateString
|
||||
console.log("race state changed to: " + speedBackend.race.state)
|
||||
ScStwAppSettings {
|
||||
id: scStwAppSettings
|
||||
|
||||
if(speedBackend.race.state != ScStwRace.IDLE) {
|
||||
scStwClient: scStwClient
|
||||
}
|
||||
|
||||
ScStwTimer {
|
||||
id: defaultTimer
|
||||
}
|
||||
|
||||
ScStwRemoteRace {
|
||||
id: scStwRemoteRace
|
||||
|
||||
autoRefreshTimerText: true
|
||||
settings: scStwAppSettings
|
||||
scStwClient: scStwClient
|
||||
|
||||
Component.onCompleted: {
|
||||
scStwRemoteRace.addTimer(defaultTimer)
|
||||
}
|
||||
|
||||
onStateChanged: {
|
||||
if(scStwRemoteRace.state !== ScStwRace.IDLE) {
|
||||
settingsDialog.close()
|
||||
profilesDialog.close()
|
||||
}
|
||||
|
||||
app.state = speedBackend.race.state
|
||||
}
|
||||
}
|
||||
|
||||
SpeedBackend {
|
||||
id: speedBackend
|
||||
scStwClient: scStwClient
|
||||
}
|
||||
|
||||
ScStwAppThemeManager {
|
||||
id: appTheme
|
||||
property ScStwSetting setting: speedBackend.settings.getSetting(ScStwAppSettings.AppThemeSetting, ScStwAppSettings.KeyLevel)
|
||||
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwAppSettings.AppThemeSetting, ScStwAppSettings.KeyLevel)
|
||||
themeName: setting.value
|
||||
}
|
||||
|
||||
|
@ -252,196 +273,8 @@ ApplicationWindow {
|
|||
height: centerContent.height - margin * 2
|
||||
}
|
||||
|
||||
/*
|
||||
states: [
|
||||
State {
|
||||
name: "IDLE"
|
||||
//state for the start page
|
||||
PropertyChanges {
|
||||
target: topContainerItm;
|
||||
anchors.bottomMargin: app.landscape() ? undefined:parent.height * 0.1;
|
||||
anchors.rightMargin: app.landscape() ? parent.height * 0.05:0
|
||||
}
|
||||
PropertyChanges {
|
||||
target: startButt;
|
||||
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: "click start to start"
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "PREPAIRING"
|
||||
//state for the start sequence
|
||||
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: "At your marks"
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "WAITING"
|
||||
PropertyChanges {
|
||||
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
|
||||
implicitText: "Ready"
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "STARTING"
|
||||
//state for the start sequence
|
||||
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
|
||||
implicitText: "Starting"
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "RUNNING"
|
||||
//state when the timer is running
|
||||
PropertyChanges { target: startButt; enabled: true;
|
||||
text: speedBackend.scStwClient.state === ScStwClient.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.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
|
||||
implicitText: ""
|
||||
}
|
||||
},
|
||||
|
||||
State {
|
||||
name: "STOPPED"
|
||||
//state when the meassuring is over
|
||||
PropertyChanges {
|
||||
target: startButt;
|
||||
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: app.landscape() ? 0-startButt.width/2:undefined
|
||||
anchors.bottomMargin: app.landscape() ? undefined:0-startButt.height/2
|
||||
}
|
||||
PropertyChanges {
|
||||
target: topLa
|
||||
text: ""
|
||||
}
|
||||
},
|
||||
|
||||
State {
|
||||
name: "INCIDENT"
|
||||
//state when the meassuring is over
|
||||
PropertyChanges {
|
||||
target: startButt;
|
||||
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: app.landscape() ? 0-startButt.width/2:undefined
|
||||
anchors.bottomMargin: app.landscape() ? undefined:0-startButt.height/2
|
||||
}
|
||||
PropertyChanges {
|
||||
target: topLa
|
||||
text: ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
/*----------------------
|
||||
Timer animations
|
||||
----------------------*/
|
||||
/*transitions: [
|
||||
Transition {
|
||||
NumberAnimation { properties: "size,rightMargin,height,width,bottomMargin,font.pixelSize,pixelSize"; easing.type: Easing.InOutQuad; duration: 700 }
|
||||
},
|
||||
Transition {
|
||||
to: "STOPPED"
|
||||
NumberAnimation { properties: "size,rightMargin,height,width,bottomMargin,font.pixelSize,pixelSize"; easing.type: Easing.InOutQuad; duration: 700 }
|
||||
},
|
||||
Transition {
|
||||
to: "IDLE"
|
||||
NumberAnimation { properties: "size,rightMargin,height,width,bottomMargin,font.pixelSize,pixelSize"; easing.type: Easing.InOutQuad; duration: 700 }
|
||||
},
|
||||
|
||||
Transition {
|
||||
from: "STARTING"
|
||||
to: "RUNNING"
|
||||
//disable transitions for the RUNNING state
|
||||
},
|
||||
Transition {
|
||||
from: "RUNNING"
|
||||
to: "WAITING"
|
||||
//disable transitions for the RUNNING state
|
||||
}
|
||||
]*/
|
||||
|
||||
/*----------------------
|
||||
Timer functions
|
||||
----------------------*/
|
||||
function landscape(){
|
||||
return(app.height < app.width)
|
||||
}
|
||||
|
||||
/*----Functions to control the stopwatch----*/
|
||||
function start(){
|
||||
var ret = speedBackend.race.start()
|
||||
if(ret !== 200){
|
||||
console.log("+ --- error starting race: " + ret)
|
||||
}
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
var ret = speedBackend.race.cancel()
|
||||
if(ret !== 200){
|
||||
console.log("+ --- error canellingr race: " + ret)
|
||||
}
|
||||
}
|
||||
|
||||
function stop(){
|
||||
|
||||
var ret = speedBackend.race.stop()
|
||||
|
||||
if(ret !== 200){
|
||||
console.log("+ --- error stopping race: " + ret)
|
||||
}
|
||||
}
|
||||
|
||||
function reset(){
|
||||
|
||||
var ret = speedBackend.race.reset()
|
||||
|
||||
if(ret !== 200){
|
||||
console.log("+ --- error resetting race: " + ret)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<file>SettingsDialog/StartPage.qml</file>
|
||||
<file>SettingsDialog/SettingsStartSequencePage.qml</file>
|
||||
<file>SettingsDialog/SettingsBaseStationPage.qml</file>
|
||||
<file>main.old.qml</file>
|
||||
<file>components/layout/ToolBar.qml</file>
|
||||
<file>MainPage/TopToolBar.qml</file>
|
||||
<file>MainPage/CenterContent.qml</file>
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f8cc23646cd77c85b4d86b145e4da3779a4766aa
|
||||
Subproject commit ca040a191cf9575e0b6095547522a6d1b09cecca
|
|
@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
// setup speed backend
|
||||
qmlRegisterType<ScStwAppBackend>("de.itsblue.ScStwApp", 2, 0, "SpeedBackend");
|
||||
qmlRegisterUncreatableType<ScStwAppSettings>("de.itsblue.ScStwApp", 2, 0, "ScStwAppSettings", "The ScStwAppSettings type is not creatable!");
|
||||
qmlRegisterType<ScStwAppSettings>("de.itsblue.ScStwApp", 2, 0, "ScStwAppSettings");
|
||||
|
||||
qRegisterMetaType<ScStwAppSettings::AppInternalSetting>("ScStwAppSettings::BaseStationSetting");
|
||||
|
||||
|
|
|
@ -2,39 +2,17 @@
|
|||
|
||||
ScStwAppBackend::ScStwAppBackend(QObject *parent) : QObject(parent)
|
||||
{
|
||||
this->scStwClient = new ScStwClient(this);
|
||||
|
||||
this->appSettings = new ScStwAppSettings(this->scStwClient, this);
|
||||
|
||||
this->race = new ScStwRemoteRace(this->scStwClient, this->appSettings, this);
|
||||
this->race->addTimer(new ScStwTimer(this));
|
||||
|
||||
this->scStwClient->setIP(this->appSettings->readSetting(ScStwAppSettings::BaseStationIpSetting).toString());
|
||||
|
||||
this->timerTextRefreshTimer = new QTimer(this);
|
||||
this->timerTextRefreshTimer->setInterval(1);
|
||||
this->timerTextRefreshTimer->setSingleShot(true);
|
||||
this->timerTextRefreshTimer->connect(this->timerTextRefreshTimer, &QTimer::timeout, this, &ScStwAppBackend::refreshTimerText);
|
||||
this->refreshTimerText();
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// --- helper functions ---
|
||||
// ------------------------
|
||||
|
||||
void ScStwAppBackend::refreshTimerText() {
|
||||
|
||||
// --- refresh timer text ---
|
||||
if(this->getRace()->getState() == ScStwRace::RUNNING) {
|
||||
emit this->getRace()->timersChanged();
|
||||
void ScStwAppBackend::setScStwClient(ScStwClient *client) {
|
||||
if(client != this->scStwClient) {
|
||||
this->scStwClient = client;
|
||||
emit this->scStwClientChanged();
|
||||
}
|
||||
|
||||
// --- refresh next start action delay progress ---
|
||||
if(this->getRace()->getState() == ScStwRace::WAITING || this->getRace()->getState() == ScStwRace::PREPAIRING) {
|
||||
emit this->getRace()->currentStartDelayChanged();
|
||||
}
|
||||
|
||||
this->timerTextRefreshTimer->start();
|
||||
}
|
||||
|
||||
// - athlete management -
|
||||
|
@ -123,14 +101,6 @@ QVariant ScStwAppBackend::getResults( QString userName ){
|
|||
// --- functions for qml ---
|
||||
// -------------------------
|
||||
|
||||
ScStwRace* ScStwAppBackend::getRace() {
|
||||
return this->race;
|
||||
}
|
||||
|
||||
ScStwAppSettings * ScStwAppBackend::getSettings() {
|
||||
return this->appSettings;
|
||||
}
|
||||
|
||||
ScStwClient* ScStwAppBackend::getScStwClient() {
|
||||
return this->scStwClient;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
|
||||
ScStwAppSettings * pGlobalAppSettings = nullptr;
|
||||
|
||||
ScStwAppSettings::ScStwAppSettings(QObject *parent) : ScStwAppSettings (nullptr, parent)
|
||||
{
|
||||
}
|
||||
|
||||
ScStwAppSettings::ScStwAppSettings(ScStwClient * client, QObject* parent)
|
||||
:ScStwRemoteSettings(client, parent)
|
||||
{
|
||||
|
|
Reference in a new issue