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
753731a2
Commit
753731a2
authored
Aug 14, 2009
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: remove b_current on PLItem, and store currentIndex when it changes
parent
1950858c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
modules/gui/qt4/components/playlist/playlist_item.cpp
modules/gui/qt4/components/playlist/playlist_item.cpp
+1
-3
modules/gui/qt4/components/playlist/playlist_item.hpp
modules/gui/qt4/components/playlist/playlist_item.hpp
+1
-2
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+9
-5
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+2
-1
No files found.
modules/gui/qt4/components/playlist/playlist_item.cpp
View file @
753731a2
...
@@ -54,7 +54,6 @@ void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent, PLModel *m,
...
@@ -54,7 +54,6 @@ void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent, PLModel *m,
i_id
=
_playlist_item
->
i_id
;
/* Playlist item specific id */
i_id
=
_playlist_item
->
i_id
;
/* Playlist item specific id */
model
=
m
;
/* PLModel (QAbsmodel) */
model
=
m
;
/* PLModel (QAbsmodel) */
i_type
=
-
1
;
/* Item type - Avoid segfault */
i_type
=
-
1
;
/* Item type - Avoid segfault */
b_current
=
false
;
/* Is the item the current Item or not */
b_is_node
=
_playlist_item
->
i_children
>
-
1
;
b_is_node
=
_playlist_item
->
i_children
>
-
1
;
p_input
=
_playlist_item
->
p_input
;
p_input
=
_playlist_item
->
p_input
;
vlc_gc_incref
(
p_input
);
vlc_gc_incref
(
p_input
);
...
@@ -139,13 +138,12 @@ int PLItem::row() const
...
@@ -139,13 +138,12 @@ int PLItem::row() const
}
}
/* update the PL Item, get the good names and so on */
/* update the PL Item, get the good names and so on */
void
PLItem
::
update
(
playlist_item_t
*
p_item
,
bool
iscurrent
)
void
PLItem
::
update
(
playlist_item_t
*
p_item
)
{
{
assert
(
p_item
->
p_input
==
p_input
);
assert
(
p_item
->
p_input
==
p_input
);
/* Useful for the model */
/* Useful for the model */
i_type
=
p_item
->
p_input
->
i_type
;
i_type
=
p_item
->
p_input
->
i_type
;
b_current
=
iscurrent
;
b_is_node
=
p_item
->
i_children
>
-
1
;
b_is_node
=
p_item
->
i_children
>
-
1
;
i_showflags
=
parentItem
?
parentItem
->
i_showflags
:
i_showflags
;
i_showflags
=
parentItem
?
parentItem
->
i_showflags
:
i_showflags
;
...
...
modules/gui/qt4/components/playlist/playlist_item.hpp
View file @
753731a2
...
@@ -59,11 +59,10 @@ public:
...
@@ -59,11 +59,10 @@ public:
PLItem
*
parent
()
{
return
parentItem
;
};
PLItem
*
parent
()
{
return
parentItem
;
};
void
update
(
playlist_item_t
*
,
bool
);
void
update
(
playlist_item_t
*
);
protected:
protected:
QList
<
PLItem
*>
children
;
QList
<
PLItem
*>
children
;
bool
b_current
;
int
i_type
;
int
i_type
;
int
i_id
;
int
i_id
;
int
i_showflags
;
int
i_showflags
;
...
...
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
753731a2
...
@@ -77,6 +77,7 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
...
@@ -77,6 +77,7 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
i_cached_id
=
-
1
;
i_cached_id
=
-
1
;
i_cached_input_id
=
-
1
;
i_cached_input_id
=
-
1
;
i_popup_item
=
i_popup_parent
=
-
1
;
i_popup_item
=
i_popup_parent
=
-
1
;
currentIndex
=
QModelIndex
();
rootItem
=
NULL
;
/* PLItem rootItem, will be set in rebuild( ) */
rootItem
=
NULL
;
/* PLItem rootItem, will be set in rebuild( ) */
...
@@ -370,7 +371,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -370,7 +371,7 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
}
}
else
if
(
role
==
Qt
::
FontRole
)
else
if
(
role
==
Qt
::
FontRole
)
{
{
if
(
i
tem
->
b_current
==
true
)
if
(
i
sCurrent
(
index
)
)
{
{
QFont
f
;
f
.
setBold
(
true
);
return
QVariant
(
f
);
QFont
f
;
f
.
setBold
(
true
);
return
QVariant
(
f
);
}
}
...
@@ -378,10 +379,12 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
...
@@ -378,10 +379,12 @@ QVariant PLModel::data( const QModelIndex &index, int role ) const
return
QVariant
();
return
QVariant
();
}
}
bool
PLModel
::
isCurrent
(
const
QModelIndex
&
index
)
bool
PLModel
::
isCurrent
(
const
QModelIndex
&
index
)
const
{
{
assert
(
index
.
isValid
()
);
assert
(
index
.
isValid
()
);
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
())
->
b_current
;
if
(
!
currentIndex
.
isValid
())
return
false
;
return
static_cast
<
PLItem
*>
(
index
.
internalPointer
())
->
p_input
==
static_cast
<
PLItem
*>
(
currentIndex
.
internalPointer
())
->
p_input
;
}
}
int
PLModel
::
itemId
(
const
QModelIndex
&
index
)
const
int
PLModel
::
itemId
(
const
QModelIndex
&
index
)
const
...
@@ -647,6 +650,7 @@ void PLModel::ProcessInputItemUpdate( input_thread_t *p_input )
...
@@ -647,6 +650,7 @@ void PLModel::ProcessInputItemUpdate( input_thread_t *p_input )
{
{
PLItem
*
item
=
FindByInput
(
rootItem
,
input_GetItem
(
p_input
)
->
i_id
);
PLItem
*
item
=
FindByInput
(
rootItem
,
input_GetItem
(
p_input
)
->
i_id
);
emit
currentChanged
(
index
(
item
,
0
)
);
emit
currentChanged
(
index
(
item
,
0
)
);
currentIndex
=
index
(
item
,
0
);
}
}
}
}
void
PLModel
::
ProcessInputItemUpdate
(
input_item_t
*
p_item
)
void
PLModel
::
ProcessInputItemUpdate
(
input_item_t
*
p_item
)
...
@@ -782,9 +786,9 @@ void PLModel::UpdateTreeItem( playlist_item_t *p_item, PLItem *item,
...
@@ -782,9 +786,9 @@ void PLModel::UpdateTreeItem( playlist_item_t *p_item, PLItem *item,
if
(
!
force
&&
i_depth
==
DEPTH_SEL
&&
p_item
->
p_parent
&&
if
(
!
force
&&
i_depth
==
DEPTH_SEL
&&
p_item
->
p_parent
&&
p_item
->
p_parent
->
i_id
!=
rootItem
->
i_id
)
p_item
->
p_parent
->
i_id
!=
rootItem
->
i_id
)
return
;
return
;
item
->
update
(
p_item
,
p_item
==
playlist_CurrentPlayingItem
(
p_playlist
)
);
item
->
update
(
p_item
);
if
(
signal
)
if
(
signal
)
emit
dataChanged
(
index
(
item
,
0
)
,
index
(
item
,
1
)
);
emit
dataChanged
(
index
(
item
,
0
)
,
index
(
item
,
columnCount
(
QModelIndex
()
)
)
);
}
}
/************************* Actions ******************************/
/************************* Actions ******************************/
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
753731a2
...
@@ -98,7 +98,7 @@ public:
...
@@ -98,7 +98,7 @@ public:
QModelIndex
index
(
int
r
,
int
c
,
const
QModelIndex
&
parent
)
const
;
QModelIndex
index
(
int
r
,
int
c
,
const
QModelIndex
&
parent
)
const
;
QModelIndex
index
(
PLItem
*
,
int
c
)
const
;
QModelIndex
index
(
PLItem
*
,
int
c
)
const
;
int
itemId
(
const
QModelIndex
&
index
)
const
;
int
itemId
(
const
QModelIndex
&
index
)
const
;
bool
isCurrent
(
const
QModelIndex
&
index
);
bool
isCurrent
(
const
QModelIndex
&
index
)
const
;
QModelIndex
parent
(
const
QModelIndex
&
index
)
const
;
QModelIndex
parent
(
const
QModelIndex
&
index
)
const
;
int
childrenCount
(
const
QModelIndex
&
parent
=
QModelIndex
()
)
const
;
int
childrenCount
(
const
QModelIndex
&
parent
=
QModelIndex
()
)
const
;
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
()
)
const
;
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
()
)
const
;
...
@@ -155,6 +155,7 @@ private:
...
@@ -155,6 +155,7 @@ private:
/* Popup */
/* Popup */
int
i_popup_item
,
i_popup_parent
;
int
i_popup_item
,
i_popup_parent
;
QModelIndexList
current_selection
;
QModelIndexList
current_selection
;
QModelIndex
currentIndex
;
QSignalMapper
*
ContextUpdateMapper
;
QSignalMapper
*
ContextUpdateMapper
;
/* Lookups */
/* Lookups */
...
...
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