viewer#1424 Finish menus
parent
738cf84c34
commit
98f7d73d46
|
|
@ -15719,14 +15719,14 @@
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>OutfitGallerySortByName</key>
|
||||
<key>OutfitGallerySortOrder</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Always sort outfits by name in Outfit Gallery</string>
|
||||
<string>Gallery sorting: 0 - sort outfits by name, 1 - images frst, 2 - favorites first</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
|
|
@ -15744,7 +15744,7 @@
|
|||
<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>
|
||||
<string> 0 - show all items in outfit as long as outfit or item inside matches. 1 - show only matches</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ LLOutfitGallery::LLOutfitGallery(const LLOutfitGallery::Params& p)
|
|||
mItemsInRow(p.items_in_row),
|
||||
mRowPanWidthFactor(p.row_panel_width_factor),
|
||||
mGalleryWidthFactor(p.gallery_width_factor),
|
||||
mTextureSelected(NULL)
|
||||
mTextureSelected(NULL),
|
||||
mSortMenu(nullptr)
|
||||
{
|
||||
updateGalleryWidth();
|
||||
}
|
||||
|
|
@ -416,18 +417,28 @@ void LLOutfitGallery::updateRowsIfNeeded()
|
|||
|
||||
bool compareGalleryItem(LLOutfitGalleryItem* item1, LLOutfitGalleryItem* item2)
|
||||
{
|
||||
if(gSavedSettings.getBOOL("OutfitGallerySortByName") ||
|
||||
((item1->isDefaultImage() && item2->isDefaultImage()) || (!item1->isDefaultImage() && !item2->isDefaultImage())))
|
||||
LLCachedControl<S32> sort_by_name(gSavedSettings, "OutfitGallerySortOrder", 0);
|
||||
switch (sort_by_name())
|
||||
{
|
||||
std::string name1 = item1->getItemName();
|
||||
std::string name2 = item2->getItemName();
|
||||
case 2:
|
||||
if (item1->isFavorite() != item2->isFavorite())
|
||||
{
|
||||
return item1->isFavorite();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (item1->isDefaultImage() != item2->isDefaultImage())
|
||||
{
|
||||
return item2->isDefaultImage();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return (LLStringUtil::compareDict(name1, name2) < 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return item2->isDefaultImage();
|
||||
}
|
||||
std::string name1 = item1->getItemName();
|
||||
std::string name2 = item2->getItemName();
|
||||
return (LLStringUtil::compareDict(name1, name2) < 0);
|
||||
}
|
||||
|
||||
void LLOutfitGallery::reArrangeRows(S32 row_diff)
|
||||
|
|
@ -1216,24 +1227,9 @@ void LLOutfitGalleryGearMenu::onUpdateItemsVisibility()
|
|||
if (!mMenu) return;
|
||||
bool have_selection = getSelectedOutfitID().notNull();
|
||||
mMenu->setItemVisible("thumbnail", have_selection);
|
||||
mMenu->setItemVisible("inventory_settings", false);
|
||||
mMenu->setItemVisible("inv_settings_separator", false);
|
||||
mMenu->setItemVisible("sort_order_separator", true);
|
||||
mMenu->setItemVisible("sort_order_by_image", true);
|
||||
LLOutfitListGearMenuBase::onUpdateItemsVisibility();
|
||||
}
|
||||
|
||||
void LLOutfitGalleryGearMenu::onChangeSortOrder()
|
||||
{
|
||||
bool sort_by_name = !gSavedSettings.getBOOL("OutfitGallerySortByName");
|
||||
gSavedSettings.setBOOL("OutfitGallerySortByName", sort_by_name);
|
||||
LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList);
|
||||
if (gallery)
|
||||
{
|
||||
gallery->reArrangeRows();
|
||||
}
|
||||
}
|
||||
|
||||
bool LLOutfitGalleryGearMenu::hasDefaultImage()
|
||||
{
|
||||
LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList);
|
||||
|
|
@ -1336,7 +1332,11 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id)
|
|||
|
||||
LLToggleableMenu* LLOutfitGallery::getSortMenu()
|
||||
{
|
||||
return nullptr;
|
||||
if (!mSortMenu)
|
||||
{
|
||||
mSortMenu = new LLOutfitGallerySortMenu(this);
|
||||
}
|
||||
return mSortMenu->getMenu();
|
||||
}
|
||||
|
||||
LLUUID LLOutfitGallery::getPhotoAssetId(const LLUUID& outfit_id)
|
||||
|
|
@ -1354,3 +1354,84 @@ LLUUID LLOutfitGallery::getDefaultPhoto()
|
|||
return LLUUID();
|
||||
}
|
||||
|
||||
|
||||
//////////////////// LLOutfitGallerySortMenu ////////////////////
|
||||
|
||||
LLOutfitGallerySortMenu::LLOutfitGallerySortMenu(LLOutfitListBase* parent_panel)
|
||||
: mPanelHandle(parent_panel->getHandle())
|
||||
{
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
|
||||
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
|
||||
|
||||
registrar.add("Sort.OnSort", boost::bind(&LLOutfitGallerySortMenu::onSort, this, _2));
|
||||
enable_registrar.add("Sort.OnEnable", boost::bind(&LLOutfitGallerySortMenu::onEnable, this, _2));
|
||||
|
||||
mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
|
||||
"menu_outfit_gallery_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
llassert(mMenu);
|
||||
}
|
||||
|
||||
|
||||
LLToggleableMenu* LLOutfitGallerySortMenu::getMenu()
|
||||
{
|
||||
return mMenu;
|
||||
}
|
||||
|
||||
void LLOutfitGallerySortMenu::updateItemsVisibility()
|
||||
{
|
||||
onUpdateItemsVisibility();
|
||||
}
|
||||
|
||||
void LLOutfitGallerySortMenu::onUpdateItemsVisibility()
|
||||
{
|
||||
if (!mMenu) return;
|
||||
}
|
||||
|
||||
bool LLOutfitGallerySortMenu::onEnable(LLSD::String param)
|
||||
{
|
||||
LLCachedControl<S32> sort_order(gSavedSettings, "OutfitGallerySortOrder", 0);
|
||||
if ("favorites_to_top" == param)
|
||||
{
|
||||
return sort_order == 2;
|
||||
}
|
||||
else if ("images_to_top" == param)
|
||||
{
|
||||
return sort_order == 1;
|
||||
}
|
||||
else if ("by_name" == param)
|
||||
{
|
||||
return sort_order == 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LLOutfitGallerySortMenu::onSort(LLSD::String param)
|
||||
{
|
||||
S32 sort_order = gSavedSettings.getS32("OutfitGallerySortOrder");
|
||||
S32 new_sort_order = 0;
|
||||
if ("favorites_to_top" == param)
|
||||
{
|
||||
new_sort_order = 2;
|
||||
}
|
||||
else if ("images_to_top" == param)
|
||||
{
|
||||
new_sort_order = 1;
|
||||
}
|
||||
else if ("by_name" == param)
|
||||
{
|
||||
new_sort_order = 0;
|
||||
}
|
||||
if (sort_order == new_sort_order)
|
||||
{
|
||||
new_sort_order = sort_order ? 0 : 1;
|
||||
}
|
||||
gSavedSettings.setS32("OutfitGallerySortOrder", new_sort_order);
|
||||
|
||||
LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mPanelHandle.get());
|
||||
if (gallery)
|
||||
{
|
||||
gallery->reArrangeRows();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,13 @@ class LLOutfitGalleryItem;
|
|||
class LLOutfitListGearMenuBase;
|
||||
class LLOutfitGalleryGearMenu;
|
||||
class LLOutfitGalleryContextMenu;
|
||||
class LLOutfitGallerySortMenu;
|
||||
|
||||
class LLOutfitGallery : public LLOutfitListBase
|
||||
{
|
||||
public:
|
||||
friend class LLOutfitGalleryGearMenu;
|
||||
friend class LLOutfitGallerySortMenu;
|
||||
friend class LLOutfitGalleryContextMenu;
|
||||
friend class LLUpdateGalleryOnPhotoLinked;
|
||||
|
||||
|
|
@ -177,6 +179,7 @@ private:
|
|||
int mGalleryWidthFactor;
|
||||
|
||||
LLListContextMenu* mOutfitGalleryMenu;
|
||||
LLOutfitGallerySortMenu* mSortMenu;
|
||||
|
||||
typedef std::map<LLUUID, LLOutfitGalleryItem*> outfit_map_t;
|
||||
typedef outfit_map_t::value_type outfit_map_value_t;
|
||||
|
|
@ -214,8 +217,6 @@ public:
|
|||
protected:
|
||||
/*virtual*/ void onUpdateItemsVisibility();
|
||||
private:
|
||||
/*virtual*/ void onChangeSortOrder();
|
||||
|
||||
bool hasDefaultImage();
|
||||
};
|
||||
|
||||
|
|
@ -252,6 +253,7 @@ public:
|
|||
|
||||
std::string getItemName() {return mOutfitName;}
|
||||
bool isDefaultImage() {return mDefaultImage;}
|
||||
bool isFavorite() { return mFavorite; }
|
||||
|
||||
bool isHidden() {return mHidden;}
|
||||
void setHidden(bool hidden) {mHidden = hidden;}
|
||||
|
|
@ -277,4 +279,21 @@ private:
|
|||
static LLUIColor sDefaultFavoriteColor;
|
||||
};
|
||||
|
||||
class LLOutfitGallerySortMenu
|
||||
{
|
||||
public:
|
||||
LLOutfitGallerySortMenu(LLOutfitListBase* parent_panel);
|
||||
|
||||
LLToggleableMenu* getMenu();
|
||||
void updateItemsVisibility();
|
||||
|
||||
private:
|
||||
void onUpdateItemsVisibility();
|
||||
bool onEnable(LLSD::String param);
|
||||
void onSort(LLSD::String param);
|
||||
|
||||
LLToggleableMenu* mMenu;
|
||||
LLHandle<LLPanel> mPanelHandle;
|
||||
};
|
||||
|
||||
#endif // LL_LLOUTFITGALLERYCTRL_H
|
||||
|
|
|
|||
|
|
@ -1457,10 +1457,6 @@ bool LLOutfitListGearMenuBase::onEnable(LLSD::String param)
|
|||
{
|
||||
return LLAppearanceMgr::instance().getCanReplaceCOF(mOutfitList->getSelectedOutfitUUID());
|
||||
}
|
||||
if ("sort_by_image" == param)
|
||||
{
|
||||
return !gSavedSettings.getBOOL("OutfitGallerySortByName");
|
||||
}
|
||||
|
||||
return mOutfitList->isActionEnabled(param);
|
||||
}
|
||||
|
|
@ -1516,10 +1512,6 @@ void LLOutfitListGearMenu::onUpdateItemsVisibility()
|
|||
if (!mMenu) return;
|
||||
mMenu->setItemVisible("thumbnail", getSelectedOutfitID().notNull());
|
||||
mMenu->setItemVisible("favorite", getSelectedOutfitID().notNull());
|
||||
mMenu->setItemVisible("inventory_settings", true);
|
||||
mMenu->setItemVisible("inv_settings_separator", true);
|
||||
mMenu->setItemVisible("sort_order_separator", false);
|
||||
mMenu->setItemVisible("sort_order_by_image", false);
|
||||
LLOutfitListGearMenuBase::onUpdateItemsVisibility();
|
||||
}
|
||||
|
||||
|
|
@ -1537,7 +1529,7 @@ LLOutfitListSortMenu::LLOutfitListSortMenu(LLOutfitListBase* parent_panel)
|
|||
enable_registrar.add("Sort.OnEnable", boost::bind(&LLOutfitListSortMenu::onEnable, this, _2));
|
||||
|
||||
mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
|
||||
"menu_outfit_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
"menu_outfit_list_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
llassert(mMenu);
|
||||
}
|
||||
|
||||
|
|
@ -1574,7 +1566,7 @@ bool LLOutfitListSortMenu::onEnable(LLSD::String param)
|
|||
return !filter_mode;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -968,9 +968,10 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
|
|||
U32 n_links = 0; // number of links among the selected items
|
||||
U32 n_editable = 0; // number of editable items among the selected ones
|
||||
U32 n_touchable = 0; // number of touchable items among the selected ones
|
||||
U32 n_favorites = 0; // number of favorite items among the selected ones
|
||||
|
||||
bool can_be_worn = true;
|
||||
bool can_favorite = false;
|
||||
bool can_unfavorite = false;
|
||||
|
||||
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
|
||||
{
|
||||
|
|
@ -995,7 +996,8 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
|
|||
|
||||
LLUUID linked_id = item->getLinkedUUID();
|
||||
LLViewerInventoryItem* linked_item = gInventory.getItem(linked_id);
|
||||
const bool is_favorite = linked_item->getIsFavorite();
|
||||
can_favorite |= !linked_item->getIsFavorite();
|
||||
can_unfavorite |= linked_item->getIsFavorite();
|
||||
|
||||
if (is_worn)
|
||||
{
|
||||
|
|
@ -1017,10 +1019,6 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
|
|||
{
|
||||
++n_already_worn;
|
||||
}
|
||||
if (is_favorite)
|
||||
{
|
||||
++n_favorites;
|
||||
}
|
||||
|
||||
if (can_be_worn)
|
||||
{
|
||||
|
|
@ -1045,10 +1043,10 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
|
|||
setMenuItemVisible(menu, "create_new", mask & (MASK_CLOTHING|MASK_BODYPART) && n_items == 1);
|
||||
setMenuItemEnabled(menu, "create_new", LLAppearanceMgr::instance().canAddWearables(ids));
|
||||
setMenuItemVisible(menu, "show_original", !standalone);
|
||||
setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items);
|
||||
setMenuItemVisible(menu, "favorites_add", n_favorites < n_items);
|
||||
setMenuItemVisible(menu, "favorites_remove", n_favorites > 0);
|
||||
setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items);
|
||||
setMenuItemEnabled(menu, "show_original", n_items == 1 && n_links == n_items);
|
||||
setMenuItemVisible(menu, "favorites_add", can_favorite);
|
||||
setMenuItemVisible(menu, "favorites_remove", can_unfavorite);
|
||||
setMenuItemVisible(menu, "take_off", mask == MASK_CLOTHING && n_worn == n_items);
|
||||
setMenuItemVisible(menu, "detach", mask == MASK_ATTACHMENT && n_worn == n_items);
|
||||
setMenuItemVisible(menu, "take_off_or_detach", mask == (MASK_ATTACHMENT|MASK_CLOTHING));
|
||||
setMenuItemEnabled(menu, "take_off_or_detach", n_worn == n_items);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<toggleable_menu
|
||||
layout="topleft"
|
||||
visible="false"
|
||||
name="Sort Outfit">
|
||||
<menu_item_check
|
||||
label="Sort favorites to top"
|
||||
layout="topleft"
|
||||
visible="true"
|
||||
name="sort_favorites_to_top">
|
||||
<on_click
|
||||
function="Sort.OnSort"
|
||||
parameter="favorites_to_top" />
|
||||
<on_check
|
||||
function="Sort.OnEnable"
|
||||
parameter="favorites_to_top" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Sort images to top"
|
||||
layout="topleft"
|
||||
visible="true"
|
||||
name="sort_images_to_top">
|
||||
<on_click
|
||||
function="Sort.OnSort"
|
||||
parameter="images_to_top" />
|
||||
<on_check
|
||||
function="Sort.OnEnable"
|
||||
parameter="images_to_top" />
|
||||
</menu_item_check>
|
||||
<menu_item_check
|
||||
label="Sort by name"
|
||||
layout="topleft"
|
||||
visible="true"
|
||||
name="sort_by_name">
|
||||
<on_click
|
||||
function="Sort.OnSort"
|
||||
parameter="by_name" />
|
||||
<on_check
|
||||
function="Sort.OnEnable"
|
||||
parameter="by_name" />
|
||||
</menu_item_check>
|
||||
</toggleable_menu>
|
||||
|
|
@ -109,18 +109,6 @@
|
|||
function="Gear.OnVisible"
|
||||
parameter="delete" />
|
||||
</menu_item_call>
|
||||
<menu_item_separator
|
||||
name="sort_order_separator"/>
|
||||
<menu_item_check
|
||||
label="Show outfits with images first"
|
||||
layout="topleft"
|
||||
name="sort_order_by_image">
|
||||
<on_click
|
||||
function="Gear.SortByImage" />
|
||||
<on_check
|
||||
function="Gear.OnEnable"
|
||||
parameter="sort_by_image" />
|
||||
</menu_item_check>
|
||||
<menu_item_separator/>
|
||||
<!-- copied (with minor modifications) from menu_inventory_add.xml -->
|
||||
<!-- *TODO: generate dynamically? -->
|
||||
|
|
@ -282,12 +270,12 @@
|
|||
</menu>
|
||||
<!-- copied from menu_inventory_add.xml -->
|
||||
|
||||
<menu_item_separator
|
||||
name="inv_settings_separator"/>
|
||||
<menu_item_separator/>
|
||||
|
||||
<menu_item_check
|
||||
label="Inventory settings..."
|
||||
layout="topleft"
|
||||
visible="true"
|
||||
name="inventory_settings">
|
||||
<menu_item_check.on_check
|
||||
function="Floater.Visible"
|
||||
|
|
|
|||
Loading…
Reference in New Issue