diff options
| author | 2018-11-11 16:39:25 -0500 | |
|---|---|---|
| committer | 2018-11-18 10:53:47 -0500 | |
| commit | e696ed1f4d20f28f8b26c637498962938df7d96f (patch) | |
| tree | 79222d795725ba7b19f0aa9326041e236f9a22d8 /src/core/frontend/applets | |
| parent | qt/main: Register Qt Software Keyboard frontend with AM (diff) | |
| download | yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar.gz yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.tar.xz yuzu-e696ed1f4d20f28f8b26c637498962938df7d96f.zip | |
am: Deglobalize software keyboard applet
Diffstat (limited to 'src/core/frontend/applets')
| -rw-r--r-- | src/core/frontend/applets/software_keyboard.cpp | 13 | ||||
| -rw-r--r-- | src/core/frontend/applets/software_keyboard.h | 54 |
2 files changed, 36 insertions, 31 deletions
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp index c1bacefef..41d81c293 100644 --- a/src/core/frontend/applets/software_keyboard.cpp +++ b/src/core/frontend/applets/software_keyboard.cpp | |||
| @@ -3,16 +3,19 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/logging/backend.h" | 5 | #include "common/logging/backend.h" |
| 6 | #include "common/string_util.h" | ||
| 7 | #include "core/frontend/applets/software_keyboard.h" | 6 | #include "core/frontend/applets/software_keyboard.h" |
| 8 | 7 | ||
| 9 | namespace Frontend { | 8 | namespace Core::Frontend { |
| 10 | bool DefaultSoftwareKeyboardApplet::GetText(Parameters parameters, std::u16string& text) { | 9 | SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default; |
| 10 | |||
| 11 | bool DefaultSoftwareKeyboardApplet::GetText(SoftwareKeyboardParameters parameters, | ||
| 12 | std::u16string& text) const { | ||
| 11 | if (parameters.initial_text.empty()) | 13 | if (parameters.initial_text.empty()) |
| 12 | text = Common::UTF8ToUTF16("yuzu"); | 14 | text = u"yuzu"; |
| 13 | else | 15 | else |
| 14 | text = parameters.initial_text; | 16 | text = parameters.initial_text; |
| 15 | 17 | ||
| 16 | return true; | 18 | return true; |
| 17 | } | 19 | } |
| 18 | } // namespace Frontend | 20 | |
| 21 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h index d368385d2..2ea9db889 100644 --- a/src/core/frontend/applets/software_keyboard.h +++ b/src/core/frontend/applets/software_keyboard.h | |||
| @@ -8,37 +8,39 @@ | |||
| 8 | #include "common/bit_field.h" | 8 | #include "common/bit_field.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace Frontend { | 11 | namespace Core::Frontend { |
| 12 | struct SoftwareKeyboardParameters { | ||
| 13 | std::u16string submit_text; | ||
| 14 | std::u16string header_text; | ||
| 15 | std::u16string sub_text; | ||
| 16 | std::u16string guide_text; | ||
| 17 | std::u16string initial_text; | ||
| 18 | std::size_t max_length; | ||
| 19 | bool password; | ||
| 20 | bool cursor_at_beginning; | ||
| 21 | |||
| 22 | union { | ||
| 23 | u8 value; | ||
| 24 | |||
| 25 | BitField<1, 1, u8> disable_space; | ||
| 26 | BitField<2, 1, u8> disable_address; | ||
| 27 | BitField<3, 1, u8> disable_percent; | ||
| 28 | BitField<4, 1, u8> disable_slash; | ||
| 29 | BitField<6, 1, u8> disable_number; | ||
| 30 | BitField<7, 1, u8> disable_download_code; | ||
| 31 | }; | ||
| 32 | }; | ||
| 33 | |||
| 12 | class SoftwareKeyboardApplet { | 34 | class SoftwareKeyboardApplet { |
| 13 | public: | 35 | public: |
| 14 | struct Parameters { | 36 | virtual ~SoftwareKeyboardApplet(); |
| 15 | std::u16string submit_text; | ||
| 16 | std::u16string header_text; | ||
| 17 | std::u16string sub_text; | ||
| 18 | std::u16string guide_text; | ||
| 19 | std::u16string initial_text; | ||
| 20 | std::size_t max_length; | ||
| 21 | bool password; | ||
| 22 | bool cursor_at_beginning; | ||
| 23 | |||
| 24 | union { | ||
| 25 | u8 value; | ||
| 26 | |||
| 27 | BitField<1, 1, u8> disable_space; | ||
| 28 | BitField<2, 1, u8> disable_address; | ||
| 29 | BitField<3, 1, u8> disable_percent; | ||
| 30 | BitField<4, 1, u8> disable_slash; | ||
| 31 | BitField<6, 1, u8> disable_number; | ||
| 32 | BitField<7, 1, u8> disable_download_code; | ||
| 33 | }; | ||
| 34 | }; | ||
| 35 | 37 | ||
| 36 | virtual bool GetText(Parameters parameters, std::u16string& text) = 0; | 38 | virtual bool GetText(SoftwareKeyboardParameters parameters, std::u16string& text) const = 0; |
| 37 | virtual ~SoftwareKeyboardApplet() = default; | ||
| 38 | }; | 39 | }; |
| 39 | 40 | ||
| 40 | class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { | 41 | class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet { |
| 41 | bool GetText(Parameters parameters, std::u16string& text) override; | 42 | public: |
| 43 | bool GetText(SoftwareKeyboardParameters parameters, std::u16string& text) const override; | ||
| 42 | }; | 44 | }; |
| 43 | 45 | ||
| 44 | } // namespace Frontend | 46 | } // namespace Core::Frontend |