mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-25 06:20:06 +00:00
applets/software_keyboard: Use aliases for callbacks
Deduplicates really long std::function declarations to make the interface nicer to read.
This commit is contained in:
parent
3b19f741bd
commit
9bbb77637e
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user