diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2022-12-06 17:26:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 17:26:53 +0100 |
commit | d8534ea140a0e07fa010fe58fae068ed926c1dbc (patch) | |
tree | 176afc9e7d481b7b48f5a61a21b5184bf33cef62 | |
parent | Merge pull request #9389 from lioncash/emumove (diff) | |
parent | applets/controller: Use aliases for callbacks (diff) | |
download | yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.gz yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.bz2 yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.lz yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.xz yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.tar.zst yuzu-d8534ea140a0e07fa010fe58fae068ed926c1dbc.zip |
22 files changed, 89 insertions, 100 deletions
diff --git a/src/core/frontend/applets/controller.cpp b/src/core/frontend/applets/controller.cpp index 6c230f619..52919484e 100644 --- a/src/core/frontend/applets/controller.cpp +++ b/src/core/frontend/applets/controller.cpp @@ -16,7 +16,7 @@ DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_ DefaultControllerApplet::~DefaultControllerApplet() = default; -void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callback, +void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback, const ControllerParameters& parameters) const { LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!"); diff --git a/src/core/frontend/applets/controller.h b/src/core/frontend/applets/controller.h index 71698df74..adb2feefd 100644 --- a/src/core/frontend/applets/controller.h +++ b/src/core/frontend/applets/controller.h @@ -36,9 +36,11 @@ struct ControllerParameters { class ControllerApplet { public: + using ReconfigureCallback = std::function<void()>; + virtual ~ControllerApplet(); - virtual void ReconfigureControllers(std::function<void()> callback, + virtual void ReconfigureControllers(ReconfigureCallback callback, const ControllerParameters& parameters) const = 0; }; @@ -47,7 +49,7 @@ public: explicit DefaultControllerApplet(HID::HIDCore& hid_core_); ~DefaultControllerApplet() override; - void ReconfigureControllers(std::function<void()> callback, + void ReconfigureControllers(ReconfigureCallback callback, const ControllerParameters& parameters) const override; private: diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp index f8b961098..69c2b2b4d 100644 --- a/src/core/frontend/applets/error.cpp +++ b/src/core/frontend/applets/error.cpp @@ -8,13 +8,13 @@ namespace Core::Frontend { ErrorApplet::~ErrorApplet() = default; -void DefaultErrorApplet::ShowError(Result error, std::function<void()> finished) const { +void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const { LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", error.module.Value(), error.description.Value(), error.raw); } void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const { + FinishedCallback finished) const { LOG_CRITICAL( Service_Fatal, "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", @@ -23,7 +23,7 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::secon void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text, std::string detail_text, - std::function<void()> finished) const { + FinishedCallback finished) const { LOG_CRITICAL(Service_Fatal, "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", error.module.Value(), error.description.Value(), error.raw); diff --git a/src/core/frontend/applets/error.h b/src/core/frontend/applets/error.h index f378f8805..884f2f653 100644 --- a/src/core/frontend/applets/error.h +++ b/src/core/frontend/applets/error.h @@ -12,25 +12,27 @@ namespace Core::Frontend { class ErrorApplet { public: + using FinishedCallback = std::function<void()>; + virtual ~ErrorApplet(); - virtual void ShowError(Result error, std::function<void()> finished) const = 0; + virtual void ShowError(Result error, FinishedCallback finished) const = 0; virtual void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const = 0; + FinishedCallback finished) const = 0; virtual void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text, - std::function<void()> finished) const = 0; + FinishedCallback finished) const = 0; }; class DefaultErrorApplet final : public ErrorApplet { public: - void ShowError(Result error, std::function<void()> finished) const override; + void ShowError(Result error, FinishedCallback finished) const override; void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const override; + FinishedCallback finished) const override; void ShowCustomErrorText(Result error, std::string main_text, std::string detail_text, - std::function<void()> finished) const override; + FinishedCallback finished) const override; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/mii_edit.cpp b/src/core/frontend/applets/mii_edit.cpp index d37b5368a..bc8c57067 100644 --- a/src/core/frontend/applets/mii_edit.cpp +++ b/src/core/frontend/applets/mii_edit.cpp @@ -8,7 +8,7 @@ namespace Core::Frontend { MiiEditApplet::~MiiEditApplet() = default; -void DefaultMiiEditApplet::ShowMiiEdit(const std::function<void()>& callback) const { +void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const { LOG_WARNING(Service_AM, "(STUBBED) called"); callback(); diff --git a/src/core/frontend/applets/mii_edit.h b/src/core/frontend/applets/mii_edit.h index 58fa2039b..d828f06ec 100644 --- a/src/core/frontend/applets/mii_edit.h +++ b/src/core/frontend/applets/mii_edit.h @@ -9,14 +9,16 @@ namespace Core::Frontend { class MiiEditApplet { public: + using MiiEditCallback = std::function<void()>; + virtual ~MiiEditApplet(); - virtual void ShowMiiEdit(const std::function<void()>& callback) const = 0; + virtual void ShowMiiEdit(const MiiEditCallback& callback) const = 0; }; class DefaultMiiEditApplet final : public MiiEditApplet { public: - void ShowMiiEdit(const std::function<void()>& callback) const override; + void ShowMiiEdit(const MiiEditCallback& callback) const override; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index d11fbce0a..da4cfbf87 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp @@ -9,8 +9,7 @@ namespace Core::Frontend { ProfileSelectApplet::~ProfileSelectApplet() = default; -void DefaultProfileSelectApplet::SelectProfile( - std::function<void(std::optional<Common::UUID>)> callback) const { +void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const { Service::Account::ProfileManager manager; callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h index 8d6ee5279..138429533 100644 --- a/src/core/frontend/applets/profile_select.h +++ b/src/core/frontend/applets/profile_select.h @@ -11,14 +11,16 @@ namespace Core::Frontend { class ProfileSelectApplet { public: + using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>; + virtual ~ProfileSelectApplet(); - virtual void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const = 0; + virtual void SelectProfile(SelectProfileCallback callback) const = 0; }; class DefaultProfileSelectApplet final : public ProfileSelectApplet { public: - void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override; + void SelectProfile(SelectProfileCallback callback) const override; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index 020c7fa5e..a3720f4d7 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp @@ -15,10 +15,7 @@ DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default; void DefaultSoftwareKeyboardApplet::InitializeKeyboard( bool is_inline, KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) { + SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) { if (is_inline) { LOG_WARNING( Service_AM, diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index 094d1e713..8aef103d3 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h @@ -54,14 +54,17 @@ struct InlineTextParameters { class SoftwareKeyboardApplet { public: + using SubmitInlineCallback = + std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>; + using SubmitNormalCallback = + std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>; + virtual ~SoftwareKeyboardApplet(); - virtual void InitializeKeyboard( - bool is_inline, KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) = 0; + virtual void InitializeKeyboard(bool is_inline, + KeyboardInitializeParameters initialize_parameters, + SubmitNormalCallback submit_normal_callback_, + SubmitInlineCallback submit_inline_callback_) = 0; virtual void ShowNormalKeyboard() const = 0; @@ -81,12 +84,9 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { public: ~DefaultSoftwareKeyboardApplet() override; - void InitializeKeyboard( - bool is_inline, KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) override; + void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters, + SubmitNormalCallback submit_normal_callback_, + SubmitInlineCallback submit_inline_callback_) override; void ShowNormalKeyboard() const override; @@ -105,12 +105,10 @@ private: void SubmitNormalText(std::u16string text) const; void SubmitInlineText(std::u16string_view text) const; - KeyboardInitializeParameters parameters; + KeyboardInitializeParameters parameters{}; - mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback; - mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback; + mutable SubmitNormalCallback submit_normal_callback; + mutable SubmitInlineCallback submit_inline_callback; }; } // namespace Core::Frontend diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 27c7086be..b09cb7102 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -10,18 +10,17 @@ WebBrowserApplet::~WebBrowserApplet() = default; DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default; -void DefaultWebBrowserApplet::OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { +void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", local_url); callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); } -void DefaultWebBrowserApplet::OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const { +void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", external_url); diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 1411274f8..4f72284ad 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -11,29 +11,29 @@ namespace Core::Frontend { class WebBrowserApplet { public: + using ExtractROMFSCallback = std::function<void()>; + using OpenWebPageCallback = + std::function<void(Service::AM::Applets::WebExitReason, std::string)>; + virtual ~WebBrowserApplet(); - virtual void OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; + virtual void OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const = 0; - virtual void OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0; + virtual void OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback) const = 0; }; class DefaultWebBrowserApplet final : public WebBrowserApplet { public: ~DefaultWebBrowserApplet() override; - void OpenLocalWebPage(const std::string& local_url, - std::function<void()> extract_romfs_callback, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback) const override; + void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback, + OpenWebPageCallback callback) const override; void OpenExternalWebPage(const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback) const override; + OpenWebPageCallback callback) const override; }; } // namespace Core::Frontend diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp index 12efdc216..c30b54499 100644 --- a/src/yuzu/applets/qt_controller.cpp +++ b/src/yuzu/applets/qt_controller.cpp @@ -685,7 +685,7 @@ QtControllerSelector::QtControllerSelector(GMainWindow& parent) { QtControllerSelector::~QtControllerSelector() = default; void QtControllerSelector::ReconfigureControllers( - std::function<void()> callback_, const Core::Frontend::ControllerParameters& parameters) const { + ReconfigureCallback callback_, const Core::Frontend::ControllerParameters& parameters) const { callback = std::move(callback_); emit MainWindowReconfigureControllers(parameters); } diff --git a/src/yuzu/applets/qt_controller.h b/src/yuzu/applets/qt_controller.h index cf948d2b5..16e99f507 100644 --- a/src/yuzu/applets/qt_controller.h +++ b/src/yuzu/applets/qt_controller.h @@ -157,7 +157,7 @@ public: ~QtControllerSelector() override; void ReconfigureControllers( - std::function<void()> callback_, + ReconfigureCallback callback_, const Core::Frontend::ControllerParameters& parameters) const override; signals: @@ -167,5 +167,5 @@ signals: private: void MainWindowReconfigureFinished(); - mutable std::function<void()> callback; + mutable ReconfigureCallback callback; }; diff --git a/src/yuzu/applets/qt_error.cpp b/src/yuzu/applets/qt_error.cpp index 367d5352d..e0190a979 100644 --- a/src/yuzu/applets/qt_error.cpp +++ b/src/yuzu/applets/qt_error.cpp @@ -14,7 +14,7 @@ QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) { QtErrorDisplay::~QtErrorDisplay() = default; -void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) const { +void QtErrorDisplay::ShowError(Result error, FinishedCallback finished) const { callback = std::move(finished); emit MainWindowDisplayError( tr("Error Code: %1-%2 (0x%3)") @@ -25,7 +25,7 @@ void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) con } void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const { + FinishedCallback finished) const { callback = std::move(finished); const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count()); @@ -42,7 +42,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds t void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text, - std::function<void()> finished) const { + FinishedCallback finished) const { callback = std::move(finished); emit MainWindowDisplayError( tr("Error Code: %1-%2 (0x%3)") diff --git a/src/yuzu/applets/qt_error.h b/src/yuzu/applets/qt_error.h index eb4107c7e..e4e174721 100644 --- a/src/yuzu/applets/qt_error.h +++ b/src/yuzu/applets/qt_error.h @@ -16,11 +16,11 @@ public: explicit QtErrorDisplay(GMainWindow& parent); ~QtErrorDisplay() override; - void ShowError(Result error, std::function<void()> finished) const override; + void ShowError(Result error, FinishedCallback finished) const override; void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, - std::function<void()> finished) const override; + FinishedCallback finished) const override; void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text, - std::function<void()> finished) const override; + FinishedCallback finished) const override; signals: void MainWindowDisplayError(QString error_code, QString error_text) const; @@ -28,5 +28,5 @@ signals: private: void MainWindowFinishedError(); - mutable std::function<void()> callback; + mutable FinishedCallback callback; }; diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp index c8bcfb223..4145c5299 100644 --- a/src/yuzu/applets/qt_profile_select.cpp +++ b/src/yuzu/applets/qt_profile_select.cpp @@ -163,8 +163,7 @@ QtProfileSelector::QtProfileSelector(GMainWindow& parent) { QtProfileSelector::~QtProfileSelector() = default; -void QtProfileSelector::SelectProfile( - std::function<void(std::optional<Common::UUID>)> callback_) const { +void QtProfileSelector::SelectProfile(SelectProfileCallback callback_) const { callback = std::move(callback_); emit MainWindowSelectProfile(); } diff --git a/src/yuzu/applets/qt_profile_select.h b/src/yuzu/applets/qt_profile_select.h index 124f2cdbd..637a3bda2 100644 --- a/src/yuzu/applets/qt_profile_select.h +++ b/src/yuzu/applets/qt_profile_select.h @@ -65,7 +65,7 @@ public: explicit QtProfileSelector(GMainWindow& parent); ~QtProfileSelector() override; - void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback_) const override; + void SelectProfile(SelectProfileCallback callback_) const override; signals: void MainWindowSelectProfile() const; @@ -73,5 +73,5 @@ signals: private: void MainWindowFinishedSelection(std::optional<Common::UUID> uuid); - mutable std::function<void(std::optional<Common::UUID>)> callback; + mutable SelectProfileCallback callback; }; diff --git a/src/yuzu/applets/qt_software_keyboard.cpp b/src/yuzu/applets/qt_software_keyboard.cpp index e60506197..734b0ea40 100644 --- a/src/yuzu/applets/qt_software_keyboard.cpp +++ b/src/yuzu/applets/qt_software_keyboard.cpp @@ -1566,10 +1566,7 @@ QtSoftwareKeyboard::~QtSoftwareKeyboard() = default; void QtSoftwareKeyboard::InitializeKeyboard( bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) { + SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) { if (is_inline) { submit_inline_callback = std::move(submit_inline_callback_); } else { diff --git a/src/yuzu/applets/qt_software_keyboard.h b/src/yuzu/applets/qt_software_keyboard.h index 35d4ee2ef..30ac8ecf6 100644 --- a/src/yuzu/applets/qt_software_keyboard.h +++ b/src/yuzu/applets/qt_software_keyboard.h @@ -233,12 +233,10 @@ public: explicit QtSoftwareKeyboard(GMainWindow& parent); ~QtSoftwareKeyboard() override; - void InitializeKeyboard( - bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters, - std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback_, - std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback_) override; + void InitializeKeyboard(bool is_inline, + Core::Frontend::KeyboardInitializeParameters initialize_parameters, + SubmitNormalCallback submit_normal_callback_, + SubmitInlineCallback submit_inline_callback_) override; void ShowNormalKeyboard() const override; @@ -279,8 +277,6 @@ private: void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type, std::u16string submitted_text, s32 cursor_position) const; - mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)> - submit_normal_callback; - mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)> - submit_inline_callback; + mutable SubmitNormalCallback submit_normal_callback; + mutable SubmitInlineCallback submit_inline_callback; }; diff --git a/src/yuzu/applets/qt_web_browser.cpp b/src/yuzu/applets/qt_web_browser.cpp index 89bd482e0..0a5912326 100644 --- a/src/yuzu/applets/qt_web_browser.cpp +++ b/src/yuzu/applets/qt_web_browser.cpp @@ -401,9 +401,9 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) { QtWebBrowser::~QtWebBrowser() = default; -void QtWebBrowser::OpenLocalWebPage( - const std::string& local_url, std::function<void()> extract_romfs_callback_, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { +void QtWebBrowser::OpenLocalWebPage(const std::string& local_url, + ExtractROMFSCallback extract_romfs_callback_, + OpenWebPageCallback callback_) const { extract_romfs_callback = std::move(extract_romfs_callback_); callback = std::move(callback_); @@ -416,9 +416,8 @@ void QtWebBrowser::OpenLocalWebPage( } } -void QtWebBrowser::OpenExternalWebPage( - const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const { +void QtWebBrowser::OpenExternalWebPage(const std::string& external_url, + OpenWebPageCallback callback_) const { callback = std::move(callback_); const auto index = external_url.find('?'); diff --git a/src/yuzu/applets/qt_web_browser.h b/src/yuzu/applets/qt_web_browser.h index 043800853..e8fe511ed 100644 --- a/src/yuzu/applets/qt_web_browser.h +++ b/src/yuzu/applets/qt_web_browser.h @@ -197,13 +197,11 @@ public: ~QtWebBrowser() override; void OpenLocalWebPage(const std::string& local_url, - std::function<void()> extract_romfs_callback_, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback_) const override; + ExtractROMFSCallback extract_romfs_callback_, + OpenWebPageCallback callback_) const override; void OpenExternalWebPage(const std::string& external_url, - std::function<void(Service::AM::Applets::WebExitReason, std::string)> - callback_) const override; + OpenWebPageCallback callback_) const override; signals: void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args, @@ -215,7 +213,6 @@ private: void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason, std::string last_url); - mutable std::function<void()> extract_romfs_callback; - - mutable std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback; + mutable ExtractROMFSCallback extract_romfs_callback; + mutable OpenWebPageCallback callback; }; |