split the SettingsDialog up into multiple files

This commit is contained in:
dorian 2019-10-18 16:10:41 +02:00
parent 01ba412e4e
commit 496d274780
11 changed files with 752 additions and 659 deletions

View file

@ -30,6 +30,16 @@ public:
int errors;
int errors_until_disconnect = 4;
QVariant connections;
QString latestReadReply;
//---general status values---//
// some meta data of the base
QString version;
double timeOffset;
// the current state
QString state;
// can be:
@ -37,12 +47,6 @@ public:
// - 'connecting'
// - 'connected'
QVariant connections;
QString latestReadReply;
//---general status values---//
private:
QDateTime *date;

View file

@ -1,650 +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 <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "./components"
Popup {
id: root
modal: true
dim: false
opacity: 0
enter: Transition {
NumberAnimation { properties: "opacity"; to: 1; duration: 300; easing.type: Easing.InOutQuad }
NumberAnimation { properties: "scale"; from: 0.9; to: 1; duration: 300; easing.type: Easing.InOutQuad }
}
exit: Transition {
NumberAnimation { properties: "opacity"; to: 0; duration: 300; easing.type: Easing.InOutQuad }
NumberAnimation { properties: "scale"; from: 1; to: 0.9; duration: 300; easing.type: Easing.InOutQuad }
}
background: Rectangle {
radius: width * 0.5
color: appTheme.style.viewColor
border.color: appTheme.style.lineColor
border.width: 0
Behavior on color {
ColorAnimation {
duration: 200
}
}
RectangularGlow {
id: headerUnderlineEffect
glowRadius: 7
spread: 0.02
color: "black"
opacity: 0.18
anchors.fill: headlineUnderline
scale: 1
}
Canvas {
id: headerBackground
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: headlineUnderline.bottom
}
height: header.height
width: header.width
property color color: appTheme.style.viewColor
Behavior on color {
ColorAnimation {
duration: 200
}
}
onColorChanged: {
requestPaint()
}
onPaint: {
var ctx = getContext("2d");
ctx.reset();
var centreX = root.width / 2;
var centreY = root.height / 2;
ctx.beginPath();
ctx.fillStyle = headerBackground.color
ctx.moveTo(centreX, centreY);
ctx.arc(centreX, centreY, root.width / 2, 1 * Math.PI, 2*Math.PI, false);
//ctx.lineTo(centreX, centreY);
ctx.fill();
}
}
Item {
id: header
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: headlineUnderline.bottom
}
Label {
id: head_text
anchors {
centerIn: parent
}
width: headlineUnderline.width * 0.4
height: parent.height
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: options_stack.currentItem.title
font.pixelSize: headlineUnderline.width * 0.1
color: enabled ? appTheme.style.textColor:appTheme.style.disabledTextColor
}
}
Rectangle {
id: headlineUnderline
height: 1
width: parent.width
color: appTheme.style.lineColor
visible: false
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))
}
}
FancyButton {
id: head_back
anchors {
left: parent.left
leftMargin: parent.width * 0.17
top:parent.top
topMargin: parent.height * 0.01
}
height: parent.height * 0.13
width: height
//opacity: root.closePolicy === Popup.NoAutoClose ? 0:1
enabled: opacity > 0
glowOpacity: Math.pow( root.opacity, 100 )
image: appTheme.style.backIcon
onClicked: {
options_stack.depth > 1 ? options_stack.pop():root.close()
}
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
}
StackView {
id: options_stack
property int delegateHeight: height * 0.2
property int rowSpacing: height * 0.01
initialItem: settings
width: headlineUnderline.width
enabled: opacity !== 0 //disable when not visible
anchors {
top: parent.top
left: parent.left
leftMargin: ( parent.width - headlineUnderline.width ) / 2
topMargin: headlineUnderline.anchors.topMargin * 0.95
bottom: parent.bottom
}
Behavior on opacity {
NumberAnimation {duration: 200}
}
/*-----start page of the settings-----*/
Component {
id: settings
Column {
id: settings_col
property string title: qsTr("options")
spacing: options_stack.rowSpacing
/*----Connect to external devices----*/
NextPageDelegate {
id: connect_del
height: options_stack.delegateHeight
text: qsTr("base station")
onClicked: {
options_stack.push(connect)
}
}
/*----Automated Start----*/
NextPageDelegate {
id: autostart_del
height: options_stack.delegateHeight
text: qsTr("start sequence")
onClicked: {
options_stack.push(autostart)
}
}
/*----Style Settings----*/
SmoothSwitchDelegate {
id: styleDel
text: qsTr("dark mode")
width: parent.width
height: options_stack.delegateHeight
checked: speedBackend.readSetting("theme") === "Dark"
onCheckedChanged: {
speedBackend.writeSetting("theme", checked ? "Dark":"Light")
appTheme.refreshTheme()
}
}
}
}
/*-----Page to setup automatc start sequence-----*/
Component {
id: autostart
Column {
id: autostart_col
spacing: options_stack.rowSpacing
property string title: "autostart"
function updateSetting(key, val, del){
speedBackend.writeSetting(key, val)
}
function loadSetting(key, del){
return speedBackend.readSetting(key)
}
SmoothSwitchDelegate {
id: ready_del
width: parent.width
height: options_stack.delegateHeight
text: qsTr("say 'ready'")
checked: parent.loadSetting("ready_en", ready_del) === "true"
onCheckedChanged: {
parent.updateSetting("ready_en",checked, ready_del)
}
}
InputDelegate {
id: ready_delay_del
width: parent.width
height: options_stack.delegateHeight
enabled: ready_del.checked
text: qsTr("delay (ms)")
inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly
inputText: autostart_col.loadSetting("ready_delay", ready_del)
onInputFinished: {
autostart_col.updateSetting("ready_delay", inputText, ready_delay_del)
}
}
SmoothSwitchDelegate {
id: at_marks_del
width: parent.width
height: options_stack.delegateHeight
text: qsTr("say 'at your marks'")
checked: autostart_col.loadSetting("at_marks_en", ready_del) === "true"
onCheckedChanged: {
parent.updateSetting("at_marks_en",at_marks_del.checked, at_marks_del)
}
}
InputDelegate {
id: at_marks_delay_del
width: parent.width
height: options_stack.delegateHeight
text: qsTr("delay (ms)")
inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly
enabled: at_marks_del.checked
inputText: autostart_col.loadSetting("at_marks_delay", at_marks_delay_del)
onInputFinished: {
autostart_col.updateSetting("at_marks_delay", inputText, at_marks_delay_del)
}
}
}
}
/*-----Page to connect to the base station -----*/
Component {
id: connect
Column {
id: connectCol
property string title: qsTr("base station")
spacing: options_stack.rowSpacing
property bool baseConnected: speedBackend.baseStationState === "connected"
opacity: 0
ConnectionDelegate {
id: connectToBaseDel
text: status.status === "connected" ? qsTr("disconnect"): status.status === "disconnected" ? qsTr("connect"):qsTr("connecting...")
status: { "status": speedBackend.baseStationState, "progress": 100 }
connect: speedBackend.connectBaseStation
disconnect: speedBackend.disconnectBaseStation
type: "baseStation"
width: parent.width
height: options_stack.delegateHeight
}
Loader {
id: baseStationOptionsLd
property alias parentComp: connectCol
property alias baseConnected: connectCol.baseConnected
onBaseConnectedChanged: {
disappearAnim.start()
}
Component.onCompleted: {
baseStationOptionsLd.sourceComponent = connectCol.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp
item.opacity = 1
item.scale = 1
}
sourceComponent: null
ParallelAnimation {
id: disappearAnim
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 = connectCol.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp
appearAnim.start()
}
}
}
ParallelAnimation {
id: appearAnim
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: 100
target: baseStationOptionsLd.item
}
NumberAnimation {
property: "scale"
from: 0.95
to: 1
duration: 100
target: baseStationOptionsLd.item
}
}
}
Component {
id: baseStationDisconnectedOptionsComp
Column {
id: baseStationDisconnectedOptions
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")
}
}
}
}
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
}
}
}
}
}
}
}
/*-----Page to view devices that core connected to the pase startion-----*/
Component{
id: baseStationConnections
ListView {
id: baseStationConnections_list
property string title: qsTr("connections")
spacing: options_stack.rowSpacing
boundsBehavior: Flickable.StopAtBounds
model: speedBackend.baseStationConnections.length
delegate: ConnectionDelegate {
opacity: 1
width: parent.width
height: options_stack.delegateHeight
text: speedBackend.baseStationConnections[index]["name"]
status: {'status': speedBackend.baseStationConnections[index]["state"], 'progress': speedBackend.baseStationConnections[index]["progress"]}
}
}
}
/*-----Custom animations-----*/
pushEnter: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
from: width * 0.1
to: 0
duration: 300
}
}
pushExit: Transition {
NumberAnimation {
property: "opacity"
from: 1
to: 0
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
to: -width * 0.1
from: 0
duration: 300
}
}
popExit: Transition {
NumberAnimation {
property: "opacity"
from: 1
to: 0
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
to: width * 0.1
from: 0
duration: 300
}
}
popEnter: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
from: -width * 0.1
to: 0
duration: 300
}
}
}
}

