2018-05-22 19:30:36 +00:00
|
|
|
// 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() {
|
2018-11-16 16:34:00 +00:00
|
|
|
// Only the first key is returned. The other 3, if present, are ignored.
|
2018-05-22 19:30:36 +00:00
|
|
|
return QKeySequence(key_sequence->keySequence()[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SequenceDialog::focusNextPrevChild(bool next) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SequenceDialog::closeEvent(QCloseEvent*) {
|
|
|
|
reject();
|
|
|
|
}
|