diff options
-rw-r--r-- | indra/newview/llpanelprofile.cpp | 74 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_profile_permissions.xml | 27 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_profile_secondlife.xml | 2 |
3 files changed, 76 insertions, 27 deletions
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 34caa61fbf..3e7dd57965 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -583,11 +583,14 @@ class LLFloaterProfilePermissions , public LLFriendObserver { public: - LLFloaterProfilePermissions(const LLUUID &avatar_id); + LLFloaterProfilePermissions(LLView * owner, const LLUUID &avatar_id); ~LLFloaterProfilePermissions(); BOOL postBuild() override; + void onOpen(const LLSD& key) override; + void draw() override; void changed(U32 mask) override; // LLFriendObserver - // todo: check if this (and inventory filters) need a drawFrustum() + + void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); private: void fillRightsData(); @@ -598,28 +601,41 @@ private: void onApplyRights(); void onCancel(); + LLTextBase* mDescription; LLCheckBoxCtrl* mOnlineStatus; LLCheckBoxCtrl* mMapRights; LLCheckBoxCtrl* mEditObjectRights; LLButton* mOkBtn; LLButton* mCancelBtn; - LLUUID mAvatarID; + LLUUID mAvatarID; + F32 mContextConeOpacity; + LLHandle<LLView> mOwnerHandle; + + boost::signals2::connection mAvatarNameCacheConnection; }; -LLFloaterProfilePermissions::LLFloaterProfilePermissions(const LLUUID &avatar_id) +LLFloaterProfilePermissions::LLFloaterProfilePermissions(LLView * owner, const LLUUID &avatar_id) : LLFloater(LLSD()) , mAvatarID(avatar_id) + , mContextConeOpacity(0.0f) + , mOwnerHandle(owner->getHandle()) { buildFromFile("floater_profile_permissions.xml"); } LLFloaterProfilePermissions::~LLFloaterProfilePermissions() { + mAvatarNameCacheConnection.disconnect(); + if (mAvatarID.notNull()) + { + LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarID, this); + } } BOOL LLFloaterProfilePermissions::postBuild() { + mDescription = getChild<LLTextBase>("perm_description"); mOnlineStatus = getChild<LLCheckBoxCtrl>("online_check"); mMapRights = getChild<LLCheckBoxCtrl>("map_check"); mEditObjectRights = getChild<LLCheckBoxCtrl>("objects_check"); @@ -630,14 +646,45 @@ BOOL LLFloaterProfilePermissions::postBuild() mOkBtn->setCommitCallback([this](LLUICtrl*, void*) { onApplyRights(); }, nullptr); mCancelBtn->setCommitCallback([this](LLUICtrl*, void*) { onCancel(); }, nullptr); - fillRightsData(); // is it possible to not be friends at this point? This might need to be onOpen() - return TRUE; } +void LLFloaterProfilePermissions::onOpen(const LLSD& key) +{ + if (LLAvatarActions::isFriend(mAvatarID)) + { + LLAvatarTracker::instance().addParticularFriendObserver(mAvatarID, this); + fillRightsData(); + } + + mAvatarNameCacheConnection = LLAvatarNameCache::get(mAvatarID, boost::bind(&LLFloaterProfilePermissions::onAvatarNameCache, this, _1, _2)); +} + +void LLFloaterProfilePermissions::draw() +{ + // drawFrustum + LLView *owner = mOwnerHandle.get(); + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, owner); + LLFloater::draw(); +} + void LLFloaterProfilePermissions::changed(U32 mask) { - //todo + if (mask != LLFriendObserver::ONLINE) + { + fillRightsData(); + } +} + +void LLFloaterProfilePermissions::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) +{ + mAvatarNameCacheConnection.disconnect(); + + LLStringUtil::format_map_t args; + args["[AGENT_NAME]"] = av_name.getDisplayName(); + std::string descritpion = getString("description_string", args); + mDescription->setValue(descritpion); } void LLFloaterProfilePermissions::fillRightsData() @@ -779,11 +826,8 @@ BOOL LLPanelProfileSecondLife::postBuild() mSaveDescriptionChanges->setCommitCallback([this](LLUICtrl*, void*) { onSaveDescriptionChanges(); }, nullptr); mDiscardDescriptionChanges->setCommitCallback([this](LLUICtrl*, void*) { onDiscardDescriptionChanges(); }, nullptr); mDescriptionEdit->setKeystrokeCallback([this](LLTextEditor* caller) { onSetDescriptionDirty(); }); - //mSeeOnlineToggle->setMouseDownCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); mSeeOnlineToggle->setMouseUpCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); - // mSeeOnMapToggle->setMouseDownCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); mSeeOnMapToggle->setMouseUpCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); - //mEditObjectsToggle->setMouseDownCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); mEditObjectsToggle->setMouseUpCallback([this](LLUICtrl*, const LLSD&) { onShowAgentPermissionsDialog(); }); return TRUE; @@ -1523,13 +1567,15 @@ void LLPanelProfileSecondLife::onShowAgentPermissionsDialog() LLFloater *floater = mFloaterPermissionsHandle.get(); if (!floater) { - LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions(getAvatarId()); - mFloaterPermissionsHandle = perms->getHandle(); - perms->openFloater(); - LLFloater* parent_floater = gFloaterView->getParentFloater(this); if (parent_floater) + { + LLFloaterProfilePermissions * perms = new LLFloaterProfilePermissions(parent_floater, getAvatarId()); + mFloaterPermissionsHandle = perms->getHandle(); + perms->openFloater(); + parent_floater->addDependentFloater(mFloaterPermissionsHandle); + } } else // already open { diff --git a/indra/newview/skins/default/xui/en/floater_profile_permissions.xml b/indra/newview/skins/default/xui/en/floater_profile_permissions.xml index d186146770..62cf9b3272 100644 --- a/indra/newview/skins/default/xui/en/floater_profile_permissions.xml +++ b/indra/newview/skins/default/xui/en/floater_profile_permissions.xml @@ -7,15 +7,18 @@ header_height="10" bg_opaque_image="Window_NoTitle_Foreground" bg_alpha_image="Window_NoTitle_Background" - height="200" + height="115" layout="topleft" name="profile_permissiona" width="300"> + <string + name="description_string" + value="Allow [AGENT_NAME] to:" /> <text name="perm_description" - value="Allow [AGENT_NAME] to:" - top="5" - left="6" + value="Allow agent to:" + top="1" + left="12" right="-6" height="16" follows="top|left" @@ -26,7 +29,7 @@ name="online_check" label="See when I am online" top_pad="5" - left="10" + left="16" height="16" width="293" follows="top|left" @@ -36,7 +39,7 @@ name="map_check" label="Find me on the world map" top_pad="5" - left="10" + left="16" height="16" width="293" follows="top|left" @@ -44,9 +47,9 @@ /> <check_box name="objects_check" - label="Edit, delete or take my objects" + label="Edit, delete or take my objects from my land" top_pad="5" - left="10" + left="16" height="16" width="293" follows="top|left" @@ -56,18 +59,18 @@ name="perms_btn_ok" label="OK" top_pad="5" - left="10" + left="42" height="20" - width="90" + width="100" follows="top|left" layout="topleft"/> <button name="perms_btn_cancel" label="Cancel" top_delta="0" - left_pad="10" + left_pad="12" height="20" - width="90" + width="100" follows="top|left" layout="topleft"/> </floater> diff --git a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml index 5dd4a9116a..cc59e12c4b 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml @@ -140,7 +140,7 @@ Account: [ACCTTYPE] left="2" bottom="-1" height="25" - width="120" + width="140" label="Actions" halign="left" image_unselected="DropDown_Off" |