From b67e6fc2b71b626ee1533f0631ec4e6f0a3f1f1b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Felix=20Paul=20K=C3=BChne?= Date: Sun, 14 May 2006 13:07:29 +0000 Subject: [PATCH] * first implementation of a widget-free authentication-dialogue (core and OSX only, refs #553) --- include/vlc_interaction.h | 3 +++ modules/gui/macosx/interaction.m | 12 +++++++----- src/interface/interaction.c | 19 +++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/vlc_interaction.h b/include/vlc_interaction.h index d77c80bae7..25aeb6dfd4 100644 --- a/include/vlc_interaction.h +++ b/include/vlc_interaction.h @@ -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 diff --git a/modules/gui/macosx/interaction.m b/modules/gui/macosx/interaction.m index a65d8fe2e6..a4c9e67d98 100644 --- a/modules/gui/macosx/interaction.m +++ b/modules/gui/macosx/interaction.m @@ -192,9 +192,9 @@ 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]; @@ -236,10 +236,12 @@ 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 ) { @@ -254,7 +256,7 @@ -(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]; diff --git a/src/interface/interaction.c b/src/interface/interaction.c index 7647211002..466cb14b7f 100644 --- a/src/interface/interaction.c +++ b/src/interface/interaction.c @@ -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) ; -- 2.39.2