2018-05-22 20:30:36 +01:00
|
|
|
// Copyright 2017 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ConfigureHotkeys;
|
|
|
|
}
|
|
|
|
|
|
|
|
class HotkeyRegistry;
|
2018-12-30 10:09:16 +00:00
|
|
|
class QStandardItemModel;
|
2018-05-22 20:30:36 +01:00
|
|
|
|
|
|
|
class ConfigureHotkeys : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ConfigureHotkeys(QWidget* parent = nullptr);
|
2023-02-04 18:06:20 +00:00
|
|
|
~ConfigureHotkeys() override;
|
2018-05-22 20:30:36 +01:00
|
|
|
|
2019-05-26 05:39:23 +01:00
|
|
|
void ApplyConfiguration(HotkeyRegistry& registry);
|
|
|
|
void RetranslateUI();
|
2018-05-22 20:30:36 +01:00
|
|
|
|
|
|
|
void EmitHotkeysChanged();
|
|
|
|
|
2018-11-16 16:34:00 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2018-05-22 20:30:36 +01:00
|
|
|
void Populate(const HotkeyRegistry& registry);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void OnInputKeysChanged(QList<QKeySequence> new_key_list);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void HotkeysChanged(QList<QKeySequence> new_key_list);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Configure(QModelIndex index);
|
2023-02-04 18:06:20 +00:00
|
|
|
std::pair<bool, QString> IsUsedKey(QKeySequence key_sequence) const;
|
2019-04-10 00:35:52 +01:00
|
|
|
QList<QKeySequence> GetUsedKeyList() const;
|
2018-05-22 20:30:36 +01:00
|
|
|
|
2023-02-04 18:06:20 +00:00
|
|
|
void RestoreDefaults();
|
|
|
|
void ClearAll();
|
|
|
|
void PopupContextMenu(const QPoint& menu_location);
|
|
|
|
void RestoreHotkey(QModelIndex index);
|
2018-05-22 20:30:36 +01:00
|
|
|
|
2018-11-16 16:34:00 +00:00
|
|
|
/**
|
|
|
|
* List of keyboard keys currently registered to any of the 3DS inputs.
|
|
|
|
* These can't be bound to any hotkey.
|
|
|
|
* Synchronised with ConfigureInput via signal-slot.
|
|
|
|
*/
|
2018-05-22 20:30:36 +01:00
|
|
|
QList<QKeySequence> input_keys_list;
|
2018-11-16 16:34:00 +00:00
|
|
|
|
2023-02-04 18:06:20 +00:00
|
|
|
std::unique_ptr<Ui::ConfigureHotkeys> ui;
|
|
|
|
|
2018-05-22 20:30:36 +01:00
|
|
|
QStandardItemModel* model;
|
|
|
|
};
|