viewer#1424 Favorites in Appearance floater #4
parent
b9633c17e3
commit
7d1597fc98
|
|
@ -777,7 +777,7 @@ void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUI
|
|||
{
|
||||
favorite_image = default_params.favorite_image;
|
||||
}
|
||||
else if (mHasFavorites)
|
||||
else if (mHasFavorites && !hasVisibleChildren())
|
||||
{
|
||||
favorite_image = default_params.favorite_content_image;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15730,6 +15730,28 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>OutfitListSortOrder</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>How outfit list in Avatar's floater is sorted. 0 - by name 1 - favorites to top</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>OutfitListFilterFullList</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>How outfit list in Avatar's floater is sorted. 0 - by name 1 - favorites to top</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>OutfitOperationsTimeout</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ public:
|
|||
|
||||
/*virtual*/ bool getHasExpandableFolders() { return FALSE; }
|
||||
|
||||
/*virtual*/ void onChangeSortOrder(const LLSD& userdata) {};
|
||||
void updateMessageVisibility();
|
||||
bool hasDefaultImage(const LLUUID& outfit_cat_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -197,8 +197,9 @@ 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));
|
||||
|
||||
// force showing list items that don't match current filter(EXT-7158)
|
||||
list->setForceShowingUnmatchedItems(true);
|
||||
// Depending on settings, force showing list items that don't match current filter(EXT-7158)
|
||||
LLCachedControl<bool> list_filter(gSavedSettings, "OutfitListFilterFullList");
|
||||
list->setForceShowingUnmatchedItems(list_filter());
|
||||
|
||||
// Setting list commit callback to monitor currently selected wearable item.
|
||||
list->setCommitCallback(boost::bind(&LLOutfitsList::onListSelectionChange, this, _1));
|
||||
|
|
@ -771,6 +772,41 @@ void LLOutfitsList::handleInvFavColorChange()
|
|||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
const LLUUID outfits = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
|
||||
refreshList(outfits);
|
||||
}
|
||||
else if (sort_data == "show_entire_outfit")
|
||||
{
|
||||
bool new_val = !gSavedSettings.getS32("OutfitListFilterFullList");
|
||||
gSavedSettings.setBOOL("OutfitListFilterFullList", new_val);
|
||||
|
||||
if (!getFilterSubString().empty())
|
||||
{
|
||||
for (outfits_map_t::value_type& outfit : mOutfitsMap)
|
||||
{
|
||||
LLAccordionCtrlTab* tab = outfit.second;
|
||||
if (!tab) continue;
|
||||
|
||||
LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
|
||||
if (list)
|
||||
{
|
||||
list->setForceShowingUnmatchedItems(new_val);
|
||||
list->setForceRefresh(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
LLToggleableMenu* LLOutfitsList::getSortMenu()
|
||||
{
|
||||
|
|
@ -889,21 +925,35 @@ void LLOutfitListBase::refreshList(const LLUUID& category_id)
|
|||
is_category);
|
||||
|
||||
// Memorize item names for each UUID
|
||||
std::map<LLUUID, std::string> names;
|
||||
struct SortData
|
||||
{
|
||||
SortData(std::string name, bool is_favorite) : mName(name), isFavorite(is_favorite) {}
|
||||
std::string mName;
|
||||
bool isFavorite;
|
||||
};
|
||||
std::map<LLUUID, SortData> sort_data;
|
||||
for (const LLPointer<LLViewerInventoryCategory>& cat : cat_array)
|
||||
{
|
||||
names.emplace(std::make_pair(cat->getUUID(), cat->getName()));
|
||||
sort_data.emplace(std::make_pair(cat->getUUID(), SortData(cat->getName(), cat->getIsFavorite())));
|
||||
}
|
||||
|
||||
// Fill added and removed items vectors.
|
||||
mRefreshListState.Added.clear();
|
||||
mRefreshListState.Removed.clear();
|
||||
computeDifference(cat_array, mRefreshListState.Added, mRefreshListState.Removed);
|
||||
// Sort added items vector by item name.
|
||||
|
||||
// Sort added items vector according to settings.
|
||||
S32 sort_order = gSavedSettings.getS32("OutfitListSortOrder");
|
||||
std::sort(mRefreshListState.Added.begin(), mRefreshListState.Added.end(),
|
||||
[names](const LLUUID& a, const LLUUID& b)
|
||||
[sort_data, sort_order](const LLUUID& a, const LLUUID& b)
|
||||
{
|
||||
return LLStringUtil::compareDict(names.at(a), names.at(b)) < 0;
|
||||
const SortData& data_a = sort_data.at(a);
|
||||
const SortData& data_b = sort_data.at(b);
|
||||
if (sort_order == 1 && data_a.isFavorite != data_b.isFavorite)
|
||||
{
|
||||
return data_a.isFavorite;
|
||||
}
|
||||
return LLStringUtil::compareDict(data_a.mName, data_b.mName) < 0;
|
||||
});
|
||||
// Initialize iterators for added and removed items vectors.
|
||||
mRefreshListState.AddedIterator = mRefreshListState.Added.begin();
|
||||
|
|
@ -1455,7 +1505,7 @@ LLOutfitListSortMenu::LLOutfitListSortMenu(LLOutfitListBase* parent_panel)
|
|||
|
||||
registrar.add("Sort.Collapse", boost::bind(&LLOutfitListBase::onCollapseAllFolders, parent_panel));
|
||||
registrar.add("Sort.Expand", boost::bind(&LLOutfitListBase::onExpandAllFolders, parent_panel));
|
||||
registrar.add("Sort.OnAction", boost::bind(&LLOutfitListBase::onAction, parent_panel, _2));
|
||||
registrar.add("Sort.OnSort", boost::bind(&LLOutfitListBase::onChangeSortOrder, parent_panel, _2));
|
||||
enable_registrar.add("Sort.OnEnable", boost::bind(&LLOutfitListBase::isActionEnabled, parent_panel, _2));
|
||||
|
||||
mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
|
||||
|
|
|
|||
|
|
@ -111,6 +111,8 @@ public:
|
|||
|
||||
virtual bool getHasExpandableFolders() = 0;
|
||||
|
||||
virtual void onChangeSortOrder(const LLSD& userdata) = 0;
|
||||
|
||||
virtual void updateMenuItemsVisibility();
|
||||
virtual LLToggleableMenu* getGearMenu();
|
||||
virtual bool getTrashMenuVisible() { return true; };
|
||||
|
|
@ -323,6 +325,7 @@ public:
|
|||
|
||||
/*virtual*/ bool getHasExpandableFolders() { return TRUE; }
|
||||
|
||||
/*virtual*/ void onChangeSortOrder(const LLSD& userdata);
|
||||
virtual LLToggleableMenu* getSortMenu();
|
||||
void updateMenuItemsVisibility();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
layout="topleft"
|
||||
name="expand">
|
||||
<on_click
|
||||
function="Sort.OnAction"
|
||||
parameter="expand" />
|
||||
function="Sort.Expand" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Collapse all folders"
|
||||
|
|
@ -17,8 +16,7 @@
|
|||
visible="true"
|
||||
name="collapse">
|
||||
<on_click
|
||||
function="Sort.OnAction"
|
||||
parameter="collapse" />
|
||||
function="Sort.Collapse" />
|
||||
</menu_item_call>
|
||||
|
||||
<menu_item_separator/>
|
||||
|
|
@ -28,7 +26,7 @@
|
|||
layout="topleft"
|
||||
name="sort_favorites_to_top">
|
||||
<on_click
|
||||
function="Sort.OnAction"
|
||||
function="Sort.OnSort"
|
||||
parameter="sort_favorites" />
|
||||
<on_check
|
||||
function="Sort.OnEnable"
|
||||
|
|
@ -42,7 +40,7 @@
|
|||
layout="topleft"
|
||||
name="show_entire_outfit_in_search">
|
||||
<on_click
|
||||
function="Sort.OnAction"
|
||||
function="Sort.OnSort"
|
||||
parameter="show_entire_outfit" />
|
||||
<on_check
|
||||
function="Sort.OnEnable"
|
||||
|
|
|
|||
Loading…
Reference in New Issue