diff options
| author | 2018-11-12 11:08:09 -0500 | |
|---|---|---|
| committer | 2018-11-18 10:53:47 -0500 | |
| commit | 8b433beff34c382e50334bb59c4f71394845558c (patch) | |
| tree | f52f432b2ee5f4ef3917c1c0e2fa052930d68f3a /src/core/frontend/applets | |
| parent | am: Allow applets to push multiple and different channels of data (diff) | |
| download | yuzu-8b433beff34c382e50334bb59c4f71394845558c.tar.gz yuzu-8b433beff34c382e50334bb59c4f71394845558c.tar.xz yuzu-8b433beff34c382e50334bb59c4f71394845558c.zip | |
software_keyboard: Make GetText asynchronous
a
Diffstat (limited to 'src/core/frontend/applets')
| -rw-r--r-- | src/core/frontend/applets/software_keyboard.cpp | 7 | ||||
| -rw-r--r-- | src/core/frontend/applets/software_keyboard.h | 7 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index 2445a980d..4105101b3 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp | |||
| @@ -9,12 +9,13 @@ | |||
| 9 | namespace Core::Frontend { | 9 | namespace Core::Frontend { |
| 10 | SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default; | 10 | SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default; |
| 11 | 11 | ||
| 12 | std::optional<std::u16string> DefaultSoftwareKeyboardApplet::GetText( | 12 | void DefaultSoftwareKeyboardApplet::RequestText( |
| 13 | std::function<void(std::optional<std::u16string>)> out, | ||
| 13 | SoftwareKeyboardParameters parameters) const { | 14 | SoftwareKeyboardParameters parameters) const { |
| 14 | if (parameters.initial_text.empty()) | 15 | if (parameters.initial_text.empty()) |
| 15 | return u"yuzu"; | 16 | out(u"yuzu"); |
| 16 | 17 | ||
| 17 | return parameters.initial_text; | 18 | out(parameters.initial_text); |
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | void DefaultSoftwareKeyboardApplet::SendTextCheckDialog(std::u16string error_message) const { | 21 | void DefaultSoftwareKeyboardApplet::SendTextCheckDialog(std::u16string error_message) const { |
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index 7387ee8d7..5420ea883 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <functional> | ||
| 7 | #include <optional> | 8 | #include <optional> |
| 8 | #include <string> | 9 | #include <string> |
| 9 | #include "common/bit_field.h" | 10 | #include "common/bit_field.h" |
| @@ -36,13 +37,15 @@ class SoftwareKeyboardApplet { | |||
| 36 | public: | 37 | public: |
| 37 | virtual ~SoftwareKeyboardApplet(); | 38 | virtual ~SoftwareKeyboardApplet(); |
| 38 | 39 | ||
| 39 | virtual std::optional<std::u16string> GetText(SoftwareKeyboardParameters parameters) const = 0; | 40 | virtual void RequestText(std::function<void(std::optional<std::u16string>)> out, |
| 41 | SoftwareKeyboardParameters parameters) const = 0; | ||
| 40 | virtual void SendTextCheckDialog(std::u16string error_message) const = 0; | 42 | virtual void SendTextCheckDialog(std::u16string error_message) const = 0; |
| 41 | }; | 43 | }; |
| 42 | 44 | ||
| 43 | class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { | 45 | class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { |
| 44 | public: | 46 | public: |
| 45 | std::optional<std::u16string> GetText(SoftwareKeyboardParameters parameters) const override; | 47 | void RequestText(std::function<void(std::optional<std::u16string>)> out, |
| 48 | SoftwareKeyboardParameters parameters) const override; | ||
| 46 | void SendTextCheckDialog(std::u16string error_message) const override; | 49 | void SendTextCheckDialog(std::u16string error_message) const override; |
| 47 | }; | 50 | }; |
| 48 | 51 | ||