From 5bda353d5754965368d103e3192ef8c775e6af8c Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 30 Mar 2020 13:50:07 -1000 Subject: [PATCH] Fix dolphin open panel filter, force X11 on linux launcher --- src/Editor/CQuickplayPropertyEditor.cpp | 2 +- src/Editor/NDolphinIntegration.cpp | 15 ++++++++++++++- src/Editor/NDolphinIntegration.h | 3 +++ .../io.github.arukibree.PrimeWorldEditor.desktop | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Editor/CQuickplayPropertyEditor.cpp b/src/Editor/CQuickplayPropertyEditor.cpp index 7414098e..dac1cf1c 100644 --- a/src/Editor/CQuickplayPropertyEditor.cpp +++ b/src/Editor/CQuickplayPropertyEditor.cpp @@ -74,7 +74,7 @@ CQuickplayPropertyEditor::~CQuickplayPropertyEditor() void CQuickplayPropertyEditor::BrowseForDolphin() { - QString Path = UICommon::OpenFileDialog(this, "Open Dolphin", "Dolphin"); + QString Path = NDolphinIntegration::AskForDolphinPath(this); if (!Path.isEmpty()) { diff --git a/src/Editor/NDolphinIntegration.cpp b/src/Editor/NDolphinIntegration.cpp index 9efcd873..2f8e89eb 100644 --- a/src/Editor/NDolphinIntegration.cpp +++ b/src/Editor/NDolphinIntegration.cpp @@ -95,7 +95,7 @@ EQuickplayLaunchResult LaunchQuickplay(QWidget* pParentWidget, if (Path.isEmpty()) { // Allow the user to select the Dolphin exe. - Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", "Dolphin"); + Path = AskForDolphinPath(pParentWidget); } bool bGotDolphin = (!Path.isEmpty() && SetDolphinPath(pParentWidget, Path, true)); @@ -331,6 +331,19 @@ QString GetDolphinPath() return Path; } +QString AskForDolphinPath(QWidget* pParentWidget) { +#if Q_OS_WIN + QString Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", "*.exe"); +#elif Q_OS_MACOS + QString Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", "*.app"); + if (Path.endsWith(".app")) + Path += "/Contents/MacOS/Dolphin"; +#else + QString Path = UICommon::OpenFileDialog(pParentWidget, "Open Dolphin", {}); +#endif + return Path; +} + /** Saves/retrieves the given quickplay settings to/from QSettings. */ void SaveQuickplayParameters(const SQuickplayParameters& kParms) { diff --git a/src/Editor/NDolphinIntegration.h b/src/Editor/NDolphinIntegration.h index 5bd5535d..07f03d31 100644 --- a/src/Editor/NDolphinIntegration.h +++ b/src/Editor/NDolphinIntegration.h @@ -116,6 +116,9 @@ bool SetDolphinPath(QWidget* pParentWidget, /** Retrieves the user path to Dolphin. */ QString GetDolphinPath(); +/** Prompt user to select dolphin binary. */ +QString AskForDolphinPath(QWidget* pParentWidget); + /** Saves/retrieves the given quickplay settings to/from QSettings. */ void SaveQuickplayParameters(const SQuickplayParameters& kParms); void LoadQuickplayParameters(SQuickplayParameters& Parms); diff --git a/src/Editor/icons/freedesktop/applications/io.github.arukibree.PrimeWorldEditor.desktop b/src/Editor/icons/freedesktop/applications/io.github.arukibree.PrimeWorldEditor.desktop index 67b3c4cf..d1d886a8 100644 --- a/src/Editor/icons/freedesktop/applications/io.github.arukibree.PrimeWorldEditor.desktop +++ b/src/Editor/icons/freedesktop/applications/io.github.arukibree.PrimeWorldEditor.desktop @@ -2,7 +2,7 @@ Name=Prime World Editor GenericName=Game Data Editor Comment=Edit world assets from games by Retro Studios -Exec=PrimeWorldEditor +Exec=env QT_QPA_PLATFORM=xcb PrimeWorldEditor Icon=PrimeWorldEditor Terminal=false Type=Application