Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
568e5555
Commit
568e5555
authored
Jun 24, 2010
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: constify currentIndex() and find* helpers, remove CACHE in findInner
parent
eb2da50b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
38 deletions
+13
-38
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+9
-34
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+4
-4
No files found.
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
568e5555
...
...
@@ -517,71 +517,46 @@ QStringList PLModel::selectedURIs()
/************************* Lookups *****************************/
PLItem
*
PLModel
::
findById
(
PLItem
*
root
,
int
i_id
)
PLItem
*
PLModel
::
findById
(
PLItem
*
root
,
int
i_id
)
const
{
return
findInner
(
root
,
i_id
,
false
);
}
PLItem
*
PLModel
::
findByInput
(
PLItem
*
root
,
int
i_id
)
PLItem
*
PLModel
::
findByInput
(
PLItem
*
root
,
int
i_id
)
const
{
PLItem
*
result
=
findInner
(
root
,
i_id
,
true
);
return
result
;
}
#define CACHE( i, p ) { i_cached_id = i; p_cached_item = p; }
#define ICACHE( i, p ) { i_cached_input_id = i; p_cached_item_bi = p; }
PLItem
*
PLModel
::
findInner
(
PLItem
*
root
,
int
i_id
,
bool
b_input
)
PLItem
*
PLModel
::
findInner
(
PLItem
*
root
,
int
i_id
,
bool
b_input
)
const
{
if
(
!
root
)
return
NULL
;
if
(
(
!
b_input
&&
i_cached_id
==
i_id
)
||
(
b_input
&&
i_cached_input_id
==
i_id
)
)
{
return
b_input
?
p_cached_item_bi
:
p_cached_item
;
}
if
(
!
b_input
&&
root
->
i_id
==
i_id
)
{
CACHE
(
i_id
,
root
);
return
root
;
}
else
if
(
b_input
&&
root
->
p_input
->
i_id
==
i_id
)
{
ICACHE
(
i_id
,
root
);
return
root
;
}
QList
<
PLItem
*>::
iterator
it
=
root
->
children
.
begin
();
while
(
it
!=
root
->
children
.
end
()
)
{
if
(
!
b_input
&&
(
*
it
)
->
i_id
==
i_id
)
{
CACHE
(
i_id
,
(
*
it
)
);
return
p_cached_item
;
}
return
(
*
it
);
else
if
(
b_input
&&
(
*
it
)
->
p_input
->
i_id
==
i_id
)
{
ICACHE
(
i_id
,
(
*
it
)
);
return
p_cached_item_bi
;
}
return
(
*
it
);
if
(
(
*
it
)
->
children
.
size
()
)
{
PLItem
*
childFound
=
findInner
(
(
*
it
),
i_id
,
b_input
);
if
(
childFound
)
{
if
(
b_input
)
ICACHE
(
i_id
,
childFound
)
else
CACHE
(
i_id
,
childFound
)
return
childFound
;
}
}
it
++
;
}
return
NULL
;
}
#undef CACHE
#undef ICACHE
int
PLModel
::
columnToMeta
(
int
_column
)
{
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
568e5555
...
...
@@ -92,7 +92,7 @@ public:
QStringList
selectedURIs
();
QModelIndex
index
(
PLItem
*
,
int
c
)
const
;
QModelIndex
index
(
int
i_id
,
int
c
);
QModelIndex
currentIndex
();
QModelIndex
currentIndex
()
const
;
bool
isParent
(
const
QModelIndex
&
index
,
const
QModelIndex
&
current
)
const
;
bool
isCurrent
(
const
QModelIndex
&
index
)
const
;
int
itemId
(
const
QModelIndex
&
index
)
const
;
...
...
@@ -154,9 +154,9 @@ private:
QSignalMapper
*
sortingMapper
;
/* Lookups */
PLItem
*
findById
(
PLItem
*
,
int
);
PLItem
*
findByInput
(
PLItem
*
,
int
);
PLItem
*
findInner
(
PLItem
*
,
int
,
bool
)
;
PLItem
*
findById
(
PLItem
*
,
int
)
const
;
PLItem
*
findByInput
(
PLItem
*
,
int
)
const
;
PLItem
*
findInner
(
PLItem
*
,
int
,
bool
)
const
;
bool
canEdit
()
const
;
PLItem
*
p_cached_item
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment