Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
c169acfa
Commit
c169acfa
authored
Jul 22, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx/playlist: fix rendering and improve style
parent
d4ec3a04
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
122 deletions
+121
-122
modules/gui/macosx/MainWindow.m
modules/gui/macosx/MainWindow.m
+1
-3
modules/gui/macosx/PLModel.m
modules/gui/macosx/PLModel.m
+1
-1
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.h
+1
-1
modules/gui/macosx/playlist.m
modules/gui/macosx/playlist.m
+118
-117
No files found.
modules/gui/macosx/MainWindow.m
View file @
c169acfa
...
...
@@ -39,6 +39,7 @@
#import <vlc_url.h>
#import <vlc_strings.h>
#import <vlc_services_discovery.h>
#import "PLModel.h"
#import "ControlsBar.h"
#import "VideoView.h"
...
...
@@ -174,8 +175,6 @@ static VLCMainWindow *sharedInstance = nil;
VLCPlaylist
*
playlist
=
[[
VLCMain
sharedInstance
]
playlist
];
playlist
.
outlineView
=
o_outline_view
;
playlist
.
playlistHeaderView
=
[
o_outline_view
headerView
];
[
o_outline_view
setDelegate
:
playlist
];
[
o_outline_view
setDataSource
:
playlist
];
[
o_dropzone_btn
setTitle
:
_NS
(
"Open media..."
)];
[[
o_dropzone_btn
cell
]
accessibilitySetOverrideValue
:
_NS
(
"Click to open an advanced dialog to select the media to play. You can also drop files here to play."
)
forAttribute
:
NSAccessibilityDescriptionAttribute
];
...
...
@@ -1132,7 +1131,6 @@ static VLCMainWindow *sharedInstance = nil;
if
([[
item
identifier
]
isEqualToString
:
@"playlist"
])
{
PL_LOCK
;
[[[[
VLCMain
sharedInstance
]
playlist
]
model
]
changeRootItem
:
p_playlist
->
p_playing
];
PL_UNLOCK
;
...
...
modules/gui/macosx/PLModel.m
View file @
c169acfa
...
...
@@ -56,7 +56,7 @@
-
(
id
)
initWithOutlineView
:(
NSOutlineView
*
)
outlineView
playlist
:(
playlist_t
*
)
pl
rootItem
:(
playlist_item_t
*
)
root
playlistObject
:(
id
)
plObj
;
{
self
=
[
super
init
];
if
(
self
)
{
if
(
self
)
{
p_playlist
=
pl
;
_outlineView
=
outlineView
;
_playlist
=
plObj
;
...
...
modules/gui/macosx/playlist.h
View file @
c169acfa
...
...
@@ -36,7 +36,7 @@
/*****************************************************************************
* VLCPlaylist interface
*****************************************************************************/
@interface
VLCPlaylist
:
NSObject
<
NSOutlineViewD
ataSource
,
NSOutlineViewD
elegate
>
@interface
VLCPlaylist
:
NSObject
<
NSOutlineViewDelegate
>
@property
(
readwrite
,
weak
)
IBOutlet
NSMenu
*
playlistMenu
;
@property
(
readwrite
,
weak
)
IBOutlet
NSMenuItem
*
playPlaylistMenuItem
;
...
...
modules/gui/macosx/playlist.m
View file @
c169acfa
...
...
@@ -199,18 +199,18 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
*****************************************************************************/
@interface
VLCPlaylist
()
{
NSImage
*
o
_descendingSortingImage
;
NSImage
*
o
_ascendingSortingImage
;
NSImage
*
_descendingSortingImage
;
NSImage
*
_ascendingSortingImage
;
BOOL
b_selected_item_met
;
BOOL
b_isSortDescending
;
id
o_tc_sort
Column
;
NSTableColumn
*
_sortTable
Column
;
NSUInteger
retainedRowSelection
;
BOOL
b_playlistmenu_nib_loaded
;
BOOL
b_view_setup
;
PLModel
*
o
_model
;
PLModel
*
_model
;
}
-
(
void
)
saveTableColumns
;
...
...
@@ -266,7 +266,7 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
-
(
PLModel
*
)
model
{
return
o
_model
;
return
_model
;
}
-
(
void
)
reloadStyles
...
...
@@ -284,7 +284,7 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
NSArray
*
columns
=
[
_outlineView
tableColumns
];
NSUInteger
count
=
columns
.
count
;
for
(
NSUInteger
x
=
0
;
x
<
count
;
x
++
)
[[
[
columns
objectAtIndex
:
x
]
dataCell
]
setFont
:
fontToUse
];
[[
columns
[
x
]
dataCell
]
setFont
:
fontToUse
];
[
_outlineView
setRowHeight
:
rowHeight
];
}
...
...
@@ -293,35 +293,41 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
if
(
b_view_setup
)
return
;
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
[
self
reloadStyles
];
[
self
initStrings
];
o_model
=
[[
PLModel
alloc
]
initWithOutlineView
:
_outlineView
playlist
:
p_playlist
rootItem
:
p_playlist
->
p_playing
playlistObject
:
self
];
[
_outlineView
setDataSource
:
o_model
];
[
_outlineView
reloadData
];
[
_outlineView
setTarget
:
self
];
[
_outlineView
setDoubleAction
:
@selector
(
playItem
:)];
[
_outlineView
setAllowsEmptySelection
:
NO
];
[
_outlineView
registerForDraggedTypes
:
[
NSArray
arrayWithObjects
:
NSFilenamesPboardType
,
@"VLCPlaylistItemPboardType"
,
nil
]];
[
_outlineView
setIntercellSpacing
:
NSMakeSize
(
0
.
0
,
1
.
0
)];
/* This uses a private API, but works fine on all current OSX releases.
* Radar ID 11739459 request a public API for this. However, it is probably
* easier and faster to recreate similar looking bitmaps ourselves. */
o
_ascendingSortingImage
=
[[
NSOutlineView
class
]
_defaultTableHeaderSortImage
];
o
_descendingSortingImage
=
[[
NSOutlineView
class
]
_defaultTableHeaderReverseSortImage
];
_ascendingSortingImage
=
[[
NSOutlineView
class
]
_defaultTableHeaderSortImage
];
_descendingSortingImage
=
[[
NSOutlineView
class
]
_defaultTableHeaderReverseSortImage
];
o_tc_sort
Column
=
nil
;
_sortTable
Column
=
nil
;
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
applicationWillTerminate
:
)
name
:
NSApplicationWillTerminateNotification
object
:
nil
];
b_view_setup
=
YES
;
}
-
(
void
)
setOutlineView
:(
VLCPlaylistView
*
__nullable
)
outlineView
{
_outlineView
=
outlineView
;
[
_outlineView
setDelegate
:
self
];
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
_model
=
[[
PLModel
alloc
]
initWithOutlineView
:
_outlineView
playlist
:
p_playlist
rootItem
:
p_playlist
->
p_playing
playlistObject
:
self
];
[
_outlineView
setDataSource
:
_model
];
[
_outlineView
reloadData
];
[
_outlineView
setTarget
:
self
];
[
_outlineView
setDoubleAction
:
@selector
(
playItem
:)];
[
_outlineView
setAllowsEmptySelection
:
NO
];
[
_outlineView
registerForDraggedTypes
:
[
NSArray
arrayWithObjects
:
NSFilenamesPboardType
,
@"VLCPlaylistItemPboardType"
,
nil
]];
[
_outlineView
setIntercellSpacing
:
NSMakeSize
(
0
.
0
,
1
.
0
)];
}
-
(
void
)
setPlaylistHeaderView
:(
NSTableHeaderView
*
__nullable
)
playlistHeaderView
{
VLCMainMenu
*
mainMenu
=
[[
VLCMain
sharedInstance
]
mainMenu
];
...
...
@@ -329,19 +335,19 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
NSMenu
*
contextMenu
=
[
mainMenu
setupPlaylistTableColumnsMenu
];
[
_playlistHeaderView
setMenu
:
contextMenu
];
NSArray
*
o_
columnArray
=
[[
NSUserDefaults
standardUserDefaults
]
arrayForKey
:
@"PlaylistColumnSelection"
];
NSUInteger
co
unt
=
[
o_
columnArray
count
];
NSString
*
o_
column
;
NSArray
*
columnArray
=
[[
NSUserDefaults
standardUserDefaults
]
arrayForKey
:
@"PlaylistColumnSelection"
];
NSUInteger
co
lumnCount
=
[
columnArray
count
];
NSString
*
column
;
for
(
NSUInteger
i
=
0
;
i
<
count
;
i
++
)
{
o_column
=
[[
o_columnArray
objectAtIndex
:
i
]
firstObject
];
if
([
o_
column
isEqualToString
:
@"status"
])
for
(
NSUInteger
i
=
0
;
i
<
co
lumnCo
unt
;
i
++
)
{
column
=
[
columnArray
[
i
]
firstObject
];
if
([
column
isEqualToString
:
@"status"
])
continue
;
if
(
!
[
mainMenu
setPlaylistColumnTableState
:
NSOnState
forColumn
:
o_
column
])
if
(
!
[
mainMenu
setPlaylistColumnTableState
:
NSOnState
forColumn
:
column
])
continue
;
[[
_outlineView
tableColumnWithIdentifier
:
o_column
]
setWidth
:
[[[
o_columnArray
objectAtIndex
:
i
]
objectAtIndex
:
1
]
floatValue
]];
[[
_outlineView
tableColumnWithIdentifier
:
column
]
setWidth
:
[
columnArray
[
i
][
1
]
floatValue
]];
}
}
...
...
@@ -370,10 +376,10 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
[
_outlineView
reloadData
];
}
-
(
void
)
plItemAppended
:(
NSArray
*
)
o_val
-
(
void
)
plItemAppended
:(
NSArray
*
)
valueArray
{
int
i_node
=
[[
o_val
firstObject
]
intValue
];
int
i_item
=
[
[
o_val
objectAtIndex
:
1
]
intValue
];
int
i_node
=
[[
valueArray
firstObject
]
intValue
];
int
i_item
=
[
valueArray
[
1
]
intValue
];
[[
self
model
]
addItem
:
i_item
withParentNode
:
i_node
];
...
...
@@ -385,9 +391,9 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
userInfo:
nil
];
}
-
(
void
)
plItemRemoved
:(
NSNumber
*
)
o_val
-
(
void
)
plItemRemoved
:(
NSNumber
*
)
value
{
int
i_item
=
[
o_val
intValue
];
int
i_item
=
[
value
intValue
];
[[
self
model
]
removeItem
:
i_item
];
[
self
deletionCompleted
];
...
...
@@ -626,12 +632,12 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
if
(
!
[[
self
model
]
editAllowed
])
return
;
NSIndexSet
*
o_selected_i
ndexes
=
[
_outlineView
selectedRowIndexes
];
retainedRowSelection
=
[
o_selected_i
ndexes
firstIndex
];
NSIndexSet
*
selectedI
ndexes
=
[
_outlineView
selectedRowIndexes
];
retainedRowSelection
=
[
selectedI
ndexes
firstIndex
];
if
(
retainedRowSelection
==
NSNotFound
)
retainedRowSelection
=
0
;
[
o_selected_i
ndexes
enumerateIndexesUsingBlock
:
^
(
NSUInteger
idx
,
BOOL
*
stop
)
{
[
selectedI
ndexes
enumerateIndexesUsingBlock
:
^
(
NSUInteger
idx
,
BOOL
*
stop
)
{
PLItem
*
o_item
=
[
_outlineView
itemAtRow
:
idx
];
if
(
!
o_item
)
return
;
...
...
@@ -675,69 +681,68 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
// [self playlistUpdated];
}
-
(
input_item_t
*
)
createItem
:(
NSDictionary
*
)
o_one_item
-
(
input_item_t
*
)
createItem
:(
NSDictionary
*
)
itemToCreateDict
{
intf_thread_t
*
p_intf
=
VLCIntf
;
playlist_t
*
p_playlist
=
pl_Get
(
p_intf
);
intf_thread_t
*
p_intf
=
VLCIntf
;
playlist_t
*
p_playlist
=
pl_Get
(
p_intf
);
input_item_t
*
p_input
;
BOOL
b_rem
=
FALSE
,
b_dir
=
FALSE
,
b_writable
=
FALSE
;
NSString
*
o_uri
,
*
o_name
,
*
o_path
;
NSURL
*
o_nsurl
;
NSArray
*
o_options
;
NSURL
*
o_true_file
;
NSString
*
uri
,
*
name
,
*
path
;
NSURL
*
url
;
NSArray
*
optionsArray
;
/* Get the item */
o_uri
=
(
NSString
*
)[
o_one_item
objectForKey
:
@"ITEM_URL"
];
o_nsurl
=
[
NSURL
URLWithString
:
o_
uri
];
o_path
=
[
o_ns
url
path
];
o_name
=
(
NSString
*
)[
o_one_item
objectForKey
:
@"ITEM_NAME"
];
o
_options
=
(
NSArray
*
)[
o_one_item
objectForKey
:
@"ITEM_OPTIONS"
];
uri
=
(
NSString
*
)[
itemToCreateDict
objectForKey
:
@"ITEM_URL"
];
url
=
[
NSURL
URLWithString
:
uri
];
path
=
[
url
path
];
name
=
(
NSString
*
)[
itemToCreateDict
objectForKey
:
@"ITEM_NAME"
];
o
ptionsArray
=
(
NSArray
*
)[
itemToCreateDict
objectForKey
:
@"ITEM_OPTIONS"
];
if
([[
NSFileManager
defaultManager
]
fileExistsAtPath
:
o_
path
isDirectory
:
&
b_dir
]
&&
b_dir
&&
[[
NSWorkspace
sharedWorkspace
]
getFileSystemInfoForPath
:
o_
path
isRemovable
:
&
b_rem
isWritable:
&
b_writable
isUnmountable
:
NULL
description
:
NULL
type
:
NULL
]
&&
b_rem
&&
!
b_writable
&&
[
o_ns
url
isFileURL
])
{
if
([[
NSFileManager
defaultManager
]
fileExistsAtPath
:
path
isDirectory
:
&
b_dir
]
&&
b_dir
&&
[[
NSWorkspace
sharedWorkspace
]
getFileSystemInfoForPath
:
path
isRemovable
:
&
b_rem
isWritable:
&
b_writable
isUnmountable
:
NULL
description
:
NULL
type
:
NULL
]
&&
b_rem
&&
!
b_writable
&&
[
url
isFileURL
])
{
NSString
*
diskType
=
[[
VLCStringUtility
sharedInstance
]
getVolumeTypeFromMountPath
:
o_
path
];
NSString
*
diskType
=
[[
VLCStringUtility
sharedInstance
]
getVolumeTypeFromMountPath
:
path
];
msg_Dbg
(
p_intf
,
"detected optical media of type %s in the file input"
,
[
diskType
UTF8String
]);
if
([
diskType
isEqualToString
:
kVLCMediaDVD
])
o_uri
=
[
NSString
stringWithFormat
:
@"dvdnav://%@"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
o_
path
]];
uri
=
[
NSString
stringWithFormat
:
@"dvdnav://%@"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
path
]];
else
if
([
diskType
isEqualToString
:
kVLCMediaVideoTSFolder
])
o_uri
=
[
NSString
stringWithFormat
:
@"dvdnav://%@"
,
o_
path
];
uri
=
[
NSString
stringWithFormat
:
@"dvdnav://%@"
,
path
];
else
if
([
diskType
isEqualToString
:
kVLCMediaAudioCD
])
o_uri
=
[
NSString
stringWithFormat
:
@"cdda://%@"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
o_
path
]];
uri
=
[
NSString
stringWithFormat
:
@"cdda://%@"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
path
]];
else
if
([
diskType
isEqualToString
:
kVLCMediaVCD
])
o_uri
=
[
NSString
stringWithFormat
:
@"vcd://%@#0:0"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
o_
path
]];
uri
=
[
NSString
stringWithFormat
:
@"vcd://%@#0:0"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
path
]];
else
if
([
diskType
isEqualToString
:
kVLCMediaSVCD
])
o_uri
=
[
NSString
stringWithFormat
:
@"vcd://%@@0:0"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
o_
path
]];
uri
=
[
NSString
stringWithFormat
:
@"vcd://%@@0:0"
,
[[
VLCStringUtility
sharedInstance
]
getBSDNodeFromMountPath
:
path
]];
else
if
([
diskType
isEqualToString
:
kVLCMediaBD
]
||
[
diskType
isEqualToString
:
kVLCMediaBDMVFolder
])
o_uri
=
[
NSString
stringWithFormat
:
@"bluray://%@"
,
o_
path
];
uri
=
[
NSString
stringWithFormat
:
@"bluray://%@"
,
path
];
else
msg_Warn
(
VLCIntf
,
"unknown disk type, treating %s as regular input"
,
[
o_
path
UTF8String
]);
msg_Warn
(
VLCIntf
,
"unknown disk type, treating %s as regular input"
,
[
path
UTF8String
]);
p_input
=
input_item_New
([
o_uri
UTF8String
],
[[[
NSFileManager
defaultManager
]
displayNameAtPath
:
o_
path
]
UTF8String
]);
p_input
=
input_item_New
([
uri
UTF8String
],
[[[
NSFileManager
defaultManager
]
displayNameAtPath
:
path
]
UTF8String
]);
}
else
p_input
=
input_item_New
([
o_uri
fileSystemRepresentation
],
o_name
?
[
o_
name
UTF8String
]
:
NULL
);
p_input
=
input_item_New
([
uri
fileSystemRepresentation
],
name
?
[
name
UTF8String
]
:
NULL
);
if
(
!
p_input
)
return
NULL
;
if
(
o
_options
)
{
NSUInteger
count
=
[
o
_options
count
];
if
(
o
ptionsArray
)
{
NSUInteger
count
=
[
o
ptionsArray
count
];
for
(
NSUInteger
i
=
0
;
i
<
count
;
i
++
)
input_item_AddOption
(
p_input
,
[
[
o_options
objectAtIndex
:
i
]
UTF8String
],
VLC_INPUT_OPTION_TRUSTED
);
input_item_AddOption
(
p_input
,
[
o_options
[
i
]
UTF8String
],
VLC_INPUT_OPTION_TRUSTED
);
}
/* Recent documents menu */
if
(
o_ns
url
!=
nil
&&
(
BOOL
)
config_GetInt
(
p_playlist
,
"macosx-recentitems"
)
==
YES
)
if
(
url
!=
nil
&&
(
BOOL
)
config_GetInt
(
p_playlist
,
"macosx-recentitems"
)
==
YES
)
[[
NSDocumentController
sharedDocumentController
]
noteNewRecentDocumentURL
:
o_nsurl
];
return
p_input
;
}
-
(
void
)
addPlaylistItems
:(
NSArray
*
)
o_
array
-
(
void
)
addPlaylistItems
:(
NSArray
*
)
array
{
int
i_plItemId
=
-
1
;
...
...
@@ -748,10 +753,10 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
BOOL
b_autoplay
=
var_InheritBool
(
VLCIntf
,
"macosx-autoplay"
);
[
self
addPlaylistItems
:
o_
array
withParentItemId
:
i_plItemId
atPos
:-
1
startPlayback
:
b_autoplay
];
[
self
addPlaylistItems
:
array
withParentItemId
:
i_plItemId
atPos
:-
1
startPlayback
:
b_autoplay
];
}
-
(
void
)
addPlaylistItems
:(
NSArray
*
)
o_
array
withParentItemId
:(
int
)
i_plItemId
atPos
:(
int
)
i_position
startPlayback
:(
BOOL
)
b_start
-
(
void
)
addPlaylistItems
:(
NSArray
*
)
array
withParentItemId
:(
int
)
i_plItemId
atPos
:(
int
)
i_position
startPlayback
:(
BOOL
)
b_start
{
playlist_t
*
p_playlist
=
pl_Get
(
VLCIntf
);
PL_LOCK
;
...
...
@@ -767,11 +772,11 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
return
;
}
NSUInteger
count
=
[
o_
array
count
];
NSUInteger
count
=
[
array
count
];
int
i_current_offset
=
0
;
for
(
NSUInteger
i
=
0
;
i
<
count
;
++
i
)
{
NSDictionary
*
o_current_item
=
[
o_array
objectAtIndex
:
i
];
NSDictionary
*
o_current_item
=
array
[
i
];
input_item_t
*
p_input
=
[
self
createItem
:
o_current_item
];
if
(
!
p_input
)
continue
;
...
...
@@ -797,16 +802,16 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
NSUInteger
indexes
[
count
];
[
selectedRows
getIndexes
:
indexes
maxCount
:
count
inIndexRange
:
nil
];
id
o_
item
;
id
item
;
playlist_item_t
*
p_item
;
for
(
NSUInteger
i
=
0
;
i
<
count
;
i
++
)
{
o_
item
=
[
_outlineView
itemAtRow
:
indexes
[
i
]];
item
=
[
_outlineView
itemAtRow
:
indexes
[
i
]];
/* We need to collapse the node first, since OSX refuses to recursively
expand an already expanded node, even if children nodes are collapsed. */
if
([
_outlineView
isExpandable
:
o_
item
])
{
[
_outlineView
collapseItem
:
o_
item
collapseChildren
:
YES
];
[
_outlineView
expandItem
:
o_
item
expandChildren
:
YES
];
if
([
_outlineView
isExpandable
:
item
])
{
[
_outlineView
collapseItem
:
item
collapseChildren
:
YES
];
[
_outlineView
expandItem
:
item
expandChildren
:
YES
];
}
selectedRows
=
[
_outlineView
selectedRowIndexes
];
...
...
@@ -847,15 +852,15 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
return
_playlistMenu
;
}
-
(
void
)
outlineView
:
(
NSOutlineView
*
)
o_tv
didClickTableColumn
:(
NSTableColumn
*
)
o_tc
-
(
void
)
outlineView
:
(
NSOutlineView
*
)
outlineView
didClickTableColumn
:(
NSTableColumn
*
)
aTableColumn
{
int
i_mode
,
i_
type
=
0
;
int
type
=
0
;
intf_thread_t
*
p_intf
=
VLCIntf
;
NSString
*
o_identifier
=
[
o_tc
identifier
];
NSString
*
identifier
=
[
aTableColumn
identifier
];
playlist_t
*
p_playlist
=
pl_Get
(
p_intf
);
if
(
o_tc_sortColumn
==
o_tc
)
if
(
_sortTableColumn
==
aTableColumn
)
b_isSortDescending
=
!
b_isSortDescending
;
else
b_isSortDescending
=
false
;
...
...
@@ -865,7 +870,7 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
else
i_type
=
ORDER_NORMAL
;
[[
self
model
]
sortForColumn
:
o_identifier
withMode
:
i_
type
];
[[
self
model
]
sortForColumn
:
identifier
withMode
:
type
];
// TODO rework, why do we need a full call here?
// [self playlistUpdated];
...
...
@@ -873,18 +878,16 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
/* Clear indications of any existing column sorting */
NSUInteger
count
=
[[
_outlineView
tableColumns
]
count
];
for
(
NSUInteger
i
=
0
;
i
<
count
;
i
++
)
[
_outlineView
setIndicatorImage
:
nil
inTableColumn
:
[
[
_outlineView
tableColumns
]
objectAtIndex
:
i
]];
[
_outlineView
setIndicatorImage
:
nil
inTableColumn
:
[
_outlineView
tableColumns
][
i
]];
[
_outlineView
setHighlightedTableColumn
:
nil
];
o_tc_sortColumn
=
nil
;
o_tc_sortColumn
=
o_tc
;
[
_outlineView
setHighlightedTableColumn
:
o_tc
];
_sortTableColumn
=
aTableColumn
;
[
_outlineView
setHighlightedTableColumn
:
aTableColumn
];
if
(
b_isSortDescending
)
[
_outlineView
setIndicatorImage
:
o_descendingSortingImage
inTableColumn
:
o_tc
];
[
_outlineView
setIndicatorImage
:
_descendingSortingImage
inTableColumn
:
aTableColumn
];
else
[
_outlineView
setIndicatorImage
:
o_ascendingSortingImage
inTableColumn
:
o_tc
];
[
_outlineView
setIndicatorImage
:
_ascendingSortingImage
inTableColumn
:
aTableColumn
];
}
...
...
@@ -931,67 +934,65 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
return
[[
self
model
]
draggedItems
];
}
-
(
void
)
setColumn
:
(
NSString
*
)
o_column
state
:
(
NSInteger
)
i_state
translationDict
:(
NSDictionary
*
)
o_d
ict
-
(
void
)
setColumn
:
(
NSString
*
)
columnIdentifier
state
:(
NSInteger
)
i_state
translationDict
:(
NSDictionary
*
)
translationD
ict
{
NSTableColumn
*
o_work_tc
;
if
(
i_state
==
NSOnState
)
{
NSString
*
o_title
=
[
o_dict
objectForKey
:
o_column
];
if
(
!
o_
title
)
NSString
*
title
=
[
translationDict
objectForKey
:
columnIdentifier
];
if
(
!
title
)
return
;
o_work_tc
=
[[
NSTableColumn
alloc
]
initWithIdentifier
:
o_column
];
[
o_work_tc
setEditable
:
NO
];
[[
o_work_tc
dataCell
]
setFont
:
[
NSFont
controlContentFontOfSize
:
11
.]];
NSTableColumn
*
tableColumn
=
[[
NSTableColumn
alloc
]
initWithIdentifier
:
columnIdentifier
];
[
tableColumn
setEditable
:
NO
];
[[
tableColumn
dataCell
]
setFont
:
[
NSFont
controlContentFontOfSize
:
11
.]];
[[
o_work_tc
headerCell
]
setStringValue
:
[
o_dict
objectForKey
:
o_column
]];
[[
tableColumn
headerCell
]
setStringValue
:[
translationDict
objectForKey
:
columnIdentifier
]];
if
([
o_column
isEqualToString
:
TRACKNUM_COLUMN
])
{
[
o_work_tc
setWidth
:
20
.];
[
o_work_tc
setResizingMask
:
NSTableColumnNoResizing
];
[[
o_work_tc
headerCell
]
setStringValue
:
@"#"
];
if
([
columnIdentifier
isEqualToString
:
TRACKNUM_COLUMN
])
{
[
tableColumn
setWidth
:
20
.];
[
tableColumn
setResizingMask
:
NSTableColumnNoResizing
];
[[
tableColumn
headerCell
]
setStringValue
:
@"#"
];
}
[
_outlineView
addTableColumn
:
o_work_tc
];
[
_outlineView
addTableColumn
:
tableColumn
];
[
_outlineView
reloadData
];
[
_outlineView
setNeedsDisplay
:
YES
];
}
else
[
_outlineView
removeTableColumn
:
[
_outlineView
tableColumnWithIdentifier
:
o_column
]];
[
_outlineView
removeTableColumn
:
[
_outlineView
tableColumnWithIdentifier
:
columnIdentifier
]];
[
_outlineView
setOutlineTableColumn
:
[
_outlineView
tableColumnWithIdentifier
:
TITLE_COLUMN
]];
}
-
(
void
)
saveTableColumns
{
NSMutableArray
*
o_
arrayToSave
=
[[
NSMutableArray
alloc
]
init
];
NSArray
*
o_
columns
=
[[
NSArray
alloc
]
initWithArray
:[
_outlineView
tableColumns
]];
NSUInteger
co
unt
=
[
o_
columns
count
];
NSTableColumn
*
o_
currentColumn
;
for
(
NSUInteger
i
=
0
;
i
<
count
;
i
++
)
{
o_currentColumn
=
[
o_columns
objectAtIndex
:
i
];
[
o_arrayToSave
addObject
:[
NSArray
arrayWithObjects
:[
o_currentColumn
identifier
],
[
NSNumber
numberWithFloat
:[
o_
currentColumn
width
]],
nil
]];
NSMutableArray
*
arrayToSave
=
[[
NSMutableArray
alloc
]
init
];
NSArray
*
columns
=
[[
NSArray
alloc
]
initWithArray
:[
_outlineView
tableColumns
]];
NSUInteger
co
lumnCount
=
[
columns
count
];
NSTableColumn
*
currentColumn
;
for
(
NSUInteger
i
=
0
;
i
<
co
lumnCo
unt
;
i
++
)
{
currentColumn
=
columns
[
i
];
[
arrayToSave
addObject
:[
NSArray
arrayWithObjects
:[
currentColumn
identifier
],
[
NSNumber
numberWithFloat
:[
currentColumn
width
]],
nil
]];
}
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
o_
arrayToSave
forKey
:
@"PlaylistColumnSelection"
];
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
arrayToSave
forKey
:
@"PlaylistColumnSelection"
];
[[
NSUserDefaults
standardUserDefaults
]
synchronize
];
}
-
(
BOOL
)
isValidResumeItem
:(
input_item_t
*
)
p_item
{
char
*
psz_url
=
input_item_GetURI
(
p_item
);
NSString
*
o_url_s
tring
=
toNSStr
(
psz_url
);
NSString
*
urlS
tring
=
toNSStr
(
psz_url
);
free
(
psz_url
);
if
([
o_url_s
tring
isEqualToString
:
@""
])
if
([
urlS
tring
isEqualToString
:
@""
])
return
NO
;
NSURL
*
o_url
=
[
NSURL
URLWithString
:
o_url_s
tring
];
NSURL
*
url
=
[
NSURL
URLWithString
:
urlS
tring
];
if
(
!
[
o_
url
isFileURL
])
if
(
!
[
url
isFileURL
])
return
NO
;
BOOL
isDir
=
false
;
if
(
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
o_
url
path
]
isDirectory
:
&
isDir
])
if
(
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
url
path
]
isDirectory
:
&
isDir
])
return
NO
;
if
(
isDir
)
...
...
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