2018-05-22 21:30:36 +02: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 11:09:16 +01:00
|
|
|
class QStandardItemModel;
|
2018-05-22 21:30:36 +02:00
|
|
|
|
|
|
|
class ConfigureHotkeys : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit ConfigureHotkeys(QWidget* parent = nullptr);
|
|
|
|
~ConfigureHotkeys();
|
|
|
|
|
|
|
|
void applyConfiguration(HotkeyRegistry& registry);
|
|
|
|
void retranslateUi();
|
|
|
|
|
|
|
|
void EmitHotkeysChanged();
|
|
|
|
|
2018-11-16 17:34:00 +01: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 21:30:36 +02: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);
|
2019-04-10 01:35:52 +02:00
|
|
|
bool IsUsedKey(QKeySequence key_sequence) const;
|
|
|
|
QList<QKeySequence> GetUsedKeyList() const;
|
2018-05-22 21:30:36 +02:00
|
|
|
|
|
|
|
std::unique_ptr<Ui::ConfigureHotkeys> ui;
|
|
|
|
|
2018-11-16 17:34:00 +01: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 21:30:36 +02:00
|
|
|
QList<QKeySequence> input_keys_list;
|
2018-11-16 17:34:00 +01:00
|
|
|
|
2018-05-22 21:30:36 +02:00
|
|
|
QStandardItemModel* model;
|
|
|
|
};
|