GlosSIConfig: Allow Desktop config setting

pull/169/head
Peter Repukat 2 years ago
parent bfadeadced
commit 21abef9bde

@ -84,7 +84,8 @@ void UIModel::readConfigs()
json["maxFps"] = filejson["window"]["maxFps"]; json["maxFps"] = filejson["window"]["maxFps"];
json["scale"] = filejson["window"]["scale"]; json["scale"] = filejson["window"]["scale"];
json["disableOverlay"] = filejson["window"]["disableOverlay"]; json["disableOverlay"] = filejson["window"]["disableOverlay"];
json["maxControllers"] = filejson["controller"]["maxControllers"]; json["maxControllers"] = filejson["controller"]["allowDesktopConfig"];
json["allowDesktopConfig"] = filejson["controller"]["allowDesktopConfig"];
json["name"] = filejson.contains("name") ? filejson["name"] : QString(name).replace(QRegularExpression("\\.json"), ""); json["name"] = filejson.contains("name") ? filejson["name"] : QString(name).replace(QRegularExpression("\\.json"), "");
@ -363,6 +364,7 @@ void UIModel::writeTarget(const QJsonObject& json, const QString& name)
QJsonObject controllerObject; QJsonObject controllerObject;
controllerObject["maxControllers"] = json["maxControllers"]; controllerObject["maxControllers"] = json["maxControllers"];
controllerObject["allowDesktopConfig"] = json["allowDesktopConfig"];
fileJson["controller"] = controllerObject; fileJson["controller"] = controllerObject;
auto wtf = QString(QJsonDocument(fileJson).toJson(QJsonDocument::Indented)).toStdString(); auto wtf = QString(QJsonDocument(fileJson).toJson(QJsonDocument::Indented)).toStdString();

