This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/resources/qml/SettingsDialog/SettingsStartSequencePage.qml

122 lines
2.9 KiB
QML
Raw Normal View History

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 de.itsblue.ScStw 2.0
import de.itsblue.ScStw.Styling 2.0
import de.itsblue.ScStw.Styling.Components 1.0
import de.itsblue.ScStwApp 2.0
import "../components"
Column {
id: control
spacing: parentObj.rowSpacing
property string title: "autostart"
property var parentObj
function updateSetting(key, val, del){
del.busy = true
scStwAppSettings.writeSetting(key, val, ScStwSettings.KeyLevel)
del.busy = false
}
function loadSetting(key, del){
return scStwAppSettings.readSetting(key, ScStwSettings.KeyLevel)
}
SmoothSwitchDelegate {
id: ready_del
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.ReadySoundEnableSetting, ScStwSettings.KeyLevel)
width: parent.width
height: parentObj.delegateHeight
checked: setting.value
onCheckedChanged: {
enabled = false
setting.value = checked
enabled = true
}
text: qsTr("say 'ready'")
}
InputDelegate {
id: ready_delay_del
property bool busy: false
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.ReadySoundDelaySetting, ScStwSettings.KeyLevel)
width: parent.width
height: parentObj.delegateHeight
enabled: !busy && ready_del.checked
text: qsTr("delay (ms)")
inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly
inputText: setting.value
onInputFinished: {
console.log("input finished")
busy = true
setting.value = inputText
busy = false
}
}
SmoothSwitchDelegate {
id: at_marks_del
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.AtYourMarksSoundEnableSetting, ScStwSettings.KeyLevel)
width: parent.width
height: parentObj.delegateHeight
text: qsTr("say 'at your marks'")
checked: setting.value
onCheckedChanged: {
enabled = false
setting.value = checked
enabled = true
}
}
InputDelegate {
id: at_marks_delay_del
property bool busy: false
property ScStwSetting setting: scStwAppSettings.getSetting(ScStwSettings.AtYourMarksSoundDelaySetting, ScStwSettings.KeyLevel)
width: parent.width
height: parentObj.delegateHeight
text: qsTr("delay (ms)")
inputHint: qsTr("time")
inputMethodHints: Qt.ImhFormattedNumbersOnly
enabled: !busy && at_marks_del.checked
inputText: setting.value
onInputFinished: {
busy = true
setting.setValue(inputText)
busy = false
}
}
}