mirror of https://github.com/mgba-emu/mgba.git
Qt: Remove shared_ptr copies in for loops
This commit is contained in:
parent
5c2a55884b
commit
16fe12cc97
|
@ -36,7 +36,7 @@ InputController::InputController(QWidget* topLevel, QObject* parent)
|
||||||
mInputMapInit(&m_inputMap, &GBAInputInfo);
|
mInputMapInit(&m_inputMap, &GBAInputInfo);
|
||||||
|
|
||||||
connect(&m_gamepadTimer, &QTimer::timeout, [this]() {
|
connect(&m_gamepadTimer, &QTimer::timeout, [this]() {
|
||||||
for (auto driver : m_inputDrivers) {
|
for (auto& driver : m_inputDrivers) {
|
||||||
if (driver->supportsPolling() && driver->supportsGamepads()) {
|
if (driver->supportsPolling() && driver->supportsGamepads()) {
|
||||||
testGamepad(driver->type());
|
testGamepad(driver->type());
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ bool InputController::loadProfile(uint32_t type, const QString& profile) {
|
||||||
|
|
||||||
void InputController::saveConfiguration() {
|
void InputController::saveConfiguration() {
|
||||||
saveConfiguration(KEYBOARD);
|
saveConfiguration(KEYBOARD);
|
||||||
for (auto driver : m_inputDrivers) {
|
for (auto& driver : m_inputDrivers) {
|
||||||
driver->saveConfiguration(m_config);
|
driver->saveConfiguration(m_config);
|
||||||
}
|
}
|
||||||
m_config->write();
|
m_config->write();
|
||||||
|
@ -331,7 +331,7 @@ int InputController::mapKeyboard(int key) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputController::update() {
|
void InputController::update() {
|
||||||
for (auto driver : m_inputDrivers) {
|
for (auto& driver : m_inputDrivers) {
|
||||||
QString profile = profileForType(driver->type());
|
QString profile = profileForType(driver->type());
|
||||||
driver->update();
|
driver->update();
|
||||||
QString newProfile = profileForType(driver->type());
|
QString newProfile = profileForType(driver->type());
|
||||||
|
@ -372,7 +372,7 @@ Gamepad* InputController::gamepad(uint32_t type) {
|
||||||
|
|
||||||
QList<Gamepad*> InputController::gamepads() {
|
QList<Gamepad*> InputController::gamepads() {
|
||||||
QList<Gamepad*> pads;
|
QList<Gamepad*> pads;
|
||||||
for (auto driver : m_inputDrivers) {
|
for (auto& driver : m_inputDrivers) {
|
||||||
if (!driver->supportsGamepads()) {
|
if (!driver->supportsGamepads()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,7 @@ void Window::multiplayerChanged() {
|
||||||
attached = multiplayer->attached();
|
attached = multiplayer->attached();
|
||||||
m_playerId = multiplayer->playerId(m_controller.get());
|
m_playerId = multiplayer->playerId(m_controller.get());
|
||||||
}
|
}
|
||||||
for (auto action : m_nonMpActions) {
|
for (auto& action : m_nonMpActions) {
|
||||||
action->setEnabled(attached < 2);
|
action->setEnabled(attached < 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -848,7 +848,7 @@ void Window::toggleFullScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::gameStarted() {
|
void Window::gameStarted() {
|
||||||
for (auto action : m_gameActions) {
|
for (auto& action : m_gameActions) {
|
||||||
action->setEnabled(true);
|
action->setEnabled(true);
|
||||||
}
|
}
|
||||||
for (auto action = m_platformActions.begin(); action != m_platformActions.end(); ++action) {
|
for (auto action = m_platformActions.begin(); action != m_platformActions.end(); ++action) {
|
||||||
|
@ -929,10 +929,10 @@ void Window::gameStarted() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::gameStopped() {
|
void Window::gameStopped() {
|
||||||
for (auto action : m_platformActions) {
|
for (auto& action : m_platformActions) {
|
||||||
action->setEnabled(true);
|
action->setEnabled(true);
|
||||||
}
|
}
|
||||||
for (auto action : m_gameActions) {
|
for (auto& action : m_gameActions) {
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
}
|
}
|
||||||
setWindowFilePath(QString());
|
setWindowFilePath(QString());
|
||||||
|
@ -1181,11 +1181,11 @@ void Window::updateTitle(float fps) {
|
||||||
MultiplayerController* multiplayer = m_controller->multiplayerController();
|
MultiplayerController* multiplayer = m_controller->multiplayerController();
|
||||||
if (multiplayer && multiplayer->attached() > 1) {
|
if (multiplayer && multiplayer->attached() > 1) {
|
||||||
title += tr(" - Player %1 of %2").arg(m_playerId + 1).arg(multiplayer->attached());
|
title += tr(" - Player %1 of %2").arg(m_playerId + 1).arg(multiplayer->attached());
|
||||||
for (auto action : m_nonMpActions) {
|
for (auto& action : m_nonMpActions) {
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto action : m_nonMpActions) {
|
for (auto& action : m_nonMpActions) {
|
||||||
action->setEnabled(true);
|
action->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1781,7 +1781,7 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
}
|
}
|
||||||
}, "autofire");
|
}, "autofire");
|
||||||
|
|
||||||
for (auto action : m_gameActions) {
|
for (auto& action : m_gameActions) {
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue