mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix input-related Qt 6 build errors
This commit is contained in:
parent
f5a6906ef8
commit
6e65b70c32
|
@ -36,7 +36,7 @@ InputController::InputController(QWidget* topLevel, QObject* parent)
|
|||
mInputMapInit(&m_inputMap, &GBAInputInfo);
|
||||
|
||||
connect(&m_gamepadTimer, &QTimer::timeout, [this]() {
|
||||
for (auto& driver : m_inputDrivers) {
|
||||
for (auto driver : m_inputDrivers) {
|
||||
if (driver->supportsPolling() && driver->supportsGamepads()) {
|
||||
testGamepad(driver->type());
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ bool InputController::loadConfiguration(uint32_t type) {
|
|||
if (!mInputMapLoad(&m_inputMap, type, m_config->input())) {
|
||||
return false;
|
||||
}
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (!driver) {
|
||||
return false;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ bool InputController::loadProfile(uint32_t type, const QString& profile) {
|
|||
|
||||
void InputController::saveConfiguration() {
|
||||
saveConfiguration(KEYBOARD);
|
||||
for (auto& driver : m_inputDrivers) {
|
||||
for (auto driver : m_inputDrivers) {
|
||||
driver->saveConfiguration(m_config);
|
||||
}
|
||||
m_config->write();
|
||||
|
@ -188,7 +188,7 @@ void InputController::saveConfiguration() {
|
|||
|
||||
void InputController::saveConfiguration(uint32_t type) {
|
||||
mInputMapSave(&m_inputMap, type, m_config->input());
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (driver) {
|
||||
driver->saveConfiguration(m_config);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void InputController::saveProfile(uint32_t type, const QString& profile) {
|
|||
}
|
||||
|
||||
QString InputController::profileForType(uint32_t type) {
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (!driver) {
|
||||
return {};
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ QString InputController::profileForType(uint32_t type) {
|
|||
}
|
||||
|
||||
void InputController::setGamepadDriver(uint32_t type) {
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (!driver || !driver->supportsGamepads()) {
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ QStringList InputController::connectedGamepads(uint32_t type) const {
|
|||
if (!type) {
|
||||
type = m_gamepadDriver;
|
||||
}
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
const auto& driver = m_inputDrivers.value(type);
|
||||
if (!driver) {
|
||||
return {};
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ int InputController::gamepadIndex(uint32_t type) const {
|
|||
if (!type) {
|
||||
type = m_gamepadDriver;
|
||||
}
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
const auto& driver = m_inputDrivers.value(type);
|
||||
if (!driver) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ void InputController::setGamepad(uint32_t type, int index) {
|
|||
if (!type) {
|
||||
type = m_gamepadDriver;
|
||||
}
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (!driver) {
|
||||
return;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ void InputController::setPreferredGamepad(uint32_t type, int index) {
|
|||
if (!type) {
|
||||
type = m_gamepadDriver;
|
||||
}
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (!driver) {
|
||||
return;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ InputMapper InputController::mapper(InputSource* source) {
|
|||
}
|
||||
|
||||
void InputController::setSensorDriver(uint32_t type) {
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (!driver || !driver->supportsSensors()) {
|
||||
return;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ void InputController::setSensorDriver(uint32_t type) {
|
|||
|
||||
|
||||
mRumble* InputController::rumble() {
|
||||
auto& driver = m_inputDrivers.value(m_sensorDriver);
|
||||
auto driver = m_inputDrivers.value(m_sensorDriver);
|
||||
if (driver) {
|
||||
return driver->rumble();
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ mRumble* InputController::rumble() {
|
|||
}
|
||||
|
||||
mRotationSource* InputController::rotationSource() {
|
||||
auto& driver = m_inputDrivers.value(m_sensorDriver);
|
||||
auto driver = m_inputDrivers.value(m_sensorDriver);
|
||||
if (driver) {
|
||||
return driver->rotationSource();
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ int InputController::mapKeyboard(int key) const {
|
|||
}
|
||||
|
||||
void InputController::update() {
|
||||
for (auto& driver : m_inputDrivers) {
|
||||
for (auto driver : m_inputDrivers) {
|
||||
QString profile = profileForType(driver->type());
|
||||
driver->update();
|
||||
QString newProfile = profileForType(driver->type());
|
||||
|
@ -359,7 +359,7 @@ int InputController::pollEvents() {
|
|||
}
|
||||
|
||||
Gamepad* InputController::gamepad(uint32_t type) {
|
||||
auto& driver = m_inputDrivers.value(type);
|
||||
auto driver = m_inputDrivers.value(type);
|
||||
if (!driver) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ Gamepad* InputController::gamepad(uint32_t type) {
|
|||
|
||||
QList<Gamepad*> InputController::gamepads() {
|
||||
QList<Gamepad*> pads;
|
||||
for (auto& driver : m_inputDrivers) {
|
||||
for (auto driver : m_inputDrivers) {
|
||||
if (!driver->supportsGamepads()) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue