Qt: auto -> auto& cleanup

This commit is contained in:
Vicki Pfau 2023-03-01 15:52:24 -08:00
parent 5f3ee83bcc
commit 10a3165642
3 changed files with 18 additions and 18 deletions

View File

@ -80,7 +80,7 @@ CoreController::CoreController(mCore* core, QObject* parent)
m_threadContext.resetCallback = [](mCoreThread* context) {
CoreController* controller = static_cast<CoreController*>(context->userData);
for (auto action : controller->m_resetActions) {
for (auto& action : controller->m_resetActions) {
action();
}

View File

@ -151,7 +151,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;
}
@ -185,7 +185,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);
}
@ -201,7 +201,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 {};
}
@ -209,7 +209,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;
}
@ -220,13 +220,13 @@ QStringList InputController::connectedGamepads(uint32_t type) const {
if (!type) {
type = m_gamepadDriver;
}
auto driver = m_inputDrivers.value(type);
auto& driver = m_inputDrivers.value(type);
if (!driver) {
return {};
}
QStringList pads;
for (auto pad : driver->connectedGamepads()) {
for (auto& pad : driver->connectedGamepads()) {
pads.append(pad->visibleName());
}
return pads;
@ -236,7 +236,7 @@ int InputController::gamepadIndex(uint32_t type) const {
if (!type) {
type = m_gamepadDriver;
}
auto driver = m_inputDrivers.value(type);
auto& driver = m_inputDrivers.value(type);
if (!driver) {
return -1;
}
@ -247,7 +247,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;
}
@ -265,7 +265,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;
}
@ -299,7 +299,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;
}
@ -308,7 +308,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();
}
@ -316,7 +316,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();
}
@ -341,7 +341,7 @@ void InputController::update() {
int InputController::pollEvents() {
int activeButtons = 0;
for (auto pad : gamepads()) {
for (auto& pad : gamepads()) {
InputMapper im(mapper(pad));
activeButtons |= im.mapKeys(pad->currentButtons());
activeButtons |= im.mapAxes(pad->currentAxes());
@ -356,7 +356,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;
}
@ -464,7 +464,7 @@ void InputController::testGamepad(uint32_t type) {
}
}
}
for (auto axis : oldAxes) {
for (auto& axis : oldAxes) {
GamepadAxisEvent* event = new GamepadAxisEvent(axis.first, axis.second, false, type, this);
clearPendingEvent(event->platformKey());
sendGamepadEvent(event);

View File

@ -51,7 +51,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
#ifdef M_CORE_GB
m_pageIndex[Page::GB] = 9;
for (auto model : GameBoy::modelList()) {
for (auto& model : GameBoy::modelList()) {
m_ui.gbModel->addItem(GameBoy::modelName(model), model);
m_ui.sgbModel->addItem(GameBoy::modelName(model), model);
m_ui.cgbModel->addItem(GameBoy::modelName(model), model);
@ -350,7 +350,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
QLocale englishLocale("en");
m_ui.languages->addItem(englishLocale.nativeLanguageName(), englishLocale);
QDir ts(":/translations/");
for (auto name : ts.entryList()) {
for (auto& name : ts.entryList()) {
if (!name.endsWith(".qm") || !name.startsWith(binaryName)) {
continue;
}