Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
XDG Integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
JennaHuntsman
XDG Integration
Commits
d17af5f3
"README.md" did not exist on "b9fa0e9bbe0db5ecdfb5fbdd88474e0d3bb8eed2"
Commit
d17af5f3
authored
4 years ago
by
Andrey Kleshchev
Browse files
Options
Downloads
Patches
Plain Diff
SL-14270 A bit of cleanup #1
parent
281c3d8b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llui/llfolderviewmodel.cpp
+135
-0
135 additions, 0 deletions
indra/llui/llfolderviewmodel.cpp
indra/llui/llfolderviewmodel.h
+12
-118
12 additions, 118 deletions
indra/llui/llfolderviewmodel.h
with
147 additions
and
118 deletions
indra/llui/llfolderviewmodel.cpp
+
135
−
0
View file @
d17af5f3
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
indra/llui/llfolderviewmodel.h
+
12
−
118
View file @
d17af5f3
...
...
@@ -231,23 +231,7 @@ class LLFolderViewModelItem : public LLRefCount, public LLTrace::MemTrackable<LL
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 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem
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
<
LLFolderViewModelItem
*>
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 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem
class
LLFolderViewModelCommon
:
public
LLFolderViewModelInterface
{
public:
LLFolderViewModelCommon
()
:
mTargetSortVersion
(
0
),
mFolderView
(
NULL
)
{}
LLFolderViewModelCommon
();
virtual
~
LLFolderViewModelCommon
()
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment