qt_software_keyboard: Address review feedback
Use auto and a more descriptive variable name. Secondly, fix some C++ misconceptions or constructing too many objects. Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com> Co-authored-by: Lioncash <mathew1800@gmail.com>
This commit is contained in:
parent
3ca3254b9f
commit
5035df27c3
|
@ -411,11 +411,11 @@ void QtSoftwareKeyboardDialog::ShowTextCheckDialog(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText()
|
const auto text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText()
|
||||||
: ui->line_edit_osk->text();
|
: ui->line_edit_osk->text();
|
||||||
std::u16string text_s = Common::U16StringFromBuffer(text.utf16(), text.size());
|
auto text_str = Common::U16StringFromBuffer(text.utf16(), text.size());
|
||||||
|
|
||||||
emit SubmitNormalText(SwkbdResult::Ok, std::move(text_s), true);
|
emit SubmitNormalText(SwkbdResult::Ok, std::move(text_str), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1119,11 +1119,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) {
|
||||||
const auto& text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText()
|
const auto text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText()
|
||||||
: ui->line_edit_osk->text();
|
: ui->line_edit_osk->text();
|
||||||
std::u16string text_s = Common::U16StringFromBuffer(text.utf16(), text.size());
|
auto text_str = Common::U16StringFromBuffer(text.utf16(), text.size());
|
||||||
|
|
||||||
emit SubmitNormalText(SwkbdResult::Ok, std::move(text_s));
|
emit SubmitNormalText(SwkbdResult::Ok, std::move(text_str));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1189,8 +1189,8 @@ void QtSoftwareKeyboardDialog::InlineKeyboardButtonClicked(QPushButton* button)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InlineTextInsertString(
|
const auto button_text = button->text();
|
||||||
Common::U16StringFromBuffer(button->text().utf16(), button->text().size()));
|
InlineTextInsertString(Common::U16StringFromBuffer(button_text.utf16(), button_text.size()));
|
||||||
|
|
||||||
// Revert the keyboard to lowercase if the shift key is active.
|
// Revert the keyboard to lowercase if the shift key is active.
|
||||||
if (bottom_osk_index == BottomOSKIndex::UpperCase && !caps_lock_enabled) {
|
if (bottom_osk_index == BottomOSKIndex::UpperCase && !caps_lock_enabled) {
|
||||||
|
@ -1283,11 +1283,11 @@ void QtSoftwareKeyboardDialog::TranslateButtonPress(Core::HID::NpadButton 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 {
|
||||||
const auto& text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText()
|
const auto text = ui->topOSK->currentIndex() == 1 ? ui->text_edit_osk->toPlainText()
|
||||||
: ui->line_edit_osk->text();
|
: ui->line_edit_osk->text();
|
||||||
std::u16string text_s = Common::U16StringFromBuffer(text.utf16(), text.size());
|
auto text_str = Common::U16StringFromBuffer(text.utf16(), text.size());
|
||||||
|
|
||||||
emit SubmitNormalText(SwkbdResult::Cancel, std::move(text_s));
|
emit SubmitNormalText(SwkbdResult::Cancel, std::move(text_str));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Core::HID::NpadButton::Y:
|
case Core::HID::NpadButton::Y:
|
||||||
|
|
Reference in New Issue