2016-07-29 14:45:49 +02:00
|
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2017-01-22 20:02:29 +01:00
|
|
|
|
#include <array>
|
2016-09-20 17:21:23 +02:00
|
|
|
|
#include <memory>
|
2018-10-30 05:03:25 +01:00
|
|
|
|
|
2016-07-29 14:45:49 +02:00
|
|
|
|
#include <QKeyEvent>
|
2020-10-27 18:33:25 +01:00
|
|
|
|
#include <QList>
|
2020-08-27 21:16:47 +02:00
|
|
|
|
#include <QWidget>
|
2018-10-30 05:03:25 +01:00
|
|
|
|
|
2020-08-15 21:26:29 +02:00
|
|
|
|
class QCheckBox;
|
2016-07-29 14:45:49 +02:00
|
|
|
|
class QString;
|
|
|
|
|
class QTimer;
|
|
|
|
|
|
2020-10-27 18:33:25 +01:00
|
|
|
|
class ConfigureInputAdvanced;
|
|
|
|
|
class ConfigureInputPlayer;
|
|
|
|
|
|
2020-09-23 15:52:25 +02:00
|
|
|
|
class InputProfiles;
|
|
|
|
|
|
2020-08-27 21:16:47 +02:00
|
|
|
|
namespace InputCommon {
|
|
|
|
|
class InputSubsystem;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-29 14:45:49 +02:00
|
|
|
|
namespace Ui {
|
2016-09-18 02:38:01 +02:00
|
|
|
|
class ConfigureInput;
|
2016-07-29 14:45:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-12-05 04:01:01 +01:00
|
|
|
|
void OnDockedModeChanged(bool last_state, bool new_state);
|
|
|
|
|
|
2020-07-22 16:39:53 +02:00
|
|
|
|
class ConfigureInput : public QWidget {
|
2016-07-29 14:45:49 +02:00
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit ConfigureInput(QWidget* parent = nullptr);
|
2018-12-02 20:06:39 +01:00
|
|
|
|
~ConfigureInput() override;
|
2016-07-29 14:45:49 +02:00
|
|
|
|
|
2020-08-27 21:16:47 +02:00
|
|
|
|
/// Initializes the input dialog with the given input subsystem.
|
2020-08-21 13:39:24 +02:00
|
|
|
|
void Initialize(InputCommon::InputSubsystem* input_subsystem_, std::size_t max_players = 8);
|
2020-08-27 21:16:47 +02:00
|
|
|
|
|
2020-07-22 16:39:53 +02:00
|
|
|
|
/// Save all button configurations to settings file.
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void ApplyConfiguration();
|
2016-07-29 14:45:49 +02:00
|
|
|
|
|
2020-07-22 16:39:53 +02:00
|
|
|
|
QList<QWidget*> GetSubTabs() const;
|
|
|
|
|
|
2016-07-29 14:45:49 +02:00
|
|
|
|
private:
|
2019-06-06 00:39:46 +02:00
|
|
|
|
void changeEvent(QEvent* event) override;
|
|
|
|
|
void RetranslateUI();
|
2020-07-22 16:39:53 +02:00
|
|
|
|
void ClearAll();
|
2019-06-06 00:39:46 +02:00
|
|
|
|
|
2020-07-22 16:39:53 +02:00
|
|
|
|
void UpdateDockedState(bool is_handheld);
|
|
|
|
|
void UpdateAllInputDevices();
|
2017-12-06 05:26:29 +01:00
|
|
|
|
|
2016-12-10 00:59:09 +01:00
|
|
|
|
/// Load configuration settings.
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void LoadConfiguration();
|
2019-06-06 00:39:46 +02:00
|
|
|
|
void LoadPlayerControllerIndices();
|
|
|
|
|
|
2016-07-29 14:45:49 +02:00
|
|
|
|
/// Restore all buttons to their default values.
|
2019-05-26 06:39:23 +02:00
|
|
|
|
void RestoreDefaults();
|
2018-08-26 10:23:12 +02:00
|
|
|
|
|
2018-11-02 03:06:48 +01:00
|
|
|
|
std::unique_ptr<Ui::ConfigureInput> ui;
|
2017-12-06 05:26:29 +01:00
|
|
|
|
|
2020-09-23 15:52:25 +02:00
|
|
|
|
std::unique_ptr<InputProfiles> profiles;
|
|
|
|
|
|
2020-07-22 16:39:53 +02:00
|
|
|
|
std::array<ConfigureInputPlayer*, 8> player_controllers;
|
|
|
|
|
std::array<QWidget*, 8> player_tabs;
|
|
|
|
|
std::array<QCheckBox*, 8> player_connected;
|
|
|
|
|
ConfigureInputAdvanced* advanced;
|
2016-07-29 14:45:49 +02:00
|
|
|
|
};
|