Files
dolphin/Source/Core/DolphinQt/Config/ControllersWindow.cpp
Dentomologist ffd46cd10c WiimoteControllersWidget: Fix UI hang on opening
Fix the UI hanging for several seconds when opening the Controllers
window.

Move the scan for Bluetooth adapters onto a separate thread so the Host
thread doesn't have to wait for it.

Only automatically scan for adapters once, when opening the Controllers
window for the first time. Add a Refresh button to let the user refresh
the adapter list afterward.
2025-05-15 20:36:21 -07:00

50 lines
1.4 KiB
C++

// Copyright 2017 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "DolphinQt/Config/ControllersWindow.h"
#include <QDialogButtonBox>
#include <QVBoxLayout>
#include "DolphinQt/Config/CommonControllersWidget.h"
#include "DolphinQt/Config/GamecubeControllersWidget.h"
#include "DolphinQt/Config/WiimoteControllersWidget.h"
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
ControllersWindow::ControllersWindow(QWidget* parent) : QDialog(parent)
{
setWindowTitle(tr("Controller Settings"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_gamecube_controllers = new GamecubeControllersWidget(this);
m_wiimote_controllers = new WiimoteControllersWidget(this);
m_common = new CommonControllersWidget(this);
CreateMainLayout();
ConnectWidgets();
}
void ControllersWindow::showEvent(QShowEvent* event)
{
QDialog::showEvent(event);
m_wiimote_controllers->UpdateBluetoothAvailableStatus();
}
void ControllersWindow::CreateMainLayout()
{
auto* layout = new QVBoxLayout();
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
layout->addWidget(m_gamecube_controllers);
layout->addWidget(m_wiimote_controllers);
layout->addWidget(m_common);
layout->addStretch();
layout->addWidget(m_button_box);
WrapInScrollArea(this, layout);
}
void ControllersWindow::ConnectWidgets()
{
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
}