View file

@ -0,0 +1,30 @@
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "../components"
ListView {
id: control
property string title: qsTr("connections")
property var parentObj
spacing: parentObj.rowSpacing
boundsBehavior: Flickable.StopAtBounds
model: speedBackend.baseStationConnections.length
delegate: ConnectionDelegate {
opacity: 1
width: parent.width
height: parentObj.delegateHeight
text: speedBackend.baseStationConnections[index]["name"]
status: {'status': speedBackend.baseStationConnections[index]["state"], 'progress': speedBackend.baseStationConnections[index]["progress"]}
}
}

View file

@ -0,0 +1,218 @@
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "../components"
Column {
id: control
property string title: qsTr("base station")
spacing: parentObj.rowSpacing
property bool baseConnected: speedBackend.baseStationState === "connected"
property var parentObj
opacity: 0
ConnectionDelegate {
id: connectToBaseDel
text: status.status === "connected" ? qsTr("disconnect"): status.status === "disconnected" ? qsTr("connect"):qsTr("connecting...")
status: { "status": speedBackend.baseStationState, "progress": 100 }
connect: speedBackend.connectBaseStation
disconnect: speedBackend.disconnectBaseStation
type: "baseStation"
width: parent.width
height: parentObj.delegateHeight
}
Loader {
id: baseStationOptionsLd
property alias parentComp: control
property alias baseConnected: control.baseConnected
onBaseConnectedChanged: {
disappearAnim.start()
}
Component.onCompleted: {
baseStationOptionsLd.sourceComponent = control.baseConnected ? baseStationConnectedOptionsComp : baseStationDisconnectedOptionsComp
item.opacity = 1
item.scale = 1
}
sourceComponent: null
ParallelAnimation {
id: disappearAnim
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()
}
}
}
ParallelAnimation {
id: appearAnim
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: 100
target: baseStationOptionsLd.item
}
NumberAnimation {
property: "scale"
from: 0.95
to: 1
duration: 100
target: baseStationOptionsLd.item
}
}
}
Component {
id: baseStationDisconnectedOptionsComp
Column {
id: baseStationDisconnectedOptions
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: parentObj.delegateHeight
visible: height > 5
Behavior on height {
NumberAnimation {
duration: 400
easing.type: Easing.Linear
}
}
}
SmoothItemDelegate {
id: baseStationHelpDel
width: parent.width
height: parentObj.delegateHeight
text: qsTr("what is this for?")
onClicked: {
Qt.openUrlExternally("https://itsblue.de/index.php/speed-climbing?ref=ScStwApp")
}
}
}
}
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: parentObj.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: parentObj.delegateHeight
visible: height > 5
onClicked: {
parentObj.push(baseStationConnections)
}
Behavior on height {
NumberAnimation {
duration: 400
easing.type: Easing.Linear
}
}
}
}
}
}

