mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-12-17 08:15:02 +00:00
Merge pull request #6374 from Morph1984/swkbd-textcheck-encoding
applets/swkbd: Only read the text check message on Failure/Confirm
This commit is contained in:
commit
2069430baa
|
@ -273,8 +273,13 @@ void SoftwareKeyboard::ProcessTextCheck() {
|
||||||
|
|
||||||
std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck));
|
std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck));
|
||||||
|
|
||||||
std::u16string text_check_message = Common::UTF16StringFromFixedZeroTerminatedBuffer(
|
std::u16string text_check_message =
|
||||||
swkbd_text_check.text_check_message.data(), swkbd_text_check.text_check_message.size());
|
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
|
||||||
|
swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm
|
||||||
|
? Common::UTF16StringFromFixedZeroTerminatedBuffer(
|
||||||
|
swkbd_text_check.text_check_message.data(),
|
||||||
|
swkbd_text_check.text_check_message.size())
|
||||||
|
: u"";
|
||||||
|
|
||||||
LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}",
|
LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}",
|
||||||
GetTextCheckResultName(swkbd_text_check.text_check_result),
|
GetTextCheckResultName(swkbd_text_check.text_check_result),
|
||||||
|
@ -285,10 +290,10 @@ void SoftwareKeyboard::ProcessTextCheck() {
|
||||||
SubmitNormalOutputAndExit(SwkbdResult::Ok, current_text);
|
SubmitNormalOutputAndExit(SwkbdResult::Ok, current_text);
|
||||||
break;
|
break;
|
||||||
case SwkbdTextCheckResult::Failure:
|
case SwkbdTextCheckResult::Failure:
|
||||||
ShowTextCheckDialog(SwkbdTextCheckResult::Failure, text_check_message);
|
ShowTextCheckDialog(SwkbdTextCheckResult::Failure, std::move(text_check_message));
|
||||||
break;
|
break;
|
||||||
case SwkbdTextCheckResult::Confirm:
|
case SwkbdTextCheckResult::Confirm:
|
||||||
ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, text_check_message);
|
ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, std::move(text_check_message));
|
||||||
break;
|
break;
|
||||||
case SwkbdTextCheckResult::Silent:
|
case SwkbdTextCheckResult::Silent:
|
||||||
default:
|
default:
|
||||||
|
@ -482,7 +487,7 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
|
||||||
max_text_length <= 32 ? SwkbdTextDrawType::Line : SwkbdTextDrawType::Box;
|
max_text_length <= 32 ? SwkbdTextDrawType::Line : SwkbdTextDrawType::Box;
|
||||||
|
|
||||||
Core::Frontend::KeyboardInitializeParameters initialize_parameters{
|
Core::Frontend::KeyboardInitializeParameters initialize_parameters{
|
||||||
.ok_text{ok_text},
|
.ok_text{std::move(ok_text)},
|
||||||
.header_text{},
|
.header_text{},
|
||||||
.sub_text{},
|
.sub_text{},
|
||||||
.guide_text{},
|
.guide_text{},
|
||||||
|
@ -558,10 +563,10 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
Core::Frontend::KeyboardInitializeParameters initialize_parameters{
|
Core::Frontend::KeyboardInitializeParameters initialize_parameters{
|
||||||
.ok_text{ok_text},
|
.ok_text{std::move(ok_text)},
|
||||||
.header_text{header_text},
|
.header_text{std::move(header_text)},
|
||||||
.sub_text{sub_text},
|
.sub_text{std::move(sub_text)},
|
||||||
.guide_text{guide_text},
|
.guide_text{std::move(guide_text)},
|
||||||
.initial_text{initial_text},
|
.initial_text{initial_text},
|
||||||
.max_text_length{max_text_length},
|
.max_text_length{max_text_length},
|
||||||
.min_text_length{min_text_length},
|
.min_text_length{min_text_length},
|
||||||
|
@ -590,7 +595,7 @@ void SoftwareKeyboard::ShowNormalKeyboard() {
|
||||||
|
|
||||||
void SoftwareKeyboard::ShowTextCheckDialog(SwkbdTextCheckResult text_check_result,
|
void SoftwareKeyboard::ShowTextCheckDialog(SwkbdTextCheckResult text_check_result,
|
||||||
std::u16string text_check_message) {
|
std::u16string text_check_message) {
|
||||||
frontend.ShowTextCheckDialog(text_check_result, text_check_message);
|
frontend.ShowTextCheckDialog(text_check_result, std::move(text_check_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoftwareKeyboard::ShowInlineKeyboard() {
|
void SoftwareKeyboard::ShowInlineKeyboard() {
|
||||||
|
|
|
@ -1101,12 +1101,11 @@ void QtSoftwareKeyboardDialog::NormalKeyboardButtonClicked(QPushButton* button)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (button == ui->button_ok || button == ui->button_ok_shift || button == ui->button_ok_num) {
|
if (button == ui->button_ok || button == ui->button_ok_shift || button == ui->button_ok_num) {
|
||||||
if (ui->topOSK->currentIndex() == 1) {
|
auto text = ui->topOSK->currentIndex() == 1
|
||||||
emit SubmitNormalText(SwkbdResult::Ok,
|
? ui->text_edit_osk->toPlainText().toStdU16String()
|
||||||
ui->text_edit_osk->toPlainText().toStdU16String());
|
: ui->line_edit_osk->text().toStdU16String();
|
||||||
} else {
|
|
||||||
emit SubmitNormalText(SwkbdResult::Ok, ui->line_edit_osk->text().toStdU16String());
|
emit SubmitNormalText(SwkbdResult::Ok, std::move(text));
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1265,13 +1264,11 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
|
||||||
if (is_inline) {
|
if (is_inline) {
|
||||||
emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position);
|
emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position);
|
||||||
} else {
|
} else {
|
||||||
if (ui->topOSK->currentIndex() == 1) {
|
auto text = ui->topOSK->currentIndex() == 1
|
||||||
emit SubmitNormalText(SwkbdResult::Cancel,
|
? ui->text_edit_osk->toPlainText().toStdU16String()
|
||||||
ui->text_edit_osk->toPlainText().toStdU16String());
|
: ui->line_edit_osk->text().toStdU16String();
|
||||||
} else {
|
|
||||||
emit SubmitNormalText(SwkbdResult::Cancel,
|
emit SubmitNormalText(SwkbdResult::Cancel, std::move(text));
|
||||||
ui->line_edit_osk->text().toStdU16String());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HIDButton::Y:
|
case HIDButton::Y:
|
||||||
|
@ -1563,7 +1560,7 @@ void QtSoftwareKeyboard::ShowNormalKeyboard() const {
|
||||||
void QtSoftwareKeyboard::ShowTextCheckDialog(
|
void QtSoftwareKeyboard::ShowTextCheckDialog(
|
||||||
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
|
||||||
std::u16string text_check_message) const {
|
std::u16string text_check_message) const {
|
||||||
emit MainWindowShowTextCheckDialog(text_check_result, text_check_message);
|
emit MainWindowShowTextCheckDialog(text_check_result, std::move(text_check_message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtSoftwareKeyboard::ShowInlineKeyboard(
|
void QtSoftwareKeyboard::ShowInlineKeyboard(
|
||||||
|
|
Loading…
Reference in a new issue