SL-19583 Uniform risizing for combination inventory view

master
Andrey Kleshchev 2023-04-26 03:53:05 +03:00
parent 7c3452fe44
commit 0091fa0cba
6 changed files with 98 additions and 89 deletions

View File

@ -924,6 +924,16 @@ void AISUpdate::clearParseResults()
mCategoryIds.clear();
}
void AISUpdate::checkTimeout()
{
if (mTimer.hasExpired())
{
llcoro::suspend();
LLCoros::checkStop();
mTimer.setTimerExpirySec(debugLoggingEnabled("Inventory") ? EXPIRY_SECONDS_DEBUG : EXPIRY_SECONDS_LIVE);
}
}
void AISUpdate::parseUpdate(const LLSD& update)
{
clearParseResults();
@ -1281,12 +1291,7 @@ void AISUpdate::parseDescendentCount(const LLUUID& category_id, const LLSD& embe
void AISUpdate::parseEmbedded(const LLSD& embedded, S32 depth)
{
if (mTimer.hasExpired())
{
llcoro::suspend();
LLCoros::checkStop();
mTimer.setTimerExpirySec(debugLoggingEnabled("Inventory") ? EXPIRY_SECONDS_DEBUG : EXPIRY_SECONDS_LIVE);
}
checkTimeout();
if (embedded.has("links")) // _embedded in a category
{
@ -1408,6 +1413,8 @@ void AISUpdate::parseEmbeddedCategories(const LLSD& categories, S32 depth)
void AISUpdate::doUpdate()
{
checkTimeout();
// Do version/descendant accounting.
for (std::map<LLUUID,S32>::const_iterator catit = mCatDescendentDeltas.begin();
catit != mCatDescendentDeltas.end(); ++catit)
@ -1571,6 +1578,8 @@ void AISUpdate::doUpdate()
}
}
checkTimeout();
gInventory.notifyObservers();
}

View File

@ -123,6 +123,7 @@ public:
void doUpdate();
private:
void clearParseResults();
void checkTimeout();
// Debug is very log-heavy, give it more time or it will take forever to process
// Todo: find a way to make throttle static isntead of per-request

View File

@ -128,6 +128,7 @@ public:
bool hasDescendents(const LLUUID& cat_id);
bool hasVisibleItems();
void handleModifiedFilter();
LLScrollContainer* getScrollableContainer() { return mScrollPanel; }
protected:

View File

@ -266,6 +266,8 @@ BOOL LLPanelMainInventory::postBuild()
comb_gallery_filter.markDefault();
mCombinationGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, true));
mCombinationScroller = getChild<LLView>("combination_scroller");
initListCommandsHandlers();
const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
@ -928,6 +930,7 @@ void LLPanelMainInventory::draw()
mActivePanel->setSortOrder(order);
mResortActivePanel = false;
}
LLPanel::draw();
updateItemcountText();
updateCombinationVisibility();
@ -1503,7 +1506,7 @@ void LLPanelMainInventory::toggleViewMode()
getChild<LLPanel>("default_inventory_panel")->setVisible(!mSingleFolderMode);
getChild<LLPanel>("single_folder_inventory")->setVisible(mSingleFolderMode && isListViewMode());
getChild<LLPanel>("gallery_view_inventory")->setVisible(mSingleFolderMode && isGalleryViewMode());
getChild<LLPanel>("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode());
getChild<LLUICtrl>("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode());
getChild<LLLayoutPanel>("nav_buttons")->setVisible(mSingleFolderMode);
getChild<LLButton>("view_mode_btn")->setImageOverlay(mSingleFolderMode ? getString("default_mode_btn") : getString("single_folder_mode_btn"));
@ -2214,19 +2217,41 @@ void LLPanelMainInventory::updateCombinationVisibility()
{
if(mSingleFolderMode && isCombinationViewMode())
{
bool is_gallery_empty = !mCombinationGalleryPanel->hasVisibleItems();
bool show_inv_pane = mCombinationInventoryPanel->hasVisibleItems() || is_gallery_empty || mForceShowInvLayout;
getChild<LLLayoutPanel>("comb_gallery_layout")->setVisible(!is_gallery_empty);
getChild<LLLayoutPanel>("comb_inventory_layout")->setVisible(show_inv_pane);
mCombinationInventoryPanel->getRootFolder()->setForceArrange(!show_inv_pane);
if(mCombinationInventoryPanel->hasVisibleItems())
LLRect inner_rect = mCombinationInventoryPanel->getScrollableContainer()->getScrolledViewRect();
LLRect inv_rect = mCombinationInventoryPanel->getRect();
inv_rect.mBottom = 0;
inv_rect.mRight = inv_rect.mLeft + inner_rect.getWidth();
if (!mCombinationGalleryPanel->hasVisibleItems() || mCombinationInventoryPanel->hasVisibleItems())
{
mForceShowInvLayout = false;
inv_rect.mTop = inv_rect.mBottom + inner_rect.getHeight();
}
if(is_gallery_empty)
else
{
mCombinationGalleryPanel->handleModifiedFilter();
inv_rect.mTop = inv_rect.mBottom;
}
inner_rect = mCombinationGalleryPanel->getScrollableContainer()->getScrolledViewRect();
LLRect galery_rect = mCombinationGalleryPanel->getRect();
galery_rect.mBottom = inv_rect.mTop;
if (mCombinationGalleryPanel->hasVisibleItems())
{
mCombinationGalleryPanel->setVisible(true);
galery_rect.mTop = galery_rect.mBottom + inner_rect.getHeight();
}
else
{
mCombinationGalleryPanel->setVisible(false);
galery_rect.mTop = galery_rect.mBottom;
}
LLRect scroller_rect = mCombinationScroller->getRect();
scroller_rect.mBottom = 0;
scroller_rect.mTop = scroller_rect.mBottom + inv_rect.getHeight() + galery_rect.getHeight();
scroller_rect.mRight = scroller_rect.mLeft + llmax(inv_rect.getWidth(), galery_rect.getWidth());
mCombinationScroller->setRect(scroller_rect);
mCombinationGalleryPanel->handleReshape(galery_rect, false);
mCombinationInventoryPanel->handleReshape(inv_rect, false);
getActivePanel()->getRootFolder();
}
@ -2293,7 +2318,7 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode)
getChild<LLPanel>("single_folder_inventory")->setVisible(mSingleFolderMode && isListViewMode());
getChild<LLPanel>("gallery_view_inventory")->setVisible(mSingleFolderMode && isGalleryViewMode());
getChild<LLPanel>("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode());
getChild<LLUICtrl>("combination_view_inventory")->setVisible(mSingleFolderMode && isCombinationViewMode());
if(isListViewMode())
{

View File

@ -143,8 +143,6 @@ protected:
static BOOL filtersVisible(void* user_data);
void onClearSearch();
static void onFoldersByName(void *user_data);
static BOOL checkFoldersByName(void *user_data);
static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
void onFilterSelected();
@ -196,6 +194,7 @@ private:
LLInventorySingleFolderPanel* mCombinationInventoryPanel;
LLInventoryGallery* mCombinationGalleryPanel;
LLView* mCombinationScroller;
boost::signals2::connection mListViewRootUpdatedConnection;
boost::signals2::connection mGalleryRootUpdatedConnection;

View File

@ -327,7 +327,7 @@
follows="all"
layout="topleft" />
</panel>
<panel
<scroll_container
follows="all"
halign="center"
height="372"
@ -337,74 +337,48 @@
top_delta="0"
visible="false"
width="312">
<layout_stack
follows="all"
height="372"
width="312"
animate="false"
drag_handle_gap="13"
drag_handle_thickness="6"
drag_handle_first_indent="18"
drag_handle_second_indent="18"
drag_handle_color="AddPaymentPanel"
drag_handle_shift="5"
show_drag_handle="true"
top="0"
left="0"
orientation="vertical">
<layout_panel
border="false"
bevel_style="in"
user_resize="true"
auto_resize="true"
height="246"
width="312"
min_width="150"
name="comb_gallery_layout">
<panel
class="inventory_gallery"
filename="panel_inventory_gallery.xml"
left="0"
top_pad="0"
height="246"
width="312"
name="comb_gallery_view_inv"
background_visible="true"
follows="all"
layout="topleft">
<panel
name="combination_scroller"
follows="all"
layout="topleft"
left="0"
top="0"
height="20"
width="291">
<panel
class="inventory_gallery"
filename="panel_inventory_gallery.xml"
follows="left|right"
layout="topleft"
left="0"
top="0"
height="10"
width="290"
name="comb_gallery_view_inv"
background_visible="true">
</panel>
<single_folder_inventory_panel
name="comb_single_folder_inv"
follows="left|right"
layout="topleft"
left="0"
top="200"
height="10"
width="290"
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>
</panel>
</layout_panel>
<layout_panel
border="false"
bevel_style="in"
user_resize="true"
auto_resize="true"
height="126"
width="312"
name="comb_inventory_layout">
<single_folder_inventory_panel
name="comb_single_folder_inv"
follows="all"
left="0"
top="1"
height="126"
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>
</scroll_container>
</panel>