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

macosx: implement 'dialog-fatal' and 'dialog-question' correctly and completely

This introduces a lot of dead code, which will be cleaned up later on, but is left there for reference.
parent fe273e3d
/***************************************************************************** /*****************************************************************************
* interaction.h: Mac OS X interaction dialogs * interaction.h: Mac OS X interaction dialogs
***************************************************************************** *****************************************************************************
* Copyright (C) 2005-2006 the VideoLAN team * Copyright (C) 2005-2009 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Derk-Jan Hartman <hartman at videolan dot org> * Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Felix Kühne <fkuehne at videolan dot org> * Felix Paul Kühne <fkuehne at videolan dot org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -21,14 +21,63 @@ ...@@ -21,14 +21,63 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include <vlc_common.h> #import <vlc_common.h>
#include <vlc_interface.h> #import <vlc_dialog.h>
#include <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
/*****************************************************************************
* VLCErrorPanel interface
*****************************************************************************/
@interface VLCErrorPanel : NSObject
{
IBOutlet id o_window;
IBOutlet id o_cleanup_button;
IBOutlet id o_error_table;
IBOutlet id o_messages_btn;
NSMutableArray * o_errors;
NSMutableArray * o_icons;
BOOL nib_interact_errpanel_loaded;
}
- (IBAction)cleanupTable:(id)sender;
- (IBAction)showMessages:(id)sender;
-(void)showPanel;
-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg;
@end
/*****************************************************************************
* VLCCoreDialogSupport interface
*****************************************************************************/
@interface VLCCoreDialogSupport : NSObject
{
NSMutableArray *o_interaction_list;
VLCErrorPanel *o_error_panel;
}
-(void)newInteractionEvent: (NSNotification *)o_notification;
#if 0
-(void)addInteraction: (interaction_dialog_t *)p_dialog;
-(void)removeInteraction: (VLCInteraction *)p_interaction;
#endif
-(void)showFatalDialog: (NSValue *)o_value;
-(void)showQuestionDialog: (NSValue *)o_value;
-(id)getErrorPanel;
@end
/***************************************************************************** /*****************************************************************************
* VLCInteraction interface * VLCInteraction interface
*****************************************************************************/ *****************************************************************************/
#if 0
@interface VLCInteraction : NSObject @interface VLCInteraction : NSObject
{ {
/* progress dialogue */ /* progress dialogue */
...@@ -50,66 +99,20 @@ ...@@ -50,66 +99,20 @@
IBOutlet id o_auth_title; IBOutlet id o_auth_title;
IBOutlet id o_auth_win; IBOutlet id o_auth_win;
/* string input dialogue */ vlc_object_t * p_dialog;
IBOutlet id o_input_cancel_btn;
IBOutlet id o_input_description;
IBOutlet id o_input_fld;
IBOutlet id o_input_ok_btn;
IBOutlet id o_input_title;
IBOutlet id o_input_win;
interaction_dialog_t * p_dialog;
intf_thread_t * p_intf; intf_thread_t * p_intf;
NSProgressIndicator * o_mainIntfPgbar; NSProgressIndicator * o_mainIntfPgbar;
BOOL nib_interact_loaded; BOOL nib_interact_loaded;
} }
- (IBAction)cancelAndClose:(id)sender;
- (IBAction)okayAndClose:(id)sender; - (IBAction)okayAndClose:(id)sender;
- (IBAction)cancelDialog:(id)sender; - (IBAction)cancelDialog:(id)sender;
-(id)initDialog: (interaction_dialog_t *)_p_dialog; -(id)initDialog: (vlc_object_t *)_p_dialog;
-(void)runDialog; -(void)runDialog;
-(void)updateDialog; -(void)updateDialog;
-(void)hideDialog; -(void)hideDialog;
-(void)destroyDialog; -(void)destroyDialog;
@end @end
#endif
@interface VLCErrorInteractionPanel : NSObject
{
IBOutlet id o_window;
IBOutlet id o_cleanup_button;
IBOutlet id o_error_table;
IBOutlet id o_messages_btn;
NSMutableArray * o_errors;
NSMutableArray * o_icons;
BOOL nib_interact_errpanel_loaded;
}
- (IBAction)cleanupTable:(id)sender;
- (IBAction)showMessages:(id)sender;
-(void)showPanel;
-(void)addError: (NSString *)o_error withMsg:(NSString *)o_msg;
-(void)addWarning: (NSString *)o_warning withMsg:(NSString *)o_msg;
@end
/*****************************************************************************
* VLCInteractionList interface
*****************************************************************************/
@interface VLCInteractionList : NSObject
{
NSMutableArray *o_interaction_list;
VLCErrorInteractionPanel *o_error_panel;
}
-(void)newInteractionEvent: (NSNotification *)o_notification;
-(void)addInteraction: (interaction_dialog_t *)p_dialog;
-(void)removeInteraction: (VLCInteraction *)p_interaction;
-(id)getErrorPanel;
@end
This diff is collapsed.
...@@ -229,17 +229,12 @@ static int DialogCallback( vlc_object_t *p_this, const char *type, vlc_value_t p ...@@ -229,17 +229,12 @@ static int DialogCallback( vlc_object_t *p_this, const char *type, vlc_value_t p
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
VLCMain *interface = (VLCMain *)data; VLCMain *interface = (VLCMain *)data;
NSLog( @"dialog callback triggered; type of dialogue is '%s'", type );
if(!strcmp (type, "dialog-fatal"))
{
const dialog_fatal_t *p_dialog = (const dialog_fatal_t *)value.p_address; const dialog_fatal_t *p_dialog = (const dialog_fatal_t *)value.p_address;
NSLog( @"fatal dialogue with title '%s' and message '%s'", p_dialog->title, p_dialog->message );
#if 0
NSValue *o_value = [NSValue valueWithPointer:p_dialog];
[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewInteractionEventNotification" object:[interface getInteractionList] userInfo:[NSDictionary dictionaryWithObject:o_value forKey:@"VLCDialogPointer"]]; NSLog( @"dialog callback triggered; type of dialogue is '%s'", type );
#endif
} NSValue *o_value = [NSValue valueWithPointer:p_dialog];
[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewCoreDialogEventNotification" object:[interface getInteractionList] userInfo:[NSDictionary dictionaryWithObjectsAndKeys: o_value, @"VLCDialogPointer", [NSString stringWithUTF8String: type], @"VLCDialogType", nil]];
[o_pool release]; [o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -290,7 +285,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -290,7 +285,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_extended = nil; o_extended = nil;
o_bookmarks = [[VLCBookmarks alloc] init]; o_bookmarks = [[VLCBookmarks alloc] init];
o_embedded_list = [[VLCEmbeddedList alloc] init]; o_embedded_list = [[VLCEmbeddedList alloc] init];
o_interaction_list = [[VLCInteractionList alloc] init]; o_interaction_list = [[VLCCoreDialogSupport alloc] init];
o_info = [[VLCInfo alloc] init]; o_info = [[VLCInfo alloc] init];
#ifdef UPDATE_CHECK #ifdef UPDATE_CHECK
o_update = [[VLCUpdate alloc] init]; o_update = [[VLCUpdate alloc] init];
...@@ -471,6 +466,12 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -471,6 +466,12 @@ static VLCMain *_o_sharedMainInstance = nil;
/* subscribe to various interactive dialogues */ /* subscribe to various interactive dialogues */
var_Create( p_intf, "dialog-fatal", VLC_VAR_ADDRESS ); var_Create( p_intf, "dialog-fatal", VLC_VAR_ADDRESS );
var_AddCallback( p_intf, "dialog-fatal", DialogCallback, self ); var_AddCallback( p_intf, "dialog-fatal", DialogCallback, self );
var_Create( p_intf, "dialog-login", VLC_VAR_ADDRESS );
var_AddCallback( p_intf, "dialog-login", DialogCallback, self );
var_Create( p_intf, "dialog-question", VLC_VAR_ADDRESS );
var_AddCallback( p_intf, "dialog-question", DialogCallback, self );
var_Create( p_intf, "dialog-progress-bar", VLC_VAR_ADDRESS );
var_AddCallback( p_intf, "dialog-progress-bar", DialogCallback, self );
dialog_Register( p_intf ); dialog_Register( p_intf );
/* update the playmode stuff */ /* update the playmode stuff */
...@@ -747,6 +748,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -747,6 +748,9 @@ static VLCMain *_o_sharedMainInstance = nil;
/* unsubscribe from the interactive dialogues */ /* unsubscribe from the interactive dialogues */
dialog_Unregister( p_intf ); dialog_Unregister( p_intf );
var_DelCallback( p_intf, "dialog-fatal", DialogCallback, self ); var_DelCallback( p_intf, "dialog-fatal", DialogCallback, self );
var_DelCallback( p_intf, "dialog-login", DialogCallback, self );
var_DelCallback( p_intf, "dialog-question", DialogCallback, self );
var_DelCallback( p_intf, "dialog-progress-bar", DialogCallback, self );
/* remove global observer watching for vout device changes correctly */ /* remove global observer watching for vout device changes correctly */
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
...@@ -2117,8 +2121,8 @@ end: ...@@ -2117,8 +2121,8 @@ end:
- (IBAction)showBookmarks:(id)sender - (IBAction)showBookmarks:(id)sender
{ {
dialog_Fatal( p_intf, _("Video Settings not saved"), dialog_Question( p_intf, _("Video Settings not saved"),
_("An error occured while saving your settings via SimplePrefs.") ); _("An error occured while saving your settings via SimplePrefs."), "Yes", "No", "Cancel" );
/* we need the wizard-nib for the bookmarks's extract functionality */ /* we need the wizard-nib for the bookmarks's extract functionality */
if( !nib_wizard_loaded ) if( !nib_wizard_loaded )
...@@ -2156,7 +2160,7 @@ end: ...@@ -2156,7 +2160,7 @@ end:
[o_update showUpdateWindow]; [o_update showUpdateWindow];
#else #else
msg_Err( VLCIntf, "Update checker wasn't enabled in this build" ); msg_Err( VLCIntf, "Update checker wasn't enabled in this build" );
dialog_Fatal( VLCIntf, _("Update check failed"), _("Checking for updates was not enabled in this build.") ); dialog_FatalWait( VLCIntf, _("Update check failed"), _("Checking for updates was not enabled in this build.") );
#endif #endif
} }
......
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