Commit 9f078d8b authored by Felix Paul Kühne's avatar Felix Paul Kühne

* added the progress dialogue to the set of widgets

- the Cancel-button is currently disabled because the core doesn't respond correctly (might be my fault though)
- note that the File's Owner of the nib-file is of type VLCInteraction because the class can't resolve its outlets otherwise

* WIDGET_TEXT and WIDGET_INPUT_TEXT are still missing, but will come in the next couple of days

As usual, comments on the implementation and the GUI-design are welcome :)
parent 096fa3a9
...@@ -80,6 +80,9 @@ EXTRA_DIST += \ ...@@ -80,6 +80,9 @@ EXTRA_DIST += \
extras/MacOSX/Resources/English.lproj/Update.nib/classes.nib \ extras/MacOSX/Resources/English.lproj/Update.nib/classes.nib \
extras/MacOSX/Resources/English.lproj/Update.nib/info.nib \ extras/MacOSX/Resources/English.lproj/Update.nib/info.nib \
extras/MacOSX/Resources/English.lproj/Update.nib/keyedobjects.nib \ extras/MacOSX/Resources/English.lproj/Update.nib/keyedobjects.nib \
extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib \
extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib \
extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib \
extras/MacOSX/Resources/English.lproj/InfoPlist.strings \ extras/MacOSX/Resources/English.lproj/InfoPlist.strings \
extras/MacOSX/Resources/a52.icns \ extras/MacOSX/Resources/a52.icns \
extras/MacOSX/Resources/aac.icns \ extras/MacOSX/Resources/aac.icns \
......
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {cancelAndClose = id; };
CLASS = VLCInteraction;
LANGUAGE = ObjC;
OUTLETS = {
"o_prog_bar" = id;
"o_prog_cancel_btn" = id;
"o_prog_description" = id;
"o_prog_title" = id;
"o_prog_win" = id;
};
SUPERCLASS = NSObject;
},
{CLASS = VLCInteractionList; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
);
IBVersion = 1;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>103 27 356 240 0 0 1440 878 </string>
<key>IBFramework Version</key>
<string>443.0</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8H14</string>
</dict>
</plist>
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id: vout.h 13803 2005-12-18 18:54:28Z bigben $ * $Id: vout.h 13803 2005-12-18 18:54:28Z bigben $
* *
* 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>
* *
* 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
...@@ -27,12 +28,23 @@ ...@@ -27,12 +28,23 @@
/***************************************************************************** /*****************************************************************************
* VLCInteraction interface * VLCInteraction interface
*****************************************************************************/ *****************************************************************************/
@interface VLCInteraction : NSObject @interface VLCInteraction : NSObject
{ {
interaction_dialog_t *p_dialog; /* progress widget */
IBOutlet id o_prog_bar;
IBOutlet id o_prog_cancel_btn;
IBOutlet id o_prog_description;
IBOutlet id o_prog_title;
IBOutlet id o_prog_win;
interaction_dialog_t * p_dialog;
intf_thread_t * p_intf; intf_thread_t * p_intf;
BOOL nib_interact_loaded;
} }
- (IBAction)cancelAndClose:(id)sender;
-(id)initDialog: (interaction_dialog_t *)_p_dialog; -(id)initDialog: (interaction_dialog_t *)_p_dialog;
-(void)runDialog; -(void)runDialog;
-(void)updateDialog; -(void)updateDialog;
......
/***************************************************************************** /*****************************************************************************
* interaction.h: Mac OS X interaction dialogs * interaction.h: Mac OS X interaction dialogs
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2005 the VideoLAN team * Copyright (C) 2005-2006 the VideoLAN team
* $Id: vout.h 13803 2005-12-18 18:54:28Z bigben $ * $Id: vout.h 13803 2005-12-18 18:54:28Z bigben $
* *
* Authors: Derk-Jan Hartman <hartman at videolan dot org> * Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Felix Khne <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
...@@ -114,6 +115,9 @@ ...@@ -114,6 +115,9 @@
if( !p_dialog ) if( !p_dialog )
msg_Err( p_intf, "serious issue (p_dialog == nil)" ); msg_Err( p_intf, "serious issue (p_dialog == nil)" );
if( !nib_interact_loaded )
nib_interact_loaded = [NSBundle loadNibNamed:@"Interaction" owner:self];
NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : "title"]; NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : "title"];
NSString *o_description = [NSString stringWithUTF8String:p_dialog->psz_description ? p_dialog->psz_description : ""]; NSString *o_description = [NSString stringWithUTF8String:p_dialog->psz_description ? p_dialog->psz_description : ""];
...@@ -151,21 +155,36 @@ ...@@ -151,21 +155,36 @@
for( i = 0; i < p_dialog->i_widgets; i++ ) for( i = 0; i < p_dialog->i_widgets; i++ )
{ {
msg_Dbg( p_intf, "widget: %s", p_dialog->pp_widgets[i]->psz_text ); msg_Dbg( p_intf, "widget: %s", p_dialog->pp_widgets[i]->psz_text );
o_description = [o_description stringByAppendingString: o_description = [o_description stringByAppendingString: \
[NSString stringWithUTF8String: p_dialog->pp_widgets[i]->psz_text]]; [NSString stringWithUTF8String: \
p_dialog->pp_widgets[i]->psz_text]];
} }
if( p_dialog->i_flags & DIALOG_OK_CANCEL ) if( p_dialog->i_flags & DIALOG_OK_CANCEL )
{ {
NSBeginInformationalAlertSheet( o_title, @"OK" , @"Cancel", nil, o_window, self, NSBeginInformationalAlertSheet( o_title, @"OK" , @"Cancel", nil, \
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, o_description ); o_window, self,@selector(sheetDidEnd: returnCode: contextInfo:),\
NULL, nil, o_description );
} }
else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL ) else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
{ {
NSBeginInformationalAlertSheet( o_title, @"Yes", @"Cancel", @"No", o_window, self, NSBeginInformationalAlertSheet( o_title, @"Yes", @"Cancel", @"No", \
@selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, o_description ); o_window, self,@selector(sheetDidEnd: returnCode: contextInfo:),\
NULL, nil, o_description );
}
else if( p_dialog->i_type & WIDGET_PROGRESS )
{
[o_prog_title setStringValue: o_title];
[o_prog_description setStringValue: o_description];
[o_prog_bar setUsesThreadedAnimation: YES];
[o_prog_bar setDoubleValue: 0];
[NSApp beginSheet: o_prog_win modalForWindow: o_window \
modalDelegate: self didEndSelector: \
nil \
contextInfo: nil];
[o_prog_win makeKeyWindow];
} }
else else
msg_Dbg( p_intf, "requested dialog type not implemented yet" ); msg_Warn( p_intf, "requested dialog type not implemented yet" );
} }
} }
...@@ -195,12 +214,25 @@ ...@@ -195,12 +214,25 @@
-(void)updateDialog -(void)updateDialog
{ {
msg_Dbg( p_intf, "update event" ); int i = 0;
for( i = 0 ; i< p_dialog->i_widgets; i++ )
{
/*msg_Dbg( p_intf, "update event, current value %i for index %i",
(int)(p_dialog->pp_widgets[i]->val.f_float), i);*/
if( p_dialog->i_type & WIDGET_PROGRESS )
[o_prog_bar setDoubleValue: \
(double)(p_dialog->pp_widgets[i]->val.f_float)];
}
} }
-(void)hideDialog -(void)hideDialog
{ {
msg_Dbg( p_intf, "hide event" ); msg_Dbg( p_intf, "hide event" );
if( p_dialog->i_type & WIDGET_PROGRESS )
{
[NSApp endSheet: o_prog_win];
[o_prog_win close];
}
} }
-(void)destroyDialog -(void)destroyDialog
...@@ -208,9 +240,14 @@ ...@@ -208,9 +240,14 @@
msg_Dbg( p_intf, "destroy event" ); msg_Dbg( p_intf, "destroy event" );
} }
-(void)dealloc - (IBAction)cancelAndClose:(id)sender
{ {
[super dealloc]; /* tell the core that the dialog was cancelled */
vlc_mutex_lock( &p_dialog->p_interaction->object_lock );
p_dialog->i_return = DIALOG_CANCELLED;
p_dialog->i_status = ANSWERED_DIALOG;
vlc_mutex_unlock( &p_dialog->p_interaction->object_lock );
msg_Dbg( p_intf, "dialog cancelled" );
} }
@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