am: Deglobalize software keyboard applet
This commit is contained in:
parent
a81645400f
commit
e696ed1f4d
17 changed files with 182 additions and 102 deletions
|
@ -3,16 +3,19 @@
|
|||
// 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 Frontend {
|
||||
bool DefaultSoftwareKeyboardApplet::GetText(Parameters parameters, std::u16string& text) {
|
||||
namespace Core::Frontend {
|
||||
SoftwareKeyboardApplet::~SoftwareKeyboardApplet() = default;
|
||||
|
||||
bool DefaultSoftwareKeyboardApplet::GetText(SoftwareKeyboardParameters parameters,
|
||||
std::u16string& text) const {
|
||||
if (parameters.initial_text.empty())
|
||||
text = Common::UTF8ToUTF16("yuzu");
|
||||
text = u"yuzu";
|
||||
else
|
||||
text = parameters.initial_text;
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace Frontend
|
||||
|
||||
} // namespace Core::Frontend
|
||||
|
|
|
@ -8,37 +8,39 @@
|
|||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Frontend {
|
||||
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:
|
||||
struct Parameters {
|
||||
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;
|
||||
virtual ~SoftwareKeyboardApplet();
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
virtual bool GetText(Parameters parameters, std::u16string& text) = 0;
|
||||
virtual ~SoftwareKeyboardApplet() = default;
|
||||
virtual bool GetText(SoftwareKeyboardParameters parameters, std::u16string& text) const = 0;
|
||||
};
|
||||
|
||||
class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
|
||||
bool GetText(Parameters parameters, std::u16string& text) override;
|
||||
public:
|
||||
bool GetText(SoftwareKeyboardParameters parameters, std::u16string& text) const override;
|
||||
};
|
||||
|
||||
} // namespace Frontend
|
||||
} // namespace Core::Frontend
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue