macosx: implemented 'dialog-login' and cleaned up most dead code
authorFelix Paul Kühne <fkuehne@videolan.org>
Tue, 7 Apr 2009 21:14:26 +0000 (23:14 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Tue, 7 Apr 2009 21:14:26 +0000 (23:14 +0200)
14 files changed:
Makefile.am
extras/package/macosx/Resources/English.lproj/Interaction.nib/classes.nib [deleted file]
extras/package/macosx/Resources/English.lproj/Interaction.nib/info.nib [deleted file]
extras/package/macosx/Resources/English.lproj/Interaction.nib/keyedobjects.nib [deleted file]
extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib
extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/info.nib
extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib
extras/package/macosx/vlc.xcodeproj/project.pbxproj
modules/gui/macosx/interaction.h
modules/gui/macosx/interaction.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m

index 6ad5d6f..8e8907c 100644 (file)
@@ -120,9 +120,9 @@ EXTRA_DIST += \
        extras/package/macosx/Resources/English.lproj/Update.nib/classes.nib \
        extras/package/macosx/Resources/English.lproj/Update.nib/info.nib \
        extras/package/macosx/Resources/English.lproj/Update.nib/keyedobjects.nib \
-       extras/package/macosx/Resources/English.lproj/Interaction.nib/classes.nib \
-       extras/package/macosx/Resources/English.lproj/Interaction.nib/info.nib \
-       extras/package/macosx/Resources/English.lproj/Interaction.nib/keyedobjects.nib \
+       extras/package/macosx/Resources/English.lproj/CoreDialogs.nib/classes.nib \
+       extras/package/macosx/Resources/English.lproj/CoreDialogs.nib/info.nib \
+       extras/package/macosx/Resources/English.lproj/CoreDialogs.nib/keyedobjects.nib \
        extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/classes.nib \
        extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/info.nib \
        extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib \
diff --git a/extras/package/macosx/Resources/English.lproj/Interaction.nib/classes.nib b/extras/package/macosx/Resources/English.lproj/Interaction.nib/classes.nib
deleted file mode 100644 (file)
index 15d18c5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-{
-    IBClasses = (
-        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
-        {
-            ACTIONS = {cancelAndClose = id; cancelDialog = id; okayAndClose = id; }; 
-            CLASS = VLCInteraction; 
-            LANGUAGE = ObjC; 
-            OUTLETS = {
-                "o_auth_cancel_btn" = id; 
-                "o_auth_description" = id; 
-                "o_auth_login_fld" = id; 
-                "o_auth_login_txt" = id; 
-                "o_auth_ok_btn" = id; 
-                "o_auth_pw_fld" = id; 
-                "o_auth_pw_txt" = id; 
-                "o_auth_title" = id; 
-                "o_auth_win" = id; 
-                "o_input_cancel_btn" = id; 
-                "o_input_description" = id; 
-                "o_input_fld" = id; 
-                "o_input_ok_btn" = id; 
-                "o_input_title" = id; 
-                "o_input_win" = id; 
-                "o_prog_bar" = id; 
-                "o_prog_cancel_btn" = id; 
-                "o_prog_description" = id; 
-                "o_prog_timeToGo" = 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/package/macosx/Resources/English.lproj/Interaction.nib/info.nib b/extras/package/macosx/Resources/English.lproj/Interaction.nib/info.nib
deleted file mode 100644 (file)
index 39b368d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?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>97 142 356 240 0 0 1440 878 </string>
-       <key>IBFramework Version</key>
-       <string>446.1</string>
-       <key>IBOpenObjects</key>
-       <array>
-               <integer>55</integer>
-               <integer>79</integer>
-               <integer>5</integer>
-       </array>
-       <key>IBSystem Version</key>
-       <string>8J135</string>
-</dict>
-</plist>
diff --git a/extras/package/macosx/Resources/English.lproj/Interaction.nib/keyedobjects.nib b/extras/package/macosx/Resources/English.lproj/Interaction.nib/keyedobjects.nib
deleted file mode 100644 (file)
index b40051a..0000000
Binary files a/extras/package/macosx/Resources/English.lproj/Interaction.nib/keyedobjects.nib and /dev/null differ
index 36b159a..714b48f 100644 (file)
@@ -1,59 +1,53 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-       <key>IBClasses</key>
-       <array>
-               <dict>
-                       <key>CLASS</key>
-                       <string>NSApplication</string>
-                       <key>LANGUAGE</key>
-                       <string>ObjC</string>
-                       <key>SUPERCLASS</key>
-                       <string>NSResponder</string>
-               </dict>
-               <dict>
-                       <key>ACTIONS</key>
-                       <dict>
-                               <key>cleanupTable</key>
-                               <string>id</string>
-                               <key>showMessages</key>
-                               <string>id</string>
-                       </dict>
-                       <key>CLASS</key>
-                       <string>VLCErrorInteractionPanel</string>
-                       <key>LANGUAGE</key>
-                       <string>ObjC</string>
-                       <key>OUTLETS</key>
-                       <dict>
-                               <key>o_cleanup_button</key>
-                               <string>id</string>
-                               <key>o_error_table</key>
-                               <string>id</string>
-                               <key>o_messages_btn</key>
-                               <string>id</string>
-                               <key>o_window</key>
-                               <string>id</string>
-                       </dict>
-                       <key>SUPERCLASS</key>
-                       <string>NSObject</string>
-               </dict>
-               <dict>
-                       <key>CLASS</key>
-                       <string>FirstResponder</string>
-                       <key>LANGUAGE</key>
-                       <string>ObjC</string>
-                       <key>SUPERCLASS</key>
-                       <string>NSObject</string>
-               </dict>
-               <dict>
-                       <key>CLASS</key>
-                       <string>NSObject</string>
-                       <key>LANGUAGE</key>
-                       <string>ObjC</string>
-               </dict>
-       </array>
-       <key>IBVersion</key>
-       <string>1</string>
-</dict>
-</plist>
+{
+    IBClasses =     (
+                {
+            CLASS = FirstResponder;
+            LANGUAGE = ObjC;
+            SUPERCLASS = NSObject;
+        },
+                {
+            CLASS = NSApplication;
+            LANGUAGE = ObjC;
+            SUPERCLASS = NSResponder;
+        },
+                {
+            CLASS = NSObject;
+            LANGUAGE = ObjC;
+        },
+                {
+            ACTIONS =             {
+                loginDialogAction = id;
+            };
+            CLASS = VLCCoreDialogSupport;
+            LANGUAGE = ObjC;
+            OUTLETS =             {
+                "o_auth_cancel_btn" = id;
+                "o_auth_description_txt" = id;
+                "o_auth_login_fld" = id;
+                "o_auth_login_txt" = id;
+                "o_auth_ok_btn" = id;
+                "o_auth_pw_fld" = id;
+                "o_auth_pw_txt" = id;
+                "o_auth_title_txt" = id;
+                "o_auth_win" = id;
+            };
+            SUPERCLASS = NSObject;
+        },
+                {
+            ACTIONS =             {
+                cleanupTable = id;
+                showMessages = id;
+            };
+            CLASS = VLCErrorPanel;
+            LANGUAGE = ObjC;
+            OUTLETS =             {
+                "o_cleanup_button" = id;
+                "o_error_table" = id;
+                "o_messages_btn" = id;
+                "o_window" = id;
+            };
+            SUPERCLASS = NSObject;
+        }
+    );
+    IBVersion = 1;
+}
\ No newline at end of file
index a6b2025..2d8706d 100644 (file)
@@ -2,18 +2,20 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+       <key>IBDocumentLocation</key>
+       <string>296 102 421 299 0 0 1280 778 </string>
        <key>IBFramework Version</key>
-       <string>644</string>
+       <string>489.0</string>
        <key>IBLastKnownRelativeProjectPath</key>
        <string>../../vlc.xcodeproj</string>
        <key>IBOldestOS</key>
        <integer>5</integer>
        <key>IBOpenObjects</key>
        <array>
-               <integer>6</integer>
+               <integer>32</integer>
        </array>
        <key>IBSystem Version</key>
-       <string>9C31</string>
+       <string>9G55</string>
        <key>targetFramework</key>
        <string>IBCocoaFramework</string>
 </dict>
index da27ee8..8a6db3e 100644 (file)
Binary files a/extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib and b/extras/package/macosx/Resources/English.lproj/InteractionErrorPanel.nib/keyedobjects.nib differ
index ecc7e35..53ad568 100644 (file)
@@ -7,6 +7,7 @@
        objects = {
 
 /* Begin PBXBuildFile section */
+               CC0FB34C0F8BED1100F057F7 /* CoreDialogs.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC0FB34A0F8BED1100F057F7 /* CoreDialogs.nib */; };
                CC402EB00E00ABBB006A4BA4 /* vlc.icns in Resources */ = {isa = PBXBuildFile; fileRef = F74F13DF02C2A53401EE194C /* vlc.icns */; };
                CC402EB10E00ABBB006A4BA4 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = F74F13EA02C2A79C01EE194C /* MainMenu.nib */; };
                CC402EB20E00ABBB006A4BA4 /* divx.icns in Resources */ = {isa = PBXBuildFile; fileRef = F6E4F90A02D2648B01A80112 /* divx.icns */; };
@@ -84,7 +85,6 @@
                CC402EFB0E00ABBB006A4BA4 /* skip_forward_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A704095AE51600018C74 /* skip_forward_embedded_blue.png */; };
                CC402EFC0E00ABBB006A4BA4 /* skip_previous_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F2A705095AE51600018C74 /* skip_previous_embedded_blue.png */; };
                CC402EFD0E00ABBB006A4BA4 /* Update.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC26BF2A09A7A05000E94D62 /* Update.nib */; };
-               CC402EFE0E00ABBB006A4BA4 /* Interaction.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */; };
                CC402EFF0E00ABBB006A4BA4 /* InteractionErrorPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */; };
                CC402F000E00ABBB006A4BA4 /* add_embedded_blue.png in Resources */ = {isa = PBXBuildFile; fileRef = CC4ED9AC0ABE07C800CA4CC5 /* add_embedded_blue.png */; };
                CC402F010E00ABBB006A4BA4 /* add_embedded.png in Resources */ = {isa = PBXBuildFile; fileRef = CC4ED9AD0ABE07C800CA4CC5 /* add_embedded.png */; };
                CC0B723A0D54F2B000448E00 /* spref_cone_Interface_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Interface_64.png; path = Resources/spref_cone_Interface_64.png; sourceTree = "<group>"; };
                CC0B723B0D54F2B000448E00 /* spref_cone_Subtitles_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Subtitles_64.png; path = Resources/spref_cone_Subtitles_64.png; sourceTree = "<group>"; };
                CC0B723C0D54F2B000448E00 /* spref_cone_Video_64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = spref_cone_Video_64.png; path = Resources/spref_cone_Video_64.png; sourceTree = "<group>"; };
+               CC0FB34B0F8BED1100F057F7 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/CoreDialogs.nib; sourceTree = "<group>"; };
                CC1941240B9C1F8400635F6B /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = "<absolute>"; };
                CC1AC1BB0A7BDA41002478C3 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/InteractionErrorPanel.nib; sourceTree = "<group>"; };
-               CC1B4B4C09A8CF9E0078AD2E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = Resources/English.lproj/Interaction.nib; sourceTree = "<group>"; };
                CC1B4C1409A8EC690078AD2E /* interaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = interaction.h; path = ../../../modules/gui/macosx/interaction.h; sourceTree = "<group>"; };
                CC1B4C1509A8EC690078AD2E /* interaction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = interaction.m; path = ../../../modules/gui/macosx/interaction.m; sourceTree = "<group>"; };
                CC1C41D00D9BAD7F002728FA /* noart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = noart.png; path = Resources/noart.png; sourceTree = "<group>"; };
                DCF358BC077F1236007DB450 /* nibs */ = {
                        isa = PBXGroup;
                        children = (
+                               CC0FB34A0F8BED1100F057F7 /* CoreDialogs.nib */,
                                CCB60A400E6E5E3F00407004 /* VLM.nib */,
                                CCC896B80D9AA9E8005AE59C /* MediaInfo.nib */,
                                DCA00AA7075F948800E6BF46 /* About.nib */,
                                DC7F46EB08A183FC0027DB24 /* Extended.nib */,
                                DCE7BD0308A56C8B007B10AE /* Bookmarks.nib */,
                                CC26BF2A09A7A05000E94D62 /* Update.nib */,
-                               CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */,
                                CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */,
                        );
                        name = nibs;
                                CC402EFB0E00ABBB006A4BA4 /* skip_forward_embedded_blue.png in Resources */,
                                CC402EFC0E00ABBB006A4BA4 /* skip_previous_embedded_blue.png in Resources */,
                                CC402EFD0E00ABBB006A4BA4 /* Update.nib in Resources */,
-                               CC402EFE0E00ABBB006A4BA4 /* Interaction.nib in Resources */,
                                CC402EFF0E00ABBB006A4BA4 /* InteractionErrorPanel.nib in Resources */,
                                CC402F000E00ABBB006A4BA4 /* add_embedded_blue.png in Resources */,
                                CC402F010E00ABBB006A4BA4 /* add_embedded.png in Resources */,
                                CCD90F4E0E87C86D0034564A /* add_schedule.png in Resources */,
                                CCD90F4F0E87C86D0034564A /* add_vod.png in Resources */,
                                CCD90F500E87C86D0034564A /* add_broadcast.png in Resources */,
+                               CC0FB34C0F8BED1100F057F7 /* CoreDialogs.nib in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
 /* End PBXRezBuildPhase section */
 
 /* Begin PBXVariantGroup section */
-               CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */ = {
+               CC0FB34A0F8BED1100F057F7 /* CoreDialogs.nib */ = {
                        isa = PBXVariantGroup;
                        children = (
-                               CC1AC1BB0A7BDA41002478C3 /* English */,
+                               CC0FB34B0F8BED1100F057F7 /* English */,
                        );
-                       name = InteractionErrorPanel.nib;
+                       name = CoreDialogs.nib;
                        sourceTree = "<group>";
                };
-               CC1B4B4B09A8CF9E0078AD2E /* Interaction.nib */ = {
+               CC1AC1BA0A7BDA41002478C3 /* InteractionErrorPanel.nib */ = {
                        isa = PBXVariantGroup;
                        children = (
-                               CC1B4B4C09A8CF9E0078AD2E /* English */,
+                               CC1AC1BB0A7BDA41002478C3 /* English */,
                        );
-                       name = Interaction.nib;
+                       name = InteractionErrorPanel.nib;
                        sourceTree = "<group>";
                };
                CC26BF2A09A7A05000E94D62 /* Update.nib */ = {
index b933dc3..882d87a 100644 (file)
@@ -40,7 +40,7 @@
     NSMutableArray * o_errors;
     NSMutableArray * o_icons;
     
-    BOOL nib_interact_errpanel_loaded;
+    BOOL nib_loaded;
 }
 - (IBAction)cleanupTable:(id)sender;
 - (IBAction)showMessages:(id)sender;
 
 
 /*****************************************************************************
- * VLCCoreDialogSupport interface
+ * VLCCoreDialogProvider interface
  *****************************************************************************/
-@interface VLCCoreDialogSupport : NSObject
+@interface VLCCoreDialogProvider : 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
- *****************************************************************************/
-
-#if 0
-@interface VLCInteraction : NSObject
-{
-    /* progress dialogue */
-    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;
-    IBOutlet id o_prog_timeToGo;
 
     /* authentication dialogue */
     IBOutlet id o_auth_cancel_btn;
-    IBOutlet id o_auth_description;
+    IBOutlet id o_auth_description_txt;
     IBOutlet id o_auth_login_fld;
     IBOutlet id o_auth_login_txt;
     IBOutlet id o_auth_ok_btn;
     IBOutlet id o_auth_pw_fld;
     IBOutlet id o_auth_pw_txt;
-    IBOutlet id o_auth_title;
+    IBOutlet id o_auth_title_txt;
     IBOutlet id o_auth_win;
 
-    vlc_object_t * p_dialog;
-    intf_thread_t * p_intf;
-    NSProgressIndicator * o_mainIntfPgbar;
-    BOOL nib_interact_loaded;
+    /* progress dialogue */
+    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;
+    IBOutlet id o_prog_timeToGo;
 }
++ (VLCCoreDialogProvider *)sharedInstance;
+
+-(void)performDialogEvent: (NSNotification *)o_notification;
 
-- (IBAction)okayAndClose:(id)sender;
-- (IBAction)cancelDialog:(id)sender;
+-(void)showFatalDialog: (NSValue *)o_value;
+-(void)showQuestionDialog: (NSValue *)o_value;
+-(void)showLoginDialog: (NSValue *)o_value;
+-(IBAction)loginDialogAction:(id)sender;
 
--(id)initDialog: (vlc_object_t *)_p_dialog;
--(void)runDialog;
--(void)updateDialog;
--(void)hideDialog;
--(void)destroyDialog;
+-(id)getErrorPanel;
 
-@end
-#endif
+@end
\ No newline at end of file
index ed4abf3..cc5c1e1 100644 (file)
 #import <ApplicationServices/ApplicationServices.h>
 
 /*****************************************************************************
- * VLCCoreDialogSupport implementation
+ * VLCCoreDialogProvider implementation
  *****************************************************************************/
-@implementation VLCCoreDialogSupport
+@implementation VLCCoreDialogProvider
+
+static VLCCoreDialogProvider *_o_sharedInstance = nil;
+
++ (VLCCoreDialogProvider *)sharedInstance
+{
+    return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
+}
 
 -(id)init
 {
-    [super init];
-    o_interaction_list = [[NSMutableArray alloc] initWithCapacity:1];
-    [[NSNotificationCenter defaultCenter] addObserver:self
-        selector:@selector(newInteractionEvent:)
-        name: @"VLCNewCoreDialogEventNotification"
-        object:self];
+    if( _o_sharedInstance )
+        [self dealloc];
+    else
+    {
+        _o_sharedInstance = [super init];
+        [[NSNotificationCenter defaultCenter] addObserver:self
+                                                 selector:@selector(performDialogEvent:)
+                                                     name: @"VLCNewCoreDialogEventNotification"
+                                                   object:self];
+        
+        o_error_panel = [[VLCErrorPanel alloc] init];
+    }
+    
+    return _o_sharedInstance;
+}
 
-    o_error_panel = [[VLCErrorPanel alloc] init];
+-(void)awakeFromNib
+{
+    [o_auth_login_txt setStringValue: _NS("User name")];
+    [o_auth_pw_txt setStringValue: _NS("Password")];
+    [o_auth_cancel_btn setTitle: _NS("Cancel")];
+    [o_auth_ok_btn setTitle: _NS("OK")];
+    [o_prog_cancel_btn setTitle: _NS("Cancel")];
+    [o_prog_bar setUsesThreadedAnimation: YES];
 
-    return self;
-}
+}    
 
--(void)newInteractionEvent: (NSNotification *)o_notification
+-(void)performDialogEvent: (NSNotification *)o_notification
 {
     NSValue *o_value = [[o_notification userInfo] objectForKey:@"VLCDialogPointer"];
     NSString *o_type = [[o_notification userInfo] objectForKey:@"VLCDialogType"];
         [self showFatalDialog: o_value];
     else if( [o_type isEqualToString: @"dialog-question"] )
         [self showQuestionDialog: o_value];
+    else if( [o_type isEqualToString: @"dialog-login"] )
+        [self showLoginDialog: o_value];
     else
         msg_Err( VLCIntf, "unhandled dialog type: '%s'", [o_type UTF8String] );
-
-#if 0
-    switch( p_dialog->i_action )
-    {
-    case INTERACT_NEW:
-        [self addInteraction: p_dialog];
-        break;
-    case INTERACT_UPDATE:
-        o_interaction = (VLCInteraction *)p_dialog->p_private;
-        [o_interaction updateDialog];
-        break;
-    case INTERACT_HIDE:
-        o_interaction = (VLCInteraction *)p_dialog->p_private;
-        [o_interaction hideDialog];
-        break;
-    case INTERACT_DESTROY:
-        o_interaction = (VLCInteraction *)p_dialog->p_private;
-        [o_interaction destroyDialog];
-        [self removeInteraction:o_interaction];
-        p_dialog->i_status = DESTROYED_DIALOG;
-        break;
-    }
-#endif
 }
 
 -(void)showFatalDialog: (NSValue *)o_value
         p_dialog->answer = 3;
 }
 
-#if 0
--(void)addInteraction: (interaction_dialog_t *)p_dialog
+-(void)showLoginDialog: (NSValue *)o_value
 {
-    VLCInteraction *o_interaction = [[VLCInteraction alloc] initDialog: p_dialog];
-    p_dialog->p_private = (void *)o_interaction;
-    [o_interaction_list addObject:[o_interaction autorelease]];
-    [o_interaction runDialog];
+    dialog_login_t *p_dialog = [o_value pointerValue];
+    NSInteger i_returnValue = 0;
+
+    [o_auth_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]];
+    [o_auth_win setTitle: [NSString stringWithUTF8String: p_dialog->title]];
+    [o_auth_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]];
+    [o_auth_login_fld setStringValue: @""];
+    [o_auth_pw_fld setStringValue: @""];
+
+    [o_auth_win center];
+    i_returnValue = [NSApp runModalForWindow: o_auth_win];
+    [o_auth_win close];
+    if( i_returnValue )
+    {
+        *p_dialog->username = strdup( [[o_auth_login_fld stringValue] UTF8String] );
+        *p_dialog->password = strdup( [[o_auth_pw_fld stringValue] UTF8String] );
+    }
+    else
+    {
+         *p_dialog->username = *p_dialog->password = NULL;
+    }
 }
 
--(void)removeInteraction: (VLCInteraction *)o_interaction
+-(IBAction)loginDialogAction:(id)sender
 {
-    [o_interaction_list removeObject:o_interaction];
+    if( [[sender title] isEqualToString: _NS("OK")] )
+        [NSApp stopModalWithCode: 1];
+    else
+        [NSApp stopModalWithCode: 0];
 }
-#endif
 
 -(id)getErrorPanel
 {
 -(void)dealloc
 {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
-    [o_interaction_list removeAllObjects];
-    [o_interaction_list release];
     [super dealloc];
 }
 @end
 
-/*****************************************************************************
- * VLCInteraction implementation
- *****************************************************************************/
 #if 0
-@implementation VLCInteraction
-
--(id)initDialog: (vlc_object_t *)_p_dialog
-{
-    p_intf = VLCIntf;
-    [super init];
-    p_dialog = _p_dialog;
-    return self;
-}
-
--(void)runDialog
-{
-    id o_window = NULL;
-    if( !p_dialog )
-        msg_Err( p_intf, "no available interaction framework" );
-
-    if( !nib_interact_loaded )
-    {
-        nib_interact_loaded = [NSBundle loadNibNamed:@"Interaction" owner:self];
-        [o_prog_cancel_btn setTitle: _NS("Cancel")];
-        [o_prog_bar setUsesThreadedAnimation: YES];
-        [o_auth_login_txt setStringValue: _NS("Login:")];
-        [o_auth_pw_txt setStringValue: _NS("Password:")];
-        [o_auth_cancel_btn setTitle: _NS("Cancel")];
-        [o_auth_ok_btn setTitle: _NS("OK")];
-        o_mainIntfPgbar = [[VLCMain sharedInstance] getMainIntfPgbar];
-    }
-
-    NSString *o_title = [NSString stringWithUTF8String:p_dialog->psz_title ? p_dialog->psz_title : _("Error")];
-    NSString *o_description = [NSString stringWithUTF8String:p_dialog->psz_description ? p_dialog->psz_description : ""];
-    NSString *o_defaultButton = p_dialog->psz_default_button ? [NSString stringWithUTF8String:p_dialog->psz_default_button] : nil;
-    NSString *o_alternateButton = p_dialog->psz_alternate_button ? [NSString stringWithUTF8String:p_dialog->psz_alternate_button] : nil;
-    NSString *o_otherButton = p_dialog->psz_other_button ? [NSString stringWithUTF8String:p_dialog->psz_other_button] : nil;
-
-    vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
-    if( p_vout != NULL )
-    {
-        NSEnumerator * o_enum = [[NSApp orderedWindows] objectEnumerator];
-
-        while( ( o_window = [o_enum nextObject] ) )
-        {
-            if( [[o_window className] isEqualToString: @"VLCVoutWindow"] )
-            {
-                vlc_object_release( (vlc_object_t *)p_vout );
-                break;
-            }
-        }
-        vlc_object_release( (vlc_object_t *)p_vout );
-    }
-    else
-    {
-        o_window = [NSApp mainWindow];
-    }
-
-    msg_Dbg( p_intf, "Title: %s", [o_title UTF8String] );
-    msg_Dbg( p_intf, "Description: %s", [o_description UTF8String] );
-
-#if 0
-    dialog_question_t
-    {
-        msg_Dbg( p_intf, "yes-no-cancel-dialog requested" );
-        NSBeginInformationalAlertSheet( o_title, o_defaultButton,
-            o_alternateButton, o_otherButton, o_window, self,
-            @selector(sheetDidEnd: returnCode: contextInfo:), NULL, nil,
-            o_description );
-    }
-
-    dialog_login_t
-    {
-        msg_Dbg( p_intf, "dialog for login and pw requested" );
-        [o_auth_title setStringValue: o_title];
-        [o_auth_description setStringValue: o_description];
-        [o_auth_login_fld setStringValue: @""];
-        [o_auth_pw_fld setStringValue: @""];
-        [NSApp beginSheet: o_auth_win modalForWindow: o_window
-            modalDelegate: self didEndSelector: nil contextInfo: nil];
-        [o_auth_win makeKeyWindow];
-    }
-
     dialog_progress_bar_t
     {
         msg_Dbg( p_intf, "user progress dialog requested" );
             modalDelegate: self didEndSelector: nil contextInfo: nil];
         [o_prog_win makeKeyWindow];
     }
-
-    DIALOG_INTF_PROGRESS
-    {
-        msg_Dbg( p_intf, "progress-bar in main intf requested" );
-        [[VLCMain sharedInstance] setScrollField: o_description stopAfter: -1];
-        [o_mainIntfPgbar setDoubleValue: (double)p_dialog->val.f_float];
-        [o_mainIntfPgbar setHidden: NO];
-        [[[VLCMain sharedInstance] getControllerWindow] makeKeyWindow];
-        [o_mainIntfPgbar setIndeterminate: NO];
-    }
-#endif
-}
-
 -(void)updateDialog
 {
     if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
         return;
     }
 }
-
--(void)hideDialog
-{
-    msg_Dbg( p_intf, "hide event %p", self );
-    if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
-    {
-        if([o_prog_win isVisible])
-        {
-            [NSApp endSheet: o_prog_win];
-            [o_prog_win close];
-        }
-    }
-}
-
--(void)destroyDialog
-{
-    msg_Dbg( p_intf, "destroy event" );
-    if( o_mainIntfPgbar )
-        [o_mainIntfPgbar release];
-}
-
-- (IBAction)cancelDialog:(id)sender
-{
-    /* tell core that the user wishes to cancel the dialogue
-     * Use this function if cancelling is optionally like in the progress-dialogue */
-    vlc_mutex_lock( p_dialog->p_lock );
-    p_dialog->b_cancelled = true;
-    vlc_mutex_unlock( p_dialog->p_lock );
-    msg_Dbg( p_intf, "cancelling dialog, will close it later on" );
-}
-
-- (IBAction)okayAndClose:(id)sender
-{
-    msg_Dbg( p_intf, "running okayAndClose" );
-    vlc_mutex_lock( p_dialog->p_lock );
-    if( p_dialog->i_flags == DIALOG_LOGIN_PW_OK_CANCEL )
-    {
-        p_dialog->psz_returned[0] = strdup( [[o_auth_login_fld stringValue] UTF8String] );
-        p_dialog->psz_returned[1] = strdup( [[o_auth_pw_fld stringValue] UTF8String] );
-    }
-    else if( p_dialog->i_flags == DIALOG_PSZ_INPUT_OK_CANCEL )
-        p_dialog->psz_returned[0] = strdup( [[o_input_fld stringValue] UTF8String] );
-    p_dialog->i_return = DIALOG_OK_YES;
-    p_dialog->i_status = ANSWERED_DIALOG;
-    vlc_mutex_unlock( p_dialog->p_lock );
-    msg_Dbg( p_intf, "dialog acknowledged" );
-}
-
-@end
 #endif
+
 /*****************************************************************************
  * VLCErrorPanel implementation
  *****************************************************************************/
 {
     [super init];
 
-    /* load the nib */
-    nib_interact_errpanel_loaded = [NSBundle loadNibNamed:@"InteractionErrorPanel" owner:self];
+    nib_loaded = [NSBundle loadNibNamed:@"InteractionErrorPanel" owner:self];
 
     /* init strings */
     [o_window setTitle: _NS("Errors and Warnings")];
index d27fb28..1bbb4d7 100644 (file)
@@ -106,7 +106,7 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     id o_bookmarks;             /* VLCBookmarks   */
     id o_vlm;                   /* VLCVLMController */
     id o_embedded_list;         /* VLCEmbeddedList*/
-    id o_interaction_list;      /* VLCInteractionList*/
+    id o_coredialogs;           /* VLCCoreDialogProvider */
     VLCInformation * o_info;                  /* VLCInformation */
 #ifdef UPDATE_CHECK
     id o_update;                /* VLCUpdate      */
@@ -122,6 +122,7 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
     BOOL nib_update_loaded;     /* update nibfile */
     BOOL nib_info_loaded;       /* information panel nibfile */
     BOOL nib_vlm_loaded;        /* VLM Panel nibfile */
+    BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
 
     IBOutlet VLControllerWindow * o_window;                     /* main window */
     IBOutlet NSView * o_playlist_view;                          /* playlist view  */
@@ -354,7 +355,7 @@ static void MsgCallback( msg_cb_data_t *, msg_item_t *, unsigned );
 - (id)getWizard;
 - (id)getBookmarks;
 - (id)getEmbeddedList;
-- (id)getInteractionList;
+- (id)getCoreDialogProvider;
 - (id)getMainIntfPgbar;
 - (id)getControllerWindow;
 - (id)getVoutMenu;
index e34600e..cb3afa7 100644 (file)
@@ -234,7 +234,7 @@ static int DialogCallback( vlc_object_t *p_this, const char *type, vlc_value_t p
     NSLog( @"dialog callback triggered; type of dialogue is '%s'", type );
     
     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]];
