Commit 9ec6a03f authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: create playlist columns at runtime instead of relying on the nib file

This adds support for the following columns: Track Number, Genre, Album, Description, Date and Language. You can remove and hide them on-the-fly using the Playback menu, since no View menu exists so far.

note that column width and column selection isn't restored on relaunch yet
parent 22495438
......@@ -107,6 +107,16 @@
IBOutlet NSMenu * o_mu_chapter;
IBOutlet NSMenuItem * o_mi_toggleJumpButtons;
IBOutlet NSMenuItem * o_mi_togglePlaymodeButtons;
IBOutlet NSMenu * o_mu_playlistTableColumns;
IBOutlet NSMenuItem * o_mi_ptc_tracknum;
IBOutlet NSMenuItem * o_mi_ptc_title;
IBOutlet NSMenuItem * o_mi_ptc_artist;
IBOutlet NSMenuItem * o_mi_ptc_duration;
IBOutlet NSMenuItem * o_mi_ptc_genre;
IBOutlet NSMenuItem * o_mi_ptc_album;
IBOutlet NSMenuItem * o_mi_ptc_description;
IBOutlet NSMenuItem * o_mi_ptc_date;
IBOutlet NSMenuItem * o_mi_ptc_language;
IBOutlet NSMenu * o_mu_audio;
IBOutlet NSMenuItem * o_mi_vol_up;
......@@ -219,6 +229,8 @@
- (void)updatePlaybackRate;
- (IBAction)toggleJumpButtons:(id)sender;
- (IBAction)togglePlaymodeButtons:(id)sender;
- (IBAction)togglePlaylistColumnTable:(id)sender;
- (void)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column;
- (IBAction)toggleFullscreen:(id)sender;
- (IBAction)resizeVideoWindow:(id)sender;
......
......@@ -36,6 +36,7 @@
#import "simple_prefs.h"
#import "coredialogs.h"
#import "controls.h"
#import "playlist.h"
#import "playlistinfo.h"
#import "VideoView.h"
#import "CoreInteraction.h"
......@@ -290,6 +291,16 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_toggleJumpButtons setState: config_GetInt( VLCIntf, "macosx-show-playback-buttons")];
[o_mi_togglePlaymodeButtons setTitle: _NS("Show Shuffle & Repeat Buttons")];
[o_mi_togglePlaymodeButtons setState: config_GetInt( VLCIntf, "macosx-show-playmode-buttons")];
[o_mu_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[o_mi_ptc_tracknum setTitle: _NS("Track Number")];
[o_mi_ptc_title setTitle: _NS("Title")];
[o_mi_ptc_artist setTitle: _NS("Artist")];
[o_mi_ptc_duration setTitle: _NS("Duration")];
[o_mi_ptc_genre setTitle: _NS("Genre")];
[o_mi_ptc_album setTitle: _NS("Album")];
[o_mi_ptc_description setTitle: _NS("Description")];
[o_mi_ptc_date setTitle: _NS("Date")];
[o_mi_ptc_language setTitle: _NS("Language")];
[o_mi_program setTitle: _NS("Program")];
[o_mu_program setTitle: _NS("Program")];
......@@ -634,6 +645,56 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_togglePlaymodeButtons setState: b_value];
}
- (IBAction)togglePlaylistColumnTable:(id)sender
{
[sender setState: ![sender state]];
NSString * o_column;
if (sender == o_mi_ptc_tracknum)
o_column = TRACKNUM_COLUMN;
else if (sender == o_mi_ptc_title)
o_column = TITLE_COLUMN;
else if (sender == o_mi_ptc_artist)
o_column = ARTIST_COLUMN;
else if (sender == o_mi_ptc_duration)
o_column = DURATION_COLUMN;
else if (sender == o_mi_ptc_genre)
o_column = GENRE_COLUMN;
else if (sender == o_mi_ptc_album)
o_column = ALBUM_COLUMN;
else if (sender == o_mi_ptc_description)
o_column = DESCRIPTION_COLUMN;
else if (sender == o_mi_ptc_date)
o_column = DATE_COLUMN;
else if (sender == o_mi_ptc_language)
o_column = LANGUAGE_COLUMN;
[[[VLCMain sharedInstance] playlist] setColumn: o_column state: [sender state]];
}
- (void)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column
{
if ([o_column isEqualToString: TRACKNUM_COLUMN])
[o_mi_ptc_tracknum setState: i_state];
else if ([o_column isEqualToString: TITLE_COLUMN])
[o_mi_ptc_title setState: i_state];
else if ([o_column isEqualToString: ARTIST_COLUMN])
[o_mi_ptc_artist setState: i_state];
else if ([o_column isEqualToString: DURATION_COLUMN])
[o_mi_ptc_duration setState: i_state];
else if ([o_column isEqualToString: GENRE_COLUMN])
[o_mi_ptc_genre setState: i_state];
else if ([o_column isEqualToString: ALBUM_COLUMN])
[o_mi_ptc_album setState: i_state];
else if ([o_column isEqualToString: DESCRIPTION_COLUMN])
[o_mi_ptc_description setState: i_state];
else if ([o_column isEqualToString: DATE_COLUMN])
[o_mi_ptc_date setState: i_state];
else if ([o_column isEqualToString: LANGUAGE_COLUMN])
[o_mi_ptc_language setState: i_state];
}
#pragma mark -
#pragma mark video menu
- (IBAction)toggleFullscreen:(id)sender
......
......@@ -25,6 +25,17 @@
#import "PXSourceList.h"
/* playlist column definitions */
#define TRACKNUM_COLUMN @"tracknumber"
#define TITLE_COLUMN @"name"
#define ARTIST_COLUMN @"artist"
#define DURATION_COLUMN @"duration"
#define GENRE_COLUMN @"genre"
#define ALBUM_COLUMN @"album"
#define DESCRIPTION_COLUMN @"description"
#define DATE_COLUMN @"date"
#define LANGUAGE_COLUMN @"language"
/*****************************************************************************
* VLCPlaylistView interface
*****************************************************************************/
......@@ -39,9 +50,6 @@
*****************************************************************************/
@interface VLCPlaylistCommon : NSObject <NSOutlineViewDataSource, NSOutlineViewDelegate>
{
IBOutlet id o_tc_name;
IBOutlet id o_tc_author;
IBOutlet id o_tc_duration;
IBOutlet VLCPlaylistView* o_outline_view;
IBOutlet id o_tc_name_other;
......@@ -55,10 +63,10 @@
- (void)setPlaylistRoot: (playlist_item_t *)root_item;
- (playlist_item_t *)currentPlaylistRoot;
- (void)initStrings;
- (playlist_item_t *)selectedPlaylistItem;
- (NSOutlineView *)outlineView;
- (void)swapPlaylists:(id)newList;
- (void)setColumn: (NSString *)o_column state: (NSInteger)i_state;
@end
/*****************************************************************************
......@@ -143,5 +151,4 @@
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue;
@end
This diff is collapsed.
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