From: Benjamin Pracht Date: Sat, 29 Apr 2006 20:48:44 +0000 (+0000) Subject: * Support for saving xspf playlist files X-Git-Tag: 0.9.0-test0~11370 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=d216605aa6d112334cbdefa551f0c27e4e4862eb;p=vlc * Support for saving xspf playlist files --- diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib index 2af33c3382..cd3dedb63f 100644 --- a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib +++ b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib @@ -371,6 +371,9 @@ "o_outline_view" = id; "o_playlist_view" = id; "o_random_ckb" = id; + "o_save_accessory_popup" = id; + "o_save_accessory_text" = id; + "o_save_accessory_view" = id; "o_search_field" = id; "o_status_field" = id; "o_tc_author" = id; diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib index 0532525c50..bdb24bbde4 100644 --- a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib +++ b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib @@ -3,13 +3,15 @@ IBDocumentLocation - 43 22 478 430 0 0 1024 746 + 90 147 478 430 0 0 1024 746 IBEditorPositions 1617 788 586 109 149 0 0 1440 878 2197 - 422 532 596 143 0 0 1440 878 + 172 420 596 143 0 0 1024 746 + 2709 + 305 626 508 82 0 0 1024 746 29 76 675 438 44 0 0 1024 746 915 @@ -24,6 +26,6 @@ 21 IBSystem Version - 8H14 + 8I127 diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib index bf6ca62094..01ab78dd2b 100644 Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/modules/gui/macosx/playlist.h b/modules/gui/macosx/playlist.h index 565722ca6b..67ecdf3cc8 100644 --- a/modules/gui/macosx/playlist.h +++ b/modules/gui/macosx/playlist.h @@ -96,6 +96,11 @@ IBOutlet id o_mm_mi_services; IBOutlet id o_mm_mu_services; + IBOutlet id o_save_accessory_view; + IBOutlet id o_save_accessory_popup; + IBOutlet id o_save_accessory_text; + + NSImage *o_descendingSortingImage; NSImage *o_ascendingSortingImage; diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m index 91137e387c..4cada240cc 100644 --- a/modules/gui/macosx/playlist.m +++ b/modules/gui/macosx/playlist.m @@ -112,7 +112,7 @@ o_outline_dict = [[NSMutableDictionary alloc] init]; } return self; -} +} - (void)awakeFromNib { playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, @@ -498,6 +498,10 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ [[o_loop_popup itemAtIndex:1] setTitle: _NS("Repeat One")]; [[o_loop_popup itemAtIndex:2] setTitle: _NS("Repeat All")]; [o_mi_addNode setTitle: _NS("Add Folder to Playlist")]; + + [o_save_accessory_text setStringValue: _NS("File Format:")]; + [[o_save_accessory_popup itemAtIndex:0] setTitle: _NS("Extended M3U")]; + [[o_save_accessory_popup itemAtIndex:1] setTitle: _NS("XML Shareable Playlist Format (XSPF)")]; } - (void)playlistUpdated @@ -745,19 +749,58 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ FIND_ANYWHERE ); NSSavePanel *o_save_panel = [NSSavePanel savePanel]; - NSString * o_name = [NSString stringWithFormat: @"%@.m3u", _NS("Untitled")]; + NSString * o_name = [NSString stringWithFormat: @"%@", _NS("Untitled")]; + + //[o_save_panel setAllowedFileTypes: [NSArray arrayWithObjects: @"m3u", @"xpf", nil] ]; [o_save_panel setTitle: _NS("Save Playlist")]; [o_save_panel setPrompt: _NS("Save")]; + [o_save_panel setAccessoryView: o_save_accessory_view]; if( [o_save_panel runModalForDirectory: nil file: o_name] == NSOKButton ) { - playlist_Export( p_playlist, [[o_save_panel filename] fileSystemRepresentation], "export-m3u" ); + NSString *o_filename = [o_save_panel filename]; + + if( [o_save_accessory_popup indexOfSelectedItem] == 1 ) + { + NSString * o_real_filename; + NSRange range; + range.location = [o_filename length] - [@".xspf" length]; + range.length = [@".xspf" length]; + + if( [o_filename compare:@".xspf" options: NSCaseInsensitiveSearch + range: range] != NSOrderedSame ) + { + o_real_filename = [NSString stringWithFormat: @"%@.xspf", o_filename]; + } + else + { + o_real_filename = o_filename; + } + playlist_Export( p_playlist, [o_real_filename fileSystemRepresentation], "export-xspf" ); + } + else + { + NSString * o_real_filename; + NSRange range; + range.location = [o_filename length] - [@".m3u" length]; + range.length = [@".m3u" length]; + + if( [o_filename compare:@".m3u" options: NSCaseInsensitiveSearch + range: range] != NSOrderedSame ) + { + o_real_filename = [NSString stringWithFormat: @"%@.m3u", o_filename]; + } + else + { + o_real_filename = o_filename; + } + playlist_Export( p_playlist, [o_real_filename fileSystemRepresentation], "export-m3u" ); + } } vlc_object_release( p_playlist ); } - /* When called retrieves the selected outlineview row and plays that node or item */ - (IBAction)playItem:(id)sender {