Files
eden/src/yuzu/configuration/configure_hotkeys.h
T

68 lines
1.9 KiB
C++
Raw Normal View History

2022-05-15 02:06:02 +02:00
// SPDX-FileCopyrightText: 2017 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2019-02-16 16:19:29 +01:00
#pragma once
#include <memory>
#include <QWidget>
2021-11-15 17:57:41 -06:00
namespace Common {
class ParamPackage;
}
namespace Core::HID {
class HIDCore;
class EmulatedController;
enum class NpadButton : u64;
} // namespace Core::HID
2019-02-16 16:19:29 +01:00
namespace Ui {
class ConfigureHotkeys;
}
class HotkeyRegistry;
class QStandardItemModel;
class ConfigureHotkeys : public QWidget {
Q_OBJECT
public:
2021-11-15 17:57:41 -06:00
explicit ConfigureHotkeys(Core::HID::HIDCore& hid_core_, QWidget* parent = nullptr);
2019-02-16 16:19:29 +01:00
~ConfigureHotkeys() override;
void ApplyConfiguration(HotkeyRegistry& registry);
2019-02-16 16:19:29 +01:00
/**
* Populates the hotkey list widget using data from the provided registry.
2023-03-11 22:10:38 -05:00
* Called every time the Configure dialog is opened.
2019-02-16 16:19:29 +01:00
* @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();
2019-02-16 16:19:29 +01:00
void Configure(QModelIndex index);
2021-11-15 17:57:41 -06:00
void ConfigureController(QModelIndex index);
std::pair<bool, QString> IsUsedKey(QKeySequence key_sequence) const;
2021-11-15 17:57:41 -06:00
std::pair<bool, QString> IsUsedControllerKey(const QString& key_sequence) const;
void RestoreDefaults();
void ClearAll();
void PopupContextMenu(const QPoint& menu_location);
2021-11-15 17:57:41 -06:00
void RestoreControllerHotkey(QModelIndex index);
void RestoreHotkey(QModelIndex index);
2019-02-16 16:19:29 +01:00
std::unique_ptr<Ui::ConfigureHotkeys> ui;
QStandardItemModel* model;
2021-11-15 17:57:41 -06:00
void SetPollingResult(Core::HID::NpadButton button, bool cancel);
2023-04-28 17:42:18 +01:00
QString GetButtonCombinationName(Core::HID::NpadButton button, bool home, bool capture) const;
2021-11-15 17:57:41 -06:00
Core::HID::EmulatedController* controller;
std::unique_ptr<QTimer> timeout_timer;
std::unique_ptr<QTimer> poll_timer;
std::optional<std::function<void(Core::HID::NpadButton, bool)>> input_setter;
2019-02-16 16:19:29 +01:00
};