configure_input.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2016 Citra 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 <QKeyEvent>
  8. #include <QList>
  9. #include <QWidget>
  10. class QCheckBox;
  11. class QString;
  12. class QTimer;
  13. class ConfigureInputAdvanced;
  14. class ConfigureInputPlayer;
  15. class InputProfiles;
  16. namespace InputCommon {
  17. class InputSubsystem;
  18. }
  19. namespace Ui {
  20. class ConfigureInput;
  21. }
  22. void OnDockedModeChanged(bool last_state, bool new_state);
  23. class ConfigureInput : public QWidget {
  24. Q_OBJECT
  25. public:
  26. explicit ConfigureInput(QWidget* parent = nullptr);
  27. ~ConfigureInput() override;
  28. /// Initializes the input dialog with the given input subsystem.
  29. void Initialize(InputCommon::InputSubsystem* input_subsystem_, std::size_t max_players = 8);
  30. /// Save all button configurations to settings file.
  31. void ApplyConfiguration();
  32. QList<QWidget*> GetSubTabs() const;
  33. private:
  34. void changeEvent(QEvent* event) override;
  35. void RetranslateUI();
  36. void ClearAll();
  37. void UpdateDockedState(bool is_handheld);
  38. void UpdateAllInputDevices();
  39. void UpdateAllInputProfiles(std::size_t player_index);
  40. /// Load configuration settings.
  41. void LoadConfiguration();
  42. void LoadPlayerControllerIndices();
  43. /// Restore all buttons to their default values.
  44. void RestoreDefaults();
  45. std::unique_ptr<Ui::ConfigureInput> ui;
  46. std::unique_ptr<InputProfiles> profiles;
  47. std::array<ConfigureInputPlayer*, 8> player_controllers;
  48. std::array<QWidget*, 8> player_tabs;
  49. std::array<QCheckBox*, 8> player_connected;
  50. ConfigureInputAdvanced* advanced;
  51. };