Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SL-19104 Clean up inventory UI to prepare for thumbnails #66

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions indra/newview/llfolderviewmodelinventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class LLFolderViewModelItemInventory
virtual LLFolderType::EType getPreferredType() const = 0;
virtual void showProperties(void) = 0;
virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.
virtual bool isItemInOutfits() const { return false; }
virtual BOOL isAgentInventory() const { return FALSE; }
virtual BOOL isUpToDate() const = 0;
virtual void addChild(LLFolderViewModelItem* child);
Expand Down
10 changes: 10 additions & 0 deletions indra/newview/llinventorybridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,16 @@ BOOL LLInvFVBridge::isLinkedObjectInTrash() const
return FALSE;
}

bool LLInvFVBridge::isItemInOutfits() const
{
const LLInventoryModel* model = getInventoryModel();
if(!model) return false;

const LLUUID my_outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS, false);

return isCOFFolder() || (my_outfits_cat == mUUID) || model->isObjectDescendentOf(mUUID, my_outfits_cat);
}

BOOL LLInvFVBridge::isLinkedObjectMissing() const
{
const LLInventoryObject *obj = getInventoryObject();
Expand Down
1 change: 1 addition & 0 deletions indra/newview/llinventorybridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class LLInvFVBridge : public LLFolderViewModelItemInventory
virtual BOOL isItemRemovable() const;
virtual BOOL isItemMovable() const;
virtual BOOL isItemInTrash() const;
virtual bool isItemInOutfits() const;
virtual BOOL isLink() const;
virtual BOOL isLibraryItem() const;
//virtual BOOL removeItem() = 0;
Expand Down
21 changes: 21 additions & 0 deletions indra/newview/llinventoryfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ bool LLInventoryFilter::checkAgainstSearchVisibility(const LLFolderViewModelItem
if (is_link && ((mFilterOps.mSearchVisibility & VISIBILITY_LINKS) == 0))
return FALSE;

if (listener->isItemInOutfits() && ((mFilterOps.mSearchVisibility & VISIBILITY_OUTFITS) == 0))
return FALSE;

if (listener->isItemInTrash() && ((mFilterOps.mSearchVisibility & VISIBILITY_TRASH) == 0))
return FALSE;

Expand Down Expand Up @@ -792,6 +795,24 @@ void LLInventoryFilter::toggleSearchVisibilityLinks()
}
}

void LLInventoryFilter::toggleSearchVisibilityOutfits()
{
bool hide_outfits = mFilterOps.mSearchVisibility & VISIBILITY_OUTFITS;
if (hide_outfits)
{
mFilterOps.mSearchVisibility &= ~VISIBILITY_OUTFITS;
}
else
{
mFilterOps.mSearchVisibility |= VISIBILITY_OUTFITS;
}

if (hasFilterString())
{
setModified(hide_outfits ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
}
}

void LLInventoryFilter::toggleSearchVisibilityTrash()
{
bool hide_trash = mFilterOps.mSearchVisibility & VISIBILITY_TRASH;
Expand Down
4 changes: 3 additions & 1 deletion indra/newview/llinventoryfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ class LLInventoryFilter : public LLFolderViewFilter
VISIBILITY_NONE = 0,
VISIBILITY_TRASH = 0x1 << 0,
VISIBILITY_LIBRARY = 0x1 << 1,
VISIBILITY_LINKS = 0x1 << 2
VISIBILITY_LINKS = 0x1 << 2,
VISIBILITY_OUTFITS = 0x1 << 3
};

struct FilterOps
Expand Down Expand Up @@ -228,6 +229,7 @@ class LLInventoryFilter : public LLFolderViewFilter

void toggleSearchVisibilityLinks();
void toggleSearchVisibilityTrash();
void toggleSearchVisibilityOutfits();
void toggleSearchVisibilityLibrary();
void setSearchVisibilityTypes(U32 types);
void setSearchVisibilityTypes(const Params& params);
Expand Down
46 changes: 15 additions & 31 deletions indra/newview/llpanelmaininventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mMenuGearDefault(NULL),
mMenuVisibility(NULL),
mMenuAddHandle(),
mNeedUploadCost(true)
mNeedUploadCost(true),
mMenuViewDefault(NULL)
{
// Menu Callbacks (non contex menus)
mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelMainInventory::doToSelected, this, _2));
Expand Down Expand Up @@ -237,6 +238,7 @@ BOOL LLPanelMainInventory::postBuild()

mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
mVisibilityMenuButton = getChild<LLMenuButton>("options_visibility_btn");
mViewMenuButton = getChild<LLMenuButton>("view_btn");

initListCommandsHandlers();

Expand Down Expand Up @@ -1163,21 +1165,15 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)

void LLPanelMainInventory::initListCommandsHandlers()
{
childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));

mTrashButton = getChild<LLDragAndDropButton>("trash_btn");
mTrashButton->setDragAndDropHandler(boost::bind(&LLPanelMainInventory::handleDragAndDropToTrash, this
, _4 // BOOL drop
, _5 // EDragAndDropType cargo_type
, _7 // EAcceptance* accept
));

mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mGearMenuButton->setMenu(mMenuGearDefault);
mMenuViewDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_view_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mViewMenuButton->setMenu(mMenuViewDefault);
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mMenuAddHandle = menu->getHandle();

Expand All @@ -1191,9 +1187,6 @@ void LLPanelMainInventory::initListCommandsHandlers()

void LLPanelMainInventory::updateListCommands()
{
bool trash_enabled = isActionEnabled("delete");

mTrashButton->setEnabled(trash_enabled);
}

void LLPanelMainInventory::onAddButtonClick()
Expand Down Expand Up @@ -1227,11 +1220,6 @@ void LLPanelMainInventory::showActionMenu(LLMenuGL* menu, std::string spawning_v
}
}

void LLPanelMainInventory::onTrashButtonClick()
{
onClipboardAction("delete");
}

void LLPanelMainInventory::onClipboardAction(const LLSD& userdata)
{
std::string command_name = userdata.asString();
Expand Down Expand Up @@ -1375,6 +1363,11 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
LLFloaterReg::showInstance("linkreplace", params);
}

if (command_name == "toggle_search_outfits")
{
mActivePanel->getFilter().toggleSearchVisibilityOutfits();
}

if (command_name == "toggle_search_trash")
{
mActivePanel->getFilter().toggleSearchVisibilityTrash();
Expand Down Expand Up @@ -1534,6 +1527,11 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
return sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
}

if (command_name == "toggle_search_outfits")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_OUTFITS) != 0;
}

if (command_name == "toggle_search_trash")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_TRASH) != 0;
Expand All @@ -1552,20 +1550,6 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
return FALSE;
}

bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
{
*accept = ACCEPT_NO;

const bool is_enabled = isActionEnabled("delete");
if (is_enabled) *accept = ACCEPT_YES_MULTI;

if (is_enabled && drop)
{
onClipboardAction("delete");
}
return true;
}

void LLPanelMainInventory::setUploadCostIfNeeded()
{
LLMenuGL* menu = (LLMenuGL*)mMenuAddHandle.get();
Expand Down
5 changes: 2 additions & 3 deletions indra/newview/llpanelmaininventory.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,21 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver
void updateListCommands();
void onAddButtonClick();
void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
void onTrashButtonClick();
void onClipboardAction(const LLSD& userdata);
BOOL isActionEnabled(const LLSD& command_name);
BOOL isActionChecked(const LLSD& userdata);
void onCustomAction(const LLSD& command_name);
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
static bool hasSettingsInventory();
/**
* Set upload cost in "Upload" sub menu.
*/
void setUploadCostIfNeeded();
private:
LLDragAndDropButton* mTrashButton;
LLToggleableMenu* mMenuGearDefault;
LLToggleableMenu* mMenuViewDefault;
LLToggleableMenu* mMenuVisibility;
LLMenuButton* mGearMenuButton;
LLMenuButton* mViewMenuButton;
LLMenuButton* mVisibilityMenuButton;
LLHandle<LLView> mMenuAddHandle;

Expand Down
3 changes: 0 additions & 3 deletions indra/newview/llpanelmarketplaceinbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ BOOL LLPanelMarketplaceInbox::postBuild()

void LLPanelMarketplaceInbox::onSelectionChange()
{
LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");

sidepanel_inventory->updateVerbs();
}


Expand Down
Loading