]> git.sesse.net Git - vlc/commitdiff
* first implementation of a widget-free authentication-dialogue (core and OSX only...
authorFelix Paul Kühne <fkuehne@videolan.org>
Sun, 14 May 2006 13:07:29 +0000 (13:07 +0000)
committerFelix Paul Kühne <fkuehne@videolan.org>
Sun, 14 May 2006 13:07:29 +0000 (13:07 +0000)
include/vlc_interaction.h
modules/gui/macosx/interaction.m
src/interface/interaction.c

index d77c80bae708c5f3a1530ce77f81986571786978..25aeb6dfd454f55cb3cad07bb83ca7d71383f3fa 100644 (file)
@@ -55,6 +55,8 @@ struct interaction_dialog_t
 
     char           *psz_returned[1];    ///< returned responses from the user
 
+    vlc_value_t     val;                ///< a value coming from core for dialogue
+
     int             i_widgets;          ///< Number of dialog widgets
     user_widget_t **pp_widgets;         ///< Dialog widgets
 
@@ -80,6 +82,7 @@ struct interaction_dialog_t
 #define DIALOG_CLEAR_NOSHOW         0x08
 #define DIALOG_GOT_ANSWER           0x10
 #define DIALOG_LOGIN_PW_OK_CANCEL   0x20
+#define DIALOG_USER_PROGRESS        0x40
 
 /**
  * Possible return codes
index a65d8fe2e632cd7eab41678467ad823c72115367..a4c9e67d98288472dc9599b9391542cd892bfda2 100644 (file)
                 modalDelegate: self didEndSelector: nil contextInfo: nil];
             [o_auth_win makeKeyWindow];
         }
-        else if( p_dialog->i_type & WIDGET_PROGRESS )
+        else if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
         {
-            msg_Dbg( p_intf, "requested type: WIDGET_PROGRESS" );
+            msg_Dbg( p_intf, "requested flag: DIALOG_USER_PROGRESS" );
             [o_prog_title setStringValue: o_title];
             [o_prog_description setStringValue: o_description];
             [o_prog_bar setDoubleValue: 0];
     int i = 0;
     for( i = 0 ; i< p_dialog->i_widgets; i++ )
     {
-        if( p_dialog->i_type & WIDGET_PROGRESS )
+        if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
         {
+            [o_prog_description setStringValue: \
+                [NSString stringWithUTF8String: p_dialog->psz_description]];
             [o_prog_bar setDoubleValue: \
-                (double)(p_dialog->pp_widgets[i]->val.f_float)];
+                (double)(p_dialog->val.f_float)];
 
             if( [o_prog_bar doubleValue] == 100.0 )
             {
 -(void)hideDialog
 {
     msg_Dbg( p_intf, "hide event" );
-    if( p_dialog->i_type & WIDGET_PROGRESS )
+    if( p_dialog->i_flags & DIALOG_USER_PROGRESS )
     {
         [NSApp endSheet: o_prog_win];
         [o_prog_win close];
index 76472110020ca51bf307ecb835cae27bf975d518..466cb14b7f1a6f357bcd11c53465b3f69e55a3f9 100644 (file)
@@ -339,20 +339,15 @@ int __intf_UserProgress( vlc_object_t *p_this,
 {
     int i_ret;
     interaction_dialog_t *p_new = NULL;
-    user_widget_t *p_widget = NULL;
 
     INTERACT_INIT( p_new );
 
     p_new->i_type = INTERACT_DIALOG_ONEWAY;
     p_new->psz_title = strdup( psz_title );
+    p_new->psz_description = strdup( psz_status );
+    p_new->val.f_float = f_pos;
 
-    /* Progress bar */
-    p_widget = (user_widget_t* )malloc( sizeof( user_widget_t ) );
-    p_widget->i_type = WIDGET_PROGRESS;
-    p_widget->psz_text = strdup( psz_status );
-    p_widget->val.f_float = f_pos;
-    INSERT_ELEM ( p_new->pp_widgets, p_new->i_widgets,
-                  p_new->i_widgets,  p_widget );
+    p_new->i_flags = DIALOG_USER_PROGRESS;
 
     i_ret = intf_Interact( p_this, p_new );
 
@@ -383,11 +378,11 @@ void __intf_UserProgressUpdate( vlc_object_t *p_this, int i_id,
         return;
     }
 
-    if( p_dialog->pp_widgets[0]->psz_text )
-        free( p_dialog->pp_widgets[0]->psz_text );
-    p_dialog->pp_widgets[0]->psz_text = strdup( psz_status );
+    if( p_dialog->psz_description )
+        free( p_dialog->psz_description );
+    p_dialog->psz_description = strdup( psz_status );
 
-    p_dialog->pp_widgets[0]->val.f_float = f_pos;
+    p_dialog->val.f_float = f_pos;
 
     p_dialog->i_status = UPDATED_DIALOG;
     vlc_mutex_unlock( &p_interaction->object_lock) ;