added events and bindings for gamepad settings
This commit is contained in:
parent
4291cf92b8
commit
16c212c472
4 changed files with 536 additions and 244 deletions
|
@ -10,7 +10,7 @@ using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.UI.Emulation
|
namespace Ryujinx.UI.Emulation
|
||||||
{
|
{
|
||||||
[Signal("failed", NetVariantType.String)]
|
[Signal("failed", NetVariantType.String, NetVariantType.String)]
|
||||||
[Signal("success")]
|
[Signal("success")]
|
||||||
[Signal("loaded")]
|
[Signal("loaded")]
|
||||||
[Signal("unloaded")]
|
[Signal("unloaded")]
|
||||||
|
@ -64,7 +64,7 @@ namespace Ryujinx.UI.Emulation
|
||||||
|
|
||||||
if (!File.Exists(GameFile))
|
if (!File.Exists(GameFile))
|
||||||
{
|
{
|
||||||
this.ActivateSignal("failed", $"File {GameFile} does not exist.");
|
this.ActivateSignal("failed", "File not found.", $"File {GameFile} does not exist.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ namespace Ryujinx.UI.Emulation
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(ExeFsPath))
|
if (!Directory.Exists(ExeFsPath))
|
||||||
{
|
{
|
||||||
this.ActivateSignal("failed", $"Directory {ExeFsPath} does not exist.");
|
this.ActivateSignal("failed", "Path not found", $"Directory {ExeFsPath} does not exist.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,16 +160,20 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
id: alertBox
|
||||||
|
standardButtons: StandardButton.Close
|
||||||
|
icon: StandardIcon.Critical
|
||||||
|
}
|
||||||
|
|
||||||
EmulationController {
|
EmulationController {
|
||||||
id: controller
|
id: controller
|
||||||
|
|
||||||
onFailed: function(result) {
|
onFailed: function(error, message) {
|
||||||
// alertBox.title = "Failed to load game"
|
alertBox.title = error
|
||||||
// alertBox.text = result
|
alertBox.text = message
|
||||||
|
|
||||||
// alertBox.open()
|
alertBox.open()
|
||||||
|
|
||||||
loadGameMenuItem.enabled = true
|
loadGameMenuItem.enabled = true
|
||||||
loadGameFolderMenuItem.enabled = true
|
loadGameFolderMenuItem.enabled = true
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Ryujinx.UI.UI.Models
|
||||||
{
|
{
|
||||||
[Signal("waitReleased")]
|
[Signal("waitReleased")]
|
||||||
[Signal("showWaitDialog")]
|
[Signal("showWaitDialog")]
|
||||||
|
[Signal("showError", NetVariantType.String, NetVariantType.String)]
|
||||||
public class ConfigurationModel
|
public class ConfigurationModel
|
||||||
{
|
{
|
||||||
private static Settings CurrentSettings;
|
private static Settings CurrentSettings;
|
||||||
|
@ -110,7 +111,7 @@ namespace Ryujinx.UI.UI.Models
|
||||||
|
|
||||||
while (IsWaiting)
|
while (IsWaiting)
|
||||||
{
|
{
|
||||||
await Task.Delay(16);
|
await Task.Delay(17);
|
||||||
|
|
||||||
KeyboardState Keyboard = GetState();
|
KeyboardState Keyboard = GetState();
|
||||||
|
|
||||||
|
@ -149,110 +150,166 @@ namespace Ryujinx.UI.UI.Models
|
||||||
|
|
||||||
public async Task<string> GetGamePadInput(string SettingKey, int GamePadIndex)
|
public async Task<string> GetGamePadInput(string SettingKey, int GamePadIndex)
|
||||||
{
|
{
|
||||||
float TriggerThreshold = CurrentSettings.GetValue<float>("GamePad_Trigger_Threshold");
|
double TriggerThreshold = CurrentSettings.GetValue<double>("GamePad_Trigger_Threshold");
|
||||||
|
|
||||||
while (true)
|
RefreshInputDevices();
|
||||||
|
|
||||||
|
if (GamePadIndex >= GamePadStates.Length)
|
||||||
{
|
{
|
||||||
await Task.Delay(33);
|
this.ActivateSignal("showError", "Failed to find GamePad", $"GamePad at Index {GamePadIndex} is not available");
|
||||||
|
|
||||||
RefreshInputDevices();
|
return string.Empty;
|
||||||
|
|
||||||
if (GamePadIndex >= GamePadStates.Length)
|
|
||||||
{
|
|
||||||
// TODO :throw error here
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(GamePadStates[GamePadIndex].Buttons.IsAnyButtonPressed)
|
|
||||||
{
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.A == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "A");
|
|
||||||
|
|
||||||
return "A";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.B == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "B");
|
|
||||||
|
|
||||||
return "B";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.X == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "X");
|
|
||||||
|
|
||||||
return "X";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.Y == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "Y");
|
|
||||||
|
|
||||||
return "Y";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.LeftShoulder == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "LShoulder");
|
|
||||||
|
|
||||||
return "LShoulder";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.RightShoulder == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "RShoulder");
|
|
||||||
|
|
||||||
return "RShoulder";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.LeftStick == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "LStick");
|
|
||||||
|
|
||||||
return "LStick";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.RightStick == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "RStick");
|
|
||||||
|
|
||||||
return "RStick";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.Start == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "Start");
|
|
||||||
|
|
||||||
return "Start";
|
|
||||||
}
|
|
||||||
if (GamePadStates[GamePadIndex].Buttons.Back == ButtonState.Pressed)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "Back");
|
|
||||||
|
|
||||||
return "Back";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (GamePadStates[GamePadIndex].DPad.IsUp)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "DPadUp");
|
|
||||||
|
|
||||||
return "A";
|
|
||||||
}
|
|
||||||
else if (GamePadStates[GamePadIndex].DPad.IsDown)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "DPadDown");
|
|
||||||
|
|
||||||
return "DPadDown";
|
|
||||||
}
|
|
||||||
else if (GamePadStates[GamePadIndex].DPad.IsLeft)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "DPadLeft");
|
|
||||||
|
|
||||||
return "DPadLeft";
|
|
||||||
}
|
|
||||||
else if (GamePadStates[GamePadIndex].DPad.IsRight)
|
|
||||||
{
|
|
||||||
CurrentSettings.SetValue(SettingKey, "DPadRight");
|
|
||||||
|
|
||||||
return "DPadRight";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsWaiting)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ActivateSignal("showWaitDialog");
|
||||||
|
|
||||||
|
IsWaiting = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
while (IsWaiting)
|
||||||
|
{
|
||||||
|
await Task.Delay(17);
|
||||||
|
|
||||||
|
RefreshInputDevices();
|
||||||
|
|
||||||
|
if (GamePadIndex >= GamePadStates.Length)
|
||||||
|
{
|
||||||
|
this.ActivateSignal("showError", "Failed to find GamePad", $"GamePad at Index {GamePadIndex} is not available");
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
GamePadState SelectedGamePad = GamePadStates[GamePadIndex];
|
||||||
|
|
||||||
|
if (SettingKey == "Controls_Left_JoyConController_Stick" || SettingKey == "Controls_Right_JoyConController_Stick")
|
||||||
|
{
|
||||||
|
// Check if Sticks have been moved since last update
|
||||||
|
if (SelectedGamePad.ThumbSticks.Left.Length > 0.1)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "LJoystick");
|
||||||
|
|
||||||
|
return "LJoystick";
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.ThumbSticks.Right.Length > 0.1)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "RJoystick");
|
||||||
|
|
||||||
|
return "RJoystick";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.Buttons.IsAnyButtonPressed)
|
||||||
|
{
|
||||||
|
if (SelectedGamePad.Buttons.A == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "A");
|
||||||
|
|
||||||
|
return "A";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.B == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "B");
|
||||||
|
|
||||||
|
return "B";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.X == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "X");
|
||||||
|
|
||||||
|
return "X";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.Y == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "Y");
|
||||||
|
|
||||||
|
return "Y";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.LeftShoulder == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "LShoulder");
|
||||||
|
|
||||||
|
return "LShoulder";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.RightShoulder == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "RShoulder");
|
||||||
|
|
||||||
|
return "RShoulder";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.LeftStick == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "LStick");
|
||||||
|
|
||||||
|
return "LStick";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.RightStick == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "RStick");
|
||||||
|
|
||||||
|
return "RStick";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.Start == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "Start");
|
||||||
|
|
||||||
|
return "Start";
|
||||||
|
}
|
||||||
|
if (SelectedGamePad.Buttons.Back == ButtonState.Pressed)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "Back");
|
||||||
|
|
||||||
|
return "Back";
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.DPad.IsUp)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "DPadUp");
|
||||||
|
|
||||||
|
return "A";
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.DPad.IsDown)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "DPadDown");
|
||||||
|
|
||||||
|
return "DPadDown";
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.DPad.IsLeft)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "DPadLeft");
|
||||||
|
|
||||||
|
return "DPadLeft";
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.DPad.IsRight)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "DPadRight");
|
||||||
|
|
||||||
|
return "DPadRight";
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.Triggers.Left > TriggerThreshold)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "LTrigger");
|
||||||
|
|
||||||
|
return "LTrigger";
|
||||||
|
}
|
||||||
|
else if (SelectedGamePad.Triggers.Right > TriggerThreshold)
|
||||||
|
{
|
||||||
|
CurrentSettings.SetValue(SettingKey, "RTrigger");
|
||||||
|
|
||||||
|
return "RTrigger";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ReleaseWait();
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
|
import QtQuick.Dialogs 1.3
|
||||||
|
import Ryujinx 1.0
|
||||||
|
|
||||||
Frame {
|
Frame {
|
||||||
id: gamePadSettingsFrame
|
id: gamePadSettingsFrame
|
||||||
|
@ -17,6 +19,12 @@ Frame {
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: enableGamePadCheckBox
|
id: enableGamePadCheckBox
|
||||||
text: "Enable GamePad"
|
text: "Enable GamePad"
|
||||||
|
|
||||||
|
checked: configModel.getValue("GamePad_Enable")
|
||||||
|
|
||||||
|
onCheckedChanged: {
|
||||||
|
configModel.setValue("GamePad_Enable", checked)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
@ -25,6 +33,8 @@ Frame {
|
||||||
columns: 2
|
columns: 2
|
||||||
rows: 3
|
rows: 3
|
||||||
|
|
||||||
|
enabled: enableGamePadCheckBox.checked
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "GamePad Index"
|
text: "GamePad Index"
|
||||||
Layout.fillHeight: false
|
Layout.fillHeight: false
|
||||||
|
@ -49,24 +59,48 @@ Frame {
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: gamePadIndexBox
|
id: gamePadIndexBox
|
||||||
Layout.fillWidth: true
|
horizontalAlignment: Text.AlignRight
|
||||||
|
Layout.preferredWidth: 80
|
||||||
|
Layout.fillWidth: false
|
||||||
Layout.column: 1
|
Layout.column: 1
|
||||||
Layout.row:0
|
Layout.row:0
|
||||||
inputMethodHints: Qt.ImhDigitsOnly
|
inputMethodHints: Qt.ImhDigitsOnly
|
||||||
|
|
||||||
|
text: configModel.getValue("GamePad_Index")
|
||||||
|
|
||||||
|
onTextEdited: {
|
||||||
|
configModel.setValue("GamePad_Index", text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: deadzoneBox
|
id: deadzoneBox
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
Layout.preferredWidth: 80
|
||||||
Layout.column: 1
|
Layout.column: 1
|
||||||
Layout.row:1
|
Layout.row:1
|
||||||
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
||||||
|
|
||||||
|
text: configModel.getValue("GamePad_Deadzone")
|
||||||
|
|
||||||
|
onTextEdited: {
|
||||||
|
configModel.setValue("GamePad_Deadzone", text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: triggerThresholdBox
|
id: triggerThresholdBox
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
Layout.preferredWidth: 80
|
||||||
Layout.column: 1
|
Layout.column: 1
|
||||||
Layout.row:2
|
Layout.row:2
|
||||||
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
||||||
|
|
||||||
|
text: configModel.getValue("GamePad_Trigger_Threshold")
|
||||||
|
|
||||||
|
onTextEdited: {
|
||||||
|
configModel.setValue("GamePad_Trigger_Threshold", text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,81 +132,38 @@ Frame {
|
||||||
columns: 3
|
columns: 3
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 0
|
Layout.row: 0
|
||||||
Layout.column: 1
|
Layout.column: 1
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Up"
|
text: "Stick"
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Up"
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: leftStickUpButton
|
id: leftStick
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_Stick")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_Stick",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 2
|
|
||||||
Layout.column: 1
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "Down"
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
text: "Down"
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
id: leftStickDownButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 1
|
|
||||||
Layout.column: 0
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "Left"
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
text: "Left"
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
id: leftStickLeftButton
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 1
|
|
||||||
Layout.column: 2
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "Right"
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
text: "Right"
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
id: leftStickRightButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 1
|
Layout.row: 1
|
||||||
Layout.column: 1
|
Layout.column: 1
|
||||||
|
|
||||||
|
@ -181,10 +172,26 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Button"
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: leftStickButton
|
id: leftStickButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_Stick_Button")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_Stick_Button",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,10 +218,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Up"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: leftDPadUpButton
|
id: leftDPadUpButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_DPad_Up")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_DPad_Up",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,10 +251,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Down"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: leftDPadDownButton
|
id: leftDPadDownButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_DPad_Down")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_DPad_Down",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,10 +284,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Left"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: leftDPadLeftButton
|
id: leftDPadLeftButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_DPad_Left")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_DPad_Left",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -266,10 +318,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Right"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: leftDPadRightButton
|
id: leftDPadRightButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_DPad_Right")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_DPad_Right",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,10 +365,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "L"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: lButton
|
id: lButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_Button_L")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_Button_L",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -316,10 +398,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "ZL"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: zLButton
|
id: zLButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_Button_ZL")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_Button_ZL",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,10 +432,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "-"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: minusButton
|
id: minusButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Left_JoyConController_Button_Minus")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Left_JoyConController_Button_Minus",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,75 +479,34 @@ Frame {
|
||||||
columns: 3
|
columns: 3
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 0
|
Layout.row: 0
|
||||||
Layout.column: 1
|
Layout.column: 1
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: "Up"
|
text: "Stick"
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Up"
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: rightStickUpButton
|
id: rightStick
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
text: configModel.getValue("Controls_Right_JoyConController_Stick")
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 2
|
|
||||||
Layout.column: 1
|
|
||||||
|
|
||||||
Label {
|
onClicked: {
|
||||||
text: "Down"
|
var task = configModel.getGamePadInput
|
||||||
}
|
("Controls_Right_JoyConController_Stick",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
Button {
|
Net.await(task, function(result)
|
||||||
text: "Down"
|
{
|
||||||
Layout.fillHeight: true
|
if(result !== "")
|
||||||
Layout.fillWidth: true
|
{
|
||||||
id: rightStickDownButton
|
text = result
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
}
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 1
|
|
||||||
Layout.column: 0
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "Left"
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
text: "Left"
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
id: rightStickLeftButton
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.row: 1
|
|
||||||
Layout.column: 2
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: "Right"
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
text: "Right"
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
id: rightStickRightButton
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,10 +521,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Button"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: rightStickButton
|
id: rightStickButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Stick_Button")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Stick_Button",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,10 +566,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "X"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: xButton
|
id: xButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Button_X")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Button_X",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,10 +599,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "B"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: bButton
|
id: bButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Button_B")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Button_B",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,10 +632,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Y"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: yButton
|
id: yButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Button_Y")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Button_Y",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -535,10 +666,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "A"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: aButton
|
id: aButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Button_A")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Button_A",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -567,10 +713,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "L"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: rButton
|
id: rButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Button_R")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Button_R",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,10 +746,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "ZL"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: zRButton
|
id: zRButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Button_ZR")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Button_ZR",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -604,10 +780,25 @@ Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "+"
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
id: plusButton
|
id: plusButton
|
||||||
|
|
||||||
|
text: configModel.getValue("Controls_Right_JoyConController_Button_Plus")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var task = configModel.getGamePadInput
|
||||||
|
("Controls_Right_JoyConController_Button_Plus",
|
||||||
|
parseInt(gamePadIndexBox.text))
|
||||||
|
|
||||||
|
Net.await(task, function(result)
|
||||||
|
{
|
||||||
|
if(result !== "")
|
||||||
|
{
|
||||||
|
text = result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -616,6 +807,46 @@ Frame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
id: inputWaitMessageDialog
|
||||||
|
text: "Please press a key..."
|
||||||
|
standardButtons: StandardButton.Close
|
||||||
|
|
||||||
|
onRejected: {
|
||||||
|
configModel.releaseWait()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
id: errorAlert
|
||||||
|
standardButtons: StandardButton.Close
|
||||||
|
icon: StandardIcon.Critical
|
||||||
|
|
||||||
|
onRejected: {
|
||||||
|
configModel.releaseWait()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigurationModel {
|
||||||
|
id: configModel
|
||||||
|
|
||||||
|
onWaitReleased: {
|
||||||
|
if(inputWaitMessageDialog.visible){
|
||||||
|
inputWaitMessageDialog.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onShowWaitDialog: {
|
||||||
|
inputWaitMessageDialog.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
onShowError: function(error,message) {
|
||||||
|
errorAlert.text = message
|
||||||
|
errorAlert.title = error
|
||||||
|
|
||||||
|
errorAlert.open()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue