mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-30 09:40:06 +00:00
Minor swkbd changes
This commit is contained in:
parent
777b4c91cc
commit
41eda5b019
@ -36,31 +36,31 @@ QtKeyboardDialog::QtKeyboardDialog(QWidget* parent, QtKeyboard* keyboard_)
|
|||||||
switch (config.button_config) {
|
switch (config.button_config) {
|
||||||
case ButtonConfig::Triple:
|
case ButtonConfig::Triple:
|
||||||
buttons->addButton(config.has_custom_button_text
|
buttons->addButton(config.has_custom_button_text
|
||||||
? QString::fromStdString(config.button_text[2])
|
? QString::fromStdString(config.buttons_text[2])
|
||||||
: tr(AppletButton::Ok),
|
: tr(AppletButton::Ok),
|
||||||
QDialogButtonBox::ButtonRole::AcceptRole);
|
QDialogButtonBox::ButtonRole::AcceptRole);
|
||||||
buttons->addButton(config.has_custom_button_text
|
buttons->addButton(config.has_custom_button_text
|
||||||
? QString::fromStdString(config.button_text[1])
|
? QString::fromStdString(config.buttons_text[1])
|
||||||
: tr(AppletButton::IForgot),
|
: tr(AppletButton::IForgot),
|
||||||
QDialogButtonBox::ButtonRole::HelpRole);
|
QDialogButtonBox::ButtonRole::HelpRole);
|
||||||
buttons->addButton(config.has_custom_button_text
|
buttons->addButton(config.has_custom_button_text
|
||||||
? QString::fromStdString(config.button_text[0])
|
? QString::fromStdString(config.buttons_text[0])
|
||||||
: tr(AppletButton::Cancel),
|
: tr(AppletButton::Cancel),
|
||||||
QDialogButtonBox::ButtonRole::RejectRole);
|
QDialogButtonBox::ButtonRole::RejectRole);
|
||||||
break;
|
break;
|
||||||
case ButtonConfig::Dual:
|
case ButtonConfig::Dual:
|
||||||
buttons->addButton(config.has_custom_button_text
|
buttons->addButton(config.has_custom_button_text
|
||||||
? QString::fromStdString(config.button_text[1])
|
? QString::fromStdString(config.buttons_text[1])
|
||||||
: tr(AppletButton::Ok),
|
: tr(AppletButton::Ok),
|
||||||
QDialogButtonBox::ButtonRole::AcceptRole);
|
QDialogButtonBox::ButtonRole::AcceptRole);
|
||||||
buttons->addButton(config.has_custom_button_text
|
buttons->addButton(config.has_custom_button_text
|
||||||
? QString::fromStdString(config.button_text[0])
|
? QString::fromStdString(config.buttons_text[0])
|
||||||
: tr(AppletButton::Cancel),
|
: tr(AppletButton::Cancel),
|
||||||
QDialogButtonBox::ButtonRole::RejectRole);
|
QDialogButtonBox::ButtonRole::RejectRole);
|
||||||
break;
|
break;
|
||||||
case ButtonConfig::Single:
|
case ButtonConfig::Single:
|
||||||
buttons->addButton(config.has_custom_button_text
|
buttons->addButton(config.has_custom_button_text
|
||||||
? QString::fromStdString(config.button_text[0])
|
? QString::fromStdString(config.buttons_text[0])
|
||||||
: tr(AppletButton::Ok),
|
: tr(AppletButton::Ok),
|
||||||
QDialogButtonBox::ButtonRole::AcceptRole);
|
QDialogButtonBox::ButtonRole::AcceptRole);
|
||||||
break;
|
break;
|
||||||
|
@ -29,17 +29,17 @@ enum class ButtonConfig {
|
|||||||
None, /// No button (returned by swkbdInputText in special cases)
|
None, /// No button (returned by swkbdInputText in special cases)
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Configuration thats relevent to frontend implementation of applets. Anything missing that we
|
/// Configuration that's relevant to frontend implementation of applet. Anything missing that we
|
||||||
/// later learn is needed can be added here and filled in by the backend HLE applet
|
/// later learn is needed can be added here and filled in by the backend HLE applet
|
||||||
struct KeyboardConfig {
|
struct KeyboardConfig {
|
||||||
ButtonConfig button_config;
|
ButtonConfig button_config;
|
||||||
AcceptedInput accept_mode; /// What kinds of input are accepted (blank/empty/fixed width)
|
AcceptedInput accept_mode; /// What kinds of input are accepted (blank/empty/fixed width)
|
||||||
bool multiline_mode; /// True if the keyboard accepts multiple lines of input
|
bool multiline_mode; /// True if the keyboard accepts multiple lines of input
|
||||||
u16 max_text_length; /// Maximum number of letters allowed if its a text input
|
u16 max_text_length; /// Maximum number of letters allowed if it's a text input
|
||||||
u16 max_digits; /// Maximum number of numbers allowed if its a number input
|
u16 max_digits; /// Maximum number of numbers allowed if it's a number input
|
||||||
std::string hint_text; /// Displayed in the field as a hint before
|
std::string hint_text; /// Displayed in the field as a hint before
|
||||||
bool has_custom_button_text; /// If true, use the button_text instead
|
bool has_custom_button_text; /// If true, buttons_text is used
|
||||||
std::vector<std::string> button_text; /// Contains the button text that the caller provides
|
std::vector<std::string> buttons_text; /// Contains the buttons text that the caller provides
|
||||||
struct Filters {
|
struct Filters {
|
||||||
bool prevent_digit; /// Disallow the use of more than a certain number of digits
|
bool prevent_digit; /// Disallow the use of more than a certain number of digits
|
||||||
/// TODO: how many is a certain number
|
/// TODO: how many is a certain number
|
||||||
|
@ -158,12 +158,12 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(
|
|||||||
std::memcpy(buffer.data(), config.hint_text.data(), text_size * sizeof(u16));
|
std::memcpy(buffer.data(), config.hint_text.data(), text_size * sizeof(u16));
|
||||||
frontend_config.hint_text = Common::UTF16ToUTF8(buffer);
|
frontend_config.hint_text = Common::UTF16ToUTF8(buffer);
|
||||||
frontend_config.has_custom_button_text =
|
frontend_config.has_custom_button_text =
|
||||||
!std::all_of(config.button_text.begin(), config.button_text.end(),
|
!std::all_of(config.buttons_text.begin(), config.buttons_text.end(),
|
||||||
[](std::array<u16, HLE::Applets::MAX_BUTTON_TEXT_LEN + 1> x) {
|
[](std::array<u16, HLE::Applets::MAX_BUTTON_TEXT_LEN + 1> x) {
|
||||||
return std::all_of(x.begin(), x.end(), [](u16 x) { return x == 0; });
|
return std::all_of(x.begin(), x.end(), [](u16 x) { return x == 0; });
|
||||||
});
|
});
|
||||||
if (frontend_config.has_custom_button_text) {
|
if (frontend_config.has_custom_button_text) {
|
||||||
for (const auto& text : config.button_text) {
|
for (const auto& text : config.buttons_text) {
|
||||||
text_size = text.size();
|
text_size = text.size();
|
||||||
const auto text_end = std::find(text.begin(), text.end(), u'\0');
|
const auto text_end = std::find(text.begin(), text.end(), u'\0');
|
||||||
if (text_end != text.end())
|
if (text_end != text.end())
|
||||||
@ -171,7 +171,7 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(
|
|||||||
|
|
||||||
buffer.resize(text_size);
|
buffer.resize(text_size);
|
||||||
std::memcpy(buffer.data(), text.data(), text_size * sizeof(u16));
|
std::memcpy(buffer.data(), text.data(), text_size * sizeof(u16));
|
||||||
frontend_config.button_text.push_back(Common::UTF16ToUTF8(buffer));
|
frontend_config.buttons_text.push_back(Common::UTF16ToUTF8(buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frontend_config.filters.prevent_digit =
|
frontend_config.filters.prevent_digit =
|
||||||
|
@ -132,7 +132,7 @@ struct SoftwareKeyboardConfig {
|
|||||||
u16_le max_text_length;
|
u16_le max_text_length;
|
||||||
u16_le dict_word_count;
|
u16_le dict_word_count;
|
||||||
u16_le max_digits;
|
u16_le max_digits;
|
||||||
std::array<std::array<u16_le, MAX_BUTTON_TEXT_LEN + 1>, MAX_BUTTON> button_text;
|
std::array<std::array<u16_le, MAX_BUTTON_TEXT_LEN + 1>, MAX_BUTTON> buttons_text;
|
||||||
std::array<u16_le, 2> numpad_keys;
|
std::array<u16_le, 2> numpad_keys;
|
||||||
std::array<u16_le, MAX_HINT_TEXT_LEN + 1>
|
std::array<u16_le, MAX_HINT_TEXT_LEN + 1>
|
||||||
hint_text; ///< Text to display when asking the user for input
|
hint_text; ///< Text to display when asking the user for input
|
||||||
|
Loading…
Reference in New Issue
Block a user