Commit b67e6fc2 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* first implementation of a widget-free authentication-dialogue (core and OSX only, refs #553)

parent 96053dfb
...@@ -55,6 +55,8 @@ struct interaction_dialog_t ...@@ -55,6 +55,8 @@ struct interaction_dialog_t
char *psz_returned[1]; ///< returned responses from the user 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 int i_widgets; ///< Number of dialog widgets
user_widget_t **pp_widgets; ///< Dialog widgets user_widget_t **pp_widgets; ///< Dialog widgets
...@@ -80,6 +82,7 @@ struct interaction_dialog_t ...@@ -80,6 +82,7 @@ struct interaction_dialog_t
#define DIALOG_CLEAR_NOSHOW 0x08 #define DIALOG_CLEAR_NOSHOW 0x08
#define DIALOG_GOT_ANSWER 0x10 #define DIALOG_GOT_ANSWER 0x10
#define DIALOG_LOGIN_PW_OK_CANCEL 0x20 #define DIALOG_LOGIN_PW_OK_CANCEL 0x20
#define DIALOG_USER_PROGRESS 0x40
/** /**
* Possible return codes * Possible return codes
......
...@@ -192,9 +192,9 @@ ...@@ -192,9 +192,9 @@
modalDelegate: self didEndSelector: nil contextInfo: nil]; modalDelegate: self didEndSelector: nil contextInfo: nil];
[o_auth_win makeKeyWindow]; [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_title setStringValue: o_title];
[o_prog_description setStringValue: o_description]; [o_prog_description setStringValue: o_description];
[o_prog_bar setDoubleValue: 0]; [o_prog_bar setDoubleValue: 0];
...@@ -236,10 +236,12 @@ ...@@ -236,10 +236,12 @@
int i = 0; int i = 0;
for( i = 0 ; i< p_dialog->i_widgets; i++ ) 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: \ [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 ) if( [o_prog_bar doubleValue] == 100.0 )
{ {
...@@ -254,7 +256,7 @@ ...@@ -254,7 +256,7 @@
-(void)hideDialog -(void)hideDialog
{ {
msg_Dbg( p_intf, "hide event" ); 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]; [NSApp endSheet: o_prog_win];
[o_prog_win close]; [o_prog_win close];
......
...@@ -339,20 +339,15 @@ int __intf_UserProgress( vlc_object_t *p_this, ...@@ -339,20 +339,15 @@ int __intf_UserProgress( vlc_object_t *p_this,
{ {
int i_ret; int i_ret;
interaction_dialog_t *p_new = NULL; interaction_dialog_t *p_new = NULL;
user_widget_t *p_widget = NULL;
INTERACT_INIT( p_new ); INTERACT_INIT( p_new );
p_new->i_type = INTERACT_DIALOG_ONEWAY; p_new->i_type = INTERACT_DIALOG_ONEWAY;
p_new->psz_title = strdup( psz_title ); p_new->psz_title = strdup( psz_title );
p_new->psz_description = strdup( psz_status );
p_new->val.f_float = f_pos;
/* Progress bar */ p_new->i_flags = DIALOG_USER_PROGRESS;
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 );
i_ret = intf_Interact( p_this, p_new ); i_ret = intf_Interact( p_this, p_new );
...@@ -383,11 +378,11 @@ void __intf_UserProgressUpdate( vlc_object_t *p_this, int i_id, ...@@ -383,11 +378,11 @@ void __intf_UserProgressUpdate( vlc_object_t *p_this, int i_id,
return; return;
} }
if( p_dialog->pp_widgets[0]->psz_text ) if( p_dialog->psz_description )
free( p_dialog->pp_widgets[0]->psz_text ); free( p_dialog->psz_description );
p_dialog->pp_widgets[0]->psz_text = strdup( psz_status ); 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; p_dialog->i_status = UPDATED_DIALOG;
vlc_mutex_unlock( &p_interaction->object_lock) ; vlc_mutex_unlock( &p_interaction->object_lock) ;
......
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