Don't hide the tab container for classifieds (especially not at the wrong time)

Thanks to Aztek Aeon for pointing out this bug!

Includes random stylistic fixes. (everywhere~)
This commit is contained in:
Inusaito Sayori
2014-12-29 16:12:18 -05:00
parent 0eba34d5a8
commit 9bf2092c7e

View File

@@ -96,7 +96,7 @@ LLPanelAvatarTab::LLPanelAvatarTab(const std::string& name, const LLRect &rect,
void LLPanelAvatarTab::setAvatarID(const LLUUID& avatar_id) void LLPanelAvatarTab::setAvatarID(const LLUUID& avatar_id)
{ {
if(mAvatarID != avatar_id) if (mAvatarID != avatar_id)
{ {
if (mAvatarID.notNull()) if (mAvatarID.notNull())
LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this);
@@ -113,7 +113,7 @@ void LLPanelAvatarTab::setAvatarID(const LLUUID& avatar_id)
// virtual // virtual
LLPanelAvatarTab::~LLPanelAvatarTab() LLPanelAvatarTab::~LLPanelAvatarTab()
{ {
if(mAvatarID.notNull()) if (mAvatarID.notNull())
LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this);
} }
@@ -121,7 +121,6 @@ LLPanelAvatarTab::~LLPanelAvatarTab()
void LLPanelAvatarTab::draw() void LLPanelAvatarTab::draw()
{ {
refresh(); refresh();
LLPanel::draw(); LLPanel::draw();
} }
@@ -160,24 +159,15 @@ void LLPanelAvatarSecondLife::updatePartnerName(const LLAvatarName& name)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLPanelAvatarSecondLife::clearControls() void LLPanelAvatarSecondLife::clearControls()
{ {
LLTextureCtrl* image_ctrl = getChild<LLTextureCtrl>("img"); getChild<LLTextureCtrl>("img")->setImageAssetID(LLUUID::null);
if(image_ctrl) childSetValue("about", LLStringUtil::null);
{ childSetValue("born", LLStringUtil::null);
image_ctrl->setImageAssetID(LLUUID::null); childSetValue("acct", LLStringUtil::null);
}
childSetValue("about", "");
childSetValue("born", "");
childSetValue("acct", "");
childSetTextArg("partner_edit", "[NAME]", LLStringUtil::null); childSetTextArg("partner_edit", "[NAME]", LLStringUtil::null);
mPartnerID = LLUUID::null; mPartnerID = LLUUID::null;
LLScrollListCtrl* group_list = getChild<LLScrollListCtrl>("groups"); getChild<LLScrollListCtrl>("groups")->deleteAllItems();
if(group_list)
{
group_list->deleteAllItems();
}
} }
// virtual // virtual
@@ -201,7 +191,7 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType
{ {
using namespace boost::gregorian; using namespace boost::gregorian;
int year, month, day; int year, month, day;
sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d",&month,&day,&year); sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d", &month, &day, &year);
std::ostringstream born_on; std::ostringstream born_on;
born_on << pAvatarData->born_on << " (" << day_clock::local_day() - date(year, month, day) << ")"; born_on << pAvatarData->born_on << " (" << day_clock::local_day() - date(year, month, day) << ")";
childSetValue("born", born_on.str()); childSetValue("born", born_on.str());
@@ -219,10 +209,10 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType
} }
} }
} }
else if(type == APT_GROUPS) else if (type == APT_GROUPS)
{ {
const LLAvatarGroups* pAvatarGroups = static_cast<const LLAvatarGroups*>( data ); const LLAvatarGroups* pAvatarGroups = static_cast<const LLAvatarGroups*>(data);
if(pAvatarGroups && pAvatarGroups->avatar_id == mAvatarID && pAvatarGroups->avatar_id.notNull()) if (pAvatarGroups && pAvatarGroups->avatar_id == mAvatarID && pAvatarGroups->avatar_id.notNull())
{ {
LLScrollListCtrl* group_list = getChild<LLScrollListCtrl>("groups"); LLScrollListCtrl* group_list = getChild<LLScrollListCtrl>("groups");
if (!pAvatarGroups->group_list.size()) if (!pAvatarGroups->group_list.size())
@@ -235,50 +225,27 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType
{ {
// Is this really necessary? Remove existing entry if it exists. // Is this really necessary? Remove existing entry if it exists.
// TODO: clear the whole list when a request for data is made // TODO: clear the whole list when a request for data is made
if (group_list)
{
S32 index = group_list->getItemIndex(it->group_id); S32 index = group_list->getItemIndex(it->group_id);
if ( index >= 0 ) if (index >= 0)
{
group_list->deleteSingleItem(index); group_list->deleteSingleItem(index);
}
}
LLSD row; LLScrollListItem::Params row;
row["id"] = it->group_id; row.value(it->group_id);
row["columns"][0]["value"] = it->group_id.notNull() ? it->group_name : "";
row["columns"][0]["font"] = "SANSSERIF_SMALL";
LLGroupData *group_data = NULL;
std::string font_style("NORMAL"); // Set normal color if not found or if group is visible in profile
if (pAvatarGroups->avatar_id == pAvatarGroups->agent_id) // own avatar if (pAvatarGroups->avatar_id == pAvatarGroups->agent_id) // own avatar
{ for (LLDynamicArray<LLGroupData>::iterator i = gAgent.mGroups.begin(); i != gAgent.mGroups.end(); ++i) // Search for this group in the agent's groups list
// Search for this group in the agent's groups list
LLDynamicArray<LLGroupData>::iterator i;
for (i = gAgent.mGroups.begin(); i != gAgent.mGroups.end(); i++)
{
if (i->mID == it->group_id) if (i->mID == it->group_id)
{ {
group_data = &*i; if (i->mListInProfile)
font_style = "BOLD";
break; break;
} }
}
// Set normal color if not found or if group is visible in profile
if (group_data)
{
std::string font_style = group_data->mListInProfile ? "BOLD" : "NORMAL";
if(group_data->mID == gAgent.getGroupID())
font_style.append("|ITALIC");
row["columns"][0]["font-style"] = font_style;
}
else
row["columns"][0]["font-style"] = "NORMAL";
}
if (group_list) if (it->group_id == gAgent.getGroupID())
{ font_style.append("|ITALIC");
group_list->addElement(row,ADD_SORTED); row.columns.add(LLScrollListCell::Params().value(it->group_id.notNull() ? it->group_name : "").font("SANSSERIF_SMALL").font_style(font_style));
} group_list->addRow(row,ADD_SORTED);
} }
} }
} }
@@ -312,12 +279,9 @@ void LLPanelAvatarSecondLife::enableControls(BOOL self)
void LLPanelAvatarFirstLife::onClickImage() void LLPanelAvatarFirstLife::onClickImage()
{ {
LLTextureCtrl* image_ctrl = getChild<LLTextureCtrl>("img"); const LLUUID& id(getChild<LLTextureCtrl>("img")->getImageAssetID());
if(image_ctrl)
{
LLUUID mUUID = image_ctrl->getImageAssetID();
llinfos << "LLPanelAvatarFirstLife::onClickImage" << llendl; llinfos << "LLPanelAvatarFirstLife::onClickImage" << llendl;
if(!LLPreview::show(mUUID)) if (!LLPreview::show(id))
{ {
// There isn't one, so make a new preview // There isn't one, so make a new preview
S32 left, top; S32 left, top;
@@ -327,25 +291,23 @@ void LLPanelAvatarFirstLife::onClickImage()
LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", LLPreviewTexture* preview = new LLPreviewTexture("preview task texture",
rect, rect,
std::string("Profile First Life Picture"), std::string("Profile First Life Picture"),
mUUID); id);
preview->setFocus(TRUE); preview->setFocus(TRUE);
//preview->mIsCopyable=FALSE; //preview->mIsCopyable=FALSE;
//preview->canSaveAs //preview->canSaveAs
} }
}
} }
// virtual // virtual
void LLPanelAvatarFirstLife::processProperties(void* data, EAvatarProcessorType type) void LLPanelAvatarFirstLife::processProperties(void* data, EAvatarProcessorType type)
{ {
if(type == APT_PROPERTIES) if (type == APT_PROPERTIES)
{ {
const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( data ); const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>(data);
if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null))
{ {
// Teens don't get these // Teens don't get these
childSetValue("about", pAvatarData->fl_about_text); getChildView("about")->setValue(pAvatarData->fl_about_text);
getChild<LLTextureCtrl>("img")->setImageAssetID(pAvatarData->fl_image_id); getChild<LLTextureCtrl>("img")->setImageAssetID(pAvatarData->fl_image_id);
} }
} }
@@ -353,42 +315,25 @@ void LLPanelAvatarFirstLife::processProperties(void* data, EAvatarProcessorType
void LLPanelAvatarSecondLife::onClickImage() void LLPanelAvatarSecondLife::onClickImage()
{ {
LLNameEditor* name_ctrl = getChild<LLNameEditor>("dnname"); const LLUUID& id = getChild<LLTextureCtrl>("img")->getImageAssetID();
if(name_ctrl)
{
std::string name_text = name_ctrl->getText();
LLTextureCtrl* image_ctrl = getChild<LLTextureCtrl>("img");
if(image_ctrl)
{
LLUUID mUUID = image_ctrl->getImageAssetID();
llinfos << "LLPanelAvatarSecondLife::onClickImage" << llendl; llinfos << "LLPanelAvatarSecondLife::onClickImage" << llendl;
if(!LLPreview::show(mUUID)) if (!LLPreview::show(id))
{ {
// There isn't one, so make a new preview // There isn't one, so make a new preview
S32 left, top; S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top); gFloaterView->getNewFloaterPosition(&left, &top);
LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); LLRect rect = gSavedSettings.getRect("PreviewTextureRect");
rect.translate( left - rect.mLeft, rect.mTop - top ); // Changed to avoid textures being sunken below the window border. rect.translate(left - rect.mLeft, rect.mTop - top); // Changed to avoid textures being sunken below the window border.
LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", LLPreviewTexture* preview = new LLPreviewTexture("preview task texture",
rect, rect,
std::string("Profile Picture: ") + name_text, std::string("Profile Picture: ") + getChild<LLNameEditor>("dnname")->getText(),
mUUID id);
);
preview->setFocus(TRUE); preview->setFocus(TRUE);
//preview->mIsCopyable=FALSE; //preview->mIsCopyable=FALSE;
/*open_texture(LLUUID::null,//id,
std::string("Profile Picture: ") + getChild<LLNameEditor>("dnname")->getText() + "and image id is " + id.asString()
, FALSE, id, TRUE);*/
} }
/*open_texture(LLUUID::null,//image_ctrl->getImageAssetID(),
std::string("Profile Picture: ") +
name_text+
"and image id is "+
image_ctrl->getImageAssetID().asString()
, FALSE, image_ctrl->getImageAssetID(), TRUE);*/
}
}
} }
void LLPanelAvatarSecondLife::onDoubleClickGroup() void LLPanelAvatarSecondLife::onDoubleClickGroup()
@@ -431,8 +376,11 @@ BOOL LLPanelAvatarSecondLife::postBuild()
childSetEnabled("born", FALSE); childSetEnabled("born", FALSE);
childSetEnabled("partner_edit", FALSE); childSetEnabled("partner_edit", FALSE);
getChild<LLUICtrl>("partner_help")->setCommitCallback(boost::bind(show_partner_help)); getChild<LLUICtrl>("partner_help")->setCommitCallback(boost::bind(show_partner_help));
getChild<LLUICtrl>("partner_info")->setCommitCallback(boost::bind(LLAvatarActions::showProfile, boost::ref(mPartnerID), false)); if (LLUICtrl* ctrl = getChild<LLUICtrl>("partner_info"))
childSetEnabled("partner_info", mPartnerID.notNull()); {
ctrl->setCommitCallback(boost::bind(LLAvatarActions::showProfile, boost::ref(mPartnerID), false));
ctrl->setEnabled(mPartnerID.notNull());
}
childSetAction("?", boost::bind(LLNotificationsUtil::add, "ClickPublishHelpAvatar")); childSetAction("?", boost::bind(LLNotificationsUtil::add, "ClickPublishHelpAvatar"));
LLPanelAvatar* pa = getPanelAvatar(); LLPanelAvatar* pa = getPanelAvatar();
@@ -483,10 +431,9 @@ BOOL LLPanelAvatarFirstLife::postBuild()
BOOL LLPanelAvatarNotes::postBuild() BOOL LLPanelAvatarNotes::postBuild()
{ {
getChild<LLUICtrl>("notes edit")->setCommitCallback(boost::bind(&LLPanelAvatar::sendAvatarNotesUpdate, getPanelAvatar())); LLTextEditor* te(getChild<LLTextEditor>("notes edit"));
te->setCommitCallback(boost::bind(&LLPanelAvatar::sendAvatarNotesUpdate, getPanelAvatar()));
LLTextEditor* te = getChild<LLTextEditor>("notes edit"); te->setCommitOnFocusLost(true);
if(te) te->setCommitOnFocusLost(TRUE);
return TRUE; return TRUE;
} }
@@ -639,13 +586,13 @@ void LLPanelAvatarWeb::setWebURL(std::string url)
{ {
load(mHome); load(mHome);
} }
childSetVisible("status_text", getPanelAvatar()->getAvatarID() != gAgentID);
} }
else else
{ {
childSetVisible("profile_html", false); childSetVisible("profile_html", false);
childSetVisible("status_text", false); childSetVisible("status_text", false);
} }
childSetVisible("status_text", !mHome.empty() && getPanelAvatar()->getAvatarID() != gAgentID);
} }
void LLPanelAvatarWeb::load(const std::string& url) void LLPanelAvatarWeb::load(const std::string& url)
@@ -716,37 +663,35 @@ LLPanelAvatarAdvanced::LLPanelAvatarAdvanced(const std::string& name,
void LLPanelAvatarAdvanced::enableControls(BOOL self) void LLPanelAvatarAdvanced::enableControls(BOOL self)
{ {
S32 t; for(S32 t(0); t < mWantToCount; ++t)
for(t=0;t<mWantToCount;t++) if (mWantToCheck[t])
{ mWantToCheck[t]->setEnabled(self);
if(mWantToCheck[t])mWantToCheck[t]->setEnabled(self); for(S32 t(0); t < mSkillsCount; ++t)
} if (mSkillsCheck[t])
for(t=0;t<mSkillsCount;t++) mSkillsCheck[t]->setEnabled(self);
{ if (mWantToEdit)
if(mSkillsCheck[t])mSkillsCheck[t]->setEnabled(self); mWantToEdit->setEnabled(self);
} if (mSkillsEdit)
mSkillsEdit->setEnabled(self);
if (mWantToEdit) mWantToEdit->setEnabled(self); childSetEnabled("languages_edit", self);
if (mSkillsEdit) mSkillsEdit->setEnabled(self);
childSetEnabled("languages_edit",self);
} }
void LLPanelAvatarAdvanced::setWantSkills(U32 want_to_mask, const std::string& want_to_text, void LLPanelAvatarAdvanced::setWantSkills(U32 want_to_mask, const std::string& want_to_text,
U32 skills_mask, const std::string& skills_text, U32 skills_mask, const std::string& skills_text,
const std::string& languages_text) const std::string& languages_text)
{ {
for(int id =0;id<mWantToCount;id++) for(S32 i = 0; i < mWantToCount; ++i)
{ {
mWantToCheck[id]->set( want_to_mask & 1<<id ); mWantToCheck[i]->set(want_to_mask & 1<<i);
} }
for(int id =0;id<mSkillsCount;id++) for(S32 i = 0; i < mSkillsCount; ++i)
{ {
mSkillsCheck[id]->set( skills_mask & 1<<id ); mSkillsCheck[i]->set(skills_mask & 1<<i);
} }
if (mWantToEdit && mSkillsEdit) if (mWantToEdit && mSkillsEdit)
{ {
mWantToEdit->setText( want_to_text ); mWantToEdit->setText(want_to_text);
mSkillsEdit->setText( skills_text ); mSkillsEdit->setText(skills_text);
} }
childSetText("languages_edit",languages_text); childSetText("languages_edit",languages_text);
@@ -759,30 +704,22 @@ void LLPanelAvatarAdvanced::getWantSkills(U32* want_to_mask, std::string& want_t
if (want_to_mask) if (want_to_mask)
{ {
*want_to_mask = 0; *want_to_mask = 0;
for(int t=0;t<mWantToCount;t++) for(S32 t = 0; t < mWantToCount; ++t)
{ if (mWantToCheck[t]->get())
if(mWantToCheck[t]->get())
*want_to_mask |= 1<<t; *want_to_mask |= 1<<t;
} }
}
if (skills_mask) if (skills_mask)
{ {
*skills_mask = 0; *skills_mask = 0;
for(int t=0;t<mSkillsCount;t++) for(S32 t = 0; t < mSkillsCount; ++t)
{
if(mSkillsCheck[t]->get()) if(mSkillsCheck[t]->get())
*skills_mask |= 1<<t; *skills_mask |= 1<<t;
} }
}
if (mWantToEdit) if (mWantToEdit)
{
want_to_text = mWantToEdit->getText(); want_to_text = mWantToEdit->getText();
}
if (mSkillsEdit) if (mSkillsEdit)
{
skills_text = mSkillsEdit->getText(); skills_text = mSkillsEdit->getText();
}
languages_text = childGetText("languages_edit"); languages_text = childGetText("languages_edit");
} }
@@ -806,8 +743,9 @@ void LLPanelAvatarNotes::refresh()
void LLPanelAvatarNotes::clearControls() void LLPanelAvatarNotes::clearControls()
{ {
childSetText("notes edit", getString("Loading")); LLView* view(getChildView("notes edit"));
childSetEnabled("notes edit", false); view->setValue(getString("Loading"));
view->setEnabled(false);
} }
@@ -907,12 +845,14 @@ void LLPanelAvatarClassified::processProperties(void* data, EAvatarProcessorType
// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
&& !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC); && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC);
// [/RLVa:KB] // [/RLVa:KB]
childSetEnabled("New...", self && !mInDirectory && allow_new); LLView* view(getChildView("New..."));
childSetVisible("New...", !mInDirectory); view->setEnabled(self && !mInDirectory && allow_new);
childSetEnabled("Delete...", self && !mInDirectory && tab_count); view->setVisible(!mInDirectory);
childSetVisible("Delete...", !mInDirectory); view = getChildView("Delete...");
childSetVisible("classified tab", !tab_count); view->setEnabled(self && !mInDirectory && tab_count);
childSetVisible("loading_text", false); view->setVisible(!mInDirectory);
view = getChildView("loading_text");
view->setVisible(false);
} }
} }
} }
@@ -931,8 +871,8 @@ void LLPanelAvatarClassified::onClickNew()
bool LLPanelAvatarClassified::callbackNew(const LLSD& notification, const LLSD& response) bool LLPanelAvatarClassified::callbackNew(const LLSD& notification, const LLSD& response)
{ {
S32 option = LLNotification::getSelectedOption(notification, response); if (LLNotification::getSelectedOption(notification, response))
if (option) return false; return false;
LLPanelClassifiedInfo* panel_classified = new LLPanelClassifiedInfo(false, false); LLPanelClassifiedInfo* panel_classified = new LLPanelClassifiedInfo(false, false);
panel_classified->initNewClassified(); panel_classified->initNewClassified();
LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); LLTabContainer* tabs = getChild<LLTabContainer>("classified tab");
@@ -963,8 +903,8 @@ void LLPanelAvatarClassified::onClickDelete()
bool LLPanelAvatarClassified::callbackDelete(const LLSD& notification, const LLSD& response) bool LLPanelAvatarClassified::callbackDelete(const LLSD& notification, const LLSD& response)
{ {
S32 option = LLNotification::getSelectedOption(notification, response); if (LLNotification::getSelectedOption(notification, response))
if (option) return false; return false;
LLTabContainer* tabs = getChild<LLTabContainer>("classified tab"); LLTabContainer* tabs = getChild<LLTabContainer>("classified tab");
LLPanelClassifiedInfo* panel_classified = (LLPanelClassifiedInfo*)tabs->getCurrentPanel(); LLPanelClassifiedInfo* panel_classified = (LLPanelClassifiedInfo*)tabs->getCurrentPanel();
@@ -1083,9 +1023,7 @@ void LLPanelAvatarPicks::onClickNew()
{ {
// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
return; return;
}
// [/RLVa:KB] // [/RLVa:KB]
LLPanelPick* panel_pick = new LLPanelPick; LLPanelPick* panel_pick = new LLPanelPick;
LLTabContainer* tabs = getChild<LLTabContainer>("picks tab"); LLTabContainer* tabs = getChild<LLTabContainer>("picks tab");
@@ -1146,8 +1084,8 @@ void LLPanelAvatarPicks::onClickDelete()
bool LLPanelAvatarPicks::callbackDelete(const LLSD& notification, const LLSD& response) bool LLPanelAvatarPicks::callbackDelete(const LLSD& notification, const LLSD& response)
{ {
S32 option = LLNotification::getSelectedOption(notification, response); if (LLNotification::getSelectedOption(notification, response))
if (option) return false; return false;
LLTabContainer* tabs = getChild<LLTabContainer>("picks tab"); LLTabContainer* tabs = getChild<LLTabContainer>("picks tab");
LLPanelPick* panel_pick = (LLPanelPick*)tabs->getCurrentPanel(); LLPanelPick* panel_pick = (LLPanelPick*)tabs->getCurrentPanel();
if (!panel_pick) return false; if (!panel_pick) return false;
@@ -1294,44 +1232,23 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status)
if(mPanelSecondLife) if(mPanelSecondLife)
mPanelSecondLife->childSetVisible("online_yes", online_status == ONLINE_STATUS_YES); mPanelSecondLife->childSetVisible("online_yes", online_status == ONLINE_STATUS_YES);
LLView* offer_tp(getChildView("Offer Teleport..."));
LLView* map_stalk(getChildView("Find on map"));
// Since setOnlineStatus gets called after setAvatarID // Since setOnlineStatus gets called after setAvatarID
// need to make sure that "Offer Teleport" doesn't get set // need to make sure that "Offer Teleport" doesn't get set
// to TRUE again for yourself // to TRUE again for yourself
if (mAvatarID != gAgentID) if (mAvatarID != gAgentID)
{ {
childSetVisible("Offer Teleport...",TRUE); offer_tp->setVisible(true);
childSetVisible("Find on Map", true); map_stalk->setVisible(true);
}
if (gAgent.isGodlike())
{
childSetEnabled("Offer Teleport...", TRUE);
childSetToolTip("Offer Teleport...", getString("TeleportGod"));
}
else if (gAgent.inPrelude())
{
childSetEnabled("Offer Teleport...",FALSE);
childSetToolTip("Offer Teleport...", getString("TeleportPrelude"));
}
else
{
childSetEnabled("Offer Teleport...", TRUE /*(online_status == ONLINE_STATUS_YES)*/);
childSetToolTip("Offer Teleport...", getString("TeleportNormal"));
}
bool prelude(gAgent.inPrelude());
bool godlike(gAgent.isGodlike());
offer_tp->setEnabled(!prelude /*(&& online_status == ONLINE_STATUS_YES)*/);
offer_tp->setToolTip(godlike ? getString("TeleportGod") : prelude ? getString("TeleportPrelude") : getString("TeleportNormal"));
// Note: we don't always know online status, so always allow gods to try to track // Note: we don't always know online status, so always allow gods to try to track
childSetEnabled("Find on Map", gAgent.isGodlike() || is_agent_mappable(mAvatarID)); map_stalk->setEnabled(godlike || is_agent_mappable(mAvatarID));
if (!mIsFriend) map_stalk->setToolTip(!mIsFriend ? getString("ShowOnMapNonFriend") : (ONLINE_STATUS_YES != online_status) ? getString("ShowOnMapFriendOffline") : getString("ShowOnMapFriendOnline"));
{
childSetToolTip("Find on Map", getString("ShowOnMapNonFriend"));
}
else if (ONLINE_STATUS_YES != online_status)
{
childSetToolTip("Find on Map", getString("ShowOnMapFriendOffline"));
}
else
{
childSetToolTip("Find on Map", getString("ShowOnMapFriendOnline"));
} }
} }
@@ -1384,24 +1301,24 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id)
mCacheConnection = LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2)); mCacheConnection = LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2));
LLNameEditor* key_edit = getChild<LLNameEditor>("avatar_key"); LLNameEditor* key_edit = getChild<LLNameEditor>("avatar_key");
if(key_edit) if (key_edit)
{
key_edit->setText(mAvatarID.asString()); key_edit->setText(mAvatarID.asString());
}
// if (avatar_changed)
{
// While we're waiting for data off the network, clear out the
// old data.
if(mPanelSecondLife) mPanelSecondLife->clearControls();
if(mPanelPicks) mPanelPicks->deletePickPanels(); // While we're waiting for data off the network, clear out the old data.
if(mPanelPicks) mPanelPicks->setDataRequested(false); if (mPanelSecondLife)
mPanelSecondLife->clearControls();
if(mPanelClassified) mPanelClassified->deleteClassifiedPanels(); if (mPanelPicks)
if(mPanelClassified) mPanelClassified->setDataRequested(false); mPanelPicks->deletePickPanels();
if (mPanelPicks)
if(mPanelNotes) mPanelNotes->clearControls(); mPanelPicks->setDataRequested(false);
if(mPanelNotes) mPanelNotes->setDataRequested(false); if (mPanelClassified)
mPanelClassified->deleteClassifiedPanels();
if (mPanelClassified)
mPanelClassified->setDataRequested(false);
if (mPanelNotes)
mPanelNotes->clearControls();
if (mPanelNotes)
mPanelNotes->setDataRequested(false);
mHaveNotes = false; mHaveNotes = false;
mLastNotes.clear(); mLastNotes.clear();
@@ -1410,74 +1327,52 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id)
// is made visible. JC // is made visible. JC
sendAvatarPropertiesRequest(); sendAvatarPropertiesRequest();
LLView* view(getChildView("OK"));
view->setVisible(own_avatar && mAllowEdit);
view->setEnabled(false); // OK button disabled until properties data arrives
view = getChildView("Cancel");
view->setVisible(own_avatar && mAllowEdit);
view->setEnabled(own_avatar && mAllowEdit);
view = getChildView("Instant Message...");
view->setVisible(!own_avatar);
view->setEnabled(false);
view = getChildView("GroupInvite_Button");
view->setVisible(!own_avatar);
view->setEnabled(false);
view = getChildView("Mute");
view->setVisible(!own_avatar);
view->setEnabled(false);
if (own_avatar) if (own_avatar)
{ {
if (mAllowEdit) view = getChildView("Offer Teleport...");
{ view->setVisible(false);
// OK button disabled until properties data arrives view->setEnabled(false);
childSetVisible("OK", true); view = getChildView("Find on Map");
childSetEnabled("OK", false); view->setVisible(false);
childSetVisible("Cancel",TRUE); view->setEnabled(false);
childSetEnabled("Cancel",TRUE);
} }
else view = getChildView("Add Friend...");
{ view->setVisible(!own_avatar);
childSetVisible("OK",FALSE); view->setEnabled(!own_avatar && !mIsFriend);
childSetEnabled("OK",FALSE); view = getChildView("Pay...");
childSetVisible("Cancel",FALSE); view->setVisible(!own_avatar);
childSetEnabled("Cancel",FALSE); view->setEnabled(false);
}
childSetVisible("Instant Message...",FALSE);
childSetEnabled("Instant Message...",FALSE);
childSetVisible("GroupInvite_Button",FALSE);
childSetEnabled("GroupInvite_Button",FALSE);
childSetVisible("Mute",FALSE);
childSetEnabled("Mute",FALSE);
childSetVisible("Offer Teleport...",FALSE);
childSetEnabled("Offer Teleport...",FALSE);
childSetVisible("Find on Map",FALSE);
childSetEnabled("Find on Map",FALSE);
childSetVisible("Add Friend...",FALSE);
childSetEnabled("Add Friend...",FALSE);
childSetVisible("Pay...",FALSE);
childSetEnabled("Pay...",FALSE);
}
else
{
childSetVisible("OK",FALSE);
childSetEnabled("OK",FALSE);
childSetVisible("Cancel",FALSE); getChild<LLNameEditor>("avatar_key")->setText(avatar_id.asString());
childSetEnabled("Cancel",FALSE);
childSetVisible("Instant Message...",TRUE);
childSetEnabled("Instant Message...",FALSE);
childSetVisible("GroupInvite_Button",TRUE);
childSetEnabled("GroupInvite_Button",FALSE);
childSetVisible("Mute",TRUE);
childSetEnabled("Mute",FALSE);
childSetVisible("Add Friend...", true);
childSetEnabled("Add Friend...", !mIsFriend);
childSetVisible("Pay...",TRUE);
childSetEnabled("Pay...",FALSE);
}
LLNameEditor* avatar_key = getChild<LLNameEditor>("avatar_key");
if (avatar_key)
{
avatar_key->setText(avatar_id.asString());
}
}
bool is_god = gAgent.isGodlike(); bool is_god = gAgent.isGodlike();
childSetVisible("Kick", is_god); view = getChildView("Kick");
childSetEnabled("Kick", is_god); view->setVisible(is_god);
childSetVisible("Freeze", is_god); view->setEnabled(is_god);
childSetEnabled("Freeze", is_god); view = getChildView("Freeze");
childSetVisible("Unfreeze", is_god); view->setVisible(is_god);
childSetEnabled("Unfreeze", is_god); view->setEnabled(is_god);
childSetVisible("csr_btn", is_god); view = getChildView("Unfreeze");
childSetEnabled("csr_btn", is_god); view->setVisible(is_god);
view->setEnabled(is_god);
view = getChildView("csr_btn");
view->setVisible(is_god);
view->setEnabled(is_god);
} }
@@ -1498,41 +1393,26 @@ void LLPanelAvatar::resetGroupList()
group_list->deleteAllItems(); group_list->deleteAllItems();
S32 count = gAgent.mGroups.size(); S32 count = gAgent.mGroups.size();
LLUUID id;
for(S32 i = 0; i < count; ++i) for(S32 i = 0; i < count; ++i)
{ {
LLGroupData group_data = gAgent.mGroups[i]; LLGroupData group_data = gAgent.mGroups[i];
id = group_data.mID;
std::string group_string;
/* Show group title? DUMMY_POWER for Don Grep
if(group_data.mOfficer)
{
group_string = "Officer of ";
}
else
{
group_string = "Member of ";
}
*/
group_string += group_data.mName;
LLSD row; const LLUUID& id(group_data.mID);
LLScrollListItem::Params row;
row["id"] = id ; row.value(id);
row["columns"][0]["value"] = group_string;
row["columns"][0]["font"] = "SANSSERIF_SMALL";
std::string font_style = group_data.mListInProfile ? "BOLD" : "NORMAL"; std::string font_style = group_data.mListInProfile ? "BOLD" : "NORMAL";
if(group_data.mID == gAgent.getGroupID()) if (id == gAgent.getGroupID())
font_style.append("|ITALIC"); font_style.append("|ITALIC");
row["columns"][0]["font-style"] = font_style; /* Show group title? DUMMY_POWER for Don Grep
row["columns"][0]["width"] = 0; (group_data.mOfficer ? "Officer of " : "Member of ") + group_data.mName;
group_list->addElement(row,ADD_SORTED); */
row.columns.add(LLScrollListCell::Params().value(group_data.mName).font("SANSSERIF_SMALL").font_style(font_style).width(0));
group_list->addRow(row, ADD_SORTED);
} }
if(selected_id.notNull()) if (selected_id.notNull())
group_list->selectByValue(selected_id); group_list->selectByValue(selected_id);
if(selected_idx!=group_list->getFirstSelectedIndex()) //if index changed then our stored pos is pointless. if (selected_idx != group_list->getFirstSelectedIndex()) //if index changed then our stored pos is pointless.
group_list->scrollToShowSelected(); group_list->scrollToShowSelected();
else else
group_list->setScrollPos(scroll_pos); group_list->setScrollPos(scroll_pos);
@@ -1542,10 +1422,8 @@ void LLPanelAvatar::resetGroupList()
void LLPanelAvatar::onClickGetKey() void LLPanelAvatar::onClickGetKey()
{ {
LLUUID agent_id = getAvatarID(); const LLUUID& agent_id(getAvatarID());
llinfos << "Copy agent id: " << agent_id << llendl; llinfos << "Copy agent id: " << agent_id << llendl;
gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(agent_id.asString())); gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(agent_id.asString()));
} }
@@ -1588,25 +1466,17 @@ void LLPanelAvatar::sendAvatarNotesUpdate()
{ {
std::string notes = mPanelNotes->childGetValue("notes edit").asString(); std::string notes = mPanelNotes->childGetValue("notes edit").asString();
if (!mHaveNotes if (!mHaveNotes && (notes.empty() || notes == getString("Loading")) || // no notes from server and no user updates
&& (notes.empty() || notes == getString("Loading"))) notes == mLastNotes) // Avatar notes unchanged
{
// no notes from server and no user updates
return; return;
}
if (notes == mLastNotes)
{
// Avatar notes unchanged
return;
}
LLAvatarPropertiesProcessor::getInstance()->sendNotes(mAvatarID,notes); LLAvatarPropertiesProcessor::instance().sendNotes(mAvatarID, notes);
} }
// virtual // virtual
void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type) void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type)
{ {
if(type == APT_PROPERTIES) if (type == APT_PROPERTIES)
{ {
const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( data ); const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( data );
if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id.notNull())) if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id.notNull()))
@@ -1627,18 +1497,11 @@ void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type)
t.tm_hour = t.tm_min = t.tm_sec = 0; t.tm_hour = t.tm_min = t.tm_sec = 0;
timeStructToFormattedString(&t, gSavedSettings.getString("ShortDateFormat"), born_on); timeStructToFormattedString(&t, gSavedSettings.getString("ShortDateFormat"), born_on);
}*/ }*/
setOnlineStatus(pAvatarData->flags & AVATAR_ONLINE ? ONLINE_STATUS_YES : ONLINE_STATUS_NO);
bool online = (pAvatarData->flags & AVATAR_ONLINE);
EOnlineStatus online_status = (online) ? ONLINE_STATUS_YES : ONLINE_STATUS_NO;
setOnlineStatus(online_status);
childSetValue("about", pAvatarData->about_text); childSetValue("about", pAvatarData->about_text);
} }
} }
else if(type == APT_NOTES) else if (type == APT_NOTES)
{ {
const LLAvatarNotes* pAvatarNotes = static_cast<const LLAvatarNotes*>( data ); const LLAvatarNotes* pAvatarNotes = static_cast<const LLAvatarNotes*>( data );
if (pAvatarNotes && (mAvatarID == pAvatarNotes->target_id) && (pAvatarNotes->target_id != LLUUID::null)) if (pAvatarNotes && (mAvatarID == pAvatarNotes->target_id) && (pAvatarNotes->target_id != LLUUID::null))
@@ -1662,32 +1525,12 @@ void LLPanelAvatar::enableOKIfReady()
void LLPanelAvatar::sendAvatarPropertiesUpdate() void LLPanelAvatar::sendAvatarPropertiesUpdate()
{ {
llinfos << "Sending avatarinfo update" << llendl; llinfos << "Sending avatarinfo update" << llendl;
BOOL allow_publish = FALSE;
if (LLPanelAvatar::sAllowFirstLife)
{
allow_publish = childGetValue("allow_publish");
}
LLUUID first_life_image_id;
std::string first_life_about_text;
if (mPanelFirstLife)
{
first_life_about_text = mPanelFirstLife->childGetValue("about").asString();
LLTextureCtrl* image_ctrl = mPanelFirstLife->getChild<LLTextureCtrl>("img");
if(image_ctrl)
{
first_life_image_id = image_ctrl->getImageAssetID();
}
}
std::string about_text = mPanelSecondLife->childGetValue("about").asString();
LLAvatarData avatar_data; LLAvatarData avatar_data;
avatar_data.image_id = mPanelSecondLife->getChild<LLTextureCtrl>("img")->getImageAssetID(); avatar_data.image_id = mPanelSecondLife->getChild<LLTextureCtrl>("img")->getImageAssetID();
avatar_data.fl_image_id = first_life_image_id; avatar_data.fl_image_id = mPanelFirstLife ? mPanelFirstLife->getChild<LLTextureCtrl>("img")->getImageAssetID() : LLUUID::null;
avatar_data.about_text = about_text; avatar_data.about_text = mPanelSecondLife->childGetValue("about").asString();
avatar_data.fl_about_text = first_life_about_text; avatar_data.fl_about_text = mPanelFirstLife ? mPanelFirstLife->childGetValue("about").asString() : LLStringUtil::null;
avatar_data.allow_publish = allow_publish; avatar_data.allow_publish = sAllowFirstLife && childGetValue("allow_publish");
avatar_data.profile_url = mPanelWeb->childGetText("url_edit"); avatar_data.profile_url = mPanelWeb->childGetText("url_edit");
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&avatar_data); LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&avatar_data);
@@ -1716,21 +1559,21 @@ void LLPanelAvatar::selectTabByName(std::string tab_name)
void* LLPanelAvatar::createPanelAvatarSecondLife(void* data) void* LLPanelAvatar::createPanelAvatarSecondLife(void* data)
{ {
LLPanelAvatar* self = (LLPanelAvatar*)data; LLPanelAvatar* self = (LLPanelAvatar*)data;
self->mPanelSecondLife = new LLPanelAvatarSecondLife(std::string("2nd Life"),LLRect(),self); self->mPanelSecondLife = new LLPanelAvatarSecondLife("2nd Life", LLRect(), self);
return self->mPanelSecondLife; return self->mPanelSecondLife;
} }
void* LLPanelAvatar::createPanelAvatarWeb(void* data) void* LLPanelAvatar::createPanelAvatarWeb(void* data)
{ {
LLPanelAvatar* self = (LLPanelAvatar*)data; LLPanelAvatar* self = (LLPanelAvatar*)data;
self->mPanelWeb = new LLPanelAvatarWeb(std::string("Web"),LLRect(),self); self->mPanelWeb = new LLPanelAvatarWeb("Web",LLRect(),self);
return self->mPanelWeb; return self->mPanelWeb;
} }
void* LLPanelAvatar::createPanelAvatarInterests(void* data) void* LLPanelAvatar::createPanelAvatarInterests(void* data)
{ {
LLPanelAvatar* self = (LLPanelAvatar*)data; LLPanelAvatar* self = (LLPanelAvatar*)data;
self->mPanelAdvanced = new LLPanelAvatarAdvanced(std::string("Interests"),LLRect(),self); self->mPanelAdvanced = new LLPanelAvatarAdvanced("Interests", LLRect(), self);
return self->mPanelAdvanced; return self->mPanelAdvanced;
} }
@@ -1738,27 +1581,27 @@ void* LLPanelAvatar::createPanelAvatarInterests(void* data)
void* LLPanelAvatar::createPanelAvatarPicks(void* data) void* LLPanelAvatar::createPanelAvatarPicks(void* data)
{ {
LLPanelAvatar* self = (LLPanelAvatar*)data; LLPanelAvatar* self = (LLPanelAvatar*)data;
self->mPanelPicks = new LLPanelAvatarPicks(std::string("Picks"),LLRect(),self); self->mPanelPicks = new LLPanelAvatarPicks("Picks", LLRect(), self);
return self->mPanelPicks; return self->mPanelPicks;
} }
void* LLPanelAvatar::createPanelAvatarClassified(void* data) void* LLPanelAvatar::createPanelAvatarClassified(void* data)
{ {
LLPanelAvatar* self = (LLPanelAvatar*)data; LLPanelAvatar* self = (LLPanelAvatar*)data;
self->mPanelClassified = new LLPanelAvatarClassified(std::string("Classified"),LLRect(),self); self->mPanelClassified = new LLPanelAvatarClassified("Classified", LLRect(), self);
return self->mPanelClassified; return self->mPanelClassified;
} }
void* LLPanelAvatar::createPanelAvatarFirstLife(void* data) void* LLPanelAvatar::createPanelAvatarFirstLife(void* data)
{ {
LLPanelAvatar* self = (LLPanelAvatar*)data; LLPanelAvatar* self = (LLPanelAvatar*)data;
self->mPanelFirstLife = new LLPanelAvatarFirstLife(std::string("1st Life"), LLRect(), self); self->mPanelFirstLife = new LLPanelAvatarFirstLife("1st Life", LLRect(), self);
return self->mPanelFirstLife; return self->mPanelFirstLife;
} }
void* LLPanelAvatar::createPanelAvatarNotes(void* data) void* LLPanelAvatar::createPanelAvatarNotes(void* data)
{ {
LLPanelAvatar* self = (LLPanelAvatar*)data; LLPanelAvatar* self = (LLPanelAvatar*)data;
self->mPanelNotes = new LLPanelAvatarNotes(std::string("My Notes"),LLRect(),self); self->mPanelNotes = new LLPanelAvatarNotes("My Notes", LLRect(),self);
return self->mPanelNotes; return self->mPanelNotes;
} }