Files
azahar/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp
T
NovaChild 38e6e79024 Desktop: Controller improvements - readable labels, controller hotkeys, option to apply profiles to all controllers (#1717)
* controller hotkey support and SDL refactor to use GameController API,
which adds more user-readable names to controller input maps

* Add "Press A (right) button" command to input automap that will map in nintendo layout if the user has a nintendo layout / prefers to match letters rather than position.

* honor shortcut context with controller hotkeys

* fix profiles not saving correctly

* analog_from_keyboard display fix, build error fix

* attempt to fix event_queue bugs

* Do not signal savestate if system is powered off

---------

Co-authored-by: PabloMK7 <hackyglitch2@gmail.com>
2026-07-10 17:09:34 +02:00

48 lines
1.4 KiB
C++

// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <QDialogButtonBox>
#include <QKeySequenceEdit>
#include <QVBoxLayout>
#include "citra_qt/util/sequence_dialog/sequence_dialog.h"
SequenceDialog::SequenceDialog(QWidget* parent) : QDialog(parent) {
setWindowTitle(tr("Enter a hotkey"));
key_sequence = new QKeySequenceEdit;
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
key_sequence->setMaximumSequenceLength(1);
key_sequence->setFinishingKeyCombinations({});
#endif
auto* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
buttons->setCenterButtons(true);
auto* const layout = new QVBoxLayout(this);
layout->addWidget(key_sequence);
layout->addWidget(buttons);
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
SequenceDialog::~SequenceDialog() = default;
QKeySequence SequenceDialog::GetSequence() {
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
return key_sequence->keySequence();
#else
// Only the first key is returned. The other 3, if present, are ignored.
return QKeySequence(key_sequence->keySequence()[0]);
#endif
}
bool SequenceDialog::focusNextPrevChild(bool next) {
return false;
}
void SequenceDialog::closeEvent(QCloseEvent*) {
reject();
}