Commit 9e42c869 authored by Benjamin Pracht's avatar Benjamin Pracht

Group selection combo box in stream proprieties dialog. Also allows to create new groups.

parent 7ce614bd
...@@ -366,7 +366,12 @@ ...@@ -366,7 +366,12 @@
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{ {
ACTIONS = {infoCancel = id; infoOk = id; togglePlaylistInfoPanel = id; }; ACTIONS = {
handleGroup = id;
infoCancel = id;
infoOk = id;
togglePlaylistInfoPanel = id;
};
CLASS = VLCPlaylistInfo; CLASS = VLCPlaylistInfo;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = { OUTLETS = {
...@@ -374,6 +379,9 @@ ...@@ -374,6 +379,9 @@
"o_author_txt" = id; "o_author_txt" = id;
"o_btn_cancel" = id; "o_btn_cancel" = id;
"o_btn_ok" = id; "o_btn_ok" = id;
"o_group_cbx" = id;
"o_group_color" = id;
"o_group_lbl" = id;
"o_info_window" = id; "o_info_window" = id;
"o_outline_view" = id; "o_outline_view" = id;
"o_title_lbl" = id; "o_title_lbl" = id;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>486 129 505 517 0 0 1024 746 </string> <string>492 225 505 517 0 0 1024 746 </string>
<key>IBEditorPositions</key> <key>IBEditorPositions</key>
<dict> <dict>
<key>1617</key> <key>1617</key>
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
<array/> <array/>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>1789</integer>
<integer>21</integer> <integer>21</integer>
<integer>1789</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>7F44</string> <string>7F44</string>
......
...@@ -38,11 +38,11 @@ ...@@ -38,11 +38,11 @@
{ {
int i_moveRow; int i_moveRow;
bool b_isSortDescending; bool b_isSortDescending;
IBOutlet id o_window; IBOutlet id o_window;
IBOutlet id o_btn_playlist; IBOutlet id o_btn_playlist;
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_id;
IBOutlet id o_tc_name; IBOutlet id o_tc_name;
...@@ -70,9 +70,9 @@ ...@@ -70,9 +70,9 @@
IBOutlet id o_uri_lbl; IBOutlet id o_uri_lbl;
IBOutlet id o_title_lbl; IBOutlet id o_title_lbl;
IBOutlet id o_author_lbl; IBOutlet id o_author_lbl;
IBOutlet id o_uri_txt; IBOutlet id o_uri_txt;
IBOutlet id o_title_txt; IBOutlet id o_title_txt;
IBOutlet id o_author_txt; IBOutlet id o_author_txt;
IBOutlet id o_btn_info_ok; IBOutlet id o_btn_info_ok;
IBOutlet id o_btn_info_cancel; IBOutlet id o_btn_info_cancel;
IBOutlet id o_tbv_info; IBOutlet id o_tbv_info;
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
/*For playlist info window*/ /*For playlist info window*/
- (int)selectedPlaylistItem; - (int)selectedPlaylistItem;
- (NSColor *)getColor:(int)i_group;
@end @end
...@@ -621,6 +621,53 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -621,6 +621,53 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
return [o_table_view selectedRow]; return [o_table_view selectedRow];
} }
- (NSColor *)getColor:(int)i_group
{
switch ( i_group % 8 )
{
case 1:
/*white*/
return [NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0];
break;
case 2:
/*red*/
return [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:0.76471 alpha:1.0];
break;
case 3:
/*dark blue*/
return [NSColor colorWithDeviceRed:0.76471 green:0.76471 blue:1.0 alpha:1.0];
break;
case 4:
/*orange*/
return [NSColor colorWithDeviceRed:1.0 green:0.89804 blue:0.76471 alpha:1.0];
break;
case 5:
/*purple*/
return [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:1.0 alpha:1.0];
break;
case 6:
/*green*/
return [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:0.76471 alpha:1.0];
break;
case 7:
/*light blue*/
return [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:1.0 alpha:1.0];
break;
case 0:
/*yellow*/
return [NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.76471 alpha:1.0];
break;
}
}
@end @end
@implementation VLCPlaylist (NSTableDataSource) @implementation VLCPlaylist (NSTableDataSource)
...@@ -712,49 +759,10 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -712,49 +759,10 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
if ((p_playlist->i_groups) > 1 ) if ((p_playlist->i_groups) > 1 )
{ {
[o_cell setDrawsBackground: VLC_TRUE]; [o_cell setDrawsBackground: VLC_TRUE];
switch ( p_playlist->pp_items[o_rows]->i_group % 8 ) [o_cell setBackgroundColor:
{ [self getColor:p_playlist->pp_items[o_rows]->i_group]];
case 1:
/*white*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0]];
break;
case 2:
/*red*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:0.76471 alpha:1.0]];
break;
case 3:
/*dark blue*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:0.76471 green:0.76471 blue:1.0 alpha:1.0]];
break;
case 4:
/*orange*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:0.89804 blue:0.76471 alpha:1.0]];
break;
case 5:
/*purple*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:1.0 alpha:1.0]];
break;
case 6:
/*green*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:0.76471 alpha:1.0]];
break;
case 7:
/*light blue*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:1.0 alpha:1.0]];
break;
case 0:
/*yellow*/
[o_cell setBackgroundColor: [NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.76471 alpha:1.0]];
break;
}
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
......
...@@ -39,11 +39,15 @@ ...@@ -39,11 +39,15 @@
IBOutlet id o_btn_info_cancel; IBOutlet id o_btn_info_cancel;
IBOutlet id o_outline_view; IBOutlet id o_outline_view;
IBOutlet id o_vlc_playlist; IBOutlet id o_vlc_playlist;
IBOutlet id o_group_lbl;
IBOutlet id o_group_cbx;
IBOutlet id o_group_color;
} }
- (IBAction)togglePlaylistInfoPanel:(id)sender; - (IBAction)togglePlaylistInfoPanel:(id)sender;
- (IBAction)infoCancel:(id)sender; - (IBAction)infoCancel:(id)sender;
- (IBAction)infoOk:(id)sender; - (IBAction)infoOk:(id)sender;
- (IBAction)handleGroup:(id)sender;
@end @end
......
/***************************************************************************** /*****************************************************************************
* playlistinfo.m: MacOS X interface module r playlistinfo.m: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2004 VideoLAN * Copyright (C) 2002-2004 VideoLAN
* $Id: playlistinfo.m 7015 2004-03-08 15:22:58Z bigben $ * $Id: playlistinfo.m 7015 2004-03-08 15:22:58Z bigben $
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
- (void)awakeFromNib - (void)awakeFromNib
{ {
[o_info_window setExcludedFromWindowsMenu: TRUE]; [o_info_window setExcludedFromWindowsMenu: TRUE];
[o_info_window setTitle: _NS("Properties")]; [o_info_window setTitle: _NS("Properties")];
...@@ -46,6 +45,7 @@ ...@@ -46,6 +45,7 @@
[o_author_lbl setStringValue: _NS("Author")]; [o_author_lbl setStringValue: _NS("Author")];
[o_btn_info_ok setTitle: _NS("OK")]; [o_btn_info_ok setTitle: _NS("OK")];
[o_btn_info_cancel setTitle: _NS("Cancel")]; [o_btn_info_cancel setTitle: _NS("Cancel")];
[o_group_lbl setStringValue: _NS("Group")];
} }
- (IBAction)togglePlaylistInfoPanel:(id)sender - (IBAction)togglePlaylistInfoPanel:(id)sender
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
if (p_playlist) if (p_playlist)
{ {
/*fill uri / title / author info */ /*fill uri / title / author info */
int i;
int i_item = [o_vlc_playlist selectedPlaylistItem]; int i_item = [o_vlc_playlist selectedPlaylistItem];
[o_uri_txt setStringValue: [o_uri_txt setStringValue:
([NSString stringWithUTF8String:p_playlist-> ([NSString stringWithUTF8String:p_playlist->
...@@ -82,10 +83,29 @@ ...@@ -82,10 +83,29 @@
[NSString stringWithUTF8String:p_playlist-> [NSString stringWithUTF8String:p_playlist->
pp_items[i_item]->input.psz_name]]; pp_items[i_item]->input.psz_name]];
[o_author_txt setStringValue:[NSString stringWithUTF8String: playlist_GetInfo(p_playlist, i_item ,_("General"),_("Author") )]]; [o_author_txt setStringValue:
[NSString stringWithUTF8String:playlist_GetInfo
(p_playlist, i_item ,_("General"),_("Author") )]];
[[VLCInfoTreeItem rootItem] refresh]; [[VLCInfoTreeItem rootItem] refresh];
[o_outline_view reloadData]; [o_outline_view reloadData];
[o_group_cbx removeAllItems];
for (i = 0; i < p_playlist->i_groups ; i++)
{
[o_group_cbx addItemWithObjectValue:
[NSString stringWithUTF8String:
p_playlist->pp_groups[i]->psz_name]];
if (p_playlist->pp_items[i_item]->i_group == p_playlist
->pp_groups[i]->i_id)
{
[o_group_cbx selectItemAtIndex:i];
}
}
[self handleGroup:self];
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
[o_info_window makeKeyAndOrderFront: sender]; [o_info_window makeKeyAndOrderFront: sender];
...@@ -115,7 +135,21 @@ ...@@ -115,7 +135,21 @@
p_playlist->pp_items[i_item]->input.psz_name = p_playlist->pp_items[i_item]->input.psz_name =
strdup([[o_title_txt stringValue] cString]); strdup([[o_title_txt stringValue] cString]);
playlist_ItemAddInfo(p_playlist->pp_items[i_item],_("General"),_("Author"), [[o_author_txt stringValue] cString]); playlist_ItemAddInfo(p_playlist->pp_items[i_item],_("General"),_("Author"), [[o_author_txt stringValue] cString]);
if ([[o_group_cbx stringValue] isEqual:
[o_group_cbx objectValueOfSelectedItem]])
{
p_playlist->pp_items[i_item]->i_group = p_playlist->
pp_groups[[o_group_cbx indexOfSelectedItem]]->i_id;
}
else
{
playlist_group_t * p_group = playlist_CreateGroup( p_playlist,
strdup([[o_group_cbx stringValue] cString]));
p_playlist->pp_items[i_item]->i_group = p_group->i_id;
}
vlc_mutex_unlock(&p_playlist->pp_items[i_item]->input.lock); vlc_mutex_unlock(&p_playlist->pp_items[i_item]->input.lock);
val.b_bool = VLC_TRUE; val.b_bool = VLC_TRUE;
var_Set( p_playlist,"intf-change",val ); var_Set( p_playlist,"intf-change",val );
...@@ -124,6 +158,30 @@ ...@@ -124,6 +158,30 @@
[self togglePlaylistInfoPanel:self]; [self togglePlaylistInfoPanel:self];
} }
- (IBAction)handleGroup:(id)sender
{
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if (p_playlist)
{
if ([[o_group_cbx stringValue] isEqual:
[o_group_cbx objectValueOfSelectedItem]])
{
[o_group_color setBackgroundColor:[o_vlc_playlist
getColor: p_playlist->pp_groups[
[o_group_cbx indexOfSelectedItem]]->i_id]];
}
else
{
[o_group_color setBackgroundColor:[o_vlc_playlist
getColor:p_playlist->pp_groups[
[o_group_cbx numberOfItems] - 1]->i_id + 1]];
}
vlc_object_release(p_playlist);
}
}
@end @end
......
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