1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

overlays: implement OSK password mode

This commit is contained in:
Megamouse 2021-04-12 19:28:39 +02:00
parent 088d22675b
commit bdc5ed094b
4 changed files with 12 additions and 3 deletions

View File

@ -1102,6 +1102,7 @@ namespace rsx
u16 vertical_scroll_offset = 0;
bool m_reset_caret_pulse = false;
bool password_mode = false;
std::u32string value;
std::u32string placeholder;

View File

@ -108,6 +108,10 @@ namespace rsx
{
overlay_element::set_unicode_text(placeholder);
}
else if (password_mode)
{
overlay_element::set_unicode_text(std::u32string(value.size(), U""[0]));
}
else
{
overlay_element::set_unicode_text(value);

View File

@ -260,6 +260,7 @@ namespace rsx
m_title.set_unicode_text(title);
m_title.back_color.a = 0.f;
m_preview.password_mode = m_password_mode;
m_preview.set_placeholder(get_placeholder());
m_preview.set_unicode_text(initial_text);
@ -814,8 +815,6 @@ namespace rsx
add_panel(osk_panel_password(shift_cb, layer_cb, space_cb, delete_cb, enter_cb));
// TODO: hide entered text with *
m_password_mode = true;
}
else if (panel_flag == CELL_OSKDIALOG_PANELMODE_DEFAULT || panel_flag == CELL_OSKDIALOG_PANELMODE_DEFAULT_NO_JAPANESE)

View File

@ -22,7 +22,7 @@ osk_dialog_frame::~osk_dialog_frame()
}
}
void osk_dialog_frame::Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 /*panel_flag*/, u32 /*first_view_panel*/)
void osk_dialog_frame::Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 /*first_view_panel*/)
{
state = OskDialogState::Open;
@ -63,6 +63,11 @@ void osk_dialog_frame::Create(const std::string& title, const std::u16string& me
input->setText(input_text);
input->setFocus();
if (panel_flag & CELL_OSKDIALOG_PANELMODE_PASSWORD)
{
input->setEchoMode(QLineEdit::Password); // Let's assume that games only use the password mode with single-line edit fields
}
if (prohibit_flags & CELL_OSKDIALOG_NO_SPACE)
{
input->setValidator(new QRegExpValidator(QRegExp("^\\S*$"), this));