// Copyright 2017 Citra Emulator Project // Licensed under GPLv2 or any later version // Refer to the license.txt file included. #pragma once #include #include namespace Common { class ParamPackage; } namespace Core::HID { class HIDCore; class EmulatedController; enum class NpadButton : u64; } // namespace Core::HID namespace Ui { class ConfigureHotkeys; } class HotkeyRegistry; class QStandardItemModel; class ConfigureHotkeys : public QWidget { Q_OBJECT public: explicit ConfigureHotkeys(Core::HID::HIDCore& hid_core_, QWidget* parent = nullptr); ~ConfigureHotkeys() override; void ApplyConfiguration(HotkeyRegistry& registry); /** * Populates the hotkey list widget using data from the provided registry. * Called everytime the Configure dialog is opened. * @param registry The HotkeyRegistry whose data is used to populate the list. */ void Populate(const HotkeyRegistry& registry); private: void changeEvent(QEvent* event) override; void RetranslateUI(); void Configure(QModelIndex index); void ConfigureController(QModelIndex index); std::pair IsUsedKey(QKeySequence key_sequence) const; std::pair IsUsedControllerKey(const QString& key_sequence) const; void RestoreDefaults(); void ClearAll(); void PopupContextMenu(const QPoint& menu_location); void RestoreControllerHotkey(QModelIndex index); void RestoreHotkey(QModelIndex index); std::unique_ptr ui; QStandardItemModel* model; void SetPollingResult(Core::HID::NpadButton button, bool cancel); QString GetButtonName(Core::HID::NpadButton button) const; Core::HID::EmulatedController* controller; std::unique_ptr timeout_timer; std::unique_ptr poll_timer; std::optional> input_setter; };