summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-14 16:40:47 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-14 16:40:47 +0300
commitb8b4e4c524331b4deb0a6caa8da004430297c98a (patch)
treea2fd6f1db45e76f08c0e5c1b4e57bbb86efba57b /src/gui
parentc28cd5ffb1ca37a3a6d5ee0a73828dcd092db7f1 (diff)
downloadplus-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.gz
plus-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.bz2
plus-b8b4e4c524331b4deb0a6caa8da004430297c98a.tar.xz
plus-b8b4e4c524331b4deb0a6caa8da004430297c98a.zip
Replace static members usage from pointers to direct classes.
clang-tidy warning: readability-static-accessed-through-instance
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popups/popupmenu.cpp2
-rw-r--r--src/gui/shortcut/emoteshortcut.cpp7
-rw-r--r--src/gui/viewport.cpp21
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/popup.cpp4
-rw-r--r--src/gui/widgets/tabs/chat/emulateguildtab.cpp10
-rw-r--r--src/gui/widgets/tabs/setup_audio.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_joystick.cpp5
-rw-r--r--src/gui/widgets/tabs/socialnavigationtab.h8
-rw-r--r--src/gui/widgets/window.cpp4
-rw-r--r--src/gui/windowmanager.cpp2
-rw-r--r--src/gui/windows/socialwindow.cpp4
12 files changed, 35 insertions, 41 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 8b97b7185..9ad23888b 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -2418,7 +2418,7 @@ void PopupMenu::showSkillTypePopup(const SkillInfo *const info)
void PopupMenu::showPopup(int x, int y)
{
- popupManager->hideItemPopup();
+ PopupManager::hideItemPopup();
const int pad2 = 2 * mPadding;
mBrowserBox->setPosition(mPadding, mPadding);
mScrollArea->setPosition(mPadding, mPadding);
diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp
index fb59da96b..8131a11a2 100644
--- a/src/gui/shortcut/emoteshortcut.cpp
+++ b/src/gui/shortcut/emoteshortcut.cpp
@@ -77,13 +77,10 @@ void EmoteShortcut::save() const
void EmoteShortcut::useEmotePlayer(const size_t index) const
{
- if (localPlayer == nullptr)
- return;
-
if (index <= CAST_SIZE(SHORTCUT_EMOTES))
{
if (mEmotes[index - 1] > 0)
- localPlayer->emote(mEmotes[index - 1]);
+ LocalPlayer::emote(mEmotes[index - 1]);
}
}
@@ -101,7 +98,7 @@ void EmoteShortcut::useEmote(const size_t index) const
{
case EmoteType::Player:
default:
- localPlayer->emote(emote);
+ LocalPlayer::emote(emote);
break;
case EmoteType::Pet:
petHandler->emote(emote);
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 08d2bfb91..c77232591 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -578,10 +578,10 @@ void Viewport::mousePressed(MouseEvent &event)
}
// If a popup is active, just remove it
- if (popupManager->isPopupMenuVisible())
+ if (PopupManager::isPopupMenuVisible())
{
mPlayerFollowMouse = false;
- popupManager->hidePopupMenu();
+ PopupManager::hidePopupMenu();
return;
}
@@ -940,13 +940,13 @@ void Viewport::mouseMoved(MouseEvent &event)
|| type == ActorType::Mercenary
|| type == ActorType::Pet))
{
- popupManager->hideTextPopup();
+ PopupManager::hideTextPopup();
if (mShowBeingPopup && (beingPopup != nullptr))
beingPopup->show(mMouseX, mMouseY, mHoverBeing);
}
else
{
- popupManager->hideBeingPopup();
+ PopupManager::hideBeingPopup();
}
mHoverItem = actorManager->findItem(x / mMap->getTileWidth(),
@@ -968,7 +968,7 @@ void Viewport::mouseMoved(MouseEvent &event)
{
if (!mHoverSign->getComment().empty())
{
- popupManager->hideBeingPopup();
+ PopupManager::hideBeingPopup();
if (textPopup != nullptr)
{
textPopup->show(mMouseX, mMouseY,
@@ -977,16 +977,19 @@ void Viewport::mouseMoved(MouseEvent &event)
}
else
{
- if (popupManager->isTextPopupVisible())
- popupManager->hideTextPopup();
+ if (PopupManager::isTextPopupVisible())
+ PopupManager::hideTextPopup();
}
gui->setCursorType(Cursor::CURSOR_UP);
return;
}
}
}
- if (!event.isConsumed() && popupManager->isTextPopupVisible())
- popupManager->hideTextPopup();
+ if (!event.isConsumed() &&
+ PopupManager::isTextPopupVisible())
+ {
+ PopupManager::hideTextPopup();
+ }
if (mHoverBeing != nullptr)
{
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index e99230216..9f667caba 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -63,10 +63,7 @@ ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget,
mUnEquipedColor(getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED)),
mUnEquipedColor2(getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED_OUTLINE))
{
- if (itemShortcut[mNumber] != nullptr)
- mMaxItems = itemShortcut[mNumber]->getItemCount();
- else
- mMaxItems = 0;
+ mMaxItems = ItemShortcut::getItemCount();
}
ItemShortcutContainer::~ItemShortcutContainer()
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index bf2b2bb83..0f5c5a31a 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -250,8 +250,8 @@ void Popup::mouseMoved(MouseEvent &event A_UNUSED)
{
if (popupManager != nullptr)
{
- popupManager->hideBeingPopup();
- popupManager->hideTextPopup();
+ PopupManager::hideBeingPopup();
+ PopupManager::hideTextPopup();
}
mRedraw = true;
}
diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.cpp b/src/gui/widgets/tabs/chat/emulateguildtab.cpp
index 4374f6b2c..4e94bf11d 100644
--- a/src/gui/widgets/tabs/chat/emulateguildtab.cpp
+++ b/src/gui/widgets/tabs/chat/emulateguildtab.cpp
@@ -56,16 +56,14 @@ EmulateGuildTab::~EmulateGuildTab()
bool EmulateGuildTab::handleCommand(const std::string &restrict type,
const std::string &restrict args)
{
- if (guildManager == nullptr)
- return false;
if (type == "invite")
- guildManager->invite(args);
+ GuildManager::invite(args);
else if (type == "leave")
- guildManager->leave();
+ GuildManager::leave();
else if (type == "kick")
- guildManager->kick(args);
+ GuildManager::kick(args);
else if (type == "notice")
- guildManager->notice(args);
+ GuildManager::notice(args);
else
return false;
diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp
index 7a37f2d89..bd8097318 100644
--- a/src/gui/widgets/tabs/setup_audio.cpp
+++ b/src/gui/widgets/tabs/setup_audio.cpp
@@ -72,14 +72,14 @@ Setup_Audio::Setup_Audio(const Widget2 *const widget) :
// TRANSLATORS: settings option
new SetupItemSlider(_("Sfx volume"), "", "sfxVolume",
- this, "sfxVolumeEvent", 0, soundManager.getMaxVolume(), 1,
+ this, "sfxVolumeEvent", 0, SoundManager::getMaxVolume(), 1,
150,
OnTheFly_true,
MainConfig_true);
// TRANSLATORS: settings option
new SetupItemSlider(_("Music volume"), "", "musicVolume",
- this, "musicVolumeEvent", 0, soundManager.getMaxVolume(), 1,
+ this, "musicVolumeEvent", 0, SoundManager::getMaxVolume(), 1,
150,
OnTheFly_true,
MainConfig_true);
diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp
index 490205b4b..84cd60521 100644
--- a/src/gui/widgets/tabs/setup_joystick.cpp
+++ b/src/gui/widgets/tabs/setup_joystick.cpp
@@ -164,8 +164,7 @@ void Setup_Joystick::setTempEnabled(const bool sel)
void Setup_Joystick::cancel()
{
- if (joystick != nullptr)
- joystick->setEnabled(mOriginalJoystickEnabled);
+ Joystick::setEnabled(mOriginalJoystickEnabled);
if (mOriginalJoystickEnabled != mJoystickEnabled->isSelected())
setTempEnabled(mOriginalJoystickEnabled);
@@ -178,7 +177,7 @@ void Setup_Joystick::apply()
if (joystick == nullptr)
return;
- config.setValue("joystickEnabled", joystick->isEnabled());
+ config.setValue("joystickEnabled", Joystick::isEnabled());
config.setValue("useInactiveJoystick", mUseInactiveCheckBox->isSelected());
joystick->setUseInactive(mUseInactiveCheckBox->isSelected());
diff --git a/src/gui/widgets/tabs/socialnavigationtab.h b/src/gui/widgets/tabs/socialnavigationtab.h
index 3bd584991..1b049f055 100644
--- a/src/gui/widgets/tabs/socialnavigationtab.h
+++ b/src/gui/widgets/tabs/socialnavigationtab.h
@@ -136,8 +136,8 @@ class SocialNavigationTab final : public SocialTab
->findPortalByTile(x, y);
if (being != nullptr)
{
- being->setName(keyboard.getKeyShortString(
- outfitWindow->keyName(idx)));
+ being->setName(KeyboardConfig::getKeyShortString(
+ OutfitWindow::keyName(idx)));
}
if (specialLayer != nullptr)
@@ -146,8 +146,8 @@ class SocialNavigationTab final : public SocialTab
ava->getX(), ava->getY());
if (portal != nullptr)
{
- portal->setName(keyboard.getKeyShortString(
- outfitWindow->keyName(idx)));
+ portal->setName(KeyboardConfig::getKeyShortString(
+ OutfitWindow::keyName(idx)));
}
}
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 5d48cfad3..9d9385f8d 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -958,8 +958,8 @@ void Window::mouseMoved(MouseEvent &event)
updateResizeHandler(event);
if ((popupManager != nullptr) && !event.isConsumed())
{
- popupManager->hideBeingPopup();
- popupManager->hideTextPopup();
+ PopupManager::hideBeingPopup();
+ PopupManager::hideTextPopup();
}
}
diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp
index 38141720b..978e6ae42 100644
--- a/src/gui/windowmanager.cpp
+++ b/src/gui/windowmanager.cpp
@@ -322,7 +322,7 @@ void WindowManager::resizeVideo(int actualWidth,
#ifndef DYECMD
Game *const game = Game::instance();
if (game != nullptr)
- game->videoResized(width, height);
+ Game::videoResized(width, height);
#endif // DYECMD
if (gui != nullptr)
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index b3f3317a3..b6b635c1c 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -312,7 +312,7 @@ void SocialWindow::action(const ActionEvent &event)
if (guildManager == nullptr || !GuildManager::getEnableGuildBot())
guildHandler->inviteResponse(mGuildInvited, true);
else
- guildManager->inviteResponse(true);
+ GuildManager::inviteResponse(true);
#else // TMWA_SUPPORT
guildHandler->inviteResponse(mGuildInvited, true);
@@ -332,7 +332,7 @@ void SocialWindow::action(const ActionEvent &event)
if (guildManager == nullptr || !GuildManager::getEnableGuildBot())
guildHandler->inviteResponse(mGuildInvited, false);
else
- guildManager->inviteResponse(false);
+ GuildManager::inviteResponse(false);
#else // TMWA_SUPPORT
guildHandler->inviteResponse(mGuildInvited, false);