+    [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewCoreDialogEventNotification" object:[interface getCoreDialogProvider] userInfo:[NSDictionary dictionaryWithObjectsAndKeys: o_value, @"VLCDialogPointer", [NSString stringWithUTF8String: type], @"VLCDialogType", nil]];
 
     [o_pool release];
     return VLC_SUCCESS;
@@ -285,7 +285,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     o_extended = nil;
     o_bookmarks = [[VLCBookmarks alloc] init];
     o_embedded_list = [[VLCEmbeddedList alloc] init];
-    o_interaction_list = [[VLCCoreDialogSupport alloc] init];
+    o_coredialogs = [[VLCCoreDialogProvider alloc] init];
     o_info = [[VLCInfo alloc] init];
 #ifdef UPDATE_CHECK
     o_update = [[VLCUpdate alloc] init];
@@ -463,6 +463,9 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     pl_Release( p_intf );
 
+    /* load our Core Dialogs nib */
+    nib_coredialogs_loaded = [NSBundle loadNibNamed:@"CoreDialogs" owner: NSApp];
+    
     /* subscribe to various interactive dialogues */
     var_Create( p_intf, "dialog-fatal", VLC_VAR_ADDRESS );
     var_AddCallback( p_intf, "dialog-fatal", DialogCallback, self );
@@ -792,7 +795,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     [crashLogURLConnection release];
  
     [o_embedded_list release];
-    [o_interaction_list release];
+    [o_coredialogs release];
     [o_eyetv release];
 
     [o_img_pause_pressed release];
@@ -1388,10 +1391,10 @@ static unsigned int VLCModifiersToCocoa( unsigned int i_key )
     return nil;
 }
 
