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
9846f39f
Commit
9846f39f
authored
Aug 24, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preliminary deletion support
parent
1fc13bde
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
2 deletions
+86
-2
modules/gui/qt4/components/playlist/panels.hpp
modules/gui/qt4/components/playlist/panels.hpp
+4
-1
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+20
-0
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.cpp
+1
-1
modules/gui/qt4/playlist_model.cpp
modules/gui/qt4/playlist_model.cpp
+55
-0
modules/gui/qt4/playlist_model.hpp
modules/gui/qt4/playlist_model.hpp
+6
-0
No files found.
modules/gui/qt4/components/playlist/panels.hpp
View file @
9846f39f
...
...
@@ -32,7 +32,7 @@
class
QTreeView
;
class
PLModel
;
class
QPushButton
;
class
QKeyEvent
;
/**
* \todo Share a single model between views using a filterproxy
*/
...
...
@@ -60,6 +60,8 @@ public:
StandardPLPanel
(
QWidget
*
,
intf_thread_t
*
,
playlist_t
*
,
playlist_item_t
*
);
virtual
~
StandardPLPanel
();
protected:
virtual
void
keyPressEvent
(
QKeyEvent
*
e
);
private:
PLModel
*
model
;
QTreeView
*
view
;
...
...
@@ -67,6 +69,7 @@ private:
public
slots
:
virtual
void
setRoot
(
int
);
private
slots
:
void
deleteSelection
();
void
handleExpansion
(
const
QModelIndex
&
);
void
toggleRandom
();
void
toggleRepeat
();
...
...
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
9846f39f
...
...
@@ -28,8 +28,10 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QHeaderView>
#include <QKeyEvent>
#include "qt4.hpp"
#include <assert.h>
#include <QModelIndexList>
StandardPLPanel
::
StandardPLPanel
(
QWidget
*
_parent
,
intf_thread_t
*
_p_intf
,
playlist_t
*
p_playlist
,
...
...
@@ -122,5 +124,23 @@ void StandardPLPanel::setRoot( int i_root_id )
model
->
Rebuild
();
}
void
StandardPLPanel
::
keyPressEvent
(
QKeyEvent
*
e
)
{
switch
(
e
->
key
()
)
{
case
Qt
:
:
Key_Back
:
case
Qt
:
:
Key_Delete
:
deleteSelection
();
break
;
}
}
void
StandardPLPanel
::
deleteSelection
()
{
QItemSelectionModel
*
selection
=
view
->
selectionModel
();
QModelIndexList
list
=
selection
->
selectedIndexes
();
model
->
doDelete
(
list
);
}
StandardPLPanel
::~
StandardPLPanel
()
{}
modules/gui/qt4/menus.cpp
View file @
9846f39f
...
...
@@ -134,7 +134,7 @@ void QVLCMenu::createPlMenuBar( QMenuBar *bar, intf_thread_t *p_intf )
manageMenu
->
addAction
(
"Quick &Add File..."
,
THEDP
,
SLOT
(
simpleAppendDialog
()
)
);
manageMenu
->
addSeparator
();
manageMenu
->
addMenu
(
SDMenu
(
p_intf
)
);
//
manageMenu->addMenu( SDMenu( p_intf ) );
bar
->
addMenu
(
manageMenu
);
}
...
...
modules/gui/qt4/playlist_model.cpp
View file @
9846f39f
...
...
@@ -555,6 +555,61 @@ void PLModel::UpdateTreeItem( playlist_item_t *p_item, PLItem *item,
emit
dataChanged
(
index
(
item
,
0
)
,
index
(
item
,
1
)
);
}
/************************* Actions ******************************/
/**
* Deletion, here we have to do a ugly slow hack as we retrieve the full
* list of indexes to delete at once: when we delete a node and all of
* its children, we need to update the list.
* Todo: investigate whethere we can use ranges to be sure to delete all items?
*/
void
PLModel
::
doDelete
(
QModelIndexList
selected
)
{
for
(
int
i
=
selected
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
QModelIndex
index
=
selected
[
i
];
if
(
index
.
column
()
!=
0
)
continue
;
PLItem
*
item
=
static_cast
<
PLItem
*>
(
index
.
internalPointer
());
if
(
item
)
{
if
(
item
->
children
.
size
()
)
recurseDelete
(
item
->
children
,
&
selected
);
doDeleteItem
(
item
,
&
selected
);
}
}
}
void
PLModel
::
recurseDelete
(
QList
<
PLItem
*>
children
,
QModelIndexList
*
fullList
)
{
for
(
int
i
=
children
.
size
()
-
1
;
i
>=
0
;
i
--
)
{
PLItem
*
item
=
children
[
i
];
if
(
item
->
children
.
size
()
)
recurseDelete
(
item
->
children
,
fullList
);
doDeleteItem
(
item
,
fullList
);
}
}
void
PLModel
::
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
)
{
QModelIndex
deleteIndex
=
index
(
item
,
0
);
fullList
->
removeAll
(
deleteIndex
);
PL_LOCK
;
playlist_item_t
*
p_item
=
playlist_ItemGetById
(
p_playlist
,
item
->
i_id
);
if
(
!
p_item
)
{
PL_UNLOCK
;
return
;
}
if
(
p_item
->
i_children
==
-
1
)
playlist_DeleteAllFromInput
(
p_playlist
,
item
->
i_input_id
);
else
playlist_NodeDelete
(
p_playlist
,
p_item
,
VLC_TRUE
,
VLC_FALSE
);
/* And finally, remove it from the tree */
item
->
remove
(
item
);
PL_UNLOCK
;
}
/**********************************************************************
* Playlist callbacks
**********************************************************************/
...
...
modules/gui/qt4/playlist_model.hpp
View file @
9846f39f
...
...
@@ -119,6 +119,8 @@ public:
void
Rebuild
();
void
rebuildRoot
(
playlist_item_t
*
);
bool
hasRandom
();
bool
hasLoop
();
bool
hasRepeat
();
void
doDelete
(
QModelIndexList
selected
);
private:
void
addCallbacks
();
void
delCallbacks
();
...
...
@@ -139,6 +141,10 @@ private:
void
UpdateNodeChildren
(
PLItem
*
);
void
UpdateNodeChildren
(
playlist_item_t
*
,
PLItem
*
);
/* Actions */
void
recurseDelete
(
QList
<
PLItem
*>
children
,
QModelIndexList
*
fullList
);
void
doDeleteItem
(
PLItem
*
item
,
QModelIndexList
*
fullList
);
/* Lookups */
PLItem
*
FindById
(
PLItem
*
,
int
);
PLItem
*
FindByInput
(
PLItem
*
,
int
);
...
...
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