Commit 99fca8b4 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Remove VLCPlaylistDataSource which was never distributed as public API and...

Remove VLCPlaylistDataSource which was never distributed as public API and should not be part of the framework but the client app
parent 83aba34c
/*****************************************************************************
* VLCPlaylistDataSource.h: VLC.framework VLCPlaylistDataSource header
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <VLC/VLCPlaylist.h>
#import <VLC/VLCVideoView.h>
/**
* This class can be used as a data source for an NSOutlineView
* it will display the playlist content. If provided the videoView
* will automatically be associated to the given playlist, and actions
* in the outlineView will trigger the videoView, visual feedback of the
* current item in the videoview will be displayed in the outlineview
*/
@interface VLCPlaylistDataSource : NSObject
{
VLCPlaylist * playlist;
VLCVideoView * videoView;
NSOutlineView *outlineView;
}
- (id)initWithPlaylist:(VLCPlaylist *)aPlaylist;
- (id)initWithPlaylist:(VLCPlaylist *)aPlaylist videoView:(VLCVideoView *)aVideoView;
- (VLCPlaylist *)playlist;
- (VLCVideoView *)videoView;
@end
/* It could be really useful to use that, this probably need to be reviewed to see
* if it really belongs here */
@interface VLCPlaylistDataSource (OutlineViewDataSource)
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
@end
@interface VLCPlaylistDataSource (OutlineViewDataSourceDropping)
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index;
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index;
@end
......@@ -80,6 +80,7 @@ Removed APIs:
- videoTracks
- videoSubTitles
- VLCServicesDiscoverer
- VLCPlaylistDataSource
Version 2.2.2:
--------------
......
/*****************************************************************************
* VLCPlaylistDataSource.m: VLC.framework VLCPlaylistDataSource implementation
*****************************************************************************
* Copyright (C) 2007 Pierre d'Herbemont
* Copyright (C) 2007 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <VLC/VLCPlaylistDataSource.h>
#import "VLCEventManager.h"
@implementation VLCPlaylistDataSource
- (id)init
{
if (self = [super init])
{
playlist = nil;
videoView = nil;
}
return self;
}
- (id)initWithPlaylist:(VLCPlaylist *)aPlaylist
{
if (self = [super init])
{
playlist = [aPlaylist retain];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(playlistDidChange:) name:VLCPlaylistItemAdded object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(itemDidAddSubitem:) name:VLCMediaSubItemAdded object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(itemDidChange:) name:VLCPlaylistItemChanged object:nil];
videoView = nil;
outlineView = nil;
}
return self;
}
- (id)initWithPlaylist:(VLCPlaylist *)aPlaylist videoView:(VLCVideoView *)aVideoView;
{
if (self = [super init])
{
playlist = [aPlaylist retain];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(playlistDidChange:) name:VLCPlaylistItemAdded object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(itemDidAddSubitem:) name:VLCMediaSubItemAdded object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(itemDidChange:) name:VLCPlaylistItemChanged object:nil];
videoView = [aVideoView retain];
/* Will be automatically set if an outline view ask us data,
* be careful not to connect two outlineView to this object or this goes wrong. */
outlineView = nil;
}
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
if (playlist)
[playlist release];
if (videoView)
[videoView release];
[super dealloc];
}
- (VLCPlaylist *)playlist
{
return playlist;
}
- (VLCVideoView *)videoView
{
return videoView;
}
@end
@implementation VLCPlaylistDataSource (OutlineViewDataSource)
- (BOOL) outlineView: (NSOutlineView *)ov isItemExpandable: (id)item { return NO; }
- (int) outlineView: (NSOutlineView *)ov numberOfChildrenOfItem:(id)item { return 0; }
- (id) outlineView: (NSOutlineView *)ov child:(int)index ofItem:(id)item { return nil; }
- (id) outlineView: (NSOutlineView *)ov objectValueForTableColumn:(NSTableColumn*)col byItem:(id)item { return nil; }
@end
@implementation VLCPlaylistDataSource (TableViewDropping)
/* Dummy implementation cause we need them */
- (int)numberOfRowsInTableView:(NSTableView *)aTableView { return 0; }
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex {return nil;}
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row proposedDropOperation:(NSTableViewDropOperation)op
{
return NSDragOperationEvery; /* This is for now */
}
- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info
row:(int)row dropOperation:(NSTableViewDropOperation)operation
{
int i;
NSArray * droppedItems = [[info draggingPasteboard] propertyListForType: NSFilenamesPboardType];
for (i = 0; i < [droppedItems count]; i++)
{
NSString * filename = [droppedItems objectAtIndex:i];
[[self playlist] insertMedia:[VLCMedia mediaWithURL:filename] atIndex:row+i];
}
}
@end
@interface NSObject (UnknownBindingsObject)
/* OutlineViewDataSourceDropping and bindings hack */
- (id)observedObject;
@end
@implementation VLCPlaylistDataSource (OutlineViewDataSourceDropping)
- (BOOL)outlineView:(NSOutlineView *)aOutlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index
{
NSArray * droppedItems = [[info draggingPasteboard] propertyListForType: NSFilenamesPboardType];
VLCPlaylist * aPlaylist;
int i;
if (!item)
item = [self playlist]; /* The root object is our playlist */
else
item = [item observedObject];
if (![item isMemberOfClass:[VLCPlaylist class]])
return NO;
if (index < 0) /* No precise item given, put it as the first one */
index = 0;
aPlaylist = item;
if (!droppedItems)
{
/* XXX: localization */
NSRunCriticalAlertPanelRelativeToWindow(@"Error", @"Unable to drop the provided item.", @"OK", nil, nil, [outlineView window]);
return NO;
}
for (i = 0; i < [droppedItems count]; i++)
{
NSString * filename = [droppedItems objectAtIndex:i];
[aPlaylist insertMedia:[VLCMedia mediaWithURL:filename] atIndex:index+i];
}
return YES;
}
- (NSDragOperation)outlineView:(NSOutlineView *)aOutlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
{
return NSDragOperationEvery;
}
@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