From e175b7046a9eb6390c5bece0dd8bf759f13adcd8 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Wed, 28 Sep 2022 00:20:16 +0200 Subject: [PATCH] GlosSIConfig: ShortcutProps: Fix config not resetting on cancel --- GlosSIConfig/qml/ShortcutProps.qml | 40 +++++++++++++++++------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/GlosSIConfig/qml/ShortcutProps.qml b/GlosSIConfig/qml/ShortcutProps.qml index 73277ae..a4d3820 100644 --- a/GlosSIConfig/qml/ShortcutProps.qml +++ b/GlosSIConfig/qml/ShortcutProps.qml @@ -67,24 +67,29 @@ Item { } onShortcutInfoChanged: function() { - nameInput.text = shortcutInfo.name || "" - if (extendedLogging) { + if (!shortcutInfo) { + return; + } + if (nameInput) { // basic info (not in collapsible container) + nameInput.text = shortcutInfo.name || "" + launchApp.checked = shortcutInfo.launch.launch + pathInput.text = shortcutInfo.launch.launchPath || "" + argsInput.text = shortcutInfo.launch.launchAppArgs || "" + } + if (extendedLogging) { // advanced settings (collapsible container) extendedLogging.checked = shortcutInfo.extendedLogging || false + closeOnExit.checked = shortcutInfo.launch.closeOnExit + waitForChildren.checked = shortcutInfo.launch.waitForChildProcs + hideDevices.checked = shortcutInfo.devices.hideDevices + realDeviceIds.checked = shortcutInfo.devices.realDeviceIds + windowMode.checked = shortcutInfo.window.windowMode + disableOverlayCheckbox.checked = shortcutInfo.window.disableOverlay + scaleSpinBox.value = shortcutInfo.window.scale + maxFPSSpinBox.value = shortcutInfo.window.maxFps + maxControllersSpinBox.value = shortcutInfo.controller.maxControllers + allowDesktopConfig.checked = shortcutInfo.controller.allowDesktopConfig + emulateDS4.checked = shortcutInfo.controller.emulateDS4 } - launchApp.checked = shortcutInfo.launch.launch - pathInput.text = shortcutInfo.launch.launchPath || "" - argsInput.text = shortcutInfo.launch.launchAppArgs || "" - closeOnExit.checked = shortcutInfo.launch.closeOnExit - waitForChildren.checked = shortcutInfo.launch.waitForChildProcs - hideDevices.checked = shortcutInfo.devices.hideDevices - realDeviceIds.checked = shortcutInfo.devices.realDeviceIds - windowMode.checked = shortcutInfo.window.windowMode - disableOverlayCheckbox.checked = shortcutInfo.window.disableOverlay - scaleSpinBox.value = shortcutInfo.window.scale - maxFPSSpinBox.value = shortcutInfo.window.maxFps - maxControllersSpinBox.value = shortcutInfo.controller.maxControllers - allowDesktopConfig.checked = shortcutInfo.controller.allowDesktopConfig - emulateDS4.checked = shortcutInfo.controller.emulateDS4 } Flickable { @@ -157,7 +162,7 @@ Item { CheckBox { id: launchApp text: qsTr("Launch app") - checked: shortcutInfo.launch.launch + checked: shortcutInfo ? shortcutInfo.launch.launch : false onCheckedChanged: function() { shortcutInfo.launch.launch = checked if (checked) { @@ -748,6 +753,7 @@ Item { Button { text: qsTr("Cancel") onClicked: function() { + resetInfo(); cancel() } }