Commit ac8d7445 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Mac OS X dialog provider: completely removed

Use VLCKit to implement dialogs properly in external apps
parent 34e88dc7
......@@ -209,6 +209,7 @@ Removed modules
* Win32 GDI text renderer module (use Freetype instead)
* Growl notification (replaced by osx_notifications)
* VCDX "extended" Video CD access module (use the normal VCD module)
* Mac OS X Dialog Provider (use VLCKit instead)
Changes between 2.2.0 and 2.2.1:
......
......@@ -3920,17 +3920,6 @@ then
VLC_ADD_PLUGIN([minimal_macosx])
fi
dnl
dnl MacOS X dialog provider
dnl
AC_ARG_ENABLE(macosx-dialog-provider,
[ --enable-macosx-dialog-provider Mac OS X dialog module (default enabled on Mac OS X)])
if test "x${enable_macosx_dialog_provider}" != "xno" &&
(test "${SYS}" = "darwin" || test "${enable_macosx_dialog_provider}" = "yes")
then
VLC_ADD_PLUGIN([macosx_dialog_provider])
fi
dnl
dnl VideoToolbox plugins
AC_CHECK_HEADERS(VideoToolbox/VideoToolbox.h, [
......
......@@ -218,7 +218,6 @@ $Id$
* lpcm: LPCM decoder
* lua: Lua scripting inteface
* macosx: Video output, and interface module for Mac OS X
* macosx_dialog_provider: Minimal Dialog Provider for Mac OS X
* mad: MPEG-1 & 2 audio layer I,II,III audio decoder using MAD
* magnify: zoom video filter
* marq: Overlays a marquee on the video
......
......@@ -22,18 +22,6 @@ endif
EXTRA_DIST += gui/eject.c
libmacosx_dialog_provider_plugin_la_SOURCES = \
gui/macosx_dialog_provider/VLCLoginPanel.h gui/macosx_dialog_provider/VLCLoginPanel.m \
gui/macosx_dialog_provider/VLCProgressPanel.h gui/macosx_dialog_provider/VLCProgressPanel.m \
gui/macosx_dialog_provider/VLCUIWidgets.h gui/macosx_dialog_provider/VLCUIWidgets.m \
gui/macosx_dialog_provider/dialogProvider.h gui/macosx_dialog_provider/dialogProvider.m
libmacosx_dialog_provider_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(guidir)' -Wl,-framework,Cocoa
EXTRA_LTLIBRARIES += libmacosx_dialog_provider_plugin.la
gui_LTLIBRARIES += $(LTLIBmacosx_dialog_provider)
libminimal_macosx_plugin_la_SOURCES = \
gui/minimal_macosx/intf.h gui/minimal_macosx/intf.m \
gui/minimal_macosx/misc.h gui/minimal_macosx/misc.m \
......
/*****************************************************************************
* VLCLoginPanel.h: A Generic Login Panel created for VLC
*****************************************************************************
* Copyright (C) 2009-2010 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot 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 <Cocoa/Cocoa.h>
@interface VLCLoginPanel : NSPanel {
IBOutlet NSButton * _cancelButton;
IBOutlet NSButton * _okayButton;
IBOutlet NSTextField * _userNameLabel;
IBOutlet NSTextField * _userNameField;
IBOutlet NSTextField * _passwordLabel;
IBOutlet NSSecureTextField * _passwordField;
IBOutlet NSTextField * _titleField;
IBOutlet NSTextField * _informativeTextField;
IBOutlet NSImageView * _iconView;
}
- (IBAction)buttonAction:(id)sender;
- (void)createContentView;
- (void)setDialogTitle:(NSString *)title;
- (void)setDialogMessage:(NSString *)message;
- (NSString *)userName;
- (NSString *)password;
@end
/*****************************************************************************
* VLCLoginPanel.m: A Generic Login Panel created for VLC
*****************************************************************************
* Copyright (C) 2009-2010 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot 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 "VLCLoginPanel.h"
@implementation VLCLoginPanel
- (id)init
{
NSRect windowRect;
windowRect.size.height = 278;
windowRect.size.width = 505;
windowRect.origin.x = windowRect.origin.y = 0;
return [super initWithContentRect:windowRect
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:YES];
}
- (void)createContentView
{
NSRect s_rc = [self frame];
id ourContentView = [self contentView];
s_rc.origin.x = 275;
s_rc.origin.y = 44;
s_rc.size.height = 32;
s_rc.size.width = 108;
_cancelButton = [[NSButton alloc] initWithFrame:s_rc];
[_cancelButton setButtonType:NSMomentaryLightButton];
[_cancelButton setTitle:@"Cancel"];
[_cancelButton setBezelStyle:NSRoundedBezelStyle];
[_cancelButton setBordered:YES];
[_cancelButton setTarget:self];
[_cancelButton setAction:@selector(buttonAction:)];
[_cancelButton setKeyEquivalent:@"\e"] ; // escape key
[ourContentView addSubview:_cancelButton];
s_rc.origin.x = 383;
s_rc.origin.y = 44;
s_rc.size.height = 32;
s_rc.size.width = 108;
_okayButton = [[NSButton alloc] initWithFrame:s_rc];
[_okayButton setButtonType:NSMomentaryLightButton];
[_okayButton setTitle:@"OK"];
[_okayButton setBezelStyle:NSRoundedBezelStyle];
[_okayButton setBordered:YES];
[_okayButton setTarget:self];
[_okayButton setAction:@selector(buttonAction:)];
[_okayButton setKeyEquivalent:@"\r"] ; // enter key
[ourContentView addSubview:_okayButton];
s_rc.origin.x = 94;
s_rc.origin.y = 170;
s_rc.size.height = 14;
s_rc.size.width = 129;
_userNameLabel = [[NSTextField alloc] initWithFrame:s_rc];
[_userNameLabel setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[_userNameLabel setStringValue:@"Username"];
[_userNameLabel setBezeled:NO];
[_userNameLabel setEditable:NO];
[_userNameLabel setSelectable:NO];
[_userNameLabel setDrawsBackground:NO];
[ourContentView addSubview:_userNameLabel];
s_rc.origin.x = 97;
s_rc.origin.y = 148;
s_rc.size.height = 22;
s_rc.size.width = 310;
_userNameField = [[NSTextField alloc] initWithFrame:s_rc];
[_userNameField setBezeled:YES];
[_userNameField setEditable:YES];
[_userNameField setImportsGraphics:NO];
[ourContentView addSubview:_userNameField];
s_rc.origin.x = 94;
s_rc.origin.y = 116;
s_rc.size.height = 14;
s_rc.size.width = 129;
_passwordLabel = [[NSTextField alloc] initWithFrame:s_rc];
[_passwordLabel setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[_passwordLabel setStringValue:@"Password"];
[_passwordLabel setBezeled:NO];
[_passwordLabel setEditable:NO];
[_passwordLabel setSelectable:NO];
[_passwordLabel setDrawsBackground:NO];
[ourContentView addSubview:_passwordLabel];
s_rc.origin.x = 97;
s_rc.origin.y = 94;
s_rc.size.height = 22;
s_rc.size.width = 310;
_passwordField = [[NSSecureTextField alloc] initWithFrame:s_rc];
[_passwordField setBezeled:YES];
[_passwordField setEditable:YES];
[_passwordField setImportsGraphics:NO];
[ourContentView addSubview:_passwordField];
s_rc.origin.x = 94;
s_rc.origin.y = 238;
s_rc.size.height = 17;
s_rc.size.width = 316;
_titleField = [[NSTextField alloc] initWithFrame:s_rc];
[_titleField setFont:[NSFont boldSystemFontOfSize:0]];
[_titleField setBezeled:NO];
[_titleField setEditable:NO];
[_titleField setSelectable:YES];
[_titleField setDrawsBackground:NO];
[ourContentView addSubview:_titleField];
s_rc.origin.x = 94;
s_rc.origin.y = 183;
s_rc.size.height = 44;
s_rc.size.width = 394;
_informativeTextField = [[NSTextField alloc] initWithFrame:s_rc];
[_informativeTextField setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[_informativeTextField setBezeled:NO];
[_informativeTextField setEditable:NO];
[_informativeTextField setSelectable:YES];
[_informativeTextField setDrawsBackground:NO];
[ourContentView addSubview:_informativeTextField];
s_rc.origin.x = 20;
s_rc.origin.y = 188;
s_rc.size.height = s_rc.size.width = 64;
_iconView = [[NSImageView alloc] initWithFrame:s_rc];
[_iconView setImage:[NSImage imageNamed:@"NSApplicationIcon"]];
[_iconView setEditable:NO];
[_iconView setAllowsCutCopyPaste:NO];
[ourContentView addSubview:_iconView];
}
- (IBAction)buttonAction:(id)sender
{
if (sender == _okayButton)
[NSApp stopModalWithCode: 1];
else
[NSApp stopModalWithCode: 0];
}
- (void)setDialogTitle:(NSString *)title
{
[_titleField setStringValue:title];
[self setTitle:title];
}
- (void)setDialogMessage:(NSString *)message
{
[_informativeTextField setStringValue:message];
}
- (NSString *)userName
{
return [_userNameField stringValue];
}
- (NSString *)password
{
return [_passwordField stringValue];
}
@end
/*****************************************************************************
* VLCProgressPanel.h: A Generic Progress Indicator Panel created for VLC
*****************************************************************************
* Copyright (C) 2009-2010 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot 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 <Cocoa/Cocoa.h>
@interface VLCProgressPanel : NSPanel {
BOOL _isCancelled;
IBOutlet NSProgressIndicator * _progressBar;
IBOutlet NSTextField *_titleField;
IBOutlet NSTextField *_messageField;
IBOutlet NSButton *_cancelButton;
IBOutlet NSImageView *_iconView;
}
- (void)createContentView;
- (void)setDialogTitle:(NSString *)title;
- (void)setDialogMessage:(NSString *)message;
- (void)setCancelButtonLabel:(NSString *)cancelLabel;
- (void)setProgressAsDouble:(double)value;
- (BOOL)isCancelled;
- (IBAction)cancelDialog:(id)sender;
@end
/*****************************************************************************
* VLCProgressPanel.m: A Generic Progress Indicator Panel created for VLC
*****************************************************************************
* Copyright (C) 2009-2010 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot 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 "VLCProgressPanel.h"
@implementation VLCProgressPanel
- (id)init
{
NSRect windowRect;
windowRect.size.height = 182;
windowRect.size.width = 520;
windowRect.origin.x = windowRect.origin.y = 0;
return [super initWithContentRect:windowRect
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:YES];
}
- (void)createContentView
{
NSRect s_rc = [self frame];
id ourContentView = [self contentView];
s_rc.origin.x = 398;
s_rc.origin.y = 28;
s_rc.size.height = 32;
s_rc.size.width = 108;
_cancelButton = [[NSButton alloc] initWithFrame:s_rc];
[_cancelButton setButtonType:NSMomentaryLightButton];
[_cancelButton setTitle:@"Cancel"];
[_cancelButton setBezelStyle:NSRoundedBezelStyle];
[_cancelButton setBordered:YES];
[_cancelButton setTarget:self];
[_cancelButton setAction:@selector(cancelDialog:)];
[_cancelButton setKeyEquivalent:@"\e"] ; // escape key
[ourContentView addSubview:_cancelButton];
s_rc.origin.x = 89;
s_rc.origin.y = 153;
s_rc.size.height = 17;
s_rc.size.width = 414;
_titleField = [[NSTextField alloc] initWithFrame:s_rc];
[_titleField setFont:[NSFont boldSystemFontOfSize:0]];
[_titleField setBezeled:NO];
[_titleField setEditable:NO];
[_titleField setSelectable:YES];
[_titleField setDrawsBackground:NO];
[ourContentView addSubview:_titleField];
s_rc.origin.x = 89;
s_rc.origin.y = 116;
s_rc.size.height = 42;
s_rc.size.width = 414;
_messageField = [[NSTextField alloc] initWithFrame:s_rc];
[_messageField setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
[_messageField setBezeled:NO];
[_messageField setEditable:NO];
[_messageField setSelectable:YES];
[_messageField setDrawsBackground:NO];
[ourContentView addSubview:_messageField];
s_rc.origin.x = 90;
s_rc.origin.y = 66;
s_rc.size.height = 20;
s_rc.size.width = 412;
_progressBar = [[NSProgressIndicator alloc] initWithFrame:s_rc];
[_progressBar setMaxValue:1000.0];
[_progressBar setUsesThreadedAnimation:YES];
[_progressBar setStyle:NSProgressIndicatorBarStyle];
[_progressBar setDisplayedWhenStopped:YES];
[_progressBar setControlSize:NSRegularControlSize];
[_progressBar setIndeterminate:NO];
[ourContentView addSubview:_progressBar];
[_progressBar startAnimation:nil];
s_rc.origin.x = 20;
s_rc.origin.y = 110;
s_rc.size.height = s_rc.size.width = 64;
_iconView = [[NSImageView alloc] initWithFrame:s_rc];
[_iconView setImage:[NSImage imageNamed:@"NSApplicationIcon"]];
[_iconView setEditable:NO];
[_iconView setAllowsCutCopyPaste:NO];
[ourContentView addSubview:_iconView];
}
- (void)setDialogTitle:(NSString *)title
{
[_titleField setStringValue:title];
[self setTitle:title];
}
- (void)setDialogMessage:(NSString *)message
{
[_messageField setStringValue:message];
}
- (void)setCancelButtonLabel:(NSString *)cancelLabel
{
[_cancelButton setTitle:cancelLabel];
}
- (void)setProgressAsDouble:(double)value
{
[_progressBar setDoubleValue:value];
}
- (BOOL)isCancelled
{
return _isCancelled;
}
- (IBAction)cancelDialog:(id)sender
{
_isCancelled = YES;
[_progressBar setIndeterminate:YES];
[_progressBar startAnimation:self];
}
@end
/*****************************************************************************
* VLCUIWidgets.h: Widgets for VLC's Minimal Dialog Provider for Mac OS X
*****************************************************************************
* Copyright (C) 2009-2010 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan dot>
*
* 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 <Cocoa/Cocoa.h>
#import <vlc_extensions.h>
@interface VLCDialogButton : NSButton
{
extension_widget_t *widget;
}
@property (readwrite) extension_widget_t *widget;
@end
@interface VLCDialogPopUpButton : NSPopUpButton
{
extension_widget_t *widget;
}
@property (readwrite) extension_widget_t *widget;
@end
@interface VLCDialogTextField : NSTextField
{
extension_widget_t *widget;
}
@property (readwrite) extension_widget_t *widget;
@end
@interface VLCDialogWindow : NSWindow
{
extension_dialog_t *dialog;
}
@property (readwrite) extension_dialog_t *dialog;
@end
@interface VLCDialogList : NSTableView <NSTableViewDataSource>
{
extension_widget_t *widget;
NSMutableArray *contentArray;
}
@property (readwrite) extension_widget_t *widget;
@property (readwrite, retain) NSMutableArray *contentArray;
@end
@interface VLCDialogGridView : NSView {
NSUInteger _rowCount, _colCount;
NSMutableArray *_gridedViews;
}
- (void)addSubview:(NSView *)view atRow:(NSUInteger)row column:(NSUInteger)column rowSpan:(NSUInteger)rowSpan colSpan:(NSUInteger)colSpan;
- (NSSize)flexSize:(NSSize)size;
- (void)removeSubview:(NSView *)view;
@end
\ No newline at end of file
/*****************************************************************************
* VLCUIWidgets.m: Widgets for VLC's Minimal Dialog Provider for Mac OS X
*****************************************************************************
* Copyright (C) 2009-2010 VLC authors and VideoLAN
* $Id$
*
* Authors: Pierre d'Herbemont <pdherbemont # videolan dot>
*
* 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 "VLCUIWidgets.h"
@implementation VLCDialogButton
@synthesize widget;
@end
@implementation VLCDialogPopUpButton
@synthesize widget;
@end
@implementation VLCDialogTextField
@synthesize widget;
@end
@implementation VLCDialogWindow
@synthesize dialog;
@end
@implementation VLCDialogList
@synthesize widget;
@synthesize contentArray;
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [contentArray count];
}
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
return [[contentArray objectAtIndex:rowIndex] objectForKey:@"text"];
}
@end
@implementation VLCDialogGridView
- (void)dealloc
{
[_gridedViews release];
[super dealloc];
}
- (void)recomputeCount
{
_colCount = 0;
_rowCount = 0;
for (NSDictionary *obj in _gridedViews)
{
NSUInteger row = [[obj objectForKey:@"row"] intValue];
NSUInteger col = [[obj objectForKey:@"col"] intValue];
if (col + 1 > _colCount)
_colCount = col + 1;
if (row + 1 > _rowCount)
_rowCount = row + 1;
}
}
- (void)recomputeWindowSize
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(recomputeWindowSize) object:nil];
NSWindow *window = [self window];
NSRect frame = [window frame];
NSRect contentRect = [window contentRectForFrameRect:frame];
contentRect.size = [self flexSize:frame.size];
NSRect newFrame = [window frameRectForContentRect:contentRect];
newFrame.origin.y -= newFrame.size.height - frame.size.height;
newFrame.origin.x -= (newFrame.size.width - frame.size.width) / 2;
[window setFrame:newFrame display:YES animate:YES];
}
- (NSSize)objectSizeToFit:(NSView *)view
{
if ([view isKindOfClass:[NSControl class]]) {
NSControl *control = (NSControl *)view;
return [[control cell] cellSize];
}
return [view frame].size;
}
- (CGFloat)marginX
{
return 16;
}
- (CGFloat)marginY
{
return 8;
}
- (CGFloat)constrainedHeightOfRow:(NSUInteger)targetRow
{
CGFloat height = 0;
for(NSDictionary *obj in _gridedViews) {
NSUInteger row = [[obj objectForKey:@"row"] intValue];
if (row != targetRow)
continue;
NSUInteger rowSpan = [[obj objectForKey:@"rowSpan"] intValue];
if (rowSpan != 1)
continue;
NSView *view = [obj objectForKey:@"view"];
if ([view autoresizingMask] & NSViewHeightSizable)
continue;
NSSize sizeToFit = [self objectSizeToFit:view];
if (height < sizeToFit.height)
height = sizeToFit.height;
}
return height;
}
- (CGFloat)remainingRowsHeight
{
NSUInteger height = [self marginY];
if (!_rowCount)
return 0;
NSUInteger autosizedRows = 0;
for (NSUInteger i = 0; i < _rowCount; i++) {
CGFloat constrainedHeight = [self constrainedHeightOfRow:i];
if (!constrainedHeight)
autosizedRows++;
height += constrainedHeight + [self marginY];
}
CGFloat remaining = 0;
if (height < self.bounds.size.height && autosizedRows)
remaining = (self.bounds.size.height - height) / autosizedRows;