View file

@ -0,0 +1,202 @@
/*
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/>.
*/
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "../components"
Popup {
id: root
modal: true
dim: false
opacity: 0
enter: Transition {
NumberAnimation { properties: "opacity"; to: 1; duration: 300; easing.type: Easing.InOutQuad }
NumberAnimation { properties: "scale"; from: 0.9; to: 1; duration: 300; easing.type: Easing.InOutQuad }
}
exit: Transition {
NumberAnimation { properties: "opacity"; to: 0; duration: 300; easing.type: Easing.InOutQuad }
NumberAnimation { properties: "scale"; from: 1; to: 0.9; duration: 300; easing.type: Easing.InOutQuad }
}
background: Rectangle {
radius: width * 0.5
color: appTheme.style.viewColor
border.color: appTheme.style.lineColor
border.width: 0
Behavior on color {
ColorAnimation {
duration: 200
}
}
RectangularGlow {
id: headerUnderlineEffect
glowRadius: 7
spread: 0.02
color: "black"
opacity: 0.18
anchors.fill: headlineUnderline
scale: 1
}
Canvas {
id: headerBackground
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: headlineUnderline.bottom
}
height: header.height
width: header.width
property color color: appTheme.style.viewColor
Behavior on color {
ColorAnimation {
duration: 200
}
}
onColorChanged: {
requestPaint()
}
onPaint: {
var ctx = getContext("2d");
ctx.reset();
var centreX = root.width / 2;
var centreY = root.height / 2;
ctx.beginPath();
ctx.fillStyle = headerBackground.color
ctx.moveTo(centreX, centreY);
ctx.arc(centreX, centreY, root.width / 2, 1 * Math.PI, 2*Math.PI, false);
//ctx.lineTo(centreX, centreY);
ctx.fill();
}
}
Item {
id: header
anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: headlineUnderline.bottom
}
Label {
id: head_text
anchors {
centerIn: parent
}
width: headlineUnderline.width * 0.4
height: parent.height
fontSizeMode: Text.Fit
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: options_stack.currentItem.title
font.pixelSize: headlineUnderline.width * 0.1
color: enabled ? appTheme.style.textColor:appTheme.style.disabledTextColor
}
}
Rectangle {
id: headlineUnderline
height: 1
width: parent.width
color: appTheme.style.lineColor
visible: false
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))
}
}
FancyButton {
id: head_back
anchors {
left: parent.left
leftMargin: parent.width * 0.17
top:parent.top
topMargin: parent.height * 0.01
}
height: parent.height * 0.13
width: height
//opacity: root.closePolicy === Popup.NoAutoClose ? 0:1
enabled: opacity > 0
glowOpacity: Math.pow( root.opacity, 100 )
image: appTheme.style.backIcon
onClicked: {
options_stack.depth > 1 ? options_stack.pop():root.close()
}
Behavior on opacity {
NumberAnimation {
duration: 200
}
}
}
}
SettingsStack {
id: options_stack
width: headlineUnderline.width
enabled: opacity !== 0 //disable when not visible
anchors {
top: parent.top
left: parent.left
leftMargin: ( parent.width - headlineUnderline.width ) / 2
topMargin: headlineUnderline.anchors.topMargin * 0.95
bottom: parent.bottom
}
Behavior on opacity {
NumberAnimation {duration: 200}
}
}
}

