summaryrefslogtreecommitdiff
path: root/src/yuzu/applets/software_keyboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/applets/software_keyboard.cpp')
-rw-r--r--src/yuzu/applets/software_keyboard.cpp43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp
index b0f764994..aa453a79f 100644
--- a/src/yuzu/applets/software_keyboard.cpp
+++ b/src/yuzu/applets/software_keyboard.cpp
@@ -720,21 +720,9 @@ void QtSoftwareKeyboardDialog::SetTextDrawType() {
ui->line_edit_osk->setFocus();
});
- connect(ui->line_edit_osk, &QLineEdit::returnPressed, [this] {
- switch (bottom_osk_index) {
- case BottomOSKIndex::LowerCase:
- ui->button_ok->click();
- break;
- case BottomOSKIndex::UpperCase:
- ui->button_ok_shift->click();
- break;
- case BottomOSKIndex::NumberPad:
- ui->button_ok_num->click();
- break;
- default:
- break;
- }
- });
+ connect(
+ ui->line_edit_osk, &QLineEdit::returnPressed, this,
+ [this] { TranslateButtonPress(HIDButton::Plus); }, Qt::QueuedConnection);
ui->line_edit_osk->setPlaceholderText(
QString::fromStdU16String(initialize_parameters.guide_text));
@@ -1113,12 +1101,11 @@ void QtSoftwareKeyboardDialog::NormalKeyboardButtonClicked(QPushButton* button)
}
if (button == ui->button_ok || button == ui->button_ok_shift || button == ui->button_ok_num) {
- if (ui->topOSK->currentIndex() == 1) {
- emit SubmitNormalText(SwkbdResult::Ok,
- ui->text_edit_osk->toPlainText().toStdU16String());
- } else {
- emit SubmitNormalText(SwkbdResult::Ok, ui->line_edit_osk->text().toStdU16String());
- }
+ auto text = ui->topOSK->currentIndex() == 1
+ ? ui->text_edit_osk->toPlainText().toStdU16String()
+ : ui->line_edit_osk->text().toStdU16String();
+
+ emit SubmitNormalText(SwkbdResult::Ok, std::move(text));
return;
}
@@ -1277,13 +1264,11 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(HIDButton button) {
if (is_inline) {
emit SubmitInlineText(SwkbdReplyType::DecidedCancel, current_text, cursor_position);
} else {
- if (ui->topOSK->currentIndex() == 1) {
- emit SubmitNormalText(SwkbdResult::Cancel,
- ui->text_edit_osk->toPlainText().toStdU16String());
- } else {
- emit SubmitNormalText(SwkbdResult::Cancel,
- ui->line_edit_osk->text().toStdU16String());
- }
+ auto text = ui->topOSK->currentIndex() == 1
+ ? ui->text_edit_osk->toPlainText().toStdU16String()
+ : ui->line_edit_osk->text().toStdU16String();
+
+ emit SubmitNormalText(SwkbdResult::Cancel, std::move(text));
}
break;
case HIDButton::Y:
@@ -1575,7 +1560,7 @@ void QtSoftwareKeyboard::ShowNormalKeyboard() const {
void QtSoftwareKeyboard::ShowTextCheckDialog(
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
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(