From 41eda5b0193eb0789dd0c37f2e7ccf7c18431477 Mon Sep 17 00:00:00 2001 From: Valentin Vanelslande Date: Tue, 16 Oct 2018 16:10:54 -0500 Subject: [PATCH] Minor swkbd changes --- src/citra_qt/applets/swkbd.cpp | 12 ++++++------ src/core/frontend/applets/swkbd.h | 10 +++++----- src/core/hle/applets/swkbd.cpp | 6 +++--- src/core/hle/applets/swkbd.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/citra_qt/applets/swkbd.cpp b/src/citra_qt/applets/swkbd.cpp index cff1f1fac..8e4f21136 100644 --- a/src/citra_qt/applets/swkbd.cpp +++ b/src/citra_qt/applets/swkbd.cpp @@ -36,31 +36,31 @@ QtKeyboardDialog::QtKeyboardDialog(QWidget* parent, QtKeyboard* keyboard_) switch (config.button_config) { case ButtonConfig::Triple: buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[2]) + ? QString::fromStdString(config.buttons_text[2]) : tr(AppletButton::Ok), QDialogButtonBox::ButtonRole::AcceptRole); buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[1]) + ? QString::fromStdString(config.buttons_text[1]) : tr(AppletButton::IForgot), QDialogButtonBox::ButtonRole::HelpRole); buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[0]) + ? QString::fromStdString(config.buttons_text[0]) : tr(AppletButton::Cancel), QDialogButtonBox::ButtonRole::RejectRole); break; case ButtonConfig::Dual: buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[1]) + ? QString::fromStdString(config.buttons_text[1]) : tr(AppletButton::Ok), QDialogButtonBox::ButtonRole::AcceptRole); buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[0]) + ? QString::fromStdString(config.buttons_text[0]) : tr(AppletButton::Cancel), QDialogButtonBox::ButtonRole::RejectRole); break; case ButtonConfig::Single: buttons->addButton(config.has_custom_button_text - ? QString::fromStdString(config.button_text[0]) + ? QString::fromStdString(config.buttons_text[0]) : tr(AppletButton::Ok), QDialogButtonBox::ButtonRole::AcceptRole); break; diff --git a/src/core/frontend/applets/swkbd.h b/src/core/frontend/applets/swkbd.h index fff0b3409..202190103 100644 --- a/src/core/frontend/applets/swkbd.h +++ b/src/core/frontend/applets/swkbd.h @@ -29,17 +29,17 @@ enum class ButtonConfig { 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 struct KeyboardConfig { ButtonConfig button_config; 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 - u16 max_text_length; /// Maximum number of letters allowed if its a text input - u16 max_digits; /// Maximum number of numbers allowed if its a number 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 it's a number input std::string hint_text; /// Displayed in the field as a hint before - bool has_custom_button_text; /// If true, use the button_text instead - std::vector button_text; /// Contains the button text that the caller provides + bool has_custom_button_text; /// If true, buttons_text is used + std::vector buttons_text; /// Contains the buttons text that the caller provides struct Filters { bool prevent_digit; /// Disallow the use of more than a certain number of digits /// TODO: how many is a certain number diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index d13050002..165240aed 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -158,12 +158,12 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig( std::memcpy(buffer.data(), config.hint_text.data(), text_size * sizeof(u16)); frontend_config.hint_text = Common::UTF16ToUTF8(buffer); 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 x) { return std::all_of(x.begin(), x.end(), [](u16 x) { return x == 0; }); }); 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(); const auto text_end = std::find(text.begin(), text.end(), u'\0'); if (text_end != text.end()) @@ -171,7 +171,7 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig( buffer.resize(text_size); 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 = diff --git a/src/core/hle/applets/swkbd.h b/src/core/hle/applets/swkbd.h index 246d2f4c5..d2a73b906 100644 --- a/src/core/hle/applets/swkbd.h +++ b/src/core/hle/applets/swkbd.h @@ -132,7 +132,7 @@ struct SoftwareKeyboardConfig { u16_le max_text_length; u16_le dict_word_count; u16_le max_digits; - std::array, MAX_BUTTON> button_text; + std::array, MAX_BUTTON> buttons_text; std::array numpad_keys; std::array hint_text; ///< Text to display when asking the user for input