-- (id)getInteractionList
+- (id)getCoreDialogProvider
 {
-    if( o_interaction_list )
-        return o_interaction_list;
+    if( o_coredialogs )
+        return o_coredialogs;
 
     return nil;
 }
@@ -2121,8 +2124,7 @@ end:
 
 - (IBAction)showBookmarks:(id)sender
 {
-    dialog_Question( p_intf, _("Video Settings not saved"),
-                 _("An error occured while saving your settings via SimplePrefs."), "Yes", "No", "Cancel" );
+    dialog_Fatal( p_intf, "Title", "Message" );
 
     /* we need the wizard-nib for the bookmarks's extract functionality */
     if( !nib_wizard_loaded )
@@ -2431,7 +2433,7 @@ end:
 
 - (IBAction)viewErrorsAndWarnings:(id)sender
 {
-    [[[self getInteractionList] getErrorPanel] showPanel];
+    [[[self getCoreDialogProvider] getErrorPanel] showPanel];
 }
 
 - (IBAction)showMessagesPanel:(id)sender
index 8bd96f0..02f291a 100644 (file)
 - (IBAction)recursiveExpandNode:(id)sender;
 
 - (IBAction)addNode:(id)sender;
-- (void)addNodeThreadedly;
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
 - (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position enqueue:(BOOL)b_enqueue;
index 8a81ce7..20988a5 100644 (file)
 
 - (IBAction)addNode:(id)sender
 {
-    /* we have to create a new thread here because otherwise we would block the
-     * interface since the interaction-stuff and this code would run in the same
-     * thread */
-    [NSThread detachNewThreadSelector: @selector(addNodeThreadedly)
-        toTarget: self withObject:nil];
-    [self playlistUpdated];
-}
-
-- (void)addNodeThreadedly
-{
-    NSAutoreleasePool * ourPool = [[NSAutoreleasePool alloc] init];
-
-    /* simply adds a new node to the end of the playlist */
     playlist_t * p_playlist = pl_Hold( VLCIntf );
     vlc_thread_set_priority( p_playlist, VLC_THREAD_PRIORITY_LOW );
 
                                       p_playlist->p_local_category, 0, NULL );
     PL_UNLOCK;
 
-    free( psz_name );
     pl_Release( VLCIntf );
-    [ourPool release];
-}
 
+    [self playlistUpdated];
+}
 @end
 
 @implementation VLCPlaylist (NSOutlineViewDataSource)