diff options
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 123 |
1 files changed, 22 insertions, 101 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index ae181e2819..dbccd243da 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -38,6 +38,7 @@ #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llcofwearables.h" #include "llfilteredwearablelist.h" #include "llinventory.h" #include "llinventoryitemslist.h" @@ -121,9 +122,15 @@ private: LLPanelOutfitEdit::LLPanelOutfitEdit() -: LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL), -mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToOutfitBtn(NULL), -mRemoveFromOutfitBtn(NULL), mLookObserver(NULL) +: LLPanel(), + mCurrentOutfitID(), + mFetchLook(NULL), + mSearchFilter(NULL), + mCOFWearables(NULL), + mInventoryItemsPanel(NULL), + mAddToOutfitBtn(NULL), + mRemoveFromOutfitBtn(NULL), + mLookObserver(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); @@ -171,9 +178,8 @@ BOOL LLPanelOutfitEdit::postBuild() childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL); childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL); - mLookContents = getChild<LLScrollListCtrl>("look_items_list"); - mLookContents->sortByColumn("look_item_sort", TRUE); - mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); + mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list"); + mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); @@ -206,15 +212,6 @@ BOOL LLPanelOutfitEdit::postBuild() childSetAction("add_to_outfit_btn", boost::bind(&LLPanelOutfitEdit::onAddToOutfitClicked, this)); childSetEnabled("add_to_outfit_btn", false); - mUpBtn = getChild<LLButton>("up_btn"); - mUpBtn->setEnabled(TRUE); - mUpBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onUpClicked, this)); - - //*TODO rename mLookContents to mOutfitContents - mLookContents = getChild<LLScrollListCtrl>("look_items_list"); - mLookContents->sortByColumn("look_item_sort", TRUE); - mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); - mRemoveFromOutfitBtn = getChild<LLButton>("remove_from_outfit_btn"); mRemoveFromOutfitBtn->setEnabled(FALSE); mRemoveFromOutfitBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this)); @@ -245,7 +242,10 @@ BOOL LLPanelOutfitEdit::postBuild() void LLPanelOutfitEdit::moveWearable(bool closer_to_body) { - LLViewerInventoryItem* wearable_to_move = gInventory.getItem(mLookContents->getSelectionInterface()->getCurrentID()); + LLUUID item_id = mCOFWearables->getSelectedUUID(); + if (item_id.isNull()) return; + + LLViewerInventoryItem* wearable_to_move = gInventory.getItem(item_id); LLAppearanceMgr::getInstance()->moveWearable(wearable_to_move, closer_to_body); //*TODO why not to listen to inventory? @@ -374,7 +374,7 @@ void LLPanelOutfitEdit::onAddToOutfitClicked(void) void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) { - LLUUID id_to_remove = mLookContents->getSelectionInterface()->getCurrentID(); + LLUUID id_to_remove = mCOFWearables->getSelectedUUID(); LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove); @@ -384,41 +384,9 @@ void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) } -void LLPanelOutfitEdit::onUpClicked(void) -{ - LLUUID inv_id = mLookContents->getSelectionInterface()->getCurrentID(); - if (inv_id.isNull()) - { - //nothing selected, do nothing - return; - } - - LLViewerInventoryItem *link_item = gInventory.getItem(inv_id); - if (!link_item) - { - llwarns << "could not find inventory item based on currently worn link." << llendl; - return; - } - - - LLUUID asset_id = link_item->getAssetUUID(); - if (asset_id.isNull()) - { - llwarns << "inventory link has null Asset ID. could not get object reference" << llendl; - } - - static const std::string empty = ""; - LLWearableList::instance().getAsset(asset_id, - empty, // don't care about wearable name - link_item->getActualType(), - LLSidepanelAppearance::editWearable, - (void*)getParentUICtrl()); -} - - void LLPanelOutfitEdit::onEditWearableClicked(void) { - LLUUID id_to_edit = mLookContents->getSelectionInterface()->getCurrentID(); + LLUUID id_to_edit = mCOFWearables->getSelectedUUID(); LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit); if (item_to_edit) @@ -491,29 +459,11 @@ void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque<LLFolderView void LLPanelOutfitEdit::onOutfitItemSelectionChange(void) { - LLScrollListItem* item = mLookContents->getLastSelectedItem(); - if (!item) - return; + LLUUID item_id = mCOFWearables->getSelectedUUID(); - LLRect item_rect; - mLookContents->localRectToOtherView(item->getRect(), &item_rect, this); + //*TODO show Edit Wearable Button - // TODO button(and item list) should be removed (when new widget is ready) - LLRect btn_rect = mEditWearableBtn->getRect(); - btn_rect.set(item_rect.mRight - btn_rect.getWidth(), item_rect.mTop, item_rect.mRight, item_rect.mBottom); - - mEditWearableBtn->setShape(btn_rect); - sendChildToFront(mEditWearableBtn); - - mEditWearableBtn->setEnabled(TRUE); - if (!mEditWearableBtn->getVisible()) - { - mEditWearableBtn->setVisible(TRUE); - } - - - const LLUUID& id_item_to_remove = item->getUUID(); - LLViewerInventoryItem* item_to_remove = gInventory.getItem(id_item_to_remove); + LLViewerInventoryItem* item_to_remove = gInventory.getItem(item_id); if (!item_to_remove) return; switch (item_to_remove->getType()) @@ -534,34 +484,7 @@ void LLPanelOutfitEdit::changed(U32 mask) void LLPanelOutfitEdit::lookFetched(void) { - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - - // collectDescendentsIf takes non-const reference: - LLFindCOFValidItems is_cof_valid; - gInventory.collectDescendentsIf(mCurrentOutfitID, - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_cof_valid); - for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin(); - iter != item_array.end(); - iter++) - { - const LLViewerInventoryItem *item = (*iter); - - LLSD row; - row["id"] = item->getUUID(); - LLSD& columns = row["columns"]; - columns[0]["column"] = "look_item"; - columns[0]["type"] = "text"; - columns[0]["value"] = item->getName(); - columns[1]["column"] = "look_item_sort"; - columns[1]["type"] = "text"; // TODO: multi-wearable sort "type" should go here. - columns[1]["value"] = item->LLInventoryItem::getDescription(); - - mLookContents->addElement(row); - } + mCOFWearables->refresh(); updateVerbs(); } @@ -570,8 +493,6 @@ void LLPanelOutfitEdit::updateLookInfo() { if (getVisible()) { - mLookContents->clearRows(); - mFetchLook->setFetchID(mCurrentOutfitID); mFetchLook->startFetch(); if (mFetchLook->isFinished()) |