diff --git a/qml/SettingsDialog.qml b/qml/SettingsDialog.qml index 1670bc8..0a5634c 100644 --- a/qml/SettingsDialog.qml +++ b/qml/SettingsDialog.qml @@ -229,7 +229,7 @@ Popup { height: options_stack.delegateHeight - text: qsTr("start sequence") + text: qsTr("Start sequence") onClicked: { options_stack.push(autostart) @@ -239,7 +239,7 @@ Popup { /*----Style Settings----*/ SmoothSwitchDelegate { id: styleDel - text: qsTr("dark mode") + text: qsTr("Dark mode") width: parent.width height: options_stack.delegateHeight @@ -278,7 +278,7 @@ Popup { width: parent.width height: options_stack.delegateHeight - text: qsTr("say 'ready'") + text: qsTr("Say 'ready'") checked: parent.loadSetting("ready_en", ready_del) === "true" @@ -295,7 +295,7 @@ Popup { enabled: ready_del.checked - text: qsTr("delay (ms)") + text: qsTr("Delay (ms)") inputHint: qsTr("time") inputMethodHints: Qt.ImhFormattedNumbersOnly @@ -312,7 +312,7 @@ Popup { width: parent.width 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" @@ -327,7 +327,7 @@ Popup { width: parent.width height: options_stack.delegateHeight - text: qsTr("delay (ms)") + text: qsTr("Delay (ms)") inputHint: qsTr("time") inputMethodHints: Qt.ImhFormattedNumbersOnly @@ -355,7 +355,7 @@ Popup { ConnectionDelegate { 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 } connect: speedBackend.connectBaseStation @@ -364,91 +364,189 @@ Popup { width: parent.width height: options_stack.delegateHeight - - font.pixelSize: height * 0.6 } - InputDelegate { - id: baseStationIpDel + Loader { + id: baseStationOptionsLd - text: qsTr("IP-Adress") + property alias parentComp: connectCol + property alias baseConnected: connectCol.baseConnected - inputHint: "IP" - inputText: speedBackend.readSetting("baseStationIpAdress") - inputTextFieldWidth: width * 0.7 - - onInputTextChanged: { - speedBackend.writeSetting("baseStationIpAdress", inputText) - speedBackend.reloadBaseStationIpAdress() + onBaseConnectedChanged: { + disappearAnim.start() } - width: parent.width - height: !connectCol.baseConnected ? options_stack.delegateHeight:0 + Component.onCompleted: { + baseStationOptionsLd.sourceComponent = connectCol.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp + item.opacity = 1 + item.scale = 1 + } - visible: height > 5 + sourceComponent: null + + ParallelAnimation { + id: disappearAnim - Behavior on height { NumberAnimation { - duration: 400 - easing.type: Easing.Linear + property: "opacity" + to: 0 + duration: 100 + target: baseStationOptionsLd.item } - } - } - SmoothSliderDelegate { - id: baseStationVolumeDel - text: qsTr("volume") + NumberAnimation { + property: "scale" + to: 0.95 + duration: 100 + target: baseStationOptionsLd.item + } - property bool active: connectCol.baseConnected - - width: parent.width - height: active ? options_stack.delegateHeight:0 - - visible: height > 5 - - sliderValue: 0 - - onSliderFinished: { - speedBackend.writeSetting("soundVolume", sliderValue) - } - - onActiveChanged: { - - if(active){ - var val = speedBackend.readSetting("soundVolume") - console.log(val) - if(val !== "false"){ - sliderValue = parseFloat(val) + onRunningChanged: { + if(!running) { + baseStationOptionsLd.sourceComponent = connectCol.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp + appearAnim.start() } } } - Behavior on height { + ParallelAnimation { + id: appearAnim + NumberAnimation { - duration: 400 - easing.type: Easing.Linear + property: "opacity" + from: 0 + to: 1 + duration: 100 + target: baseStationOptionsLd.item + } + + NumberAnimation { + property: "scale" + from: 0.95 + to: 1 + duration: 100 + target: baseStationOptionsLd.item } } + } - NextPageDelegate { - id: baseStationConnectionsDel - text: qsTr("connected extensions") + Component { + id: baseStationDisconnectedOptionsComp - width: parent.width - height: connectCol.baseConnected ? options_stack.delegateHeight:0 + Column { + id: baseStationDisconnectedOptions - visible: height > 5 + width: parentComp.width + + opacity: 0 // opacity and scale are adjusted by baseStationOptionsLd + scale: 0.95 + + InputDelegate { + id: baseStationIpDel + + text: qsTr("IP") + + inputHint: "IP" + inputText: speedBackend.readSetting("baseStationIpAdress") + inputTextFieldWidth: width * 0.7 + + onInputTextChanged: { + speedBackend.writeSetting("baseStationIpAdress", inputText) + speedBackend.reloadBaseStationIpAdress() + } + + width: parent.width + height: options_stack.delegateHeight + + visible: height > 5 + + Behavior on height { + NumberAnimation { + duration: 400 + easing.type: Easing.Linear + } + } + } + + SmoothItemDelegate { + id: baseStationHelpDel + + width: parent.width + height: options_stack.delegateHeight + + text: qsTr("What is this for?") + + onClicked: { + Qt.openUrlExternally("https://itsblue.de/index.php/speed-climbing?ref=ScStwApp") + } + } - onClicked: { - options_stack.push(baseStationConnections) } - Behavior on height { - NumberAnimation { - duration: 400 - easing.type: Easing.Linear + } + + Component { + id: baseStationConnectedOptionsComp + + Column { + id: baseStationConnectedOptions + + width: parentComp.width + + opacity: 0 // opacity and scale are adjusted by baseStationOptionsLd + scale: 0.95 + + SmoothSliderDelegate { + id: baseStationVolumeDel + text: qsTr("Volume") + + width: parent.width + height: options_stack.delegateHeight + + sliderValue: 0 + + onSliderFinished: { + speedBackend.writeSetting("soundVolume", sliderValue) + } + + Component.onCompleted: { + var val = speedBackend.readSetting("soundVolume") + console.log(val) + if(val !== "false"){ + sliderValue = parseFloat(val) + } + } + + Behavior on height { + NumberAnimation { + duration: 400 + easing.type: Easing.Linear + } + } } + + NextPageDelegate { + id: baseStationConnectionsDel + text: qsTr("Connected extensions") + + width: parent.width + height: options_stack.delegateHeight + + visible: height > 5 + + onClicked: { + options_stack.push(baseStationConnections) + } + + Behavior on height { + NumberAnimation { + duration: 400 + easing.type: Easing.Linear + } + } + } + } } } diff --git a/qml/components/SmoothItemDelegate.qml b/qml/components/SmoothItemDelegate.qml index c3627d0..2caf73a 100644 --- a/qml/components/SmoothItemDelegate.qml +++ b/qml/components/SmoothItemDelegate.qml @@ -7,6 +7,8 @@ ItemDelegate { property color textColor: appTheme.style.textColor property alias backgroundRect: backgroundRect + font.pixelSize: height * 0.4 + opacity: enabled ? 1 : 0.2 contentItem: Text { @@ -31,7 +33,7 @@ ItemDelegate { fontSizeMode: Text.Fit - font.pixelSize: control.height * 0.4 + font.pixelSize: control.font.pixelSize minimumPixelSize: 1 } diff --git a/qml/components/SmoothSwitchDelegate.qml b/qml/components/SmoothSwitchDelegate.qml index 8942d21..0942bf7 100644 --- a/qml/components/SmoothSwitchDelegate.qml +++ b/qml/components/SmoothSwitchDelegate.qml @@ -60,7 +60,7 @@ SwitchDelegate { width: parent.height height: parent.height radius: height * 0.5 - color: parent.down ? "#cccccc" : "#ffffff" + color: parent.down ? appTheme.style.buttonPressedColor:appTheme.style.backgroundColor border.color: parent.checked ? (parent.down ? "#17a81a" : "#21be2b") : "#999999" Behavior on x{ NumberAnimation { diff --git a/qml/main.qml b/qml/main.qml index bac106e..cb1e1a1 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -188,8 +188,8 @@ Window { height: parent.height elide: "ElideRight" - color: speedBackend.timers[index]["state"] === "WON" ? appTheme.style.successColor : - speedBackend.timers[index]["state"] === "LOST" ? appTheme.style.errorColor: + color: ["WON"].includes(speedBackend.timers[index]["state"]) ? appTheme.style.successColor : + ["LOST", "FAILED"].includes(speedBackend.timers[index]["state"]) ? appTheme.style.errorColor: appTheme.style.textColor enabled: speedBackend.timers[index]["state"] !== "DISABLED" @@ -205,12 +205,12 @@ Window { minimumPixelSize: 1 - Behavior on text { - enabled: app.state !== "RUNNING" && app.state !== "STOPPED" + /*Behavior on text { + enabled: !["RUNNING", "STOPPED", "WON", "LOST", "FAILED", "CANCELLED"].includes(app.state) FadeAnimation { target: timerTextLa } - } + }*/ } Label { diff --git a/shared.qrc b/shared.qrc index b738fe3..d977fbf 100644 --- a/shared.qrc +++ b/shared.qrc @@ -24,8 +24,6 @@ graphics/icons/startpad.png graphics/icons/user_black.png graphics/icons/ok.png - sounds/IFSC_STARTSIGNAL_SAWTOOTH.wav sounds/IFSC_STARTSIGNAL_SINE.wav - sounds/IFSC_STARTSIGNAL_SQUARE.wav diff --git a/sounds/IFSC_STARTSIGNAL_SAWTOOTH.wav b/sounds/IFSC_STARTSIGNAL_SAWTOOTH.wav deleted file mode 100644 index eed682e..0000000 Binary files a/sounds/IFSC_STARTSIGNAL_SAWTOOTH.wav and /dev/null differ diff --git a/sounds/IFSC_STARTSIGNAL_SINE.wav b/sounds/IFSC_STARTSIGNAL_SINE.wav index 8f6e0cd..c04ad24 100644 Binary files a/sounds/IFSC_STARTSIGNAL_SINE.wav and b/sounds/IFSC_STARTSIGNAL_SINE.wav differ diff --git a/sounds/IFSC_STARTSIGNAL_SQUARE.wav b/sounds/IFSC_STARTSIGNAL_SQUARE.wav deleted file mode 100644 index 8223e95..0000000 Binary files a/sounds/IFSC_STARTSIGNAL_SQUARE.wav and /dev/null differ diff --git a/sources/apptheme.cpp b/sources/apptheme.cpp index 57e8907..dd6fd19 100644 --- a/sources/apptheme.cpp +++ b/sources/apptheme.cpp @@ -7,7 +7,7 @@ AppTheme::AppTheme(QObject *parent) : QObject(parent) {"backgroundColor", "#2d3037"}, {"buttonColor", "#202227"}, - {"buttonPressedColor", "#6ccaf2"}, + {"buttonPressedColor", "#41454f"}, {"buttonBorderColor", "grey"}, {"disabledButtonColor", "#555555"},