diff options
Diffstat (limited to 'indra/newview/llfloaterbump.cpp')
-rwxr-xr-x | indra/newview/llfloaterbump.cpp | 133 |
1 files changed, 127 insertions, 6 deletions
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp index ad44c509d9..34904cf7ed 100755 --- a/indra/newview/llfloaterbump.cpp +++ b/indra/newview/llfloaterbump.cpp @@ -30,10 +30,17 @@ #include "llsd.h" #include "mean_collision_data.h" +#include "llavataractions.h" #include "llfloaterbump.h" +#include "llfloaterreporter.h" +#include "llmutelist.h" +#include "llpanelblockedlist.h" #include "llscrolllistctrl.h" +#include "lltrans.h" #include "lluictrlfactory.h" #include "llviewermessage.h" +#include "llviewermenu.h" +#include "llviewerobjectlist.h" ///---------------------------------------------------------------------------- /// Class LLFloaterBump @@ -43,6 +50,18 @@ LLFloaterBump::LLFloaterBump(const LLSD& key) : LLFloater(key) { + mCommitCallbackRegistrar.add("Avatar.SendIM", boost::bind(&LLFloaterBump::startIM, this)); + mCommitCallbackRegistrar.add("Avatar.ReportAbuse", boost::bind(&LLFloaterBump::reportAbuse, this)); + mCommitCallbackRegistrar.add("ShowAgentProfile", boost::bind(&LLFloaterBump::showProfile, this)); + mCommitCallbackRegistrar.add("Avatar.InviteToGroup", boost::bind(&LLFloaterBump::inviteToGroup, this)); + mCommitCallbackRegistrar.add("Avatar.Call", boost::bind(&LLFloaterBump::startCall, this)); + mEnableCallbackRegistrar.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall)); + mCommitCallbackRegistrar.add("Avatar.AddFriend", boost::bind(&LLFloaterBump::addFriend, this)); + mEnableCallbackRegistrar.add("Avatar.EnableAddFriend", boost::bind(&LLFloaterBump::enableAddFriend, this)); + mCommitCallbackRegistrar.add("Avatar.Mute", boost::bind(&LLFloaterBump::muteAvatar, this)); + mEnableCallbackRegistrar.add("Avatar.EnableMute", boost::bind(&LLFloaterBump::enableMute, this)); + mCommitCallbackRegistrar.add("PayObject", boost::bind(&LLFloaterBump::payAvatar, this)); + mCommitCallbackRegistrar.add("Tools.LookAtSelection", boost::bind(&LLFloaterBump::zoomInAvatar, this)); } @@ -51,13 +70,25 @@ LLFloaterBump::~LLFloaterBump() { } +BOOL LLFloaterBump::postBuild() +{ + mList = getChild<LLScrollListCtrl>("bump_list"); + mList->setAllowMultipleSelection(false); + mList->setRightMouseDownCallback(boost::bind(&LLFloaterBump::onScrollListRightClicked, this, _1, _2, _3)); + + mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_avatar_other.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + mPopupMenu->setItemVisible(std::string("Normal"), false); + mPopupMenu->setItemVisible(std::string("Always use impostor"), false); + mPopupMenu->setItemVisible(std::string("Never use impostor"), false); + mPopupMenu->setItemVisible(std::string("Impostor seperator"), false); + + return TRUE; +} // virtual void LLFloaterBump::onOpen(const LLSD& key) { - LLScrollListCtrl* list = getChild<LLScrollListCtrl>("bump_list"); - if (!list) - return; - list->deleteAllItems(); + mNames.clear(); + mList->deleteAllItems(); if (gMeanCollisionList.empty()) { @@ -65,7 +96,7 @@ void LLFloaterBump::onOpen(const LLSD& key) LLSD row; row["columns"][0]["value"] = none_detected; row["columns"][0]["font"] = "SansSerifBold"; - list->addElement(row); + mList->addElement(row); } else { @@ -73,7 +104,7 @@ void LLFloaterBump::onOpen(const LLSD& key) iter != gMeanCollisionList.end(); ++iter) { LLMeanCollisionData *mcd = *iter; - add(list, mcd); + add(mList, mcd); } } } @@ -125,4 +156,94 @@ void LLFloaterBump::add(LLScrollListCtrl* list, LLMeanCollisionData* mcd) row["columns"][0]["value"] = text; row["columns"][0]["font"] = "SansSerifBold"; list->addElement(row); + + + mNames[mcd->mPerp] = mcd->mFullName; +} + + +void LLFloaterBump::onScrollListRightClicked(LLUICtrl* ctrl, S32 x, S32 y) +{ + if (!gMeanCollisionList.empty()) + { + LLScrollListItem* item = mList->hitItem(x, y); + if (item && mPopupMenu) + { + mItemUUID = item->getUUID(); + mPopupMenu->buildDrawLabels(); + mPopupMenu->updateParent(LLMenuGL::sMenuContainer); + + std::string mute_msg = (LLMuteList::getInstance()->isMuted(mItemUUID, mNames[mItemUUID])) ? "UnmuteAvatar" : "MuteAvatar"; + mPopupMenu->getChild<LLUICtrl>("Avatar Mute")->setValue(LLTrans::getString(mute_msg)); + mPopupMenu->setItemEnabled(std::string("Zoom In"), (BOOL)gObjectList.findObject(mItemUUID)); + + ((LLContextMenu*)mPopupMenu)->show(x, y); + LLMenuGL::showPopup(ctrl, mPopupMenu, x, y); + } + } +} + + +void LLFloaterBump::startIM() +{ + LLAvatarActions::startIM(mItemUUID); +} + +void LLFloaterBump::startCall() +{ + LLAvatarActions::startCall(mItemUUID); +} + +void LLFloaterBump::reportAbuse() +{ + LLFloaterReporter::showFromAvatar(mItemUUID, "av_name"); +} + +void LLFloaterBump::showProfile() +{ + LLAvatarActions::showProfile(mItemUUID); +} + +void LLFloaterBump::addFriend() +{ + LLAvatarActions::requestFriendshipDialog(mItemUUID); +} + +bool LLFloaterBump::enableAddFriend() +{ + return !LLAvatarActions::isFriend(mItemUUID); +} + +void LLFloaterBump::muteAvatar() +{ + LLMute mute(mItemUUID, mNames[mItemUUID], LLMute::AGENT); + if (LLMuteList::getInstance()->isMuted(mute.mID)) + { + LLMuteList::getInstance()->remove(mute); + } + else + { + LLMuteList::getInstance()->add(mute); + LLPanelBlockedList::showPanelAndSelect(mute.mID); + } +} + +void LLFloaterBump::payAvatar() +{ + LLAvatarActions::pay(mItemUUID); +} + +void LLFloaterBump::zoomInAvatar() +{ + handle_zoom_to_object(mItemUUID); +} + +bool LLFloaterBump::enableMute() +{ + return LLAvatarActions::canBlock(mItemUUID); +} + +void LLFloaterBump::inviteToGroup() +{ + LLAvatarActions::inviteToGroup(mItemUUID); } |