View file

@ -0,0 +1,125 @@
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "../components"
StackView {
id: control
property int delegateHeight: height * 0.2
property int rowSpacing: height * 0.01
initialItem: settings
/*-----start page of the settings-----*/
Component {
id: settings
StartPage {
id: settings_col
parentObj: control
}
}
/*-----Page to setup automatc start sequence-----*/
Component {
id: autostart
SettingsStartSequencePage {
id: autostart_col
parentObj: control
}
}
/*-----Page to connect to the base station -----*/
Component {
id: connect
SettingsBaseStationPage{
id: connectCol
parentObj: control
}
}
/*-----Page to view devices that core connected to the pase startion-----*/
Component{
id: baseStationConnections
SettingsBaseStationConnectionsPage {
parentObj: control
}
}
/*-----Custom animations-----*/
pushEnter: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
from: width * 0.1
to: 0
duration: 300
}
}
pushExit: Transition {
NumberAnimation {
property: "opacity"
from: 1
to: 0
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
to: -width * 0.1
from: 0
duration: 300
}
}
popExit: Transition {
NumberAnimation {
property: "opacity"
from: 1
to: 0
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
to: width * 0.1
from: 0
duration: 300
}
}
popEnter: Transition {
NumberAnimation {
property: "opacity"
from: 0
to: 1
duration: 300
easing.type: Easing.InOutQuad
}
NumberAnimation {
property: "x"
from: -width * 0.1
to: 0
duration: 300
}
}
}

View file

