From 060a00b9c73b7f0ac8887ef65daf26ce8bd1b000 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 31 Mar 2019 15:16:48 -0700 Subject: [PATCH] Consolidate help handling into ErrorMessageDialog --- app/gui/AppView.qml | 1 - app/gui/CliQuitStreamSegue.qml | 4 ---- app/gui/CliStartStreamSegue.qml | 4 ---- app/gui/ErrorMessageDialog.qml | 5 +++++ app/gui/PcView.qml | 9 ++++----- app/gui/QuitSegue.qml | 3 --- app/gui/StreamSegue.qml | 4 ---- app/gui/main.qml | 12 +++--------- 8 files changed, 12 insertions(+), 30 deletions(-) diff --git a/app/gui/AppView.qml b/app/gui/AppView.qml index d585a752..c590fc29 100644 --- a/app/gui/AppView.qml +++ b/app/gui/AppView.qml @@ -216,7 +216,6 @@ GridView { NavigableMessageDialog { id: quitAppDialog - modality:Qt.WindowModal property string appName : "" property bool segueToStream : false property string nextAppName: "" diff --git a/app/gui/CliQuitStreamSegue.qml b/app/gui/CliQuitStreamSegue.qml index 8c229736..54f4de41 100644 --- a/app/gui/CliQuitStreamSegue.qml +++ b/app/gui/CliQuitStreamSegue.qml @@ -51,10 +51,6 @@ Item { ErrorMessageDialog { id: errorDialog - onHelp: { - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"); - } - onVisibleChanged: { if (!visible) { Qt.quit() diff --git a/app/gui/CliStartStreamSegue.qml b/app/gui/CliStartStreamSegue.qml index 06edfcc9..4b3beddc 100644 --- a/app/gui/CliStartStreamSegue.qml +++ b/app/gui/CliStartStreamSegue.qml @@ -67,10 +67,6 @@ Item { ErrorMessageDialog { id: errorDialog - onHelp: { - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"); - } - onVisibleChanged: { if (!visible) { Qt.quit(); diff --git a/app/gui/ErrorMessageDialog.qml b/app/gui/ErrorMessageDialog.qml index 1b7a5a7e..d0ffba89 100644 --- a/app/gui/ErrorMessageDialog.qml +++ b/app/gui/ErrorMessageDialog.qml @@ -5,9 +5,14 @@ import SystemProperties 1.0 NavigableMessageDialog { property string helpText + property string helpUrl : "https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting" informativeText: SystemProperties.hasBrowser ? helpText : "" icon: StandardIcon.Critical standardButtons: StandardButton.Ok | (SystemProperties.hasBrowser ? StandardButton.Help : 0) + + onHelp: { + Qt.openUrlExternally(helpUrl) + } } diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index a63e1938..737d3a73 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -231,11 +231,10 @@ GridView { ErrorMessageDialog { id: errorDialog - onHelp: { - // Using Setup-Guide here instead of Troubleshooting because it's likely that users - // will arrive here by forgetting to enable GameStream or not forwarding ports. - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide"); - } + + // Using Setup-Guide here instead of Troubleshooting because it's likely that users + // will arrive here by forgetting to enable GameStream or not forwarding ports. + helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide" } NavigableMessageDialog { diff --git a/app/gui/QuitSegue.qml b/app/gui/QuitSegue.qml index 44e1814e..536f9d3a 100644 --- a/app/gui/QuitSegue.qml +++ b/app/gui/QuitSegue.qml @@ -69,8 +69,5 @@ Item { ErrorMessageDialog { id: errorDialog - onHelp: { - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"); - } } } diff --git a/app/gui/StreamSegue.qml b/app/gui/StreamSegue.qml index 45814476..e45373bf 100644 --- a/app/gui/StreamSegue.qml +++ b/app/gui/StreamSegue.qml @@ -182,9 +182,5 @@ Item { Qt.quit() } } - - onHelp: { - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"); - } } } diff --git a/app/gui/main.qml b/app/gui/main.qml index 29e09ae9..a503f2f1 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -383,9 +383,7 @@ ApplicationWindow { text: "No functioning hardware accelerated H.264 video decoder was detected by Moonlight. " + "Your streaming performance may be severely degraded in this configuration." helpText: "Click the Help button for more information on solving this problem." - onHelp: { - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems"); - } + helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems" } ErrorMessageDialog { @@ -394,9 +392,7 @@ ApplicationWindow { text: "Moonlight does not support hardware acceleration on Wayland. Continuing on Wayland may result in poor streaming performance. " + "Please switch to an X session for optimal performance." helpText: "Click the Help button for more information." - onHelp: { - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems"); - } + helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Fixing-Hardware-Decoding-Problems" } NavigableMessageDialog { @@ -415,9 +411,7 @@ ApplicationWindow { icon: StandardIcon.Warning text: "Moonlight detected gamepads without a mapping:\n" + unmappedGamepads helpText: "Click the Help button for information on how to map your gamepads." - onHelp: { - Qt.openUrlExternally("https://github.com/moonlight-stream/moonlight-docs/wiki/Gamepad-Mapping"); - } + helpUrl: "https://github.com/moonlight-stream/moonlight-docs/wiki/Gamepad-Mapping" } // This dialog appears when quitting via keyboard or gamepad button