configure_input.h 1.7 KB

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