configure_debug_controller.cpp 1.7 KB

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