From dfb9fa0144ca79e596f6f2b1bc960b1a44745aa6 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 31 Dec 2023 09:40:32 -0500 Subject: am: re-namespace frontend applets to frontend directory --- src/core/frontend/applets/general.cpp | 59 +++++++++++++++++++++++ src/core/frontend/applets/general.h | 63 +++++++++++++++++++++++++ src/core/frontend/applets/general_frontend.cpp | 59 ----------------------- src/core/frontend/applets/general_frontend.h | 63 ------------------------- src/core/frontend/applets/profile_select.h | 8 ++-- src/core/frontend/applets/software_keyboard.cpp | 12 ++--- src/core/frontend/applets/software_keyboard.h | 22 ++++----- src/core/frontend/applets/web_browser.cpp | 4 +- src/core/frontend/applets/web_browser.h | 4 +- 9 files changed, 147 insertions(+), 147 deletions(-) create mode 100644 src/core/frontend/applets/general.cpp create mode 100644 src/core/frontend/applets/general.h delete mode 100644 src/core/frontend/applets/general_frontend.cpp delete mode 100644 src/core/frontend/applets/general_frontend.h (limited to 'src/core/frontend') diff --git a/src/core/frontend/applets/general.cpp b/src/core/frontend/applets/general.cpp new file mode 100644 index 000000000..4c299ee9c --- /dev/null +++ b/src/core/frontend/applets/general.cpp @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "common/logging/log.h" +#include "core/frontend/applets/general.h" + +namespace Core::Frontend { + +ParentalControlsApplet::~ParentalControlsApplet() = default; + +DefaultParentalControlsApplet::~DefaultParentalControlsApplet() = default; + +void DefaultParentalControlsApplet::Close() const {} + +void DefaultParentalControlsApplet::VerifyPIN(std::function finished, + bool suspend_future_verification_temporarily) { + LOG_INFO(Service_AM, + "Application requested frontend to verify PIN (normal), " + "suspend_future_verification_temporarily={}, verifying as correct.", + suspend_future_verification_temporarily); + finished(true); +} + +void DefaultParentalControlsApplet::VerifyPINForSettings(std::function finished) { + LOG_INFO(Service_AM, + "Application requested frontend to verify PIN (settings), verifying as correct."); + finished(true); +} + +void DefaultParentalControlsApplet::RegisterPIN(std::function finished) { + LOG_INFO(Service_AM, "Application requested frontend to register new PIN"); + finished(); +} + +void DefaultParentalControlsApplet::ChangePIN(std::function finished) { + LOG_INFO(Service_AM, "Application requested frontend to change PIN to new value"); + finished(); +} + +PhotoViewerApplet::~PhotoViewerApplet() = default; + +DefaultPhotoViewerApplet::~DefaultPhotoViewerApplet() = default; + +void DefaultPhotoViewerApplet::Close() const {} + +void DefaultPhotoViewerApplet::ShowPhotosForApplication(u64 title_id, + std::function finished) const { + LOG_INFO(Service_AM, + "Application requested frontend to display stored photos for title_id={:016X}", + title_id); + finished(); +} + +void DefaultPhotoViewerApplet::ShowAllPhotos(std::function finished) const { + LOG_INFO(Service_AM, "Application requested frontend to display all stored photos."); + finished(); +} + +} // namespace Core::Frontend diff --git a/src/core/frontend/applets/general.h b/src/core/frontend/applets/general.h new file mode 100644 index 000000000..319838ac7 --- /dev/null +++ b/src/core/frontend/applets/general.h @@ -0,0 +1,63 @@ +// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include "common/common_types.h" + +#include "core/frontend/applets/applet.h" + +namespace Core::Frontend { + +class ParentalControlsApplet : public Applet { +public: + virtual ~ParentalControlsApplet(); + + // Prompts the user to enter a PIN and calls the callback with whether or not it matches the + // correct PIN. If the bool is passed, and the PIN was recently entered correctly, the frontend + // should not prompt and simply return true. + virtual void VerifyPIN(std::function finished, + bool suspend_future_verification_temporarily) = 0; + + // Prompts the user to enter a PIN and calls the callback for correctness. Frontends can + // optionally alert the user that this is to change parental controls settings. + virtual void VerifyPINForSettings(std::function finished) = 0; + + // Prompts the user to create a new PIN for pctl and stores it with the service. + virtual void RegisterPIN(std::function finished) = 0; + + // Prompts the user to verify the current PIN and then store a new one into pctl. + virtual void ChangePIN(std::function finished) = 0; +}; + +class DefaultParentalControlsApplet final : public ParentalControlsApplet { +public: + ~DefaultParentalControlsApplet() override; + + void Close() const override; + void VerifyPIN(std::function finished, + bool suspend_future_verification_temporarily) override; + void VerifyPINForSettings(std::function finished) override; + void RegisterPIN(std::function finished) override; + void ChangePIN(std::function finished) override; +}; + +class PhotoViewerApplet : public Applet { +public: + virtual ~PhotoViewerApplet(); + + virtual void ShowPhotosForApplication(u64 title_id, std::function finished) const = 0; + virtual void ShowAllPhotos(std::function finished) const = 0; +}; + +class DefaultPhotoViewerApplet final : public PhotoViewerApplet { +public: + ~DefaultPhotoViewerApplet() override; + + void Close() const override; + void ShowPhotosForApplication(u64 title_id, std::function finished) const override; + void ShowAllPhotos(std::function finished) const override; +}; + +} // namespace Core::Frontend diff --git a/src/core/frontend/applets/general_frontend.cpp b/src/core/frontend/applets/general_frontend.cpp deleted file mode 100644 index b4b213a31..000000000 --- a/src/core/frontend/applets/general_frontend.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "common/logging/log.h" -#include "core/frontend/applets/general_frontend.h" - -namespace Core::Frontend { - -ParentalControlsApplet::~ParentalControlsApplet() = default; - -DefaultParentalControlsApplet::~DefaultParentalControlsApplet() = default; - -void DefaultParentalControlsApplet::Close() const {} - -void DefaultParentalControlsApplet::VerifyPIN(std::function finished, - bool suspend_future_verification_temporarily) { - LOG_INFO(Service_AM, - "Application requested frontend to verify PIN (normal), " - "suspend_future_verification_temporarily={}, verifying as correct.", - suspend_future_verification_temporarily); - finished(true); -} - -void DefaultParentalControlsApplet::VerifyPINForSettings(std::function finished) { - LOG_INFO(Service_AM, - "Application requested frontend to verify PIN (settings), verifying as correct."); - finished(true); -} - -void DefaultParentalControlsApplet::RegisterPIN(std::function finished) { - LOG_INFO(Service_AM, "Application requested frontend to register new PIN"); - finished(); -} - -void DefaultParentalControlsApplet::ChangePIN(std::function finished) { - LOG_INFO(Service_AM, "Application requested frontend to change PIN to new value"); - finished(); -} - -PhotoViewerApplet::~PhotoViewerApplet() = default; - -DefaultPhotoViewerApplet::~DefaultPhotoViewerApplet() = default; - -void DefaultPhotoViewerApplet::Close() const {} - -void DefaultPhotoViewerApplet::ShowPhotosForApplication(u64 title_id, - std::function finished) const { - LOG_INFO(Service_AM, - "Application requested frontend to display stored photos for title_id={:016X}", - title_id); - finished(); -} - -void DefaultPhotoViewerApplet::ShowAllPhotos(std::function finished) const { - LOG_INFO(Service_AM, "Application requested frontend to display all stored photos."); - finished(); -} - -} // namespace Core::Frontend diff --git a/src/core/frontend/applets/general_frontend.h b/src/core/frontend/applets/general_frontend.h deleted file mode 100644 index 319838ac7..000000000 --- a/src/core/frontend/applets/general_frontend.h +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include -#include "common/common_types.h" - -#include "core/frontend/applets/applet.h" - -namespace Core::Frontend { - -class ParentalControlsApplet : public Applet { -public: - virtual ~ParentalControlsApplet(); - - // Prompts the user to enter a PIN and calls the callback with whether or not it matches the - // correct PIN. If the bool is passed, and the PIN was recently entered correctly, the frontend - // should not prompt and simply return true. - virtual void VerifyPIN(std::function finished, - bool suspend_future_verification_temporarily) = 0; - - // Prompts the user to enter a PIN and calls the callback for correctness. Frontends can - // optionally alert the user that this is to change parental controls settings. - virtual void VerifyPINForSettings(std::function finished) = 0; - - // Prompts the user to create a new PIN for pctl and stores it with the service. - virtual void RegisterPIN(std::function finished) = 0; - - // Prompts the user to verify the current PIN and then store a new one into pctl. - virtual void ChangePIN(std::function finished) = 0; -}; - -class DefaultParentalControlsApplet final : public ParentalControlsApplet { -public: - ~DefaultParentalControlsApplet() override; - - void Close() const override; - void VerifyPIN(std::function finished, - bool suspend_future_verification_temporarily) override; - void VerifyPINForSettings(std::function finished) override; - void RegisterPIN(std::function finished) override; - void ChangePIN(std::function finished) override; -}; - -class PhotoViewerApplet : public Applet { -public: - virtual ~PhotoViewerApplet(); - - virtual void ShowPhotosForApplication(u64 title_id, std::function finished) const = 0; - virtual void ShowAllPhotos(std::function finished) const = 0; -}; - -class DefaultPhotoViewerApplet final : public PhotoViewerApplet { -public: - ~DefaultPhotoViewerApplet() override; - - void Close() const override; - void ShowPhotosForApplication(u64 title_id, std::function finished) const override; - void ShowAllPhotos(std::function finished) const override; -}; - -} // namespace Core::Frontend diff --git a/src/core/frontend/applets/profile_select.h b/src/core/frontend/applets/profile_select.h index 92e2737ea..880b69ad6 100644 --- a/src/core/frontend/applets/profile_select.h +++ b/src/core/frontend/applets/profile_select.h @@ -8,15 +8,15 @@ #include "common/uuid.h" #include "core/frontend/applets/applet.h" -#include "core/hle/service/am/applets/applet_profile_select.h" +#include "core/hle/service/am/frontend/applet_profile_select.h" namespace Core::Frontend { struct ProfileSelectParameters { - Service::AM::Applets::UiMode mode; + Service::AM::Frontend::UiMode mode; std::array invalid_uid_list; - Service::AM::Applets::UiSettingsDisplayOptions display_options; - Service::AM::Applets::UserSelectionPurpose purpose; + Service::AM::Frontend::UiSettingsDisplayOptions display_options; + Service::AM::Frontend::UserSelectionPurpose purpose; }; class ProfileSelectApplet : public Applet { diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index 7655d215b..d00da8ac9 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp @@ -69,7 +69,7 @@ void DefaultSoftwareKeyboardApplet::ShowNormalKeyboard() const { } void DefaultSoftwareKeyboardApplet::ShowTextCheckDialog( - Service::AM::Applets::SwkbdTextCheckResult text_check_result, + Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const { LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to show the text check dialog."); } @@ -118,7 +118,7 @@ void DefaultSoftwareKeyboardApplet::InlineTextChanged(InlineTextParameters text_ "\ncursor_position={}", Common::UTF16ToUTF8(text_parameters.input_text), text_parameters.cursor_position); - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::ChangedString, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::ChangedString, text_parameters.input_text, text_parameters.cursor_position); } @@ -127,22 +127,22 @@ void DefaultSoftwareKeyboardApplet::ExitKeyboard() const { } void DefaultSoftwareKeyboardApplet::SubmitNormalText(std::u16string text) const { - submit_normal_callback(Service::AM::Applets::SwkbdResult::Ok, text, true); + submit_normal_callback(Service::AM::Frontend::SwkbdResult::Ok, text, true); } void DefaultSoftwareKeyboardApplet::SubmitInlineText(std::u16string_view text) const { std::this_thread::sleep_for(std::chrono::milliseconds(500)); for (std::size_t index = 0; index < text.size(); ++index) { - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::ChangedString, + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::ChangedString, std::u16string(text.data(), text.data() + index + 1), static_cast(index) + 1); std::this_thread::sleep_for(std::chrono::milliseconds(250)); } - submit_inline_callback(Service::AM::Applets::SwkbdReplyType::DecidedEnter, std::u16string(text), - static_cast(text.size())); + submit_inline_callback(Service::AM::Frontend::SwkbdReplyType::DecidedEnter, + std::u16string(text), static_cast(text.size())); } } // namespace Core::Frontend diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index 8ed96da24..a32a98e4c 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h @@ -8,7 +8,7 @@ #include "common/common_types.h" #include "core/frontend/applets/applet.h" -#include "core/hle/service/am/applets/applet_software_keyboard_types.h" +#include "core/hle/service/am/frontend/applet_software_keyboard_types.h" namespace Core::Frontend { @@ -23,10 +23,10 @@ struct KeyboardInitializeParameters { u32 max_text_length; u32 min_text_length; s32 initial_cursor_position; - Service::AM::Applets::SwkbdType type; - Service::AM::Applets::SwkbdPasswordMode password_mode; - Service::AM::Applets::SwkbdTextDrawType text_draw_type; - Service::AM::Applets::SwkbdKeyDisableFlags key_disable_flags; + Service::AM::Frontend::SwkbdType type; + Service::AM::Frontend::SwkbdPasswordMode password_mode; + Service::AM::Frontend::SwkbdTextDrawType text_draw_type; + Service::AM::Frontend::SwkbdKeyDisableFlags key_disable_flags; bool use_blur_background; bool enable_backspace_button; bool enable_return_button; @@ -40,8 +40,8 @@ struct InlineAppearParameters { f32 key_top_scale_y; f32 key_top_translate_x; f32 key_top_translate_y; - Service::AM::Applets::SwkbdType type; - Service::AM::Applets::SwkbdKeyDisableFlags key_disable_flags; + Service::AM::Frontend::SwkbdType type; + Service::AM::Frontend::SwkbdKeyDisableFlags key_disable_flags; bool key_top_as_floating; bool enable_backspace_button; bool enable_return_button; @@ -56,9 +56,9 @@ struct InlineTextParameters { class SoftwareKeyboardApplet : public Applet { public: using SubmitInlineCallback = - std::function; + std::function; using SubmitNormalCallback = - std::function; + std::function; virtual ~SoftwareKeyboardApplet(); @@ -69,7 +69,7 @@ public: virtual void ShowNormalKeyboard() const = 0; - virtual void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, + virtual void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const = 0; virtual void ShowInlineKeyboard(InlineAppearParameters appear_parameters) const = 0; @@ -93,7 +93,7 @@ public: void ShowNormalKeyboard() const override; - void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result, + void ShowTextCheckDialog(Service::AM::Frontend::SwkbdTextCheckResult text_check_result, std::u16string text_check_message) const override; void ShowInlineKeyboard(InlineAppearParameters appear_parameters) const override; diff --git a/src/core/frontend/applets/web_browser.cpp b/src/core/frontend/applets/web_browser.cpp index 6e703ef06..eca8d6d98 100644 --- a/src/core/frontend/applets/web_browser.cpp +++ b/src/core/frontend/applets/web_browser.cpp @@ -18,7 +18,7 @@ void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url, LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}", local_url); - callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); + callback(Service::AM::Frontend::WebExitReason::WindowClosed, "http://localhost/"); } void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url, @@ -26,7 +26,7 @@ void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_ur LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}", external_url); - callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/"); + callback(Service::AM::Frontend::WebExitReason::WindowClosed, "http://localhost/"); } } // namespace Core::Frontend diff --git a/src/core/frontend/applets/web_browser.h b/src/core/frontend/applets/web_browser.h index 178bbdd3f..b70856a22 100644 --- a/src/core/frontend/applets/web_browser.h +++ b/src/core/frontend/applets/web_browser.h @@ -6,7 +6,7 @@ #include #include "core/frontend/applets/applet.h" -#include "core/hle/service/am/applets/applet_web_browser_types.h" +#include "core/hle/service/am/frontend/applet_web_browser_types.h" namespace Core::Frontend { @@ -14,7 +14,7 @@ class WebBrowserApplet : public Applet { public: using ExtractROMFSCallback = std::function; using OpenWebPageCallback = - std::function; + std::function; virtual ~WebBrowserApplet(); -- cgit v1.2.3