From 062cae9a4880f7672df7f6189e01b2bff15f42f1 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 29 Jun 2012 15:44:08 -0700 Subject: CHUI-101 WIP Make LLFolderView general purpose cleaned up some stale TODOs worked on getting initial inventory display to work consistently --- indra/newview/llfolderview.cpp | 2 +- indra/newview/llfolderviewmodel.h | 13 +++--------- indra/newview/llinventoryfilter.cpp | 3 +-- indra/newview/llinventorypanel.cpp | 34 ++++++++++++++++++++++++-------- indra/newview/llinventorypanel.h | 4 ++-- indra/newview/llpanelobjectinventory.cpp | 2 +- indra/newview/lltexturectrl.cpp | 2 +- 7 files changed, 35 insertions(+), 25 deletions(-) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index e007c58497..5844c58e09 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -713,7 +713,6 @@ void LLFolderView::draw() { if (!mViewModel->contentsReady() || getLastFilterGeneration() < getFolderViewModel()->getFilter()->getFirstSuccessGeneration()) { - // TODO RN: Get this from filter mStatusText = LLTrans::getString("Searching"); } else @@ -981,6 +980,7 @@ void LLFolderView::openSelectedItems( void ) void LLFolderView::propertiesSelectedItems( void ) { + //TODO RN: get working again //if(getVisible() && getEnabled()) //{ // if (mSelectedItems.size() == 1) diff --git a/indra/newview/llfolderviewmodel.h b/indra/newview/llfolderviewmodel.h index c5079712f5..5304613219 100644 --- a/indra/newview/llfolderviewmodel.h +++ b/indra/newview/llfolderviewmodel.h @@ -122,7 +122,6 @@ public: virtual void requestSortAll() = 0; virtual void sort(class LLFolderViewFolder*) = 0; - virtual void filter(class LLFolderViewFolder*) = 0; virtual bool contentsReady() = 0; virtual void setFolderView(LLFolderView* folder_view) = 0; @@ -208,12 +207,6 @@ public: } } - //TODO RN: fix this - void filter(LLFolderViewFolder* folder) - { - - } - protected: SortType mSorter; FilterType mFilter; @@ -264,7 +257,7 @@ public: virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet? - virtual void filter( LLFolderViewFilter& filter) = 0; + virtual bool filter( LLFolderViewFilter& filter) = 0; virtual bool passedFilter(S32 filter_generation = -1) = 0; virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0; virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0; @@ -306,8 +299,8 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem public: LLFolderViewModelItemCommon() : mSortVersion(-1), - mPassedFilter(false), - mPassedFolderFilter(false), + mPassedFilter(true), + mPassedFolderFilter(true), mFolderViewItem(NULL), mLastFilterGeneration(-1), mMostFilteredDescendantGeneration(-1), diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index 08f1e541b5..6a33130322 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -159,7 +159,7 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const // (e.g. versus in-world object contents). const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id); if (!cat) - return false; + return folder_id.isNull(); LLFolderType::EType cat_type = cat->getPreferredType(); if (cat_type != LLFolderType::FT_NONE && (1LL << cat_type & mFilterOps.mFilterCategoryTypes) == U64(0)) return false; @@ -1091,7 +1091,6 @@ void LLInventoryFilter::setEmptyLookupMessage(const std::string& message) mEmptyLookupMessage = message; } -// TODO RN: turn this into a param and move to llfolderviewmodelinterface std::string LLInventoryFilter::getEmptyLookupMessage() const { LLStringUtil::format_map_t args; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 73e20fc684..e4cabcc988 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1388,10 +1388,12 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_fo mLastFilterGeneration = filter_generation; } -void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) +bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) { + bool passed_filter_before = item->passedFilter(); S32 filter_generation = filter.getCurrentGeneration(); S32 must_pass_generation = filter.getFirstRequiredGeneration(); + bool changed = false; // mMostFilteredDescendantGeneration might have been reset // in which case we need to update it even for folders that @@ -1407,22 +1409,37 @@ void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite } else { - //TODO RN: - item->filter( filter ); + changed |= item->filter( filter ); } } // track latest generation to pass any child items if (item->passedFilter()) { - mMostFilteredDescendantGeneration = filter_generation; - //TODO RN: ensure this still happens - //requestArrange(); + LLFolderViewModelItemInventory* view_model = this; + + while(view_model && view_model->mMostFilteredDescendantGeneration < filter_generation) + { + view_model->mMostFilteredDescendantGeneration = filter_generation; + view_model = static_cast(view_model->mParent); + } + } + + changed |= (item->passedFilter() != passed_filter_before); + if (changed) + { + //TODO RN: ensure this still happens, but without dependency on folderview + LLFolderViewFolder* parent = mFolderViewItem->getParentFolder(); + if (parent) parent->requestArrange(); } + + return changed; } -void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) +bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { + bool changed = false; + if(!mChildren.empty() && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement @@ -1432,7 +1449,7 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) iter != mChildren.end() && filter.getFilterCount() > 0; ++iter) { - filterChildItem((*iter), filter); + changed |= filterChildItem((*iter), filter); } } @@ -1460,6 +1477,7 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) //mStringMatchOffset = filter.getStringMatchOffset(this); filter.decrementFilterCount(); } + return changed; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 55edf386d5..3195d9a369 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -74,8 +74,8 @@ public: virtual bool passedFilter(S32 filter_generation = -1); virtual bool descendantsPassedFilter(S32 filter_generation = -1); virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation); - virtual void filter( LLFolderViewFilter& filter); - virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); + virtual bool filter( LLFolderViewFilter& filter); + virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); protected: LLFolderViewModelInventory* mRootViewModel; }; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index d0b9072ade..450e1f7ed0 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1566,7 +1566,7 @@ void LLPanelObjectInventory::reset() mFolders = LLUICtrlFactory::create(p); // this ensures that we never say "searching..." or "no items found" //TODO RN: make this happen by manipulating filter object directly - //mFolders->getFilter()->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); + static_cast(mFolders->getFolderViewModel()->getFilter())->setShowFolderState(LLInventoryFilter::SHOW_ALL_FOLDERS); mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar); if (hasFocus()) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 654b18614a..61a0331b72 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -637,7 +637,7 @@ void LLFloaterTexturePicker::draw() { folder_view->setPinningSelectedItem(mSelectedItemPinned); folder_view->getViewModelItem()->dirtyFilter(); - //TODO RN: test + //TODO RN: test..still works without this? //folder_view->arrangeFromRoot(); mSelectedItemPinned = TRUE; -- cgit v1.2.3