@ -44,7 +44,8 @@ Item {
icon: null, icon: null,
maxControllers: 4, maxControllers: 4,
disableOverlay: false, disableOverlay: false,
realDeviceIds: false realDeviceIds: false,
allowDesktopConfig: true,
}) })
function resetInfo() { function resetInfo() {
@ -63,7 +64,8 @@ Item {
icon: null, icon: null,
maxControllers: 4, maxControllers: 4,
disableOverlay: false, disableOverlay: false,
realDeviceIds: false realDeviceIds: false,
allowDesktopConfig: true,
}) })
} }
@ -79,309 +81,367 @@ Item {
maxControllersSpinBox.value = shortcutInfo.maxControllers maxControllersSpinBox.value = shortcutInfo.maxControllers
disableOverlayCheckbox.checked = shortcutInfo.disableOverlay || false disableOverlayCheckbox.checked = shortcutInfo.disableOverlay || false
realDeviceIds.checked = shortcutInfo.realDeviceIds || false realDeviceIds.checked = shortcutInfo.realDeviceIds || false
allowDesktopConfig.checked = shortcutInfo.allowDesktopConfig || true
} }
Column { Flickable {
anchors.margins: 32 id: flickable
anchors.margins: 0
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
spacing: 4 clip: true
ScrollBar.vertical: ScrollBar {
Item { }
id: namewrapper contentWidth: propscolumn.width
width: parent.width / 3 contentHeight: propscolumn.height
height: 64 flickableDirection: Flickable.VerticalFlick
Label {
anchors.left: parent.left
anchors.leftMargin: 4 Column {
id: nameLabel id: propscolumn
font.bold: true anchors.left: parent.left
text: qsTr("Name") anchors.right: parent.right
anchors.leftMargin: 32
spacing: 4
Item {
id: topspacing
width: 1
height: 32
} }
FluentTextInput {
width: parent.width Item {
anchors.top: nameLabel.bottom id: namewrapper
anchors.topMargin: 4 width: parent.width / 3
id: nameInput height: 64
placeholderText: qsTr("...") Label {
text: shortcutInfo.name anchors.left: parent.left
onTextChanged: shortcutInfo.name = text anchors.leftMargin: 4
validator: RegularExpressionValidator { regularExpression: /([0-z]|\s|.)+/gm } id: nameLabel
font.bold: true
text: qsTr("Name")
}
FluentTextInput {
width: parent.width
anchors.top: nameLabel.bottom
anchors.topMargin: 4
id: nameInput
placeholderText: qsTr("...")
text: shortcutInfo.name
onTextChanged: shortcutInfo.name = text
validator: RegularExpressionValidator { regularExpression: /([0-z]|\s|.)+/gm }
}
} }
} Item {
Item { width: 1
width: 1 height: 8
height: 8 }
} RPane {
RPane {
width: parent.width
height: 192
radius: 4
Material.elevation: 32
bgOpacity: 0.97
Column {
width: parent.width width: parent.width
height: parent.height height: 248
spacing: 4 radius: 4
Row { Material.elevation: 32
spacing: 32 bgOpacity: 0.97
Column {
width: parent.width width: parent.width
height: closeOnExitCol.height height: parent.height
CheckBox { spacing: 4
id: launchApp Row {
text: qsTr("Launch app") spacing: 32
checked: shortcutInfo.launch width: parent.width
onCheckedChanged: shortcutInfo.launch = checked height: closeOnExitCol.height
}
Column {
id: closeOnExitCol
spacing: 2
CheckBox { CheckBox {
id: closeOnExit id: launchApp
text: qsTr("Close when launched app quits") text: qsTr("Launch app")
checked: shortcutInfo.closeOnExit checked: shortcutInfo.launch
onCheckedChanged: shortcutInfo.closeOnExit = checked onCheckedChanged: function() {
shortcutInfo.launch = checked
if (checked) {
closeOnExit.enabled = true;
if (closeOnExit.checked) {
waitForChildren.enabled = true;
}
allowDesktopConfig.enabled = true;
} else {
waitForChildren.enabled = false;
closeOnExit.enabled = false;
allowDesktopConfig.enabled = false;
}
}
} }
Label { Column {
text: qsTr("Recommended to disable for launcher-games") id: closeOnExitCol
wrapMode: Text.WordWrap spacing: 2
width: parent.width CheckBox {
leftPadding: 32 id: closeOnExit
topPadding: -8 text: qsTr("Close when launched app quits")
checked: shortcutInfo.closeOnExit
onCheckedChanged: function() {
shortcutInfo.closeOnExit = checked
if (checked) {
waitForChildren.enabled = true;
} else {
waitForChildren.enabled = false;
}
}
}
Label {
text: qsTr("Recommended to disable for launcher-games")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
CheckBox {
id: waitForChildren
text: qsTr("Wait for child processes")
checked: shortcutInfo.waitForChildProcs
onCheckedChanged: function(){
shortcutInfo.waitForChildProcs = checked
}
}
} }
} Column {
CheckBox { spacing: 2
id: waitForChildren CheckBox {
text: qsTr("Close when all children processes quit") id: allowDesktopConfig
checked: shortcutInfo.waitForChildProcs text: qsTr("Allow desktop-config")
onCheckedChanged: function(){ checked: shortcutInfo.allowDesktopConfig
shortcutInfo.waitForChildProcs = checked onCheckedChanged: function(){
if (checked) { shortcutInfo.allowDesktopConfig = checked
closeOnExit.checked = true; }
closeOnExit.enabled = false; }
} else { Label {
closeOnExit.enabled = true; text: qsTr("Use desktop-config if launched application is not focused")
leftPadding: 32
topPadding: -8
} }
} }
} }
}
Item {
width: 1
height: 8
}
RowLayout {
id: launchlayout
spacing: 4
width: parent.width
Image {
id: maybeIcon
source: shortcutInfo.icon
? shortcutInfo.icon.endsWith(".exe")
? "image://exe/" + shortcutInfo.icon
: "file:///" + shortcutInfo.icon
: null
Layout.preferredWidth: 48
Layout.preferredHeight: 48
visible: shortcutInfo.icon
Layout.alignment: Qt.AlignVCenter
}
Item { Item {
Layout.preferredWidth: 8 width: 1
Layout.preferredHeight: 8 height: 8
visible: shortcutInfo.icon
} }
Item { RowLayout {
Layout.preferredWidth: parent.width / 2 id: launchlayout
Layout.fillWidth: true spacing: 4
height: 64 width: parent.width
Label { Image {
anchors.left: parent.left id: maybeIcon
anchors.leftMargin: 4 source: shortcutInfo.icon
id: pathLabel ? shortcutInfo.icon.endsWith(".exe")
font.bold: true ? "image://exe/" + shortcutInfo.icon
text: qsTr("Path") : "file:///" + shortcutInfo.icon
: null
Layout.preferredWidth: 48
Layout.preferredHeight: 48
visible: shortcutInfo.icon
Layout.alignment: Qt.AlignVCenter
} }
FluentTextInput { Item {
width: parent.width Layout.preferredWidth: 8
anchors.top: pathLabel.bottom Layout.preferredHeight: 8
anchors.topMargin: 4 visible: shortcutInfo.icon
id: pathInput
placeholderText: qsTr("...")
enabled: launchApp.checked
text: shortcutInfo.launchPath || ""
onTextChanged: shortcutInfo.launchPath = text
} }
} Item {
Button { Layout.preferredWidth: parent.width / 2
Layout.preferredWidth: 64 Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom height: 64
text: qsTr("...") Label {
onClicked: fileDialog.open(); anchors.left: parent.left
} anchors.leftMargin: 4
Button { id: pathLabel
Layout.preferredWidth: 64 font.bold: true
Layout.alignment: Qt.AlignBottom text: qsTr("Path")
text: qsTr("UWP") }
visible: uiModel.isWindows FluentTextInput {
onClicked: uwpSelectDialog.open(); width: parent.width
} anchors.top: pathLabel.bottom
Item { anchors.topMargin: 4
height: 1 id: pathInput
Layout.preferredWidth: 12 placeholderText: qsTr("...")
} enabled: launchApp.checked
Item { text: shortcutInfo.launchPath || ""
Layout.preferredWidth: parent.width / 2.5 onTextChanged: shortcutInfo.launchPath = text
height: 64 }
Label {
anchors.left: parent.left
anchors.leftMargin: 4
id: argslabel
font.bold: true
text: qsTr("Launch Arguments")
} }
FluentTextInput { Button {
width: parent.width Layout.preferredWidth: 64
anchors.top: argslabel.bottom Layout.alignment: Qt.AlignBottom
anchors.topMargin: 4 text: qsTr("...")
id: argsInput onClicked: fileDialog.open();
enabled: launchApp.checked }
text: shortcutInfo.launchAppArgs Button {
onTextChanged: shortcutInfo.launchAppArgs = text Layout.preferredWidth: 64
Layout.alignment: Qt.AlignBottom
text: qsTr("UWP")
visible: uiModel.isWindows
onClicked: uwpSelectDialog.open();
}
Item {
height: 1
Layout.preferredWidth: 12
}
Item {
Layout.preferredWidth: parent.width / 2.5
height: 64
Label {
anchors.left: parent.left
anchors.leftMargin: 4
id: argslabel
font.bold: true
text: qsTr("Launch Arguments")
}
FluentTextInput {
width: parent.width
anchors.top: argslabel.bottom
anchors.topMargin: 4
id: argsInput
enabled: launchApp.checked
text: shortcutInfo.launchAppArgs
onTextChanged: shortcutInfo.launchAppArgs = text
}
} }
} }
} }
} }
} Item {
Item { width: 1
width: 1 height: 8
height: 8 }
} Row {
Row { spacing: 16
spacing: 16 width: parent.width
width: parent.width
RPane { RPane {
width: parent.width / 2 - 8 width: parent.width / 2 - 8
height: 294 height: 294
radius: 4 radius: 4
Material.elevation: 32 Material.elevation: 32
bgOpacity: 0.97 bgOpacity: 0.97
Column { Column {
spacing: 2 spacing: 2
width: parent.width
RadioButton {
id: hideDevices
text: qsTr("Hide (Real) Controllers")
checked: shortcutInfo.hideDevices
onCheckedChanged: shortcutInfo.hideDevices = checked
}
Label {
text: qsTr("Hides real game controllers from the system\nThis may prevent doubled inputs")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
Label {
text: qsTr("You can change this setting and which devices are hidden in the GlosSI overlay")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
}
Item {
width: 1
height: 4
}
RadioButton {
id: realDeviceIds
text: qsTr("Use real device (USB)-IDs")
checked: shortcutInfo.realDeviceIds
onCheckedChanged: shortcutInfo.realDeviceIds = checked
}
Label {
text: qsTr("Only enable if input's are not recognized by the game")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
Label {
text: qsTr("If enabled, device-hiding won't work.\nUse the \"Max. Controller count\" setting!")
wrapMode: Text.WordWrap
width: parent.width width: parent.width
leftPadding: 32 RadioButton {
} id: hideDevices
Item { text: qsTr("Hide (Real) Controllers")
width: 1 checked: shortcutInfo.hideDevices
height: 4 onCheckedChanged: shortcutInfo.hideDevices = checked
} }
Row { Label {
leftPadding: 16 text: qsTr("Hides real game controllers from the system\nThis may prevent doubled inputs")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
Label { Label {
text: qsTr("Max. emulated controllers") text: qsTr("You can change this setting and which devices are hidden in the GlosSI overlay")
topPadding: 16 wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
} }
SpinBox { Item {
id: maxControllersSpinBox width: 1
width: 128 height: 4
value: 4 }
from: 0 RadioButton {
to: 4 id: realDeviceIds
onValueChanged: shortcutInfo.maxControllers = value text: qsTr("Use real device (USB)-IDs")
checked: shortcutInfo.realDeviceIds
onCheckedChanged: shortcutInfo.realDeviceIds = checked
}
Label {
text: qsTr("Only enable if input's are not recognized by the game")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
Label {
text: qsTr("If enabled, device-hiding won't work.\nUse the \"Max. Controller count\" setting!")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
}
Item {
width: 1
height: 4
}
Row {
leftPadding: 16
Label {
text: qsTr("Max. emulated controllers")
topPadding: 16
}
SpinBox {
id: maxControllersSpinBox
width: 128
value: 4
from: 0
to: 4
onValueChanged: shortcutInfo.maxControllers = value
}
} }
} }
} }
} RPane {
RPane { width: parent.width / 2 - 8
width: parent.width / 2 - 8 height: 294
height: 294 radius: 4
radius: 4 Material.elevation: 32
Material.elevation: 32 bgOpacity: 0.97
bgOpacity: 0.97 Column {
Column { spacing: 2
spacing: 2
width: parent.width
CheckBox {
id: windowMode
text: qsTr("Steam/GlosSI overlay as separate window")
checked: shortcutInfo.windowMode
onCheckedChanged: shortcutInfo.windowMode = checked
}
Label {
text: qsTr("Doesn't show overlay on top, but as separate window")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
Label {
text: qsTr("Use if blackscreen-issues are encountered.")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
}
Item {
width: 1
height: 4
}
CheckBox {
id: disableOverlayCheckbox
text: qsTr("Disable Steam/GlosSI overlay")
checked: shortcutInfo.disableOverlay
onCheckedChanged: shortcutInfo.disableOverlay = checked
}
Label {
text: qsTr("Only controller emulation - No extra window")
wrapMode: Text.WordWrap
width: parent.width width: parent.width
leftPadding: 32 CheckBox {
topPadding: -8 id: windowMode
text: qsTr("Steam/GlosSI overlay as separate window")
checked: shortcutInfo.windowMode
onCheckedChanged: shortcutInfo.windowMode = checked
}
Label {
text: qsTr("Doesn't show overlay on top, but as separate window")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
Label {
text: qsTr("Use if blackscreen-issues are encountered.")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
}
Item {
width: 1
height: 4
}
CheckBox {
id: disableOverlayCheckbox
text: qsTr("Disable Steam/GlosSI overlay")
checked: shortcutInfo.disableOverlay
onCheckedChanged: shortcutInfo.disableOverlay = checked
}
Label {
text: qsTr("Only controller emulation - No extra window")
wrapMode: Text.WordWrap
width: parent.width
leftPadding: 32
topPadding: -8
}
} }
} }
} }
Item {
id: bottomspacing
width: 1
height: 32
}
} }
} }
@ -389,7 +449,8 @@ Item {
spacing: 8 spacing: 8
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
anchors.margins: 32 anchors.margins: 24
anchors.bottomMargin: 16
Button { Button {
text: qsTr("Cancel") text: qsTr("Cancel")
onClicked: function() { onClicked: function() {

Loading…
Cancel
Save