From 4bb9a1021066ef96e7b424fe7a3949cbbcfa195c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 7 May 2020 12:22:37 +0300 Subject: Fix code style after merged switch port code --- src/gui/sdlinput.cpp | 4 ++-- src/gui/windows/chatwindow.cpp | 5 +++-- src/gui/windows/logindialog.cpp | 6 +++--- src/logger.cpp | 2 +- src/maingui.cpp | 15 ++++++++++----- src/net/ea/loginhandler.cpp | 6 ++++-- src/progs/manaplus/client.cpp | 3 ++- src/render/renderers.cpp | 2 +- 8 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index c4c7c9741..00c95092e 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -141,11 +141,11 @@ void SDLInput::pushInput(const SDL_Event &event) #ifdef __SWITCH__ // send an enter/select key on keyboard dismiss event bool visible = SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE; - if(visible) + if (visible) { keyboardClosed = false; } - else if(!keyboardClosed) + else if (!keyboardClosed) { simulateKey(KeyValue::ENTER, InputAction::GUI_SELECT2); keyboardClosed = true; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 759764e48..7fc059f5c 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -823,11 +823,12 @@ void ChatWindow::keyPressed(KeyEvent &event) const InputActionT actionId = event.getActionId(); std::string temp; #ifdef __SWITCH__ - if(event.getKey().getValue() == KeyValue::TEXTINPUT) + if (event.getKey().getValue() == KeyValue::TEXTINPUT) { action(ActionEvent(this, "chatinput")); return; - } else + } + else #endif if (actionId == InputAction::GUI_DOWN) { diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 7f36704cb..168b1b76a 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -74,10 +74,11 @@ LoginDialog::LoginDialog(LoginData &data, mUserField(new TextField(this, mLoginData->username, LoseFocusOnTab_true, nullptr, std::string(), false)), mPassField(new PasswordField(this, mLoginData->password)), - // TRANSLATORS: login dialog label #ifdef SAVE_PASSWORD + // TRANSLATORS: login dialog label mKeepCheck(new CheckBox(this, _("Remember user and password"), #else + // TRANSLATORS: login dialog label mKeepCheck(new CheckBox(this, _("Remember username"), #endif mLoginData->remember, nullptr, std::string())), @@ -209,9 +210,8 @@ void LoginDialog::postInit() #else if (mUserField->getText().empty()) mUserField->requestFocus(); - else { + else mPassField->requestFocus(); - } #endif mLoginButton->setEnabled(canSubmit()); diff --git a/src/logger.cpp b/src/logger.cpp index 90aefaeeb..c3c4cf699 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -121,7 +121,7 @@ void Logger::setLogFile(const std::string &logFilename) closeFile(); #ifdef __SWITCH__ - mLogFile = nullptr; + mLogFile = nullptr; #else mLogFile = fopen(logFilename.c_str(), "wt"); #endif diff --git a/src/maingui.cpp b/src/maingui.cpp index 8b0ddd218..05231134c 100644 --- a/src/maingui.cpp +++ b/src/maingui.cpp @@ -98,7 +98,8 @@ PRAGMA48(GCC diagnostic pop) #include "debug.h" #ifdef __SWITCH__ -extern "C" { +extern "C" +{ #include #include } @@ -106,18 +107,22 @@ extern "C" { #include static int sock = -1; #endif -void nxInit() { +void nxInit() +{ socketInitializeDefault(); #ifndef NDEBUG sock = nxlinkStdio(); - if (sock < 0) { + if (sock < 0) + { socketExit(); } #endif } -void NxDeinit() { +void NxDeinit() +{ #ifndef NDEBUG - if (sock >= 0) { + if (sock >= 0) + { close(sock); sock = -1; } diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 92a2e9f35..2fc177476 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -152,13 +152,15 @@ void LoginHandler::loginOrRegister(LoginData *const data) const loginAccount(data); const bool remember = data->remember; - if (remember) { + if (remember) + { serverConfig.setValue("username", data->username); #ifdef SAVE_PASSWORD serverConfig.setValue("password", data->password); #endif } - else { + else + { serverConfig.setValue("username", ""); #ifdef SAVE_PASSWORD serverConfig.setValue("password", ""); diff --git a/src/progs/manaplus/client.cpp b/src/progs/manaplus/client.cpp index d47404925..349f02b4b 100644 --- a/src/progs/manaplus/client.cpp +++ b/src/progs/manaplus/client.cpp @@ -1645,7 +1645,8 @@ int Client::gameExec() BLOCK_START("Client::gameExec State::ERROR") config.write(); #ifdef SAVE_PASSWORD - if(errorMessage == "Wrong password.") { + if (errorMessage == "Wrong password.") + { serverConfig.setValue("password", ""); serverConfig.write(); } diff --git a/src/render/renderers.cpp b/src/render/renderers.cpp index 40bb550bc..50784c5a2 100644 --- a/src/render/renderers.cpp +++ b/src/render/renderers.cpp @@ -42,7 +42,7 @@ static RenderType getDefault() noexcept2 RenderType intToRenderType(const int mode) noexcept2 { #ifdef __SWITCH__ - return RENDER_GLES2_OPENGL; + return RENDER_GLES2_OPENGL; #endif if (mode < 0 || mode >= RENDER_LAST) return getDefault(); -- cgit v1.2.3-70-g09d2