From 9608b6dcac894c5251d9419c66943d6473fa5d41 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 11 Jun 2020 17:41:59 +0300 Subject: SL-13433 Viewer should recognizes ipv6 links --- indra/llui/llurlentry.cpp | 39 +++++++++++++++++++++++++++++++++++++++ indra/llui/llurlentry.h | 13 +++++++++++++ indra/llui/llurlregistry.cpp | 1 + 3 files changed, 53 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 333d03f208..ac86101f69 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -1475,4 +1475,43 @@ void LLUrlEntryExperienceProfile::onExperienceDetails( const LLSD& experience_de callObservers(experience_details[LLExperienceCache::EXPERIENCE_ID].asString(), name, LLStringUtil::null); } +// +// LLUrlEntryEmail Describes an IPv6 address +// +LLUrlEntryIPv6::LLUrlEntryIPv6() + : LLUrlEntryBase() +{ + mHostPath = "https?://\\[([a-f0-9:]+:+)+[a-f0-9]+]"; + mPattern = boost::regex(mHostPath + "(:\\d{1,5})?(/\\S*)?", + boost::regex::perl | boost::regex::icase); + mMenuName = "menu_url_http.xml"; + mTooltip = LLTrans::getString("TooltipHttpUrl"); +} +std::string LLUrlEntryIPv6::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + boost::regex regex = boost::regex(mHostPath, boost::regex::perl | boost::regex::icase); + boost::match_results matches; + + if (boost::regex_search(url, matches, regex)) + { + return url.substr(0, matches[0].length()); + } + else + { + return url; + } +} + +std::string LLUrlEntryIPv6::getQuery(const std::string &url) const +{ + boost::regex regex = boost::regex(mHostPath, boost::regex::perl | boost::regex::icase); + boost::match_results matches; + + return boost::regex_replace(url, regex, ""); +} + +std::string LLUrlEntryIPv6::getUrl(const std::string &string) const +{ + return string; +} diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 78c149d9fd..0a0c247a6a 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -513,5 +513,18 @@ public: /*virtual*/ std::string getUrl(const std::string &string) const; }; +/// +/// LLUrlEntryEmail Describes an IPv6 address +/// +class LLUrlEntryIPv6 : public LLUrlEntryBase +{ +public: + LLUrlEntryIPv6(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getUrl(const std::string &string) const; + /*virtual*/ std::string getQuery(const std::string &url) const; + + std::string mHostPath; +}; #endif diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index ba6fa1e2e9..321a0ec5b9 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -79,6 +79,7 @@ LLUrlRegistry::LLUrlRegistry() mUrlEntrySLLabel = new LLUrlEntrySLLabel(); registerUrl(mUrlEntrySLLabel); registerUrl(new LLUrlEntryEmail()); + registerUrl(new LLUrlEntryIPv6()); } LLUrlRegistry::~LLUrlRegistry() -- cgit v1.2.3 From 905005be3c7e15429d8380c99d7590e677482286 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 11 Jun 2020 20:54:09 +0300 Subject: SL-13433 Add tests for new url entry --- indra/llui/tests/llurlentry_test.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp index 3c34fd269e..4a4fdb72e3 100644 --- a/indra/llui/tests/llurlentry_test.cpp +++ b/indra/llui/tests/llurlentry_test.cpp @@ -903,4 +903,38 @@ namespace tut "and even no www something lindenlab.com", ""); } + + template<> template<> + void object::test<16>() + { + // + // test LLUrlEntryIPv6 + // + LLUrlEntryIPv6 url; + + // Regex tests. + testRegex("match urls with a protocol", url, + "this url should match http://[::1]", + "http://[::1]"); + + testRegex("match urls with a protocol and query", url, + "this url should match http://[::1]/file.mp3", + "http://[::1]/file.mp3"); + + testRegex("match urls with a protocol", url, + "this url should match http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]", + "http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]"); + + testRegex("match urls with port", url, + "let's specify some port http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]:8080", + "http://[2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d]:8080"); + + testRegex("don't match urls w/o protocol", url, + "looks like an url something [2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d] but no https prefix", + ""); + + testRegex("don't match incorrect urls", url, + "http://[ 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d ]", + ""); + } } -- cgit v1.2.3 From 05ce7511aa6ffebe78676d714a621a1fe04c66e2 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 8 Jul 2020 20:29:44 +0300 Subject: SL-13479 Avatar menu tweaks --- indra/llui/llmenugl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 5568a84494..c2698fa648 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -79,7 +79,7 @@ const U32 LEFT_PAD_PIXELS = 3; const U32 LEFT_WIDTH_PIXELS = 15; const U32 LEFT_PLAIN_PIXELS = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS; -const U32 RIGHT_PAD_PIXELS = 2; +const U32 RIGHT_PAD_PIXELS = 7; const U32 RIGHT_WIDTH_PIXELS = 15; const U32 RIGHT_PLAIN_PIXELS = RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS; @@ -95,7 +95,7 @@ const std::string SEPARATOR_NAME("separator"); const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK -const std::string LLMenuGL::BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE +const std::string LLMenuGL::BRANCH_SUFFIX( "\xe2\x96\xb8" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE const std::string LLMenuGL::ARROW_UP ("^^^^^^^"); const std::string LLMenuGL::ARROW_DOWN("vvvvvvv"); -- cgit v1.2.3 From 54383cac8fa8a40d96590a300d4fce618f7413f3 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 10 Jul 2020 20:48:43 +0300 Subject: SL-5894 #3 WIP enumerate devices to flaoter, let floater set device temp --- indra/llui/llscrolllistctrl.cpp | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 763c3aeb81..8570dcf318 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1380,18 +1380,34 @@ BOOL LLScrollListCtrl::setSelectedByValue(const LLSD& value, BOOL selected) for (iter = mItemList.begin(); iter != mItemList.end(); iter++) { LLScrollListItem* item = *iter; - if (item->getEnabled() && (item->getValue().asString() == value.asString())) - { - if (selected) - { - selectItem(item); - } - else - { - deselectItem(item); - } - found = TRUE; - break; + if (item->getEnabled()) + { + if (value.isBinary()) + { + if (item->getValue().isBinary()) + { + LLSD::Binary data1 = value.asBinary(); + LLSD::Binary data2 = item->getValue().asBinary(); + found = std::equal(data1.begin(), data1.end(), data2.begin()) ? TRUE : FALSE; + } + } + else + { + found = item->getValue().asString() == value.asString() ? TRUE : FALSE; + } + + if (found) + { + if (selected) + { + selectItem(item); + } + else + { + deselectItem(item); + } + break; + } } } -- cgit v1.2.3 From 2b5396a8e8962ad03ef74c60fe0bf6515a4b8521 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 2 Oct 2020 13:24:00 +0300 Subject: SL-14050 Remove all Help question marks from Viewer UI --- indra/llui/llfloater.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index abb043f428..e9c980ad9a 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -303,12 +303,10 @@ void LLFloater::initFloater(const Params& p) mButtonsEnabled[BUTTON_CLOSE] = TRUE; } - // Help button: '?' - if ( !mHelpTopic.empty() ) - { - mButtonsEnabled[BUTTON_HELP] = TRUE; - } - + // Help button: '?' + //SL-14050 Disable all Help question marks + mButtonsEnabled[BUTTON_HELP] = FALSE; + // Minimize button only for top draggers if ( !mDragOnLeft && mCanMinimize ) { -- cgit v1.2.3 From fc17790a35402e25d7790dfed467e9c46b059554 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 6 Oct 2020 19:45:26 +0300 Subject: SL-14030 FIXED Clicking in Places > My Landmarks scrolls the Places window. --- indra/llui/llaccordionctrl.cpp | 3 ++- indra/llui/llaccordionctrl.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 61a119800e..809d72208f 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -55,6 +55,7 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params) , mTabComparator( NULL ) , mNoVisibleTabsHelpText(NULL) , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString()) + , mSkipScrollToChild(false) { initNoTabsWidget(params.no_matched_tabs_text); @@ -659,7 +660,7 @@ void LLAccordionCtrl::onScrollPosChangeCallback(S32, LLScrollbar*) // virtual void LLAccordionCtrl::onUpdateScrollToChild(const LLUICtrl *cntrl) { - if (mScrollbar && mScrollbar->getVisible()) + if (mScrollbar && mScrollbar->getVisible() && !mSkipScrollToChild) { // same as scrollToShowRect LLRect rect; diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index b38a76d27f..2828254472 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -138,6 +138,8 @@ public: bool getFitParent() const {return mFitParent;} + void setSkipScrollToChild(bool skip) { mSkipScrollToChild = skip; } + private: void initNoTabsWidget(const LLTextBox::Params& tb_params); void updateNoTabsHelpTextVisibility(); @@ -183,6 +185,8 @@ private: F32 mAutoScrollRate; LLTextBox* mNoVisibleTabsHelpText; + bool mSkipScrollToChild; + std::string mNoMatchedTabsOrigString; std::string mNoVisibleTabsOrigString; -- cgit v1.2.3 From 281c3d8beec393de9afced57c6756d0d367a1c77 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 5 Nov 2020 21:40:54 +0200 Subject: SL-14270 Crash accessing deleted 'parent' via callback from child --- indra/llui/llfolderviewmodel.cpp | 5 +++++ indra/llui/llfolderviewmodel.h | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3b45fb53a2..58a1ef646a 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -29,6 +29,11 @@ #include "llfolderviewmodel.h" #include "lltrans.h" +LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() +{ + clearChildren(); +} + bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index f71a88c56e..903049b9af 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -248,6 +248,8 @@ public: mChildren.clear(); } + virtual ~LLFolderViewModelItemCommon(); + void requestSort() { mSortVersion = -1; } S32 getSortVersion() { return mSortVersion; } void setSortVersion(S32 version) { mSortVersion = version;} @@ -399,6 +401,8 @@ public: mFolderView(NULL) {} + virtual ~LLFolderViewModelCommon() {} + virtual void requestSortAll() { // sort everything -- cgit v1.2.3 From d17af5f3a6303c816f357b1e94a28cae36828b69 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 5 Nov 2020 21:58:12 +0200 Subject: SL-14270 A bit of cleanup #1 --- indra/llui/llfolderviewmodel.cpp | 135 +++++++++++++++++++++++++++++++++++++++ indra/llui/llfolderviewmodel.h | 130 ++++--------------------------------- 2 files changed, 147 insertions(+), 118 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 58a1ef646a..727ed7a405 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -29,11 +29,146 @@ #include "llfolderviewmodel.h" #include "lltrans.h" +// LLFolderViewModelItemCommon + +LLFolderViewModelItemCommon::LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) + : mSortVersion(-1), + mPassedFilter(true), + mPassedFolderFilter(true), + mStringMatchOffsetFilter(std::string::npos), + mStringFilterSize(0), + mFolderViewItem(NULL), + mLastFilterGeneration(-1), + mLastFolderFilterGeneration(-1), + mMarkedDirtyGeneration(-1), + mMostFilteredDescendantGeneration(-1), + mParent(NULL), + mRootViewModel(root_view_model) +{ + mChildren.clear(); //??? +} + LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() { clearChildren(); } +void LLFolderViewModelItemCommon::dirtyFilter() +{ + if (mMarkedDirtyGeneration < 0) + { + mMarkedDirtyGeneration = mLastFilterGeneration; + } + mLastFilterGeneration = -1; + mLastFolderFilterGeneration = -1; + + // bubble up dirty flag all the way to root + if (mParent) + { + mParent->dirtyFilter(); + } +} + +void LLFolderViewModelItemCommon::dirtyDescendantsFilter() +{ + mMostFilteredDescendantGeneration = -1; + if (mParent) + { + mParent->dirtyDescendantsFilter(); + } +} + +//virtual +void LLFolderViewModelItemCommon::addChild(LLFolderViewModelItem* child) +{ + // Avoid duplicates: bail out if that child is already present in the list + // Note: this happens when models are created before views + child_list_t::const_iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + if (child == *iter) + { + return; + } + } + mChildren.push_back(child); + child->setParent(this); + dirtyFilter(); + requestSort(); +} + +//virtual +void LLFolderViewModelItemCommon::removeChild(LLFolderViewModelItem* child) +{ + mChildren.remove(child); + child->setParent(NULL); + dirtyDescendantsFilter(); + dirtyFilter(); +} + +//virtual +void LLFolderViewModelItemCommon::clearChildren() +{ + // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects + // This is different and not equivalent to calling removeChild() on each child + std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); + mChildren.clear(); + dirtyDescendantsFilter(); + dirtyFilter(); +} + +void LLFolderViewModelItemCommon::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset /*= std::string::npos*/, std::string::size_type string_size /*= 0*/) +{ + mPassedFilter = passed; + mLastFilterGeneration = filter_generation; + mStringMatchOffsetFilter = string_offset; + mStringFilterSize = string_size; + mMarkedDirtyGeneration = -1; +} + +void LLFolderViewModelItemCommon::setPassedFolderFilter(bool passed, S32 filter_generation) +{ + mPassedFolderFilter = passed; + mLastFolderFilterGeneration = filter_generation; +} + +//virtual +bool LLFolderViewModelItemCommon::potentiallyVisible() +{ + return passedFilter() // we've passed the filter + || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet + || descendantsPassedFilter(); +} + +//virtual +bool LLFolderViewModelItemCommon::passedFilter(S32 filter_generation /*= -1*/) +{ + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); + bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); + return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); +} + +//virtual +bool LLFolderViewModelItemCommon::descendantsPassedFilter(S32 filter_generation /*= -1*/) +{ + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + return mMostFilteredDescendantGeneration >= filter_generation; +} + +// LLFolderViewModelCommon + +LLFolderViewModelCommon::LLFolderViewModelCommon() + : mTargetSortVersion(0), + mFolderView(NULL) +{} + bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 903049b9af..d8e5bccc9b 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -231,23 +231,7 @@ protected: class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: - LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) - : mSortVersion(-1), - mPassedFilter(true), - mPassedFolderFilter(true), - mStringMatchOffsetFilter(std::string::npos), - mStringFilterSize(0), - mFolderViewItem(NULL), - mLastFilterGeneration(-1), - mLastFolderFilterGeneration(-1), - mMarkedDirtyGeneration(-1), - mMostFilteredDescendantGeneration(-1), - mParent(NULL), - mRootViewModel(root_view_model) - { - mChildren.clear(); - } - + LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model); virtual ~LLFolderViewModelItemCommon(); void requestSort() { mSortVersion = -1; } @@ -257,115 +241,28 @@ public: S32 getLastFilterGeneration() const { return mLastFilterGeneration; } S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; } S32 getMarkedDirtyGeneration() const { return mMarkedDirtyGeneration; } - void dirtyFilter() - { - if(mMarkedDirtyGeneration < 0) - { - mMarkedDirtyGeneration = mLastFilterGeneration; - } - mLastFilterGeneration = -1; - mLastFolderFilterGeneration = -1; - - // bubble up dirty flag all the way to root - if (mParent) - { - mParent->dirtyFilter(); - } - } - void dirtyDescendantsFilter() - { - mMostFilteredDescendantGeneration = -1; - if (mParent) - { - mParent->dirtyDescendantsFilter(); - } - } + void dirtyFilter(); + void dirtyDescendantsFilter(); bool hasFilterStringMatch(); std::string::size_type getFilterStringOffset(); std::string::size_type getFilterStringSize(); typedef std::list child_list_t; - virtual void addChild(LLFolderViewModelItem* child) - { - // Avoid duplicates: bail out if that child is already present in the list - // Note: this happens when models are created before views - child_list_t::const_iterator iter; - for (iter = mChildren.begin(); iter != mChildren.end(); iter++) - { - if (child == *iter) - { - return; - } - } - mChildren.push_back(child); - child->setParent(this); - dirtyFilter(); - requestSort(); - } - virtual void removeChild(LLFolderViewModelItem* child) - { - mChildren.remove(child); - child->setParent(NULL); - dirtyDescendantsFilter(); - dirtyFilter(); - } + virtual void addChild(LLFolderViewModelItem* child); + virtual void removeChild(LLFolderViewModelItem* child); - virtual void clearChildren() - { - // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects - // This is different and not equivalent to calling removeChild() on each child - std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); - mChildren.clear(); - dirtyDescendantsFilter(); - dirtyFilter(); - } + virtual void clearChildren(); child_list_t::const_iterator getChildrenBegin() const { return mChildren.begin(); } child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); } child_list_t::size_type getChildrenCount() const { return mChildren.size(); } - void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) - { - mPassedFilter = passed; - mLastFilterGeneration = filter_generation; - mStringMatchOffsetFilter = string_offset; - mStringFilterSize = string_size; - mMarkedDirtyGeneration = -1; - } - - void setPassedFolderFilter(bool passed, S32 filter_generation) - { - mPassedFolderFilter = passed; - mLastFolderFilterGeneration = filter_generation; - } - - virtual bool potentiallyVisible() - { - return passedFilter() // we've passed the filter - || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet - || descendantsPassedFilter(); - } - - virtual bool passedFilter(S32 filter_generation = -1) - { - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); - bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); - return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); - } - - virtual bool descendantsPassedFilter(S32 filter_generation = -1) - { - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - return mMostFilteredDescendantGeneration >= filter_generation; - } + void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); + void setPassedFolderFilter(bool passed, S32 filter_generation); + virtual bool potentiallyVisible(); + virtual bool passedFilter(S32 filter_generation = -1); + virtual bool descendantsPassedFilter(S32 filter_generation = -1); protected: @@ -396,10 +293,7 @@ protected: class LLFolderViewModelCommon : public LLFolderViewModelInterface { public: - LLFolderViewModelCommon() - : mTargetSortVersion(0), - mFolderView(NULL) - {} + LLFolderViewModelCommon(); virtual ~LLFolderViewModelCommon() {} -- cgit v1.2.3 From dc136e8dc886cf4798804757d3002f5711995b97 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 5 Nov 2020 22:54:28 +0200 Subject: SL-14270 A bit of cleanup #2 --- indra/llui/llfolderviewmodel.cpp | 7 +++++ indra/llui/llfolderviewmodel.h | 65 +++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 35 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 727ed7a405..adadf979b7 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -169,6 +169,13 @@ LLFolderViewModelCommon::LLFolderViewModelCommon() mFolderView(NULL) {} +//virtual +void LLFolderViewModelCommon::requestSortAll() +{ + // sort everything + mTargetSortVersion++; +} + bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index d8e5bccc9b..ba8733c86d 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -38,7 +38,6 @@ enum EInventorySortGroup SG_ITEM }; -class LLFontGL; class LLInventoryModel; class LLMenuGL; class LLUIImage; @@ -232,25 +231,25 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model); - virtual ~LLFolderViewModelItemCommon(); + virtual ~LLFolderViewModelItemCommon() override; - void requestSort() { mSortVersion = -1; } - S32 getSortVersion() { return mSortVersion; } - void setSortVersion(S32 version) { mSortVersion = version;} + void requestSort() override { mSortVersion = -1; } + S32 getSortVersion() override { return mSortVersion; } + void setSortVersion(S32 version) override { mSortVersion = version;} - S32 getLastFilterGeneration() const { return mLastFilterGeneration; } + S32 getLastFilterGeneration() const override { return mLastFilterGeneration; } S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; } - S32 getMarkedDirtyGeneration() const { return mMarkedDirtyGeneration; } - void dirtyFilter(); - void dirtyDescendantsFilter(); - bool hasFilterStringMatch(); - std::string::size_type getFilterStringOffset(); - std::string::size_type getFilterStringSize(); + S32 getMarkedDirtyGeneration() const override { return mMarkedDirtyGeneration; } + void dirtyFilter() override; + void dirtyDescendantsFilter() override; + bool hasFilterStringMatch() override; + std::string::size_type getFilterStringOffset() override; + std::string::size_type getFilterStringSize() override; typedef std::list child_list_t; - virtual void addChild(LLFolderViewModelItem* child); - virtual void removeChild(LLFolderViewModelItem* child); + virtual void addChild(LLFolderViewModelItem* child) override; + virtual void removeChild(LLFolderViewModelItem* child) override; virtual void clearChildren(); @@ -258,16 +257,16 @@ public: child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); } child_list_t::size_type getChildrenCount() const { return mChildren.size(); } - void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); - void setPassedFolderFilter(bool passed, S32 filter_generation); - virtual bool potentiallyVisible(); - virtual bool passedFilter(S32 filter_generation = -1); - virtual bool descendantsPassedFilter(S32 filter_generation = -1); + void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) override; + void setPassedFolderFilter(bool passed, S32 filter_generation) override; + virtual bool potentiallyVisible() override; + virtual bool passedFilter(S32 filter_generation = -1) override; + virtual bool descendantsPassedFilter(S32 filter_generation = -1) override; protected: - virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } - virtual bool hasParent() { return mParent != NULL; } + virtual void setParent(LLFolderViewModelItem* parent) override { mParent = parent; } + virtual bool hasParent() override { return mParent != NULL; } S32 mSortVersion; bool mPassedFilter; @@ -284,7 +283,7 @@ protected: LLFolderViewModelItem* mParent; LLFolderViewModelInterface& mRootViewModel; - void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} + void setFolderViewItem(LLFolderViewItem* folder_view_item) override { mFolderViewItem = folder_view_item;} LLFolderViewItem* mFolderViewItem; }; @@ -295,17 +294,13 @@ class LLFolderViewModelCommon : public LLFolderViewModelInterface public: LLFolderViewModelCommon(); - virtual ~LLFolderViewModelCommon() {} + virtual ~LLFolderViewModelCommon() override {} - virtual void requestSortAll() - { - // sort everything - mTargetSortVersion++; - } - virtual std::string getStatusText(); - virtual void filter(); + virtual void requestSortAll() override; + virtual std::string getStatusText() override; + virtual void filter() override; - void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} + void setFolderView(LLFolderView* folder_view) override { mFolderView = folder_view;} protected: bool needsSort(class LLFolderViewModelItem* item); @@ -329,7 +324,7 @@ public: mFilter(filter) {} - virtual ~LLFolderViewModel() + virtual ~LLFolderViewModel() override { delete mSorter; mSorter = NULL; @@ -347,8 +342,8 @@ 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; } + virtual bool contentsReady() override { return true; } + virtual bool isFolderComplete(LLFolderViewFolder* folder) override { return true; } struct ViewModelCompare { @@ -369,7 +364,7 @@ public: const SortType& mSorter; }; - void sort(LLFolderViewFolder* folder) + void sort(LLFolderViewFolder* folder) override { if (needsSort(folder->getViewModelItem())) { -- cgit v1.2.3 From 561da5bd7f32e5d09849ac97c69b1acf07cd9a0f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 6 Nov 2020 23:17:30 +0200 Subject: SL-14270 Crash fix --- indra/llui/llfolderviewmodel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index adadf979b7..eae0d2f3e4 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -50,7 +50,14 @@ LLFolderViewModelItemCommon::LLFolderViewModelItemCommon(LLFolderViewModelInterf LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() { - clearChildren(); + // Children don't belong to model, but to LLFolderViewItem, just mark them as having no parent + std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); + + // Don't leave dead pointer in parent + if (mParent) + { + mParent->removeChild(this); + } } void LLFolderViewModelItemCommon::dirtyFilter() -- cgit v1.2.3 From e1ae2e7cbd8335abf5463fe28aa942d46523638e Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Thu, 12 Nov 2020 00:06:39 +0200 Subject: Mac buildfix --- indra/llui/llfolderviewmodel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index ba8733c86d..6e739a57a6 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -336,8 +336,8 @@ public: virtual const SortType& getSorter() const { return *mSorter; } virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); } - virtual FilterType& getFilter() { return *mFilter; } - virtual const FilterType& getFilter() const { return *mFilter; } + virtual FilterType& getFilter() override { return *mFilter; } + virtual const FilterType& getFilter() const override { return *mFilter; } virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); } // By default, we assume the content is available. If a network fetch mechanism is implemented for the model, -- cgit v1.2.3 From f534e37328e7408b1609c9b78d13c6c749091e53 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 21 Nov 2020 00:06:32 +0200 Subject: SL-14368 Expanding the 'People' floater to the right does not expand the displayed values --- indra/llui/llscrolllistctrl.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index dc525517bf..a6e4f3a2af 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -763,14 +763,20 @@ void LLScrollListCtrl::updateColumns(bool force_update) } } + bool header_changed_width = false; // expand last column header we encountered to full list width if (last_header) { + S32 old_width = last_header->getColumn()->getWidth(); S32 new_width = llmax(0, mItemListRect.mRight - last_header->getRect().mLeft); last_header->reshape(new_width, last_header->getRect().getHeight()); last_header->setVisible(mDisplayColumnHeaders && new_width > 0); - last_header->getColumn()->setWidth(new_width); - } + if (old_width != new_width) + { + last_header->getColumn()->setWidth(new_width); + header_changed_width = true; + } + } // propagate column widths to individual cells if (columns_changed_width || force_update) @@ -789,6 +795,20 @@ void LLScrollListCtrl::updateColumns(bool force_update) } } } + else if (header_changed_width) + { + item_list::iterator iter; + S32 index = last_header->getColumn()->mIndex; // Not always identical to last column! + for (iter = mItemList.begin(); iter != mItemList.end(); iter++) + { + LLScrollListItem *itemp = *iter; + LLScrollListCell* cell = itemp->getColumn(index); + if (cell) + { + cell->setWidth(last_header->getColumn()->getWidth()); + } + } + } } void LLScrollListCtrl::setHeadingHeight(S32 heading_height) -- cgit v1.2.3 From 7b7667973b3ecaa857f1013c8084f3159105eec1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 23 Nov 2020 14:29:07 +0200 Subject: DRTVWR-513 Resolved merge conflict from merge with DRTVWR-507 See changes from SL-13119 and SL-13190 --- indra/llui/llfolderviewmodel.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index e95cc12520..a028a32704 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -88,16 +88,6 @@ void LLFolderViewModelItemCommon::dirtyDescendantsFilter() //virtual void LLFolderViewModelItemCommon::addChild(LLFolderViewModelItem* child) { - // Avoid duplicates: bail out if that child is already present in the list - // Note: this happens when models are created before views - child_list_t::const_iterator iter; - for (iter = mChildren.begin(); iter != mChildren.end(); iter++) - { - if (child == *iter) - { - return; - } - } mChildren.push_back(child); child->setParent(this); dirtyFilter(); -- cgit v1.2.3 From 7f236cd2ae79423af4fa192f4cb113b023f00984 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Tue, 24 Nov 2020 04:20:06 +0200 Subject: Revert "SL-13479 Avatar menu tweaks" This reverts commit 05ce7511aa6ffebe78676d714a621a1fe04c66e2. --- indra/llui/llmenugl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index c2698fa648..5568a84494 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -79,7 +79,7 @@ const U32 LEFT_PAD_PIXELS = 3; const U32 LEFT_WIDTH_PIXELS = 15; const U32 LEFT_PLAIN_PIXELS = LEFT_PAD_PIXELS + LEFT_WIDTH_PIXELS; -const U32 RIGHT_PAD_PIXELS = 7; +const U32 RIGHT_PAD_PIXELS = 2; const U32 RIGHT_WIDTH_PIXELS = 15; const U32 RIGHT_PLAIN_PIXELS = RIGHT_PAD_PIXELS + RIGHT_WIDTH_PIXELS; @@ -95,7 +95,7 @@ const std::string SEPARATOR_NAME("separator"); const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK -const std::string LLMenuGL::BRANCH_SUFFIX( "\xe2\x96\xb8" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE +const std::string LLMenuGL::BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE const std::string LLMenuGL::ARROW_UP ("^^^^^^^"); const std::string LLMenuGL::ARROW_DOWN("vvvvvvv"); -- cgit v1.2.3 From 18b664cd76bd849f0cf55865e4b57837c6d62ead Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 3 Dec 2020 01:26:26 +0200 Subject: SL-14270 A bit of cleanup #3 Just in case and for clarity --- indra/llui/llfolderviewmodel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index a028a32704..a2ac9ffaa0 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -52,11 +52,13 @@ LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() { // Children don't belong to model, but to LLFolderViewItem, just mark them as having no parent std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); + mChildren.clear(); // Don't leave dead pointer in parent if (mParent) { mParent->removeChild(this); + mParent = NULL; } } -- cgit v1.2.3 From 7ab3de94cd10cb6aa9d1f4a6607366edae101464 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 7 Dec 2020 19:29:39 +0200 Subject: Revert "SL-14270 Crash accessing deleted 'parent' via callback from child" There are random inventory's buildViewsTree crashes in branch with SL-14270 commit and there doesn't seem to be anything else inventory related that could have caused those. Reverting commits to see if it fixes crashes. --- indra/llui/llfolderviewmodel.cpp | 146 --------------------------------- indra/llui/llfolderviewmodel.h | 169 ++++++++++++++++++++++++++++++--------- 2 files changed, 133 insertions(+), 182 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index a2ac9ffaa0..ea106b5fae 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -29,152 +29,6 @@ #include "llfolderviewmodel.h" #include "lltrans.h" -// LLFolderViewModelItemCommon - -LLFolderViewModelItemCommon::LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) - : mSortVersion(-1), - mPassedFilter(true), - mPassedFolderFilter(true), - mStringMatchOffsetFilter(std::string::npos), - mStringFilterSize(0), - mFolderViewItem(NULL), - mLastFilterGeneration(-1), - mLastFolderFilterGeneration(-1), - mMarkedDirtyGeneration(-1), - mMostFilteredDescendantGeneration(-1), - mParent(NULL), - mRootViewModel(root_view_model) -{ - mChildren.clear(); //??? -} - -LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() -{ - // Children don't belong to model, but to LLFolderViewItem, just mark them as having no parent - std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); - mChildren.clear(); - - // Don't leave dead pointer in parent - if (mParent) - { - mParent->removeChild(this); - mParent = NULL; - } -} - -void LLFolderViewModelItemCommon::dirtyFilter() -{ - if (mMarkedDirtyGeneration < 0) - { - mMarkedDirtyGeneration = mLastFilterGeneration; - } - mLastFilterGeneration = -1; - mLastFolderFilterGeneration = -1; - - // bubble up dirty flag all the way to root - if (mParent) - { - mParent->dirtyFilter(); - } -} - -void LLFolderViewModelItemCommon::dirtyDescendantsFilter() -{ - mMostFilteredDescendantGeneration = -1; - if (mParent) - { - mParent->dirtyDescendantsFilter(); - } -} - -//virtual -void LLFolderViewModelItemCommon::addChild(LLFolderViewModelItem* child) -{ - mChildren.push_back(child); - child->setParent(this); - dirtyFilter(); - requestSort(); -} - -//virtual -void LLFolderViewModelItemCommon::removeChild(LLFolderViewModelItem* child) -{ - mChildren.remove(child); - child->setParent(NULL); - dirtyDescendantsFilter(); - dirtyFilter(); -} - -//virtual -void LLFolderViewModelItemCommon::clearChildren() -{ - // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects - // This is different and not equivalent to calling removeChild() on each child - std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); - mChildren.clear(); - dirtyDescendantsFilter(); - dirtyFilter(); -} - -void LLFolderViewModelItemCommon::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset /*= std::string::npos*/, std::string::size_type string_size /*= 0*/) -{ - mPassedFilter = passed; - mLastFilterGeneration = filter_generation; - mStringMatchOffsetFilter = string_offset; - mStringFilterSize = string_size; - mMarkedDirtyGeneration = -1; -} - -void LLFolderViewModelItemCommon::setPassedFolderFilter(bool passed, S32 filter_generation) -{ - mPassedFolderFilter = passed; - mLastFolderFilterGeneration = filter_generation; -} - -//virtual -bool LLFolderViewModelItemCommon::potentiallyVisible() -{ - return passedFilter() // we've passed the filter - || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet - || descendantsPassedFilter(); -} - -//virtual -bool LLFolderViewModelItemCommon::passedFilter(S32 filter_generation /*= -1*/) -{ - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); - bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); - return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); -} - -//virtual -bool LLFolderViewModelItemCommon::descendantsPassedFilter(S32 filter_generation /*= -1*/) -{ - if (filter_generation < 0) - { - filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - } - return mMostFilteredDescendantGeneration >= filter_generation; -} - -// LLFolderViewModelCommon - -LLFolderViewModelCommon::LLFolderViewModelCommon() - : mTargetSortVersion(0), - mFolderView(NULL) -{} - -//virtual -void LLFolderViewModelCommon::requestSortAll() -{ - // sort everything - mTargetSortVersion++; -} - bool LLFolderViewModelCommon::needsSort(LLFolderViewModelItem* item) { return item->getSortVersion() < mTargetSortVersion; diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 6e739a57a6..f4ddfa8f18 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -38,6 +38,7 @@ enum EInventorySortGroup SG_ITEM }; +class LLFontGL; class LLInventoryModel; class LLMenuGL; class LLUIImage; @@ -230,43 +231,134 @@ protected: class LLFolderViewModelItemCommon : public LLFolderViewModelItem { public: - LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model); - virtual ~LLFolderViewModelItemCommon() override; + LLFolderViewModelItemCommon(LLFolderViewModelInterface& root_view_model) + : mSortVersion(-1), + mPassedFilter(true), + mPassedFolderFilter(true), + mStringMatchOffsetFilter(std::string::npos), + mStringFilterSize(0), + mFolderViewItem(NULL), + mLastFilterGeneration(-1), + mLastFolderFilterGeneration(-1), + mMarkedDirtyGeneration(-1), + mMostFilteredDescendantGeneration(-1), + mParent(NULL), + mRootViewModel(root_view_model) + { + mChildren.clear(); + } - void requestSort() override { mSortVersion = -1; } - S32 getSortVersion() override { return mSortVersion; } - void setSortVersion(S32 version) override { mSortVersion = version;} + void requestSort() { mSortVersion = -1; } + S32 getSortVersion() { return mSortVersion; } + void setSortVersion(S32 version) { mSortVersion = version;} - S32 getLastFilterGeneration() const override { return mLastFilterGeneration; } + S32 getLastFilterGeneration() const { return mLastFilterGeneration; } S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; } - S32 getMarkedDirtyGeneration() const override { return mMarkedDirtyGeneration; } - void dirtyFilter() override; - void dirtyDescendantsFilter() override; - bool hasFilterStringMatch() override; - std::string::size_type getFilterStringOffset() override; - std::string::size_type getFilterStringSize() override; + S32 getMarkedDirtyGeneration() const { return mMarkedDirtyGeneration; } + void dirtyFilter() + { + if(mMarkedDirtyGeneration < 0) + { + mMarkedDirtyGeneration = mLastFilterGeneration; + } + mLastFilterGeneration = -1; + mLastFolderFilterGeneration = -1; + + // bubble up dirty flag all the way to root + if (mParent) + { + mParent->dirtyFilter(); + } + } + void dirtyDescendantsFilter() + { + mMostFilteredDescendantGeneration = -1; + if (mParent) + { + mParent->dirtyDescendantsFilter(); + } + } + bool hasFilterStringMatch(); + std::string::size_type getFilterStringOffset(); + std::string::size_type getFilterStringSize(); typedef std::list child_list_t; - virtual void addChild(LLFolderViewModelItem* child) override; - virtual void removeChild(LLFolderViewModelItem* child) override; + virtual void addChild(LLFolderViewModelItem* child) + { + mChildren.push_back(child); + child->setParent(this); + dirtyFilter(); + requestSort(); + } + virtual void removeChild(LLFolderViewModelItem* child) + { + mChildren.remove(child); + child->setParent(NULL); + dirtyDescendantsFilter(); + dirtyFilter(); + } - virtual void clearChildren(); + virtual void clearChildren() + { + // As this is cleaning the whole list of children wholesale, we do need to delete the pointed objects + // This is different and not equivalent to calling removeChild() on each child + std::for_each(mChildren.begin(), mChildren.end(), DeletePointer()); + mChildren.clear(); + dirtyDescendantsFilter(); + dirtyFilter(); + } child_list_t::const_iterator getChildrenBegin() const { return mChildren.begin(); } child_list_t::const_iterator getChildrenEnd() const { return mChildren.end(); } child_list_t::size_type getChildrenCount() const { return mChildren.size(); } - void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) override; - void setPassedFolderFilter(bool passed, S32 filter_generation) override; - virtual bool potentiallyVisible() override; - virtual bool passedFilter(S32 filter_generation = -1) override; - virtual bool descendantsPassedFilter(S32 filter_generation = -1) override; + void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) + { + mPassedFilter = passed; + mLastFilterGeneration = filter_generation; + mStringMatchOffsetFilter = string_offset; + mStringFilterSize = string_size; + mMarkedDirtyGeneration = -1; + } + + void setPassedFolderFilter(bool passed, S32 filter_generation) + { + mPassedFolderFilter = passed; + mLastFolderFilterGeneration = filter_generation; + } + + virtual bool potentiallyVisible() + { + return passedFilter() // we've passed the filter + || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet + || descendantsPassedFilter(); + } + + virtual bool passedFilter(S32 filter_generation = -1) + { + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); + bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); + return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); + } + + virtual bool descendantsPassedFilter(S32 filter_generation = -1) + { + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + return mMostFilteredDescendantGeneration >= filter_generation; + } protected: - virtual void setParent(LLFolderViewModelItem* parent) override { mParent = parent; } - virtual bool hasParent() override { return mParent != NULL; } + virtual void setParent(LLFolderViewModelItem* parent) { mParent = parent; } + virtual bool hasParent() { return mParent != NULL; } S32 mSortVersion; bool mPassedFilter; @@ -283,7 +375,7 @@ protected: LLFolderViewModelItem* mParent; LLFolderViewModelInterface& mRootViewModel; - void setFolderViewItem(LLFolderViewItem* folder_view_item) override { mFolderViewItem = folder_view_item;} + void setFolderViewItem(LLFolderViewItem* folder_view_item) { mFolderViewItem = folder_view_item;} LLFolderViewItem* mFolderViewItem; }; @@ -292,15 +384,20 @@ protected: class LLFolderViewModelCommon : public LLFolderViewModelInterface { public: - LLFolderViewModelCommon(); - - virtual ~LLFolderViewModelCommon() override {} + LLFolderViewModelCommon() + : mTargetSortVersion(0), + mFolderView(NULL) + {} - virtual void requestSortAll() override; - virtual std::string getStatusText() override; - virtual void filter() override; + virtual void requestSortAll() + { + // sort everything + mTargetSortVersion++; + } + virtual std::string getStatusText(); + virtual void filter(); - void setFolderView(LLFolderView* folder_view) override { mFolderView = folder_view;} + void setFolderView(LLFolderView* folder_view) { mFolderView = folder_view;} protected: bool needsSort(class LLFolderViewModelItem* item); @@ -324,7 +421,7 @@ public: mFilter(filter) {} - virtual ~LLFolderViewModel() override + virtual ~LLFolderViewModel() { delete mSorter; mSorter = NULL; @@ -336,14 +433,14 @@ public: virtual const SortType& getSorter() const { return *mSorter; } virtual void setSorter(const SortType& sorter) { mSorter = new SortType(sorter); requestSortAll(); } - virtual FilterType& getFilter() override { return *mFilter; } - virtual const FilterType& getFilter() const override { return *mFilter; } + virtual FilterType& getFilter() { return *mFilter; } + virtual const FilterType& getFilter() const { return *mFilter; } virtual void setFilter(const FilterType& filter) { mFilter = new FilterType(filter); } // 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() override { return true; } - virtual bool isFolderComplete(LLFolderViewFolder* folder) override { return true; } + virtual bool contentsReady() { return true; } + virtual bool isFolderComplete(LLFolderViewFolder* folder) { return true; } struct ViewModelCompare { @@ -364,7 +461,7 @@ public: const SortType& mSorter; }; - void sort(LLFolderViewFolder* folder) override + void sort(LLFolderViewFolder* folder) { if (needsSort(folder->getViewModelItem())) { -- cgit v1.2.3