summaryrefslogtreecommitdiffstats
path: root/src/yuzu/applets/qt_profile_select.cpp
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-28 06:26:51 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-12-02 22:17:44 +0100
commit5ba7b11ba49ecba530612248286482f94799672c (patch)
tree16439df3a2c0d1f1169e45cefea492572413f6ba /src/yuzu/applets/qt_profile_select.cpp
parentMerge pull request #7472 from Morph1984/post-kraken-cleanup (diff)
downloadyuzu-5ba7b11ba49ecba530612248286482f94799672c.tar
yuzu-5ba7b11ba49ecba530612248286482f94799672c.tar.gz
yuzu-5ba7b11ba49ecba530612248286482f94799672c.tar.bz2
yuzu-5ba7b11ba49ecba530612248286482f94799672c.tar.lz
yuzu-5ba7b11ba49ecba530612248286482f94799672c.tar.xz
yuzu-5ba7b11ba49ecba530612248286482f94799672c.tar.zst
yuzu-5ba7b11ba49ecba530612248286482f94799672c.zip
Diffstat (limited to 'src/yuzu/applets/qt_profile_select.cpp')
-rw-r--r--src/yuzu/applets/qt_profile_select.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/yuzu/applets/qt_profile_select.cpp b/src/yuzu/applets/qt_profile_select.cpp
index a56638e21..7b19f1f8d 100644
--- a/src/yuzu/applets/qt_profile_select.cpp
+++ b/src/yuzu/applets/qt_profile_select.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <mutex>
+#include <QApplication>
#include <QDialogButtonBox>
#include <QHeaderView>
#include <QLabel>
@@ -16,6 +17,7 @@
#include "core/hle/lock.h"
#include "yuzu/applets/qt_profile_select.h"
#include "yuzu/main.h"
+#include "yuzu/util/controller_navigation.h"
namespace {
QString FormatUserEntryText(const QString& username, Common::UUID uuid) {
@@ -45,7 +47,7 @@ QPixmap GetIcon(Common::UUID uuid) {
}
} // Anonymous namespace
-QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent)
+QtProfileSelectionDialog::QtProfileSelectionDialog(Core::HID::HIDCore& hid_core, QWidget* parent)
: QDialog(parent), profile_manager(std::make_unique<Service::Account::ProfileManager>()) {
outer_layout = new QVBoxLayout;
@@ -65,6 +67,7 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent)
tree_view = new QTreeView;
item_model = new QStandardItemModel(tree_view);
tree_view->setModel(item_model);
+ controller_navigation = new ControllerNavigation(hid_core, this);
tree_view->setAlternatingRowColors(true);
tree_view->setSelectionMode(QHeaderView::SingleSelection);
@@ -91,6 +94,14 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent)
scroll_area->setLayout(layout);
connect(tree_view, &QTreeView::clicked, this, &QtProfileSelectionDialog::SelectUser);
+ connect(controller_navigation, &ControllerNavigation::TriggerKeyboardEvent,
+ [this](Qt::Key key) {
+ if (!this->isActiveWindow()) {
+ return;
+ }
+ QKeyEvent* event = new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier);
+ QCoreApplication::postEvent(tree_view, event);
+ });
const auto& profiles = profile_manager->GetAllUsers();
for (const auto& user : profiles) {
@@ -113,7 +124,9 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent)
resize(550, 400);
}
-QtProfileSelectionDialog::~QtProfileSelectionDialog() = default;
+QtProfileSelectionDialog::~QtProfileSelectionDialog() {
+ controller_navigation->UnloadController();
+};
int QtProfileSelectionDialog::exec() {
// Skip profile selection when there's only one.