diff options
Diffstat (limited to 'src/yuzu/configuration')
| -rw-r--r-- | src/yuzu/configuration/configure_dialog.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_filesystem.cpp | 16 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_filesystem.h | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_hotkeys.cpp | 32 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 27 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_motion_touch.cpp | 38 | 
6 files changed, 70 insertions, 53 deletions
| diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 464e7a489..19133ccf5 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -109,7 +109,7 @@ void ConfigureDialog::ApplyConfiguration() {      ui_tab->ApplyConfiguration();      system_tab->ApplyConfiguration();      profile_tab->ApplyConfiguration(); -    filesystem_tab->applyConfiguration(); +    filesystem_tab->ApplyConfiguration();      input_tab->ApplyConfiguration();      hotkeys_tab->ApplyConfiguration(registry);      cpu_tab->ApplyConfiguration(); diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp index 9cb317822..d6fb43f8b 100644 --- a/src/yuzu/configuration/configure_filesystem.cpp +++ b/src/yuzu/configuration/configure_filesystem.cpp @@ -14,7 +14,7 @@  ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)      : QWidget(parent), ui(std::make_unique<Ui::ConfigureFilesystem>()) {      ui->setupUi(this); -    this->setConfiguration(); +    SetConfiguration();      connect(ui->nand_directory_button, &QToolButton::pressed, this,              [this] { SetDirectory(DirectoryTarget::NAND, ui->nand_directory_edit); }); @@ -38,7 +38,15 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)  ConfigureFilesystem::~ConfigureFilesystem() = default; -void ConfigureFilesystem::setConfiguration() { +void ConfigureFilesystem::changeEvent(QEvent* event) { +    if (event->type() == QEvent::LanguageChange) { +        RetranslateUI(); +    } + +    QWidget::changeEvent(event); +} + +void ConfigureFilesystem::SetConfiguration() {      ui->nand_directory_edit->setText(          QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir)));      ui->sdmc_directory_edit->setText( @@ -60,7 +68,7 @@ void ConfigureFilesystem::setConfiguration() {      UpdateEnabledControls();  } -void ConfigureFilesystem::applyConfiguration() { +void ConfigureFilesystem::ApplyConfiguration() {      Common::FS::SetYuzuPath(Common::FS::YuzuPath::NANDDir,                              ui->nand_directory_edit->text().toStdString());      Common::FS::SetYuzuPath(Common::FS::YuzuPath::SDMCDir, @@ -143,6 +151,6 @@ void ConfigureFilesystem::UpdateEnabledControls() {                                           !ui->gamecard_current_game->isChecked());  } -void ConfigureFilesystem::retranslateUi() { +void ConfigureFilesystem::RetranslateUI() {      ui->retranslateUi(this);  } diff --git a/src/yuzu/configuration/configure_filesystem.h b/src/yuzu/configuration/configure_filesystem.h index 2147cd405..b4f9355eb 100644 --- a/src/yuzu/configuration/configure_filesystem.h +++ b/src/yuzu/configuration/configure_filesystem.h @@ -20,11 +20,13 @@ public:      explicit ConfigureFilesystem(QWidget* parent = nullptr);      ~ConfigureFilesystem() override; -    void applyConfiguration(); -    void retranslateUi(); +    void ApplyConfiguration();  private: -    void setConfiguration(); +    void changeEvent(QEvent* event) override; + +    void RetranslateUI(); +    void SetConfiguration();      enum class DirectoryTarget {          NAND, diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp index be10e0a31..53e629a5e 100644 --- a/src/yuzu/configuration/configure_hotkeys.cpp +++ b/src/yuzu/configuration/configure_hotkeys.cpp @@ -178,52 +178,52 @@ void ConfigureHotkeys::SetPollingResult(Core::HID::NpadButton button, const bool  QString ConfigureHotkeys::GetButtonName(Core::HID::NpadButton button) const {      Core::HID::NpadButtonState state{button};      if (state.a) { -        return tr("A"); +        return QStringLiteral("A");      }      if (state.b) { -        return tr("B"); +        return QStringLiteral("B");      }      if (state.x) { -        return tr("X"); +        return QStringLiteral("X");      }      if (state.y) { -        return tr("Y"); +        return QStringLiteral("Y");      }      if (state.l || state.right_sl || state.left_sl) { -        return tr("L"); +        return QStringLiteral("L");      }      if (state.r || state.right_sr || state.left_sr) { -        return tr("R"); +        return QStringLiteral("R");      }      if (state.zl) { -        return tr("ZL"); +        return QStringLiteral("ZL");      }      if (state.zr) { -        return tr("ZR"); +        return QStringLiteral("ZR");      }      if (state.left) { -        return tr("Dpad_Left"); +        return QStringLiteral("Dpad_Left");      }      if (state.right) { -        return tr("Dpad_Right"); +        return QStringLiteral("Dpad_Right");      }      if (state.up) { -        return tr("Dpad_Up"); +        return QStringLiteral("Dpad_Up");      }      if (state.down) { -        return tr("Dpad_Down"); +        return QStringLiteral("Dpad_Down");      }      if (state.stick_l) { -        return tr("Left_Stick"); +        return QStringLiteral("Left_Stick");      }      if (state.stick_r) { -        return tr("Right_Stick"); +        return QStringLiteral("Right_Stick");      }      if (state.minus) { -        return tr("Minus"); +        return QStringLiteral("Minus");      }      if (state.plus) { -        return tr("Plus"); +        return QStringLiteral("Plus");      }      return tr("Invalid");  } diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 752504236..cc0534907 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -102,6 +102,10 @@ QString GetButtonName(Common::Input::ButtonNames button_name) {          return QObject::tr("Share");      case Common::Input::ButtonNames::Options:          return QObject::tr("Options"); +    case Common::Input::ButtonNames::Home: +        return QObject::tr("Home"); +    case Common::Input::ButtonNames::Touch: +        return QObject::tr("Touch");      case Common::Input::ButtonNames::ButtonMouseWheel:          return QObject::tr("Wheel", "Indicates the mouse wheel");      case Common::Input::ButtonNames::ButtonBackward: @@ -326,7 +330,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i          connect(button, &QPushButton::clicked, [=, this] {              HandleClick(                  button, button_id, -                [=, this](Common::ParamPackage params) { +                [=, this](const Common::ParamPackage& params) {                      emulated_controller->SetButtonParam(button_id, params);                  },                  InputCommon::Polling::InputType::Button); @@ -392,7 +396,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i          connect(button, &QPushButton::clicked, [=, this] {              HandleClick(                  button, motion_id, -                [=, this](Common::ParamPackage params) { +                [=, this](const Common::ParamPackage& params) {                      emulated_controller->SetMotionParam(motion_id, params);                  },                  InputCommon::Polling::InputType::Motion); @@ -497,10 +501,11 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i                                  param.Set("invert_y", invert_str);                                  emulated_controller->SetStickParam(analog_id, param);                              } -                            for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; -                                 ++sub_button_id) { -                                analog_map_buttons[analog_id][sub_button_id]->setText( -                                    AnalogToText(param, analog_sub_buttons[sub_button_id])); +                            for (int analog_sub_button_id = 0; +                                 analog_sub_button_id < ANALOG_SUB_BUTTONS_NUM; +                                 ++analog_sub_button_id) { +                                analog_map_buttons[analog_id][analog_sub_button_id]->setText( +                                    AnalogToText(param, analog_sub_buttons[analog_sub_button_id]));                              }                          });                          context_menu.exec(analog_map_buttons[analog_id][sub_button_id]->mapToGlobal( @@ -783,7 +788,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {      if (devices.size() == 1) {          const auto devices_it = std::find_if(              input_devices.begin(), input_devices.end(), -            [first_engine, first_guid, first_port, first_pad](const Common::ParamPackage param) { +            [first_engine, first_guid, first_port, first_pad](const Common::ParamPackage& param) {                  return param.Get("engine", "") == first_engine &&                         param.Get("guid", "") == first_guid && param.Get("port", 0) == first_port &&                         param.Get("pad", 0) == first_pad; @@ -814,7 +819,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {      if (is_engine_equal && is_port_equal) {          const auto devices_it = std::find_if(              input_devices.begin(), input_devices.end(), -            [first_engine, first_guid, second_guid, first_port](const Common::ParamPackage param) { +            [first_engine, first_guid, second_guid, first_port](const Common::ParamPackage& param) {                  const bool is_guid_valid =                      (param.Get("guid", "") == first_guid &&                       param.Get("guid2", "") == second_guid) || @@ -1026,7 +1031,7 @@ int ConfigureInputPlayer::GetIndexFromControllerType(Core::HID::NpadStyleIndex t  void ConfigureInputPlayer::UpdateInputDevices() {      input_devices = input_subsystem->GetInputDevices();      ui->comboDevices->clear(); -    for (auto device : input_devices) { +    for (const auto& device : input_devices) {          ui->comboDevices->addItem(QString::fromStdString(device.Get("display", "Unknown")), {});      }  } @@ -1308,7 +1313,7 @@ void ConfigureInputPlayer::HandleClick(      }      button->setFocus(); -    input_setter = new_input_setter; +    input_setter = std::move(new_input_setter);      input_subsystem->BeginMapping(type); @@ -1358,7 +1363,7 @@ bool ConfigureInputPlayer::IsInputAcceptable(const Common::ParamPackage& params)          return params.Get("engine", "") == "keyboard" || params.Get("engine", "") == "mouse";      } -    const auto current_input_device = input_devices[ui->comboDevices->currentIndex()]; +    const auto& current_input_device = input_devices[ui->comboDevices->currentIndex()];      return params.Get("engine", "") == current_input_device.Get("engine", "") &&             (params.Get("guid", "") == current_input_device.Get("guid", "") ||              params.Get("guid", "") == current_input_device.Get("guid2", "")) && diff --git a/src/yuzu/configuration/configure_motion_touch.cpp b/src/yuzu/configuration/configure_motion_touch.cpp index 8539a5c8b..4340de304 100644 --- a/src/yuzu/configuration/configure_motion_touch.cpp +++ b/src/yuzu/configuration/configure_motion_touch.cpp @@ -42,23 +42,25 @@ CalibrationConfigurationDialog::CalibrationConfigurationDialog(QWidget* parent,      job = std::make_unique<CalibrationConfigurationJob>(          host, port,          [this](CalibrationConfigurationJob::Status status) { -            QString text; -            switch (status) { -            case CalibrationConfigurationJob::Status::Ready: -                text = tr("Touch the top left corner <br>of your touchpad."); -                break; -            case CalibrationConfigurationJob::Status::Stage1Completed: -                text = tr("Now touch the bottom right corner <br>of your touchpad."); -                break; -            case CalibrationConfigurationJob::Status::Completed: -                text = tr("Configuration completed!"); -                break; -            default: -                break; -            } -            QMetaObject::invokeMethod(this, "UpdateLabelText", Q_ARG(QString, text)); +            QMetaObject::invokeMethod(this, [status, this] { +                QString text; +                switch (status) { +                case CalibrationConfigurationJob::Status::Ready: +                    text = tr("Touch the top left corner <br>of your touchpad."); +                    break; +                case CalibrationConfigurationJob::Status::Stage1Completed: +                    text = tr("Now touch the bottom right corner <br>of your touchpad."); +                    break; +                case CalibrationConfigurationJob::Status::Completed: +                    text = tr("Configuration completed!"); +                    break; +                default: +                    break; +                } +                UpdateLabelText(text); +            });              if (status == CalibrationConfigurationJob::Status::Completed) { -                QMetaObject::invokeMethod(this, "UpdateButtonText", Q_ARG(QString, tr("OK"))); +                QMetaObject::invokeMethod(this, [this] { UpdateButtonText(tr("OK")); });              }          },          [this](u16 min_x_, u16 min_y_, u16 max_x_, u16 max_y_) { @@ -215,11 +217,11 @@ void ConfigureMotionTouch::OnCemuhookUDPTest() {          ui->udp_server->text().toStdString(), static_cast<u16>(ui->udp_port->text().toInt()),          [this] {              LOG_INFO(Frontend, "UDP input test success"); -            QMetaObject::invokeMethod(this, "ShowUDPTestResult", Q_ARG(bool, true)); +            QMetaObject::invokeMethod(this, [this] { ShowUDPTestResult(true); });          },          [this] {              LOG_ERROR(Frontend, "UDP input test failed"); -            QMetaObject::invokeMethod(this, "ShowUDPTestResult", Q_ARG(bool, false)); +            QMetaObject::invokeMethod(this, [this] { ShowUDPTestResult(false); });          });  } | 
