summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs/socialfriendstab.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-18 12:18:44 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-18 14:52:11 +0300
commitbb9ed14fc1bf7dc20f1e951e67bb359c273033a3 (patch)
treec46e7e5708d3a2058233a41a08995e6c861703ea /src/gui/widgets/tabs/socialfriendstab.h
parent10273bc94e90fefcfe3fc215aaaaafe7e0e96bd4 (diff)
downloadmanaverse-bb9ed14fc1bf7dc20f1e951e67bb359c273033a3.tar.gz
manaverse-bb9ed14fc1bf7dc20f1e951e67bb359c273033a3.tar.bz2
manaverse-bb9ed14fc1bf7dc20f1e951e67bb359c273033a3.tar.xz
manaverse-bb9ed14fc1bf7dc20f1e951e67bb359c273033a3.zip
fix code style.
Diffstat (limited to 'src/gui/widgets/tabs/socialfriendstab.h')
-rw-r--r--src/gui/widgets/tabs/socialfriendstab.h37
1 files changed, 6 insertions, 31 deletions
diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h
index 3d65e2678..0a43c6e2f 100644
--- a/src/gui/widgets/tabs/socialfriendstab.h
+++ b/src/gui/widgets/tabs/socialfriendstab.h
@@ -24,15 +24,15 @@
#include "gui/widgets/tabs/socialtab.h"
#include "actormanager.h"
-#include "avatar.h"
-#include "being/actortype.h"
#include "being/playerrelations.h"
#include "gui/models/beingslistmodel.h"
#include "gui/windows/whoisonline.h"
+#include "gui/widgets/tabs/socialfriendsfunctor.h"
+
#include "utils/delete2.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -41,33 +41,6 @@
#include "localconsts.h"
-namespace
-{
- static class SortFriendsFunctor final
- {
- public:
- bool operator() (const Avatar *const m1,
- const Avatar *const m2) const
- {
- if (!m1 || !m2)
- return false;
-
- if (m1->getOnline() != m2->getOnline())
- return m1->getOnline() > m2->getOnline();
-
- if (m1->getName() != m2->getName())
- {
- std::string s1 = m1->getName();
- std::string s2 = m2->getName();
- toLower(s1);
- toLower(s2);
- return s1 < s2;
- }
- return false;
- }
- } friendSorter;
-} // namespace
-
class SocialFriendsTab final : public SocialTab
{
public:
@@ -75,7 +48,8 @@ class SocialFriendsTab final : public SocialTab
std::string name,
const bool showBackground) :
SocialTab(widget),
- mBeings(new BeingsListModel)
+ mBeings(new BeingsListModel),
+ mFriendSorter()
{
createControls(mBeings, showBackground);
@@ -139,7 +113,7 @@ class SocialFriendsTab final : public SocialTab
total ++;
avatars->push_back(ava);
}
- std::sort(avatars->begin(), avatars->end(), friendSorter);
+ std::sort(avatars->begin(), avatars->end(), mFriendSorter);
delete players;
// TRANSLATORS: social window label
@@ -151,6 +125,7 @@ class SocialFriendsTab final : public SocialTab
private:
BeingsListModel *mBeings;
+ SortFriendsFunctor mFriendSorter;
};
#endif // GUI_WIDGETS_TABS_SOCIALFRIENDSTAB_H