summaryrefslogtreecommitdiff
path: root/indra/newview/llsidepaneliteminfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llsidepaneliteminfo.cpp')
-rw-r--r--indra/newview/llsidepaneliteminfo.cpp152
1 files changed, 109 insertions, 43 deletions
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index ad0bace91a..82a7719c52 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -31,11 +31,13 @@
#include "llagent.h"
#include "llavataractions.h"
+#include "llavatarnamecache.h"
#include "llbutton.h"
#include "llcallbacklist.h"
#include "llcombobox.h"
#include "llfloater.h"
#include "llgroupactions.h"
+#include "llgroupmgr.h"
#include "llinventorydefines.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
@@ -134,19 +136,27 @@ LLSidepanelItemInfo::~LLSidepanelItemInfo()
gIdleCallbacks.deleteFunction(&LLSidepanelItemInfo::onIdle, (void*)this);
stopObjectInventoryObserver();
+
+ if (mOwnerCacheConnection.connected())
+ {
+ mOwnerCacheConnection.disconnect();
+ }
+ if (mCreatorCacheConnection.connected())
+ {
+ mCreatorCacheConnection.disconnect();
+ }
}
// virtual
BOOL LLSidepanelItemInfo::postBuild()
{
+ mLabelOwnerName = getChild<LLTextBox>("LabelOwnerName");
+ mLabelCreatorName = getChild<LLTextBox>("LabelCreatorName");
+
getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this));
getChild<LLLineEditor>("LabelItemDesc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
- // Creator information
- getChild<LLUICtrl>("BtnCreator")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onClickCreator,this));
- // owner information
- getChild<LLUICtrl>("BtnOwner")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onClickOwner,this));
// acquired date
// owner permissions
// Permissions debug text
@@ -229,18 +239,6 @@ void LLSidepanelItemInfo::refresh()
refreshFromItem(item);
return;
}
-
- if (!item)
- {
- const std::string no_edit_mode_names[]={
- "BtnCreator",
- "BtnOwner",
- };
- for(size_t t=0; t<LL_ARRAY_SIZE(no_edit_mode_names); ++t)
- {
- getChildView(no_edit_mode_names[t])->setEnabled(false);
- }
- }
if (mParentFloater)
{
@@ -319,6 +317,17 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
getChildView("IconLocked")->setVisible(!is_modifiable);
getChild<LLUICtrl>("LabelItemDesc")->setValue(item->getDescription());
getChild<LLUICtrl>("item_thumbnail")->setValue(item->getThumbnailUUID());
+
+ // Style for creator and owner links
+ LLStyle::Params style_params;
+ LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+ style_params.color = link_color;
+ style_params.readonly_color = link_color;
+ style_params.is_link = true; // link will be added later
+ const LLFontGL* fontp = mLabelCreatorName->getFont();
+ style_params.font.name = LLFontGL::nameFromFont(fontp);
+ style_params.font.size = LLFontGL::sizeFromFont(fontp);
+ style_params.font.style = "UNDERLINE";
//////////////////
// CREATOR NAME //
@@ -329,19 +338,34 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
if (item->getCreatorUUID().notNull())
{
LLUUID creator_id = item->getCreatorUUID();
- std::string name =
- LLSLURL("agent", creator_id, "completename").getSLURLString();
- getChildView("BtnCreator")->setEnabled(TRUE);
+ std::string slurl =
+ LLSLURL("agent", creator_id, "inspect").getSLURLString();
+
+ style_params.link_href = slurl;
+
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(creator_id, &av_name))
+ {
+ updateCreatorName(creator_id, av_name, style_params);
+ }
+ else
+ {
+ if (mCreatorCacheConnection.connected())
+ {
+ mCreatorCacheConnection.disconnect();
+ }
+ mLabelCreatorName->setText(LLTrans::getString("None"));
+ mCreatorCacheConnection = LLAvatarNameCache::get(creator_id, boost::bind(&LLSidepanelItemInfo::updateCreatorName, this, _1, _2, style_params));
+ }
+
getChildView("LabelCreatorTitle")->setEnabled(TRUE);
- getChildView("LabelCreatorName")->setEnabled(FALSE);
- getChild<LLUICtrl>("LabelCreatorName")->setValue(name);
+ mLabelCreatorName->setEnabled(FALSE);
}
else
{
- getChildView("BtnCreator")->setEnabled(FALSE);
getChildView("LabelCreatorTitle")->setEnabled(FALSE);
- getChildView("LabelCreatorName")->setEnabled(FALSE);
- getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown_multiple"));
+ mLabelCreatorName->setEnabled(FALSE);
+ mLabelCreatorName->setValue(getString("unknown_multiple"));
}
////////////////
@@ -349,27 +373,56 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
////////////////
if(perm.isOwned())
{
- std::string name;
+ std::string slurl;
if (perm.isGroupOwned())
{
- gCacheName->getGroupName(perm.getGroup(), name);
+ LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(perm.getGroup());
+
+ slurl = LLSLURL("group", perm.getGroup(), "inspect").getSLURLString();
+ style_params.link_href = slurl;
+ if (group_data && group_data->isGroupPropertiesDataComplete())
+ {
+ mLabelOwnerName->setText(group_data->mName, style_params);
+ }
+ else
+ {
+ // Triggers refresh
+ LLGroupMgr::getInstance()->sendGroupPropertiesRequest(perm.getGroup());
+
+ std::string name;
+ gCacheName->getGroupName(perm.getGroup(), name);
+ mLabelOwnerName->setText(name, style_params);
+ }
}
else
{
LLUUID owner_id = perm.getOwner();
- name = LLSLURL("agent", owner_id, "completename").getSLURLString();
+ slurl = LLSLURL("agent", owner_id, "inspect").getSLURLString();
+
+ style_params.link_href = slurl;
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(owner_id, &av_name))
+ {
+ updateOwnerName(owner_id, av_name, style_params);
+ }
+ else
+ {
+ if (mOwnerCacheConnection.connected())
+ {
+ mOwnerCacheConnection.disconnect();
+ }
+ mLabelOwnerName->setText(LLTrans::getString("None"));
+ mOwnerCacheConnection = LLAvatarNameCache::get(owner_id, boost::bind(&LLSidepanelItemInfo::updateOwnerName, this, _1, _2, style_params));
+ }
}
- getChildView("BtnOwner")->setEnabled(TRUE);
getChildView("LabelOwnerTitle")->setEnabled(TRUE);
- getChildView("LabelOwnerName")->setEnabled(FALSE);
- getChild<LLUICtrl>("LabelOwnerName")->setValue(name);
+ mLabelOwnerName->setEnabled(FALSE);
}
else
{
- getChildView("BtnOwner")->setEnabled(FALSE);
getChildView("LabelOwnerTitle")->setEnabled(FALSE);
- getChildView("LabelOwnerName")->setEnabled(FALSE);
- getChild<LLUICtrl>("LabelOwnerName")->setValue(getString("public"));
+ mLabelOwnerName->setEnabled(FALSE);
+ mLabelOwnerName->setValue(getString("public"));
}
////////////
@@ -480,6 +533,8 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
if( gSavedSettings.getBOOL("DebugPermissions") )
{
+ childSetVisible("layout_debug_permissions", true);
+
BOOL slam_perm = FALSE;
BOOL overwrite_group = FALSE;
BOOL overwrite_everyone = FALSE;
@@ -497,38 +552,29 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
perm_string = "B: ";
perm_string += mask_to_string(base_mask);
getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string);
- getChildView("BaseMaskDebug")->setVisible(TRUE);
perm_string = "O: ";
perm_string += mask_to_string(owner_mask);
getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string);
- getChildView("OwnerMaskDebug")->setVisible(TRUE);
perm_string = "G";
perm_string += overwrite_group ? "*: " : ": ";
perm_string += mask_to_string(group_mask);
getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string);
- getChildView("GroupMaskDebug")->setVisible(TRUE);
perm_string = "E";
perm_string += overwrite_everyone ? "*: " : ": ";
perm_string += mask_to_string(everyone_mask);
getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string);
- getChildView("EveryoneMaskDebug")->setVisible(TRUE);
perm_string = "N";
perm_string += slam_perm ? "*: " : ": ";
perm_string += mask_to_string(next_owner_mask);
getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string);
- getChildView("NextMaskDebug")->setVisible(TRUE);
}
else
{
- getChildView("BaseMaskDebug")->setVisible(FALSE);
- getChildView("OwnerMaskDebug")->setVisible(FALSE);
- getChildView("GroupMaskDebug")->setVisible(FALSE);
- getChildView("EveryoneMaskDebug")->setVisible(FALSE);
- getChildView("NextMaskDebug")->setVisible(FALSE);
+ childSetVisible("layout_debug_permissions", false);
}
/////////////
@@ -663,6 +709,26 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
}
}
+void LLSidepanelItemInfo::updateCreatorName(const LLUUID& creator_id, const LLAvatarName& creator_name, const LLStyle::Params& style_params)
+{
+ if (mCreatorCacheConnection.connected())
+ {
+ mCreatorCacheConnection.disconnect();
+ }
+ std::string name = creator_name.getCompleteName();
+ mLabelCreatorName->setText(name, style_params);
+}
+
+void LLSidepanelItemInfo::updateOwnerName(const LLUUID& owner_id, const LLAvatarName& owner_name, const LLStyle::Params& style_params)
+{
+ if (mOwnerCacheConnection.connected())
+ {
+ mOwnerCacheConnection.disconnect();
+ }
+ std::string name = owner_name.getCompleteName();
+ mLabelOwnerName->setText(name, style_params);
+}
+
void LLSidepanelItemInfo::changed(U32 mask)
{
const LLUUID& item_id = getItemID();