summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml22
-rw-r--r--indra/newview/lloutfitgallery.h1
-rw-r--r--indra/newview/lloutfitslist.cpp66
-rw-r--r--indra/newview/lloutfitslist.h3
-rw-r--r--indra/newview/skins/default/xui/en/menu_outfit_sort.xml10
5 files changed, 88 insertions, 14 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 21afd37a35..5c2e2978d7 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -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>
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h
index f530212d26..3d36e9a12f 100644
--- a/indra/newview/lloutfitgallery.h
+++ b/indra/newview/lloutfitgallery.h
@@ -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);
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 94e242c3ef..d5e82f4112 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -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>(
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index 94df963977..9a48f9b99d 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -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();
diff --git a/indra/newview/skins/default/xui/en/menu_outfit_sort.xml b/indra/newview/skins/default/xui/en/menu_outfit_sort.xml
index eeee5689a7..98d6301fbb 100644
--- a/indra/newview/skins/default/xui/en/menu_outfit_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_outfit_sort.xml
@@ -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"