MAINT-5274 Missing folder arrow

master
andreykproductengine 2015-06-22 19:26:28 +03:00
parent 3e0f31f406
commit 7cd62f4908
5 changed files with 43 additions and 2 deletions

View File

@ -128,6 +128,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mSelectPending(FALSE),
mLabelStyle( LLFontGL::NORMAL ),
mHasVisibleChildren(FALSE),
mIsFolderComplete(true),
mLocalIndentation(p.folder_indentation),
mIndentation(0),
mItemHeight(p.item_height),
@ -672,7 +673,7 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L
//
const S32 TOP_PAD = default_params.item_top_pad;
if (hasVisibleChildren())
if (hasVisibleChildren() || !isFolderComplete())
{
LLUIImage* arrow_image = default_params.folder_arrow_image;
gl_draw_scaled_rotated_image(
@ -932,6 +933,8 @@ LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ):
mLastArrangeGeneration( -1 ),
mLastCalculatedWidth(0)
{
// folder might have children that are not loaded yet. Mark it as incomplete until chance to check it.
mIsFolderComplete = false;
}
void LLFolderViewFolder::updateLabelRotation()
@ -1014,6 +1017,12 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height )
mHasVisibleChildren = found;
}
if (!mIsFolderComplete)
{
mIsFolderComplete = getFolderViewModel()->isFolderComplete(this);
}
// calculate height as a single item (without any children), and reshapes rectangle to match
LLFolderViewItem::arrange( width, height );
@ -1679,7 +1688,9 @@ void LLFolderViewFolder::setOpenArrangeRecursively(BOOL openitem, ERecurseType r
mIsOpen = openitem;
if(!was_open && openitem)
{
getViewModelItem()->openItem();
getViewModelItem()->openItem();
// openItem() will request content, it won't be incomplete
mIsFolderComplete = true;
}
else if(was_open && !openitem)
{

View File

@ -114,6 +114,7 @@ protected:
F32 mControlLabelRotation;
LLFolderView* mRoot;
bool mHasVisibleChildren,
mIsFolderComplete, // indicates that some children were not loaded/added yet
mIsCurSelection,
mDragAndDropTarget,
mIsMouseOverTitle,
@ -210,6 +211,9 @@ public:
BOOL hasVisibleChildren() { return mHasVisibleChildren; }
// true if object can't have children
BOOL isFolderComplete() { return mIsFolderComplete; }
// Call through to the viewed object and return true if it can be
// removed. Returns true if it's removed.
//virtual BOOL removeRecursively(BOOL single_item);

View File

@ -122,6 +122,7 @@ public:
virtual void filter() = 0;
virtual bool contentsReady() = 0;
virtual bool isFolderComplete(class LLFolderViewFolder*) = 0;
virtual void setFolderView(LLFolderView* folder_view) = 0;
virtual LLFolderViewFilter& getFilter() = 0;
virtual const LLFolderViewFilter& getFilter() const = 0;
@ -442,6 +443,7 @@ public:
// By default, we assume the content is available. If a network fetch mechanism is implemented for the model,
// this method needs to be overloaded and return the relevant fetch status.
virtual bool contentsReady() { return true; }
virtual bool isFolderComplete(LLFolderViewFolder* folder) { return true; }
struct ViewModelCompare
{

View File

@ -108,6 +108,29 @@ bool LLFolderViewModelInventory::contentsReady()
return !LLInventoryModelBackgroundFetch::instance().folderFetchActive();
}
bool LLFolderViewModelInventory::isFolderComplete(LLFolderViewFolder* folder)
{
LLFolderViewModelItemInventory* modelp = static_cast<LLFolderViewModelItemInventory*>(folder->getViewModelItem());
LLUUID cat_id = modelp->getUUID();
if (cat_id.isNull())
{
return false;
}
LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
if (cat)
{
// don't need to check version - descendents_server == -1 if we have no data
S32 descendents_server = cat->getDescendentCount();
S32 descendents_actual = cat->getViewerDescendentCount();
if (descendents_server == descendents_actual
|| (descendents_actual > 0 && descendents_server == -1)) // content was loaded in previous session
{
return true;
}
}
return false;
}
void LLFolderViewModelItemInventory::requestSort()
{
LLFolderViewModelItemCommon::requestSort();

View File

@ -113,6 +113,7 @@ public:
void sort(LLFolderViewFolder* folder);
bool contentsReady();
bool isFolderComplete(LLFolderViewFolder* folder);
bool startDrag(std::vector<LLFolderViewModelItem*>& items);
private: