SL-19544 WIP Combination view first pass

meow-7.2.2
Maxim Nikolenko 2023-04-07 15:13:47 +03:00
parent 3c23be758e
commit d5a949d97a
6 changed files with 169 additions and 9 deletions

View File

@ -1128,6 +1128,11 @@ bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id)
}
return true;
}
bool LLInventoryGallery::hasVisibleItems()
{
return mItemsAddedCount > 0;
}
//-----------------------------
// LLInventoryGalleryItem
//-----------------------------

View File

@ -122,6 +122,7 @@ public:
LLInventoryFilter::ESearchType getSearchType() { return mSearchType; }
bool hasDescendents(const LLUUID& cat_id);
bool hasVisibleItems();
protected:

View File

@ -252,6 +252,19 @@ BOOL LLPanelMainInventory::postBuild()
mInventoryGalleryPanel = getChild<LLInventoryGallery>("gallery_view_inv");
mGalleryRootUpdatedConnection = mInventoryGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::updateTitle, this));
mCombinationPanelInventory = getChild<LLInventorySingleFolderPanel>("comb_single_folder_inv");
LLInventoryFilter& comb_inv_filter = mCombinationPanelInventory->getFilter();
comb_inv_filter.setFilterThumbnails(LLInventoryFilter::FILTER_EXCLUDE_THUMBNAILS);
comb_inv_filter.markDefault();
mCombinationPanelInventory->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mCombinationPanelInventory, _1, _2));
mCombinationPanelInventory->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, false));
mCombinationGalleryPanel = getChild<LLInventoryGallery>("comb_gallery_view_inv");
LLInventoryFilter& comb_gallery_filter = mCombinationGalleryPanel->getFilter();
comb_gallery_filter.setFilterThumbnails(LLInventoryFilter::FILTER_ONLY_THUMBNAILS);
comb_gallery_filter.markDefault();
mCombinationGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, true));
initListCommandsHandlers();
const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
@ -887,6 +900,7 @@ void LLPanelMainInventory::draw()
}
LLPanel::draw();
updateItemcountText();
updateCombinationVisibility();
}
void LLPanelMainInventory::updateItemcountText()
@ -1514,6 +1528,10 @@ void LLPanelMainInventory::onUpFolderClicked()
{
mInventoryGalleryPanel->setRootFolder(cat->getParentUUID());
}
if(isCombinationViewMode())
{
mCombinationPanelInventory->changeFolderRoot(cat->getParentUUID());
}
}
}
}
@ -1528,6 +1546,10 @@ void LLPanelMainInventory::onBackFolderClicked()
{
mInventoryGalleryPanel->onBackwardFolder();
}
if(isCombinationViewMode())
{
mCombinationPanelInventory->onBackwardFolder();
}
}
void LLPanelMainInventory::onForwardFolderClicked()
@ -1540,6 +1562,10 @@ void LLPanelMainInventory::onForwardFolderClicked()
{
mInventoryGalleryPanel->onForwardFolder();
}
if(isCombinationViewMode())
{
mCombinationPanelInventory->onForwardFolder();
}
}
void LLPanelMainInventory::setSingleFolderViewRoot(const LLUUID& folder_id, bool clear_nav_history)
@ -2099,6 +2125,26 @@ void LLPanelMainInventory::updateTitle()
updateNavButtons();
}
void LLPanelMainInventory::onCombinationRootChanged(bool gallery_clicked)
{
if(gallery_clicked)
{
mCombinationPanelInventory->changeFolderRoot(mCombinationGalleryPanel->getRootFolder());
}
else
{
mCombinationGalleryPanel->setRootFolder(mCombinationPanelInventory->getSingleFolderRoot());
}
updateTitle();
}
void LLPanelMainInventory::updateCombinationVisibility()
{
getChild<LLLayoutPanel>("comb_gallery_layout")->setVisible(mCombinationGalleryPanel->hasVisibleItems());
getChild<LLView>("border")->setVisible(mCombinationGalleryPanel->hasVisibleItems());
}
void LLPanelMainInventory::updateNavButtons()
{
if(isListViewMode())
@ -2111,6 +2157,11 @@ void LLPanelMainInventory::updateNavButtons()
getChild<LLButton>("back_btn")->setEnabled(mInventoryGalleryPanel->isBackwardAvailable());
getChild<LLButton>("forward_btn")->setEnabled(mInventoryGalleryPanel->isForwardAvailable());
}
if(isCombinationViewMode())
{
getChild<LLButton>("back_btn")->setEnabled(mCombinationPanelInventory->isBackwardAvailable());
getChild<LLButton>("forward_btn")->setEnabled(mCombinationPanelInventory->isForwardAvailable());
}
const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot());
bool up_enabled = (cat && cat->getParentUUID().notNull());
@ -2131,6 +2182,24 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode)
{
if(mode != mViewMode)
{
std::list<LLUUID> forward_history;
std::list<LLUUID> backward_history;
switch(mViewMode)
{
case MODE_LIST:
forward_history = mSingleFolderPanelInventory->getNavForwardList();
backward_history = mSingleFolderPanelInventory->getNavBackwardList();
break;
case MODE_GALLERY:
forward_history = mInventoryGalleryPanel->getNavForwardList();
backward_history = mInventoryGalleryPanel->getNavBackwardList();
break;
case MODE_COMBINATION:
forward_history = mCombinationPanelInventory->getNavForwardList();
backward_history = mCombinationPanelInventory->getNavBackwardList();
break;
}
LLUUID cur_root = getCurrentSFVRoot();
mViewMode = mode;
@ -2141,15 +2210,25 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode)
if(isListViewMode())
{
mSingleFolderPanelInventory->changeFolderRoot(cur_root);
mSingleFolderPanelInventory->setNavForwardList(mInventoryGalleryPanel->getNavForwardList());
mSingleFolderPanelInventory->setNavBackwardList(mInventoryGalleryPanel->getNavBackwardList());
mSingleFolderPanelInventory->setNavForwardList(forward_history);
mSingleFolderPanelInventory->setNavBackwardList(backward_history);
}
if(isGalleryViewMode())
{
mInventoryGalleryPanel->setRootFolder(cur_root);
mInventoryGalleryPanel->setNavForwardList(mSingleFolderPanelInventory->getNavForwardList());
mInventoryGalleryPanel->setNavBackwardList(mSingleFolderPanelInventory->getNavBackwardList());
mInventoryGalleryPanel->setNavForwardList(forward_history);
mInventoryGalleryPanel->setNavBackwardList(backward_history);
}
if(isCombinationViewMode())
{
mCombinationPanelInventory->changeFolderRoot(cur_root);
mCombinationGalleryPanel->setRootFolder(cur_root);
mCombinationPanelInventory->setNavForwardList(forward_history);
mCombinationPanelInventory->setNavBackwardList(backward_history);
mCombinationGalleryPanel->setNavForwardList(forward_history);
mCombinationGalleryPanel->setNavBackwardList(backward_history);
}
updateNavButtons();
onFilterSelected();
@ -2178,8 +2257,7 @@ LLUUID LLPanelMainInventory::getCurrentSFVRoot()
}
if(isCombinationViewMode())
{
//todo: should get actual Combination view root
return mSingleFolderPanelInventory->getSingleFolderRoot();
return mCombinationPanelInventory->getSingleFolderRoot();
}
return LLUUID::null;
}

