Use fixed indices for button order

Apps always return 3 strings, even if there is no custom text, so the index should be constant for each button.
This commit is contained in:
SutandoTsukai181 2020-05-24 21:45:23 +03:00
parent 1255d94baa
commit 9ed6762c59
2 changed files with 3 additions and 4 deletions

View file

@ -49,7 +49,7 @@ QtKeyboardDialog::QtKeyboardDialog(QWidget* parent, QtKeyboard* keyboard_)
break; break;
case ButtonConfig::Dual: case ButtonConfig::Dual:
buttons->addButton(config.has_custom_button_text buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[1]) ? QString::fromStdString(config.button_text[2])
: tr(SWKBD_BUTTON_OKAY), : tr(SWKBD_BUTTON_OKAY),
QDialogButtonBox::ButtonRole::AcceptRole); QDialogButtonBox::ButtonRole::AcceptRole);
buttons->addButton(config.has_custom_button_text buttons->addButton(config.has_custom_button_text
@ -59,7 +59,7 @@ QtKeyboardDialog::QtKeyboardDialog(QWidget* parent, QtKeyboard* keyboard_)
break; break;
case ButtonConfig::Single: case ButtonConfig::Single:
buttons->addButton(config.has_custom_button_text buttons->addButton(config.has_custom_button_text
? QString::fromStdString(config.button_text[0]) ? QString::fromStdString(config.button_text[2])
: tr(SWKBD_BUTTON_OKAY), : tr(SWKBD_BUTTON_OKAY),
QDialogButtonBox::ButtonRole::AcceptRole); QDialogButtonBox::ButtonRole::AcceptRole);
break; break;

View file

@ -201,7 +201,6 @@ Frontend::KeyboardConfig SoftwareKeyboard::ToFrontendConfig(
}); });
if (frontend_config.has_custom_button_text) { if (frontend_config.has_custom_button_text) {
for (const auto& text : config.button_text) { for (const auto& text : config.button_text) {
if (text.front() != 0)
frontend_config.button_text.push_back(Common::UTF16BufferToUTF8(text)); frontend_config.button_text.push_back(Common::UTF16BufferToUTF8(text));
} }
} }