Skip to content
Snippets Groups Projects
Commit ff37134a authored by Andrew Dyukov's avatar Andrew Dyukov
Browse files

Implemented low task EXT-1156(Implement option to show/hide avatar icon in the friend list)

--HG--
branch : product-engine
parent cc7d1c8f
Branches
No related tags found
No related merge requests found
...@@ -7731,6 +7731,39 @@ ...@@ -7731,6 +7731,39 @@
<key>Value</key> <key>Value</key>
<integer>1</integer> <integer>1</integer>
</map> </map>
<key>FriendsListShowIcons</key>
<map>
<key>Comment</key>
<string>Show/hide online and all friends icons in the friend list</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>NearbyListShowIcons</key>
<map>
<key>Comment</key>
<string>Show/hide people icons in nearby list</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>RecentListShowIcons</key>
<map>
<key>Comment</key>
<string>Show/hide people icons in recent list</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FriendsSortOrder</key> <key>FriendsSortOrder</key>
<map> <map>
<key>Comment</key> <key>Comment</key>
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "llcallingcard.h" // for LLAvatarTracker #include "llcallingcard.h" // for LLAvatarTracker
#include "llcachename.h" #include "llcachename.h"
#include "llvoiceclient.h" #include "llvoiceclient.h"
#include "llviewercontrol.h" // for gSavedSettings
static LLDefaultChildRegistry::Register<LLAvatarList> r("avatar_list"); static LLDefaultChildRegistry::Register<LLAvatarList> r("avatar_list");
...@@ -45,6 +46,21 @@ static LLDefaultChildRegistry::Register<LLAvatarList> r("avatar_list"); ...@@ -45,6 +46,21 @@ static LLDefaultChildRegistry::Register<LLAvatarList> r("avatar_list");
// Used to limit time spent for avatar list update per frame. // Used to limit time spent for avatar list update per frame.
static const unsigned ADD_LIMIT = 50; static const unsigned ADD_LIMIT = 50;
void LLAvatarList::toggleIcons()
{
// Save the new value for new items to use.
mShowIcons = !mShowIcons;
gSavedSettings.setBOOL(mIconParamName, mShowIcons);
// Show/hide icons for all existing items.
std::vector<LLPanel*> items;
getItems(items);
for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
{
static_cast<LLAvatarListItem*>(*it)->setAvatarIconVisible(mShowIcons);
}
}
static bool findInsensitive(std::string haystack, const std::string& needle_upper) static bool findInsensitive(std::string haystack, const std::string& needle_upper)
{ {
LLStringUtil::toUpper(haystack); LLStringUtil::toUpper(haystack);
...@@ -73,6 +89,12 @@ LLAvatarList::LLAvatarList(const Params& p) ...@@ -73,6 +89,12 @@ LLAvatarList::LLAvatarList(const Params& p)
setComparator(&NAME_COMPARATOR); setComparator(&NAME_COMPARATOR);
} }
void LLAvatarList::setShowIcons(std::string param_name)
{
mIconParamName= param_name;
mShowIcons = gSavedSettings.getBOOL(mIconParamName);
}
// virtual // virtual
void LLAvatarList::draw() void LLAvatarList::draw()
{ {
...@@ -202,6 +224,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is ...@@ -202,6 +224,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is
item->setContextMenu(mContextMenu); item->setContextMenu(mContextMenu);
item->childSetVisible("info_btn", false); item->childSetVisible("info_btn", false);
item->setAvatarIconVisible(mShowIcons);
addItem(item, id, pos); addItem(item, id, pos);
} }
......
...@@ -70,7 +70,11 @@ public: ...@@ -70,7 +70,11 @@ public:
void setContextMenu(LLAvatarListItem::ContextMenu* menu) { mContextMenu = menu; } void setContextMenu(LLAvatarListItem::ContextMenu* menu) { mContextMenu = menu; }
void toggleIcons();
void sortByName(); void sortByName();
void setShowIcons(std::string param_name);
bool getIconsVisible() const { return mShowIcons; }
const std::string getIconParamName() const{return mIconParamName;}
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
protected: protected:
...@@ -86,7 +90,9 @@ private: ...@@ -86,7 +90,9 @@ private:
bool mIgnoreOnlineStatus; bool mIgnoreOnlineStatus;
bool mDirty; bool mDirty;
bool mShowIcons;
std::string mIconParamName;
std::string mNameFilter; std::string mNameFilter;
uuid_vector_t mIDs; uuid_vector_t mIDs;
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "llavatariconctrl.h" #include "llavatariconctrl.h"
#include "llbutton.h" #include "llbutton.h"
S32 LLAvatarListItem::sIconWidth = 0;
LLAvatarListItem::LLAvatarListItem() LLAvatarListItem::LLAvatarListItem()
: LLPanel(), : LLPanel(),
...@@ -55,6 +56,12 @@ LLAvatarListItem::LLAvatarListItem() ...@@ -55,6 +56,12 @@ LLAvatarListItem::LLAvatarListItem()
mOnlineStatus(E_UNKNOWN) mOnlineStatus(E_UNKNOWN)
{ {
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml");
// Remember avatar icon width including its padding from the name text box,
// so that we can hide and show the icon again later.
if (!sIconWidth)
{
sIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft;
}
} }
LLAvatarListItem::~LLAvatarListItem() LLAvatarListItem::~LLAvatarListItem()
...@@ -188,6 +195,21 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes) ...@@ -188,6 +195,21 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes)
gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2, _3)); gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2, _3));
} }
void LLAvatarListItem::setAvatarIconVisible(bool visible)
{
// Already done? Then do nothing.
if (mAvatarIcon->getVisible() == (BOOL)visible)
return;
// Show/hide avatar icon.
mAvatarIcon->setVisible(visible);
// Move the avatar name horizontally by icon size + its distance from the avatar name.
LLRect name_rect = mAvatarName->getRect();
name_rect.mLeft += visible ? sIconWidth : -sIconWidth;
mAvatarName->setRect(name_rect);
}
void LLAvatarListItem::onInfoBtnClick() void LLAvatarListItem::onInfoBtnClick()
{ {
LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarId)); LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarId));
......
...@@ -64,6 +64,7 @@ public: ...@@ -64,6 +64,7 @@ public:
void setOnline(bool online); void setOnline(bool online);
void setName(const std::string& name); void setName(const std::string& name);
void setAvatarId(const LLUUID& id, bool ignore_status_changes = false); void setAvatarId(const LLUUID& id, bool ignore_status_changes = false);
void setAvatarIconVisible(bool visible);
const LLUUID& getAvatarId() const; const LLUUID& getAvatarId() const;
const std::string getAvatarName() const; const std::string getAvatarName() const;
...@@ -98,6 +99,7 @@ private: ...@@ -98,6 +99,7 @@ private:
LLUUID mAvatarId; LLUUID mAvatarId;
EOnlineStatus mOnlineStatus; EOnlineStatus mOnlineStatus;
static S32 sIconWidth; // icon width + padding
}; };
#endif //LL_LLAVATARLISTITEM_H #endif //LL_LLAVATARLISTITEM_H
...@@ -413,13 +413,17 @@ BOOL LLPanelPeople::postBuild() ...@@ -413,13 +413,17 @@ BOOL LLPanelPeople::postBuild()
mOnlineFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_online"); mOnlineFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_online");
mAllFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_all"); mAllFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_all");
mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online")); mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online"));
mOnlineFriendList->setShowIcons("FriendsListShowIcons");
mAllFriendList->setNoItemsCommentText(getString("no_friends")); mAllFriendList->setNoItemsCommentText(getString("no_friends"));
mAllFriendList->setShowIcons("FriendsListShowIcons");
mNearbyList = getChild<LLPanel>(NEARBY_TAB_NAME)->getChild<LLAvatarList>("avatar_list"); mNearbyList = getChild<LLPanel>(NEARBY_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
mNearbyList->setNoItemsCommentText(getString("no_one_near")); mNearbyList->setNoItemsCommentText(getString("no_one_near"));
mNearbyList->setShowIcons("NearbyListShowIcons");
mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list"); mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
mRecentList->setNoItemsCommentText(getString("no_people")); mRecentList->setNoItemsCommentText(getString("no_people"));
mRecentList->setShowIcons("RecentListShowIcons");
mGroupList = getChild<LLGroupList>("group_list"); mGroupList = getChild<LLGroupList>("group_list");
mGroupList->setNoItemsCommentText(getString("no_groups")); mGroupList->setNoItemsCommentText(getString("no_groups"));
...@@ -963,6 +967,8 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata) ...@@ -963,6 +967,8 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata)
} }
else if (chosen_item == "view_icons") else if (chosen_item == "view_icons")
{ {
mAllFriendList->toggleIcons();
mOnlineFriendList->toggleIcons();
} }
else if (chosen_item == "organize_offline") else if (chosen_item == "organize_offline")
{ {
...@@ -992,6 +998,7 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata) ...@@ -992,6 +998,7 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata)
} }
else if (chosen_item == "view_icons") else if (chosen_item == "view_icons")
{ {
mNearbyList->toggleIcons();
} }
else if (chosen_item == "sort_distance") else if (chosen_item == "sort_distance")
{ {
...@@ -1011,7 +1018,7 @@ void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata) ...@@ -1011,7 +1018,7 @@ void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata)
} }
else if (chosen_item == "view_icons") else if (chosen_item == "view_icons")
{ {
// *TODO: implement showing/hiding icons mRecentList->toggleIcons();
} }
} }
......
...@@ -23,9 +23,14 @@ ...@@ -23,9 +23,14 @@
parameter="sort_status" /> parameter="sort_status" />
</menu_item_check> </menu_item_check>
<menu_item_separator layout="topleft" /> <menu_item_separator layout="topleft" />
<menu_item_call name="view_icons" label="View People Icons"> <menu_item_check name="view_icons" label="View People Icons">
<menu_item_call.on_click function="People.Friends.ViewSort.Action" userdata="view_icons" /> <menu_item_check.on_click
</menu_item_call> function="People.Friends.ViewSort.Action"
parameter="view_icons" />
<menu_item_check.on_check
function="CheckControl"
parameter="FriendsListShowIcons" />
</menu_item_check>
<menu_item_call name="organize_offline" label="Organize Offline Friends"> <menu_item_call name="organize_offline" label="Organize Offline Friends">
<menu_item_call.on_click function="People.Friends.ViewSort.Action" userdata="organize_offline" /> <menu_item_call.on_click function="People.Friends.ViewSort.Action" userdata="organize_offline" />
</menu_item_call> </menu_item_call>
......
...@@ -12,9 +12,14 @@ ...@@ -12,9 +12,14 @@
<menu_item_call.on_click function="People.Nearby.ViewSort.Action" userdata="sort_distance" /> <menu_item_call.on_click function="People.Nearby.ViewSort.Action" userdata="sort_distance" />
</menu_item_call> </menu_item_call>
<menu_item_separator layout="topleft" /> <menu_item_separator layout="topleft" />
<menu_item_call name="view_icons" label="View People Icons"> <menu_item_check name="view_icons" label="View People Icons">
<menu_item_call.on_click function="People.Nearby.ViewSort.Action" userdata="view_icons" /> <menu_item_check.on_click
</menu_item_call> function="People.Nearby.ViewSort.Action"
parameter="view_icons" />
<menu_item_check.on_check
function="CheckControl"
parameter="NearbyListShowIcons" />
</menu_item_check>
<menu_item_separator layout="topleft" /> <menu_item_separator layout="topleft" />
<menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects"> <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
<menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" /> <menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
......
...@@ -23,9 +23,14 @@ ...@@ -23,9 +23,14 @@
parameter="sort_name" /> parameter="sort_name" />
</menu_item_check> </menu_item_check>
<menu_item_separator layout="topleft" /> <menu_item_separator layout="topleft" />
<menu_item_call name="view_icons" label="View People Icons"> <menu_item_check name="view_icons" label="View People Icons">
<menu_item_call.on_click function="People.Recent.ViewSort.Action" userdata="view_icons" /> <menu_item_check.on_click
</menu_item_call> function="People.Recent.ViewSort.Action"
parameter="view_icons" />
<menu_item_check.on_check
function="CheckControl"
parameter="RecentListShowIcons" />
</menu_item_check>
<menu_item_separator layout="topleft" /> <menu_item_separator layout="topleft" />
<menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects"> <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
<menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" /> <menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment