]> git.sesse.net Git - vlc/commitdiff
* added the progress dialogue to the set of widgets
authorFelix Paul Kühne <fkuehne@videolan.org>
Sun, 19 Feb 2006 22:38:07 +0000 (22:38 +0000)
committerFelix Paul Kühne <fkuehne@videolan.org>
Sun, 19 Feb 2006 22:38:07 +0000 (22:38 +0000)
- 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 :)

Makefile.am
extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib [new file with mode: 0644]
extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib [new file with mode: 0644]
extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib [new file with mode: 0644]
modules/gui/macosx/interaction.h
modules/gui/macosx/interaction.m
modules/gui/macosx/intf.m

index 65fabfbba3fdd8d303a36ba42c72a49295dd5ed1..3ece91e5ecbf9700a029a0613205c212322326fd 100644 (file)
@@ -80,6 +80,9 @@ EXTRA_DIST += \
        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/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/a52.icns \
        extras/MacOSX/Resources/aac.icns \
diff --git a/extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib b/extras/MacOSX/Resources/English.lproj/Interaction.nib/classes.nib
new file mode 100644 (file)
index 0000000..25c8f22
--- /dev/null
@@ -0,0 +1,20 @@
+{
+    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
diff --git a/extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib b/extras/MacOSX/Resources/English.lproj/Interaction.nib/info.nib
new file mode 100644 (file)
index 0000000..8ebe9a6
--- /dev/null
@@ -0,0 +1,16 @@
+<?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>
diff --git a/extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib b/extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..60c4a67
Binary files /dev/null and b/extras/MacOSX/Resources/English.lproj/Interaction.nib/keyedobjects.nib differ
index 906bdbafefff7dd35d3ebcca5861d3af0aabb2f2..036065148d78b8dd0a582df7fa6009f580adde1f 100644 (file)
@@ -5,6 +5,7 @@
  * $Id: vout.h 13803 2005-12-18 18:54:28Z bigben $
  *
  * Authors: Derk-Jan Hartman <hartman at videolan dot org>
+ *          Felix K\9fhne <fkuehne at videolan dot org>
  *
  * 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
 /*****************************************************************************
  * VLCInteraction interface
  *****************************************************************************/
+
 @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;
+    BOOL nib_interact_loaded;
 }
 
+- (IBAction)cancelAndClose:(id)sender;
+
 -(id)initDialog: (interaction_dialog_t *)_p_dialog;
 -(void)runDialog;
 -(void)updateDialog;
index 61bec635a602582cbde833b9742cae3b0412f31c..75790f65f6f6504a04e3e0f7520094ee70b102cb 100644 (file)
@@ -1,10 +1,11 @@
 /*****************************************************************************
  * 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 $
  *
  * Authors: Derk-Jan Hartman <hartman at videolan dot org>
+ *          Felix K\9fhne <fkuehne at videolan dot org>
  *
  * 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
     if( !p_dialog )
         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_description = [NSString stringWithUTF8String:p_dialog->psz_description ? p_dialog->psz_description : ""];
     
         for( i = 0; i < p_dialog->i_widgets; i++ )
         {
             msg_Dbg( p_intf, "widget: %s", p_dialog->pp_widgets[i]->psz_text );
-            o_description = [o_description stringByAppendingString:
-                                [NSString stringWithUTF8String: p_dialog->pp_widgets[i]->psz_text]];
+            o_description = [o_description stringByAppendingString: \
+                [NSString stringWithUTF8String: \
+                    p_dialog->pp_widgets[i]->psz_text]];
         }
         if( p_dialog->i_flags & DIALOG_OK_CANCEL )
         {
-            NSBeginInformationalAlertSheet( o_title, @"OK" , @"Cancel", nil, o_window, self,
-                @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, o_description );
+            NSBeginInformationalAlertSheet( o_title, @"OK" , @"Cancel", nil, \
+                o_window, self,@selector(sheetDidEnd: returnCode: contextInfo:),\
+                NULL, nil, o_description );
         }
         else if( p_dialog->i_flags & DIALOG_YES_NO_CANCEL )
         {
-            NSBeginInformationalAlertSheet( o_title, @"Yes", @"Cancel", @"No", o_window, self,
-                @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil, o_description );
+            NSBeginInformationalAlertSheet( o_title, @"Yes", @"Cancel", @"No", \
+                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
-            msg_Dbg( p_intf, "requested dialog type not implemented yet" );
+            msg_Warn( p_intf, "requested dialog type not implemented yet" );
     }
 }
 
 
 -(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
 {
     msg_Dbg( p_intf, "hide event" );
+    if( p_dialog->i_type & WIDGET_PROGRESS )
+    {
+        [NSApp endSheet: o_prog_win];
+        [o_prog_win close];
+    }
 }
 
 -(void)destroyDialog
     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
\ No newline at end of file
+@end
index 7205bd75caf52d32c59ac4546e574debb55fd93f..a263e18338debe310b69865fdb402ce2565be0b4 100644 (file)
@@ -317,7 +317,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     } else {
         _o_sharedMainInstance = [super init];
     }
-    
+
     o_about = [[VLAboutBox alloc] init];
     o_prefs = nil;
     o_open = [[VLCOpen alloc] init];
@@ -458,7 +458,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     var_Create( p_intf, "interaction", VLC_VAR_ADDRESS );
     var_AddCallback( p_intf, "interaction", InteractCallback, self );
     p_intf->b_interaction = VLC_TRUE;
-    
+
     nib_main_loaded = TRUE;
 }