From b5ff7aa3a5adf5e03ea1e1190b720158fc4a97a8 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Sun, 7 Apr 2024 21:14:51 +0200 Subject: Fix all alignment warnings/errors. Other addButton sections intentionally left misaligned as a test for future fix in nsiqcppstyle. .. why does it not complain about every such block? --- src/gui/popups/popupmenu.cpp | 2 +- src/gui/windowmanager.cpp | 10 ++++---- src/gui/windowmenu.cpp | 52 +++++++++++++++++++++++------------------- src/gui/windows/buydialog.cpp | 3 ++- src/gui/windows/quitdialog.cpp | 2 +- src/net/download.h | 3 ++- 6 files changed, 41 insertions(+), 31 deletions(-) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 6a73c5fb7..f4d123cb4 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -283,7 +283,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) } else { - mBrowserBox->addRow("/kickguild 'NAME'", + mBrowserBox->addRow("/kickguild 'NAME'", // TRANSLATORS: popup menu item // TRANSLATORS: leave guild _("Leave guild")); diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 79e6cb47c..346013639 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -434,6 +434,7 @@ void WindowManager::setIcon() SDL::getWindowWMInfo(mainGraphics->getWindow(), &pInfo); else SDL::getWindowWMInfo(nullptr, &pInfo); + // Attempt to load icon from .ico file HICON icon = static_cast(LoadImage(nullptr, iconFile.c_str(), @@ -446,6 +447,7 @@ void WindowManager::setIcon() logger->log("icon load error"); icon = LoadIcon(GetModuleHandle(nullptr), "A"); } + if (icon) { #ifdef WIN64 @@ -454,16 +456,16 @@ void WindowManager::setIcon() #else SetClassLongPtr(pInfo.window, #endif // USE_SDL2 - GCLP_HICON, - reinterpret_cast(icon)); + GCLP_HICON, + reinterpret_cast(icon)); #else // WIN64 #ifdef USE_SDL2 SetClassLong(pInfo.info.win.window, #else SetClassLong(pInfo.window, #endif // USE_SDL2 - GCL_HICON, - reinterpret_cast(icon)); + GCL_HICON, + reinterpret_cast(icon)); #endif // WIN64 } #else // WIN32 diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 7cf4980a6..2e1474bd1 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -56,8 +56,9 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : ActionListener(), SelectionListener(), MouseListener(), - mSkin(theme != nullptr ? theme->load("windowmenu.xml", "", - true, Theme::getThemePath()) : nullptr), + mSkin(theme != nullptr + ? theme->load("windowmenu.xml", "", true, Theme::getThemePath()) + : nullptr), mImageSet(nullptr), mPadding(mSkin != nullptr ? mSkin->getPadding() : 1), mSpacing(mSkin != nullptr ? mSkin->getOption("spacing", 3) : 3), @@ -82,42 +83,47 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : // TRANSLATORS: short button name for who is online window. addButton(N_("ONL"), - 13, - // TRANSLATORS: long button name for who is online window. - _("Who is online"), x, h, InputAction::WINDOW_ONLINE, - Visible_true); + 13, + // TRANSLATORS: long button name for who is online window. + _("Who is online"), x, h, InputAction::WINDOW_ONLINE, + Visible_true); + // TRANSLATORS: short button name for help window. addButton(N_("HLP"), - 0, - // TRANSLATORS: long button name for help window. - _("Help"), x, h, InputAction::WINDOW_HELP, - Visible_true); + 0, + // TRANSLATORS: long button name for help window. + _("Help"), x, h, InputAction::WINDOW_HELP, + Visible_true); + // TRANSLATORS: short button name for quests window. addButton(N_("QE"), - 12, - // TRANSLATORS: long button name for quests window. - _("Quests"), x, h, InputAction::WINDOW_QUESTS, - Visible_true); + 12, + // TRANSLATORS: long button name for quests window. + _("Quests"), x, h, InputAction::WINDOW_QUESTS, + Visible_true); + // TRANSLATORS: short button name for kill stats window. addButton(N_("KS"), - 16, - // TRANSLATORS: long button name for kill stats window. - _("Kill stats"), x, h, InputAction::WINDOW_KILLS, - Visible_true); + 16, + // TRANSLATORS: long button name for kill stats window. + _("Kill stats"), x, h, InputAction::WINDOW_KILLS, + Visible_true); + addButton(":-)", 6, // TRANSLATORS: long button name for emotes window. _("Smilies"), x, h, InputAction::WINDOW_EMOTE_SHORTCUT, Visible_true); + // TRANSLATORS: short button name for chat window. addButton(N_("CH"), - 20, - // TRANSLATORS: longt button name for chat window. - _("Chat"), x, h, InputAction::WINDOW_CHAT, + 20, + // TRANSLATORS: longt button name for chat window. + _("Chat"), x, h, InputAction::WINDOW_CHAT, #ifdef ANDROID - Visible_true); + Visible_true); #else // ANDROID - Visible_false); + Visible_false); #endif // ANDROID // TRANSLATORS: short button name for status window. diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index c1d6ba958..b17064e45 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -510,7 +510,8 @@ void BuyDialog::sort() std::sort(items.begin(), items.end(), itemWeightBuySorter); break; case 5: - std::sort(items.begin(), items.end(), itemWeightTimesAmountBuySorter); + std::sort(items.begin(), items.end(), + itemWeightTimesAmountBuySorter); break; case 6: std::sort(items.begin(), items.end(), itemAmountBuySorter); diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index 66d330af9..d1ceb1ad9 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -90,7 +90,7 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe) : { // Only added if we are connected to an accountserver or gameserver placeOption(placer, mLogoutQuit); - if(!settings.options.uniqueSession) + if (!settings.options.uniqueSession) { // Only shown if we are not in a uniqueSession placeOption(placer, mSwitchAccountServer); diff --git a/src/net/download.h b/src/net/download.h index 93593a15f..86dcb1cc2 100644 --- a/src/net/download.h +++ b/src/net/download.h @@ -96,7 +96,8 @@ class Download final static size_t writeFunction(void *ptr, size_t size, size_t nmemb, void *stream); - static void prepareForm(Download *const d, const std::string &fileName); + static void prepareForm(Download *const d, + const std::string &fileName); static unsigned long fadler32(FILE *const file) A_WARN_UNUSED; -- cgit v1.2.3-60-g2f50