@ -0,0 +1,94 @@
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "../components"
Column {
id: control
spacing: parentObj.rowSpacing
property string title: "autostart"
property var parentObj
function updateSetting(key, val, del){
speedBackend.writeSetting(key, val)
}
function loadSetting(key, del){
return speedBackend.readSetting(key)
}
SmoothSwitchDelegate {
id: ready_del
width: parent.width
height: parentObj.delegateHeight
text: qsTr("say 'ready'")
checked: parent.loadSetting("ready_en", ready_del) === "true"
onCheckedChanged: {
parent.updateSetting("ready_en",checked, ready_del)
}
}
InputDelegate {
id: ready_delay_del
width: parent.width
height: parentObj.delegateHeight
enabled: ready_del.checked
text: qsTr("delay (ms)")
inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly
inputText: control.loadSetting("ready_delay", ready_del)
onInputFinished: {
control.updateSetting("ready_delay", inputText, ready_delay_del)
}
}
SmoothSwitchDelegate {
id: at_marks_del
width: parent.width
height: parentObj.delegateHeight
text: qsTr("say 'at your marks'")
checked: control.loadSetting("at_marks_en", ready_del) === "true"
onCheckedChanged: {
parent.updateSetting("at_marks_en",at_marks_del.checked, at_marks_del)
}
}
InputDelegate {
id: at_marks_delay_del
width: parent.width
height: parentObj.delegateHeight
text: qsTr("delay (ms)")
inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly
enabled: at_marks_del.checked
inputText: control.loadSetting("at_marks_delay", at_marks_delay_del)
onInputFinished: {
control.updateSetting("at_marks_delay", inputText, at_marks_delay_del)
}
}
}

View file

@ -0,0 +1,59 @@
import QtQuick 2.9
import QtMultimedia 5.8
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import QtQuick.Controls.Styles 1.4
import "../components"
Column {
id: control
property string title: qsTr("options")
property var parentObj
spacing: parent.rowSpacing
/*----Connect to external devices----*/
NextPageDelegate {
id: connect_del
height: parentObj.delegateHeight
text: qsTr("base station")
onClicked: {
parentObj.push(connect)
}
}
/*----Automated Start----*/
NextPageDelegate {
id: autostart_del
height: parentObj.delegateHeight
text: qsTr("start sequence")
onClicked: {
parentObj.push(autostart)
}
}
/*----Style Settings----*/
SmoothSwitchDelegate {
id: styleDel
text: qsTr("dark mode")
width: parent.width
height: parentObj.delegateHeight
checked: speedBackend.readSetting("theme") === "Dark"
onCheckedChanged: {
speedBackend.writeSetting("theme", checked ? "Dark":"Light")
appTheme.refreshTheme()
}
}
}

View file

@ -23,6 +23,7 @@ import QtGraphicalEffects 1.0
import "."
import "./components"
import "./ProfilesDialog"
import "./SettingsDialog"
//import QtQuick.Layouts 1.11
import com.itsblue.speedclimbingstopwatch 2.0

View file

@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>SettingsDialog.qml</file>
<file>components/ProgressCircle.qml</file>
<file>components/ConnectionDelegate.qml</file>
<file>components/FadeAnimation.qml</file>
@ -19,5 +18,11 @@
<file>ProfilesDialog/ProfileListPage.qml</file>
<file>ProfilesDialog/AddProfilePage.qml</file>
<file>ProfilesDialog/ResultListPage.qml</file>
<file>SettingsDialog/SettingsDialog.qml</file>
<file>SettingsDialog/SettingsStack.qml</file>
<file>SettingsDialog/StartPage.qml</file>
<file>SettingsDialog/SettingsStartSequencePage.qml</file>
<file>SettingsDialog/SettingsBaseStationPage.qml</file>
<file>SettingsDialog/SettingsBaseStationConnectionsPage.qml</file>
</qresource>
</RCC>

View file

@ -53,11 +53,16 @@ bool BaseConn::init() {
QJsonArray updateSubs = {"onRaceStateChanged", "onTimersChanged", "onExtensionConnectionsChanged", "onNextStartActionChanged"};
QJsonObject sessionParams = {{"updateSubs", updateSubs}, {"init", true}};
if(this->sendCommand(1, sessionParams)["status"] != 200) {
QVariantMap initResponse = this->sendCommand(1, sessionParams);
if(initResponse["status"] != 200) {
return false;
}
this->refreshConnections();
this->version = initResponse["data"].toMap()["version"].toString();
this->timeOffset = initResponse["data"].toMap()["time"].toDouble() - this->date->currentMSecsSinceEpoch();
qDebug() << "[INFO][BaseStation] Init done! version: " << this->version << " time offset: " << this->timeOffset;
return true;
}