configure_debug_controller.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "core/hid/hid_core.h"
  4. #include "ui_configure_debug_controller.h"
  5. #include "yuzu/configuration/configure_debug_controller.h"
  6. #include "yuzu/configuration/configure_input_player.h"
  7. ConfigureDebugController::ConfigureDebugController(QWidget* parent,
  8. InputCommon::InputSubsystem* input_subsystem,
  9. InputProfiles* profiles,
  10. Core::HID::HIDCore& hid_core, bool is_powered_on)
  11. : QDialog(parent), ui(std::make_unique<Ui::ConfigureDebugController>()),
  12. debug_controller(new ConfigureInputPlayer(this, 9, nullptr, input_subsystem, profiles,
  13. hid_core, is_powered_on, true)) {
  14. ui->setupUi(this);
  15. ui->controllerLayout->addWidget(debug_controller);
  16. connect(ui->clear_all_button, &QPushButton::clicked, this,
  17. [this] { debug_controller->ClearAll(); });
  18. connect(ui->restore_defaults_button, &QPushButton::clicked, this,
  19. [this] { debug_controller->RestoreDefaults(); });
  20. RetranslateUI();
  21. }
  22. ConfigureDebugController::~ConfigureDebugController() = default;
  23. void ConfigureDebugController::ApplyConfiguration() {
  24. debug_controller->ApplyConfiguration();
  25. }
  26. void ConfigureDebugController::changeEvent(QEvent* event) {
  27. if (event->type() == QEvent::LanguageChange) {
  28. RetranslateUI();
  29. }
  30. QDialog::changeEvent(event);
  31. }
  32. void ConfigureDebugController::RetranslateUI() {
  33. ui->retranslateUi(this);
  34. }