2
0
mirror of https://github.com/Alia5/GlosSI.git synced 2024-11-10 19:10:46 +00:00

GlosSIConfig: Allow Desktop config setting

This commit is contained in:
Peter Repukat 2022-03-14 20:13:27 +01:00
parent bfadeadced
commit 21abef9bde
2 changed files with 349 additions and 286 deletions

View File

@ -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();

View File

@ -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,16 +81,38 @@ 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
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 spacing: 4
Item {
id: topspacing
width: 1
height: 32
}
Item { Item {
id: namewrapper id: namewrapper
width: parent.width / 3 width: parent.width / 3
@ -117,7 +141,7 @@ Item {
} }
RPane { RPane {
width: parent.width width: parent.width
height: 192 height: 248
radius: 4 radius: 4
Material.elevation: 32 Material.elevation: 32
bgOpacity: 0.97 bgOpacity: 0.97
@ -133,7 +157,20 @@ Item {
id: launchApp id: launchApp
text: qsTr("Launch app") text: qsTr("Launch app")
checked: shortcutInfo.launch 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 { Column {
id: closeOnExitCol id: closeOnExitCol
@ -142,7 +179,14 @@ Item {
id: closeOnExit id: closeOnExit
text: qsTr("Close when launched app quits") text: qsTr("Close when launched app quits")
checked: shortcutInfo.closeOnExit checked: shortcutInfo.closeOnExit
onCheckedChanged: shortcutInfo.closeOnExit = checked onCheckedChanged: function() {
shortcutInfo.closeOnExit = checked
if (checked) {
waitForChildren.enabled = true;
} else {
waitForChildren.enabled = false;
}
}
} }
Label { Label {
text: qsTr("Recommended to disable for launcher-games") text: qsTr("Recommended to disable for launcher-games")
@ -151,21 +195,31 @@ Item {
leftPadding: 32 leftPadding: 32
topPadding: -8 topPadding: -8
} }
}
CheckBox { CheckBox {
id: waitForChildren id: waitForChildren
text: qsTr("Close when all children processes quit") text: qsTr("Wait for child processes")
checked: shortcutInfo.waitForChildProcs checked: shortcutInfo.waitForChildProcs
onCheckedChanged: function(){ onCheckedChanged: function(){
shortcutInfo.waitForChildProcs = checked 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 { Item {
width: 1 width: 1
@ -383,13 +437,20 @@ Item {
} }
} }
} }
Item {
id: bottomspacing
width: 1
height: 32
}
}
} }
Row { Row {
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() {