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/llpanelpicks.cpp | 344 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 325 insertions(+), 19 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') 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 -- 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/llpanelpicks.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') 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 -- cgit v1.2.3 From 148a29ea1ec97922180ca8f0f6ced9a4a9e05c07 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan 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/llpanelpicks.cpp | 143 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 139 insertions(+), 4 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') 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(); } } -- cgit v1.2.3 From d04539f74a2922db40a6f90f16929b29056f666b Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 10 Nov 2009 13:21:02 +0200 Subject: Update for major task EXT-2251 - Implement panels for creating, editing and viewing Classifieds. Fixed bugs, improved functionality. --HG-- branch : product-engine --- indra/newview/llpanelpicks.cpp | 50 ++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 7b7667c147..2129fe473a 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -73,9 +73,19 @@ static LLRegisterPanelClassWrapper t_panel_picks("panel_picks"); ////////////////////////////////////////////////////////////////////////// +/** + * Copy&Pasted from old LLPanelClassified. This class does nothing at the moment. + * Subscribing to "classifiedclickthrough" removes a few warnings. + */ class LLClassifiedClickThrough : public LLDispatchHandler { public: + + // "classifiedclickthrough" + // strings[0] = classified_id + // strings[1] = teleport_clicks + // strings[2] = map_clicks + // strings[3] = profile_clicks virtual bool operator()( const LLDispatcher* dispatcher, const std::string& key, @@ -85,15 +95,6 @@ public: 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; } }; @@ -115,10 +116,11 @@ LLPanelPicks::LLPanelPicks() mPicksAccTab(NULL), mClassifiedsAccTab(NULL), mPanelClassifiedInfo(NULL), - mPanelClassifiedEdit(NULL) + mPanelClassifiedEdit(NULL), + mClickThroughDisp(NULL) { - gGenericDispatcher.addHandler("classifiedclickthrough", - new LLClassifiedClickThrough()); + mClickThroughDisp = new LLClassifiedClickThrough(); + gGenericDispatcher.addHandler("classifiedclickthrough", mClickThroughDisp); } LLPanelPicks::~LLPanelPicks() @@ -127,6 +129,8 @@ LLPanelPicks::~LLPanelPicks() { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } + + delete mClickThroughDisp; } void* LLPanelPicks::create(void* data /* = NULL */) @@ -693,14 +697,26 @@ void LLPanelPicks::onPanelClassifiedSave(LLPanelClassifiedEdit* panel) 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); + mClassifiedsList->addItem(c_item, c_value, ADD_TOP); 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 + else + { + onPanelClassifiedClose(panel); + return; + } + + onPanelPickClose(panel); + updateButtons(); +} + +void LLPanelPicks::onPanelClassifiedClose(LLPanelClassifiedInfo* panel) +{ + if(panel->getInfoLoaded()) { std::vector values; mClassifiedsList->getValues(values); @@ -739,7 +755,7 @@ void LLPanelPicks::createClassifiedInfoPanel() if(!mPanelClassifiedInfo) { mPanelClassifiedInfo = LLPanelClassifiedInfo::create(); - mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedInfo)); + mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedInfo)); mPanelClassifiedInfo->setVisible(FALSE); } } @@ -749,9 +765,9 @@ void LLPanelPicks::createClassifiedEditPanel() if(!mPanelClassifiedEdit) { mPanelClassifiedEdit = LLPanelClassifiedEdit::create(); - mPanelClassifiedEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit)); + mPanelClassifiedEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedEdit)); mPanelClassifiedEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelClassifiedSave, this, mPanelClassifiedEdit)); - mPanelClassifiedEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelClassifiedEdit)); + mPanelClassifiedEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedEdit)); mPanelClassifiedEdit->setVisible(FALSE); } } -- cgit v1.2.3 From 107525aa5a82b1cd4b2152e498d93d5db6577a15 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 10 Nov 2009 17:00:29 +0200 Subject: Update for major task EXT-2251 - Implement panels for creating, editing and viewing Classifieds. Fixed bugs, cleared code. --HG-- branch : product-engine --- indra/newview/llpanelpicks.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 2129fe473a..0fededcc46 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -686,7 +686,7 @@ void LLPanelPicks::onPanelPickSave(LLPanel* panel) void LLPanelPicks::onPanelClassifiedSave(LLPanelClassifiedEdit* panel) { - if(panel->isNewClassified()) + if(panel->isNew()) { LLClassifiedItem* c_item = new LLClassifiedItem(getAvatarId(), panel->getClassifiedId()); @@ -716,7 +716,7 @@ void LLPanelPicks::onPanelClassifiedSave(LLPanelClassifiedEdit* panel) void LLPanelPicks::onPanelClassifiedClose(LLPanelClassifiedInfo* panel) { - if(panel->getInfoLoaded()) + if(panel->getInfoLoaded() && !panel->isDirty()) { std::vector values; mClassifiedsList->getValues(values); -- cgit v1.2.3 From 15372bbc342a7b4c7a8d9b2e1bedd52655232ba7 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 10 Nov 2009 17:02:25 +0200 Subject: Update for major task EXT-2250 - Implement Classifieds list in Picks panel. Removed temporary workaround which was expanding only one accordion in Picks panel. --HG-- branch : product-engine --- indra/newview/llpanelpicks.cpp | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 0fededcc46..c30658755a 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -332,22 +332,6 @@ void LLPanelPicks::onPlusMenuItemClicked(const LLSD& param) 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); -- cgit v1.2.3 From 1e9cdef67cc98fb7b954aca87938cbcc34762035 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 11 Nov 2009 13:03:06 +0200 Subject: Update for major task EXT-2251 - Implement panels for creating, editing and viewing Classifieds. Implemented "Map", "Teleport", and "Edit" buttons in Classified Info panel. --HG-- branch : product-engine --- indra/newview/llpanelpicks.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index c30658755a..4be8f12e32 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -740,6 +740,7 @@ void LLPanelPicks::createClassifiedInfoPanel() { mPanelClassifiedInfo = LLPanelClassifiedInfo::create(); mPanelClassifiedInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelClassifiedClose, this, mPanelClassifiedInfo)); + mPanelClassifiedInfo->setEditClassifiedCallback(boost::bind(&LLPanelPicks::onPanelClassifiedEdit, this)); mPanelClassifiedInfo->setVisible(FALSE); } } -- cgit v1.2.3 From e29fbb572f2e10db1f2f3c448bc59aafec4a62c8 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 11 Nov 2009 13:05:15 +0200 Subject: Update for major task EXT-2250 Implement Classifieds list in Picks panel. Fixed accordion name and added code to show and expand classifieds accordion when first classified is created. --HG-- branch : product-engine --- indra/newview/llpanelpicks.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llpanelpicks.cpp') diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 4be8f12e32..6905c7e546 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -687,6 +687,10 @@ void LLPanelPicks::onPanelClassifiedSave(LLPanelClassifiedEdit* panel) 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)); + + // order does matter, showAccordion will invoke arrange for accordions. + mClassifiedsAccTab->changeOpenClose(false); + showAccordion("tab_classifieds", true); } else { -- cgit v1.2.3