LP: implemented own profile editing

master
Kadah_Coba 2012-02-11 20:50:01 -08:00
parent 7a21a60a99
commit 3135abd856
11 changed files with 264 additions and 55 deletions

View File

@ -100,10 +100,10 @@ void FSFloaterProfile::onOKBtn()
{
FSPanelProfile* panel_profile = findChild<FSPanelProfile>(PANEL_PROFILE);
FSPanelProfileWeb* panel_web = findChild<FSPanelProfileWeb>(PANEL_WEB);
// FSPanelProfileInterests* panel_interests = findChild<FSPanelProfileInterests>(PANEL_INTERESTS);
FSPanelProfileInterests* panel_interests = findChild<FSPanelProfileInterests>(PANEL_INTERESTS);
FSPanelProfilePicks* panel_picks = findChild<FSPanelProfilePicks>(PANEL_PICKS);
FSPanelProfileFirstLife* panel_firstlife = findChild<FSPanelProfileFirstLife>(PANEL_FIRSTLIFE);
// FSPanelAvatarNotes* panel_notes = findChild<FSPanelAvatarNotes>(PANEL_NOTES);
FSPanelAvatarNotes* panel_notes = findChild<FSPanelAvatarNotes>(PANEL_NOTES);
//KC - Avatar data is spread over 3 different panels
// collect data from the last 2 and give to the first to save
@ -113,9 +113,9 @@ void FSFloaterProfile::onOKBtn()
panel_web->apply(&data);
panel_profile->apply(&data);
// panel_interests->apply();
panel_interests->apply();
panel_picks->apply();
// panel_notes->apply();
panel_notes->apply();
}
closeFloater();

View File

@ -182,6 +182,10 @@ BOOL FSPanelProfile::postBuild()
enable.add("Profile.EnableUnblock", boost::bind(&FSPanelProfile::enableUnblock, this));
LLGroupList* group_list = getChild<LLGroupList>("group_list");
if (getAvatarId() == gAgent.getID())
{
group_list->enableForAgent();
}
group_list->setDoubleClickCallback(boost::bind(&FSPanelProfile::openGroupProfile, this));
group_list->setReturnCallback(boost::bind(&FSPanelProfile::openGroupProfile, this));
@ -209,11 +213,6 @@ void FSPanelProfile::onOpen(const LLSD& key)
getChild<LLUICtrl>("block")->setVisible( false );
getChild<LLUICtrl>("unblock")->setVisible( false );
getChild<LLUICtrl>("overflow_btn")->setVisible( false );
getChild<LLUICtrl>("show_in_search_checkbox")->setVisible( true );
getChild<LLUICtrl>("show_in_search_checkbox")->setEnabled( true );
getChild<LLUICtrl>("sl_description_edit")->setEnabled( true );
getChild<LLUICtrl>("2nd_life_pic")->setEnabled( true );
}
else
{
@ -226,7 +225,7 @@ void FSPanelProfile::onOpen(const LLSD& key)
void FSPanelProfile::apply(LLAvatarData* data)
{
if (getAvatarId() == gAgent.getID())
if (getIsLoaded() && (getAvatarId() == gAgent.getID()))
{
data->image_id = getChild<LLTextureCtrl>("2nd_life_pic")->getImageAssetID();
data->about_text = getChild<LLUICtrl>("sl_description_edit")->getValue().asString();
@ -241,7 +240,10 @@ void FSPanelProfile::updateData()
if (getAvatarId().notNull())
{
LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(getAvatarId());
LLAvatarPropertiesProcessor::getInstance()->sendAvatarGroupsRequest(getAvatarId());
if (getAvatarId() != gAgent.getID())
{
LLAvatarPropertiesProcessor::getInstance()->sendAvatarGroupsRequest(getAvatarId());
}
}
}
@ -253,6 +255,7 @@ void FSPanelProfile::processProperties(void* data, EAvatarProcessorType type)
if(avatar_data && getAvatarId() == avatar_data->avatar_id)
{
processProfileProperties(avatar_data);
enableControls();
}
}
else if(APT_GROUPS == type)
@ -657,6 +660,19 @@ void FSPanelProfile::processOnlineStatus(bool online)
mStatusText->setValue(status);
}
void FSPanelProfile::enableControls()
{
FSPanelProfileTab::enableControls();
if (getAvatarId() == gAgent.getID())
{
getChild<LLUICtrl>("show_in_search_checkbox")->setVisible( true );
getChild<LLUICtrl>("show_in_search_checkbox")->setEnabled( true );
getChild<LLUICtrl>("sl_description_edit")->setEnabled( true );
getChild<LLUICtrl>("2nd_life_pic")->setEnabled( true );
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -671,6 +687,11 @@ FSPanelProfileWeb::~FSPanelProfileWeb()
{
}
void FSPanelProfileWeb::onOpen(const LLSD& key)
{
FSPanelProfileTab::onOpen(key);
}
BOOL FSPanelProfileWeb::postBuild()
{
getChild<LLUICtrl>("load")->setCommitCallback(boost::bind(&FSPanelProfileWeb::onCommitLoad, this, _1));
@ -681,6 +702,8 @@ BOOL FSPanelProfileWeb::postBuild()
mWebBrowser = getChild<LLMediaCtrl>("profile_html");
mWebBrowser->addObserver(this);
getChild<LLLineEditor>("url_edit")->setEnabled( FALSE );
return TRUE;
}
@ -694,6 +717,7 @@ void FSPanelProfileWeb::processProperties(void* data, EAvatarProcessorType type)
mURLHome = avatar_data->profile_url;
getChild<LLUICtrl>("url_edit")->setValue(mURLHome);
childSetEnabled("load", mURLHome.length() > 0);
enableControls();
}
}
}
@ -828,6 +852,16 @@ void FSPanelProfileWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent e
}
}
void FSPanelProfileWeb::enableControls()
{
FSPanelProfileTab::enableControls();
if (getAvatarId() == gAgent.getID())
{
getChild<LLLineEditor>("url_edit")->setEnabled( TRUE );
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -844,6 +878,11 @@ FSPanelProfileInterests::~FSPanelProfileInterests()
{
}
void FSPanelProfileInterests::onOpen(const LLSD& key)
{
FSPanelProfileTab::onOpen(key);
}
BOOL FSPanelProfileInterests::postBuild()
{
for (S32 i=0; i < WANT_CHECKS; ++i)
@ -858,6 +897,12 @@ BOOL FSPanelProfileInterests::postBuild()
mSkillChecks[i] = getChild<LLCheckBoxCtrl>(check_name);
}
//FS:KC - Due to a bug with LLLineEditor, it cannot be disabled from XUI
// It won't properly enable from code if it is.
getChild<LLLineEditor>("want_to_edit")->setEnabled( FALSE );
getChild<LLLineEditor>("skills_edit")->setEnabled( FALSE );
getChild<LLLineEditor>("languages_edit")->setEnabled( FALSE );
return TRUE;
}
@ -869,9 +914,9 @@ void FSPanelProfileInterests::processProperties(void* data, EAvatarProcessorType
const FSInterestsData* interests_data = static_cast<const FSInterestsData*>(data);
if (interests_data && getAvatarId() == interests_data->avatar_id)
{
for (S32 i=0; i < WANT_CHECKS; ++i)
for (S32 i=0; i < WANT_CHECKS; i++)
{
if (interests_data->want_to_mask & 1<<i)
if (interests_data->want_to_mask & (1<<i))
{
mWantChecks[i]->setValue(TRUE);
}
@ -881,9 +926,9 @@ void FSPanelProfileInterests::processProperties(void* data, EAvatarProcessorType
}
}
for (S32 i=0; i < SKILL_CHECKS; ++i)
for (S32 i=0; i < SKILL_CHECKS; i++)
{
if (interests_data->skills_mask & 1<<i)
if (interests_data->skills_mask & (1<<i))
{
mSkillChecks[i]->setValue(TRUE);
}
@ -896,10 +941,66 @@ void FSPanelProfileInterests::processProperties(void* data, EAvatarProcessorType
childSetText("want_to_edit", interests_data->want_to_text);
childSetText("skills_edit", interests_data->skills_text);
childSetText("languages_edit", interests_data->languages_text);
enableControls();
}
}
}
void FSPanelProfileInterests::apply()
{
if (getIsLoaded() && (getAvatarId() == gAgent.getID()))
{
FSInterestsData interests_data = FSInterestsData();
interests_data.want_to_mask = 0;
for (S32 i=0; i < WANT_CHECKS; i++)
{
if (mWantChecks[i]->getValue().asBoolean())
{
interests_data.want_to_mask |= (1<<i);
}
}
interests_data.skills_mask = 0;
for (S32 i=0; i < SKILL_CHECKS; i++)
{
if (mSkillChecks[i]->getValue().asBoolean())
{
interests_data.skills_mask |= (1<<i);
}
}
interests_data.want_to_text = getChild<LLUICtrl>("want_to_edit")->getValue().asString();
interests_data.skills_text = getChild<LLUICtrl>("skills_edit")->getValue().asString();
interests_data.languages_text = getChild<LLUICtrl>("languages_edit")->getValue().asString();
LLAvatarPropertiesProcessor::getInstance()->sendInterestsInfoUpdate(&interests_data);
}
}
void FSPanelProfileInterests::enableControls()
{
FSPanelProfileTab::enableControls();
if (getAvatarId() == gAgent.getID())
{
getChild<LLLineEditor>("want_to_edit")->setEnabled( TRUE );
getChild<LLLineEditor>("skills_edit")->setEnabled( TRUE );
getChild<LLLineEditor>("languages_edit")->setEnabled( TRUE );
for (S32 i=0; i < WANT_CHECKS; ++i)
{
mWantChecks[i]->setEnabled( TRUE );
}
for (S32 i=0; i < SKILL_CHECKS; ++i)
{
mSkillChecks[i]->setEnabled( TRUE );
}
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -1093,7 +1194,7 @@ void FSPanelPick::onClickTeleport()
void FSPanelPick::enableSaveButton(bool enable)
{
// getChildView("save_changes_btn")->setEnabled(enable);
getChildView("save_changes_btn")->setEnabled(enable);
getChild<LLUICtrl>("save_changes_btn")->setVisible(enable);
}
@ -1284,6 +1385,15 @@ void FSPanelProfilePicks::onOpen(const LLSD& key)
{
FSPanelProfileTab::onOpen(key);
if (getAvatarId() == gAgent.getID())
{
getChild<LLUICtrl>("new_btn")->setVisible( true );
getChild<LLUICtrl>("new_btn")->setEnabled( true );
getChild<LLUICtrl>("delete_btn")->setVisible( true );
getChild<LLUICtrl>("delete_btn")->setEnabled( true );
}
updateData();
}
@ -1451,6 +1561,11 @@ FSPanelProfileFirstLife::~FSPanelProfileFirstLife()
{
}
void FSPanelProfileFirstLife::onOpen(const LLSD& key)
{
FSPanelProfileTab::onOpen(key);
}
void FSPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType type)
{
if(APT_PROPERTIES == type)
@ -1460,6 +1575,7 @@ void FSPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType
{
getChild<LLUICtrl>("fl_description_edit")->setValue(avatar_data->fl_about_text);
getChild<LLUICtrl>("real_world_pic")->setValue(avatar_data->fl_image_id);
enableControls();
}
}
}
@ -1470,6 +1586,17 @@ void FSPanelProfileFirstLife::apply(LLAvatarData* data)
data->fl_about_text = getChild<LLUICtrl>("fl_description_edit")->getValue().asString();
}
void FSPanelProfileFirstLife::enableControls()
{
FSPanelProfileTab::enableControls();
if (getAvatarId() == gAgent.getID())
{
getChild<LLUICtrl>("fl_description_edit")->setEnabled( true );
getChild<LLUICtrl>("real_world_pic")->setEnabled( true );
}
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
@ -1508,6 +1635,15 @@ void FSPanelAvatarNotes::onOpen(const LLSD& key)
updateData();
}
void FSPanelAvatarNotes::apply()
{
if (getIsLoaded())
{
//likely overkill
onCommitNotes();
}
}
void FSPanelAvatarNotes::fillRightsData()
{
getChild<LLUICtrl>("status_check")->setValue(FALSE);
@ -1618,6 +1754,7 @@ void FSPanelAvatarNotes::processProperties(void* data, EAvatarProcessorType type
{
getChild<LLUICtrl>("notes_edit")->setValue(avatar_notes->notes);
getChildView("notes edit")->setEnabled(true);
enableControls();
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this);
}
@ -1659,6 +1796,4 @@ void FSPanelAvatarNotes::setAvatarId(const LLUUID& id)
}
}
// eof

View File

@ -79,9 +79,14 @@ protected:
virtual void onMapButtonClick();
virtual void enableControls() { mLoaded = TRUE; }
bool getIsLoaded() { return mLoaded; }
private:
LLUUID mAvatarId;
LLUUID mAvatarId;
BOOL mLoaded;
};
@ -206,6 +211,8 @@ protected:
void updateOnlineStatus();
void processOnlineStatus(bool online);
virtual void enableControls();
private:
typedef std::map<std::string,LLUUID> group_map_t;
group_map_t mGroups;
@ -228,6 +235,8 @@ public:
FSPanelProfileWeb();
/*virtual*/ ~FSPanelProfileWeb();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ BOOL postBuild();
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
@ -247,6 +256,8 @@ public:
void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
virtual void enableControls();
protected:
void onCommitLoad(LLUICtrl* ctrl);
void onCommitWebProfile(LLUICtrl* ctrl);
@ -270,11 +281,19 @@ public:
FSPanelProfileInterests();
/*virtual*/ ~FSPanelProfileInterests();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ BOOL postBuild();
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
/**
* Saves changes.
*/
virtual void apply();
protected:
virtual void enableControls();
private:
LLCheckBoxCtrl *mWantChecks[8];
@ -307,6 +326,9 @@ public:
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
/**
* Saves changes.
*/
virtual void apply();
//This stuff we got from LLRemoteParcelObserver, in the last one we intentionally do nothing
@ -429,6 +451,9 @@ public:
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
/**
* Saves changes.
*/
virtual void apply();
protected:
@ -456,7 +481,9 @@ class FSPanelProfileFirstLife
{
public:
FSPanelProfileFirstLife();
/*virtual*/ ~FSPanelProfileFirstLife();;
/*virtual*/ ~FSPanelProfileFirstLife();
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
@ -464,6 +491,9 @@ public:
* Saves changes.
*/
void apply(LLAvatarData* data);
protected:
virtual void enableControls();
};
/**
@ -492,6 +522,11 @@ public:
/*virtual*/ void updateData();
/**
* Saves changes.
*/
virtual void apply();
protected:
/**
* Fills rights data for friends.

View File

@ -669,3 +669,28 @@ void LLAvatarPropertiesProcessor::removePendingRequest(const LLUUID& avatar_id,
timestamp_map_t::key_type key = std::make_pair(avatar_id, type);
mRequestTimestamps.erase(key);
}
//<FS:KC legacy profiles>
void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const FSInterestsData* interests_data)
{
if(!interests_data)
{
return;
}
LLMessageSystem* msg = gMessageSystem;
msg->newMessage(_PREHASH_AvatarInterestsUpdate);
msg->nextBlockFast( _PREHASH_AgentData);
msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast( _PREHASH_SessionID, gAgent.getSessionID() );
msg->nextBlockFast( _PREHASH_PropertiesData);
msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask);
msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text);
msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask);
msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text);
msg->addString( _PREHASH_LanguagesText, interests_data->languages_text);
gAgent.sendReliableMessage();
}
//</FS:KC legacy profiles>

View File

@ -232,6 +232,10 @@ public:
void sendClassifiedDelete(const LLUUID& classified_id);
//<FS:KC legacy profiles>
void sendInterestsInfoUpdate(const FSInterestsData* interests_data);
//</FS:KC legacy profiles>
// Returns translated, human readable string for account type, such
// as "Resident" or "Linden Employee". Used for profiles, inspectors.
static std::string accountType(const LLAvatarData* avatar_data);

View File

@ -79,30 +79,16 @@ LLGroupList::LLGroupList(const Params& p)
mForAgent(p.for_agent)
, mDirty(true) // to force initial update
{
// Listen for agent group changes.
if (mForAgent) gAgent.addListener(this, "new group");
mShowIcons = mForAgent && gSavedSettings.getBOOL("GroupListShowIcons");
setCommitOnSelectionChange(true);
// Set default sort order.
setComparator(&GROUP_COMPARATOR);
if (mForAgent)
if (mForAgent)
{
// Set up context menu.
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
registrar.add("People.Groups.Action", boost::bind(&LLGroupList::onContextMenuItemClick, this, _2));
enable_registrar.add("People.Groups.Enable", boost::bind(&LLGroupList::onContextMenuItemEnable, this, _2));
LLMenuGL* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_groups.xml",
gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(context_menu)
mContextMenuHandle = context_menu->getHandle();
}
enableForAgent();
}
}
LLGroupList::~LLGroupList()
@ -111,6 +97,26 @@ LLGroupList::~LLGroupList()
if (mContextMenuHandle.get()) mContextMenuHandle.get()->die();
}
void LLGroupList::enableForAgent()
{
mForAgent = true;
// Listen for agent group changes.
gAgent.addListener(this, "new group");
// Set up context menu.
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
registrar.add("People.Groups.Action", boost::bind(&LLGroupList::onContextMenuItemClick, this, _2));
enable_registrar.add("People.Groups.Enable", boost::bind(&LLGroupList::onContextMenuItemEnable, this, _2));
LLMenuGL* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_groups.xml",
gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(context_menu)
mContextMenuHandle = context_menu->getHandle();
}
// virtual
void LLGroupList::draw()
{

View File

@ -54,6 +54,8 @@ public:
LLGroupList(const Params& p);
virtual ~LLGroupList();
void enableForAgent();
virtual void draw(); // from LLView
/*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); // from LLView

View File

@ -81,7 +81,7 @@
bottom_delta="0"
left="10"
height="20"
width="100"
width="90"
layout="topleft"
follows="left|bottom"
name="ok_btn"
@ -93,7 +93,7 @@
bottom_delta="0"
right="-10"
height="20"
width="100"
width="90"
layout="topleft"
follows="right|bottom"
name="cancel_btn"

View File

@ -105,7 +105,6 @@
follows="left|top"
name="want_to_edit"
is_unicode="false"
enabled="false"
max_length="254" />
<text
@ -138,6 +137,7 @@
name="schk1"
label="Architecture"
enabled="false" />
<!-- The next two are out of order on purpose due to the odd layout used in v1.x -->
<check_box
top_pad="1"
left="75"
@ -145,8 +145,8 @@
width="90"
layout="topleft"
follows="left|top"
name="schk2"
label="Event Planning"
name="schk3"
label="Modeling"
enabled="false" />
<check_box
left_pad="80"
@ -154,8 +154,8 @@
width="90"
layout="topleft"
follows="left|top"
name="schk3"
label="Modeling"
name="schk2"
label="Event Planning"
enabled="false" />
<check_box
top_pad="1"
@ -185,7 +185,6 @@
follows="left|top"
name="skills_edit"
is_unicode="false"
enabled="false"
max_length="254" />
<text
@ -208,7 +207,6 @@
follows="left|top"
name="languages_edit"
is_unicode="false"
enabled="false"
max_length="254" />
</panel>

View File

@ -34,7 +34,9 @@
layout="topleft"
follows="left|top"
name="new_btn"
label="New..." />
label="New..."
visible="false"
enabled="false" />
<button
left_pad="5"
height="20"
@ -42,7 +44,9 @@
layout="topleft"
follows="left|top"
name="delete_btn"
label="Delete..." />
label="Delete..."
visible="false"
enabled="false" />
<!--
<button
left_pad="5"

View File

@ -16,7 +16,6 @@
layout="topleft"
follows="left|top"
name="url_edit"
enabled="false"
is_unicode="false"
max_length="254" />
@ -65,9 +64,9 @@
<web_browser
top="48"
bottom="-15"
bottom="-18"
left="10"
right="-1"
right="-10"
layout="topleft"
follows="all"
name="profile_html"
@ -75,11 +74,12 @@
start_url="" />
<text
bottom="-2"
bottom="-4"
left="110"
right="-100"
right="-110"
layout="topleft"
follows="bottom|left|right"
name="status_text" />
name="status_text"
halign="center" />
</panel>