Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
a3b7bce4
Commit
a3b7bce4
authored
Apr 28, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt, playlist: simplifications
parent
7ec2e3f0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
62 deletions
+50
-62
modules/gui/qt4/components/playlist/playlist_item.cpp
modules/gui/qt4/components/playlist/playlist_item.cpp
+6
-4
modules/gui/qt4/components/playlist/playlist_item.hpp
modules/gui/qt4/components/playlist/playlist_item.hpp
+4
-7
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+38
-48
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+2
-3
No files found.
modules/gui/qt4/components/playlist/playlist_item.cpp
View file @
a3b7bce4
...
@@ -30,7 +30,6 @@
...
@@ -30,7 +30,6 @@
#include "qt4.hpp"
#include "qt4.hpp"
#include "playlist_item.hpp"
#include "playlist_item.hpp"
#include <vlc_intf_strings.h>
#include "sorting.h"
#include "sorting.h"
...
@@ -45,14 +44,12 @@
...
@@ -45,14 +44,12 @@
PLItem have a parent, and id and a input Id
PLItem have a parent, and id and a input Id
*/
*/
void
PLItem
::
init
(
playlist_item_t
*
_playlist_item
,
PLItem
*
parent
)
void
PLItem
::
init
(
playlist_item_t
*
_playlist_item
,
PLItem
*
parent
)
{
{
parentItem
=
parent
;
/* Can be NULL, but only for the rootItem */
parentItem
=
parent
;
/* Can be NULL, but only for the rootItem */
i_id
=
_playlist_item
->
i_id
;
/* Playlist item specific id */
i_id
=
_playlist_item
->
i_id
;
/* Playlist item specific id */
p_input
=
_playlist_item
->
p_input
;
p_input
=
_playlist_item
->
p_input
;
vlc_gc_incref
(
p_input
);
vlc_gc_incref
(
p_input
);
}
}
/*
/*
...
@@ -79,11 +76,16 @@ PLItem::~PLItem()
...
@@ -79,11 +76,16 @@ PLItem::~PLItem()
/* So far signal is always true.
/* So far signal is always true.
Using signal false would not call PLModel... Why ?
Using signal false would not call PLModel... Why ?
*/
*/
void
PLItem
::
insertChild
(
PLItem
*
item
,
int
i_pos
,
bool
signal
)
inline
void
PLItem
::
insertChild
(
PLItem
*
item
,
int
i_pos
,
bool
signal
)
{
{
children
.
insert
(
i_pos
,
item
);
children
.
insert
(
i_pos
,
item
);
}
}
inline
void
PLItem
::
appendChild
(
PLItem
*
item
,
bool
signal
)
{
children
.
insert
(
children
.
count
(),
item
);
}
void
PLItem
::
removeChild
(
PLItem
*
item
)
void
PLItem
::
removeChild
(
PLItem
*
item
)
{
{
children
.
removeOne
(
item
);
children
.
removeOne
(
item
);
...
...
modules/gui/qt4/components/playlist/playlist_item.hpp
View file @
a3b7bce4
...
@@ -35,16 +35,12 @@ class PLItem
...
@@ -35,16 +35,12 @@ class PLItem
friend
class
PLModel
;
friend
class
PLModel
;
public:
public:
PLItem
(
playlist_item_t
*
,
PLItem
*
parent
);
PLItem
(
playlist_item_t
*
,
PLItem
*
parent
);
PLItem
(
playlist_item_t
*
);
~
PLItem
();
~
PLItem
();
int
row
()
const
;
int
row
()
const
;
void
insertChild
(
PLItem
*
,
int
p
,
bool
signal
=
true
);
void
insertChild
(
PLItem
*
,
int
pos
,
bool
signal
=
true
);
void
appendChild
(
PLItem
*
item
,
bool
signal
=
true
)
void
appendChild
(
PLItem
*
item
,
bool
signal
=
true
);
{
children
.
insert
(
children
.
count
(),
item
);
};
void
removeChild
(
PLItem
*
);
void
removeChild
(
PLItem
*
);
void
removeChildren
();
void
removeChildren
();
void
takeChildAt
(
int
);
void
takeChildAt
(
int
);
...
@@ -59,12 +55,13 @@ public:
...
@@ -59,12 +55,13 @@ public:
protected:
protected:
QList
<
PLItem
*>
children
;
QList
<
PLItem
*>
children
;
PLItem
*
parentItem
;
int
i_id
;
int
i_id
;
input_item_t
*
p_input
;
input_item_t
*
p_input
;
private:
private:
PLItem
(
playlist_item_t
*
);
void
init
(
playlist_item_t
*
,
PLItem
*
);
void
init
(
playlist_item_t
*
,
PLItem
*
);
PLItem
*
parentItem
;
};
};
#endif
#endif
...
...
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
a3b7bce4
...
@@ -48,7 +48,6 @@
...
@@ -48,7 +48,6 @@
#include <QDesktopServices>
#include <QDesktopServices>
#include <QInputDialog>
#include <QInputDialog>
#include <QSignalMapper>
#include <QSignalMapper>
#include <QPixmapCache>
#define I_NEW_DIR \
#define I_NEW_DIR \
I_DIR_OR_FOLDER( N_("Create Directory"), N_( "Create Folder" ) )
I_DIR_OR_FOLDER( N_("Create Directory"), N_( "Create Folder" ) )
...
@@ -179,7 +178,7 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
...
@@ -179,7 +178,7 @@ QMimeData *PLModel::mimeData( const QModelIndexList &indexes ) const
else
else
item
=
getItem
(
index
);
item
=
getItem
(
index
);
plMimeData
->
appendItem
(
item
->
p_input
);
plMimeData
->
appendItem
(
item
->
inputItem
()
);
}
}
return
plMimeData
;
return
plMimeData
;
...
@@ -209,7 +208,7 @@ void PLModel::dropAppendCopy( const PlMimeData *plMimeData, PLItem *target, int
...
@@ -209,7 +208,7 @@ void PLModel::dropAppendCopy( const PlMimeData *plMimeData, PLItem *target, int
PL_LOCK
;
PL_LOCK
;
playlist_item_t
*
p_parent
=
playlist_item_t
*
p_parent
=
playlist_ItemGetByInput
(
p_playlist
,
target
->
p_input
);
playlist_ItemGetByInput
(
p_playlist
,
target
->
inputItem
()
);
if
(
!
p_parent
)
return
;
if
(
!
p_parent
)
return
;
if
(
pos
==
-
1
)
pos
=
PLAYLIST_END
;
if
(
pos
==
-
1
)
pos
=
PLAYLIST_END
;
...
@@ -235,7 +234,7 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
...
@@ -235,7 +234,7 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
PL_LOCK
;
PL_LOCK
;
playlist_item_t
*
p_parent
=
playlist_item_t
*
p_parent
=
playlist_ItemGetByInput
(
p_playlist
,
target
->
p_input
);
playlist_ItemGetByInput
(
p_playlist
,
target
->
inputItem
()
);
if
(
!
p_parent
||
row
>
p_parent
->
i_children
)
if
(
!
p_parent
||
row
>
p_parent
->
i_children
)
{
{
...
@@ -264,10 +263,10 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
...
@@ -264,10 +263,10 @@ void PLModel::dropMove( const PlMimeData * plMimeData, PLItem *target, int row )
{
{
PL_UNLOCK
;
return
;
PL_UNLOCK
;
return
;
}
}
climber
=
climber
->
parent
Item
;
climber
=
climber
->
parent
()
;
}
}
if
(
item
->
parent
Item
==
target
&&
if
(
item
->
parent
()
==
target
&&
target
->
children
.
indexOf
(
item
)
<
new_pos
)
target
->
children
.
indexOf
(
item
)
<
new_pos
)
model_pos
--
;
model_pos
--
;
...
@@ -316,7 +315,7 @@ void PLModel::activateItem( playlist_item_t *p_item )
...
@@ -316,7 +315,7 @@ void PLModel::activateItem( playlist_item_t *p_item )
playlist_item_t
*
p_parent
=
p_item
;
playlist_item_t
*
p_parent
=
p_item
;
while
(
p_parent
)
while
(
p_parent
)
{
{
if
(
p_parent
->
i_id
==
rootItem
->
i
_id
)
break
;
if
(
p_parent
->
i_id
==
rootItem
->
i
d
()
)
break
;
p_parent
=
p_parent
->
p_parent
;
p_parent
=
p_parent
->
p_parent
;
}
}
if
(
p_parent
)
if
(
p_parent
)
...
@@ -354,7 +353,7 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
...
@@ -354,7 +353,7 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
}
}
else
else
{
{
char
*
psz
=
psz_column_meta
(
item
->
p_input
,
metadata
);
char
*
psz
=
psz_column_meta
(
item
->
inputItem
()
,
metadata
);
returninfo
=
qfu
(
psz
);
returninfo
=
qfu
(
psz
);
free
(
psz
);
free
(
psz
);
}
}
...
@@ -363,7 +362,7 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
...
@@ -363,7 +362,7 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
else
if
(
role
==
Qt
::
DecorationRole
&&
index
.
column
()
==
0
)
else
if
(
role
==
Qt
::
DecorationRole
&&
index
.
column
()
==
0
)
{
{
/* Used to segfault here because i_type wasn't always initialized */
/* Used to segfault here because i_type wasn't always initialized */
return
QVariant
(
PLModel
::
icons
[
item
->
p_input
->
i_type
]
);
return
QVariant
(
PLModel
::
icons
[
item
->
inputItem
()
->
i_type
]
);
}
}
else
if
(
role
==
Qt
::
FontRole
)
else
if
(
role
==
Qt
::
FontRole
)
{
{
...
@@ -415,12 +414,12 @@ bool PLModel::isParent( const QModelIndex &index, const QModelIndex ¤t ) c
...
@@ -415,12 +414,12 @@ bool PLModel::isParent( const QModelIndex &index, const QModelIndex ¤t ) c
bool
PLModel
::
isCurrent
(
const
QModelIndex
&
index
)
const
bool
PLModel
::
isCurrent
(
const
QModelIndex
&
index
)
const
{
{
return
getItem
(
index
)
->
p_input
==
THEMIM
->
currentInputItem
();
return
getItem
(
index
)
->
inputItem
()
==
THEMIM
->
currentInputItem
();
}
}
int
PLModel
::
itemId
(
const
QModelIndex
&
index
)
const
int
PLModel
::
itemId
(
const
QModelIndex
&
index
)
const
{
{
return
getItem
(
index
)
->
i
_id
;
return
getItem
(
index
)
->
i
d
()
;
}
}
QVariant
PLModel
::
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
QVariant
PLModel
::
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
...
@@ -485,7 +484,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
...
@@ -485,7 +484,7 @@ QModelIndex PLModel::parent( const QModelIndex &index ) const
PLItem
*
parentItem
=
childItem
->
parent
();
PLItem
*
parentItem
=
childItem
->
parent
();
if
(
!
parentItem
||
parentItem
==
rootItem
)
return
QModelIndex
();
if
(
!
parentItem
||
parentItem
==
rootItem
)
return
QModelIndex
();
if
(
!
parentItem
->
parent
Item
)
if
(
!
parentItem
->
parent
()
)
{
{
msg_Err
(
p_playlist
,
"No parent parent, trying row 0 "
);
msg_Err
(
p_playlist
,
"No parent parent, trying row 0 "
);
msg_Err
(
p_playlist
,
"----- PLEASE REPORT THIS ------"
);
msg_Err
(
p_playlist
,
"----- PLEASE REPORT THIS ------"
);
...
@@ -546,22 +545,22 @@ PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input ) const
...
@@ -546,22 +545,22 @@ PLItem * PLModel::findInner( PLItem *root, int i_id, bool b_input ) const
{
{
if
(
!
root
)
return
NULL
;
if
(
!
root
)
return
NULL
;
if
(
!
b_input
&&
root
->
i
_id
==
i_id
)
if
(
!
b_input
&&
root
->
i
d
()
==
i_id
)
return
root
;
return
root
;
else
if
(
b_input
&&
root
->
p_input
->
i_id
==
i_id
)
else
if
(
b_input
&&
root
->
inputItem
()
->
i_id
==
i_id
)
return
root
;
return
root
;
QList
<
PLItem
*>::
iterator
it
=
root
->
children
.
begin
();
QList
<
PLItem
*>::
iterator
it
=
root
->
children
.
begin
();
while
(
it
!=
root
->
children
.
end
()
)
while
(
it
!=
root
->
children
.
end
()
)
{
{
if
(
!
b_input
&&
(
*
it
)
->
i
_id
==
i_id
)
if
(
!
b_input
&&
(
*
it
)
->
i
d
()
==
i_id
)
return
(
*
it
);
return
(
*
it
);
else
if
(
b_input
&&
(
*
it
)
->
p_input
->
i_id
==
i_id
)
else
if
(
b_input
&&
(
*
it
)
->
inputItem
()
->
i_id
==
i_id
)
return
(
*
it
);
return
(
*
it
);
if
(
(
*
it
)
->
child
ren
.
size
()
)
if
(
(
*
it
)
->
child
Count
()
)
{
{
PLItem
*
childFound
=
findInner
(
(
*
it
),
i_id
,
b_input
);
PLItem
*
childFound
=
findInner
(
(
*
it
),
i_id
,
b_input
);
if
(
childFound
)
if
(
childFound
)
...
@@ -577,9 +576,9 @@ bool PLModel::canEdit() const
...
@@ -577,9 +576,9 @@ bool PLModel::canEdit() const
return
(
return
(
rootItem
!=
NULL
&&
rootItem
!=
NULL
&&
(
(
rootItem
->
p_input
==
p_playlist
->
p_playing
->
p_input
||
rootItem
->
inputItem
()
==
p_playlist
->
p_playing
->
p_input
||
(
p_playlist
->
p_media_library
&&
(
p_playlist
->
p_media_library
&&
rootItem
->
p_input
==
p_playlist
->
p_media_library
->
p_input
)
rootItem
->
inputItem
()
==
p_playlist
->
p_media_library
->
p_input
)
)
)
);
);
}
}
...
@@ -645,15 +644,10 @@ void PLModel::processItemAppend( int i_item, int i_parent )
...
@@ -645,15 +644,10 @@ void PLModel::processItemAppend( int i_item, int i_parent )
nodeParentItem
->
insertChild
(
newItem
,
pos
);
nodeParentItem
->
insertChild
(
newItem
,
pos
);
endInsertRows
();
endInsertRows
();
if
(
newItem
->
p_input
==
THEMIM
->
currentInputItem
()
)
if
(
newItem
->
inputItem
()
==
THEMIM
->
currentInputItem
()
)
emit
currentChanged
(
index
(
newItem
,
0
)
);
emit
currentChanged
(
index
(
newItem
,
0
)
);
}
}
void
PLModel
::
rebuild
()
{
rebuild
(
NULL
);
}
void
PLModel
::
rebuild
(
playlist_item_t
*
p_root
)
void
PLModel
::
rebuild
(
playlist_item_t
*
p_root
)
{
{
playlist_item_t
*
p_item
;
playlist_item_t
*
p_item
;
...
@@ -664,7 +658,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
...
@@ -664,7 +658,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
if
(
rootItem
)
rootItem
->
removeChildren
();
if
(
rootItem
)
rootItem
->
removeChildren
();
PL_LOCK
;
PL_LOCK
;
if
(
p_root
)
if
(
p_root
)
// Can be NULL
{
{
delete
rootItem
;
delete
rootItem
;
rootItem
=
new
PLItem
(
p_root
);
rootItem
=
new
PLItem
(
p_root
);
...
@@ -683,7 +677,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
...
@@ -683,7 +677,7 @@ void PLModel::rebuild( playlist_item_t *p_root )
void
PLModel
::
takeItem
(
PLItem
*
item
)
void
PLModel
::
takeItem
(
PLItem
*
item
)
{
{
assert
(
item
);
assert
(
item
);
PLItem
*
parent
=
item
->
parent
Item
;
PLItem
*
parent
=
item
->
parent
()
;
assert
(
parent
);
assert
(
parent
);
int
i_index
=
parent
->
children
.
indexOf
(
item
);
int
i_index
=
parent
->
children
.
indexOf
(
item
);
...
@@ -714,10 +708,10 @@ void PLModel::removeItem( PLItem *item )
...
@@ -714,10 +708,10 @@ void PLModel::removeItem( PLItem *item )
i_cached_id
=
-
1
;
i_cached_id
=
-
1
;
i_cached_input_id
=
-
1
;
i_cached_input_id
=
-
1
;
if
(
item
->
parent
Item
)
{
if
(
item
->
parent
()
)
{
int
i
=
item
->
parent
Item
->
children
.
indexOf
(
item
);
int
i
=
item
->
parent
()
->
children
.
indexOf
(
item
);
beginRemoveRows
(
index
(
item
->
parent
Item
,
0
),
i
,
i
);
beginRemoveRows
(
index
(
item
->
parent
()
,
0
),
i
,
i
);
item
->
parent
Item
->
children
.
removeAt
(
i
);
item
->
parent
()
->
children
.
removeAt
(
i
);
delete
item
;
delete
item
;
endRemoveRows
();
endRemoveRows
();
}
}
...
@@ -733,7 +727,7 @@ void PLModel::removeItem( PLItem *item )
...
@@ -733,7 +727,7 @@ void PLModel::removeItem( PLItem *item )
/* This function must be entered WITH the playlist lock */
/* This function must be entered WITH the playlist lock */
void
PLModel
::
updateChildren
(
PLItem
*
root
)
void
PLModel
::
updateChildren
(
PLItem
*
root
)
{
{
playlist_item_t
*
p_node
=
playlist_ItemGetById
(
p_playlist
,
root
->
i
_id
);
playlist_item_t
*
p_node
=
playlist_ItemGetById
(
p_playlist
,
root
->
i
d
()
);
updateChildren
(
p_node
,
root
);
updateChildren
(
p_node
,
root
);
}
}
...
@@ -775,11 +769,11 @@ void PLModel::doDelete( QModelIndexList selected )
...
@@ -775,11 +769,11 @@ void PLModel::doDelete( QModelIndexList selected )
if
(
index
.
column
()
!=
0
)
continue
;
if
(
index
.
column
()
!=
0
)
continue
;
PLItem
*
item
=
getItem
(
index
);
PLItem
*
item
=
getItem
(
index
);
if
(
item
->
child
ren
.
size
()
)
if
(
item
->
child
Count
()
)
recurseDelete
(
item
->
children
,
&
selected
);
recurseDelete
(
item
->
children
,
&
selected
);
PL_LOCK
;
PL_LOCK
;
playlist_DeleteFromInput
(
p_playlist
,
item
->
p_input
,
pl_Locked
);
playlist_DeleteFromInput
(
p_playlist
,
item
->
inputItem
()
,
pl_Locked
);
PL_UNLOCK
;
PL_UNLOCK
;
removeItem
(
item
);
removeItem
(
item
);
...
@@ -791,7 +785,7 @@ void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList
...
@@ -791,7 +785,7 @@ void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList
for
(
int
i
=
children
.
size
()
-
1
;
i
>=
0
;
i
--
)
for
(
int
i
=
children
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
{
PLItem
*
item
=
children
[
i
];
PLItem
*
item
=
children
[
i
];
if
(
item
->
child
ren
.
size
()
)
if
(
item
->
child
Count
()
)
recurseDelete
(
item
->
children
,
fullList
);
recurseDelete
(
item
->
children
,
fullList
);
fullList
->
removeAll
(
index
(
item
,
0
)
);
fullList
->
removeAll
(
index
(
item
,
0
)
);
}
}
...
@@ -800,7 +794,7 @@ void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList
...
@@ -800,7 +794,7 @@ void PLModel::recurseDelete( QList<PLItem*> children, QModelIndexList *fullList
/******* Volume III: Sorting and searching ********/
/******* Volume III: Sorting and searching ********/
void
PLModel
::
sort
(
const
int
column
,
Qt
::
SortOrder
order
)
void
PLModel
::
sort
(
const
int
column
,
Qt
::
SortOrder
order
)
{
{
sort
(
rootItem
->
i
_id
,
column
,
order
);
sort
(
rootItem
->
i
d
()
,
column
,
order
);
}
}
void
PLModel
::
sort
(
const
int
i_root_id
,
const
int
column
,
Qt
::
SortOrder
order
)
void
PLModel
::
sort
(
const
int
i_root_id
,
const
int
column
,
Qt
::
SortOrder
order
)
...
@@ -813,7 +807,7 @@ void PLModel::sort( const int i_root_id, const int column, Qt::SortOrder order )
...
@@ -813,7 +807,7 @@ void PLModel::sort( const int i_root_id, const int column, Qt::SortOrder order )
PLItem
*
item
=
findById
(
rootItem
,
i_root_id
);
PLItem
*
item
=
findById
(
rootItem
,
i_root_id
);
if
(
!
item
)
return
;
if
(
!
item
)
return
;
QModelIndex
qIndex
=
index
(
item
,
0
);
QModelIndex
qIndex
=
index
(
item
,
0
);
int
count
=
item
->
child
ren
.
size
();
int
count
=
item
->
child
Count
();
if
(
count
)
if
(
count
)
{
{
beginRemoveRows
(
qIndex
,
0
,
count
-
1
);
beginRemoveRows
(
qIndex
,
0
,
count
-
1
);
...
@@ -869,11 +863,11 @@ void PLModel::search( const QString& search_text, const QModelIndex & idx, bool
...
@@ -869,11 +863,11 @@ void PLModel::search( const QString& search_text, const QModelIndex & idx, bool
{
{
PLItem
*
searchRoot
=
getItem
(
idx
);
PLItem
*
searchRoot
=
getItem
(
idx
);
beginRemoveRows
(
idx
,
0
,
searchRoot
->
child
ren
.
size
()
-
1
);
beginRemoveRows
(
idx
,
0
,
searchRoot
->
child
Count
()
-
1
);
searchRoot
->
removeChildren
();
searchRoot
->
removeChildren
();
endRemoveRows
(
);
endRemoveRows
(
);
beginInsertRows
(
idx
,
0
,
searchRoot
->
child
ren
.
size
()
-
1
);
beginInsertRows
(
idx
,
0
,
searchRoot
->
child
Count
()
-
1
);
updateChildren
(
searchRoot
);
// The PL_LOCK is needed here
updateChildren
(
searchRoot
);
// The PL_LOCK is needed here
endInsertRows
();
endInsertRows
();
...
@@ -888,7 +882,7 @@ void PLModel::search( const QString& search_text, const QModelIndex & idx, bool
...
@@ -888,7 +882,7 @@ void PLModel::search( const QString& search_text, const QModelIndex & idx, bool
/*********** Popup *********/
/*********** Popup *********/
bool
PLModel
::
popup
(
const
QModelIndex
&
index
,
const
QPoint
&
point
,
const
QModelIndexList
&
list
)
bool
PLModel
::
popup
(
const
QModelIndex
&
index
,
const
QPoint
&
point
,
const
QModelIndexList
&
list
)
{
{
int
i_id
=
index
.
isValid
()
?
itemId
(
index
)
:
rootItem
->
i
_id
;
int
i_id
=
index
.
isValid
()
?
itemId
(
index
)
:
rootItem
->
i
d
()
;
PL_LOCK
;
PL_LOCK
;
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_playlist
,
i_id
);
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_playlist
,
i_id
);
...
@@ -904,10 +898,10 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
...
@@ -904,10 +898,10 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
i_popup_item
=
index
.
isValid
()
?
p_item
->
i_id
:
-
1
;
i_popup_item
=
index
.
isValid
()
?
p_item
->
i_id
:
-
1
;
i_popup_parent
=
index
.
isValid
()
?
i_popup_parent
=
index
.
isValid
()
?
(
p_item
->
p_parent
?
p_item
->
p_parent
->
i_id
:
-
1
)
:
(
p_item
->
p_parent
?
p_item
->
p_parent
->
i_id
:
-
1
)
:
(
rootItem
->
i
_id
);
(
rootItem
->
i
d
()
);
i_popup_column
=
index
.
column
();
i_popup_column
=
index
.
column
();
bool
tree
=
(
rootItem
&&
rootItem
->
i
_id
!=
p_playlist
->
p_playing
->
i_id
)
||
bool
tree
=
(
rootItem
&&
rootItem
->
i
d
()
!=
p_playlist
->
p_playing
->
i_id
)
||
var_InheritBool
(
p_intf
,
"playlist-tree"
);
var_InheritBool
(
p_intf
,
"playlist-tree"
);
PL_UNLOCK
;
PL_UNLOCK
;
...
@@ -936,14 +930,14 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
...
@@ -936,14 +930,14 @@ bool PLModel::popup( const QModelIndex & index, const QPoint &point, const QMode
QIcon
addIcon
(
":/buttons/playlist/playlist_add"
);
QIcon
addIcon
(
":/buttons/playlist/playlist_add"
);
menu
.
addSeparator
();
menu
.
addSeparator
();
if
(
tree
)
menu
.
addAction
(
addIcon
,
qtr
(
I_POP_NEWFOLDER
),
this
,
SLOT
(
popupAddNode
()
)
);
if
(
tree
)
menu
.
addAction
(
addIcon
,
qtr
(
I_POP_NEWFOLDER
),
this
,
SLOT
(
popupAddNode
()
)
);
if
(
rootItem
->
i
_id
==
THEPL
->
p_playing
->
i_id
)
if
(
rootItem
->
i
d
()
==
THEPL
->
p_playing
->
i_id
)
{
{
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDF
),
THEDP
,
SLOT
(
simplePLAppendDialog
())
);
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDF
),
THEDP
,
SLOT
(
simplePLAppendDialog
())
);
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDDIR
),
THEDP
,
SLOT
(
PLAppendDir
())
);
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDDIR
),
THEDP
,
SLOT
(
PLAppendDir
())
);
menu
.
addAction
(
addIcon
,
qtr
(
I_OP_ADVOP
),
THEDP
,
SLOT
(
PLAppendDialog
())
);
menu
.
addAction
(
addIcon
,
qtr
(
I_OP_ADVOP
),
THEDP
,
SLOT
(
PLAppendDialog
())
);
}
}
else
if
(
THEPL
->
p_media_library
&&
else
if
(
THEPL
->
p_media_library
&&
rootItem
->
i
_id
==
THEPL
->
p_media_library
->
i_id
)
rootItem
->
i
d
()
==
THEPL
->
p_media_library
->
i_id
)
{
{
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDF
),
THEDP
,
SLOT
(
simpleMLAppendDialog
())
);
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDF
),
THEDP
,
SLOT
(
simpleMLAppendDialog
())
);
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDDIR
),
THEDP
,
SLOT
(
MLAppendDir
()
)
);
menu
.
addAction
(
addIcon
,
qtr
(
I_PL_ADDDIR
),
THEDP
,
SLOT
(
MLAppendDir
()
)
);
...
@@ -1094,10 +1088,6 @@ void PLModel::popupSort( int column )
...
@@ -1094,10 +1088,6 @@ void PLModel::popupSort( int column )
}
}
/******************* Drag and Drop helper class ******************/
/******************* Drag and Drop helper class ******************/
PlMimeData
::
PlMimeData
(
)
{
}
PlMimeData
::~
PlMimeData
()
PlMimeData
::~
PlMimeData
()
{
{
foreach
(
input_item_t
*
p_item
,
_inputItems
)
foreach
(
input_item_t
*
p_item
,
_inputItems
)
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
a3b7bce4
...
@@ -92,8 +92,7 @@ public:
...
@@ -92,8 +92,7 @@ public:
void
search
(
const
QString
&
search_text
,
const
QModelIndex
&
root
,
bool
b_recursive
);
void
search
(
const
QString
&
search_text
,
const
QModelIndex
&
root
,
bool
b_recursive
);
void
sort
(
const
int
column
,
Qt
::
SortOrder
order
);
void
sort
(
const
int
column
,
Qt
::
SortOrder
order
);
void
sort
(
const
int
i_root_id
,
const
int
column
,
Qt
::
SortOrder
order
);
void
sort
(
const
int
i_root_id
,
const
int
column
,
Qt
::
SortOrder
order
);
void
rebuild
();
void
rebuild
(
playlist_item_t
*
p
=
NULL
);
void
rebuild
(
playlist_item_t
*
);
inline
PLItem
*
getItem
(
QModelIndex
index
)
const
inline
PLItem
*
getItem
(
QModelIndex
index
)
const
{
{
...
@@ -174,7 +173,7 @@ class PlMimeData : public QMimeData
...
@@ -174,7 +173,7 @@ class PlMimeData : public QMimeData
Q_OBJECT
Q_OBJECT
public:
public:
PlMimeData
()
;
PlMimeData
()
{}
~
PlMimeData
();
~
PlMimeData
();
void
appendItem
(
input_item_t
*
p_item
);
void
appendItem
(
input_item_t
*
p_item
);
QList
<
input_item_t
*>
inputItems
()
const
;
QList
<
input_item_t
*>
inputItems
()
const
;
...
...
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