summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/service/am/applets/software_keyboard.cpp25
-rw-r--r--src/yuzu/applets/software_keyboard.cpp25
2 files changed, 26 insertions, 24 deletions
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp
index b05a5da04..b1a81810b 100644
--- a/src/core/hle/service/am/applets/software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/software_keyboard.cpp
@@ -273,8 +273,13 @@ void SoftwareKeyboard::ProcessTextCheck() {
273 273
274 std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck)); 274 std::memcpy(&swkbd_text_check, text_check_data.data(), sizeof(SwkbdTextCheck));
275 275
276 std::u16string text_check_message = Common::UTF16StringFromFixedZeroTerminatedBuffer( 276 std::u16string text_check_message =
277 swkbd_text_check.text_check_message.data(), swkbd_text_check.text_check_message.size()); 277 swkbd_text_check.text_check_result == SwkbdTextCheckResult::Failure ||
278 swkbd_text_check.text_check_result == SwkbdTextCheckResult::Confirm
279 ? Common::UTF16StringFromFixedZeroTerminatedBuffer(
280 swkbd_text_check.text_check_message.data(),
281 swkbd_text_check.text_check_message.size())
282 : u"";
278 283
279 LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}", 284 LOG_INFO(Service_AM, "\nTextCheckResult: {}\nTextCheckMessage: {}",
280 GetTextCheckResultName(swkbd_text_check.text_check_result), 285 GetTextCheckResultName(swkbd_text_check.text_check_result),
@@ -285,10 +290,10 @@ void SoftwareKeyboard::ProcessTextCheck() {
285 SubmitNormalOutputAndExit(SwkbdResult::Ok, current_text); 290 SubmitNormalOutputAndExit(SwkbdResult::Ok, current_text);
286 break; 291 break;
287 case SwkbdTextCheckResult::Failure: 292 case SwkbdTextCheckResult::Failure:
288 ShowTextCheckDialog(SwkbdTextCheckResult::Failure, text_check_message); 293 ShowTextCheckDialog(SwkbdTextCheckResult::Failure, std::move(text_check_message));
289 break; 294 break;
290 case SwkbdTextCheckResult::Confirm: 295 case SwkbdTextCheckResult::Confirm:
291 ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, text_check_message); 296 ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, std::move(text_check_message));
292 break; 297 break;
293 case SwkbdTextCheckResult::Silent: 298 case SwkbdTextCheckResult::Silent:
294 default: 299 default:
@@ -482,7 +487,7 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
482 max_text_length <= 32 ? SwkbdTextDrawType::Line : SwkbdTextDrawType::Box; 487 max_text_length <= 32 ? SwkbdTextDrawType::Line : SwkbdTextDrawType::Box;
483 488
484 Core::Frontend::KeyboardInitializeParameters initialize_parameters{ 489 Core::Frontend::KeyboardInitializeParameters initialize_parameters{
485 .ok_text{ok_text}, 490 .ok_text{std::move(ok_text)},
486 .header_text{}, 491 .header_text{},
487 .sub_text{}, 492 .sub_text{},
488 .guide_text{}, 493 .guide_text{},
@@ -558,10 +563,10 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() {
558 : false; 563 : false;
559 564
560 Core::Frontend::KeyboardInitializeParameters initialize_parameters{ 565 Core::Frontend::KeyboardInitializeParameters initialize_parameters{
561 .ok_text{ok_text}, 566 .ok_text{std::move(ok_text)},
562 .header_text{header_text}, 567 .header_text{std::move(header_text)},
563 .sub_text{sub_text}, 568 .sub_text{std::move(sub_text)},
564 .guide_text{guide_text}, 569 .guide_text{std::move(guide_text)},
565 .initial_text{initial_text}, 570 .initial_text{initial_text},
566 .max_text_length{max_text_length}, 571 .max_text_length{max_text_length},
567 .min_text_length{min_text_length}, 572 .min_text_length{min_text_length},
@@ -590,7 +595,7 @@ void SoftwareKeyboard::ShowNormalKeyboard() {
590 595
591void SoftwareKeyboard::ShowTextCheckDialog(SwkbdTextCheckResult text_check_result, 596void SoftwareKeyboard::ShowTextCheckDialog(SwkbdTextCheckResult text_check_result,
592 std::u16string text_check_message) { 597 std::u16string text_check_message) {
593 frontend.ShowTextCheckDialog(text_check_result, text_check_message); 598 frontend.ShowTextCheckDialog(text_check_result, std::move(text_check_message));
594} 599}
595 600
596void SoftwareKeyboard::ShowInlineKeyboard() { 601void SoftwareKeyboard::ShowInlineKeyboard() {
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp
index a9a095d58..aa453a79f 100644
--- a/src/yuzu/applets/software_keyboard.cpp
+++ b/src/yuzu/applets/software_keyboard.cpp
@@ -1101,12 +1101,11 @@ void QtSoftwareKeyboardDialog::NormalKeyboardButtonClicked(QPushButton* button)
1101 } 1101 }
1102 1102
1103 if (button == ui->button_ok || button == ui->button_ok_shift || button == ui->button_ok_num) { 1103 if (button == ui->button_ok || button == ui->button_ok_shift || button == ui->button_ok_num) {
1104 if (ui->topOSK->currentIndex() == 1) { 1104 auto text = ui->topOSK->currentIndex() == 1
1105 emit SubmitNormalText(SwkbdResult::Ok, 1105 ? ui->text_edit_osk->toPlainText().toStdU16String()
1106 ui->text_edit_osk->toPlainText().toStdU16String()); 1106 : ui->line_edit_osk->text().toStdU16String();
1107 } else { 1107
1108 emit SubmitNormalText(SwkbdResult::Ok, ui->line_edit_osk->text().toStdU16String()); 1108 emit SubmitNormalText(SwkbdResult::Ok, std::move(text));
1109 }
1110 return; 1109 return;
1111 } 1110 }
1112 1111
@@ -1265,13 +1264,11 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
1265 if (is_inline) { 1264 if (is_inline) {
1266 emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position); 1265 emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position);
1267 } else { 1266 } else {
1268 if (ui->topOSK->currentIndex() == 1) { 1267 auto text = ui->topOSK->currentIndex() == 1
1269 emit SubmitNormalText(SwkbdResult::Cancel, 1268 ? ui->text_edit_osk->toPlainText().toStdU16String()
1270 ui->text_edit_osk->toPlainText().toStdU16String()); 1269 : ui->line_edit_osk->text().toStdU16String();
1271 } else { 1270
1272 emit SubmitNormalText(SwkbdResult::Cancel, 1271 emit SubmitNormalText(SwkbdResult::Cancel, std::move(text));
1273 ui->line_edit_osk->text().toStdU16String());
1274 }
1275 } 1272 }
1276 break; 1273 break;
1277 case HIDButton::Y: 1274 case HIDButton::Y:
@@ -1563,7 +1560,7 @@ void QtSoftwareKeyboard::ShowNormalKeyboard() const {
1563void QtSoftwareKeyboard::ShowTextCheckDialog( 1560void QtSoftwareKeyboard::ShowTextCheckDialog(
1564 Service::AM::Applets::SwkbdTextCheckResult text_check_result, 1561 Service::AM::Applets::SwkbdTextCheckResult text_check_result,
1565 std::u16string text_check_message) const { 1562 std::u16string text_check_message) const {
1566 emit MainWindowShowTextCheckDialog(text_check_result, text_check_message); 1563 emit MainWindowShowTextCheckDialog(text_check_result, std::move(text_check_message));
1567} 1564}
1568 1565
1569void QtSoftwareKeyboard::ShowInlineKeyboard( 1566void QtSoftwareKeyboard::ShowInlineKeyboard(