Commit cbd4b6ac authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Added sortID

* Fixed adding multiple items
* playlist API changes fixes
* fixed options
parent f1e0ca60
...@@ -351,6 +351,7 @@ ...@@ -351,6 +351,7 @@
"o_table_view" = id; "o_table_view" = id;
"o_tc_author" = id; "o_tc_author" = id;
"o_tc_duration" = id; "o_tc_duration" = id;
"o_tc_id" = id;
"o_tc_name" = id; "o_tc_name" = id;
"o_window" = id; "o_window" = id;
}; };
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
<array/> <array/>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>1647</integer>
<integer>1617</integer>
<integer>984</integer>
<integer>21</integer> <integer>21</integer>
<integer>984</integer>
<integer>1617</integer>
<integer>1647</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>7D24</string> <string>7D24</string>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.h: MacOS X interface module * playlist.h: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2004 VideoLAN * Copyright (C) 2002-2004 VideoLAN
* $Id: playlist.h,v 1.20 2004/01/25 17:01:57 murray Exp $ * $Id: playlist.h,v 1.21 2004/02/06 04:51:02 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org> * Derk-Jan Hartman <hartman at videolan dot org>
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
IBOutlet id o_table_view; IBOutlet id o_table_view;
IBOutlet id o_status_field; IBOutlet id o_status_field;
IBOutlet id o_tc_id;
IBOutlet id o_tc_name; IBOutlet id o_tc_name;
IBOutlet id o_tc_author; IBOutlet id o_tc_author;
IBOutlet id o_tc_duration; IBOutlet id o_tc_duration;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface module * playlist.m: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2004 VideoLAN * Copyright (C) 2002-2004 VideoLAN
* $Id: playlist.m,v 1.55 2004/01/25 17:01:57 murray Exp $ * $Id: playlist.m,v 1.56 2004/02/06 04:51:02 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videolan dot org> * Derk-Jan Hartman <hartman at videolan dot org>
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
/* We need to check whether _defaultTableHeaderSortImage exists, since it /* We need to check whether _defaultTableHeaderSortImage exists, since it
belongs to an Apple hidden private API, and then can "disapear" at any time*/ belongs to an Apple hidden private API, and then can "disapear" at any time*/
if ([[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderSortImage)]) if( [[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderSortImage)] )
{ {
o_ascendingSortingImage = [[NSTableView class] _defaultTableHeaderSortImage]; o_ascendingSortingImage = [[NSTableView class] _defaultTableHeaderSortImage];
} }
...@@ -147,7 +147,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -147,7 +147,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
o_ascendingSortingImage = nil; o_ascendingSortingImage = nil;
} }
if ([[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)]) if( [[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)] )
{ {
o_descendingSortingImage = [[NSTableView class] _defaultTableHeaderReverseSortImage]; o_descendingSortingImage = [[NSTableView class] _defaultTableHeaderReverseSortImage];
} }
...@@ -192,39 +192,50 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -192,39 +192,50 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
return; return;
} }
if (o_tc_sortColumn == o_tc ) if( o_tc_sortColumn == o_tc )
{ {
b_isSortDescending = !b_isSortDescending; b_isSortDescending = !b_isSortDescending;
} }
else if (o_tc == o_tc_name || o_tc == o_tc_author) else if( o_tc == o_tc_name || o_tc == o_tc_author ||
o_tc == o_tc_id )
{ {
b_isSortDescending = VLC_FALSE; b_isSortDescending = VLC_FALSE;
[o_table_view setHighlightedTableColumn:o_tc]; [o_table_view setHighlightedTableColumn:o_tc];
o_tc_sortColumn = o_tc; o_tc_sortColumn = o_tc;
for (i=0;i<max;i++) for( i=0 ; i<max ; i++ )
{ {
[o_table_view setIndicatorImage:nil inTableColumn:[[o_table_view tableColumns] objectAtIndex:i]]; [o_table_view setIndicatorImage:nil inTableColumn:[[o_table_view tableColumns] objectAtIndex:i]];
} }
} }
if (o_tc_name == o_tc && !b_isSortDescending) if( o_tc_id == o_tc && !b_isSortDescending )
{ {
playlist_SortTitle( p_playlist , 0 ); playlist_SortID( p_playlist , ORDER_NORMAL );
[o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc]; [o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];
} }
else if (o_tc_author == o_tc && !b_isSortDescending) else if( o_tc_name == o_tc && !b_isSortDescending )
{ {
playlist_SortAuthor( p_playlist , 0 ); playlist_SortTitle( p_playlist , ORDER_NORMAL );
[o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc]; [o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];
} }
else if (o_tc_name == o_tc && b_isSortDescending) else if( o_tc_author == o_tc && !b_isSortDescending )
{ {
playlist_SortTitle( p_playlist , 1 ); playlist_SortAuthor( p_playlist , ORDER_NORMAL );
[o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];
}
else if( o_tc_id == o_tc && b_isSortDescending )
{
playlist_SortID( p_playlist , ORDER_REVERSE );
[o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];
}
else if( o_tc_name == o_tc && b_isSortDescending )
{
playlist_SortTitle( p_playlist , ORDER_REVERSE );
[o_table_view setIndicatorImage:o_descendingSortingImage inTableColumn:o_tc]; [o_table_view setIndicatorImage:o_descendingSortingImage inTableColumn:o_tc];
} }
else if (o_tc_author == o_tc && b_isSortDescending) else if( o_tc_author == o_tc && b_isSortDescending )
{ {
playlist_SortAuthor( p_playlist , 1 ); playlist_SortAuthor( p_playlist , ORDER_REVERSE );
[o_table_view setIndicatorImage:o_descendingSortingImage inTableColumn:o_tc]; [o_table_view setIndicatorImage:o_descendingSortingImage inTableColumn:o_tc];
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -423,12 +434,13 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -423,12 +434,13 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
{ {
/* One item */ /* One item */
NSDictionary *o_one_item; NSDictionary *o_one_item;
int j, i_new_id = -1; int j, i_total_options = 0, i_new_id = -1;
int i_mode = PLAYLIST_INSERT; int i_mode = PLAYLIST_INSERT;
BOOL b_rem = FALSE, b_dir = FALSE; BOOL b_rem = FALSE, b_dir = FALSE;
NSString *o_uri, *o_name; NSString *o_uri, *o_name;
NSArray *o_options; NSArray *o_options;
NSURL *o_true_file; NSURL *o_true_file;
char **ppsz_options = NULL;
/* Get the item */ /* Get the item */
o_one_item = [o_array objectAtIndex: i_item]; o_one_item = [o_array objectAtIndex: i_item];
...@@ -456,26 +468,31 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -456,26 +468,31 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
o_uri = [NSString stringWithCString: psz_dev ]; o_uri = [NSString stringWithCString: psz_dev ];
} }
/* Add the item */ if( o_options && [o_options count] > 0 )
i_new_id = playlist_Add( p_playlist, [o_uri fileSystemRepresentation],
[o_name UTF8String], i_mode,
i_position == -1 ? PLAYLIST_END : i_position + i_item);
/* Add the options, when there are any */
if( o_options )
{ {
for( j = 0; j < [o_options count]; j++ ) /* Count the input options */
i_total_options = [o_options count];
/* Allocate ppsz_options */
for( j = 0; j < i_total_options; j++ )
{ {
playlist_AddOption( p_playlist, i_new_id, if( !ppsz_options )
strdup( [[o_options objectAtIndex:j] UTF8String] ) ); ppsz_options = (char **)malloc( sizeof(char *) * i_total_options );
ppsz_options[j] = strdup([[o_options objectAtIndex:j] UTF8String]);
} }
} }
if( i_item == 0 && !b_enqueue ) /* Add the item */
{ i_new_id = playlist_AddExt( p_playlist, [o_uri fileSystemRepresentation],
playlist_Goto( p_playlist, playlist_GetPositionById( p_playlist, i_new_id ) ); [o_name UTF8String], i_mode,
playlist_Play( p_playlist ); i_position == -1 ? PLAYLIST_END : i_position + i_item,
} 0, (ppsz_options != NULL ) ? (const char **)ppsz_options : 0, i_total_options );
/* clean up
for( j = 0; j < i_total_options; j++ )
free( ppsz_options[j] );
if( ppsz_options ) free( ppsz_options ); */
/* Recent documents menu */ /* Recent documents menu */
o_true_file = [NSURL fileURLWithPath: o_uri]; o_true_file = [NSURL fileURLWithPath: o_uri];
...@@ -484,6 +501,12 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -484,6 +501,12 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
[[NSDocumentController sharedDocumentController] [[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL: o_true_file]; noteNewRecentDocumentURL: o_true_file];
} }
if( i_item == 0 && !b_enqueue )
{
playlist_Goto( p_playlist, playlist_GetPositionById( p_playlist, i_new_id ) );
playlist_Play( p_playlist );
}
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
......
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