Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
ab81a846
Commit
ab81a846
authored
Oct 12, 2013
by
Edward Wang
Committed by
Jean-Baptiste Kempf
Oct 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: add rename directory option
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
f217d32d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
0 deletions
+39
-0
include/vlc_intf_strings.h
include/vlc_intf_strings.h
+2
-0
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+16
-0
modules/gui/qt4/components/playlist/playlist_model.hpp
modules/gui/qt4/components/playlist/playlist_model.hpp
+2
-0
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+17
-0
modules/gui/qt4/components/playlist/vlc_model.hpp
modules/gui/qt4/components/playlist/vlc_model.hpp
+2
-0
No files found.
include/vlc_intf_strings.h
View file @
ab81a846
...
...
@@ -67,6 +67,8 @@
#define I_POP_INFO N_("Information...")
#define I_POP_NEWFOLDER I_DIR_OR_FOLDER( N_("Create Directory..."), \
N_("Create Folder...") )
#define I_POP_RENAMEFOLDER I_DIR_OR_FOLDER( N_("Rename Directory..."), \
N_("Rename Folder...") )
#define I_POP_EXPLORE I_DIR_OR_FOLDER( N_("Show Containing Directory..."), \
N_("Show Containing Folder...") )
#define I_POP_STREAM N_("Stream...")
...
...
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
ab81a846
...
...
@@ -957,6 +957,19 @@ void PLModel::createNode( QModelIndex index, QString name )
PL_UNLOCK
;
}
void
PLModel
::
renameNode
(
QModelIndex
index
,
QString
name
)
{
if
(
name
.
isEmpty
()
||
!
index
.
isValid
()
)
return
;
PL_LOCK
;
if
(
!
index
.
isValid
()
)
index
=
rootIndex
();
input_item_t
*
p_input
=
this
->
getInputItem
(
index
);
input_item_SetName
(
p_input
,
qtu
(
name
)
);
playlist_t
*
p_playlist
=
pl_Get
(
p_intf
);
input_item_WriteMeta
(
VLC_OBJECT
(
p_playlist
),
p_input
);
PL_UNLOCK
;
}
bool
PLModel
::
action
(
QAction
*
action
,
const
QModelIndexList
&
indexes
)
{
QModelIndex
index
;
...
...
@@ -1077,6 +1090,9 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
return
getURI
(
index
).
startsWith
(
"file://"
);
case
ACTION_CREATENODE
:
return
(
canEdit
()
&&
isTree
()
);
case
ACTION_RENAMENODE
:
return
(
index
!=
rootIndex
()
)
&&
!
isLeaf
(
index
);
break
;
case
ACTION_CLEAR
:
return
rowCount
()
&&
canEdit
();
case
ACTION_ENQUEUEFILE
:
...
...
modules/gui/qt4/components/playlist/playlist_model.hpp
View file @
ab81a846
...
...
@@ -76,6 +76,7 @@ public:
virtual
void
rebuild
(
playlist_item_t
*
p
=
NULL
)
{
model
()
->
rebuild
(
p
);
}
virtual
void
doDelete
(
QModelIndexList
list
)
{
model
()
->
doDelete
(
mapListToSource
(
list
)
);
}
virtual
void
createNode
(
QModelIndex
a
,
QString
b
)
{
model
()
->
createNode
(
mapToSource
(
a
),
b
);
}
virtual
void
renameNode
(
QModelIndex
a
,
QString
b
)
{
model
()
->
renameNode
(
mapToSource
(
a
),
b
);
}
virtual
void
removeAll
()
{
model
()
->
removeAll
();
}
virtual
QModelIndex
rootIndex
()
const
{
return
mapFromSource
(
model
()
->
rootIndex
()
);
}
...
...
@@ -165,6 +166,7 @@ public:
virtual
void
rebuild
(
playlist_item_t
*
p
=
NULL
);
virtual
void
doDelete
(
QModelIndexList
selected
);
virtual
void
createNode
(
QModelIndex
index
,
QString
name
);
virtual
void
renameNode
(
QModelIndex
index
,
QString
name
);
virtual
void
removeAll
();
/* Lookups */
...
...
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
ab81a846
...
...
@@ -51,6 +51,12 @@
I_DIR_OR_FOLDER( N_( "Enter name for new directory:" ), \
N_( "Enter name for new folder:" ) )
#define I_RENAME_DIR \
I_DIR_OR_FOLDER( N_("Rename Directory"), N_( "Rename Folder" ) )
#define I_RENAME_DIR_NAME \
I_DIR_OR_FOLDER( N_( "Enter a new name for the directory:" ), \
N_( "Enter a new name for the folder:" ) )
#include <QHeaderView>
#include <QMenu>
#include <QKeyEvent>
...
...
@@ -198,6 +204,9 @@ bool StandardPLPanel::popup( const QPoint &point )
ADD_MENU_ENTRY
(
addIcon
,
qtr
(
I_POP_NEWFOLDER
),
VLCModelSubInterface
::
ACTION_CREATENODE
)
ADD_MENU_ENTRY
(
QIcon
(),
qtr
(
I_POP_RENAMEFOLDER
),
VLCModelSubInterface
::
ACTION_RENAMENODE
)
menu
.
addSeparator
();
/* In PL or ML, allow to add a file/folder */
ADD_MENU_ENTRY
(
addIcon
,
qtr
(
I_PL_ADDF
),
...
...
@@ -325,6 +334,14 @@ void StandardPLPanel::popupAction( QAction *action )
model
->
createNode
(
index
,
temp
);
break
;
case
VLCModelSubInterface
:
:
ACTION_RENAMENODE
:
temp
=
QInputDialog
::
getText
(
PlaylistDialog
::
getInstance
(
p_intf
),
qtr
(
I_RENAME_DIR
),
qtr
(
I_RENAME_DIR_NAME
),
QLineEdit
::
Normal
,
model
->
getTitle
(
index
),
&
ok
);
if
(
!
ok
)
return
;
model
->
renameNode
(
index
,
temp
);
break
;
case
VLCModelSubInterface
:
:
ACTION_ENQUEUEFILE
:
uris
=
THEDP
->
showSimpleOpen
();
if
(
uris
.
isEmpty
()
)
return
;
...
...
modules/gui/qt4/components/playlist/vlc_model.hpp
View file @
ab81a846
...
...
@@ -65,6 +65,7 @@ public:
virtual
void
rebuild
(
playlist_item_t
*
p
=
NULL
)
=
0
;
virtual
void
doDelete
(
QModelIndexList
)
=
0
;
virtual
void
createNode
(
QModelIndex
,
QString
)
=
0
;
virtual
void
renameNode
(
QModelIndex
,
QString
)
=
0
;
virtual
void
removeAll
()
=
0
;
virtual
QModelIndex
rootIndex
()
const
=
0
;
...
...
@@ -89,6 +90,7 @@ public:
ACTION_SORT
,
ACTION_EXPLORE
,
ACTION_CREATENODE
,
ACTION_RENAMENODE
,
ACTION_CLEAR
,
ACTION_ENQUEUEFILE
,
ACTION_ENQUEUEDIR
,
...
...
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