configure_input.h 1.7 KB

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