From c19dd3d2c48c99f36ff2b6616e7e048ce30d81ad Mon Sep 17 00:00:00 2001 From: Vladimir Pchelko Date: Tue, 22 Jun 2010 18:41:40 +0300 Subject: EXT-7805 FIXED set tool_tip for "plus" button when body_part is selected in "Add more" panel (Edit Outfit) Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/626/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 70 +++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 26 deletions(-) (limited to 'indra/newview/llpaneloutfitedit.cpp') diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 6b5eb23a9b..aac020087b 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -252,7 +252,8 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() mInitialized(false), mAddWearablesPanel(NULL), mFolderViewFilterCmbBox(NULL), - mListViewFilterCmbBox(NULL) + mListViewFilterCmbBox(NULL), + mPlusBtn(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); @@ -343,9 +344,9 @@ BOOL LLPanelOutfitEdit::postBuild() mInventoryItemsPanel = getChild("folder_view"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); - mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2)); - + mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this)); + mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this)); + mCOFDragAndDropObserver = new LLCOFDragAndDropObserver(mInventoryItemsPanel->getModel()); mFolderViewFilterCmbBox = getChild("folder_view_filter_combobox"); @@ -371,7 +372,8 @@ BOOL LLPanelOutfitEdit::postBuild() childSetAction("show_add_wearables_btn", boost::bind(&LLPanelOutfitEdit::onAddMoreButtonClicked, this)); - childSetAction("plus_btn", boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this)); + mPlusBtn = getChild("plus_btn"); + mPlusBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this)); mEditWearableBtn = getChild("edit_wearable_btn"); mEditWearableBtn->setEnabled(FALSE); @@ -382,6 +384,8 @@ BOOL LLPanelOutfitEdit::postBuild() mWearablesListViewPanel = getChild("filtered_wearables_panel"); mWearableItemsList = getChild("list_view"); + mWearableItemsList->setCommitOnSelectionChange(true); + mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this)); mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this)); return TRUE; @@ -559,21 +563,7 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) void LLPanelOutfitEdit::onPlusBtnClicked(void) { - LLUUID selected_id; - if (mInventoryItemsPanel->getVisible()) - { - LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); - if (!curr_item) return; - - LLFolderViewEventListener* listenerp = curr_item->getListener(); - if (!listenerp) return; - - selected_id = listenerp->getUUID(); - } - else if (mWearablesListViewPanel->getVisible()) - { - selected_id = mWearableItemsList->getSelectedUUID(); - } + LLUUID selected_id = getSelectedItemUUID(); if (selected_id.isNull()) return; @@ -658,22 +648,28 @@ void LLPanelOutfitEdit::onEditWearableClicked(void) } } -void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque &items, BOOL user_action) +void LLPanelOutfitEdit::onInventorySelectionChange() { - LLFolderViewItem* current_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); - if (!current_item) + LLUUID item_uuid = getSelectedItemUUID(); + if (item_uuid.isNull()) { return; } - LLViewerInventoryItem* item = current_item->getInventoryItem(); - if (!item) return; + LLViewerInventoryItem* item(gInventory.getItem(item_uuid)); + if (!item) + { + return; + } switch (item->getType()) { - case LLAssetType::AT_CLOTHING: case LLAssetType::AT_BODYPART: + mPlusBtn->setToolTip(getString("replace_body_part")); + break; + case LLAssetType::AT_CLOTHING: case LLAssetType::AT_OBJECT: + mPlusBtn->setToolTip(LLStringUtil::null); default: break; } @@ -934,4 +930,26 @@ void LLPanelOutfitEdit::onOutfitChanging(bool started) indicator->setVisible(started); } +LLUUID LLPanelOutfitEdit::getSelectedItemUUID() +{ + LLUUID selected_id; + if (mInventoryItemsPanel->getVisible()) + { + LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem(); + if (!curr_item) return selected_id; + + LLFolderViewEventListener* listenerp = curr_item->getListener(); + if (!listenerp) return selected_id; + + selected_id = listenerp->getUUID(); + } + else if (mWearablesListViewPanel->getVisible()) + { + selected_id = mWearableItemsList->getSelectedUUID(); + } + + return selected_id; +} + + // EOF -- cgit v1.2.3