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["scale"] = filejson["window"]["scale"];
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"), "");
@ -363,6 +364,7 @@ void UIModel::writeTarget(const QJsonObject& json, const QString& name)
QJsonObject controllerObject;
controllerObject["maxControllers"] = json["maxControllers"];
controllerObject["allowDesktopConfig"] = json["allowDesktopConfig"];
fileJson["controller"] = controllerObject;
auto wtf = QString(QJsonDocument(fileJson).toJson(QJsonDocument::Indented)).toStdString();

@ -44,7 +44,8 @@ Item {
icon: null,
maxControllers: 4,
disableOverlay: false,
realDeviceIds: false
realDeviceIds: false,
allowDesktopConfig: true,
})
function resetInfo() {
@ -63,7 +64,8 @@ Item {
icon: null,
maxControllers: 4,
disableOverlay: false,
realDeviceIds: false
realDeviceIds: false,
allowDesktopConfig: true,
})
}
@ -79,16 +81,38 @@ Item {
maxControllersSpinBox.value = shortcutInfo.maxControllers
disableOverlayCheckbox.checked = shortcutInfo.disableOverlay || false
realDeviceIds.checked = shortcutInfo.realDeviceIds || false
allowDesktopConfig.checked = shortcutInfo.allowDesktopConfig || true
}
Column {
anchors.margins: 32
Flickable {
id: flickable
anchors.margins: 0
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
clip: true
ScrollBar.vertical: ScrollBar {
}
contentWidth: propscolumn.width
contentHeight: propscolumn.height
flickableDirection: Flickable.VerticalFlick
Column {
id: propscolumn
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 32
spacing: 4
Item {
id: topspacing
width: 1
height: 32
}
Item {
id: namewrapper
width: parent.width / 3
@ -117,7 +141,7 @@ Item {
}
RPane {
width: parent.width
height: 192
height: 248
radius: 4
Material.elevation: 32
bgOpacity: 0.97
@ -133,7 +157,20 @@ Item {
id: launchApp
text: qsTr("Launch app")
checked: shortcutInfo.launch
onCheckedChanged: shortcutInfo.launch = 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;
}
}
}
Column {
id: closeOnExitCol
@ -142,7 +179,14 @@ Item {
id: closeOnExit
text: qsTr("Close when launched app quits")
checked: shortcutInfo.closeOnExit
onCheckedChanged: shortcutInfo.closeOnExit = checked
onCheckedChanged: function() {
shortcutInfo.closeOnExit = checked
if (checked) {
waitForChildren.enabled = true;
} else {
waitForChildren.enabled = false;
}
}
}
Label {
text: qsTr("Recommended to disable for launcher-games")
@ -151,21 +195,31 @@ Item {
leftPadding: 32
topPadding: -8
}
}
CheckBox {
id: waitForChildren
text: qsTr("Close when all children processes quit")
text: qsTr("Wait for child processes")
checked: shortcutInfo.waitForChildProcs
onCheckedChanged: function(){
shortcutInfo.waitForChildProcs = checked
if (checked) {
closeOnExit.checked = true;
closeOnExit.enabled = false;
} else {
closeOnExit.enabled = true;
}
}
}
Column {
spacing: 2
CheckBox {
id: allowDesktopConfig
text: qsTr("Allow desktop-config")
checked: shortcutInfo.allowDesktopConfig
onCheckedChanged: function(){
shortcutInfo.allowDesktopConfig = checked
}
}
Label {
text: qsTr("Use desktop-config if launched application is not focused")
leftPadding: 32
topPadding: -8
}
}
}
Item {
width: 1
@ -383,13 +437,20 @@ Item {
}
}
}
Item {
id: bottomspacing
width: 1
height: 32
}
}
}
Row {
spacing: 8
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: 32
anchors.margins: 24
anchors.bottomMargin: 16
Button {
text: qsTr("Cancel")
onClicked: function() {

Loading…
Cancel
Save