Skip to content

Commit

Permalink
Add optional toggle of the Y offset to MoveCenterTabController. Allow…
Browse files Browse the repository at this point in the history
…s short players and wheelchair users to fully interact with height-limited applications by both boosting their height and being able to touch the in-game floor when necessary.
  • Loading branch information
Mel Klimushyn committed Jan 28, 2017
1 parent 6c7240f commit 39f81f3
Show file tree
Hide file tree
Showing 3 changed files with 528 additions and 13 deletions.
262 changes: 249 additions & 13 deletions bin/win64/res/qml/PlayspacePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,149 @@ import matzman666.advsettings 1.0
MyStackViewPage {
headerText: "Play Space Settings"

MyDialogOkCancelPopup {
id: pttControllerConfigDialog
property int controllerIndex: -1
dialogTitle: "Controller Configuration"
dialogWidth: 600
dialogHeight: 620
dialogContentItem: ColumnLayout {
MyText {
text: "Buttons"
}
Rectangle {
color: "#cccccc"
height: 1
Layout.fillWidth: true
}
MyToggleButton {
id: pttControllerConfigGripButtonToggle
text: "Grip"
}
MyToggleButton {
id: pttControllerConfigMenuButtonToggle
text: "Menu"
}
MyToggleButton {
id: pttControllerConfigTriggerButtonToggle
text: "Trigger"
}

MyText {
Layout.topMargin: 32
text: "Touchpad"
}
Rectangle {
color: "#cccccc"
height: 1
Layout.fillWidth: true
}
RowLayout {
spacing: 64
MyToggleButton {
id: pttControllerConfigPadLeftToggle
text: "Left"
}
MyToggleButton {
id: pttControllerConfigPadRightToggle
text: "Right"
}
}
RowLayout {
spacing: 64
MyToggleButton {
id: pttControllerConfigPadTopToggle
text: "Top"
}
MyToggleButton {
id: pttControllerConfigPadBottomToggle
text: "Bottom"
}
}
RowLayout {
MyText {
text: "Mode:"
}
MyComboBox {
id: pttControllerConfigPadModeCombo
Layout.preferredWidth: 250
model: ["Disabled", "Touched", "Pressed"]
}
}
}
onClosed: {
if (okClicked) {
var buttons = []
if (pttControllerConfigGripButtonToggle.checked) {
buttons.push(2)
}
if (pttControllerConfigMenuButtonToggle.checked) {
buttons.push(1)
}
var triggerMode = 0
if (pttControllerConfigTriggerButtonToggle.checked) {
triggerMode = 1
}
var padAreas = 0
if (pttControllerConfigPadLeftToggle.checked) {
padAreas |= (1 << 0)
}
if (pttControllerConfigPadTopToggle.checked) {
padAreas |= (1 << 1)
}
if (pttControllerConfigPadRightToggle.checked) {
padAreas |= (1 << 2)
}
if (pttControllerConfigPadBottomToggle.checked) {
padAreas |= (1 << 3)
}
MoveCenterTabController.setPttControllerConfig(controllerIndex, buttons, triggerMode, pttControllerConfigPadModeCombo.currentIndex, padAreas);
}
}
function openPopup(controller) {
if (controller === 0) {
dialogTitle = "Left Controller Configuration"
controllerIndex = 0
} else {
dialogTitle = "Right Controller Configuration"
controllerIndex = 1
}
pttControllerConfigGripButtonToggle.checked = false
pttControllerConfigMenuButtonToggle.checked = false
pttControllerConfigTriggerButtonToggle.checked = false
pttControllerConfigPadLeftToggle.checked = false
pttControllerConfigPadTopToggle.checked = false
pttControllerConfigPadRightToggle.checked = false
pttControllerConfigPadBottomToggle.checked = false
pttControllerConfigPadModeCombo.currentIndex = MoveCenterTabController.pttTouchpadMode(controllerIndex)
var buttons = MoveCenterTabController.pttDigitalButtons(controllerIndex)
for (var i = 0; i < buttons.length; i++) {
if (buttons[i] == 1) {
pttControllerConfigMenuButtonToggle.checked = true
} else if (buttons[i] == 2) {
pttControllerConfigGripButtonToggle.checked = true
}
}
if (MoveCenterTabController.pttTriggerMode(controllerIndex) > 0) {
pttControllerConfigTriggerButtonToggle.checked = true
}
var padAreas = MoveCenterTabController.pttTouchpadArea(controllerIndex)
if (padAreas & (1 << 0)) {
pttControllerConfigPadLeftToggle.checked = true
}
if (padAreas & (1 << 1)) {
pttControllerConfigPadTopToggle.checked = true
}
if (padAreas & (1 << 2)) {
pttControllerConfigPadRightToggle.checked = true
}
if (padAreas & (1 << 3)) {
pttControllerConfigPadBottomToggle.checked = true
}
open()
}
}

content: ColumnLayout {
spacing: 18

Expand Down Expand Up @@ -63,10 +206,10 @@ MyStackViewPage {
}
}

MyTextField {
MyTextField {
id: playSpaceMoveXText
text: "0.00"
keyBoardUID: 101
keyBoardUID: 101
Layout.preferredWidth: 140
Layout.leftMargin: 10
Layout.rightMargin: 10
Expand Down Expand Up @@ -265,22 +408,100 @@ MyStackViewPage {
}
}

MyToggleButton {
id: playspaceAdjustChaperoneToggle
text: "Adjust Chaperone"
onCheckedChanged: {
MoveCenterTabController.adjustChaperone = this.checked
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)
}
}
}
}
}
}

Item { Layout.fillHeight: true; Layout.fillWidth: true}

MyPushButton {
id: playspaceResetButton
Layout.preferredWidth: 250
text: "Reset"
onClicked: {
MoveCenterTabController.reset()
ColumnLayout {
Layout.fillWidth: true

RowLayout {
MyToggleButton {
id: playspaceAdjustChaperoneToggle
text: "Adjust Chaperone"
Layout.preferredWidth: 250
onCheckedChanged: {
MoveCenterTabController.adjustChaperone = this.checked
}
}

Item { Layout.fillWidth: true}

MyPushButton {
id: playspaceResetButton
Layout.preferredWidth: 250
text: "Reset"
onClicked: {
MoveCenterTabController.reset()
}
}
}
}

Expand All @@ -305,6 +526,9 @@ MyStackViewPage {
} else {
playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
}
offsetYPttEnabledToggle.checked = MoveCenterTabController.pttEnabled
offsetYPttLeftControllerToggle.checked = MoveCenterTabController.pttLeftControllerEnabled
offsetYPttRightControllerToggle.checked = MoveCenterTabController.pttRightControllerEnabled
}

Connections {
Expand Down Expand Up @@ -341,6 +565,18 @@ MyStackViewPage {
playspaceModeText.text = "Unknown(" + MoveCenterTabController.trackingUniverse + ")"
}
}
onPttEnabledChanged: {
offsetYPttEnabledToggle.checked = MoveCenterTabController.pttEnabled
}
onPttActiveChanged: {

}
onPttLeftControllerEnabledChanged: {
offsetYPttLeftControllerToggle.checked = MoveCenterTabController.pttLeftControllerEnabled
}
onPttRightControllerEnabledChanged: {
offsetYPttRightControllerToggle.checked = MoveCenterTabController.pttRightControllerEnabled
}
}

}
Expand Down
Loading

0 comments on commit 39f81f3

Please sign in to comment.