summaryrefslogtreecommitdiffstats
path: root/src/core/frontend
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-11-20 17:24:11 +0100
committerGitHub <noreply@github.com>2018-11-20 17:24:11 +0100
commitb6d2c64f4dcb01f1ffc99f9a057910ec65c6a401 (patch)
treeb75fde22327ac851821d58078614e62cc1c29916 /src/core/frontend
parentMerge pull request #1739 from lioncash/lm (diff)
parentsoftware_keyboard: Fix erroneous extra PushNormalData (diff)
downloadyuzu-b6d2c64f4dcb01f1ffc99f9a057910ec65c6a401.tar
yuzu-b6d2c64f4dcb01f1ffc99f9a057910ec65c6a401.tar.gz
yuzu-b6d2c64f4dcb01f1ffc99f9a057910ec65c6a401.tar.bz2
yuzu-b6d2c64f4dcb01f1ffc99f9a057910ec65c6a401.tar.lz
yuzu-b6d2c64f4dcb01f1ffc99f9a057910ec65c6a401.tar.xz
yuzu-b6d2c64f4dcb01f1ffc99f9a057910ec65c6a401.tar.zst
yuzu-b6d2c64f4dcb01f1ffc99f9a057910ec65c6a401.zip
Diffstat (limited to 'src/core/frontend')
-rw-r--r--src/core/frontend/applets/software_keyboard.cpp29
-rw-r--r--src/core/frontend/applets/software_keyboard.h54
2 files changed, 83 insertions, 0 deletions
diff --git a/src/core/frontend/applets/software_keyboard.cpp b/src/core/frontend/applets/software_keyboard.cpp
new file mode 100644
index 000000000..856ed33da
--- /dev/null
+++ b/src/core/frontend/applets/software_keyboard.cpp
@@ -0,0 +1,29 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/logging/backend.h"
+#include "common/string_util.h"
+#include "core/frontend/applets/software_keyboard.h"
+
+namespace Core::Frontend {
+SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default;
+
+void DefaultSoftwareKeyboardApplet::RequestText(
+ std::function<void(std::optional<std::u16string>)> out,
+ SoftwareKeyboardParameters parameters) const {
+ if (parameters.initial_text.empty())
+ out(u"yuzu");
+
+ out(parameters.initial_text);
+}
+
+void DefaultSoftwareKeyboardApplet::SendTextCheckDialog(
+ std::u16string error_message, std::function<void()> finished_check) const {
+ LOG_WARNING(Service_AM,
+ "(STUBBED) called - Default fallback software keyboard does not support text "
+ "check! (error_message={})",
+ Common::UTF16ToUTF8(error_message));
+ finished_check();
+}
+} // namespace Core::Frontend
diff --git a/src/core/frontend/applets/software_keyboard.h b/src/core/frontend/applets/software_keyboard.h
new file mode 100644
index 000000000..f9b202664
--- /dev/null
+++ b/src/core/frontend/applets/software_keyboard.h
@@ -0,0 +1,54 @@
+// Copyright 2018 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <functional>
+#include <optional>
+#include <string>
+#include "common/bit_field.h"
+#include "common/common_types.h"
+
+namespace Core::Frontend {
+struct SoftwareKeyboardParameters {
+ std::u16string submit_text;
+ std::u16string header_text;
+ std::u16string sub_text;
+ std::u16string guide_text;
+ std::u16string initial_text;
+ std::size_t max_length;
+ bool password;
+ bool cursor_at_beginning;
+
+ union {
+ u8 value;
+
+ BitField<1, 1, u8> disable_space;
+ BitField<2, 1, u8> disable_address;
+ BitField<3, 1, u8> disable_percent;
+ BitField<4, 1, u8> disable_slash;
+ BitField<6, 1, u8> disable_number;
+ BitField<7, 1, u8> disable_download_code;
+ };
+};
+
+class SoftwareKeyboardApplet {
+public:
+ virtual ~SoftwareKeyboardApplet();
+
+ virtual void RequestText(std::function<void(std::optional<std::u16string>)> out,
+ SoftwareKeyboardParameters parameters) const = 0;
+ virtual void SendTextCheckDialog(std::u16string error_message,
+ std::function<void()> finished_check) const = 0;
+};
+
+class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
+public:
+ void RequestText(std::function<void(std::optional<std::u16string>)> out,
+ SoftwareKeyboardParameters parameters) const override;
+ void SendTextCheckDialog(std::u16string error_message,
+ std::function<void()> finished_check) const override;
+};
+
+} // namespace Core::Frontend