View File

@ -160,6 +160,8 @@ protected:
bool isSaveTextureEnabled(const LLSD& userdata);
void updateItemcountText();
void updateCombinationVisibility();
void onFocusReceived();
void onSelectSearchType();
void updateSearchTypeCombo();
@ -190,6 +192,8 @@ private:
EViewModeType mViewMode;
LLInventorySingleFolderPanel* mSingleFolderPanelInventory;
LLInventoryGallery* mInventoryGalleryPanel;
LLInventorySingleFolderPanel* mCombinationPanelInventory;
LLInventoryGallery* mCombinationGalleryPanel;
boost::signals2::connection mListViewRootUpdatedConnection;
boost::signals2::connection mGalleryRootUpdatedConnection;
@ -209,6 +213,8 @@ protected:
static bool hasSettingsInventory();
void updateTitle();
void updateNavButtons();
void onCombinationRootChanged(bool gallery_clicked);
/**
* Set upload cost in "Upload" sub menu.
*/

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
background_visible="true"
bg_alpha_color="DkGray"
bg_alpha_color="InventoryBackgroundColor"
border="false"
follows="all"
height="390"

View File

@ -286,8 +286,7 @@
name="single_folder_inv"
follows="all"
left="0"
top="0"
top_pad="5"
top_pad="1"
height="372"
width="312"
layout="topleft"
@ -338,5 +337,76 @@
top_delta="0"
visible="false"
width="312">
<layout_stack
follows="all"
height="372"
width="312"
animate="false"
top="0"
left="0"
orientation="vertical">
<layout_panel
border="false"
bevel_style="in"
user_resize="true"
auto_resize="true"
height="186"
width="312"
min_width="150"
name="comb_gallery_layout">
<panel
class="inventory_gallery"
filename="panel_inventory_gallery.xml"
left="0"
top_pad="0"
height="178"
width="312"
name="comb_gallery_view_inv"
background_visible="true"
follows="all"
layout="topleft">
</panel>
<view_border
bevel_style="none"
height="0"
follows="left|bottom|right"
layout="topleft"
left="6"
name="border"
top_pad="8"
width="300"/>
</layout_panel>
<layout_panel
border="false"
bevel_style="in"
user_resize="true"
auto_resize="true"
height="186"
width="312"
name="comb_inventory_layout">
<single_folder_inventory_panel
name="comb_single_folder_inv"
follows="all"
left="0"
top="1"
height="181"
width="312"
layout="topleft"
show_item_link_overlays="true"
bg_opaque_color="DkGray2"
bg_alpha_color="DkGray2"
background_visible="true"
border="false"
bevel_style="none"
scroll.reserve_scroll_corner="false">
<item
single_folder_mode="true"
folder_indentation="-8"/>
<folder
single_folder_mode="true"
folder_indentation="-8"/>
</single_folder_inventory_panel>
</layout_panel>
</layout_stack>
</panel>
</panel>