From 82fa9f8d56bc285e7bb58fc81b495a55be9ea82c Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Tue, 8 Dec 2020 06:20:45 -0500 Subject: applets/web: Implement the online web browser applet --- src/yuzu/main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f835ee9cb..620e80cdc 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -366,13 +366,13 @@ void GMainWindow::SoftwareKeyboardInvokeCheckDialog(std::u16string error_message emit SoftwareKeyboardFinishedCheckDialog(); } -void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, - std::string_view additional_args) { +void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args, + bool is_local) { #ifdef YUZU_USE_QT_WEB_ENGINE if (disable_web_applet) { emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, - "http://localhost"); + "http://localhost/"); return; } @@ -388,7 +388,7 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, loading_progress.setRange(0, 3); loading_progress.setValue(0); - if (!Common::FS::Exists(std::string(main_url))) { + if (is_local && !Common::FS::Exists(std::string(main_url))) { loading_progress.show(); auto future = QtConcurrent::run([this] { emit WebBrowserExtractOfflineRomFS(); }); @@ -400,7 +400,11 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, loading_progress.setValue(1); - web_browser_view.LoadLocalWebPage(main_url, additional_args); + if (is_local) { + web_browser_view.LoadLocalWebPage(main_url, additional_args); + } else { + web_browser_view.LoadExternalWebPage(main_url, additional_args); + } if (render_window->IsLoadingComplete()) { render_window->hide(); @@ -493,7 +497,7 @@ void GMainWindow::WebBrowserOpenLocalWebPage(std::string_view main_url, #else // Utilize the same fallback as the default web browser applet. - emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost"); + emit WebBrowserClosed(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); #endif } -- cgit v1.2.3