summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2020-11-30 16:34:18 +0100
committerMorph <39850852+Morph1984@users.noreply.github.com>2020-12-18 16:33:28 +0100
commit2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea (patch)
treec6508d694e6aab367561f325fd624da9b716ed0c
parentmain, applets/web: Re-add progress dialog for RomFS extraction (diff)
downloadyuzu-2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea.tar
yuzu-2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea.tar.gz
yuzu-2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea.tar.bz2
yuzu-2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea.tar.lz
yuzu-2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea.tar.xz
yuzu-2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea.tar.zst
yuzu-2ddd83cdfe2bfb63579d2932a1ee3b26073fbeea.zip
-rw-r--r--src/yuzu/main.cpp24
-rw-r--r--src/yuzu/main.h3
2 files changed, 27 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index f696fc494..ccff08074 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);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index ed02df3e2..b140995bf 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -325,6 +325,9 @@ private:
// Last game booted, used for multi-process apps
QString last_filename_booted;
+ // Disables the web applet for the rest of the emulated session
+ bool disable_web_applet{};
+
protected:
void dropEvent(QDropEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;