Implemented low task EXT-1156(Implement option to show/hide avatar icon in the friend list)
--HG-- branch : product-enginemeow-7.2.2
parent
cc7d1c8f69
commit
ff37134a40
|
|
@ -7731,6 +7731,39 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</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>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "llcallingcard.h" // for LLAvatarTracker
|
||||
#include "llcachename.h"
|
||||
#include "llvoiceclient.h"
|
||||
#include "llviewercontrol.h" // for gSavedSettings
|
||||
|
||||
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.
|
||||
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)
|
||||
{
|
||||
LLStringUtil::toUpper(haystack);
|
||||
|
|
@ -73,6 +89,12 @@ LLAvatarList::LLAvatarList(const Params& p)
|
|||
setComparator(&NAME_COMPARATOR);
|
||||
}
|
||||
|
||||
void LLAvatarList::setShowIcons(std::string param_name)
|
||||
{
|
||||
mIconParamName= param_name;
|
||||
mShowIcons = gSavedSettings.getBOOL(mIconParamName);
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLAvatarList::draw()
|
||||
{
|
||||
|
|
@ -202,6 +224,7 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is
|
|||
item->setContextMenu(mContextMenu);
|
||||
|
||||
item->childSetVisible("info_btn", false);
|
||||
item->setAvatarIconVisible(mShowIcons);
|
||||
|
||||
addItem(item, id, pos);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,11 @@ public:
|
|||
|
||||
void setContextMenu(LLAvatarListItem::ContextMenu* menu) { mContextMenu = menu; }
|
||||
|
||||
void toggleIcons();
|
||||
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);
|
||||
|
||||
protected:
|
||||
|
|
@ -86,7 +90,9 @@ private:
|
|||
|
||||
bool mIgnoreOnlineStatus;
|
||||
bool mDirty;
|
||||
bool mShowIcons;
|
||||
|
||||
std::string mIconParamName;
|
||||
std::string mNameFilter;
|
||||
uuid_vector_t mIDs;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "llavatariconctrl.h"
|
||||
#include "llbutton.h"
|
||||
|
||||
S32 LLAvatarListItem::sIconWidth = 0;
|
||||
|
||||
LLAvatarListItem::LLAvatarListItem()
|
||||
: LLPanel(),
|
||||
|
|
@ -55,6 +56,12 @@ LLAvatarListItem::LLAvatarListItem()
|
|||
mOnlineStatus(E_UNKNOWN)
|
||||
{
|
||||
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()
|
||||
|
|
@ -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));
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarId));
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public:
|
|||
void setOnline(bool online);
|
||||
void setName(const std::string& name);
|
||||
void setAvatarId(const LLUUID& id, bool ignore_status_changes = false);
|
||||
void setAvatarIconVisible(bool visible);
|
||||
|
||||
const LLUUID& getAvatarId() const;
|
||||
const std::string getAvatarName() const;
|
||||
|
|
@ -87,7 +88,7 @@ private:
|
|||
|
||||
void onNameCache(const std::string& first_name, const std::string& last_name);
|
||||
|
||||
LLAvatarIconCtrl*mAvatarIcon;
|
||||
LLAvatarIconCtrl* mAvatarIcon;
|
||||
LLTextBox* mAvatarName;
|
||||
LLTextBox* mStatus;
|
||||
|
||||
|
|
@ -98,6 +99,7 @@ private:
|
|||
|
||||
LLUUID mAvatarId;
|
||||
EOnlineStatus mOnlineStatus;
|
||||
static S32 sIconWidth; // icon width + padding
|
||||
};
|
||||
|
||||
#endif //LL_LLAVATARLISTITEM_H
|
||||
|
|
|
|||
|
|
@ -413,13 +413,17 @@ BOOL LLPanelPeople::postBuild()
|
|||
mOnlineFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_online");
|
||||
mAllFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_all");
|
||||
mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online"));
|
||||
mOnlineFriendList->setShowIcons("FriendsListShowIcons");
|
||||
mAllFriendList->setNoItemsCommentText(getString("no_friends"));
|
||||
mAllFriendList->setShowIcons("FriendsListShowIcons");
|
||||
|
||||
mNearbyList = getChild<LLPanel>(NEARBY_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
|
||||
mNearbyList->setNoItemsCommentText(getString("no_one_near"));
|
||||
mNearbyList->setShowIcons("NearbyListShowIcons");
|
||||
|
||||
mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
|
||||
mRecentList->setNoItemsCommentText(getString("no_people"));
|
||||
mRecentList->setShowIcons("RecentListShowIcons");
|
||||
|
||||
mGroupList = getChild<LLGroupList>("group_list");
|
||||
mGroupList->setNoItemsCommentText(getString("no_groups"));
|
||||
|
|
@ -963,6 +967,8 @@ void LLPanelPeople::onFriendsViewSortMenuItemClicked(const LLSD& userdata)
|
|||
}
|
||||
else if (chosen_item == "view_icons")
|
||||
{
|
||||
mAllFriendList->toggleIcons();
|
||||
mOnlineFriendList->toggleIcons();
|
||||
}
|
||||
else if (chosen_item == "organize_offline")
|
||||
{
|
||||
|
|
@ -992,6 +998,7 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata)
|
|||
}
|
||||
else if (chosen_item == "view_icons")
|
||||
{
|
||||
mNearbyList->toggleIcons();
|
||||
}
|
||||
else if (chosen_item == "sort_distance")
|
||||
{
|
||||
|
|
@ -1011,7 +1018,7 @@ void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata)
|
|||
}
|
||||
else if (chosen_item == "view_icons")
|
||||
{
|
||||
// *TODO: implement showing/hiding icons
|
||||
mRecentList->toggleIcons();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,14 @@
|
|||
parameter="sort_status" />
|
||||
</menu_item_check>
|
||||
<menu_item_separator layout="topleft" />
|
||||
<menu_item_call name="view_icons" label="View People Icons">
|
||||
<menu_item_call.on_click function="People.Friends.ViewSort.Action" userdata="view_icons" />
|
||||
</menu_item_call>
|
||||
<menu_item_check name="view_icons" label="View People Icons">
|
||||
<menu_item_check.on_click
|
||||
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.on_click function="People.Friends.ViewSort.Action" userdata="organize_offline" />
|
||||
</menu_item_call>
|
||||
|
|
|
|||
|
|
@ -12,9 +12,14 @@
|
|||
<menu_item_call.on_click function="People.Nearby.ViewSort.Action" userdata="sort_distance" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator layout="topleft" />
|
||||
<menu_item_call name="view_icons" label="View People Icons">
|
||||
<menu_item_call.on_click function="People.Nearby.ViewSort.Action" userdata="view_icons" />
|
||||
</menu_item_call>
|
||||
<menu_item_check name="view_icons" label="View People Icons">
|
||||
<menu_item_check.on_click
|
||||
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_call name="show_blocked_list" label="Show Blocked Residents & Objects">
|
||||
<menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
|
||||
|
|
|
|||
|
|
@ -23,9 +23,14 @@
|
|||
parameter="sort_name" />
|
||||
</menu_item_check>
|
||||
<menu_item_separator layout="topleft" />
|
||||
<menu_item_call name="view_icons" label="View People Icons">
|
||||
<menu_item_call.on_click function="People.Recent.ViewSort.Action" userdata="view_icons" />
|
||||
</menu_item_call>
|
||||
<menu_item_check name="view_icons" label="View People Icons">
|
||||
<menu_item_check.on_click
|
||||
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_call name="show_blocked_list" label="Show Blocked Residents & Objects">
|
||||
<menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue