mirror of https://github.com/mgba-emu/mgba.git
Qt: auto -> auto& cleanup
This commit is contained in:
parent
5f3ee83bcc
commit
10a3165642
|
@ -80,7 +80,7 @@ CoreController::CoreController(mCore* core, QObject* parent)
|
||||||
|
|
||||||
m_threadContext.resetCallback = [](mCoreThread* context) {
|
m_threadContext.resetCallback = [](mCoreThread* context) {
|
||||||
CoreController* controller = static_cast<CoreController*>(context->userData);
|
CoreController* controller = static_cast<CoreController*>(context->userData);
|
||||||
for (auto action : controller->m_resetActions) {
|
for (auto& action : controller->m_resetActions) {
|
||||||
action();
|
action();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ bool InputController::loadConfiguration(uint32_t type) {
|
||||||
if (!mInputMapLoad(&m_inputMap, type, m_config->input())) {
|
if (!mInputMapLoad(&m_inputMap, type, m_config->input())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ void InputController::saveConfiguration() {
|
||||||
|
|
||||||
void InputController::saveConfiguration(uint32_t type) {
|
void InputController::saveConfiguration(uint32_t type) {
|
||||||
mInputMapSave(&m_inputMap, type, m_config->input());
|
mInputMapSave(&m_inputMap, type, m_config->input());
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (driver) {
|
if (driver) {
|
||||||
driver->saveConfiguration(m_config);
|
driver->saveConfiguration(m_config);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ void InputController::saveProfile(uint32_t type, const QString& profile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString InputController::profileForType(uint32_t type) {
|
QString InputController::profileForType(uint32_t type) {
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ QString InputController::profileForType(uint32_t type) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputController::setGamepadDriver(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()) {
|
if (!driver || !driver->supportsGamepads()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -220,13 +220,13 @@ QStringList InputController::connectedGamepads(uint32_t type) const {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = m_gamepadDriver;
|
type = m_gamepadDriver;
|
||||||
}
|
}
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList pads;
|
QStringList pads;
|
||||||
for (auto pad : driver->connectedGamepads()) {
|
for (auto& pad : driver->connectedGamepads()) {
|
||||||
pads.append(pad->visibleName());
|
pads.append(pad->visibleName());
|
||||||
}
|
}
|
||||||
return pads;
|
return pads;
|
||||||
|
@ -236,7 +236,7 @@ int InputController::gamepadIndex(uint32_t type) const {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = m_gamepadDriver;
|
type = m_gamepadDriver;
|
||||||
}
|
}
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ void InputController::setGamepad(uint32_t type, int index) {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = m_gamepadDriver;
|
type = m_gamepadDriver;
|
||||||
}
|
}
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ void InputController::setPreferredGamepad(uint32_t type, int index) {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = m_gamepadDriver;
|
type = m_gamepadDriver;
|
||||||
}
|
}
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ InputMapper InputController::mapper(InputSource* source) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputController::setSensorDriver(uint32_t type) {
|
void InputController::setSensorDriver(uint32_t type) {
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver || !driver->supportsSensors()) {
|
if (!driver || !driver->supportsSensors()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ void InputController::setSensorDriver(uint32_t type) {
|
||||||
|
|
||||||
|
|
||||||
mRumble* InputController::rumble() {
|
mRumble* InputController::rumble() {
|
||||||
auto driver = m_inputDrivers.value(m_sensorDriver);
|
auto& driver = m_inputDrivers.value(m_sensorDriver);
|
||||||
if (driver) {
|
if (driver) {
|
||||||
return driver->rumble();
|
return driver->rumble();
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ mRumble* InputController::rumble() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mRotationSource* InputController::rotationSource() {
|
mRotationSource* InputController::rotationSource() {
|
||||||
auto driver = m_inputDrivers.value(m_sensorDriver);
|
auto& driver = m_inputDrivers.value(m_sensorDriver);
|
||||||
if (driver) {
|
if (driver) {
|
||||||
return driver->rotationSource();
|
return driver->rotationSource();
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ void InputController::update() {
|
||||||
|
|
||||||
int InputController::pollEvents() {
|
int InputController::pollEvents() {
|
||||||
int activeButtons = 0;
|
int activeButtons = 0;
|
||||||
for (auto pad : gamepads()) {
|
for (auto& pad : gamepads()) {
|
||||||
InputMapper im(mapper(pad));
|
InputMapper im(mapper(pad));
|
||||||
activeButtons |= im.mapKeys(pad->currentButtons());
|
activeButtons |= im.mapKeys(pad->currentButtons());
|
||||||
activeButtons |= im.mapAxes(pad->currentAxes());
|
activeButtons |= im.mapAxes(pad->currentAxes());
|
||||||
|
@ -356,7 +356,7 @@ int InputController::pollEvents() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Gamepad* InputController::gamepad(uint32_t type) {
|
Gamepad* InputController::gamepad(uint32_t type) {
|
||||||
auto driver = m_inputDrivers.value(type);
|
auto& driver = m_inputDrivers.value(type);
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
return nullptr;
|
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);
|
GamepadAxisEvent* event = new GamepadAxisEvent(axis.first, axis.second, false, type, this);
|
||||||
clearPendingEvent(event->platformKey());
|
clearPendingEvent(event->platformKey());
|
||||||
sendGamepadEvent(event);
|
sendGamepadEvent(event);
|
||||||
|
|
|
@ -51,7 +51,7 @@ SettingsView::SettingsView(ConfigController* controller, InputController* inputC
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
m_pageIndex[Page::GB] = 9;
|
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.gbModel->addItem(GameBoy::modelName(model), model);
|
||||||
m_ui.sgbModel->addItem(GameBoy::modelName(model), model);
|
m_ui.sgbModel->addItem(GameBoy::modelName(model), model);
|
||||||
m_ui.cgbModel->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");
|
QLocale englishLocale("en");
|
||||||
m_ui.languages->addItem(englishLocale.nativeLanguageName(), englishLocale);
|
m_ui.languages->addItem(englishLocale.nativeLanguageName(), englishLocale);
|
||||||
QDir ts(":/translations/");
|
QDir ts(":/translations/");
|
||||||
for (auto name : ts.entryList()) {
|
for (auto& name : ts.entryList()) {
|
||||||
if (!name.endsWith(".qm") || !name.startsWith(binaryName)) {
|
if (!name.endsWith(".qm") || !name.startsWith(binaryName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue