Commit 2cb924ac authored by Cinder's avatar Cinder
Browse files

ALCH-301 - Edit picks from profile

parent e4db2f5c
......@@ -54,7 +54,7 @@
#include "lluiconstants.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llworldmap.h"
#define XML_PANEL_EDIT_PICK "panel_edit_pick.xml"
......@@ -98,7 +98,7 @@ LLPanelPickInfo::LLPanelPickInfo()
LLPanelPickInfo::~LLPanelPickInfo()
{
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
LLAvatarPropertiesProcessor::getInstance()->removeObserver(LLPanelPickInfo::getAvatarId(), this);
if (mParcelId.notNull())
{
......@@ -355,6 +355,7 @@ LLPanelPickEdit::LLPanelPickEdit()
, mLocationChanged(false)
, mNeedData(true)
, mNewPick(false)
, text_icon(nullptr)
{
}
......@@ -489,8 +490,6 @@ BOOL LLPanelPickEdit::isDirty() const
return FALSE;
}
// PROTECTED AREA
void LLPanelPickEdit::sendUpdate()
{
LLPickData pick_data;
......
......@@ -148,8 +148,6 @@ protected:
void onClickBack();
protected:
S32 mScrollingPanelMinHeight;
S32 mScrollingPanelWidth;
LLScrollContainer* mScrollContainer;
......@@ -176,13 +174,10 @@ public:
*/
static LLPanelPickEdit* create();
/*virtual*/ ~LLPanelPickEdit();
/*virtual*/ void onOpen(const LLSD& key) override;
~LLPanelPickEdit();
void onOpen(const LLSD& key) override;
virtual void setPickData(const LLPickData* pick_data);
/*virtual*/ BOOL postBuild() override;
BOOL postBuild() override;
/**
* Sets "Save" button click callback
......@@ -197,24 +192,24 @@ public:
/**
* Resets panel and all cantrols to unedited state
*/
/*virtual*/ void resetDirty() override;
void resetDirty() override;
/**
* Returns true if any of Pick properties was changed by user.
*/
/*virtual*/ BOOL isDirty() const override;
BOOL isDirty() const override;
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type) override;
void processProperties(void* data, EAvatarProcessorType type) override;
/**
* Sends Pick properties to server.
*/
void sendUpdate();
protected:
LLPanelPickEdit();
/**
* Sends Pick properties to server.
*/
void sendUpdate();
/**
* Called when snapshot image changes.
*/
......@@ -244,8 +239,6 @@ protected:
std::string getLocationNotice();
protected:
bool mLocationChanged;
bool mNeedData;
bool mNewPick;
......
......@@ -75,7 +75,6 @@ static LLPanelInjector<LLPanelProfileLegacy::LLPanelProfilePicks> t_panel_picks(
LLPanelProfileLegacy::LLPanelProfileLegacy()
: LLPanelProfileTab()
, mPickDetail(nullptr)
, mPanelPicks(nullptr)
, mPanelGroups(nullptr)
{
......@@ -140,8 +139,6 @@ void LLPanelProfileLegacy::onOpen(const LLSD& key)
// *TODO: Actions, if any
return;
}
if (mPickDetail != nullptr)
closePanel(mPickDetail);
if (mNameChangedConnection.connected())
{
......@@ -538,7 +535,6 @@ void LLPanelProfileLegacy::openPanel(LLPanel* panel, const LLSD& params)
panel->reshape(new_rect.getWidth(), new_rect.getHeight());
new_rect.setLeftTopAndSize(0, new_rect.getHeight(), new_rect.getWidth(), new_rect.getHeight());
panel->setRect(new_rect);
mPickDetail = panel;
}
void LLPanelProfileLegacy::closePanel(LLPanel* panel)
......@@ -563,29 +559,28 @@ void LLPanelProfileLegacy::closePanel(LLPanel* panel)
LL_WARNS() << "No underlying panel to focus." << LL_ENDL;
}
}
mPickDetail = nullptr;
}
// LLPanelProfilePicks //
LLPanelProfileLegacy::LLPanelProfilePicks::LLPanelProfilePicks()
: LLPanelProfileTab(),
mProfilePanel(nullptr),
mClassifiedsList(nullptr),
mPicksList(nullptr),
mPanelPickInfo(nullptr),
mPanelClassifiedInfo(nullptr)
mProfilePanel(nullptr),
mClassifiedsList(nullptr),
mPicksList(nullptr),
mPanelPickEdit(nullptr),
mPanelPickInfo(nullptr),
mPanelClassifiedInfo(nullptr)
{
}
BOOL LLPanelProfileLegacy::LLPanelProfilePicks::postBuild()
{
mPicksList = getChild<LLFlatListView>("picks_list");
mClassifiedsList = getChild<LLFlatListView>("classifieds_list");
childSetAction("teleport_btn", boost::bind(&LLPanelProfileLegacy::LLPanelProfilePicks::onClickTeleport, this));
childSetAction("show_on_map_btn", boost::bind(&LLPanelProfileLegacy::LLPanelProfilePicks::onClickShowOnMap, this));
childSetAction("info_btn", boost::bind(&LLPanelProfileLegacy::LLPanelProfilePicks::onClickInfo, this));
childSetAction("teleport_btn", boost::bind(&LLPanelProfilePicks::onClickTeleport, this));
childSetAction("show_on_map_btn", boost::bind(&LLPanelProfilePicks::onClickShowOnMap, this));
childSetAction("info_btn", boost::bind(&LLPanelProfilePicks::onClickInfo, this));
updateButtons();
return TRUE;
}
......@@ -610,6 +605,7 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::processProperties(void* data, EA
{
if (APT_PICKS == type)
{
mPicksList->clear();
LLAvatarPicks* avatar_picks = static_cast<LLAvatarPicks*>(data);
if (!avatar_picks || getAvatarId() != avatar_picks->target_id) return;
for (const LLAvatarPicks::pick_data_t& pick: avatar_picks->picks_list)
......@@ -618,7 +614,7 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::processProperties(void* data, EA
const std::string pick_name = pick.second;
LLPickItem* picture = LLPickItem::create();
picture->childSetAction("info_chevron", boost::bind(&LLPanelProfileLegacy::LLPanelProfilePicks::onClickInfo, this));
picture->childSetAction("info_chevron", boost::bind(&LLPanelProfilePicks::onClickInfo, this));
picture->setPickName(pick_name);
picture->setPickId(pick_id);
picture->setCreatorId(getAvatarId());
......@@ -632,7 +628,7 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::processProperties(void* data, EA
pick_value.insert(PICK_CREATOR_ID, getAvatarId());
mPicksList->addItem(picture, pick_value);
picture->setMouseUpCallback(boost::bind(&LLPanelProfileLegacy::LLPanelProfilePicks::updateButtons, this));
picture->setMouseUpCallback(boost::bind(&LLPanelProfilePicks::updateButtons, this));
}
showAccordion("tab_picks", mPicksList->size());
}
......@@ -643,7 +639,7 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::processProperties(void* data, EA
for (const LLAvatarClassifieds::classified_data& c_data: c_info->classifieds_list)
{
LLClassifiedItem* c_item = new LLClassifiedItem(getAvatarId(), c_data.classified_id);
c_item->childSetAction("info_chevron", boost::bind(&LLPanelProfileLegacy::LLPanelProfilePicks::onClickInfo, this));
c_item->childSetAction("info_chevron", boost::bind(&LLPanelProfilePicks::onClickInfo, this));
c_item->setClassifiedName(c_data.name);
LLSD pick_value = LLSD();
......@@ -654,7 +650,7 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::processProperties(void* data, EA
{
mClassifiedsList->addItem(c_item, pick_value);
}
c_item->setMouseUpCallback(boost::bind(&LLPanelProfileLegacy::LLPanelProfilePicks::updateButtons, this));
c_item->setMouseUpCallback(boost::bind(&LLPanelProfilePicks::updateButtons, this));
}
showAccordion("tab_classifieds", mClassifiedsList->size());
}
......@@ -760,6 +756,7 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::openPickInfo()
{
mPanelPickInfo = LLPanelPickInfo::create();
mPanelPickInfo->setExitCallback(boost::bind(&LLPanelProfilePicks::onPanelPickClose, this, mPanelPickInfo));
mPanelPickInfo->setEditPickCallback(boost::bind(&LLPanelProfilePicks::onPanelEditPick, this));
mPanelPickInfo->setVisible(FALSE);
}
......@@ -837,6 +834,33 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::onPanelPickClose(LLPanel* panel)
getProfilePanel()->closePanel(panel);
}
void LLPanelProfileLegacy::LLPanelProfilePicks::onPanelPickEditSave(LLPanelPickEdit* panel)
{
panel->sendUpdate();
getProfilePanel()->closePanel(panel);
}
void LLPanelProfileLegacy::LLPanelProfilePicks::onPanelEditPick()
{
LLSD selected_value = mPicksList->getSelectedValue();
if (selected_value.isUndefined()) return;
LLPickItem* pick = dynamic_cast<LLPickItem*>(mPicksList->getSelectedItem());
LLSD params;
params["pick_id"] = pick->getPickId();
params["avatar_id"] = pick->getCreatorId();
params["snapshot_id"] = pick->getSnapshotId();
params["pick_name"] = pick->getPickName();
params["pick_desc"] = pick->getPickDesc();
mPanelPickEdit = LLPanelPickEdit::create();
mPanelPickEdit->setCancelCallback(boost::bind(&LLPanelProfilePicks::onPanelPickClose, this, mPanelPickEdit));
mPanelPickEdit->setSaveCallback(boost::bind(&LLPanelProfilePicks::onPanelPickEditSave, this, mPanelPickEdit));
getProfilePanel()->openPanel(mPanelPickEdit, params);
}
void LLPanelProfileLegacy::LLPanelProfilePicks::setProfilePanel(LLPanelProfileLegacy* profile_panel)
{
mProfilePanel = profile_panel;
......@@ -935,7 +959,7 @@ LLProfileGroupItem* LLProfileGroupItem::create()
void LLProfileGroupItem::init(const LLAvatarGroups::LLGroupData& data)
{
setId(data.group_id);
setName(data.group_name);
setGroupName(data.group_name);
setInsignia(data.group_insignia_id);
LLGroupMgr::getInstance()->addObserver(this);
LLGroupMgr::getInstance()->sendGroupPropertiesRequest(data.group_id);
......@@ -969,7 +993,7 @@ void LLProfileGroupItem::setInsignia(const LLUUID& id)
getChild<LLTextureCtrl>("picture")->setImageAssetID(id);
}
void LLProfileGroupItem::setName(const std::string& name)
void LLProfileGroupItem::setGroupName(const std::string& name)
{
mGroupName = name;
getChild<LLUICtrl>("name")->setValue(name);
......
......@@ -38,6 +38,7 @@ class LLAvatarName;
class LLClassifiedItem;
class LLFlatListView;
class LLPanel;
class LLPanelPickEdit;
class LLPanelPickInfo;
class LLPanelProfileTab;
class LLPanelClassifiedInfo;
......@@ -49,8 +50,8 @@ class LLPanelProfileLegacy : public LLPanelProfileTab
public:
LLPanelProfileLegacy();
BOOL postBuild() override;
/* virtual */ void onOpen(const LLSD& key) override;
/* virtual */ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override;
void onOpen(const LLSD& key) override;
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) override;
protected:
void openPanel(LLPanel* panel, const LLSD& params);
......@@ -58,9 +59,9 @@ protected:
private:
~LLPanelProfileLegacy();
/* virtual */ void updateData() override;
/* virtual */ void processProperties(void* data, EAvatarProcessorType type) override;
/* virtual */ void resetControls() override;
void updateData() override;
void processProperties(void* data, EAvatarProcessorType type) override;
void resetControls() override;
void setProgress(bool started);
void showAccordion(const std::string& name, bool show);
void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
......@@ -103,7 +104,6 @@ private:
LLPanel* mParent;
};
ChildStack mChildStack;
LLPanel* mPickDetail;
public:
class LLPanelProfilePicks : public LLPanelProfileTab
......@@ -111,17 +111,21 @@ public:
friend class LLPanelProfileLegacy;
public:
LLPanelProfilePicks();
/* virtual */ BOOL postBuild() override;
BOOL postBuild() override;
protected:
/* virtual */ void onOpen(const LLSD& key) override;
void onOpen(const LLSD& key) override;
private:
/* virtual */ void updateData() override;
/* virtual */ void processProperties(void* data, EAvatarProcessorType type) override;
/* virtual */ void resetControls() override {};
void updateData() override;
void processProperties(void* data, EAvatarProcessorType type) override;
void resetControls() override {};
void showAccordion(const std::string& name, bool show);
void setProfilePanel(LLPanelProfileLegacy* profile_panel);
LLPanelProfileLegacy* getProfilePanel() const;
void onPanelPickClose(LLPanel* panel);
void onPanelPickEditSave(LLPanelPickEdit* panel);
void onPanelEditPick();
void updateButtons() override;
void onClickInfo();
void onClickTeleport();
......@@ -135,6 +139,7 @@ public:
LLPanelProfileLegacy* mProfilePanel;
LLFlatListView* mClassifiedsList;
LLFlatListView* mPicksList;
LLPanelPickEdit* mPanelPickEdit;
LLPanelPickInfo* mPanelPickInfo;
LLPanelClassifiedInfo* mPanelClassifiedInfo;
};
......@@ -144,13 +149,15 @@ public:
friend class LLPanelProfileLegacy;
public:
LLPanelProfileGroups();
/* virtual */ BOOL postBuild() override;
BOOL postBuild() override;
protected:
/* virtual */ void onOpen(const LLSD& key) override;
void onOpen(const LLSD& key) override;
private:
/* virtual */ void updateData() override;
/* virtual */ void processProperties(void* data, EAvatarProcessorType type) override;
/* virtual */ void resetControls() override {};
void updateData() override;
void processProperties(void* data, EAvatarProcessorType type) override;
void resetControls() override {};
void showGroup(const LLUUID& id);
LLTextBase* mGroupsText;
......@@ -169,15 +176,17 @@ public:
~LLProfileGroupItem();
static LLProfileGroupItem* create();
void init(const LLAvatarGroups::LLGroupData& data);
/* virtual */ BOOL postBuild() override;
BOOL postBuild() override;
void setValue(const LLSD& value) override;
void setId(const LLUUID& id);
void setInsignia(const LLUUID& id);
void setName(const std::string& name);
void setGroupName(const std::string& name);
void setCharter(const std::string& charter);
protected:
/* virtual */ void changed(LLGroupChange gc) override;
void changed(LLGroupChange gc) override;
private:
LLUUID mInsignia;
std::string mGroupName;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment