Commit 15354b04 authored by Clément Stenac's avatar Clément Stenac

* Handle dialogs needing answer

* Handle interfaces not providing interaction correctly
* Add a new helper to request authentication
* Add return codes
parent 0f6f58c6
......@@ -39,7 +39,7 @@ enum
{
WIDGET_TEXT, //< Text display
WIDGET_PROGRESS, //< A progress bar
WIDGET_INPUT //< Input (backed up by a variable)
WIDGET_INPUT_TEXT //< Input (backed up by a variable)
};
/**
......@@ -52,16 +52,39 @@ struct interaction_dialog_t
char *psz_title; //< Title
char *psz_description; //< Descriptor string
/* For dialogs */
int i_widgets; //< Nu,ber of dialog widgets
user_widget_t **pp_widgets; //< Dialog widgets
vlc_bool_t b_reusable; //< Do we have to reuse this ?
void * p_private; //< Private interface data
int i_status; //< Dialog status;
int i_status; //< Dialog status;
int i_action; //< Action to perform;
int i_flags; //< Misc flags
int i_return; //< Return status
interaction_t *p_interaction; //< Parent interaction object
vlc_object_t *p_parent; //< The vlc object that asked
//for interaction
};
/**
* Possible flags . Reusable and button types
*/
#define DIALOG_REUSABLE 0x01
#define DIALOG_OK_CANCEL 0x02
#define DIALOG_YES_NO 0x04
#define DIALOG_YES_NO_CANCEL 0x04
#define DIALOG_GOT_ANSWER 0x08
/**
* Possible return codes
*/
enum
{
DIALOG_DEFAULT,
DIALOG_OK_YES,
DIALOG_NO,
DIALOG_CANCELLED
};
/**
......@@ -69,12 +92,13 @@ struct interaction_dialog_t
*/
enum
{
NEW_DIALOG,
SENT_DIALOG,
UPDATED_DIALOG,
ANSWERED_DIALOG,
HIDING_DIALOG,
HIDDEN_DIALOG,
NEW_DIALOG, //< Just created
SENT_DIALOG, //< Sent to interface
UPDATED_DIALOG, //< Update to send
ANSWERED_DIALOG, //< Got "answer"
HIDING_DIALOG, //< Hiding requested
HIDDEN_DIALOG, //< Now hidden. Requesting destruction
DESTROYED_DIALOG, //< Interface has destroyed it
};
/**
......@@ -82,11 +106,9 @@ enum
*/
enum
{
INTERACT_PROGRESS, //< Progress bar
INTERACT_WARNING, //< Warning message ("codec not supported")
INTERACT_FATAL, //< Fatal message ("File not found")
INTERACT_FATAL_LIST, //< List of fatal messages ("File not found")
INTERACT_ASK, //< Full-featured dialog box (password)
INTERACT_PROGRESS, //< Progress bar (in the main interface ?)
INTERACT_DIALOG_ONEWAY, //< Dialog box without feedback
INTERACT_DIALOG_TWOWAY, //< Dialog box with feedback
};
/**
......@@ -95,9 +117,7 @@ enum
enum
{
DIALOG_FIRST,
DIALOG_NOACCESS,
DIALOG_NOCODEC,
DIALOG_NOAUDIO,
DIALOG_ERRORS,
DIALOG_LAST_PREDEFINED,
};
......@@ -124,7 +144,8 @@ enum
{
INTERACT_NEW,
INTERACT_UPDATE,
INTERACT_HIDE
INTERACT_HIDE,
INTERACT_DESTROY
};
/***************************************************************************
......@@ -134,8 +155,10 @@ enum
#define intf_Interact( a,b ) __intf_Interact( VLC_OBJECT(a), b )
VLC_EXPORT( int,__intf_Interact,( vlc_object_t *,interaction_dialog_t * ) );
#define intf_UserFatal( a,b, c, d, e... ) __intf_UserFatal( a,b,c,d, ## e )
VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, int, const char*, const char*, ...) );
#define intf_UserFatal( a, c, d, e... ) __intf_UserFatal( a,c,d, ## e )
VLC_EXPORT( void, __intf_UserFatal,( vlc_object_t*, const char*, const char*, ...) );
#define intf_UserLoginPassword( a, b, c, d, e... ) __intf_UserLoginPassword( a,b,c,d,e)
VLC_EXPORT( int, __intf_UserLoginPassword,( vlc_object_t*, const char*, const char*, char **, char **) );
VLC_EXPORT( void, intf_InteractionManage,( playlist_t *) );
VLC_EXPORT( void, intf_InteractionDestroy,( interaction_t *) );
......@@ -92,6 +92,7 @@ struct intf_thread_t
*****************************************************************************/
struct intf_dialog_args_t
{
intf_thread_t *p_intf;
char *psz_title;
char **psz_results;
......@@ -104,6 +105,9 @@ struct intf_dialog_args_t
char *psz_extensions;
vlc_bool_t b_save;
vlc_bool_t b_multiple;
/* Specific to INTF_DIALOG_INTERACTION */
interaction_dialog_t *p_dialog;
};
/*****************************************************************************
......@@ -160,6 +164,7 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#define INTF_DIALOG_POPUPMENU 20
#define INTF_DIALOG_FILE_GENERIC 30
#define INTF_DIALOG_INTERACTION 50
#define INTF_DIALOG_UPDATEVLC 90
#define INTF_DIALOG_VLM 91
......
......@@ -145,6 +145,7 @@ int playlist_Export (playlist_t *, const char *, const char *);
demux_t * __demux2_New (vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path, stream_t *s, es_out_t *out, vlc_bool_t);
int __vlc_threads_end (vlc_object_t *);
int sout_AccessOutRead (sout_access_out_t *, block_t *);
int __intf_UserLoginPassword (vlc_object_t*, const char*, const char*, char **, char **);
int demux2_vaControlHelper (stream_t *, int64_t i_start, int64_t i_end, int i_bitrate, int i_align, int i_query, va_list args);
int httpd_UrlCatch (httpd_url_t *, int i_msg, httpd_callback_t, httpd_callback_sys_t *);
void __vlc_object_yield (vlc_object_t *);
......@@ -297,7 +298,7 @@ subpicture_t * spu_CreateSubpicture (spu_t *);
void httpd_MsgAdd (httpd_message_t *, char *psz_name, char *psz_value, ...);
int vout_vaControlDefault (vout_thread_t *, int, va_list);
int playlist_NodeEmpty (playlist_t *, playlist_item_t *, vlc_bool_t);
void __intf_UserFatal (vlc_object_t*, int, const char*, const char*, ...);
void __intf_UserFatal (vlc_object_t*, const char*, const char*, ...);
spu_t * __spu_Create (vlc_object_t *);
int playlist_NodeRemoveItem (playlist_t *,playlist_item_t*,playlist_item_t *);
int __net_Accept (vlc_object_t *, int *, mtime_t);
......@@ -858,7 +859,8 @@ struct module_symbols_t
int (*__intf_Interact_inner) (vlc_object_t *,interaction_dialog_t *);
void (*intf_InteractionManage_inner) (playlist_t *);
void (*intf_InteractionDestroy_inner) (interaction_t *);
void (*__intf_UserFatal_inner) (vlc_object_t*, int, const char*, const char*, ...);
void (*__intf_UserFatal_inner) (vlc_object_t*, const char*, const char*, ...);
int (*__intf_UserLoginPassword_inner) (vlc_object_t*, const char*, const char*, char **, char **);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
......@@ -1274,6 +1276,7 @@ struct module_symbols_t
# define intf_InteractionManage (p_symbols)->intf_InteractionManage_inner
# define intf_InteractionDestroy (p_symbols)->intf_InteractionDestroy_inner
# define __intf_UserFatal (p_symbols)->__intf_UserFatal_inner
# define __intf_UserLoginPassword (p_symbols)->__intf_UserLoginPassword_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
......@@ -1692,6 +1695,7 @@ struct module_symbols_t
((p_symbols)->intf_InteractionManage_inner) = intf_InteractionManage; \
((p_symbols)->intf_InteractionDestroy_inner) = intf_InteractionDestroy; \
((p_symbols)->__intf_UserFatal_inner) = __intf_UserFatal; \
((p_symbols)->__intf_UserLoginPassword_inner) = __intf_UserLoginPassword; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
# endif /* __PLUGIN__ */
......
......@@ -2095,9 +2095,8 @@ static int InputSourceInit( input_thread_t *p_input,
if( in->p_access == NULL )
{
msg_Err( p_input, "no suitable access module for `%s'", psz_mrl );
intf_UserFatal( VLC_OBJECT( p_input), DIALOG_NOACCESS,
"Error opening stream",
"Unable to open '%s'", psz_mrl );
intf_UserFatal( VLC_OBJECT( p_input),
_("Errors"),"Unable to open '%s'", psz_mrl );
goto error;
}
......@@ -2167,6 +2166,8 @@ static int InputSourceInit( input_thread_t *p_input,
{
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
psz_access, psz_demux, psz_path );
intf_UserFatal( VLC_OBJECT( p_input), _("Errors"),
"Unrecognized format for '%s'", psz_mrl );
goto error;
}
......
This diff is collapsed.
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