summaryrefslogtreecommitdiff
path: root/indra/newview/lloutfitslist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r--indra/newview/lloutfitslist.cpp332
1 files changed, 23 insertions, 309 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 2b2b5ea696..df53c66ec1 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -35,7 +35,6 @@
#include "llaccordionctrltab.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
-#include "llappviewer.h"
#include "llfloaterreg.h"
#include "llfloatersidepanelcontainer.h"
#include "llinspecttexture.h"
@@ -46,7 +45,6 @@
#include "lloutfitobserver.h"
#include "lltoggleablemenu.h"
#include "lltransutil.h"
-#include "llviewercontrol.h"
#include "llviewermenu.h"
#include "llvoavatar.h"
#include "llvoavatarself.h"
@@ -55,24 +53,14 @@
static bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y);
static const LLOutfitTabNameComparator OUTFIT_TAB_NAME_COMPARATOR;
-static const LLOutfitTabFavComparator OUTFIT_TAB_FAV_COMPARATOR;
/*virtual*/
bool LLOutfitTabNameComparator::compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const
{
- return (LLStringUtil::compareDict(tab1->getTitle(), tab2->getTitle()) < 0);
-}
-
-bool LLOutfitTabFavComparator::compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const
-{
- LLOutfitAccordionCtrlTab* taba = (LLOutfitAccordionCtrlTab*)tab1;
- LLOutfitAccordionCtrlTab* tabb = (LLOutfitAccordionCtrlTab*)tab2;
- if (taba->getFavorite() != tabb->getFavorite())
- {
- return taba->getFavorite();
- }
+ std::string name1 = tab1->getTitle();
+ std::string name2 = tab2->getTitle();
- return (LLStringUtil::compareDict(tab1->getTitle(), tab2->getTitle()) < 0);
+ return (LLStringUtil::compareDict(name1, name2) < 0);
}
struct outfit_accordion_tab_params : public LLInitParam::Block<outfit_accordion_tab_params, LLOutfitAccordionCtrlTab::Params>
@@ -92,9 +80,6 @@ const outfit_accordion_tab_params& get_accordion_tab_params()
{
initialized = true;
- LLOutfitAccordionCtrlTab::sFavoriteIcon = LLUI::getUIImage("Inv_Favorite_Star_Full");
- LLOutfitAccordionCtrlTab::sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4U(255, 255, 255));
-
LLXMLNodePtr xmlNode;
if (LLUICtrlFactory::getLayeredXMLNode("outfit_accordion_tab.xml", xmlNode))
{
@@ -118,20 +103,11 @@ LLOutfitsList::LLOutfitsList()
, mAccordion(NULL)
, mListCommands(NULL)
, mItemSelected(false)
- , mSortMenu(nullptr)
{
- LLControlVariable* ctrl = gSavedSettings.getControl("InventoryFavoritesColorText");
- if (ctrl)
- {
- mSavedSettingInvFavColor = ctrl->getSignal()->connect(boost::bind(&LLOutfitsList::handleInvFavColorChange, this));
- }
}
LLOutfitsList::~LLOutfitsList()
{
- delete mSortMenu;
- mSavedSettingInvFavColor.disconnect();
- mGearMenuConnection.disconnect();
}
bool LLOutfitsList::postBuild()
@@ -139,25 +115,9 @@ bool LLOutfitsList::postBuild()
mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
- initComparator();
-
return LLOutfitListBase::postBuild();
}
-void LLOutfitsList::initComparator()
-{
- S32 mode = gSavedSettings.getS32("OutfitListSortOrder");
- if (mode == 0)
- {
- mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
- }
- else
- {
- mAccordion->setComparator(&OUTFIT_TAB_FAV_COMPARATOR);
- }
- sortOutfits();
-}
-
//virtual
void LLOutfitsList::onOpen(const LLSD& info)
{
@@ -205,7 +165,6 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id)
tab->setName(name);
tab->setTitle(name);
- tab->setFavorite(cat->getIsFavorite());
// *TODO: LLUICtrlFactory::defaultBuilder does not use "display_children" from xml. Should be investigated.
tab->setDisplayChildren(false);
@@ -235,9 +194,8 @@ void LLOutfitsList::updateAddedCategory(LLUUID cat_id)
// Setting callback to reset items selection inside outfit on accordion collapsing and expanding (EXT-7875)
tab->setDropDownStateChangedCallback(boost::bind(&LLOutfitsList::resetItemSelection, this, list, cat_id));
- // Depending on settings, force showing list items that don't match current filter(EXT-7158)
- static LLCachedControl<bool> list_filter(gSavedSettings, "OutfitListFilterFullList");
- list->setForceShowingUnmatchedItems(list_filter(), false);
+ // force showing list items that don't match current filter(EXT-7158)
+ list->setForceShowingUnmatchedItems(true);
// Setting list commit callback to monitor currently selected wearable item.
list->setCommitCallback(boost::bind(&LLOutfitsList::onListSelectionChange, this, _1));
@@ -302,11 +260,13 @@ void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)
{
if (mOutfitsMap[prev_id])
{
- ((LLOutfitAccordionCtrlTab*)mOutfitsMap[prev_id])->setOutfitSelected(false);
+ mOutfitsMap[prev_id]->setTitleFontStyle("NORMAL");
+ mOutfitsMap[prev_id]->setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor"));
}
if (mOutfitsMap[base_id])
{
- ((LLOutfitAccordionCtrlTab*)mOutfitsMap[base_id])->setOutfitSelected(true);
+ mOutfitsMap[base_id]->setTitleFontStyle("BOLD");
+ mOutfitsMap[base_id]->setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor"));
}
}
@@ -364,11 +324,6 @@ void LLOutfitsList::onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid)
}
}
-void LLOutfitListBase::onAction(const LLSD& userdata)
-{
- performAction(userdata.asString());
-}
-
// virtual
bool LLOutfitListBase::isActionEnabled(const LLSD& userdata)
{
@@ -481,12 +436,11 @@ void LLOutfitsList::updateChangedCategoryName(LLViewerInventoryCategory *cat, st
if (outfits_iter != mOutfitsMap.end())
{
// Update tab name with the new category name.
- LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*) outfits_iter->second;
+ LLAccordionCtrlTab* tab = outfits_iter->second;
if (tab)
{
tab->setName(name);
tab->setTitle(name);
- tab->setFavorite(cat->getIsFavorite());
}
}
}
@@ -578,7 +532,7 @@ void LLOutfitsList::onFilterSubStringChanged(const std::string& new_string, cons
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
if (list)
{
- list->setFilterSubString(new_string, true);
+ list->setFilterSubString(new_string, tab->getDisplayChildren());
}
if (old_string.empty())
@@ -795,75 +749,6 @@ void LLOutfitsList::onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUI
}
}
-void LLOutfitsList::handleInvFavColorChange()
-{
- for (outfits_map_t::iterator iter = mOutfitsMap.begin();
- iter != mOutfitsMap.end();
- ++iter)
- {
- if (!iter->second) continue;
- LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*)iter->second;
-
- // refresh font color
- tab->setFavorite(tab->getFavorite());
- }
-}
-
-void LLOutfitsList::onChangeSortOrder(const LLSD& userdata)
-{
- std::string sort_data = userdata.asString();
- if (sort_data == "favorites_to_top")
- {
- // at the moment this is a toggle
- S32 val = gSavedSettings.getS32("OutfitListSortOrder");
- gSavedSettings.setS32("OutfitListSortOrder", (val ? 0 : 1));
-
- initComparator();
- }
- else if (sort_data == "show_entire_outfit")
- {
- bool new_val = !gSavedSettings.getBOOL("OutfitListFilterFullList");
- gSavedSettings.setBOOL("OutfitListFilterFullList", new_val);
-
- if (!getFilterSubString().empty())
- {
- for (outfits_map_t::value_type& outfit : mOutfitsMap)
- {
- LLAccordionCtrlTab* tab = outfit.second;
- const LLUUID& category_id = outfit.first;
- if (!tab) continue;
-
- LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
- if (list)
- {
- list->setForceRefresh(true);
- list->setForceShowingUnmatchedItems(new_val, tab->getDisplayChildren());
- }
- applyFilterToTab(category_id, tab, getFilterSubString());
- }
- mAccordion->arrange();
- }
- }
-}
-
-LLToggleableMenu* LLOutfitsList::getSortMenu()
-{
- if (!mSortMenu)
- {
- mSortMenu = new LLOutfitListSortMenu(this);
- }
- return mSortMenu->getMenu();
-}
-
-void LLOutfitsList::updateMenuItemsVisibility()
-{
- if (mSortMenu)
- {
- mSortMenu->updateItemsVisibility();
- }
- LLOutfitListBase::updateMenuItemsVisibility();
-}
-
LLOutfitListGearMenuBase* LLOutfitsList::createGearMenu()
{
return new LLOutfitListGearMenu(this);
@@ -881,10 +766,10 @@ bool is_tab_header_clicked(LLAccordionCtrlTab* tab, S32 y)
LLOutfitListBase::LLOutfitListBase()
: LLPanelAppearanceTab()
, mIsInitialized(false)
- , mGearMenu(nullptr)
{
mCategoriesObserver = new LLInventoryCategoriesObserver();
mOutfitMenu = new LLOutfitContextMenu(this);
+ //mGearMenu = createGearMenu();
}
LLOutfitListBase::~LLOutfitListBase()
@@ -980,10 +865,6 @@ bool LLOutfitListBase::isOutfitFolder(LLViewerInventoryCategory* cat) const
void LLOutfitListBase::refreshList(const LLUUID& category_id)
{
- if (LLAppViewer::instance()->quitRequested())
- {
- return;
- }
bool wasNull = mRefreshListState.CategoryUUID.isNull();
mRefreshListState.CategoryUUID.setNull();
@@ -1042,18 +923,8 @@ void LLOutfitListBase::onIdle(void* userdata)
void LLOutfitListBase::onIdleRefreshList()
{
- if (LLAppViewer::instance()->quitRequested())
- {
- mRefreshListState.CategoryUUID.setNull();
- gIdleCallbacks.deleteFunction(onIdle, this);
- return;
- }
if (mRefreshListState.CategoryUUID.isNull())
- {
- LL_WARNS() << "Called onIdleRefreshList without id" << LL_ENDL;
- gIdleCallbacks.deleteFunction(onIdle, this);
return;
- }
const F64 MAX_TIME = 0.05f;
F64 curent_time = LLTimer::getTotalSeconds();
@@ -1195,6 +1066,12 @@ void LLOutfitListBase::ChangeOutfitSelection(LLWearableItemsList* list, const LL
bool LLOutfitListBase::postBuild()
{
+ mGearMenu = createGearMenu();
+
+ LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
+
+ menu_gear_btn->setMouseDownCallback(boost::bind(&LLOutfitListGearMenuBase::updateItemsVisibility, mGearMenu));
+ menu_gear_btn->setMenu(mGearMenu->getMenu());
return true;
}
@@ -1208,20 +1085,6 @@ void LLOutfitListBase::expandAllFolders()
onExpandAllFolders();
}
-void LLOutfitListBase::updateMenuItemsVisibility()
-{
- mGearMenu->updateItemsVisibility();
-}
-
-LLToggleableMenu* LLOutfitListBase::getGearMenu()
-{
- if (!mGearMenu)
- {
- mGearMenu = createGearMenu();
- }
- return mGearMenu->getMenu();
-};
-
void LLOutfitListBase::deselectOutfit(const LLUUID& category_id)
{
// Reset selection if the outfit is selected.
@@ -1248,7 +1111,6 @@ LLContextMenu* LLOutfitContextMenu::createMenu()
registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id));
registrar.add("Outfit.Delete", boost::bind(&LLOutfitListBase::removeSelected, mOutfitList));
registrar.add("Outfit.Thumbnail", boost::bind(&LLOutfitContextMenu::onThumbnail, this, selected_id));
- registrar.add("Outfit.Favorite", boost::bind(&LLOutfitContextMenu::onFavorite, this, selected_id));
registrar.add("Outfit.Save", boost::bind(&LLOutfitContextMenu::onSave, this, selected_id));
enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitContextMenu::onEnable, this, _2));
@@ -1299,16 +1161,6 @@ bool LLOutfitContextMenu::onVisible(LLSD::String param)
{
return LLAppearanceMgr::instance().getCanRemoveOutfit(outfit_cat_id);
}
- else if ("favorites_add" == param)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_cat_id);
- return cat && !cat->getIsFavorite();
- }
- else if ("favorites_remove" == param)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(outfit_cat_id);
- return cat && cat->getIsFavorite();
- }
return true;
}
@@ -1333,14 +1185,6 @@ void LLOutfitContextMenu::onThumbnail(const LLUUID &outfit_cat_id)
}
}
-void LLOutfitContextMenu::onFavorite(const LLUUID& outfit_cat_id)
-{
- if (outfit_cat_id.notNull())
- {
- toggle_favorite(outfit_cat_id);
- }
-}
-
void LLOutfitContextMenu::onSave(const LLUUID &outfit_cat_id)
{
if (outfit_cat_id.notNull())
@@ -1371,13 +1215,14 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist)
registrar.add("Gear.Rename", boost::bind(&LLOutfitListGearMenuBase::onRename, this));
registrar.add("Gear.Delete", boost::bind(&LLOutfitListBase::removeSelected, mOutfitList));
registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenuBase::onCreate, this, _2));
+ registrar.add("Gear.Collapse", boost::bind(&LLOutfitListBase::onCollapseAllFolders, mOutfitList));
+ registrar.add("Gear.Expand", boost::bind(&LLOutfitListBase::onExpandAllFolders, mOutfitList));
registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenuBase::onAdd, this));
registrar.add("Gear.Save", boost::bind(&LLOutfitListGearMenuBase::onSave, this));
registrar.add("Gear.Thumbnail", boost::bind(&LLOutfitListGearMenuBase::onThumbnail, this));
- registrar.add("Gear.Favorite", boost::bind(&LLOutfitListGearMenuBase::onFavorite, this));
- registrar.add("Gear.SortByImage", boost::bind(&LLOutfitListGearMenuBase::onChangeSortOrder, this));
+ registrar.add("Gear.SortByName", boost::bind(&LLOutfitListGearMenuBase::onChangeSortOrder, this));
enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenuBase::onEnable, this, _2));
enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenuBase::onVisible, this, _2));
@@ -1511,16 +1356,6 @@ bool LLOutfitListGearMenuBase::onVisible(LLSD::String param)
{
return false;
}
- else if ("favorites_add" == param)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(selected_outfit_id);
- return cat && !cat->getIsFavorite();
- }
- else if ("favorites_remove" == param)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(selected_outfit_id);
- return cat && cat->getIsFavorite();
- }
return true;
}
@@ -1532,12 +1367,6 @@ void LLOutfitListGearMenuBase::onThumbnail()
LLFloaterReg::showInstance("change_item_thumbnail", data);
}
-void LLOutfitListGearMenuBase::onFavorite()
-{
- const LLUUID& selected_outfit_id = getSelectedOutfitID();
- toggle_favorite(selected_outfit_id);
-}
-
void LLOutfitListGearMenuBase::onChangeSortOrder()
{
@@ -1553,79 +1382,14 @@ LLOutfitListGearMenu::~LLOutfitListGearMenu()
void LLOutfitListGearMenu::onUpdateItemsVisibility()
{
if (!mMenu) return;
+ mMenu->setItemVisible("expand", true);
+ mMenu->setItemVisible("collapse", true);
mMenu->setItemVisible("thumbnail", getSelectedOutfitID().notNull());
- mMenu->setItemVisible("favorite", getSelectedOutfitID().notNull());
mMenu->setItemVisible("sepatator3", false);
mMenu->setItemVisible("sort_folders_by_name", false);
LLOutfitListGearMenuBase::onUpdateItemsVisibility();
}
-//////////////////// LLOutfitListSortMenu ////////////////////
-
-LLOutfitListSortMenu::LLOutfitListSortMenu(LLOutfitListBase* parent_panel)
- : mPanelHandle(parent_panel->getHandle())
-{
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
-
- registrar.add("Sort.Collapse", boost::bind(&LLOutfitListBase::onCollapseAllFolders, parent_panel));
- registrar.add("Sort.Expand", boost::bind(&LLOutfitListBase::onExpandAllFolders, parent_panel));
- registrar.add("Sort.OnSort", boost::bind(&LLOutfitListBase::onChangeSortOrder, parent_panel, _2));
- enable_registrar.add("Sort.OnEnable", boost::bind(&LLOutfitListSortMenu::onEnable, this, _2));
-
- mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
- "menu_outfit_list_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- llassert(mMenu);
-}
-
-
-LLToggleableMenu* LLOutfitListSortMenu::getMenu()
-{
- return mMenu;
-}
-
-void LLOutfitListSortMenu::updateItemsVisibility()
-{
- onUpdateItemsVisibility();
-}
-
-void LLOutfitListSortMenu::onUpdateItemsVisibility()
-{
- if (!mMenu) return;
- mMenu->setItemVisible("expand", true);
- mMenu->setItemVisible("collapse", true);
- mMenu->setItemVisible("sort_favorites_to_top", true);
- mMenu->setItemVisible("show_entire_outfit_in_search", true);
-}
-
-bool LLOutfitListSortMenu::onEnable(LLSD::String param)
-{
- if ("favorites_to_top" == param)
- {
- static LLCachedControl<S32> sort_order(gSavedSettings, "OutfitListSortOrder", 0);
- return sort_order == 1;
- }
- else if ("show_entire_outfit" == param)
- {
- static LLCachedControl<bool> filter_mode(gSavedSettings, "OutfitListFilterFullList", 0);
- return filter_mode;
- }
-
- return false;
-}
-
-
-//////////////////// LLOutfitAccordionCtrlTab ////////////////////
-
-LLUIImage* LLOutfitAccordionCtrlTab::sFavoriteIcon;
-LLUIColor LLOutfitAccordionCtrlTab::sFgColor;
-
-void LLOutfitAccordionCtrlTab::draw()
-{
- LLAccordionCtrlTab::draw();
- drawFavoriteIcon();
-}
-
bool LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)
{
if (y >= getLocalRect().getHeight() - getHeaderHeight())
@@ -1651,54 +1415,4 @@ bool LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)
return LLAccordionCtrlTab::handleToolTip(x, y, mask);
}
-
-void LLOutfitAccordionCtrlTab::setFavorite(bool is_favorite)
-{
- mIsFavorite = is_favorite;
- updateTitleColor();
-}
-
-void LLOutfitAccordionCtrlTab::setOutfitSelected(bool val)
-{
- mIsSelected = val;
- setTitleFontStyle(mIsSelected ? "BOLD" : "NORMAL");
- updateTitleColor();
- }
-
-void LLOutfitAccordionCtrlTab::updateTitleColor()
- {
- static LLUICachedControl<bool> highlight_color("InventoryFavoritesColorText", true);
- if (mIsFavorite && highlight_color())
- {
- setTitleColor(LLUIColorTable::instance().getColor("InventoryFavoriteColor"));
- }
- else if (mIsSelected)
- {
- setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor"));
- }
- else
- {
- setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor"));
- }
- }
-
-void LLOutfitAccordionCtrlTab::drawFavoriteIcon()
-{
- if (!mIsFavorite)
- {
- return;
- }
- static LLUICachedControl<bool> draw_star("InventoryFavoritesUseStar", true);
- if (!draw_star)
- {
- return;
- }
-
- const S32 PAD = 2;
- const S32 image_size = 18;
-
- gl_draw_scaled_image(
- getRect().getWidth() - image_size - PAD, getRect().getHeight() - image_size - PAD,
- image_size, image_size, sFavoriteIcon->getImage(), sFgColor);
-}
// EOF