From dac5694aa90ea2c49afa6e788c3b21ad18bd1e60 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Fri, 12 Nov 2021 15:31:36 +0100 Subject: [PATCH] Add wait for child procs config UI --- GlosSIConfig/UIModel.cpp | 2 ++ GlosSIConfig/qml/ShortcutCards.qml | 8 ++++---- GlosSIConfig/qml/ShortcutProps.qml | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/GlosSIConfig/UIModel.cpp b/GlosSIConfig/UIModel.cpp index 7529f1b..67e2f9c 100644 --- a/GlosSIConfig/UIModel.cpp +++ b/GlosSIConfig/UIModel.cpp @@ -76,6 +76,7 @@ void UIModel::readConfigs() json["launchPath"] = filejson["launch"]["launchPath"]; json["launchAppArgs"] = filejson["launch"]["launchAppArgs"]; json["closeOnExit"] = filejson["launch"]["closeOnExit"]; + json["waitForChildProcs"] = filejson["launch"]["waitForChildProcs"]; json["hideDevices"] = filejson["devices"]["hideDevices"]; json["windowMode"] = filejson["window"]["windowMode"]; json["maxFps"] = filejson["window"]["maxFps"]; @@ -263,6 +264,7 @@ void UIModel::writeTarget(const QJsonObject& json, const QString& name) launchObject["launchPath"] = json["launchPath"]; launchObject["launchAppArgs"] = json["launchAppArgs"]; launchObject["closeOnExit"] = json["closeOnExit"]; + launchObject["waitForChildProcs"] = json["waitForChildProcs"]; fileJson["launch"] = launchObject; QJsonObject devicesObject; diff --git a/GlosSIConfig/qml/ShortcutCards.qml b/GlosSIConfig/qml/ShortcutCards.qml index faadf28..4fdb9dd 100644 --- a/GlosSIConfig/qml/ShortcutCards.qml +++ b/GlosSIConfig/qml/ShortcutCards.qml @@ -86,14 +86,14 @@ GridView { anchors.top: parent.top anchors.left: parent.left id: maybeIcon - source: modelData.icon + source: !!modelData.icon ? modelData.icon.endsWith(".exe") ? "image://exe/" + modelData.icon : "file:///" + modelData.icon : null width: 48 height: 48 - visible: modelData.icon + visible: !!modelData.icon } Label { @@ -116,10 +116,10 @@ GridView { spacing: 8 Row { spacing: 8 - visible: modelData.launchPath && modelData.launchPath.length > 0 + visible: !!modelData.launchPath && modelData.launchPath.length > 0 Label { id: typeLabel - text: uiModel.isWindows && modelData.launchPath + text: uiModel.isWindows && !!modelData.launchPath ? modelData.launchPath.replace(/^.{1,3}:/, "").length < modelData.launchPath.length ? "Win32" : "UWP" diff --git a/GlosSIConfig/qml/ShortcutProps.qml b/GlosSIConfig/qml/ShortcutProps.qml index 207e77f..9644ef4 100644 --- a/GlosSIConfig/qml/ShortcutProps.qml +++ b/GlosSIConfig/qml/ShortcutProps.qml @@ -36,6 +36,7 @@ Item { launchPath: null, launchAppArgs: null, closeOnExit: true, + waitForChildProcs: false, hideDevices: true, windowMode: false, maxFps: null, @@ -51,6 +52,7 @@ Item { launchPath: null, launchAppArgs: null, closeOnExit: true, + waitForChildProcs: false, hideDevices: true, windowMode: false, maxFps: null, @@ -65,6 +67,7 @@ Item { pathInput.text = shortcutInfo.launchPath || "" argsInput.text = shortcutInfo.launchAppArgs || "" closeOnExit.checked = shortcutInfo.closeOnExit || false + waitForChildren.checked = shortcutInfo.waitForChildProcs || false hideDevices.checked = shortcutInfo.hideDevices || false windowMode.checked = shortcutInfo.windowMode || false } @@ -127,6 +130,20 @@ Item { wrapMode: Text.WordWrap width: parent.width } + CheckBox { + id: waitForChildren + text: qsTr("Close when all children processes quit") + checked: shortcutInfo.waitForChildProcs + onCheckedChanged: function(){ + shortcutInfo.waitForChildProcs = checked + if (checked) { + closeOnExit.checked = true; + closeOnExit.enabled = false; + } else { + closeOnExit.enabled = true; + } + } + } } } RowLayout {