diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-11-30 10:34:18 -0500 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-12-18 10:33:28 -0500 |
commit | 2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea (patch) | |
tree | c6508d694e6aab367561f325fd624da9b716ed0c /src/yuzu/main.cpp | |
parent | 8b95bf041da573459e953e27eee2dcf30208b02d (diff) |
main: Add the ability to disable the web applet
This should only be used for Super Mario 3D All-Stars. This is a temporary solution until it can be implemented properly.
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f696fc494a..ccff080747 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -370,6 +370,12 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, std::string_view additional_args) { #ifdef YUZU_USE_QT_WEB_ENGINE + if (disable_web_applet) { + emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, + "http://localhost"); + return; + } + QtNXWebEngineView web_browser_view(this, Core::System::GetInstance()); ui.action_Pause->setEnabled(false); @@ -418,6 +424,22 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, bool exit_check = false; + // TODO (Morph): Remove this + QAction* exit_action = new QAction(tr("Disable Web Applet"), this); + connect(exit_action, &QAction::triggered, this, [this, &web_browser_view] { + const auto result = QMessageBox::warning( + this, tr("Disable Web Applet"), + tr("Disabling the web applet will cause it to not be shown again for the rest of the " + "emulated session. This can lead to undefined behavior and should only be used with " + "Super Mario 3D All-Stars. Are you sure you want to disable the web applet?"), + QMessageBox::Yes | QMessageBox::No); + if (result == QMessageBox::Yes) { + disable_web_applet = true; + web_browser_view.SetFinished(true); + } + }); + ui.menubar->addAction(exit_action); + while (!web_browser_view.IsFinished()) { QCoreApplication::processEvents(); @@ -462,6 +484,8 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, ui.action_Restart->setEnabled(true); ui.action_Stop->setEnabled(true); + ui.menubar->removeAction(exit_action); + QCoreApplication::processEvents(); emit WebBrowserClosed(exit_reason, last_url); |