* playlist.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
- * $Id: playlist.h,v 1.22 2004/03/03 11:34:19 bigben Exp $
+ * $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
IBOutlet id o_ctx_menu;
IBOutlet id o_mi_save_playlist;
+ IBOutlet id o_mi_info;
IBOutlet id o_mi_play;
IBOutlet id o_mi_delete;
IBOutlet id o_mi_selectall;
IBOutlet id o_loop_popup;
+/*For playlist info window*/
+
+ IBOutlet id o_info_window;
+ IBOutlet id o_uri_lbl;
+ IBOutlet id o_title_lbl;
+ IBOutlet id o_author_lbl;
+ IBOutlet id o_uri_txt;
+ IBOutlet id o_title_txt;
+ IBOutlet id o_author_txt;
+ IBOutlet id o_btn_info_ok;
+ IBOutlet id o_btn_info_cancel;
+
NSImage *o_descendingSortingImage;
NSImage *o_ascendingSortingImage;
-
}
- (void)initStrings;
- (void)updateRowSelection;
- (void)playlistUpdated;
+/*For playlist info window*/
+
+- (IBAction)togglePlaylistInfoPanel:(id)sender;
+- (IBAction)infoCancel:(id)sender;
+- (IBAction)infoOk:(id)sender;
+
@end
* playlist.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2004 VideoLAN
- * $Id: playlist.m,v 1.59 2004/03/03 11:34:19 bigben Exp $
+ * $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org>
[NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
[o_table_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
[o_window setExcludedFromWindowsMenu: TRUE];
-
+ [o_info_window setExcludedFromWindowsMenu: TRUE];
/* We need to check whether _defaultTableHeaderSortImage exists, since it
belongs to an Apple hidden private API, and then can "disapear" at any time*/
[o_mi_play setTitle: _NS("Play")];
[o_mi_delete setTitle: _NS("Delete")];
[o_mi_selectall setTitle: _NS("Select All")];
+ [o_mi_info setTitle: _NS("Proprieties")];
[[o_tc_name headerCell] setStringValue:_NS("Name")];
[[o_tc_author headerCell] setStringValue:_NS("Author")];
[[o_tc_duration headerCell] setStringValue:_NS("Duration")];
[[o_loop_popup itemAtIndex:0] setTitle: _NS("Standard Play")];
[[o_loop_popup itemAtIndex:1] setTitle: _NS("Repeat One")];
[[o_loop_popup itemAtIndex:2] setTitle: _NS("Repeat All")];
+
+ [o_info_window setTitle: _NS("Proprieties")];
+ [o_uri_lbl setStringValue: _NS("URI")];
+ [o_title_lbl setStringValue: _NS("Title")];
+ [o_author_lbl setStringValue: _NS("Author")];
+ [o_btn_info_ok setTitle: _NS("OK")];
+ [o_btn_info_cancel setTitle: _NS("Cancel")];
}
- (void) tableView:(NSTableView*)o_tv
[o_mi_play setEnabled: b_item_sel];
[o_mi_delete setEnabled: b_item_sel];
[o_mi_selectall setEnabled: b_rows];
+ [o_mi_info setEnabled: b_item_sel];
return( o_ctx_menu );
}
[o_table_view scrollRowToVisible: i_row];
}
+/*For info window*/
+
+- (IBAction)togglePlaylistInfoPanel:(id)sender
+{
+ intf_thread_t * p_intf = [NSApp getIntf];
+ playlist_t * p_playlist;
+ if( [o_info_window isVisible] )
+ {
+ [o_info_window orderOut: sender];
+ }
+ else
+ {
+ p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+
+ if (p_playlist)
+ {
+ int i_item = [o_table_view selectedRow];
+ [o_uri_txt setStringValue:[NSString stringWithUTF8String: p_playlist->pp_items[i_item]->psz_uri]];
+ [o_title_txt setStringValue:[NSString stringWithUTF8String: p_playlist->pp_items[i_item]->psz_name]];
+ [o_author_txt setStringValue:[NSString stringWithUTF8String: playlist_GetInfo(p_playlist, i_item ,_("General"),_("Author") )]];
+ vlc_object_release ( p_playlist );
+ }
+ [o_info_window makeKeyAndOrderFront: sender];
+ }
+}
+
+- (IBAction)infoCancel:(id)sender
+{
+ [self togglePlaylistInfoPanel:self];
+}
+
+- (IBAction)infoOk:(id)sender
+{
+ int i_item = [o_table_view selectedRow];
+ intf_thread_t * p_intf = [NSApp getIntf];
+ playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ if (p_playlist)
+ {
+ vlc_mutex_lock(&p_playlist->pp_items[i_item]->lock);
+
+ p_playlist->pp_items[i_item]->psz_uri = strdup([[o_uri_txt stringValue] cString]);
+ p_playlist->pp_items[i_item]->psz_name = strdup([[o_title_txt stringValue] cString]);
+ playlist_ItemAddInfo(p_playlist->pp_items[i_item],_("General"),_("Author"), [[o_author_txt stringValue] cString]);
+
+ vlc_mutex_unlock(&p_playlist->pp_items[i_item]->lock);
+ vlc_object_release ( p_playlist );
+ }
+ [self togglePlaylistInfoPanel:self];
+ [self playlistUpdated];
+}
+
@end