summaryrefslogtreecommitdiff
path: root/src/gui/whoisonline.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-12 18:50:24 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-12 18:50:24 +0300
commit55dd2a721ec7dfb0966c1e93536096984d78e2e5 (patch)
tree7f797bda90ee4025aa7040f97796e9ff52a6f2d3 /src/gui/whoisonline.cpp
parent00d092dc0f458a3967f26e82655212db1b0bcc59 (diff)
downloadmv-55dd2a721ec7dfb0966c1e93536096984d78e2e5.tar.gz
mv-55dd2a721ec7dfb0966c1e93536096984d78e2e5.tar.bz2
mv-55dd2a721ec7dfb0966c1e93536096984d78e2e5.tar.xz
mv-55dd2a721ec7dfb0966c1e93536096984d78e2e5.zip
Add option to enable/disable grouping friends in online list.
Diffstat (limited to 'src/gui/whoisonline.cpp')
-rw-r--r--src/gui/whoisonline.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index 7c620bdf1..1efa9c22d 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -85,7 +85,8 @@ WhoIsOnline::WhoIsOnline():
mMemoryBuffer(nullptr),
mCurlError(new char[CURL_ERROR_SIZE]),
mAllowUpdate(true),
- mShowLevel(false)
+ mShowLevel(false),
+ mGroupFriends(true)
{
mCurlError[0] = 0;
setWindowName("WhoIsOnline");
@@ -124,12 +125,15 @@ WhoIsOnline::WhoIsOnline():
download();
config.addListener("updateOnlineList", this);
+ config.addListener("groupFriends", this);
mUpdateOnlineList = config.getBoolValue("updateOnlineList");
+ mGroupFriends = config.getBoolValue("groupFriends");
}
WhoIsOnline::~WhoIsOnline()
{
config.removeListener("updateOnlineList", this);
+ config.removeListener("groupFriends", this);
if (mThread && SDL_GetThreadID(mThread))
SDL_WaitThread(mThread, nullptr);
@@ -282,7 +286,10 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list)
case PlayerRelation::FRIEND:
player->setText("2");
- friends.push_back(player);
+ if (mGroupFriends)
+ friends.push_back(player);
+ else
+ neutral.push_back(player);
break;
case PlayerRelation::DISREGARDED:
@@ -425,7 +432,10 @@ void WhoIsOnline::loadWebList()
case PlayerRelation::FRIEND:
player->setText("2");
- friends.push_back(player);
+ if (mGroupFriends)
+ friends.push_back(player);
+ else
+ neutral.push_back(player);
break;
case PlayerRelation::DISREGARDED:
@@ -716,6 +726,8 @@ void WhoIsOnline::optionChanged(const std::string &name)
{
if (name == "updateOnlineList")
mUpdateOnlineList = config.getBoolValue("updateOnlineList");
+ else if (name == "groupFriends")
+ mGroupFriends = config.getBoolValue("groupFriends");
}
void OnlinePlayer::setText(std::string color)