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
dee8cee6
Commit
dee8cee6
authored
Feb 02, 2014
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: display total playlist duration (close #9852)
parent
c33e62ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
2 deletions
+47
-2
modules/gui/macosx/MainWindow.m
modules/gui/macosx/MainWindow.m
+47
-2
No files found.
modules/gui/macosx/MainWindow.m
View file @
dee8cee6
...
...
@@ -739,6 +739,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[
self
showDropZone
];
PL_UNLOCK
;
[
o_sidebar_view
setNeedsDisplay
:
YES
];
[
self
_updatePlaylistTitle
];
}
-
(
void
)
setPause
...
...
@@ -901,6 +903,47 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[[
VLCMain
sharedInstance
]
mainMenu
]
updateSidebarMenuItem
];
}
#pragma mark -
#pragma mark private playlist magic
-
(
void
)
_updatePlaylistTitle
{
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
PL_LOCK
;
playlist_item_t
*
currentPlaylistRoot
=
[[[
VLCMain
sharedInstance
]
playlist
]
currentPlaylistRoot
];
PL_UNLOCK
;
if
(
currentPlaylistRoot
==
p_playlist
->
p_local_category
||
currentPlaylistRoot
==
p_playlist
->
p_ml_category
)
{
if
(
currentPlaylistRoot
==
p_playlist
->
p_local_category
)
[
o_chosen_category_lbl
setStringValue
:
[
_NS
(
"Playlist"
)
stringByAppendingString
:[
self
_playbackDurationOfNode
:
p_playlist
->
p_local_category
]]];
else
[
o_chosen_category_lbl
setStringValue
:
[
_NS
(
"Media Library"
)
stringByAppendingString
:[
self
_playbackDurationOfNode
:
p_playlist
->
p_ml_category
]]];
}
}
-
(
NSString
*
)
_playbackDurationOfNode
:(
playlist_item_t
*
)
node
{
if
(
!
node
)
return
@""
;
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
PL_LOCK
;
mtime_t
mt_duration
=
playlist_GetNodeDuration
(
node
);
PL_UNLOCK
;
if
(
mt_duration
<
1
)
return
@""
;
mt_duration
=
mt_duration
/
1000000
;
NSDate
*
date
=
[
NSDate
dateWithTimeIntervalSince1970
:
mt_duration
];
NSDateFormatter
*
formatter
=
[[
NSDateFormatter
alloc
]
init
];
[
formatter
setDateFormat
:
@"HH:mm:ss"
];
[
formatter
setTimeZone
:[
NSTimeZone
timeZoneForSecondsFromGMT
:
0
]];
NSString
*
playbackDuration
=
[
NSString
stringWithFormat
:
@" — %@"
,[
formatter
stringFromDate
:
date
]];
[
formatter
release
];
return
playbackDuration
;
}
#pragma mark -
#pragma mark Side Bar Data handling
/* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
...
...
@@ -1040,7 +1083,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
NSIndexSet
*
selectedIndexes
=
[
o_sidebar_view
selectedRowIndexes
];
id
item
=
[
o_sidebar_view
itemAtRow
:[
selectedIndexes
firstIndex
]];
//Set the label text to represent the new selection
if
([
item
sdtype
]
>
-
1
&&
[[
item
identifier
]
length
]
>
0
)
{
BOOL
sd_loaded
=
playlist_IsServicesDiscoveryLoaded
(
p_playlist
,
[[
item
identifier
]
UTF8String
]);
...
...
@@ -1052,9 +1094,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
if
([[
item
identifier
]
isEqualToString
:
@"playlist"
])
{
[[[
VLCMain
sharedInstance
]
playlist
]
setPlaylistRoot
:
p_playlist
->
p_local_category
];
[
o_chosen_category_lbl
setStringValue
:
[[
o_chosen_category_lbl
stringValue
]
stringByAppendingString
:[
self
_playbackDurationOfNode
:
p_playlist
->
p_local_category
]]];
}
else
if
([[
item
identifier
]
isEqualToString
:
@"medialibrary"
])
{
if
(
p_playlist
->
p_ml_category
)
if
(
p_playlist
->
p_ml_category
)
{
[[[
VLCMain
sharedInstance
]
playlist
]
setPlaylistRoot
:
p_playlist
->
p_ml_category
];
[
o_chosen_category_lbl
setStringValue
:
[[
o_chosen_category_lbl
stringValue
]
stringByAppendingString
:[
self
_playbackDurationOfNode
:
p_playlist
->
p_ml_category
]]];
}
}
else
{
playlist_item_t
*
pl_item
;
PL_LOCK
;
...
...
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