Qt: Fix saved language setting

This commit is contained in:
Connor McLaughlin 2022-07-22 23:47:12 +10:00
parent 6e5b9c8f33
commit 23ea7b92bc
4 changed files with 16 additions and 14 deletions

View file

@ -77,7 +77,7 @@
<item> <item>
<widget class="QPushButton" name="automaticBinding"> <widget class="QPushButton" name="automaticBinding">
<property name="text"> <property name="text">
<string>Automatic binding</string> <string>Automatic Mapping</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="gamepad-line"> <iconset theme="gamepad-line">
@ -88,7 +88,7 @@
<item> <item>
<widget class="QPushButton" name="clearBindings"> <widget class="QPushButton" name="clearBindings">
<property name="text"> <property name="text">
<string>Clear Bindings</string> <string>Clear Mapping</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="file-reduce-line"> <iconset theme="file-reduce-line">

View file

@ -162,8 +162,8 @@ void ControllerBindingWidget::onAutomaticBindingClicked()
void ControllerBindingWidget::onClearBindingsClicked() void ControllerBindingWidget::onClearBindingsClicked()
{ {
if (QMessageBox::question( if (QMessageBox::question(
QtUtils::GetRootWidget(this), tr("Clear Bindings"), QtUtils::GetRootWidget(this), tr("Clear Mapping"),
tr("Are you sure you want to clear all bindings for this controller? This action cannot be undone.")) != tr("Are you sure you want to clear all mappings for this controller? This action cannot be undone.")) !=
QMessageBox::Yes) QMessageBox::Yes)
{ {
return; return;
@ -200,7 +200,7 @@ void ControllerBindingWidget::doDeviceAutomaticBinding(const QString& device)
InputManager::GetGenericBindingMapping(device.toStdString()); InputManager::GetGenericBindingMapping(device.toStdString());
if (mapping.empty()) if (mapping.empty())
{ {
QMessageBox::critical(QtUtils::GetRootWidget(this), tr("Automatic Binding"), QMessageBox::critical(QtUtils::GetRootWidget(this), tr("Automatic Mapping"),
tr("No generic bindings were generated for device '%1'").arg(device)); tr("No generic bindings were generated for device '%1'").arg(device));
return; return;
} }

View file

@ -208,6 +208,7 @@ bool QtHost::InitializeConfig(std::string settings_filename)
Log::SetConsoleOutputParams(true, nullptr, LOGLEVEL_NONE); Log::SetConsoleOutputParams(true, nullptr, LOGLEVEL_NONE);
} }
InstallTranslator();
return true; return true;
} }
@ -2160,8 +2161,9 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
if (autoboot && !autoboot->filename.empty() && !FileSystem::FileExists(autoboot->filename.c_str())) if (autoboot && !autoboot->filename.empty() && !FileSystem::FileExists(autoboot->filename.c_str()))
{ {
QMessageBox::critical(nullptr, QStringLiteral("Error"), QMessageBox::critical(
QStringLiteral("File '%1' does not exist.").arg(QString::fromStdString(autoboot->filename))); nullptr, qApp->translate("QtHost", "Error"),
qApp->translate("QtHost", "File '%1' does not exist.").arg(QString::fromStdString(autoboot->filename)));
return false; return false;
} }
@ -2186,8 +2188,8 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
if (autoboot->save_state.empty() || !FileSystem::FileExists(autoboot->save_state.c_str())) if (autoboot->save_state.empty() || !FileSystem::FileExists(autoboot->save_state.c_str()))
{ {
QMessageBox::critical(nullptr, QStringLiteral("Error"), QMessageBox::critical(nullptr, qApp->translate("QtHost", "Error"),
QStringLiteral("The specified save state does not exist.")); qApp->translate("QtHost", "The specified save state does not exist."));
return false; return false;
} }
} }
@ -2201,10 +2203,10 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app,
// scanning the game list). // scanning the game list).
if (s_batch_mode && !autoboot && !s_start_fullscreen_ui) if (s_batch_mode && !autoboot && !s_start_fullscreen_ui)
{ {
QMessageBox::critical(nullptr, QStringLiteral("Error"), QMessageBox::critical(
s_nogui_mode ? nullptr, qApp->translate("QtHost", "Error"),
QStringLiteral("Cannot use no-gui mode, because no boot filename was specified.") : s_nogui_mode ? qApp->translate("QtHost", "Cannot use no-gui mode, because no boot filename was specified.") :
QStringLiteral("Cannot use batch mode, because no boot filename was specified.")); qApp->translate("QtHost", "Cannot use batch mode, because no boot filename was specified."));
return false; return false;
} }

View file

@ -1656,7 +1656,7 @@ void FullscreenUI::StartAutomaticBinding(u32 port)
std::vector<std::pair<std::string, std::string>> devices(InputManager::EnumerateDevices()); std::vector<std::pair<std::string, std::string>> devices(InputManager::EnumerateDevices());
if (devices.empty()) if (devices.empty())
{ {
ShowToast({}, "Automatic binding failed, no devices are available."); ShowToast({}, "Automatic mapping failed, no devices are available.");
return; return;
} }