diff options
Diffstat (limited to 'indra/newview')
26 files changed, 422 insertions, 92 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp index 65a2b8b5e6..7b2dc02864 100644 --- a/indra/newview/llavatarlist.cpp +++ b/indra/newview/llavatarlist.cpp @@ -79,6 +79,8 @@ static const LLFlatListView::ItemReverseComparator REVERSE_NAME_COMPARATOR(NAME_ LLAvatarList::Params::Params() : ignore_online_status("ignore_online_status", false) , show_last_interaction_time("show_last_interaction_time", false) +, show_info_btn("show_info_btn", true) +, show_profile_btn("show_profile_btn", true) { } @@ -89,6 +91,9 @@ LLAvatarList::LLAvatarList(const Params& p) , mContextMenu(NULL) , mDirty(true) // to force initial update , mLITUpdateTimer(NULL) +, mShowIcons(true) +, mShowInfoBtn(p.show_info_btn) +, mShowProfileBtn(p.show_profile_btn) { setCommitOnSelectionChange(true); @@ -253,6 +258,8 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is item->childSetVisible("info_btn", false); item->setAvatarIconVisible(mShowIcons); + item->setShowInfoBtn(mShowInfoBtn); + item->setShowProfileBtn(mShowProfileBtn); addItem(item, id, pos); } diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h index 8f2f0249a6..51d3760d39 100644 --- a/indra/newview/llavatarlist.h +++ b/indra/newview/llavatarlist.h @@ -59,6 +59,8 @@ public: { Optional<bool> ignore_online_status; // show all items as online Optional<bool> show_last_interaction_time; // show most recent interaction time. *HACK: move this to a derived class + Optional<bool> show_info_btn; + Optional<bool> show_profile_btn; Params(); }; @@ -96,6 +98,8 @@ private: bool mShowLastInteractionTime; bool mDirty; bool mShowIcons; + bool mShowInfoBtn; + bool mShowProfileBtn; LLTimer* mLITUpdateTimer; // last interaction time update timer std::string mIconParamName; diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 8464430501..a7ac14c948 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -42,8 +42,6 @@ #include "llavatariconctrl.h" #include "llbutton.h" -S32 LLAvatarListItem::sIconWidth = 0; - LLAvatarListItem::LLAvatarListItem() : LLPanel(), mAvatarIcon(NULL), @@ -53,15 +51,17 @@ LLAvatarListItem::LLAvatarListItem() mInfoBtn(NULL), mProfileBtn(NULL), mContextMenu(NULL), - mOnlineStatus(E_UNKNOWN) + mOnlineStatus(E_UNKNOWN), + mShowInfoBtn(true), + mShowProfileBtn(true) { 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; - } + + mIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft; + mInfoBtnWidth = mInfoBtn->getRect().mRight - mSpeakingIndicator->getRect().mRight; + mProfileBtnWidth = mProfileBtn->getRect().mRight - mInfoBtn->getRect().mRight; } LLAvatarListItem::~LLAvatarListItem() @@ -116,8 +116,8 @@ BOOL LLAvatarListItem::postBuild() void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask) { childSetVisible("hovered_icon", true); - mInfoBtn->setVisible(true); - mProfileBtn->setVisible(true); + mInfoBtn->setVisible(mShowInfoBtn); + mProfileBtn->setVisible(mShowProfileBtn); LLPanel::onMouseEnter(x, y, mask); } @@ -202,6 +202,34 @@ void LLAvatarListItem::setLastInteractionTime(const std::string& val) mLastInteractionTime->setValue(val); } +void LLAvatarListItem::setShowInfoBtn(bool show) +{ + // Already done? Then do nothing. + if(mShowInfoBtn == show) + return; + mShowInfoBtn = show; + S32 width_delta = show ? - mInfoBtnWidth : mInfoBtnWidth; + + //Translating speaking indicator + mSpeakingIndicator->translate(width_delta, 0); + //Reshaping avatar name + mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight()); +} + +void LLAvatarListItem::setShowProfileBtn(bool show) +{ + // Already done? Then do nothing. + if(mShowProfileBtn == show) + return; + mShowProfileBtn = show; + S32 width_delta = show ? - mProfileBtnWidth : mProfileBtnWidth; + + //Translating speaking indicator + mSpeakingIndicator->translate(width_delta, 0); + //Reshaping avatar name + mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight()); +} + void LLAvatarListItem::setAvatarIconVisible(bool visible) { // Already done? Then do nothing. @@ -213,7 +241,7 @@ void LLAvatarListItem::setAvatarIconVisible(bool 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; + name_rect.mLeft += visible ? mIconWidth : -mIconWidth; mAvatarName->setRect(name_rect); } diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 10c0b17005..cd7a85c3dc 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -64,6 +64,9 @@ public: void setName(const std::string& name); void setAvatarId(const LLUUID& id, bool ignore_status_changes = false); void setLastInteractionTime(const std::string& val); + //Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly + void setShowProfileBtn(bool hide); + void setShowInfoBtn(bool hide); void setAvatarIconVisible(bool visible); const LLUUID& getAvatarId() const; @@ -99,7 +102,13 @@ private: LLUUID mAvatarId; EOnlineStatus mOnlineStatus; - static S32 sIconWidth; // icon width + padding + //Flag indicating that info/profile button shouldn't be shown at all. + //Speaker indicator and avatar name coords are translated accordingly + bool mShowInfoBtn; + bool mShowProfileBtn; + S32 mIconWidth; // icon width + padding + S32 mInfoBtnWidth; //info btn width + padding + S32 mProfileBtnWidth; //profile btn width + padding }; #endif //LL_LLAVATARLISTITEM_H diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 7a81d0c4a1..e8812d87ee 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -62,7 +62,6 @@ #include "llviewerwindow.h" #include "llvoavatar.h" #include "llimview.h" -#include "llimpanel.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -719,18 +718,8 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) // If there's an open IM session with this agent, send a notification there too. LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); - LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); - if (floater) - { - std::string notifyMsg = notification->getMessage(); - if (!notifyMsg.empty()) - { - floater->addHistoryLine(notifyMsg,LLUIColorTable::instance().getColor("SystemChatColor")); - } - } - - //*TODO instead of adding IM message about online/offline status - //do something like graying avatar icon on messages from a user that went offline, and make it colored when online. + std::string notify_msg = notification->getMessage(); + LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg); } mModifyMask |= LLFriendObserver::ONLINE; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index b21df87093..dee86f4a22 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -51,6 +51,7 @@ #include "llviewerwindow.h" #include "llvoicechannel.h" #include "lltransientfloatermgr.h" +#include "llinventorymodel.h" @@ -265,7 +266,7 @@ void LLIMFloater::draw() } } - LLFloater::draw(); + LLTransientDockableFloater::draw(); } @@ -602,6 +603,162 @@ void LLIMFloater::processSessionUpdate(const LLSD& session_update) } } +BOOL LLIMFloater::handleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, EDragAndDropType cargo_type, + void *cargo_data, EAcceptance *accept, + std::string& tooltip_msg) +{ + + if (mDialog == IM_NOTHING_SPECIAL) + { + LLToolDragAndDrop::handleGiveDragAndDrop(mOtherParticipantUUID, mSessionID, drop, + cargo_type, cargo_data, accept); + } + + // handle case for dropping calling cards (and folders of calling cards) onto invitation panel for invites + else if (isInviteAllowed()) + { + *accept = ACCEPT_NO; + + if (cargo_type == DAD_CALLINGCARD) + { + if (dropCallingCard((LLInventoryItem*)cargo_data, drop)) + { + *accept = ACCEPT_YES_MULTI; + } + } + else if (cargo_type == DAD_CATEGORY) + { + if (dropCategory((LLInventoryCategory*)cargo_data, drop)) + { + *accept = ACCEPT_YES_MULTI; + } + } + } + return TRUE; +} + +BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop) +{ + BOOL rv = isInviteAllowed(); + if(rv && item && item->getCreatorUUID().notNull()) + { + if(drop) + { + std::vector<LLUUID> ids; + ids.push_back(item->getCreatorUUID()); + inviteToSession(ids); + } + } + else + { + // set to false if creator uuid is null. + rv = FALSE; + } + return rv; +} + +BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop) +{ + BOOL rv = isInviteAllowed(); + if(rv && category) + { + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + LLUniqueBuddyCollector buddies; + gInventory.collectDescendentsIf(category->getUUID(), + cats, + items, + LLInventoryModel::EXCLUDE_TRASH, + buddies); + S32 count = items.count(); + if(count == 0) + { + rv = FALSE; + } + else if(drop) + { + std::vector<LLUUID> ids; + ids.reserve(count); + for(S32 i = 0; i < count; ++i) + { + ids.push_back(items.get(i)->getCreatorUUID()); + } + inviteToSession(ids); + } + } + return rv; +} + +BOOL LLIMFloater::isInviteAllowed() const +{ + + return ( (IM_SESSION_CONFERENCE_START == mDialog) + || (IM_SESSION_INVITE == mDialog) ); +} + +class LLSessionInviteResponder : public LLHTTPClient::Responder +{ +public: + LLSessionInviteResponder(const LLUUID& session_id) + { + mSessionID = session_id; + } + + void error(U32 statusNum, const std::string& reason) + { + llinfos << "Error inviting all agents to session" << llendl; + //throw something back to the viewer here? + } + +private: + LLUUID mSessionID; +}; + +BOOL LLIMFloater::inviteToSession(const std::vector<LLUUID>& ids) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (!region) + { + return FALSE; + } + + S32 count = ids.size(); + + if( isInviteAllowed() && (count > 0) ) + { + llinfos << "LLIMFloater::inviteToSession() - inviting participants" << llendl; + + std::string url = region->getCapability("ChatSessionRequest"); + + LLSD data; + + data["params"] = LLSD::emptyArray(); + for (int i = 0; i < count; i++) + { + data["params"].append(ids[i]); + } + + data["method"] = "invite"; + data["session-id"] = mSessionID; + LLHTTPClient::post( + url, + data, + new LLSessionInviteResponder( + mSessionID)); + } + else + { + llinfos << "LLIMFloater::inviteToSession -" + << " no need to invite agents for " + << mDialog << llendl; + // successful add, because everyone that needed to get added + // was added. + } + + return TRUE; +} + void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info) { // We may have lost a "stop-typing" packet, don't add it twice diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index d2aac57ee2..f5edb3188a 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -35,11 +35,13 @@ #include "lltransientdockablefloater.h" #include "lllogchat.h" +#include "lltooldraganddrop.h" class LLLineEditor; class LLPanelChatControlPanel; class LLChatHistory; - +class LLInventoryItem; +class LLInventoryCategory; /** * Individual IM window that appears at the bottom of the screen, @@ -90,10 +92,21 @@ public: void processIMTyping(const LLIMInfo* im_info, BOOL typing); void processSessionUpdate(const LLSD& session_update); + BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, EDragAndDropType cargo_type, + void *cargo_data, EAcceptance *accept, + std::string& tooltip_msg); + private: // process focus events to set a currently active session /* virtual */ void onFocusLost(); /* virtual */ void onFocusReceived(); + + BOOL dropCallingCard(LLInventoryItem* item, BOOL drop); + BOOL dropCategory(LLInventoryCategory* category, BOOL drop); + + BOOL isInviteAllowed() const; + BOOL inviteToSession(const std::vector<LLUUID>& agent_ids); static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata ); static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 49fc9d8055..cdcb284cee 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -89,9 +89,6 @@ LLIMMgr* gIMMgr = NULL; const static std::string IM_SEPARATOR(": "); -std::map<LLUUID, LLIMModel::LLIMSession*> LLIMModel::sSessionsMap; - - void toast_callback(const LLSD& msg){ // do not show toast in busy mode or it goes from agent @@ -105,7 +102,13 @@ void toast_callback(const LLSD& msg){ { return; } - + + // Skip toasting for system messages + if (msg["from_id"].asUUID() == LLUUID::null) + { + return; + } + LLSD args; args["MESSAGE"] = msg["message"]; args["TIME"] = msg["time"]; @@ -232,6 +235,12 @@ void LLIMModel::LLIMSession::addMessage(const std::string& from, const LLUUID& f message["index"] = (LLSD::Integer)mMsgs.size(); mMsgs.push_front(message); + + if (mSpeakers && from_id.notNull()) + { + mSpeakers->speakerChatted(from_id); + mSpeakers->setSpeakerTyping(from_id, FALSE); + } } void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata) @@ -252,12 +261,11 @@ void LLIMModel::LLIMSession::chatFromLogFile(LLLogChat::ELogLineType type, const LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const { - return get_if_there(LLIMModel::instance().sSessionsMap, session_id, + return get_if_there(mId2SessionMap, session_id, (LLIMModel::LLIMSession*) NULL); } -//*TODO change name to represent session initialization aspect (IB) -void LLIMModel::updateSessionID(const LLUUID& old_session_id, const LLUUID& new_session_id) +void LLIMModel::processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id) { LLIMSession* session = findIMSession(old_session_id); if (session) @@ -266,8 +274,8 @@ void LLIMModel::updateSessionID(const LLUUID& old_session_id, const LLUUID& new_ if (old_session_id != new_session_id) { - sSessionsMap.erase(old_session_id); - sSessionsMap[new_session_id] = session; + mId2SessionMap.erase(old_session_id); + mId2SessionMap[new_session_id] = session; gIMMgr->notifyObserverSessionIDUpdated(old_session_id, new_session_id); } @@ -316,14 +324,14 @@ void LLIMModel::testMessages() bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids) { - if (is_in_map(sSessionsMap, session_id)) + if (findIMSession(session_id)) { llwarns << "IM Session " << session_id << " already exists" << llendl; return false; } LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids); - sSessionsMap[session_id] = session; + mId2SessionMap[session_id] = session; LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, name, other_participant_id); @@ -333,9 +341,9 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co bool LLIMModel::clearSession(const LLUUID& session_id) { - if (sSessionsMap.find(session_id) == sSessionsMap.end()) return false; - delete (sSessionsMap[session_id]); - sSessionsMap.erase(session_id); + if (mId2SessionMap.find(session_id) == mId2SessionMap.end()) return false; + delete (mId2SessionMap[session_id]); + mId2SessionMap.erase(session_id); return true; } @@ -383,7 +391,6 @@ bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, return true; } -//*TODO rewrite chat history persistence using LLSD serialization (IB) bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) { S32 im_log_option = gSavedPerAccountSettings.getS32("IMLogOptions"); @@ -403,6 +410,23 @@ bool LLIMModel::logToFile(const LLUUID& session_id, const std::string& from, con return false; } +bool LLIMModel::proccessOnlineOfflineNotification( + const LLUUID& session_id, + const std::string& utf8_text) +{ + // Add message to old one floater + LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); + if ( floater ) + { + if ( !utf8_text.empty() ) + { + floater->addHistoryLine(utf8_text, LLUIColorTable::instance().getColor("SystemChatColor")); + } + } + // Add system message to history + return addMessage(session_id, SYSTEM_FROM, LLUUID::null, utf8_text); +} + bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text, bool log2file /* = true */) { LLIMSession* session = findIMSession(session_id); @@ -547,8 +571,7 @@ void LLIMModel::sendLeaveSession(const LLUUID& session_id, const LLUUID& other_p } } - -//*TODO update list of messages in a LLIMSession (IB) +//*TODO this method is better be moved to the LLIMMgr void LLIMModel::sendMessage(const std::string& utf8_text, const LLUUID& im_session_id, const LLUUID& other_participant_id, @@ -1443,14 +1466,6 @@ void LLIMMgr::addMessage( else { floater->addHistoryLine(msg, color, true, other_participant_id, from); // Insert linked name to front of message - - //*TODO consider moving that speaker management stuff into model (IB) - LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(new_session_id); - if (speaker_mgr) - { - speaker_mgr->speakerChatted(gAgentID); - speaker_mgr->setSpeakerTyping(gAgentID, FALSE); - } } LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg); @@ -1516,7 +1531,7 @@ S32 LLIMMgr::getNumberOfUnreadIM() std::map<LLUUID, LLIMModel::LLIMSession*>::iterator it; S32 num = 0; - for(it = LLIMModel::sSessionsMap.begin(); it != LLIMModel::sSessionsMap.end(); ++it) + for(it = LLIMModel::getInstance()->mId2SessionMap.begin(); it != LLIMModel::getInstance()->mId2SessionMap.end(); ++it) { num += (*it).second->mNumUnread; } @@ -2013,7 +2028,7 @@ void LLIMMgr::noteOfflineUsers( { const LLRelationship* info = NULL; LLAvatarTracker& at = LLAvatarTracker::instance(); - LLIMModel* im_model = LLIMModel::getInstance(); + LLIMModel& im_model = LLIMModel::instance(); for(S32 i = 0; i < count; ++i) { info = at.getBuddyInfo(ids.get(i)); @@ -2024,13 +2039,7 @@ void LLIMMgr::noteOfflineUsers( LLUIString offline = LLTrans::getString("offline_message"); offline.setArg("[FIRST]", first); offline.setArg("[LAST]", last); - - if (floater) - { - floater->addHistoryLine(offline, LLUIColorTable::instance().getColor("SystemChatColor")); - } - - im_model->addMessage(session_id, SYSTEM_FROM, LLUUID::null, offline); + im_model.proccessOnlineOfflineNotification(session_id, offline); } } } @@ -2122,7 +2131,7 @@ public: { session_id = body["session_id"].asUUID(); - LLIMModel::getInstance()->updateSessionID(temp_session_id, session_id); + LLIMModel::getInstance()->processSessionInitializedReply(temp_session_id, session_id); LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id); if (speaker_mgr) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index d0bd594df1..f986d9dcdb 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -92,8 +92,8 @@ public: void resetActiveSessionID() { mActiveSessionID.setNull(); } LLUUID getActiveSessionID() { return mActiveSessionID; } - //*TODO make it non-static as LLIMMOdel is a singleton (IB) - static std::map<LLUUID, LLIMSession*> sSessionsMap; //mapping session_id to session + /** Session id to session object */ + std::map<LLUUID, LLIMSession*> mId2SessionMap; typedef boost::signals2::signal<void(const LLSD&)> session_signal_t; typedef boost::function<void(const LLSD&)> session_callback_t; @@ -109,7 +109,7 @@ public: /** * Rebind session data to a new session id. */ - void updateSessionID(const LLUUID& old_session_id, const LLUUID& new_session_id); + void processSessionInitializedReply(const LLUUID& old_session_id, const LLUUID& new_session_id); boost::signals2::connection addNewMsgCallback( session_callback_t cb ) { return mNewMsgSignal.connect(cb); } boost::signals2::connection addNoUnreadMsgsCallback( session_callback_t cb ) { return mNoUnreadMsgsSignal.connect(cb); } @@ -136,7 +136,12 @@ public: * It sends new message signal for each added message. */ bool addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& other_participant_id, const std::string& utf8_text, bool log2file = true); - + + /** + * Add a system message to an IM Model + */ + bool proccessOnlineOfflineNotification(const LLUUID& session_id, const std::string& utf8_text); + /** * Get a session's name. * For a P2P chat - it's an avatar's name, diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index 091346d3b4..0b07dd4f21 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -133,6 +133,33 @@ public: } }; +// Returns true if the given inventory item is a landmark pointing to the current parcel. +// Used to find out if there is at least one landmark from current parcel. +class LLFistAgentParcelLandmark : public LLInventoryCollectFunctor +{ +private: + bool mFounded;// to avoid unnecessary check + +public: + LLFistAgentParcelLandmark(): mFounded(false){} + + /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) + { + if (mFounded || !item || item->getType() != LLAssetType::AT_LANDMARK) + return false; + + LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID()); + if (!landmark) // the landmark not been loaded yet + return false; + + LLVector3d landmark_global_pos; + if (!landmark->getGlobalPos(landmark_global_pos)) + return false; + mFounded = LLViewerParcelMgr::getInstance()->inAgentParcel(landmark_global_pos); + return mFounded; + } +}; + static void fetch_landmarks(LLInventoryModel::cat_array_t& cats, LLInventoryModel::item_array_t& items, LLInventoryCollectFunctor& add) @@ -172,6 +199,16 @@ bool LLLandmarkActions::landmarkAlreadyExists() return findLandmarkForAgentPos() != NULL; } +//static +bool LLLandmarkActions::hasParcelLandmark() +{ + LLFistAgentParcelLandmark get_first_agent_landmark; + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + fetch_landmarks(cats, items, get_first_agent_landmark); + return !items.empty(); + +} // *TODO: This could be made more efficient by only fetching the FIRST // landmark that meets the criteria diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h index 32f05e702b..312426cab0 100644 --- a/indra/newview/lllandmarkactions.h +++ b/indra/newview/lllandmarkactions.h @@ -50,9 +50,14 @@ public: */ static LLInventoryModel::item_array_t fetchLandmarksByName(std::string& name, BOOL if_use_substring); /** - * @brief Checks whether landmark exists for current parcel. + * @brief Checks whether landmark exists for current agent position. */ static bool landmarkAlreadyExists(); + + /** + * @brief Checks whether landmark exists for current parcel. + */ + static bool hasParcelLandmark(); /** * @brief Searches landmark for global position. diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 00f12ae2eb..8fe317a292 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -294,6 +294,11 @@ void LLLocationInputCtrl::hideList() BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, MASK mask) { + + if(mAddLandmarkBtn->parentPointInView(x,y)) + { + updateAddLandmarkTooltip(); + } // Let the buttons show their tooltips. if (LLUICtrl::handleToolTip(x, y, mask)) { @@ -602,11 +607,12 @@ void LLLocationInputCtrl::enableAddLandmarkButton(bool val) // depending on whether current parcel has been landmarked. void LLLocationInputCtrl::updateAddLandmarkButton() { - bool landmark_exists = LLLandmarkActions::landmarkAlreadyExists(); - enableAddLandmarkButton(!landmark_exists); - + enableAddLandmarkButton(LLLandmarkActions::hasParcelLandmark()); +} +void LLLocationInputCtrl::updateAddLandmarkTooltip() +{ std::string tooltip; - if(landmark_exists) + if(LLLandmarkActions::landmarkAlreadyExists()) { tooltip = mEditLandmarkTooltip; } diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index c74a294ca3..44dc0cb251 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -107,6 +107,7 @@ private: bool findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter); void setText(const LLStringExplicit& text); void updateAddLandmarkButton(); + void updateAddLandmarkTooltip(); void updateContextMenu(); void updateWidgetlayout(); void changeLocationPresentation(); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index 957513e154..8a8ad9d073 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -262,8 +262,9 @@ void LLNearbyChatScreenChannel::showToastsBottom() toast_rect.setLeftTopAndSize(getRect().mLeft , toast_top, toast_rect.getWidth() ,toast_rect.getHeight()); toast->setRect(toast_rect); - + toast->setIsHidden(false); toast->setVisible(TRUE); + bottom = toast->getRect().mTop; } } diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 48a93f0d42..c9598a2576 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -184,9 +184,9 @@ void LLLandmarksPanel::updateVerbs() if (!isTabVisible()) return; - BOOL enabled = isLandmarkSelected(); - mTeleportBtn->setEnabled(enabled); - mShowOnMapBtn->setEnabled(enabled); + bool landmark_selected = isLandmarkSelected(); + mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport")); + mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map")); // TODO: mantipov: Uncomment when mShareBtn is supported // Share button should be enabled when neither a folder nor a landmark is selected diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 5af27a5ec1..34644cfe42 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -54,6 +54,7 @@ #include "llaccordionctrltab.h" #include "llagent.h" #include "llagentui.h" +#include "llappviewer.h" #include "llavatarpropertiesprocessor.h" #include "llcallbacklist.h" #include "llexpandabletextbox.h" @@ -1003,13 +1004,15 @@ void LLPanelPlaceInfo::updateYouAreHereBanner(void* userdata) LLPanelPlaceInfo* self = static_cast<LLPanelPlaceInfo*>(userdata); if(!self->getVisible()) return; + if(!gDisconnected) + { + static F32 radius = gSavedSettings.getF32("YouAreHereDistance"); - static F32 radius = gSavedSettings.getF32("YouAreHereDistance"); - - BOOL display_banner = self->mLastSelectedRegionID == gAgent.getRegion()->getRegionID() && + BOOL display_banner = gAgent.getRegion()->getRegionID() == self->mLastSelectedRegionID && LLAgentUI::checkAgentDistance(self->mPosRegion, radius); - self->mYouAreHerePanel->setVisible(display_banner); + self->mYouAreHerePanel->setVisible(display_banner); + } } void LLPanelPlaceInfo::onForSaleBannerClick() diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index 1d16c4ef5e..d4ab5013f9 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -32,10 +32,12 @@ #include "llviewerprecompiledheaders.h" +#include "llavatarconstants.h" #include "lluserrelations.h" #include "llpanelprofileview.h" +#include "llavatarpropertiesprocessor.h" #include "llcallingcard.h" #include "llpanelavatar.h" #include "llpanelpicks.h" @@ -48,14 +50,46 @@ static std::string PANEL_NOTES = "panel_notes"; static const std::string PANEL_PROFILE = "panel_profile"; static const std::string PANEL_PICKS = "panel_picks"; + +class AvatarStatusObserver : public LLAvatarPropertiesObserver +{ +public: + AvatarStatusObserver(LLPanelProfileView* profile_view) + { + mProfileView = profile_view; + } + + void processProperties(void* data, EAvatarProcessorType type) + { + if(APT_PROPERTIES != type) return; + const LLAvatarData* avatar_data = static_cast<const LLAvatarData*>(data); + if(avatar_data && mProfileView->getAvatarId() == avatar_data->avatar_id) + { + mProfileView->processOnlineStatus(avatar_data->flags & AVATAR_ONLINE); + LLAvatarPropertiesProcessor::instance().removeObserver(mProfileView->getAvatarId(), this); + } + } + + void subscribe() + { + LLAvatarPropertiesProcessor::instance().addObserver(mProfileView->getAvatarId(), this); + } + +private: + LLPanelProfileView* mProfileView; +}; + LLPanelProfileView::LLPanelProfileView() : LLPanelProfile() , mStatusText(NULL) +, mAvatarStatusObserver(NULL) { + mAvatarStatusObserver = new AvatarStatusObserver(this); } LLPanelProfileView::~LLPanelProfileView(void) { + delete mAvatarStatusObserver; } /*virtual*/ @@ -66,6 +100,9 @@ void LLPanelProfileView::onOpen(const LLSD& key) { id = key["id"]; } + + // subscribe observer to get online status. Request will be sent by LLPanelAvatarProfile itself + mAvatarStatusObserver->subscribe(); if(id.notNull() && getAvatarId() != id) { setAvatarId(id); @@ -74,10 +111,12 @@ void LLPanelProfileView::onOpen(const LLSD& key) // Update the avatar name. gCacheName->get(getAvatarId(), FALSE, boost::bind(&LLPanelProfileView::onAvatarNameCached, this, _1, _2, _3, _4)); - +/* +// disable this part of code according to EXT-2022. See processOnlineStatus // status should only show if viewer has permission to view online/offline. EXT-453 mStatusText->setVisible(isGrantedToSeeOnlineStatus()); updateOnlineStatus(); +*/ LLPanelProfile::onOpen(key); } @@ -93,6 +132,7 @@ BOOL LLPanelProfileView::postBuild() getTabContainer()[PANEL_PROFILE]->childSetVisible("status_combo", FALSE); mStatusText = getChild<LLTextBox>("status"); + mStatusText->setVisible(false); childSetCommitCallback("back",boost::bind(&LLPanelProfileView::onBackBtnClick,this),NULL); @@ -135,13 +175,18 @@ void LLPanelProfileView::updateOnlineStatus() return; bool online = relationship->isOnline(); -// std::string statusName(); std::string status = getString(online ? "status_online" : "status_offline"); mStatusText->setValue(status); } +void LLPanelProfileView::processOnlineStatus(bool online) +{ + mAvatarIsOnline = online; + mStatusText->setVisible(online); +} + void LLPanelProfileView::onAvatarNameCached(const LLUUID& id, const std::string& first_name, const std::string& last_name, BOOL is_group) { llassert(getAvatarId() == id); @@ -155,7 +200,7 @@ void LLPanelProfileView::togglePanel(LLPanel* panel) { // LLPanelProfile::togglePanel shows/hides all children, // we don't want to display online status for non friends, so re-hide it here - mStatusText->setVisible(isGrantedToSeeOnlineStatus()); + mStatusText->setVisible(mAvatarIsOnline); } } diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h index 07a6c3a9a0..b59d1d42f3 100644 --- a/indra/newview/llpanelprofileview.h +++ b/indra/newview/llpanelprofileview.h @@ -40,6 +40,7 @@ class LLPanelProfile; class LLPanelProfileTab; class LLTextBox; +class AvatarStatusObserver; /** * Panel for displaying Avatar's profile. It consists of three sub panels - Profile, @@ -49,6 +50,7 @@ class LLPanelProfileView : public LLPanelProfile { LOG_CLASS(LLPanelProfileView); friend class LLUICtrlFactory; + friend class AvatarStatusObserver; public: @@ -65,8 +67,9 @@ public: protected: void onBackBtnClick(); - bool isGrantedToSeeOnlineStatus(); - void updateOnlineStatus(); + bool isGrantedToSeeOnlineStatus(); // deprecated after EXT-2022 is implemented + void updateOnlineStatus(); // deprecated after EXT-2022 is implemented + void processOnlineStatus(bool online); private: // LLCacheName will call this function when avatar name is loaded from server. @@ -78,6 +81,8 @@ private: BOOL is_group); LLTextBox* mStatusText; + AvatarStatusObserver* mAvatarStatusObserver; + bool mAvatarIsOnline; }; #endif //LL_LLPANELPROFILEVIEW_H diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp index 419603e14e..c255418429 100644 --- a/indra/newview/llsyswellwindow.cpp +++ b/indra/newview/llsyswellwindow.cpp @@ -409,7 +409,6 @@ bool LLSysWellWindow::isWindowEmpty() void LLSysWellWindow::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - //*TODO get rid of get_session_value, session_id's are unique, cause performance degradation with lots chiclets (IB) if (mMessageList->getItemByValue(session_id) == NULL) { S32 chicletCounter = LLIMModel::getInstance()->getNumUnread(session_id); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index b497ca5e7a..82c994b150 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -488,6 +488,9 @@ <!--WARNING OLD ART *do not use*--> + <texture name="Banner_ForSale" file_name="Banner_ForSale.png" preload="false" /> + <texture name="Banner_YouAreHere" file_name="Banner_YouAreHere.png" preload="false" /> + <texture name="btn_chatbar.tga" scale.left="20" scale.top="24" scale.right="44" scale.bottom="0" /> <texture name="btn_chatbar_selected.tga" scale.left="20" scale.top="24" scale.right="44" scale.bottom="0" /> diff --git a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml index 3f4f8b197f..1fd9b95318 100644 --- a/indra/newview/skins/default/xui/en/floater_avatar_picker.xml +++ b/indra/newview/skins/default/xui/en/floater_avatar_picker.xml @@ -104,9 +104,9 @@ layout="topleft" left="10" name="InstructSelectFriend" - top="15" + top="5" width="200"> - Select a friend(s): + Select a person: </text> <button follows="top|right" diff --git a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml index 65dd4e74ff..e7c5bf8585 100644 --- a/indra/newview/skins/default/xui/en/floater_nearby_chat.xml +++ b/indra/newview/skins/default/xui/en/floater_nearby_chat.xml @@ -14,6 +14,7 @@ help_topic="nearby_chat" save_rect="true" title="Nearby Chat" + save_dock_state="true" save_visibility="true" single_instance="true" width="320"> diff --git a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml index 8db745fab7..1003b4a3a8 100644 --- a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml @@ -13,6 +13,8 @@ left="3" name="speakers_list" opaque="false" + show_info_btn="false" + show_profile_btn="false" top="10" width="140" /> <button diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index 73a1bae1c6..9bf3458d29 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -94,7 +94,7 @@ min_width="76" name="gesture_panel" user_resize="false"> - <button + <gesture_combo_box follows="right" height="23" label="Gesture" diff --git a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml index 15b6b2a00d..ce952628c6 100644 --- a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml @@ -13,6 +13,8 @@ left="3" name="speakers_list" opaque="false" + show_info_btn="false" + show_profile_btn="false" top="10" width="140" /> <button diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml b/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml index 63c2d4538e..e2be5f8fca 100644 --- a/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml +++ b/indra/newview/skins/default/xui/en/panel_teleport_history_item.xml @@ -28,15 +28,14 @@ visible="false" width="380" /> <icon - height="20" - follows="top|right|left" - image_name="ListItem_Select" + height="16" + follows="top|left" + image_name="Inv_Landmark" layout="topleft" left="0" name="landmark_icon" top="0" - visible="false" - width="20" /> + width="16" /> <text follows="left|right" height="20" |