From ecd482d24b63d9658ac71d2bf4155e3ed9175bb9 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Thu, 5 Nov 2009 14:08:31 +0200 Subject: Implemented major sub-task EXT-2250 - Implement Classifieds list in Picks panel. --HG-- branch : product-engine --- indra/newview/llavatarpropertiesprocessor.cpp | 90 +++++- indra/newview/llavatarpropertiesprocessor.h | 50 ++- indra/newview/llpanelpicks.cpp | 344 +++++++++++++++++++-- indra/newview/llpanelpicks.h | 66 +++- indra/newview/llstartup.cpp | 5 +- .../skins/default/xui/en/menu_picks_plus.xml | 22 ++ .../newview/skins/default/xui/en/notifications.xml | 12 + .../default/xui/en/panel_classifieds_list_item.xml | 83 +++++ indra/newview/skins/default/xui/en/panel_picks.xml | 43 ++- 9 files changed, 685 insertions(+), 30 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/menu_picks_plus.xml create mode 100644 indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 73e24ca8e7..98a6a4b92a 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -158,6 +158,11 @@ void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar removePendingRequest(avatar_id, APT_TEXTURES); } +void LLAvatarPropertiesProcessor::sendAvatarClassifiedsRequest(const LLUUID& avatar_id) +{ + sendGenericRequest(avatar_id, APT_CLASSIFIEDS, "avatarclassifiedsrequest"); +} + void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props) { llinfos << "Sending avatarinfo update" << llendl; @@ -284,12 +289,60 @@ void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* m */ } -void LLAvatarPropertiesProcessor::processAvatarClassifiedReply(LLMessageSystem* msg, void**) +void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg, void**) { - // avatarclassifiedsrequest is not sent according to new UI design but - // keep this method according to resolved issues. + LLAvatarClassifieds classifieds; + + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, classifieds.agent_id); + msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, classifieds.target_id); + + S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data); + + for(int n = 0; n < block_count; ++n) + { + LLAvatarClassifieds::classified_data data; + + msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, data.classified_id, n); + msg->getString(_PREHASH_Data, _PREHASH_Name, data.name, n); + + classifieds.classifieds_list.push_back(data); + } + + LLAvatarPropertiesProcessor* self = getInstance(); + // Request processed, no longer pending + self->removePendingRequest(classifieds.target_id, APT_CLASSIFIEDS); + self->notifyObservers(classifieds.target_id,&classifieds,APT_CLASSIFIEDS); } +void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* msg, void**) +{ + LLAvatarClassifiedInfo c_info; + + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, c_info.agent_id); + + msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, c_info.classified_id); + msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, c_info.creator_id); + msg->getU32(_PREHASH_Data, _PREHASH_CreationDate, c_info.creation_date); + msg->getU32(_PREHASH_Data, _PREHASH_ExpirationDate, c_info.expiration_date); + msg->getU32(_PREHASH_Data, _PREHASH_Category, c_info.category); + msg->getString(_PREHASH_Data, _PREHASH_Name, c_info.name); + msg->getString(_PREHASH_Data, _PREHASH_Desc, c_info.description); + msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, c_info.parcel_id); + msg->getU32(_PREHASH_Data, _PREHASH_ParentEstate, c_info.parent_estate); + msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, c_info.snapshot_id); + msg->getString(_PREHASH_Data, _PREHASH_SimName, c_info.sim_name); + msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, c_info.pos_global); + msg->getString(_PREHASH_Data, _PREHASH_ParcelName, c_info.parcel_name); + msg->getU8(_PREHASH_Data, _PREHASH_ClassifiedFlags, c_info.classified_flags); + msg->getS32(_PREHASH_Data, _PREHASH_PriceForListing, c_info.price_for_listing); + + LLAvatarPropertiesProcessor* self = getInstance(); + // Request processed, no longer pending + self->removePendingRequest(c_info.agent_id, APT_CLASSIFIED_INFO); + self->notifyObservers(c_info.agent_id, &c_info, APT_CLASSIFIED_INFO); +} + + void LLAvatarPropertiesProcessor::processAvatarNotesReply(LLMessageSystem* msg, void**) { LLAvatarNotes avatar_notes; @@ -451,6 +504,22 @@ void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id ) LLAgentPicksInfo::getInstance()->decrementNumberOfPicks(); } +void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_id) +{ + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage(_PREHASH_ClassifiedDelete); + + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_ClassifiedID, classified_id); + + gAgent.sendReliableMessage(); +} + void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) { if (!new_pick) return; @@ -495,6 +564,21 @@ void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, send_generic_message("pickinforequest", request_params); } +void LLAvatarPropertiesProcessor::sendClassifiedInfoRequest(const LLUUID& avatar_id, const LLUUID& classified_id) +{ + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage(_PREHASH_ClassifiedInfoRequest); + msg->nextBlock(_PREHASH_AgentData); + + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_ClassifiedID, classified_id); + + gAgent.sendReliableMessage(); +} bool LLAvatarPropertiesProcessor::isPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type) { diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index e6563024b2..3c6b4e17d9 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -53,7 +53,9 @@ enum EAvatarProcessorType APT_GROUPS, APT_PICKS, APT_PICK_INFO, - APT_TEXTURES + APT_TEXTURES, + APT_CLASSIFIEDS, + APT_CLASSIFIED_INFO }; struct LLAvatarData @@ -136,6 +138,43 @@ struct LLAvatarGroups }; }; +struct LLAvatarClassifieds +{ + LLUUID agent_id; + LLUUID target_id; + + struct classified_data; + typedef std::list classifieds_list_t; + + classifieds_list_t classifieds_list; + + struct classified_data + { + LLUUID classified_id; + std::string name; + }; +}; + +struct LLAvatarClassifiedInfo +{ + LLUUID agent_id; + LLUUID classified_id; + LLUUID creator_id; + U32 creation_date; + U32 expiration_date; + U32 category; + std::string name; + std::string description; + LLUUID parcel_id; + U32 parent_estate; + LLUUID snapshot_id; + std::string sim_name; + LLVector3d pos_global; + std::string parcel_name; + U8 classified_flags; + S32 price_for_listing; +}; + class LLAvatarPropertiesObserver { public: @@ -162,10 +201,13 @@ public: void sendAvatarNotesRequest(const LLUUID& avatar_id); void sendAvatarGroupsRequest(const LLUUID& avatar_id); void sendAvatarTexturesRequest(const LLUUID& avatar_id); + void sendAvatarClassifiedsRequest(const LLUUID& avatar_id); // Duplicate pick info requests are not suppressed. void sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id); + void sendClassifiedInfoRequest(const LLUUID& avatar_id, const LLUUID& classified_id); + void sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props); void sendPickInfoUpdate(const LLPickData* new_pick); @@ -176,6 +218,8 @@ public: void sendPickDelete(const LLUUID& pick_id); + void sendClassifiedDelete(const LLUUID& classified_id); + // 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); @@ -189,7 +233,9 @@ public: static void processAvatarInterestsReply(LLMessageSystem* msg, void**); - static void processAvatarClassifiedReply(LLMessageSystem* msg, void**); + static void processAvatarClassifiedsReply(LLMessageSystem* msg, void**); + + static void processClassifiedInfoReply(LLMessageSystem* msg, void**); static void processAvatarGroupsReply(LLMessageSystem* msg, void**); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 6181531f82..526c604bb4 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -45,6 +45,8 @@ #include "llviewermenu.h" #include "llregistry.h" +#include "llaccordionctrl.h" +#include "llaccordionctrltab.h" #include "llpanelpicks.h" #include "llavatarpropertiesprocessor.h" #include "llpanelavatar.h" @@ -62,6 +64,9 @@ static const std::string PICK_ID("pick_id"); static const std::string PICK_CREATOR_ID("pick_creator_id"); static const std::string PICK_NAME("pick_name"); +static const std::string CLASSIFIED_ID("classified_id"); +static const std::string CLASSIFIED_NAME("classified_name"); + static LLRegisterPanelClassWrapper t_panel_picks("panel_picks"); @@ -74,9 +79,13 @@ LLPanelPicks::LLPanelPicks() mProfilePanel(NULL), mPickPanel(NULL), mPicksList(NULL), + mClassifiedsList(NULL), mPanelPickInfo(NULL), mPanelPickEdit(NULL), - mOverflowMenu(NULL) + mOverflowMenu(NULL), + mPlusMenu(NULL), + mPicksAccTab(NULL), + mClassifiedsAccTab(NULL) { } @@ -100,6 +109,9 @@ void LLPanelPicks::updateData() { mPicksList->clear(); LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(getAvatarId()); + + mClassifiedsList->clear(); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarClassifiedsRequest(getAvatarId()); } } @@ -138,13 +150,47 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type) mPicksList->addItem(picture, pick_value); - picture->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickItem, this, _1)); + picture->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickPickItem, this, _1)); picture->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4)); picture->setMouseUpCallback(boost::bind(&LLPanelPicks::updateButtons, this)); } + showAccordion("tab_picks", mPicksList->size()); + + resetDirty(); + updateButtons(); + } + } + else if(APT_CLASSIFIEDS == type) + { + LLAvatarClassifieds* c_info = static_cast(data); + if(c_info && getAvatarId() == c_info->target_id) + { + mClassifiedsList->clear(); + + LLAvatarClassifieds::classifieds_list_t::const_iterator it = c_info->classifieds_list.begin(); + for(; c_info->classifieds_list.end() != it; ++it) + { + LLAvatarClassifieds::classified_data c_data = *it; + + LLClassifiedItem* c_item = new LLClassifiedItem(getAvatarId(), c_data.classified_id); + c_item->childSetAction("info_chevron", boost::bind(&LLPanelPicks::onClickInfo, this)); + c_item->setName(c_data.name); + + LLSD pick_value = LLSD(); + pick_value.insert(CLASSIFIED_ID, c_data.classified_id); + pick_value.insert(CLASSIFIED_NAME, c_data.name); + + mClassifiedsList->addItem(c_item, pick_value); + + c_item->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickClassifiedItem, this, _1)); + c_item->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4)); + c_item->setMouseUpCallback(boost::bind(&LLPanelPicks::updateButtons, this)); + } + + showAccordion("tab_classifieds", mClassifiedsList->size()); + resetDirty(); - LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); updateButtons(); } } @@ -158,16 +204,44 @@ LLPickItem* LLPanelPicks::getSelectedPickItem() return dynamic_cast(selected_item); } +LLClassifiedItem* LLPanelPicks::getSelectedClassifiedItem() +{ + LLPanel* selected_item = mClassifiedsList->getSelectedItem(); + if (!selected_item) + { + return NULL; + } + return dynamic_cast(selected_item); +} + BOOL LLPanelPicks::postBuild() { mPicksList = getChild("picks_list"); + mClassifiedsList = getChild("classifieds_list"); + + mPicksList->setCommitOnSelectionChange(true); + mClassifiedsList->setCommitOnSelectionChange(true); + + mPicksList->setCommitCallback(boost::bind(&LLPanelPicks::onListCommit, this, mPicksList)); + mClassifiedsList->setCommitCallback(boost::bind(&LLPanelPicks::onListCommit, this, mClassifiedsList)); - childSetAction(XML_BTN_NEW, boost::bind(&LLPanelPicks::onClickNew, this)); + mPicksList->setNoItemsCommentText(getString("no_picks")); + mClassifiedsList->setNoItemsCommentText(getString("no_classifieds")); + + childSetAction(XML_BTN_NEW, boost::bind(&LLPanelPicks::onClickPlusBtn, this)); childSetAction(XML_BTN_DELETE, boost::bind(&LLPanelPicks::onClickDelete, this)); childSetAction(XML_BTN_TELEPORT, boost::bind(&LLPanelPicks::onClickTeleport, this)); childSetAction(XML_BTN_SHOW_ON_MAP, boost::bind(&LLPanelPicks::onClickMap, this)); childSetAction(XML_BTN_INFO, boost::bind(&LLPanelPicks::onClickInfo, this)); childSetAction(XML_BTN_OVERFLOW, boost::bind(&LLPanelPicks::onOverflowButtonClicked, this)); + + mPicksAccTab = getChild("tab_picks"); + mPicksAccTab->setDropDownStateChangedCallback(boost::bind(&LLPanelPicks::onAccordionStateChanged, this, mPicksAccTab)); + mPicksAccTab->setDisplayChildren(true); + + mClassifiedsAccTab = getChild("tab_classifieds"); + mClassifiedsAccTab->setDropDownStateChangedCallback(boost::bind(&LLPanelPicks::onAccordionStateChanged, this, mClassifiedsAccTab)); + mClassifiedsAccTab->setDisplayChildren(false); LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar; registar.add("Pick.Info", boost::bind(&LLPanelPicks::onClickInfo, this)); @@ -180,6 +254,10 @@ BOOL LLPanelPicks::postBuild() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar overflow_registar; overflow_registar.add("PicksList.Overflow", boost::bind(&LLPanelPicks::onOverflowMenuItemClicked, this, _2)); mOverflowMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_picks_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar plus_registar; + plus_registar.add("Picks.Plus.Action", boost::bind(&LLPanelPicks::onPlusMenuItemClicked, this, _2)); + mPlusMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_picks_plus.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); return TRUE; } @@ -202,6 +280,50 @@ void LLPanelPicks::onOverflowMenuItemClicked(const LLSD& param) } } +void LLPanelPicks::onPlusMenuItemClicked(const LLSD& param) +{ + std::string value = param.asString(); + + if("new_pick" == value) + { + createNewPick(); + } + else if("new_classified" == value) + { + createNewClassified(); + } +} + +void LLPanelPicks::onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab) +{ + if(acc_tab->getDisplayChildren()) + { + if(acc_tab != mPicksAccTab && mPicksAccTab->getDisplayChildren()) + { + mPicksAccTab->setDisplayChildren(false); + } + + if(acc_tab != mClassifiedsAccTab && mClassifiedsAccTab->getDisplayChildren()) + { + mClassifiedsAccTab->setDisplayChildren(false); + } + + LLAccordionCtrl* accordion = getChild("accordion"); + accordion->arrange(); + } + + if(!mPicksAccTab->getDisplayChildren()) + { + mPicksList->resetSelection(true); + } + if(!mClassifiedsAccTab->getDisplayChildren()) + { + mClassifiedsList->resetSelection(true); + } + + updateButtons(); +} + void LLPanelPicks::onOverflowButtonClicked() { LLRect rect; @@ -250,21 +372,50 @@ void LLPanelPicks::onOpen(const LLSD& key) LLPanelProfileTab::onOpen(key); } +void LLPanelPicks::onListCommit(const LLFlatListView* f_list) +{ + // Make sure only one of the lists has selection. + if(f_list == mPicksList) + { + mClassifiedsList->resetSelection(true); + } + else if(f_list == mClassifiedsList) + { + mPicksList->resetSelection(true); + } + else + { + llwarns << "Unknown list" << llendl; + } + + updateButtons(); +} + //static void LLPanelPicks::onClickDelete() { - LLSD pick_value = mPicksList->getSelectedValue(); - if (pick_value.isUndefined()) return; + LLSD value = mPicksList->getSelectedValue(); + if (value.isDefined()) + { + LLSD args; + args["PICK"] = value[PICK_NAME]; + LLNotifications::instance().add("DeleteAvatarPick", args, LLSD(), boost::bind(&LLPanelPicks::callbackDeletePick, this, _1, _2)); + return; + } - LLSD args; - args["PICK"] = pick_value[PICK_NAME]; - LLNotifications::instance().add("DeleteAvatarPick", args, LLSD(), boost::bind(&LLPanelPicks::callbackDelete, this, _1, _2)); + value = mClassifiedsList->getSelectedValue(); + if(value.isDefined()) + { + LLSD args; + args["NAME"] = value[CLASSIFIED_NAME]; + LLNotifications::instance().add("DeleteClassified", args, LLSD(), boost::bind(&LLPanelPicks::callbackDeleteClassified, this, _1, _2)); + return; + } } -bool LLPanelPicks::callbackDelete(const LLSD& notification, const LLSD& response) +bool LLPanelPicks::callbackDeletePick(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); - LLSD pick_value = mPicksList->getSelectedValue(); if (0 == option) @@ -276,6 +427,20 @@ bool LLPanelPicks::callbackDelete(const LLSD& notification, const LLSD& response return false; } +bool LLPanelPicks::callbackDeleteClassified(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + LLSD value = mClassifiedsList->getSelectedValue(); + + if (0 == option) + { + LLAvatarPropertiesProcessor::instance().sendClassifiedDelete(value[CLASSIFIED_ID]); + mClassifiedsList->removeItemByValue(value); + } + updateButtons(); + return false; +} + bool LLPanelPicks::callbackTeleport( const LLSD& notification, const LLSD& response ) { S32 option = LLNotification::getSelectedOption(notification, response); @@ -291,9 +456,14 @@ bool LLPanelPicks::callbackTeleport( const LLSD& notification, const LLSD& respo void LLPanelPicks::onClickTeleport() { LLPickItem* pick_item = getSelectedPickItem(); - if (!pick_item) return; + LLClassifiedItem* c_item = getSelectedClassifiedItem(); + + LLVector3d pos; + if(pick_item) + pos = pick_item->getPosGlobal(); + else if(c_item) + pos = c_item->getPosGlobal(); - LLVector3d pos = pick_item->getPosGlobal(); if (!pos.isExactlyZero()) { gAgent.teleportViaLocation(pos); @@ -305,9 +475,15 @@ void LLPanelPicks::onClickTeleport() void LLPanelPicks::onClickMap() { LLPickItem* pick_item = getSelectedPickItem(); - if (!pick_item) return; + LLClassifiedItem* c_item = getSelectedClassifiedItem(); + + LLVector3d pos; + if (pick_item) + pos = pick_item->getPosGlobal(); + else if(c_item) + pos = c_item->getPosGlobal(); - LLFloaterWorldMap::getInstance()->trackLocation(pick_item->getPosGlobal()); + LLFloaterWorldMap::getInstance()->trackLocation(pos); LLFloaterReg::showInstance("world_map", "center"); } @@ -325,7 +501,7 @@ void LLPanelPicks::onRightMouseUpItem(LLUICtrl* item, S32 x, S32 y, MASK mask) } } -void LLPanelPicks::onDoubleClickItem(LLUICtrl* item) +void LLPanelPicks::onDoubleClickPickItem(LLUICtrl* item) { LLSD pick_value = mPicksList->getSelectedValue(); if (pick_value.isUndefined()) return; @@ -335,9 +511,19 @@ void LLPanelPicks::onDoubleClickItem(LLUICtrl* item) LLNotifications::instance().add("TeleportToPick", args, LLSD(), boost::bind(&LLPanelPicks::callbackTeleport, this, _1, _2)); } +void LLPanelPicks::onDoubleClickClassifiedItem(LLUICtrl* item) +{ + LLSD value = mClassifiedsList->getSelectedValue(); + if (value.isUndefined()) return; + + LLSD args; + args["CLASSIFIED"] = value[CLASSIFIED_NAME]; + LLNotifications::instance().add("TeleportToClassified", args, LLSD(), boost::bind(&LLPanelPicks::callbackTeleport, this, _1, _2)); +} + void LLPanelPicks::updateButtons() { - bool has_selected = mPicksList->numSelected(); + bool has_selected = mPicksList->numSelected() > 0 || mClassifiedsList->numSelected() > 0; if (getAvatarId() == gAgentID) { @@ -366,14 +552,41 @@ void LLPanelPicks::buildPickPanel() // } } -void LLPanelPicks::onClickNew() +void LLPanelPicks::onClickPlusBtn() +{ + LLRect rect; + childGetRect(XML_BTN_NEW, rect); + + mPlusMenu->updateParent(LLMenuGL::sMenuContainer); + mPlusMenu->setButtonRect(rect, this); + LLMenuGL::showPopup(this, mPlusMenu, rect.mLeft, rect.mTop); +} + +void LLPanelPicks::createNewPick() { createPickEditPanel(); getProfilePanel()->openPanel(mPanelPickEdit, LLSD()); } +void LLPanelPicks::createNewClassified() +{ + LLNotifications::instance().add("ClickUnimplemented"); +} + void LLPanelPicks::onClickInfo() +{ + if(mPicksList->numSelected() > 0) + { + openPickInfo(); + } + else if(mClassifiedsList->numSelected() > 0) + { + openClassifiedInfo(); + } +} + +void LLPanelPicks::openPickInfo() { LLSD selected_value = mPicksList->getSelectedValue(); if (selected_value.isUndefined()) return; @@ -392,6 +605,19 @@ void LLPanelPicks::onClickInfo() getProfilePanel()->openPanel(mPanelPickInfo, params); } +void LLPanelPicks::openClassifiedInfo() +{ + LLNotifications::instance().add("ClickUnimplemented"); +} + +void LLPanelPicks::showAccordion(const std::string& name, bool show) +{ + LLAccordionCtrlTab* tab = getChild(name); + tab->setVisible(show); + LLAccordionCtrl* acc = getChild("accordion"); + acc->arrange(); +} + void LLPanelPicks::onPanelPickClose(LLPanel* panel) { panel->setVisible(FALSE); @@ -475,7 +701,14 @@ void LLPanelPicks::onPanelPickEdit() void LLPanelPicks::onClickMenuEdit() { - onPanelPickEdit(); + if(getSelectedPickItem()) + { + onPanelPickEdit(); + } + else if(getSelectedClassifiedItem()) + { + LLNotifications::instance().add("ClickUnimplemented"); + } } inline LLPanelProfile* LLPanelPicks::getProfilePanel() @@ -610,3 +843,76 @@ void LLPickItem::setValue(const LLSD& value) if (!value.has("selected")) return; childSetVisible("selected_icon", value["selected"]); } + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLClassifiedItem::LLClassifiedItem(const LLUUID& avatar_id, const LLUUID& classified_id) + : LLPanel() + , mAvatarId(avatar_id) + , mClassifiedId(classified_id) +{ + LLUICtrlFactory::getInstance()->buildPanel(this,"panel_classifieds_list_item.xml"); + + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); + LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getAvatarId(), getClassifiedId()); +} + +LLClassifiedItem::~LLClassifiedItem() +{ + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); +} + +void LLClassifiedItem::processProperties(void* data, EAvatarProcessorType type) +{ + if(APT_CLASSIFIED_INFO != type) + { + return; + } + + LLAvatarClassifiedInfo* c_info = static_cast(data); + if( !(c_info && c_info->agent_id == getAvatarId() + && c_info->classified_id == getClassifiedId()) ) + { + return; + } + + setName(c_info->name); + setDescription(c_info->description); + setSnapshotId(c_info->snapshot_id); + setPosGlobal(c_info->pos_global); + + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); +} + +BOOL LLClassifiedItem::postBuild() +{ + setMouseEnterCallback(boost::bind(&LLPanelPickInfo::childSetVisible, this, "hovered_icon", true)); + setMouseLeaveCallback(boost::bind(&LLPanelPickInfo::childSetVisible, this, "hovered_icon", false)); + return TRUE; +} + +void LLClassifiedItem::setValue(const LLSD& value) +{ + if (!value.isMap()) return;; + if (!value.has("selected")) return; + childSetVisible("selected_icon", value["selected"]); +} + +void LLClassifiedItem::setName(const std::string& name) +{ + childSetValue("name", name); +} + +void LLClassifiedItem::setDescription(const std::string& desc) +{ + childSetValue("description", desc); +} + +void LLClassifiedItem::setSnapshotId(const LLUUID& snapshot_id) +{ + childSetValue("picture", snapshot_id); +} + +//EOF diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index 06a0f0a0fd..d6321a475c 100644 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -40,6 +40,7 @@ #include "llpanelavatar.h" #include "llregistry.h" +class LLAccordionCtrlTab; class LLPanelProfile; class LLMessageSystem; class LLVector3d; @@ -47,6 +48,7 @@ class LLPanelProfileTab; class LLAgent; class LLMenuGL; class LLPickItem; +class LLClassifiedItem; class LLFlatListView; class LLPanelPickInfo; class LLPanelPickEdit; @@ -71,6 +73,7 @@ public: // returns the selected pick item LLPickItem* getSelectedPickItem(); + LLClassifiedItem* getSelectedClassifiedItem(); //*NOTE top down approch when panel toggling is done only by // parent panels failed to work (picks related code was in me profile panel) @@ -83,25 +86,39 @@ private: void onOverflowMenuItemClicked(const LLSD& param); void onOverflowButtonClicked(); + void onPlusMenuItemClicked(const LLSD& param); + + void onListCommit(const LLFlatListView* f_list); + void onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab); //------------------------------------------------ // Callbacks which require panel toggling //------------------------------------------------ - void onClickNew(); + void onClickPlusBtn(); void onClickInfo(); void onPanelPickClose(LLPanel* panel); void onPanelPickSave(LLPanel* panel); void onPanelPickEdit(); void onClickMenuEdit(); + void createNewPick(); + void createNewClassified(); + + void openPickInfo(); + void openClassifiedInfo(); + + void showAccordion(const std::string& name, bool show); + void buildPickPanel(); - bool callbackDelete(const LLSD& notification, const LLSD& response); + bool callbackDeletePick(const LLSD& notification, const LLSD& response); + bool callbackDeleteClassified(const LLSD& notification, const LLSD& response); bool callbackTeleport(const LLSD& notification, const LLSD& response); void updateButtons(); - virtual void onDoubleClickItem(LLUICtrl* item); + virtual void onDoubleClickPickItem(LLUICtrl* item); + virtual void onDoubleClickClassifiedItem(LLUICtrl* item); virtual void onRightMouseUpItem(LLUICtrl* item, S32 x, S32 y, MASK mask); LLPanelProfile* getProfilePanel(); @@ -115,9 +132,14 @@ private: LLPanelProfile* mProfilePanel; LLPanelPickInfo* mPickPanel; LLFlatListView* mPicksList; + LLFlatListView* mClassifiedsList; LLPanelPickInfo* mPanelPickInfo; LLPanelPickEdit* mPanelPickEdit; LLToggleableMenu* mOverflowMenu; + LLToggleableMenu* mPlusMenu; + + LLAccordionCtrlTab* mPicksAccTab; + LLAccordionCtrlTab* mClassifiedsAccTab; }; class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver @@ -189,4 +211,42 @@ protected: std::string mSimName; }; +class LLClassifiedItem : public LLPanel, public LLAvatarPropertiesObserver +{ +public: + + LLClassifiedItem(const LLUUID& avatar_id, const LLUUID& classified_id); + + virtual ~LLClassifiedItem(); + + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); + + /*virtual*/ BOOL postBuild(); + + /*virtual*/ void setValue(const LLSD& value); + + LLUUID getAvatarId() {return mAvatarId;} + + void setAvatarId(const LLUUID& avatar_id) {mAvatarId = avatar_id;} + + LLUUID getClassifiedId() {return mClassifiedId;} + + void setClassifiedId(const LLUUID& classified_id) {mClassifiedId = classified_id;} + + void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; } + + const LLVector3d& getPosGlobal() { return mPosGlobal; } + + void setName (const std::string& name); + + void setDescription(const std::string& desc); + + void setSnapshotId(const LLUUID& snapshot_id); + +private: + LLUUID mAvatarId; + LLUUID mClassifiedId; + LLVector3d mPosGlobal; +}; + #endif // LL_LLPANELPICKS_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9aa74e8b9f..0ffea6d600 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2469,7 +2469,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("AvatarPicksReply", &LLAvatarPropertiesProcessor::processAvatarPicksReply); msg->setHandlerFunc("AvatarClassifiedReply", - &LLAvatarPropertiesProcessor::processAvatarClassifiedReply); + &LLAvatarPropertiesProcessor::processAvatarClassifiedsReply); msg->setHandlerFuncFast(_PREHASH_CreateGroupReply, LLGroupMgr::processCreateGroupReply); @@ -2535,7 +2535,8 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply); msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply); - msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply); +// msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply); + msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply); msg->setHandlerFunc("ParcelInfoReply", LLRemoteParcelInfoProcessor::processParcelInfoReply); msg->setHandlerFunc("ScriptDialog", process_script_dialog); msg->setHandlerFunc("LoadURL", process_load_url); diff --git a/indra/newview/skins/default/xui/en/menu_picks_plus.xml b/indra/newview/skins/default/xui/en/menu_picks_plus.xml new file mode 100644 index 0000000000..3065239615 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_picks_plus.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index babed28f10..d479acb20c 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3050,6 +3050,18 @@ Teleport to [PICK]? yestext="Teleport"/> + + Teleport to [CLASSIFIED]? + + + + + + + + + + - - + width="18" /> + + + + + + + + + + + + + + + + + + + + + + Date: Mon, 9 Nov 2009 13:17:37 +0200 Subject: fixed bug EXT-2016 Place Profile panel isn't resized --HG-- branch : product-engine --- indra/newview/skins/default/xui/en/panel_place_profile.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml index b5ae05fe6c..d3eb548207 100644 --- a/indra/newview/skins/default/xui/en/panel_place_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml @@ -172,7 +172,7 @@ width="313"> Date: Mon, 9 Nov 2009 13:55:55 +0200 Subject: Fixed low bug EXT-2319 - Unable to save new Pick. --HG-- branch : product-engine --- indra/newview/llpanelpick.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index 103f041686..726c47b678 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -438,7 +438,8 @@ void LLPanelPickEdit::resetDirty() BOOL LLPanelPickEdit::isDirty() const { - if( LLPanelPickInfo::isDirty() + if( mNewPick + || LLPanelPickInfo::isDirty() || mLocationChanged || mSnapshotCtrl->isDirty() || getChild("pick_name")->isDirty() -- cgit v1.2.3 From cd328841106734938dd747e9a7fd2575cd6c1b85 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Mon, 9 Nov 2009 14:44:56 +0200 Subject: Update for major task EXT-2250 Classifieds list in Picks panel. Fixed viewing classifieds of other avatars. --HG-- branch : product-engine --- indra/newview/llavatarpropertiesprocessor.cpp | 8 ++++---- indra/newview/llavatarpropertiesprocessor.h | 4 ++-- indra/newview/llpanelpicks.cpp | 19 +++++++++++++------ indra/newview/llpanelpicks.h | 8 +++++++- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 98a6a4b92a..2942e436ef 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -333,13 +333,13 @@ void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* ms msg->getString(_PREHASH_Data, _PREHASH_SimName, c_info.sim_name); msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, c_info.pos_global); msg->getString(_PREHASH_Data, _PREHASH_ParcelName, c_info.parcel_name); - msg->getU8(_PREHASH_Data, _PREHASH_ClassifiedFlags, c_info.classified_flags); + msg->getU8(_PREHASH_Data, _PREHASH_ClassifiedFlags, c_info.flags); msg->getS32(_PREHASH_Data, _PREHASH_PriceForListing, c_info.price_for_listing); LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending - self->removePendingRequest(c_info.agent_id, APT_CLASSIFIED_INFO); - self->notifyObservers(c_info.agent_id, &c_info, APT_CLASSIFIED_INFO); + self->removePendingRequest(c_info.creator_id, APT_CLASSIFIED_INFO); + self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO); } @@ -564,7 +564,7 @@ void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, send_generic_message("pickinforequest", request_params); } -void LLAvatarPropertiesProcessor::sendClassifiedInfoRequest(const LLUUID& avatar_id, const LLUUID& classified_id) +void LLAvatarPropertiesProcessor::sendClassifiedInfoRequest(const LLUUID& classified_id) { LLMessageSystem* msg = gMessageSystem; diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 3c6b4e17d9..64964b1665 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -171,7 +171,7 @@ struct LLAvatarClassifiedInfo std::string sim_name; LLVector3d pos_global; std::string parcel_name; - U8 classified_flags; + U8 flags; S32 price_for_listing; }; @@ -206,7 +206,7 @@ public: // Duplicate pick info requests are not suppressed. void sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id); - void sendClassifiedInfoRequest(const LLUUID& avatar_id, const LLUUID& classified_id); + void sendClassifiedInfoRequest(const LLUUID& classified_id); void sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 88c1d17a02..78f8152b10 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -175,7 +175,7 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type) LLClassifiedItem* c_item = new LLClassifiedItem(getAvatarId(), c_data.classified_id); c_item->childSetAction("info_chevron", boost::bind(&LLPanelPicks::onClickInfo, this)); - c_item->setName(c_data.name); + c_item->setClassifiedName(c_data.name); LLSD pick_value = LLSD(); pick_value.insert(CLASSIFIED_ID, c_data.classified_id); @@ -364,6 +364,9 @@ void LLPanelPicks::onOpen(const LLSD& key) if(getAvatarId() != id) { + showAccordion("tab_picks", false); + showAccordion("tab_classifieds", false); + mPicksList->goToTop(); // Set dummy value to make panel dirty and make it reload picks setValue(LLSD()); @@ -856,7 +859,7 @@ LLClassifiedItem::LLClassifiedItem(const LLUUID& avatar_id, const LLUUID& classi LLUICtrlFactory::getInstance()->buildPanel(this,"panel_classifieds_list_item.xml"); LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); - LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getAvatarId(), getClassifiedId()); + LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); } LLClassifiedItem::~LLClassifiedItem() @@ -872,13 +875,12 @@ void LLClassifiedItem::processProperties(void* data, EAvatarProcessorType type) } LLAvatarClassifiedInfo* c_info = static_cast(data); - if( !(c_info && c_info->agent_id == getAvatarId() - && c_info->classified_id == getClassifiedId()) ) + if( !c_info || c_info->classified_id != getClassifiedId() ) { return; } - setName(c_info->name); + setClassifiedName(c_info->name); setDescription(c_info->description); setSnapshotId(c_info->snapshot_id); setPosGlobal(c_info->pos_global); @@ -900,7 +902,7 @@ void LLClassifiedItem::setValue(const LLSD& value) childSetVisible("selected_icon", value["selected"]); } -void LLClassifiedItem::setName(const std::string& name) +void LLClassifiedItem::setClassifiedName(const std::string& name) { childSetValue("name", name); } @@ -915,4 +917,9 @@ void LLClassifiedItem::setSnapshotId(const LLUUID& snapshot_id) childSetValue("picture", snapshot_id); } +LLUUID LLClassifiedItem::getSnapshotId() +{ + return childGetValue("picture"); +} + //EOF diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index ef7ba9e700..daf8059fee 100644 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -237,12 +237,18 @@ public: const LLVector3d& getPosGlobal() { return mPosGlobal; } - void setName (const std::string& name); + void setClassifiedName (const std::string& name); + + std::string getClassifiedName() { return childGetValue("name").asString(); } void setDescription(const std::string& desc); + std::string getDescription() { return childGetValue("description").asString(); } + void setSnapshotId(const LLUUID& snapshot_id); + LLUUID getSnapshotId(); + private: LLUUID mAvatarId; LLUUID mClassifiedId; -- cgit v1.2.3 From 0f1c5aebd5c68bcaefdcc26b9050fa19c7444d06 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Mon, 9 Nov 2009 15:02:16 +0200 Subject: Implemented low task EXT-1155 (Implement option to sort the nearby people list by distance and most recent speakers) --HG-- branch : product-engine --- indra/newview/llpanelpeople.cpp | 120 ++++++++++++++++++++- indra/newview/llpanelpeople.h | 3 + .../xui/en/menu_people_nearby_view_sort.xml | 39 +++++-- 3 files changed, 148 insertions(+), 14 deletions(-) diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index bb6cdd2f78..b08eb27b9f 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -60,6 +60,7 @@ #include "llviewermenu.h" // for gMenuHolder #include "llvoiceclient.h" #include "llworld.h" +#include "llspeakers.h" #define FRIEND_LIST_UPDATE_TIMEOUT 0.5 #define NEARBY_LIST_UPDATE_INTERVAL 1 @@ -119,8 +120,84 @@ protected: } }; +/** Compares avatar items by distance between you and them */ +class LLAvatarItemDistanceComparator : public LLAvatarItemComparator +{ +public: + typedef std::map < LLUUID, LLVector3d > id_to_pos_map_t; + LLAvatarItemDistanceComparator() {}; + + void updateAvatarsPositions(std::vector& positions, std::vector& uuids) + { + std::vector::const_iterator + pos_it = positions.begin(), + pos_end = positions.end(); + + std::vector::const_iterator + id_it = uuids.begin(), + id_end = uuids.end(); + + LLAvatarItemDistanceComparator::id_to_pos_map_t pos_map; + + mAvatarsPositions.clear(); + + for (;pos_it != pos_end && id_it != id_end; ++pos_it, ++id_it ) + { + mAvatarsPositions[*id_it] = *pos_it; + } + }; + +protected: + virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const + { + const LLVector3d& me_pos = gAgent.getPositionGlobal(); + const LLVector3d& item1_pos = mAvatarsPositions.find(item1->getAvatarId())->second; + const LLVector3d& item2_pos = mAvatarsPositions.find(item2->getAvatarId())->second; + F32 dist1 = dist_vec(item1_pos, me_pos); + F32 dist2 = dist_vec(item2_pos, me_pos); + return dist1 < dist2; + } +private: + id_to_pos_map_t mAvatarsPositions; +}; + +/** Comparator for comparing nearby avatar items by last spoken time */ +class LLAvatarItemRecentSpeakerComparator : public LLAvatarItemNameComparator +{ +public: + LLAvatarItemRecentSpeakerComparator() {}; + virtual ~LLAvatarItemRecentSpeakerComparator() {}; + +protected: + virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const + { + LLPointer lhs = LLLocalSpeakerMgr::instance().findSpeaker(item1->getAvatarId()); + LLPointer rhs = LLLocalSpeakerMgr::instance().findSpeaker(item2->getAvatarId()); + if ( lhs.notNull() && rhs.notNull() ) + { + // Compare by last speaking time + if( lhs->mLastSpokeTime != rhs->mLastSpokeTime ) + return ( lhs->mLastSpokeTime > rhs->mLastSpokeTime ); + } + else if ( lhs.notNull() ) + { + // True if only item1 speaker info available + return true; + } + else if ( rhs.notNull() ) + { + // False if only item2 speaker info available + return false; + } + // By default compare by name. + return LLAvatarItemNameComparator::doCompare(item1, item2); + } +}; + static const LLAvatarItemRecentComparator RECENT_COMPARATOR; static const LLAvatarItemStatusComparator STATUS_COMPARATOR; +static LLAvatarItemDistanceComparator DISTANCE_COMPARATOR; +static const LLAvatarItemRecentSpeakerComparator RECENT_SPEAKER_COMPARATOR; static LLRegisterPanelClassWrapper t_people("panel_people"); @@ -434,6 +511,7 @@ BOOL LLPanelPeople::postBuild() setSortOrder(mRecentList, (ESortOrder)gSavedSettings.getU32("RecentPeopleSortOrder"), false); setSortOrder(mAllFriendList, (ESortOrder)gSavedSettings.getU32("FriendsSortOrder"), false); + setSortOrder(mNearbyList, (ESortOrder)gSavedSettings.getU32("NearbyPeopleSortOrder"), false); LLPanel* groups_panel = getChild(GROUP_TAB_NAME); groups_panel->childSetAction("activate_btn", boost::bind(&LLPanelPeople::onActivateButtonClicked, this)); @@ -494,7 +572,8 @@ BOOL LLPanelPeople::postBuild() enable_registrar.add("People.Friends.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onFriendsViewSortMenuItemCheck, this, _2)); enable_registrar.add("People.Recent.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck, this, _2)); - + enable_registrar.add("People.Nearby.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck, this, _2)); + LLMenuGL* plus_menu = LLUICtrlFactory::getInstance()->createFromFile("menu_group_plus.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); mGroupPlusMenuHandle = plus_menu->getHandle(); @@ -573,8 +652,13 @@ void LLPanelPeople::updateNearbyList() if (!mNearbyList) return; - LLWorld::getInstance()->getAvatars(&mNearbyList->getIDs(), NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); + std::vector positions; + + LLWorld::getInstance()->getAvatars(&mNearbyList->getIDs(), &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); mNearbyList->setDirty(); + + DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs()); + LLLocalSpeakerMgr::instance().update(TRUE); } void LLPanelPeople::updateRecentList() @@ -760,6 +844,14 @@ void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save list->setComparator(&RECENT_COMPARATOR); list->sort(); break; + case E_SORT_BY_RECENT_SPEAKERS: + list->setComparator(&RECENT_SPEAKER_COMPARATOR); + list->sort(); + break; + case E_SORT_BY_DISTANCE: + list->setComparator(&DISTANCE_COMPARATOR); + list->sort(); + break; default: llwarns << "Unrecognized people sort order for " << list->getName() << llendl; return; @@ -774,7 +866,7 @@ void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save else if (list == mRecentList) setting = "RecentPeopleSortOrder"; else if (list == mNearbyList) - setting = "NearbyPeopleSortOrder"; // *TODO: unused by current implementation + setting = "NearbyPeopleSortOrder"; if (!setting.empty()) gSavedSettings.setU32(setting, order); @@ -1010,12 +1102,13 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata) { std::string chosen_item = userdata.asString(); - if (chosen_item == "sort_recent") + if (chosen_item == "sort_by_recent_speakers") { + setSortOrder(mNearbyList, E_SORT_BY_RECENT_SPEAKERS); } else if (chosen_item == "sort_name") { - mNearbyList->sortByName(); + setSortOrder(mNearbyList, E_SORT_BY_NAME); } else if (chosen_item == "view_icons") { @@ -1023,8 +1116,25 @@ void LLPanelPeople::onNearbyViewSortMenuItemClicked(const LLSD& userdata) } else if (chosen_item == "sort_distance") { + setSortOrder(mNearbyList, E_SORT_BY_DISTANCE); } } + +bool LLPanelPeople::onNearbyViewSortMenuItemCheck(const LLSD& userdata) +{ + std::string item = userdata.asString(); + U32 sort_order = gSavedSettings.getU32("NearbyPeopleSortOrder"); + + if (item == "sort_by_recent_speakers") + return sort_order == E_SORT_BY_RECENT_SPEAKERS; + if (item == "sort_name") + return sort_order == E_SORT_BY_NAME; + if (item == "sort_distance") + return sort_order == E_SORT_BY_DISTANCE; + + return false; +} + void LLPanelPeople::onRecentViewSortMenuItemClicked(const LLSD& userdata) { std::string chosen_item = userdata.asString(); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 9bf9befe90..faed573eca 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -62,6 +62,8 @@ private: E_SORT_BY_NAME = 0, E_SORT_BY_STATUS = 1, E_SORT_BY_MOST_RECENT = 2, + E_SORT_BY_DISTANCE = 3, + E_SORT_BY_RECENT_SPEAKERS = 4, } ESortOrder; // methods indirectly called by the updaters @@ -115,6 +117,7 @@ private: bool onFriendsViewSortMenuItemCheck(const LLSD& userdata); bool onRecentViewSortMenuItemCheck(const LLSD& userdata); + bool onNearbyViewSortMenuItemCheck(const LLSD& userdata); // misc callbacks static void onAvatarPicked( diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml index c002cd078f..39f9e48609 100644 --- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml +++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml @@ -2,15 +2,36 @@ - - - - - - - - - + + + + + + + + + + + + Date: Mon, 9 Nov 2009 15:43:50 +0200 Subject: Fixed normal bug EXT-2252 ([BSI] "Set to current location" button on Edit Pick panel has no effect) --HG-- branch : product-engine --- indra/newview/skins/default/xui/en/panel_edit_pick.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/panel_edit_pick.xml b/indra/newview/skins/default/xui/en/panel_edit_pick.xml index f4a212ba0a..d6de5af32d 100644 --- a/indra/newview/skins/default/xui/en/panel_edit_pick.xml +++ b/indra/newview/skins/default/xui/en/panel_edit_pick.xml @@ -53,7 +53,7 @@ layout="topleft" top="0" background_visible="false" - height="470" + height="510" left="0" width="295"> Date: Mon, 9 Nov 2009 15:54:54 +0200 Subject: Implemented major task EXT-2251 - Implement panels for creating, editing and viewing Classifieds. --HG-- branch : product-engine --- indra/newview/llavatarpropertiesprocessor.cpp | 30 ++ indra/newview/llavatarpropertiesprocessor.h | 2 + indra/newview/llpanelclassified.cpp | 490 +++++++++++++++++++++ indra/newview/llpanelclassified.h | 126 ++++++ indra/newview/llpanelpicks.cpp | 143 +++++- indra/newview/llpanelpicks.h | 10 +- indra/newview/llpanelprofile.cpp | 5 + .../skins/default/xui/en/panel_classified_info.xml | 175 ++++++++ .../skins/default/xui/en/panel_edit_classified.xml | 251 +++++++++++ 9 files changed, 1226 insertions(+), 6 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/panel_classified_info.xml create mode 100644 indra/newview/skins/default/xui/en/panel_edit_classified.xml diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 2942e436ef..7cda2d31e6 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -554,6 +554,36 @@ void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) LLAgentPicksInfo::getInstance()->requestNumberOfPicks(); } +void LLAvatarPropertiesProcessor::sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data) +{ + if(!c_data) + { + return; + } + + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage(_PREHASH_ClassifiedInfoUpdate); + + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id); + msg->addU32(_PREHASH_Category, c_data->category); + msg->addString(_PREHASH_Name, c_data->name); + msg->addString(_PREHASH_Desc, c_data->description); + msg->addUUID(_PREHASH_ParcelID, c_data->parcel_id); + msg->addU32(_PREHASH_ParentEstate, 0); + msg->addUUID(_PREHASH_SnapshotID, c_data->snapshot_id); + msg->addVector3d(_PREHASH_PosGlobal, c_data->pos_global); + msg->addU8(_PREHASH_ClassifiedFlags, c_data->flags); + msg->addS32(_PREHASH_PriceForListing, c_data->price_for_listing); + + gAgent.sendReliableMessage(); +} + void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id) { // Must ask for a pick based on the creator id because diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index 64964b1665..716c1b8065 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -212,6 +212,8 @@ public: void sendPickInfoUpdate(const LLPickData* new_pick); + void sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data); + void sendFriendRights(const LLUUID& avatar_id, S32 rights); void sendNotes(const LLUUID& avatar_id, const std::string notes); diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index a29c9752e6..b118c6813c 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -1142,3 +1142,493 @@ void LLPanelClassified::setDefaultAccessCombo() break; } } + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + + +std::string SET_LOCATION_NOTICE1("(will update after save)"); + +LLPanelClassifiedInfo::LLPanelClassifiedInfo() + : LLPanel() +{ +} + +LLPanelClassifiedInfo::~LLPanelClassifiedInfo() +{ +} + +// static +LLPanelClassifiedInfo* LLPanelClassifiedInfo::create() +{ + LLPanelClassifiedInfo* panel = new LLPanelClassifiedInfo(); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_classified_info.xml"); + return panel; +} + +BOOL LLPanelClassifiedInfo::postBuild() +{ + childSetAction("back_btn", boost::bind(&LLPanelClassifiedInfo::onExit, this), NULL); + + return TRUE; +} + +void LLPanelClassifiedInfo::setExitCallback(const commit_callback_t& cb) +{ + getChild("back_btn")->setClickedCallback(cb); +} + +void LLPanelClassifiedInfo::onOpen(const LLSD& key) +{ + LLUUID avatar_id = key["avatar_id"]; + if(avatar_id.isNull()) + { + return; + } + + if(getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); + } + + setAvatarId(avatar_id); + + resetData(); + resetControls(); + + setClassifiedId(key["classified_id"]); + setClassifiedName(key["name"]); + setDescription(key["desc"]); + setSnapshotId(key["snapshot_id"]); + + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); + LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); +} + +void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType type) +{ + if(APT_CLASSIFIED_INFO == type) + { + LLAvatarClassifiedInfo* c_info = static_cast(data); + if(data && getClassifiedId() == c_info->classified_id) + { + setClassifiedName(c_info->name); + setDescription(c_info->description); + setSnapshotId(c_info->snapshot_id); + setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); + childSetValue("category", LLClassifiedInfo::sCategories[c_info->category]); + + bool mature = is_cf_mature(c_info->flags); + childSetValue("content_type", mature ? "Mature" : "PG Content"); + childSetValue("auto_renew", is_cf_auto_renew(c_info->flags)); + + childSetTextArg("price_for_listing", "[PRICE]", llformat("%d", c_info->price_for_listing)); + } + } +} + +void LLPanelClassifiedInfo::resetData() +{ + setClassifiedName(LLStringUtil::null); + setDescription(LLStringUtil::null); + setClassifiedLocation(LLStringUtil::null); + setClassifiedId(LLUUID::null); + setSnapshotId(LLUUID::null); + mPosGlobal.clearVec(); +} + +void LLPanelClassifiedInfo::resetControls() +{ + if(getAvatarId() == gAgent.getID()) + { + childSetEnabled("edit_btn", TRUE); + childSetVisible("edit_btn", TRUE); + } + else + { + childSetEnabled("edit_btn", FALSE); + childSetVisible("edit_btn", FALSE); + } +} + +void LLPanelClassifiedInfo::setClassifiedName(const std::string& name) +{ + childSetValue("classified_name", name); +} + +std::string LLPanelClassifiedInfo::getClassifiedName() +{ + return childGetValue("classified_name").asString(); +} + +void LLPanelClassifiedInfo::setDescription(const std::string& desc) +{ + childSetValue("classified_desc", desc); +} + +std::string LLPanelClassifiedInfo::getDescription() +{ + return childGetValue("classified_desc").asString(); +} + +void LLPanelClassifiedInfo::setClassifiedLocation(const std::string& location) +{ + childSetValue("classified_location", location); +} + +void LLPanelClassifiedInfo::setSnapshotId(const LLUUID& id) +{ + childSetValue("classified_snapshot", id); +} + +LLUUID LLPanelClassifiedInfo::getSnapshotId() +{ + return childGetValue("classified_snapshot").asUUID(); +} + +// static +std::string LLPanelClassifiedInfo::createLocationText( + const std::string& original_name, + const std::string& sim_name, + const LLVector3d& pos_global) +{ + std::string location_text; + + location_text.append(original_name); + + if (!sim_name.empty()) + { + if (!location_text.empty()) + location_text.append(", "); + location_text.append(sim_name); + } + + if (!location_text.empty()) + location_text.append(" "); + + if (!pos_global.isNull()) + { + S32 region_x = llround((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS; + S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS; + S32 region_z = llround((F32)pos_global.mdV[VZ]); + location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z)); + } + + return location_text; +} + +void LLPanelClassifiedInfo::onExit() +{ + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLPanelClassifiedEdit::LLPanelClassifiedEdit() + : LLPanelClassifiedInfo() + , mSnapshotCtrl(NULL) + , mNewClassified(false) +{ +} + +LLPanelClassifiedEdit::~LLPanelClassifiedEdit() +{ +} + +//static +LLPanelClassifiedEdit* LLPanelClassifiedEdit::create() +{ + LLPanelClassifiedEdit* panel = new LLPanelClassifiedEdit(); + LLUICtrlFactory::getInstance()->buildPanel(panel, "panel_edit_classified.xml"); + return panel; +} + +BOOL LLPanelClassifiedEdit::postBuild() +{ + LLPanelClassifiedInfo::postBuild(); + + mSnapshotCtrl = getChild("classified_snapshot"); + mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelClassifiedEdit::onSnapshotChanged, this, _1)); + + LLLineEditor* line_edit = getChild("classified_name"); + line_edit->setKeystrokeCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL); + + LLTextEditor* text_edit = getChild("classified_desc"); + text_edit->setKeystrokeCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this)); + + LLComboBox* combobox = getChild( "category"); + LLClassifiedInfo::cat_map::iterator iter; + for (iter = LLClassifiedInfo::sCategories.begin(); + iter != LLClassifiedInfo::sCategories.end(); + iter++) + { + combobox->add(LLTrans::getString(iter->second), (void *)((intptr_t)iter->first), ADD_BOTTOM); + } + + combobox->setCurrentByIndex(0); + combobox->setCommitCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this)); + + combobox = getChild("content_type"); + combobox->setCommitCallback(boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this)); + + childSetCommitCallback("price_for_listing", boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL); + childSetCommitCallback("auto_renew", boost::bind(&LLPanelClassifiedEdit::onClassifiedChanged, this), NULL); + + childSetAction("save_changes_btn", boost::bind(&LLPanelClassifiedEdit::onClickSave, this)); + childSetAction("set_to_curr_location_btn", boost::bind(&LLPanelClassifiedEdit::onClickSetLocation, this)); + + return TRUE; +} + +void LLPanelClassifiedEdit::onOpen(const LLSD& key) +{ + LLUUID classified_id = key["classified_id"]; + + if(classified_id.isNull()) + { + mNewClassified = true; + setAvatarId(gAgent.getID()); + + resetData(); + resetControls(); + + setPosGlobal(gAgent.getPositionGlobal()); + + LLUUID snapshot_id = LLUUID::null; + std::string desc; + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + + if(parcel) + { + desc = parcel->getDesc(); + snapshot_id = parcel->getSnapshotID(); + } + + std::string region_name = LLTrans::getString("ClassifiedUpdateAfterPublish"); + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + region_name = region->getName(); + } + + childSetValue("classified_name", makeClassifiedName()); + childSetValue("classified_desc", desc); + setSnapshotId(snapshot_id); + setClassifiedLocation(createLocationText(region_name, LLStringUtil::null, getPosGlobal())); + setParcelId(LLUUID::null); + + enableSaveButton(true); + } + else + { + mNewClassified = false; + + LLPanelClassifiedInfo::onOpen(key); + enableSaveButton(false); + } + + resetDirty(); +} + +void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType type) +{ + if(APT_CLASSIFIED_INFO == type) + { + LLAvatarClassifiedInfo* c_info = static_cast(data); + if(data && getClassifiedId() == c_info->classified_id) + { + setClassifiedName(c_info->name); + setDescription(c_info->description); + setSnapshotId(c_info->snapshot_id); + setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); + getChild("category")->setCurrentByIndex(c_info->category + 1); + getChild("category")->resetDirty(); + + bool mature = is_cf_mature(c_info->flags); + bool auto_renew = is_cf_auto_renew(c_info->flags); + + getChild("content_type")->setCurrentByIndex(mature ? 0 : 1); + childSetValue("auto_renew", auto_renew); + childSetValue("price_for_listing", c_info->price_for_listing); + + resetDirty(); + } + } +} + +BOOL LLPanelClassifiedEdit::isDirty() const +{ + if(mNewClassified) + return TRUE; + + BOOL dirty = false; + + dirty |= LLPanelClassifiedInfo::isDirty(); + dirty |= mSnapshotCtrl->isDirty(); + dirty |= getChild("classified_name")->isDirty(); + dirty |= getChild("classified_desc")->isDirty(); + dirty |= getChild("category")->isDirty(); + dirty |= getChild("content_type")->isDirty(); + dirty |= getChild("auto_renew")->isDirty(); + dirty |= getChild("price_for_listing")->isDirty(); + + return dirty; +} + +void LLPanelClassifiedEdit::resetDirty() +{ + LLPanelClassifiedInfo::resetDirty(); + mSnapshotCtrl->resetDirty(); + getChild("classified_name")->resetDirty(); + getChild("classified_desc")->resetDirty(); + getChild("category")->resetDirty(); + getChild("content_type")->resetDirty(); + getChild("auto_renew")->resetDirty(); + getChild("price_for_listing")->resetDirty(); +} + +void LLPanelClassifiedEdit::setSaveCallback(const commit_callback_t& cb) +{ + getChild("save_changes_btn")->setClickedCallback(cb); +} + +void LLPanelClassifiedEdit::setCancelCallback(const commit_callback_t& cb) +{ + getChild("cancel_btn")->setClickedCallback(cb); +} + +void LLPanelClassifiedEdit::resetControls() +{ + LLPanelClassifiedInfo::resetControls(); + + getChild("category")->setCurrentByIndex(0); + getChild("content_type")->setCurrentByIndex(0); + childSetValue("auto_renew", false); + childSetValue("price_for_listing", MINIMUM_PRICE_FOR_LISTING); +} + +void LLPanelClassifiedEdit::sendUpdate() +{ + LLAvatarClassifiedInfo c_data; + + if(getClassifiedId().isNull()) + { + LLUUID id = getClassifiedId(); + id.generate(); + setClassifiedId(id); + } + + c_data.agent_id = gAgent.getID(); + c_data.classified_id = getClassifiedId(); + c_data.category = getCategory(); + c_data.name = getClassifiedName(); + c_data.description = getDescription(); + c_data.parcel_id = getParcelId(); + c_data.snapshot_id = getSnapshotId(); + c_data.pos_global = getPosGlobal(); + c_data.flags = getClassifiedFlags(); + c_data.price_for_listing = getPriceForListing(); + + LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoUpdate(&c_data); +} + +U32 LLPanelClassifiedEdit::getCategory() +{ + LLComboBox* cat_cb = getChild("category"); + return cat_cb->getCurrentIndex() + 1; +} + +U8 LLPanelClassifiedEdit::getClassifiedFlags() +{ + bool auto_renew = childGetValue("auto_renew").asBoolean(); + + LLComboBox* content_cb = getChild("content_type"); + bool mature = content_cb->getCurrentIndex() == 0; + + return pack_classified_flags_request(auto_renew, false, mature, false);; +} + +void LLPanelClassifiedEdit::enableSaveButton(bool enable) +{ + childSetEnabled("save_changes_btn", enable); +} + +std::string LLPanelClassifiedEdit::makeClassifiedName() +{ + std::string name; + + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if(parcel) + { + name = parcel->getName(); + } + + if(!name.empty()) + return name; + + LLViewerRegion* region = gAgent.getRegion(); + if(region) + { + name = region->getName(); + } + + return name; +} + +S32 LLPanelClassifiedEdit::getPriceForListing() +{ + return childGetValue("price_for_listing").asInteger(); +} + +void LLPanelClassifiedEdit::onClickSetLocation() +{ + setPosGlobal(gAgent.getPositionGlobal()); + setParcelId(LLUUID::null); + + std::string region_name = LLTrans::getString("ClassifiedUpdateAfterPublish"); + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + region_name = region->getName(); + } + + setClassifiedLocation(createLocationText(region_name, LLStringUtil::null, getPosGlobal())); + + // mark classified as dirty + setValue(LLSD()); + + onClassifiedChanged(); +} + +void LLPanelClassifiedEdit::onSnapshotChanged(LLUICtrl* ctrl) +{ + +} + +void LLPanelClassifiedEdit::onClassifiedChanged() +{ + if(isDirty()) + { + enableSaveButton(true); + } + else + { + enableSaveButton(false); + } +} + +void LLPanelClassifiedEdit::onClickSave() +{ + sendUpdate(); + +// LLAvatarPropertiesProcessor::getInstance()->sendAvatarClassifiedsRequest(getAvatarId()); + + LLSD params; + params["action"] = "save_classified"; + notifyParent(params); +} + +//EOF diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index 417eddf460..eccc83cf53 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -198,5 +198,131 @@ private: void* mUserData; }; +#include "llavatarpropertiesprocessor.h" + +class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver +{ +public: + + static LLPanelClassifiedInfo* create(); + + virtual ~LLPanelClassifiedInfo(); + + virtual void setExitCallback(const commit_callback_t& cb); + + /*virtual*/ void onOpen(const LLSD& key); + + /*virtual*/ BOOL postBuild(); + + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); + + virtual void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; } + + LLUUID& getAvatarId() { return mAvatarId; } + + virtual void setSnapshotId(const LLUUID& id); + + virtual LLUUID getSnapshotId(); + + virtual void setClassifiedId(const LLUUID& id) { mClassifiedId = id; } + + virtual LLUUID& getClassifiedId() { return mClassifiedId; } + + virtual void setClassifiedName(const std::string& name); + + virtual std::string getClassifiedName(); + + virtual void setDescription(const std::string& desc); + + virtual std::string getDescription(); + + virtual void setClassifiedLocation(const std::string& location); + + virtual void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; } + + virtual LLVector3d& getPosGlobal() { return mPosGlobal; } + +protected: + + LLPanelClassifiedInfo(); + + virtual void resetData(); + + virtual void resetControls(); + + static std::string createLocationText( + const std::string& original_name, + const std::string& sim_name, + const LLVector3d& pos_global); + + void onClickMap(); + void onClickTeleport(); + void onClickBack(); + void onExit(); + +private: + + LLUUID mAvatarId; + LLUUID mClassifiedId; + LLVector3d mPosGlobal; +}; + +class LLPanelClassifiedEdit : public LLPanelClassifiedInfo +{ +public: + + static LLPanelClassifiedEdit* create(); + + virtual ~LLPanelClassifiedEdit(); + + BOOL postBuild(); + + void onOpen(const LLSD& key); + + void processProperties(void* data, EAvatarProcessorType type); + + BOOL isDirty() const; + + void resetDirty(); + + void setSaveCallback(const commit_callback_t& cb); + + void setCancelCallback(const commit_callback_t& cb); + + void resetControls(); + + virtual bool isNewClassified() { return mNewClassified; } + +protected: + + LLPanelClassifiedEdit(); + + void sendUpdate(); + + U32 getCategory(); + + void enableSaveButton(bool enable); + + std::string makeClassifiedName(); + + void setParcelId(const LLUUID& id) { mParcelId = id; } + + LLUUID getParcelId() { return mParcelId; } + + S32 getPriceForListing(); + + U8 getClassifiedFlags(); + + void onClickSetLocation(); + void onSnapshotChanged(LLUICtrl* ctrl); + void onClassifiedChanged(); + void onClickSave(); + +private: + LLTextureCtrl* mSnapshotCtrl; + + LLUUID mParcelId; + bool mNewClassified; +}; #endif // LL_LLPANELCLASSIFIED_H diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 78f8152b10..7b7667c147 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -52,6 +52,7 @@ #include "llpanelavatar.h" #include "llpanelprofile.h" #include "llpanelpick.h" +#include "llpanelclassified.h" static const std::string XML_BTN_NEW = "new_btn"; static const std::string XML_BTN_DELETE = "trash_btn"; @@ -70,6 +71,33 @@ static const std::string CLASSIFIED_NAME("classified_name"); static LLRegisterPanelClassWrapper t_panel_picks("panel_picks"); +////////////////////////////////////////////////////////////////////////// + +class LLClassifiedClickThrough : public LLDispatchHandler +{ +public: + virtual bool operator()( + const LLDispatcher* dispatcher, + const std::string& key, + const LLUUID& invoice, + const sparam_t& strings) + { + if (strings.size() != 4) + return false; + + // LLUUID classified_id(strings[0]); + // S32 teleport_clicks = atoi(strings[1].c_str()); + // S32 map_clicks = atoi(strings[2].c_str()); + // S32 profile_clicks = atoi(strings[3].c_str()); + // LLPanelClassified::setClickThrough(classified_id, teleport_clicks, + // map_clicks, + // profile_clicks, + // false); + + return true; + } +}; + //----------------------------------------------------------------------------- // LLPanelPicks //----------------------------------------------------------------------------- @@ -85,8 +113,12 @@ LLPanelPicks::LLPanelPicks() mOverflowMenu(NULL), mPlusMenu(NULL), mPicksAccTab(NULL), - mClassifiedsAccTab(NULL) + mClassifiedsAccTab(NULL), + mPanelClassifiedInfo(NULL), + mPanelClassifiedEdit(NULL) { + gGenericDispatcher.addHandler("classifiedclickthrough", + new LLClassifiedClickThrough()); } LLPanelPicks::~LLPanelPicks() @@ -574,7 +606,9 @@ void LLPanelPicks::createNewPick() void LLPanelPicks::createNewClassified() { - LLNotifications::instance().add("ClickUnimplemented"); + createClassifiedEditPanel(); + + getProfilePanel()->openPanel(mPanelClassifiedEdit, LLSD()); } void LLPanelPicks::onClickInfo() @@ -610,7 +644,21 @@ void LLPanelPicks::openPickInfo() void LLPanelPicks::openClassifiedInfo() { - LLNotifications::instance().add("ClickUnimplemented"); + LLSD selected_value = mClassifiedsList->getSelectedValue(); + if (selected_value.isUndefined()) return; + + LLClassifiedItem* c_item = getSelectedClassifiedItem(); + + createClassifiedInfoPanel(); + + LLSD params; + params["classified_id"] = c_item->getClassifiedId(); + params["avatar_id"] = c_item->getAvatarId(); + params["snapshot_id"] = c_item->getSnapshotId(); + params["name"] = c_item->getClassifiedName(); + params["desc"] = c_item->getDescription(); + + getProfilePanel()->openPanel(mPanelClassifiedInfo, params); } void LLPanelPicks::showAccordion(const std::string& name, bool show) @@ -632,6 +680,49 @@ void LLPanelPicks::onPanelPickSave(LLPanel* panel) updateButtons(); } +void LLPanelPicks::onPanelClassifiedSave(LLPanelClassifiedEdit* panel) +{ + if(panel->isNewClassified()) + { + LLClassifiedItem* c_item = new LLClassifiedItem(getAvatarId(), panel->getClassifiedId()); + + c_item->setClassifiedName(panel->getClassifiedName()); + c_item->setDescription(panel->getDescription()); + c_item->setSnapshotId(panel->getSnapshotId()); + + LLSD c_value; + c_value.insert(CLASSIFIED_ID, c_item->getClassifiedId()); + c_value.insert(CLASSIFIED_NAME, c_item->getClassifiedName()); + mClassifiedsList->addItem(c_item, c_value); + + c_item->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickClassifiedItem, this, _1)); + c_item->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4)); + c_item->setMouseUpCallback(boost::bind(&LLPanelPicks::updateButtons, this)); + c_item->childSetAction("info_chevron", boost::bind(&LLPanelPicks::onClickInfo, this)); + } + else + { + std::vector values; + mClassifiedsList->getValues(values); + for(size_t n = 0; n < values.size(); ++n) + { + LLUUID c_id = values[n][CLASSIFIED_ID].asUUID(); + if(panel->getClassifiedId() == c_id) + { + LLClassifiedItem* c_item = dynamic_cast( + mClassifiedsList->getItemByValue(values[n])); + + c_item->setClassifiedName(panel->getClassifiedName()); + c_item->setDescription(panel->getDescription()); + c_item->setSnapshotId(panel->getSnapshotId()); + } + } + } + + onPanelPickClose(panel); + updateButtons(); +} + void LLPanelPicks::createPickInfoPanel() { if(!mPanelPickInfo) @@ -643,6 +734,28 @@ void LLPanelPicks::createPickInfoPanel() } } +void LLPanelPicks::createClassifiedInfoPanel() +{ + if(!mPanelClassifiedInfo) + { + mPanelClassifiedInfo = LLPanelClassifiedInfo::create(); + mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedInfo)); + mPanelClassifiedInfo->setVisible(FALSE); + } +} + +void LLPanelPicks::createClassifiedEditPanel() +{ + if(!mPanelClassifiedEdit) + { + mPanelClassifiedEdit = LLPanelClassifiedEdit::create(); + mPanelClassifiedEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit)); + mPanelClassifiedEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelClassifiedSave, this, mPanelClassifiedEdit)); + mPanelClassifiedEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit)); + mPanelClassifiedEdit->setVisible(FALSE); + } +} + void LLPanelPicks::createPickEditPanel() { if(!mPanelPickEdit) @@ -702,6 +815,28 @@ void LLPanelPicks::onPanelPickEdit() getProfilePanel()->openPanel(mPanelPickEdit, params); } +void LLPanelPicks::onPanelClassifiedEdit() +{ + LLSD selected_value = mClassifiedsList->getSelectedValue(); + if (selected_value.isUndefined()) + { + return; + } + + LLClassifiedItem* c_item = dynamic_cast(mClassifiedsList->getSelectedItem()); + + createClassifiedEditPanel(); + + LLSD params; + params["classified_id"] = c_item->getClassifiedId(); + params["avatar_id"] = c_item->getAvatarId(); + params["snapshot_id"] = c_item->getSnapshotId(); + params["name"] = c_item->getClassifiedName(); + params["desc"] = c_item->getDescription(); + + getProfilePanel()->openPanel(mPanelClassifiedEdit, params); +} + void LLPanelPicks::onClickMenuEdit() { if(getSelectedPickItem()) @@ -710,7 +845,7 @@ void LLPanelPicks::onClickMenuEdit() } else if(getSelectedClassifiedItem()) { - LLNotifications::instance().add("ClickUnimplemented"); + onPanelClassifiedEdit(); } } diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index daf8059fee..b30036c603 100644 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -53,6 +53,8 @@ class LLFlatListView; class LLPanelPickInfo; class LLPanelPickEdit; class LLToggleableMenu; +class LLPanelClassifiedInfo; +class LLPanelClassifiedEdit; class LLPanelPicks : public LLPanelProfileTab @@ -98,7 +100,9 @@ private: void onClickInfo(); void onPanelPickClose(LLPanel* panel); void onPanelPickSave(LLPanel* panel); + void onPanelClassifiedSave(LLPanelClassifiedEdit* panel); void onPanelPickEdit(); + void onPanelClassifiedEdit(); void onClickMenuEdit(); void createNewPick(); @@ -125,8 +129,8 @@ private: void createPickInfoPanel(); void createPickEditPanel(); -// void openPickEditPanel(LLPickItem* pick); -// void openPickInfoPanel(LLPickItem* pick); + void createClassifiedInfoPanel(); + void createClassifiedEditPanel(); LLMenuGL* mPopupMenu; LLPanelProfile* mProfilePanel; @@ -134,6 +138,8 @@ private: LLFlatListView* mPicksList; LLFlatListView* mClassifiedsList; LLPanelPickInfo* mPanelPickInfo; + LLPanelClassifiedInfo* mPanelClassifiedInfo; + LLPanelClassifiedEdit* mPanelClassifiedEdit; LLPanelPickEdit* mPanelPickEdit; LLToggleableMenu* mOverflowMenu; LLToggleableMenu* mPlusMenu; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index bec670cdaa..b404c8db4c 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -199,5 +199,10 @@ void LLPanelProfile::notifyParent(const LLSD& info) onOpen(info); return; } + else if("save_classified" == action) + { + // onOpen(info); + return; + } LLPanel::notifyParent(info); } diff --git a/indra/newview/skins/default/xui/en/panel_classified_info.xml b/indra/newview/skins/default/xui/en/panel_classified_info.xml new file mode 100644 index 0000000000..b7a54a7eea --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml @@ -0,0 +1,175 @@ + + +