From b82d70cf2aa2b56a2c0bfdd941ee4f74e690e4df Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Mon, 4 Mar 2019 00:18:45 -0800 Subject: Added viewer based profiles Split picks and classifieds in to separate panels Moved getProfileURL to LLAvatarActions Removed dead XUI panels Removed picks/classifieds floater --- indra/newview/llpanelavatar.cpp | 207 ++++++++++++++-------------------------- 1 file changed, 71 insertions(+), 136 deletions(-) (limited to 'indra/newview/llpanelavatar.cpp') diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 5d1b582d1f..dbda6070fa 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llpanelavatar.cpp * @brief LLPanelAvatar and related class implementations * * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -28,172 +28,107 @@ #include "llpanelavatar.h" #include "llagent.h" -#include "llavataractions.h" -#include "llcallingcard.h" -#include "llcombobox.h" -#include "lldateutil.h" // ageFromDate() -#include "llimview.h" -#include "llmenubutton.h" -#include "llnotificationsutil.h" -#include "llslurl.h" -#include "lltexteditor.h" -#include "lltexturectrl.h" -#include "lltoggleablemenu.h" +#include "llloadingindicator.h" #include "lltooldraganddrop.h" -#include "llscrollcontainer.h" -#include "llavatariconctrl.h" -#include "llfloaterreg.h" -#include "llnotificationsutil.h" -#include "llvoiceclient.h" -#include "lltextbox.h" -#include "lltrans.h" - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLDropTarget -// -// This handy class is a simple way to drop something on another -// view. It handles drop events, always setting itself to the size of -// its parent. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLDropTarget : public LLView -{ -public: - struct Params : public LLInitParam::Block - { - Optional agent_id; - Params() - : agent_id("agent_id") - { - changeDefault(mouse_opaque, false); - changeDefault(follows.flags, FOLLOWS_ALL); - } - }; - - LLDropTarget(const Params&); - ~LLDropTarget(); - - void doDrop(EDragAndDropType cargo_type, void* cargo_data); - - // - // LLView functionality - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); - void setAgentID(const LLUUID &agent_id) { mAgentID = agent_id; } -protected: - LLUUID mAgentID; -}; - -LLDropTarget::LLDropTarget(const LLDropTarget::Params& p) -: LLView(p), - mAgentID(p.agent_id) -{} -LLDropTarget::~LLDropTarget() +////////////////////////////////////////////////////////////////////////// +// LLProfileDropTarget + +LLProfileDropTarget::LLProfileDropTarget(const LLProfileDropTarget::Params& p) +: LLView(p), + mAgentID(p.agent_id) {} -void LLDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) +void LLProfileDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) { - LL_INFOS() << "LLDropTarget::doDrop()" << LL_ENDL; + LL_INFOS() << "LLProfileDropTarget::doDrop()" << LL_ENDL; } -BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) +BOOL LLProfileDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) { - if(getParent()) - { - LLToolDragAndDrop::handleGiveDragAndDrop(mAgentID, LLUUID::null, drop, - cargo_type, cargo_data, accept); + if (getParent()) + { + LLToolDragAndDrop::handleGiveDragAndDrop(mAgentID, LLUUID::null, drop, + cargo_type, cargo_data, accept); - return TRUE; - } + return TRUE; + } - return FALSE; + return FALSE; } -static LLDefaultChildRegistry::Register r("drop_target"); +static LLDefaultChildRegistry::Register r("profile_drop_target"); ////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// +// LLPanelProfileTab LLPanelProfileTab::LLPanelProfileTab() : LLPanel() , mAvatarId(LLUUID::null) +, mLoading(false) +, mLoaded(false) +, mEmbedded(false) +, mSelfProfile(false) { } LLPanelProfileTab::~LLPanelProfileTab() { - if(getAvatarId().notNull()) - { - LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); - } + if(getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); + } } -void LLPanelProfileTab::setAvatarId(const LLUUID& id) +void LLPanelProfileTab::setAvatarId(const LLUUID& avatar_id) { - if(id.notNull()) - { - if(getAvatarId().notNull()) - { - LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId,this); - } - mAvatarId = id; - LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(),this); - } + if (avatar_id.notNull()) + { + if (getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this); + } + mAvatarId = avatar_id; + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); + + mSelfProfile = (getAvatarId() == gAgentID); + } } void LLPanelProfileTab::onOpen(const LLSD& key) { - // Don't reset panel if we are opening it for same avatar. - if(getAvatarId() != key.asUUID()) - { - resetControls(); - resetData(); - - scrollToTop(); - } - - // Update data even if we are viewing same avatar profile as some data might been changed. - setAvatarId(key.asUUID()); - updateData(); - updateButtons(); -} + // Update data even if we are viewing same avatar profile as some data might been changed. + setAvatarId(key.asUUID()); -void LLPanelProfileTab::scrollToTop() -{ - LLScrollContainer* scrollContainer = findChild("profile_scroll"); - if (scrollContainer) - scrollContainer->goToTop(); + setApplyProgress(true); } -void LLPanelProfileTab::onMapButtonClick() +void LLPanelProfileTab::updateButtons() { - LLAvatarActions::showOnMap(getAvatarId()); + setApplyProgress(false); + + mLoaded = true; } -void LLPanelProfileTab::updateButtons() +void LLPanelProfileTab::setApplyProgress(bool started) { - bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); - - if(LLAvatarActions::isFriend(getAvatarId())) - { - getChildView("teleport")->setEnabled(is_buddy_online); - } - else - { - getChildView("teleport")->setEnabled(true); - } - - bool enable_map_btn = (is_buddy_online && - is_agent_mappable(getAvatarId())) - || gAgent.isGodlike(); - getChildView("show_on_map_btn")->setEnabled(enable_map_btn); + LLLoadingIndicator* indicator = findChild("progress_indicator"); + + if (indicator) + { + indicator->setVisible(started); + + if (started) + { + indicator->start(); + } + else + { + indicator->stop(); + } + } } -- cgit v1.3 From 8163eeb43bdfa806c306ba5caf2457c59efed2d4 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 6 Apr 2022 22:16:39 +0300 Subject: SL-15312 Legacy profiles remake #1 Initial layout --- indra/newview/llfloaterprofile.cpp | 3 - indra/newview/llpanelavatar.cpp | 2 +- indra/newview/llpanelprofile.cpp | 150 +--- indra/newview/llpanelprofile.h | 31 - .../skins/default/xui/en/floater_profile.xml | 27 +- .../skins/default/xui/en/panel_edit_profile.xml | 472 ------------ .../default/xui/en/panel_profile_secondlife.xml | 827 ++++++++------------- 7 files changed, 338 insertions(+), 1174 deletions(-) delete mode 100644 indra/newview/skins/default/xui/en/panel_edit_profile.xml (limited to 'indra/newview/llpanelavatar.cpp') diff --git a/indra/newview/llfloaterprofile.cpp b/indra/newview/llfloaterprofile.cpp index f2863e1e27..0a775f217a 100644 --- a/indra/newview/llfloaterprofile.cpp +++ b/indra/newview/llfloaterprofile.cpp @@ -62,9 +62,6 @@ BOOL LLFloaterProfile::postBuild() { mPanelProfile = findChild(PANEL_PROFILE_VIEW); - childSetAction("ok_btn", boost::bind(&LLFloaterProfile::onOKBtn, this)); - childSetAction("cancel_btn", boost::bind(&LLFloaterProfile::onCancelBtn, this)); - return TRUE; } diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index dbda6070fa..e25eba11d2 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -120,7 +120,7 @@ void LLPanelProfileTab::setApplyProgress(bool started) if (indicator) { - indicator->setVisible(started); + indicator->setVisible(true); if (started) { diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index c19688191b..5453c87013 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -562,7 +562,6 @@ LLAgentHandler gAgentHandler; LLPanelProfileSecondLife::LLPanelProfileSecondLife() : LLPanelProfileTab() - , mStatusText(NULL) , mAvatarNameCacheConnection() { } @@ -589,42 +588,13 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife() BOOL LLPanelProfileSecondLife::postBuild() { - mStatusText = getChild("status"); mGroupList = getChild("group_list"); mShowInSearchCheckbox = getChild("show_in_search_checkbox"); mSecondLifePic = getChild("2nd_life_pic"); mSecondLifePicLayout = getChild("image_stack"); mDescriptionEdit = getChild("sl_description_edit"); - mTeleportButton = getChild("teleport"); - mShowOnMapButton = getChild("show_on_map_btn"); - mBlockButton = getChild("block"); - mUnblockButton = getChild("unblock"); - mNameLabel = getChild("name_label"); - mDisplayNameButton = getChild("set_name"); - mAddFriendButton = getChild("add_friend"); - mGroupInviteButton = getChild("group_invite"); - mPayButton = getChild("pay"); - mIMButton = getChild("im"); - mCopyMenuButton = getChild("copy_btn"); mGiveInvPanel = getChild("give_stack"); - mStatusText->setVisible(FALSE); - mCopyMenuButton->setVisible(FALSE); - - mAddFriendButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onAddFriendButtonClick, this)); - mIMButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onIMButtonClick, this)); - mTeleportButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onTeleportButtonClick, this)); - mShowOnMapButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onMapButtonClick, this)); - mPayButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::pay, this)); - mBlockButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onClickToggleBlock, this)); - mUnblockButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onClickToggleBlock, this)); - mGroupInviteButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onGroupInvite,this)); - mDisplayNameButton->setCommitCallback(boost::bind(&LLPanelProfileSecondLife::onClickSetName, this)); - mSecondLifePic->setMouseUpCallback(boost::bind(&LLPanelProfileSecondLife::onPickTexture, this)); - - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar commit; - commit.add("Profile.CopyName", [this](LLUICtrl*, const LLSD& userdata) { onCommitMenu(userdata); }); - LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; enable.add("Profile.EnableCall", [this](LLUICtrl*, const LLSD&) { return mVoiceStatus; }); enable.add("Profile.EnableGod", [](LLUICtrl*, const LLSD&) { return gAgent.isGodlike(); }); @@ -632,8 +602,7 @@ BOOL LLPanelProfileSecondLife::postBuild() mGroupList->setDoubleClickCallback(boost::bind(&LLPanelProfileSecondLife::openGroupProfile, this)); mGroupList->setReturnCallback(boost::bind(&LLPanelProfileSecondLife::openGroupProfile, this)); - LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this); - mCopyMenuButton->setMenu("menu_name_field.xml", LLMenuButton::MP_BOTTOM_RIGHT); + //mAgentActionMenuButton->setMenu("menu_name_field.xml", LLMenuButton::MP_BOTTOM_RIGHT); return TRUE; } @@ -649,16 +618,11 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) BOOL own_profile = getSelfProfile(); - mGroupInviteButton->setVisible(!own_profile); - mShowOnMapButton->setVisible(!own_profile); - mPayButton->setVisible(!own_profile); - mTeleportButton->setVisible(!own_profile); - mIMButton->setVisible(!own_profile); - mAddFriendButton->setVisible(!own_profile); - mBlockButton->setVisible(!own_profile); - mUnblockButton->setVisible(!own_profile); mGroupList->setShowNone(!own_profile); - mGiveInvPanel->setVisible(!own_profile); + //mGiveInvPanel->setVisible(!own_profile); + + childSetVisible("notes_panel", !own_profile); + childSetVisible("settings_panel", own_profile); if (own_profile && !getEmbedded()) { @@ -667,11 +631,8 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) mGroupList->enableForAgent(false); } - if (own_profile && !getEmbedded() ) + if (own_profile) { - mNameLabel->setVisible(FALSE); - mDisplayNameButton->setVisible(TRUE); - mDisplayNameButton->setEnabled(TRUE); } mDescriptionEdit->setParseHTML(!own_profile && !getEmbedded()); @@ -794,11 +755,10 @@ void LLPanelProfileSecondLife::resetData() mSecondLifePicLayout->reshape(imageRect.getHeight(), imageRect.getHeight()); mDescriptionEdit->setValue(LLStringUtil::null); - mStatusText->setVisible(FALSE); - mCopyMenuButton->setVisible(FALSE); mGroups.clear(); mGroupList->setGroups(mGroups); clearUploadProfileImagePath(); + //mAgentActionMenuButton set menu } void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avatar_data) @@ -858,8 +818,7 @@ void LLPanelProfileSecondLife::onAvatarNameCache(const LLUUID& agent_id, const L { mAvatarNameCacheConnection.disconnect(); - getChild("complete_name")->setValue( av_name.getCompleteName() ); - mCopyMenuButton->setVisible(TRUE); + //getChild("complete_name")->setValue( av_name.getCompleteName() ); } void LLPanelProfileSecondLife::setUploadProfileImagePath(const std::string &path, const std::string &orig_path) @@ -900,14 +859,8 @@ void LLPanelProfileSecondLife::fillCommonData(const LLAvatarData* avatar_data) LLAvatarIconIDCache::getInstance()->add(avatar_data->avatar_id, avatar_data->image_id); LLStringUtil::format_map_t args; - { - std::string birth_date = LLTrans::getString("AvatarBirthDateFormat"); - LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) avatar_data->born_on.secondsSinceEpoch())); - args["[REG_DATE]"] = birth_date; - } - args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now()); - std::string register_date = getString("RegisterDateFormat", args); + std::string register_date = getString("AgeFormat", args); getChild("register_date")->setValue(register_date ); mDescriptionEdit->setValue(avatar_data->about_text); mImageAssetId = avatar_data->image_id; @@ -956,53 +909,7 @@ void LLPanelProfileSecondLife::fillAccountStatus(const LLAvatarData* avatar_data args["[PAYMENTINFO]"] = LLAvatarPropertiesProcessor::paymentInfo(avatar_data); std::string caption_text = getString("CaptionTextAcctInfo", args); - getChild("acc_status_text")->setValue(caption_text); -} - -void LLPanelProfileSecondLife::onMapButtonClick() -{ - LLAvatarActions::showOnMap(getAvatarId()); -} - -void LLPanelProfileSecondLife::pay() -{ - LLAvatarActions::pay(getAvatarId()); -} - -void LLPanelProfileSecondLife::onClickToggleBlock() -{ - bool blocked = LLAvatarActions::toggleBlock(getAvatarId()); - - updateButtons(); - // we are hiding one button and showing another, set focus - if (blocked) - { - mUnblockButton->setFocus(true); - } - else - { - mBlockButton->setFocus(true); - } -} - -void LLPanelProfileSecondLife::onAddFriendButtonClick() -{ - LLAvatarActions::requestFriendshipDialog(getAvatarId()); -} - -void LLPanelProfileSecondLife::onIMButtonClick() -{ - LLAvatarActions::startIM(getAvatarId()); -} - -void LLPanelProfileSecondLife::onTeleportButtonClick() -{ - LLAvatarActions::offerTeleport(getAvatarId()); -} - -void LLPanelProfileSecondLife::onGroupInvite() -{ - LLAvatarActions::inviteToGroup(getAvatarId()); + getChild("account_info")->setValue(caption_text); } void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) @@ -1112,14 +1019,6 @@ void LLPanelProfileSecondLife::updateOnlineStatus() void LLPanelProfileSecondLife::processOnlineStatus(bool online) { - mStatusText->setVisible(isGrantedToSeeOnlineStatus()); - - std::string status = getString(online ? "status_online" : "status_offline"); - - mStatusText->setValue(status); - mStatusText->setColor(online ? - LLUIColorTable::instance().getColor("StatusUserOnline") : - LLUIColorTable::instance().getColor("StatusUserOffline")); } void LLPanelProfileSecondLife::updateButtons() @@ -1132,33 +1031,6 @@ void LLPanelProfileSecondLife::updateButtons() mShowInSearchCheckbox->setEnabled(TRUE); mDescriptionEdit->setEnabled(TRUE); } - - if (!getSelfProfile()) - { - LLUUID av_id = getAvatarId(); - bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); - - if (LLAvatarActions::isFriend(av_id)) - { - mTeleportButton->setEnabled(is_buddy_online); - //Disable "Add Friend" button for friends. - mAddFriendButton->setEnabled(false); - } - else - { - mTeleportButton->setEnabled(true); - mAddFriendButton->setEnabled(true); - } - - bool enable_map_btn = (is_buddy_online && is_agent_mappable(av_id)) || gAgent.isGodlike(); - mShowOnMapButton->setEnabled(enable_map_btn); - - bool enable_block_btn = LLAvatarActions::canBlock(av_id) && !LLAvatarActions::isBlocked(av_id); - mBlockButton->setVisible(enable_block_btn); - - bool enable_unblock_btn = LLAvatarActions::isBlocked(av_id); - mUnblockButton->setVisible(enable_unblock_btn); - } } void LLPanelProfileSecondLife::onClickSetName() @@ -1857,8 +1729,6 @@ void LLPanelProfile::onTabChange() void LLPanelProfile::updateBtnsVisibility() { - getChild("ok_btn")->setVisible(((getSelfProfile() && !getEmbedded()) || isNotesTabSelected())); - getChild("cancel_btn")->setVisible(((getSelfProfile() && !getEmbedded()) || isNotesTabSelected())); } void LLPanelProfile::onOpen(const LLSD& key) diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 9aab8a087c..c73973b812 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -134,25 +134,6 @@ protected: */ virtual void fillAccountStatus(const LLAvatarData* avatar_data); - void onMapButtonClick(); - - /** - * Opens "Pay Resident" dialog. - */ - void pay(); - - /** - * Add/remove resident to/from your block list. - * Updates button focus - */ - void onClickToggleBlock(); - - void onAddFriendButtonClick(); - void onIMButtonClick(); - void onTeleportButtonClick(); - - void onGroupInvite(); - void onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep); static void onImageLoaded(BOOL success, LLViewerFetchedTexture *src_vi, @@ -191,23 +172,11 @@ private: group_map_t mGroups; void openGroupProfile(); - LLTextBox* mStatusText; LLGroupList* mGroupList; LLCheckBoxCtrl* mShowInSearchCheckbox; LLIconCtrl* mSecondLifePic; LLPanel* mSecondLifePicLayout; LLTextBase* mDescriptionEdit; - LLButton* mTeleportButton; - LLButton* mShowOnMapButton; - LLButton* mBlockButton; - LLButton* mUnblockButton; - LLUICtrl* mNameLabel; - LLButton* mDisplayNameButton; - LLButton* mAddFriendButton; - LLButton* mGroupInviteButton; - LLButton* mPayButton; - LLButton* mIMButton; - LLMenuButton* mCopyMenuButton; LLPanel* mGiveInvPanel; bool mVoiceStatus; diff --git a/indra/newview/skins/default/xui/en/floater_profile.xml b/indra/newview/skins/default/xui/en/floater_profile.xml index dede8bc0a6..92207cdc36 100644 --- a/indra/newview/skins/default/xui/en/floater_profile.xml +++ b/indra/newview/skins/default/xui/en/floater_profile.xml @@ -36,7 +36,7 @@ > -