Commit d4ec3a04 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fix playlist column creation and customization

parent 68827bcd
...@@ -81,32 +81,6 @@ ...@@ -81,32 +81,6 @@
#pragma mark - Initialization #pragma mark - Initialization
- (id)init
{
self = [super init];
if (self) {
_translationsForPlaylistTableColumns = [[NSDictionary alloc] initWithObjectsAndKeys:
_NS("Track Number"), TRACKNUM_COLUMN,
_NS("Title"), TITLE_COLUMN,
_NS("Author"), ARTIST_COLUMN,
_NS("Duration"), DURATION_COLUMN,
_NS("Genre"), GENRE_COLUMN,
_NS("Album"), ALBUM_COLUMN,
_NS("Description"), DESCRIPTION_COLUMN,
_NS("Date"), DATE_COLUMN,
_NS("Language"), LANGUAGE_COLUMN,
_NS("URI"), URI_COLUMN,
_NS("File Size"), FILESIZE_COLUMN,
nil];
// this array also assigns tags (index) to type of menu item
_menuOrderOfPlaylistTableColumns = [[NSArray alloc] initWithObjects: TRACKNUM_COLUMN, TITLE_COLUMN,
ARTIST_COLUMN, DURATION_COLUMN, GENRE_COLUMN, ALBUM_COLUMN,
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN,
FILESIZE_COLUMN,nil];
}
return self;
}
- (void)dealloc - (void)dealloc
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
...@@ -127,6 +101,25 @@ ...@@ -127,6 +101,25 @@
[self setRateControlsEnabled:NO]; [self setRateControlsEnabled:NO];
_translationsForPlaylistTableColumns = [[NSDictionary alloc] initWithObjectsAndKeys:
_NS("Track Number"), TRACKNUM_COLUMN,
_NS("Title"), TITLE_COLUMN,
_NS("Author"), ARTIST_COLUMN,
_NS("Duration"), DURATION_COLUMN,
_NS("Genre"), GENRE_COLUMN,
_NS("Album"), ALBUM_COLUMN,
_NS("Description"), DESCRIPTION_COLUMN,
_NS("Date"), DATE_COLUMN,
_NS("Language"), LANGUAGE_COLUMN,
_NS("URI"), URI_COLUMN,
_NS("File Size"), FILESIZE_COLUMN,
nil];
// this array also assigns tags (index) to type of menu item
_menuOrderOfPlaylistTableColumns = [[NSArray alloc] initWithObjects: TRACKNUM_COLUMN, TITLE_COLUMN,
ARTIST_COLUMN, DURATION_COLUMN, GENRE_COLUMN, ALBUM_COLUMN,
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN,
FILESIZE_COLUMN,nil];
#ifdef HAVE_SPARKLE #ifdef HAVE_SPARKLE
[_checkForUpdate setAction:@selector(checkForUpdates:)]; [_checkForUpdate setAction:@selector(checkForUpdates:)];
[_checkForUpdate setTarget:[SUUpdater sharedUpdater]]; [_checkForUpdate setTarget:[SUUpdater sharedUpdater]];
...@@ -376,7 +369,7 @@ ...@@ -376,7 +369,7 @@
[_toggleEffectsButton setState: config_GetInt(VLCIntf, "macosx-show-effects-button")]; [_toggleEffectsButton setState: config_GetInt(VLCIntf, "macosx-show-effects-button")];
[_toggleSidebar setTitle: _NS("Show Sidebar")]; [_toggleSidebar setTitle: _NS("Show Sidebar")];
[_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")]; [_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")];
[_playlistTableColumnsMenu setTitle: _NS("Playlist Table Columns")]; [self setupPlaylistTableColumnsForMenu:_playlistTableColumnsMenu];
[_playlistTableColumns setTitle: _NS("Playlist Table Columns")]; [_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[_controlsMenu setTitle: _NS("Playback")]; [_controlsMenu setTitle: _NS("Playback")];
...@@ -513,20 +506,17 @@ ...@@ -513,20 +506,17 @@
- (NSMenu *)setupPlaylistTableColumnsMenu - (NSMenu *)setupPlaylistTableColumnsMenu
{ {
NSMenu *contextMenu = [[NSMenu alloc] init]; NSMenu *contextMenu = [[NSMenu alloc] init];
[self setupPlaylistTableColumnsForMenu:contextMenu];
return contextMenu;
}
- (void)setupPlaylistTableColumnsForMenu:(NSMenu *)menu
{
NSMenuItem *menuItem; NSMenuItem *menuItem;
NSUInteger count = [_menuOrderOfPlaylistTableColumns count]; NSUInteger count = [_menuOrderOfPlaylistTableColumns count];
for (NSUInteger i = 0; i < count; i++) { for (NSUInteger i = 0; i < count; i++) {
NSString *title = [_translationsForPlaylistTableColumns objectForKey:[_menuOrderOfPlaylistTableColumns objectAtIndex:i]]; NSString *title = [_translationsForPlaylistTableColumns objectForKey:[_menuOrderOfPlaylistTableColumns objectAtIndex:i]];
menuItem = [_playlistTableColumnsMenu addItemWithTitle:title menuItem = [menu addItemWithTitle:title
action:@selector(togglePlaylistColumnTable:)
keyEquivalent:@""];
/* don't set a valid target for the title column selector, since we want it to be disabled */
if (![[_menuOrderOfPlaylistTableColumns objectAtIndex:i] isEqualToString: TITLE_COLUMN])
[menuItem setTarget:self];
[menuItem setTag:i];
menuItem = [contextMenu addItemWithTitle:title
action:@selector(togglePlaylistColumnTable:) action:@selector(togglePlaylistColumnTable:)
keyEquivalent:@""]; keyEquivalent:@""];
/* don't set a valid target for the title column selector, since we want it to be disabled */ /* don't set a valid target for the title column selector, since we want it to be disabled */
...@@ -534,9 +524,6 @@ ...@@ -534,9 +524,6 @@
[menuItem setTarget:self]; [menuItem setTarget:self];
[menuItem setTag:i]; [menuItem setTag:i];
} }
if (!_playlistTableColumnsContextMenu)
_playlistTableColumnsContextMenu = contextMenu;
return contextMenu;
} }
#pragma mark - Termination #pragma mark - Termination
......
...@@ -202,6 +202,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -202,6 +202,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"]; NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"];
[defaults registerDefaults:appDefaults]; [defaults registerDefaults:appDefaults];
_mainmenu = [[VLCMainMenu alloc] init];
_voutController = [[VLCVoutWindowController alloc] init]; _voutController = [[VLCVoutWindowController alloc] init];
} }
...@@ -224,7 +225,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -224,7 +225,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
[NSBundle loadNibNamed:@"MainWindow" owner:self]; [NSBundle loadNibNamed:@"MainWindow" owner:self];
[[self mainWindow] makeKeyAndOrderFront:nil]; [[self mainWindow] makeKeyAndOrderFront:nil];
_open = [[VLCOpen alloc] init]; _open = [[VLCOpen alloc] init];
_mainmenu = [[VLCMainMenu alloc] init];
_coreinteraction = [VLCCoreInteraction sharedInstance]; _coreinteraction = [VLCCoreInteraction sharedInstance];
playlist_t * p_playlist = pl_Get(VLCIntf); playlist_t * p_playlist = pl_Get(VLCIntf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment