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
5626f2a8
Commit
5626f2a8
authored
Dec 20, 2012
by
Olafs Vandāns
Committed by
Jean-Baptiste Kempf
Dec 20, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: add playlist total duration
Ref #2744 #4252 Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
8df7ff82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
3 deletions
+40
-3
modules/gui/qt4/components/playlist/selector.cpp
modules/gui/qt4/components/playlist/selector.cpp
+36
-3
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/components/playlist/selector.hpp
+4
-0
No files found.
modules/gui/qt4/components/playlist/selector.cpp
View file @
5626f2a8
...
...
@@ -188,13 +188,42 @@ PLSelItem * putPLData( PLSelItem* item, playlist_item_t* plItem )
return
item
;
}
/*
* Reads and updates the playlist's duration as [xx:xx] after the label in the tree
* item - the treeview item to get the duration for
* prefix - the string to use before the time (should be the category name)
*/
void
PLSelector
::
updateTotalDuration
(
PLSelItem
*
item
,
const
char
*
prefix
)
{
/* Getting the playlist */
QVariant
playlistVariant
=
item
->
treeItem
()
->
data
(
0
,
PL_ITEM_ROLE
);
playlist_item_t
*
node
=
playlistVariant
.
value
<
playlist_item_t
*>
();
/* Formatting time */
QString
qs_timeLabel
(
prefix
);
mtime_t
mt_duration
=
playlist_GetNodeDuration
(
node
);
int
i_seconds
=
mt_duration
/
1000000
;
int
i_minutes
=
i_seconds
/
60
;
i_seconds
=
i_seconds
%
60
;
if
(
i_minutes
>=
60
)
{
int
i_hours
=
i_minutes
/
60
;
i_minutes
=
i_minutes
%
60
;
qs_timeLabel
+=
QString
(
" [%1:%2:%3]"
).
arg
(
i_hours
).
arg
(
i_minutes
,
2
,
10
,
QChar
(
'0'
)
).
arg
(
i_seconds
,
2
,
10
,
QChar
(
'0'
)
);
}
else
qs_timeLabel
+=
QString
(
" [%1:%2]"
).
arg
(
i_minutes
,
2
,
10
,
QChar
(
'0'
)
).
arg
(
i_seconds
,
2
,
10
,
QChar
(
'0'
)
);
item
->
setText
(
qs_timeLabel
);
}
void
PLSelector
::
createItems
()
{
/* PL */
PLSelItem
*
pl
=
putPLData
(
addItem
(
PL_ITEM_TYPE
,
N_
(
"Playlist"
),
true
),
playlistItem
=
putPLData
(
addItem
(
PL_ITEM_TYPE
,
N_
(
"Playlist"
),
true
),
THEPL
->
p_playing
);
pl
->
treeItem
()
->
setData
(
0
,
SPECIAL_ROLE
,
QVariant
(
IS_PL
)
);
setCurrentItem
(
pl
->
treeItem
()
);
pl
aylistItem
->
treeItem
()
->
setData
(
0
,
SPECIAL_ROLE
,
QVariant
(
IS_PL
)
);
setCurrentItem
(
pl
aylistItem
->
treeItem
()
);
/* ML */
PLSelItem
*
ml
=
putPLData
(
addItem
(
PL_ITEM_TYPE
,
N_
(
"Media Library"
),
true
),
...
...
@@ -426,6 +455,7 @@ void PLSelector::dragMoveEvent ( QDragMoveEvent * event )
void
PLSelector
::
plItemAdded
(
int
item
,
int
parent
)
{
updateTotalDuration
(
playlistItem
,
"Playlist"
);
if
(
parent
!=
podcastsParentId
||
podcastsParent
==
NULL
)
return
;
playlist_Lock
(
THEPL
);
...
...
@@ -458,6 +488,7 @@ void PLSelector::plItemAdded( int item, int parent )
void
PLSelector
::
plItemRemoved
(
int
id
)
{
updateTotalDuration
(
playlistItem
,
"Playlist"
);
if
(
!
podcastsParent
)
return
;
int
c
=
podcastsParent
->
childCount
();
...
...
@@ -477,6 +508,8 @@ void PLSelector::plItemRemoved( int id )
void
PLSelector
::
inputItemUpdate
(
input_item_t
*
arg
)
{
updateTotalDuration
(
playlistItem
,
"Playlist"
);
if
(
podcastsParent
==
NULL
)
return
;
...
...
modules/gui/qt4/components/playlist/selector.hpp
View file @
5626f2a8
...
...
@@ -133,6 +133,10 @@ private:
bool
drop
=
false
,
QTreeWidgetItem
*
parentItem
=
0
);
PLSelItem
*
addPodcastItem
(
playlist_item_t
*
p_item
);
PLSelItem
*
playlistItem
;
void
updateTotalDuration
(
PLSelItem
*
,
const
char
*
);
inline
PLSelItem
*
itemWidget
(
QTreeWidgetItem
*
);
intf_thread_t
*
p_intf
;
...
...
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