mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-08-23 16:17:18 +02: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(
|
void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
|
||||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
|
||||||
submit_normal_callback_,
|
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) {
|
|
||||||
if (is_inline) {
|
if (is_inline) {
|
||||||
LOG_WARNING(
|
LOG_WARNING(
|
||||||
Service_AM,
|
Service_AM,
|
||||||
|
@ -54,14 +54,17 @@ struct InlineTextParameters {
|
|||||||
|
|
||||||
class SoftwareKeyboardApplet {
|
class SoftwareKeyboardApplet {
|
||||||
public:
|
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 ~SoftwareKeyboardApplet();
|
||||||
|
|
||||||
virtual void InitializeKeyboard(
|
virtual void InitializeKeyboard(bool is_inline,
|
||||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_,
|
||||||
submit_normal_callback_,
|
SubmitInlineCallback submit_inline_callback_) = 0;
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) = 0;
|
|
||||||
|
|
||||||
virtual void ShowNormalKeyboard() const = 0;
|
virtual void ShowNormalKeyboard() const = 0;
|
||||||
|
|
||||||
@ -81,12 +84,9 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
|
|||||||
public:
|
public:
|
||||||
~DefaultSoftwareKeyboardApplet() override;
|
~DefaultSoftwareKeyboardApplet() override;
|
||||||
|
|
||||||
void InitializeKeyboard(
|
void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
SubmitNormalCallback submit_normal_callback_,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitInlineCallback submit_inline_callback_) override;
|
||||||
submit_normal_callback_,
|
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) override;
|
|
||||||
|
|
||||||
void ShowNormalKeyboard() const override;
|
void ShowNormalKeyboard() const override;
|
||||||
|
|
||||||
@ -105,12 +105,10 @@ private:
|
|||||||
void SubmitNormalText(std::u16string text) const;
|
void SubmitNormalText(std::u16string text) const;
|
||||||
void SubmitInlineText(std::u16string_view text) const;
|
void SubmitInlineText(std::u16string_view text) const;
|
||||||
|
|
||||||
KeyboardInitializeParameters parameters;
|
KeyboardInitializeParameters parameters{};
|
||||||
|
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
mutable SubmitNormalCallback submit_normal_callback;
|
||||||
submit_normal_callback;
|
mutable SubmitInlineCallback submit_inline_callback;
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
@ -1566,10 +1566,7 @@ QtSoftwareKeyboard::~QtSoftwareKeyboard() = default;
|
|||||||
|
|
||||||
void QtSoftwareKeyboard::InitializeKeyboard(
|
void QtSoftwareKeyboard::InitializeKeyboard(
|
||||||
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
|
||||||
submit_normal_callback_,
|
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) {
|
|
||||||
if (is_inline) {
|
if (is_inline) {
|
||||||
submit_inline_callback = std::move(submit_inline_callback_);
|
submit_inline_callback = std::move(submit_inline_callback_);
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,12 +233,10 @@ public:
|
|||||||
explicit QtSoftwareKeyboard(GMainWindow& parent);
|
explicit QtSoftwareKeyboard(GMainWindow& parent);
|
||||||
~QtSoftwareKeyboard() override;
|
~QtSoftwareKeyboard() override;
|
||||||
|
|
||||||
void InitializeKeyboard(
|
void InitializeKeyboard(bool is_inline,
|
||||||
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_,
|
||||||
submit_normal_callback_,
|
SubmitInlineCallback submit_inline_callback_) override;
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) override;
|
|
||||||
|
|
||||||
void ShowNormalKeyboard() const override;
|
void ShowNormalKeyboard() const override;
|
||||||
|
|
||||||
@ -279,8 +277,6 @@ private:
|
|||||||
void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
||||||
std::u16string submitted_text, s32 cursor_position) const;
|
std::u16string submitted_text, s32 cursor_position) const;
|
||||||
|
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
mutable SubmitNormalCallback submit_normal_callback;
|
||||||
submit_normal_callback;
|
mutable SubmitInlineCallback submit_inline_callback;
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback;
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user