citra-qt: Add base support for hotkey reconfiguration + UI (whole of PR citra-emu/citra#3786)
* Adds a new Hotkeys tab in the Controls group. * Right click to reconfigure. * See the original PR for more details & screenshots.
This commit is contained in:
parent
95a57a2fe3
commit
5fa25fcf13
22 changed files with 559 additions and 306 deletions
35
src/citra_qt/util/sequence_dialog/sequence_dialog.cpp
Normal file
35
src/citra_qt/util/sequence_dialog/sequence_dialog.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QVBoxLayout>
|
||||
#include "citra_qt/util/sequence_dialog/sequence_dialog.h"
|
||||
|
||||
SequenceDialog::SequenceDialog(QWidget* parent) : QDialog(parent) {
|
||||
setWindowTitle(tr("Enter a hotkey"));
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
key_sequence = new QKeySequenceEdit;
|
||||
layout->addWidget(key_sequence);
|
||||
auto* buttons =
|
||||
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal);
|
||||
buttons->setCenterButtons(true);
|
||||
layout->addWidget(buttons);
|
||||
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
}
|
||||
|
||||
SequenceDialog::~SequenceDialog() = default;
|
||||
|
||||
QKeySequence SequenceDialog::GetSequence() {
|
||||
return QKeySequence(key_sequence->keySequence()[0]);
|
||||
}
|
||||
|
||||
bool SequenceDialog::focusNextPrevChild(bool next) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void SequenceDialog::closeEvent(QCloseEvent*) {
|
||||
reject();
|
||||
}
|
24
src/citra_qt/util/sequence_dialog/sequence_dialog.h
Normal file
24
src/citra_qt/util/sequence_dialog/sequence_dialog.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2018 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <QDialog>
|
||||
#include <QKeySequenceEdit>
|
||||
|
||||
class SequenceDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SequenceDialog(QWidget* parent = nullptr);
|
||||
~SequenceDialog();
|
||||
|
||||
QKeySequence GetSequence();
|
||||
void closeEvent(QCloseEvent*) override;
|
||||
|
||||
private:
|
||||
QKeySequenceEdit* key_sequence;
|
||||
bool focusNextPrevChild(bool next) override;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue