diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/frontend/applets/web_browser.cpp | 4 | ||||
| -rw-r--r-- | src/core/frontend/applets/web_browser.h | 9 | ||||
| -rw-r--r-- | src/yuzu/applets/web_browser.cpp | 19 | ||||
| -rw-r--r-- | src/yuzu/applets/web_browser.h | 11 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 |
6 files changed, 28 insertions, 25 deletions
diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 50db6a654..be4736f47 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp | |||
| @@ -12,7 +12,7 @@ WebBrowserApplet::~WebBrowserApplet() = default; | |||
| 12 | DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; | 12 | DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; |
| 13 | 13 | ||
| 14 | void DefaultWebBrowserApplet::OpenLocalWebPage( | 14 | void DefaultWebBrowserApplet::OpenLocalWebPage( |
| 15 | std::string_view local_url, std::function<void()> extract_romfs_callback, | 15 | const std::string& local_url, std::function<void()> extract_romfs_callback, |
| 16 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { | 16 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { |
| 17 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", | 17 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", |
| 18 | local_url); | 18 | local_url); |
| @@ -21,7 +21,7 @@ void DefaultWebBrowserApplet::OpenLocalWebPage( | |||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | void DefaultWebBrowserApplet::OpenExternalWebPage( | 23 | void DefaultWebBrowserApplet::OpenExternalWebPage( |
| 24 | std::string_view external_url, | 24 | const std::string& external_url, |
| 25 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { | 25 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { |
| 26 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", | 26 | LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", |
| 27 | external_url); | 27 | external_url); |
diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 1c5ef19a9..d7bd44c27 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h | |||
| @@ -16,11 +16,11 @@ public: | |||
| 16 | virtual ~WebBrowserApplet(); | 16 | virtual ~WebBrowserApplet(); |
| 17 | 17 | ||
| 18 | virtual void OpenLocalWebPage( | 18 | virtual void OpenLocalWebPage( |
| 19 | std::string_view local_url, std::function<void()> extract_romfs_callback, | 19 | const std::string& local_url, std::function<void()> extract_romfs_callback, |
| 20 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; | 20 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; |
| 21 | 21 | ||
| 22 | virtual void OpenExternalWebPage( | 22 | virtual void OpenExternalWebPage( |
| 23 | std::string_view external_url, | 23 | const std::string& external_url, |
| 24 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; | 24 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| @@ -28,11 +28,12 @@ class DefaultWebBrowserApplet final : public WebBrowserApplet { | |||
| 28 | public: | 28 | public: |
| 29 | ~DefaultWebBrowserApplet() override; | 29 | ~DefaultWebBrowserApplet() override; |
| 30 | 30 | ||
| 31 | void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback, | 31 | void OpenLocalWebPage(const std::string& local_url, |
| 32 | std::function<void()> extract_romfs_callback, | ||
| 32 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | 33 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> |
| 33 | callback) const override; | 34 | callback) const override; |
| 34 | 35 | ||
| 35 | void OpenExternalWebPage(std::string_view external_url, | 36 | void OpenExternalWebPage(const std::string& external_url, |
| 36 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | 37 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> |
| 37 | callback) const override; | 38 | callback) const override; |
| 38 | }; | 39 | }; |
diff --git a/src/yuzu/applets/web_browser.cpp b/src/yuzu/applets/web_browser.cpp index e482ba029..93e3a4f6f 100644 --- a/src/yuzu/applets/web_browser.cpp +++ b/src/yuzu/applets/web_browser.cpp | |||
| @@ -102,8 +102,8 @@ QtNXWebEngineView::~QtNXWebEngineView() { | |||
| 102 | StopInputThread(); | 102 | StopInputThread(); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | void QtNXWebEngineView::LoadLocalWebPage(std::string_view main_url, | 105 | void QtNXWebEngineView::LoadLocalWebPage(const std::string& main_url, |
| 106 | std::string_view additional_args) { | 106 | const std::string& additional_args) { |
| 107 | is_local = true; | 107 | is_local = true; |
| 108 | 108 | ||
| 109 | LoadExtractedFonts(); | 109 | LoadExtractedFonts(); |
| @@ -113,12 +113,12 @@ void QtNXWebEngineView::LoadLocalWebPage(std::string_view main_url, | |||
| 113 | SetLastURL("http://localhost/"); | 113 | SetLastURL("http://localhost/"); |
| 114 | StartInputThread(); | 114 | StartInputThread(); |
| 115 | 115 | ||
| 116 | load(QUrl(QUrl::fromLocalFile(QString::fromStdString(std::string(main_url))).toString() + | 116 | load(QUrl(QUrl::fromLocalFile(QString::fromStdString(main_url)).toString() + |
| 117 | QString::fromStdString(std::string(additional_args)))); | 117 | QString::fromStdString(additional_args))); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | void QtNXWebEngineView::LoadExternalWebPage(std::string_view main_url, | 120 | void QtNXWebEngineView::LoadExternalWebPage(const std::string& main_url, |
| 121 | std::string_view additional_args) { | 121 | const std::string& additional_args) { |
| 122 | is_local = false; | 122 | is_local = false; |
| 123 | 123 | ||
| 124 | SetUserAgent(UserAgent::WebApplet); | 124 | SetUserAgent(UserAgent::WebApplet); |
| @@ -127,8 +127,7 @@ void QtNXWebEngineView::LoadExternalWebPage(std::string_view main_url, | |||
| 127 | SetLastURL("http://localhost/"); | 127 | SetLastURL("http://localhost/"); |
| 128 | StartInputThread(); | 128 | StartInputThread(); |
| 129 | 129 | ||
| 130 | load(QUrl(QString::fromStdString(std::string(main_url)) + | 130 | load(QUrl(QString::fromStdString(main_url) + QString::fromStdString(additional_args))); |
| 131 | QString::fromStdString(std::string(additional_args)))); | ||
| 132 | } | 131 | } |
| 133 | 132 | ||
| 134 | void QtNXWebEngineView::SetUserAgent(UserAgent user_agent) { | 133 | void QtNXWebEngineView::SetUserAgent(UserAgent user_agent) { |
| @@ -375,7 +374,7 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { | |||
| 375 | QtWebBrowser::~QtWebBrowser() = default; | 374 | QtWebBrowser::~QtWebBrowser() = default; |
| 376 | 375 | ||
| 377 | void QtWebBrowser::OpenLocalWebPage( | 376 | void QtWebBrowser::OpenLocalWebPage( |
| 378 | std::string_view local_url, std::function<void()> extract_romfs_callback_, | 377 | const std::string& local_url, std::function<void()> extract_romfs_callback_, |
| 379 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { | 378 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { |
| 380 | extract_romfs_callback = std::move(extract_romfs_callback_); | 379 | extract_romfs_callback = std::move(extract_romfs_callback_); |
| 381 | callback = std::move(callback_); | 380 | callback = std::move(callback_); |
| @@ -390,7 +389,7 @@ void QtWebBrowser::OpenLocalWebPage( | |||
| 390 | } | 389 | } |
| 391 | 390 | ||
| 392 | void QtWebBrowser::OpenExternalWebPage( | 391 | void QtWebBrowser::OpenExternalWebPage( |
| 393 | std::string_view external_url, | 392 | const std::string& external_url, |
| 394 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { | 393 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { |
| 395 | callback = std::move(callback_); | 394 | callback = std::move(callback_); |
| 396 | 395 | ||
diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h index 47f960d69..7ad07409f 100644 --- a/src/yuzu/applets/web_browser.h +++ b/src/yuzu/applets/web_browser.h | |||
| @@ -58,7 +58,7 @@ public: | |||
| 58 | * @param main_url The url to the file. | 58 | * @param main_url The url to the file. |
| 59 | * @param additional_args Additional arguments appended to the main url. | 59 | * @param additional_args Additional arguments appended to the main url. |
| 60 | */ | 60 | */ |
| 61 | void LoadLocalWebPage(std::string_view main_url, std::string_view additional_args); | 61 | void LoadLocalWebPage(const std::string& main_url, const std::string& additional_args); |
| 62 | 62 | ||
| 63 | /** | 63 | /** |
| 64 | * Loads an external website. Cannot be used to load local urls. | 64 | * Loads an external website. Cannot be used to load local urls. |
| @@ -66,7 +66,7 @@ public: | |||
| 66 | * @param main_url The url to the website. | 66 | * @param main_url The url to the website. |
| 67 | * @param additional_args Additional arguments appended to the main url. | 67 | * @param additional_args Additional arguments appended to the main url. |
| 68 | */ | 68 | */ |
| 69 | void LoadExternalWebPage(std::string_view main_url, std::string_view additional_args); | 69 | void LoadExternalWebPage(const std::string& main_url, const std::string& additional_args); |
| 70 | 70 | ||
| 71 | /** | 71 | /** |
| 72 | * Sets the background color of the web page. | 72 | * Sets the background color of the web page. |
| @@ -193,16 +193,17 @@ public: | |||
| 193 | explicit QtWebBrowser(GMainWindow& parent); | 193 | explicit QtWebBrowser(GMainWindow& parent); |
| 194 | ~QtWebBrowser() override; | 194 | ~QtWebBrowser() override; |
| 195 | 195 | ||
| 196 | void OpenLocalWebPage(std::string_view local_url, std::function<void()> extract_romfs_callback_, | 196 | void OpenLocalWebPage(const std::string& local_url, |
| 197 | std::function<void()> extract_romfs_callback_, | ||
| 197 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | 198 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> |
| 198 | callback_) const override; | 199 | callback_) const override; |
| 199 | 200 | ||
| 200 | void OpenExternalWebPage(std::string_view external_url, | 201 | void OpenExternalWebPage(const std::string& external_url, |
| 201 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> | 202 | std::function<void(Service::AM::Applets::WebExitReason, std::string)> |
| 202 | callback_) const override; | 203 | callback_) const override; |
| 203 | 204 | ||
| 204 | signals: | 205 | signals: |
| 205 | void MainWindowOpenWebPage(std::string_view main_url, std::string_view additional_args, | 206 | void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args, |
| 206 | bool is_local) const; | 207 | bool is_local) const; |
| 207 | 208 | ||
| 208 | private: | 209 | private: |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 39bdf186d..00d4cfe67 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -574,8 +574,8 @@ void GMainWindow::SoftwareKeyboardExit() { | |||
| 574 | software_keyboard = nullptr; | 574 | software_keyboard = nullptr; |
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args, | 577 | void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url, |
| 578 | bool is_local) { | 578 | const std::string& additional_args, bool is_local) { |
| 579 | #ifdef YUZU_USE_QT_WEB_ENGINE | 579 | #ifdef YUZU_USE_QT_WEB_ENGINE |
| 580 | 580 | ||
| 581 | if (disable_web_applet) { | 581 | if (disable_web_applet) { |
| @@ -596,13 +596,15 @@ void GMainWindow::WebBrowserOpenWebPage(std::string_view main_url, std::string_v | |||
| 596 | loading_progress.setRange(0, 3); | 596 | loading_progress.setRange(0, 3); |
| 597 | loading_progress.setValue(0); | 597 | loading_progress.setValue(0); |
| 598 | 598 | ||
| 599 | if (is_local && !Common::FS::Exists(std::string(main_url))) { | 599 | if (is_local && !Common::FS::Exists(main_url)) { |
| 600 | loading_progress.show(); | 600 | loading_progress.show(); |
| 601 | 601 | ||
| 602 | auto future = QtConcurrent::run([this] { emit WebBrowserExtractOfflineRomFS(); }); | 602 | auto future = QtConcurrent::run([this] { emit WebBrowserExtractOfflineRomFS(); }); |
| 603 | 603 | ||
| 604 | while (!future.isFinished()) { | 604 | while (!future.isFinished()) { |
| 605 | QCoreApplication::processEvents(); | 605 | QCoreApplication::processEvents(); |
| 606 | |||
| 607 | std::this_thread::sleep_for(std::chrono::milliseconds(1)); | ||
| 606 | } | 608 | } |
| 607 | } | 609 | } |
| 608 | 610 | ||
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 7f1e50a5b..98a608fce 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -159,7 +159,7 @@ public slots: | |||
| 159 | void SoftwareKeyboardExit(); | 159 | void SoftwareKeyboardExit(); |
| 160 | void ErrorDisplayDisplayError(QString error_code, QString error_text); | 160 | void ErrorDisplayDisplayError(QString error_code, QString error_text); |
| 161 | void ProfileSelectorSelectProfile(); | 161 | void ProfileSelectorSelectProfile(); |
| 162 | void WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args, | 162 | void WebBrowserOpenWebPage(const std::string& main_url, const std::string& additional_args, |
| 163 | bool is_local); | 163 | bool is_local); |
| 164 | void OnAppFocusStateChanged(Qt::ApplicationState state); | 164 | void OnAppFocusStateChanged(Qt::ApplicationState state); |
| 165 | 165 | ||