diff options
| author | 2021-05-27 23:22:38 -0400 | |
|---|---|---|
| committer | 2021-05-27 23:45:56 -0400 | |
| commit | c68255f70f2f91769a6b7d8bac4cbb1f80c4004b (patch) | |
| tree | 5fb7f851518d26ba5e559a80db7292bdf5ddc2f7 /src | |
| parent | applets/swkbd: Only read the text check message on Failure/Confirm (diff) | |
| download | yuzu-c68255f70f2f91769a6b7d8bac4cbb1f80c4004b.tar.gz yuzu-c68255f70f2f91769a6b7d8bac4cbb1f80c4004b.tar.xz yuzu-c68255f70f2f91769a6b7d8bac4cbb1f80c4004b.zip | |
applets/swkbd: Make use of std::move where applicable
Avoids redundant string copies
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/applets/software_keyboard.cpp | 16 | ||||
| -rw-r--r-- | src/yuzu/applets/software_keyboard.cpp | 25 |
2 files changed, 19 insertions, 22 deletions
diff --git a/src/core/hle/service/am/applets/software_keyboard.cpp b/src/core/hle/service/am/applets/software_keyboard.cpp index a1027a9ad..b1a81810b 100644 --- a/src/core/hle/service/am/applets/software_keyboard.cpp +++ b/src/core/hle/service/am/applets/software_keyboard.cpp | |||
| @@ -290,10 +290,10 @@ void SoftwareKeyboard::ProcessTextCheck() { | |||
| 290 | SubmitNormalOutputAndExit(SwkbdResult::Ok, current_text); | 290 | SubmitNormalOutputAndExit(SwkbdResult::Ok, current_text); |
| 291 | break; | 291 | break; |
| 292 | case SwkbdTextCheckResult::Failure: | 292 | case SwkbdTextCheckResult::Failure: |
| 293 | ShowTextCheckDialog(SwkbdTextCheckResult::Failure, text_check_message); | 293 | ShowTextCheckDialog(SwkbdTextCheckResult::Failure, std::move(text_check_message)); |
| 294 | break; | 294 | break; |
| 295 | case SwkbdTextCheckResult::Confirm: | 295 | case SwkbdTextCheckResult::Confirm: |
| 296 | ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, text_check_message); | 296 | ShowTextCheckDialog(SwkbdTextCheckResult::Confirm, std::move(text_check_message)); |
| 297 | break; | 297 | break; |
| 298 | case SwkbdTextCheckResult::Silent: | 298 | case SwkbdTextCheckResult::Silent: |
| 299 | default: | 299 | default: |
| @@ -487,7 +487,7 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() { | |||
| 487 | max_text_length <= 32 ? SwkbdTextDrawType::Line : SwkbdTextDrawType::Box; | 487 | max_text_length <= 32 ? SwkbdTextDrawType::Line : SwkbdTextDrawType::Box; |
| 488 | 488 | ||
| 489 | Core::Frontend::KeyboardInitializeParameters initialize_parameters{ | 489 | Core::Frontend::KeyboardInitializeParameters initialize_parameters{ |
| 490 | .ok_text{ok_text}, | 490 | .ok_text{std::move(ok_text)}, |
| 491 | .header_text{}, | 491 | .header_text{}, |
| 492 | .sub_text{}, | 492 | .sub_text{}, |
| 493 | .guide_text{}, | 493 | .guide_text{}, |
| @@ -563,10 +563,10 @@ void SoftwareKeyboard::InitializeFrontendKeyboard() { | |||
| 563 | : false; | 563 | : false; |
| 564 | 564 | ||
| 565 | Core::Frontend::KeyboardInitializeParameters initialize_parameters{ | 565 | Core::Frontend::KeyboardInitializeParameters initialize_parameters{ |
| 566 | .ok_text{ok_text}, | 566 | .ok_text{std::move(ok_text)}, |
| 567 | .header_text{header_text}, | 567 | .header_text{std::move(header_text)}, |
| 568 | .sub_text{sub_text}, | 568 | .sub_text{std::move(sub_text)}, |
| 569 | .guide_text{guide_text}, | 569 | .guide_text{std::move(guide_text)}, |
| 570 | .initial_text{initial_text}, | 570 | .initial_text{initial_text}, |
| 571 | .max_text_length{max_text_length}, | 571 | .max_text_length{max_text_length}, |
| 572 | .min_text_length{min_text_length}, | 572 | .min_text_length{min_text_length}, |
| @@ -595,7 +595,7 @@ void SoftwareKeyboard::ShowNormalKeyboard() { | |||
| 595 | 595 | ||
| 596 | void SoftwareKeyboard::ShowTextCheckDialog(SwkbdTextCheckResult text_check_result, | 596 | void SoftwareKeyboard::ShowTextCheckDialog(SwkbdTextCheckResult text_check_result, |
| 597 | std::u16string text_check_message) { | 597 | std::u16string text_check_message) { |
| 598 | frontend.ShowTextCheckDialog(text_check_result, text_check_message); | 598 | frontend.ShowTextCheckDialog(text_check_result, std::move(text_check_message)); |
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | void SoftwareKeyboard::ShowInlineKeyboard() { | 601 | void 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 { | |||
| 1563 | void QtSoftwareKeyboard::ShowTextCheckDialog( | 1560 | void 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 | ||
| 1569 | void QtSoftwareKeyboard::ShowInlineKeyboard( | 1566 | void QtSoftwareKeyboard::ShowInlineKeyboard( |