configure_vibration.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Copyright 2020 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include <memory>
  7. #include <QDialog>
  8. class QGroupBox;
  9. class QSpinBox;
  10. namespace Ui {
  11. class ConfigureVibration;
  12. }
  13. namespace Core::HID {
  14. enum class ControllerTriggerType;
  15. class HIDCore;
  16. } // namespace Core::HID
  17. class ConfigureVibration : public QDialog {
  18. Q_OBJECT
  19. public:
  20. explicit ConfigureVibration(QWidget* parent, Core::HID::HIDCore& hid_core_);
  21. ~ConfigureVibration() override;
  22. void ApplyConfiguration();
  23. private:
  24. void changeEvent(QEvent* event) override;
  25. void RetranslateUI();
  26. void VibrateController(Core::HID::ControllerTriggerType type, std::size_t player_index);
  27. void StopVibrations();
  28. std::unique_ptr<Ui::ConfigureVibration> ui;
  29. static constexpr std::size_t NUM_PLAYERS = 8;
  30. /// Groupboxes encapsulating the vibration strength spinbox.
  31. std::array<QGroupBox*, NUM_PLAYERS> vibration_groupboxes;
  32. /// Spinboxes representing the vibration strength percentage.
  33. std::array<QSpinBox*, NUM_PLAYERS> vibration_spinboxes;
  34. /// Callback index to stop the controllers events
  35. std::array<int, NUM_PLAYERS> controller_callback_key;
  36. Core::HID::HIDCore& hid_core;
  37. };