Move the push-to-toggle y axis adjustment from the playspace page to a new Accessibility Tools tab, packaged as a new height adjustment tool. Height offset is saved and can be set via slider.

This commit is contained in:
Mel Klimushyn
2017-02-07 00:13:41 -08:00
parent 927be598d7
commit 1aa1580a90
12 changed files with 363 additions and 128 deletions
+179
View File
@@ -0,0 +1,179 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import matzman666.advsettings 1.0
MyStackViewPage {
headerText: "Accessibility Tools"
PttControllerConfigDialog {
id: pttControllerConfigDialog
pttControllerConfigClass: AccessibilityTabController
}
content: ColumnLayout {
spacing: 92
GroupBox {
Layout.fillWidth: true
label: MyText {
leftPadding: 10
text: "Adjust Player Height"
bottomPadding: -10
}
background: Rectangle {
color: "transparent"
border.color: "#ffffff"
radius: 8
}
ColumnLayout {
anchors.fill: parent
Rectangle {
color: "#ffffff"
height: 1
Layout.fillWidth: true
Layout.bottomMargin: 5
}
RowLayout {
MyPushButton2 {
Layout.preferredWidth: 40
text: "-"
onClicked: {
accessibilityMoveYSlider.decrease()
}
}
MySlider {
id: accessibilityMoveYSlider
from: 0
to: 1.5
stepSize: 0.05
value: 0.0
Layout.fillWidth: true
onPositionChanged: {
var val = this.from + ( this.position * (this.to - this.from))
accessibilityMoveYText.text = val.toFixed(2)
}
onValueChanged: {
AccessibilityTabController.heightOffset = this.value.toFixed(2)
}
}
MyPushButton2 {
Layout.preferredWidth: 40
text: "+"
onClicked: {
accessibilityMoveYSlider.increase()
}
}
MyTextField {
id: accessibilityMoveYText
text: "0.00"
keyBoardUID: 700
Layout.preferredWidth: 140
Layout.leftMargin: 10
Layout.rightMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val) && val >= accessibilityMoveYSlider.from && val <= accessibilityMoveYSlider.to) {
accessibilityMoveYSlider.value = val.toFixed(2);
}
text = AccessibilityTabController.heightOffset.toFixed(2)
}
}
}
RowLayout {
MyToggleButton {
id: heightOffsetPttEnabledToggle
Layout.preferredWidth: 260
text: "Push-to-Toggle:"
onClicked: {
AccessibilityTabController.pttEnabled = checked
}
}
MyToggleButton {
id: heightOffsetPttLeftControllerToggle
text: "Left Controller"
onClicked: {
AccessibilityTabController.setPttLeftControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(0)
}
}
Item {
Layout.fillWidth: true
}
MyToggleButton {
id: heightOffsetPttRightControllerToggle
text: "Right Controller"
onClicked: {
AccessibilityTabController.setPttRightControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(1)
}
}
}
}
}
Item { Layout.fillHeight: true; Layout.fillWidth: true}
MyPushButton {
id: accessibilityResetButton
Layout.preferredWidth: 250
text: "Reset"
onClicked: {
AccessibilityTabController.reset()
}
}
Component.onCompleted: {
var heightOffsetFormatted = AccessibilityTabController.heightOffset.toFixed(2)
accessibilityMoveYText.text = heightOffsetFormatted
accessibilityMoveYSlider.value = heightOffsetFormatted
heightOffsetPttEnabledToggle.checked = AccessibilityTabController.pttEnabled
heightOffsetPttLeftControllerToggle.checked = AccessibilityTabController.pttLeftControllerEnabled
heightOffsetPttRightControllerToggle.checked = AccessibilityTabController.pttRightControllerEnabled
}
Connections {
target: AccessibilityTabController
onHeightOffsetChanged: {
var heightOffsetFormatted = AccessibilityTabController.heightOffset.toFixed(2)
accessibilityMoveYText.text = heightOffsetFormatted
accessibilityMoveYSlider.value = heightOffsetFormatted
}
onPttEnabledChanged: {
heightOffsetPttEnabledToggle.checked = AccessibilityTabController.pttEnabled
}
onPttActiveChanged: {
}
onPttLeftControllerEnabledChanged: {
heightOffsetPttLeftControllerToggle.checked = AccessibilityTabController.pttLeftControllerEnabled
}
onPttRightControllerEnabledChanged: {
heightOffsetPttRightControllerToggle.checked = AccessibilityTabController.pttRightControllerEnabled
}
}
}
}
+2 -92
View File
@@ -8,11 +8,6 @@ import matzman666.advsettings 1.0
MyStackViewPage {
headerText: "Play Space Settings"
PttControllerConfigDialog {
id: pttControllerConfigDialog
pttControllerConfigClass: MoveCenterTabController
}
content: ColumnLayout {
spacing: 18
@@ -68,10 +63,10 @@ MyStackViewPage {
}
}
MyTextField {
MyTextField {
id: playSpaceMoveXText
text: "0.00"
keyBoardUID: 101
keyBoardUID: 101
Layout.preferredWidth: 140
Layout.leftMargin: 10
Layout.rightMargin: 10
@@ -270,79 +265,9 @@ MyStackViewPage {
}
}
GroupBox {
Layout.fillWidth: true
label: MyText {
leftPadding: 10
text: "Push-to-Toggle Y-Axis Offset"
bottomPadding: -10
}
background: Rectangle {
color: "transparent"
border.color: "#ffffff"
radius: 8
}
ColumnLayout {
anchors.fill: parent
Rectangle {
color: "#ffffff"
height: 1
Layout.fillWidth: true
Layout.bottomMargin: 5
}
ColumnLayout {
RowLayout {
MyToggleButton {
id: offsetYPttEnabledToggle
Layout.preferredWidth: 260
text: "Enabled"
onClicked: {
MoveCenterTabController.pttEnabled = checked
}
}
MyToggleButton {
id: offsetYPttLeftControllerToggle
text: "Left Controller"
onClicked: {
MoveCenterTabController.setPttLeftControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(0)
}
}
Item {
Layout.fillWidth: true
}
MyToggleButton {
id: offsetYPttRightControllerToggle
text: "Right Controller"
onClicked: {
MoveCenterTabController.setPttRightControllerEnabled(checked, false)
}
}
MyPushButton {
text: "Configure"
onClicked: {
pttControllerConfigDialog.openPopup(1)
}
}
}
}
}
}
MyToggleButton {
id: playspaceAdjustChaperoneToggle
text: "Adjust Chaperone"
Layout.preferredWidth: 270
onCheckedChanged: {
MoveCenterTabController.adjustChaperone = this.checked
}
@@ -380,9 +305,6 @@ MyStackViewPage {
} else {
playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
}
offsetYPttEnabledToggle.checked = MoveCenterTabController.pttEnabled
offsetYPttLeftControllerToggle.checked = MoveCenterTabController.pttLeftControllerEnabled
offsetYPttRightControllerToggle.checked = MoveCenterTabController.pttRightControllerEnabled
}
Connections {
@@ -419,18 +341,6 @@ MyStackViewPage {
playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
}
}
onPttEnabledChanged: {
offsetYPttEnabledToggle.checked = MoveCenterTabController.pttEnabled
}
onPttActiveChanged: {
}
onPttLeftControllerEnabledChanged: {
offsetYPttLeftControllerToggle.checked = MoveCenterTabController.pttLeftControllerEnabled
}
onPttRightControllerEnabledChanged: {
offsetYPttRightControllerToggle.checked = MoveCenterTabController.pttRightControllerEnabled
}
}
}
+11
View File
@@ -100,6 +100,17 @@ MyStackViewPage {
}
}
MyPushButton {
id: accessibilityButton
activationSoundEnabled: false
text: "Accessibility"
Layout.fillWidth: true
onClicked: {
MyResources.playFocusChangedSound()
mainView.push(accessibilityPage)
}
}
MyPushButton {
id: statisticsButton
activationSoundEnabled: false
+5
View File
@@ -58,6 +58,11 @@ Rectangle {
visible: false
}
property AccessibilityPage accessibilityPage: AccessibilityPage {
stackView: mainView
visible: false
}
StackView {
id: mainView
anchors.fill: parent