Commit 8bc7546a authored by Clément Stenac's avatar Clément Stenac

Improve dialogs handling

parent 1003427e
...@@ -56,12 +56,23 @@ struct interaction_dialog_t ...@@ -56,12 +56,23 @@ struct interaction_dialog_t
int i_widgets; //< Nu,ber of dialog widgets int i_widgets; //< Nu,ber of dialog widgets
user_widget_t **pp_widgets; //< Dialog widgets user_widget_t **pp_widgets; //< Dialog widgets
vlc_bool_t b_have_answer; //< Has an answer been given ?
vlc_bool_t b_reusable; //< Do we have to reuse this ? vlc_bool_t b_reusable; //< Do we have to reuse this ?
vlc_bool_t b_updated; //< Update for this one ?
vlc_bool_t b_finished; //< Hidden by interface
void * p_private; //< Private interface data void * p_private; //< Private interface data
int i_status; //< Dialog status;
};
/**
* Possible status
*/
enum
{
NEW_DIALOG,
SENT_DIALOG,
UPDATED_DIALOG,
ANSWERED_DIALOG,
HIDING_DIALOG,
HIDDEN_DIALOG,
}; };
/** /**
...@@ -81,6 +92,7 @@ enum ...@@ -81,6 +92,7 @@ enum
*/ */
enum enum
{ {
DIALOG_FIRST,
DIALOG_NOACCESS, DIALOG_NOACCESS,
DIALOG_NOCODEC, DIALOG_NOCODEC,
DIALOG_NOAUDIO, DIALOG_NOAUDIO,
......
...@@ -62,6 +62,11 @@ ...@@ -62,6 +62,11 @@
#include "../../../share/vlc16x16.xpm" #include "../../../share/vlc16x16.xpm"
#endif #endif
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int DoInteract( intf_thread_t *, interaction_dialog_t *, int );
/***************************************************************************** /*****************************************************************************
* Local class declarations. * Local class declarations.
*****************************************************************************/ *****************************************************************************/
...@@ -335,6 +340,8 @@ Interface::Interface( intf_thread_t *_p_intf, long style ): ...@@ -335,6 +340,8 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
extra_frame = 0; extra_frame = 0;
playlist_manager = 0; playlist_manager = 0;
p_intf->pf_interact = DoInteract;
/* Give our interface a nice little icon */ /* Give our interface a nice little icon */
SetIcon( wxIcon( vlc_xpm ) ); SetIcon( wxIcon( vlc_xpm ) );
...@@ -1155,6 +1162,14 @@ void Interface::TogglePlayButton( int i_playing_status ) ...@@ -1155,6 +1162,14 @@ void Interface::TogglePlayButton( int i_playing_status )
GetToolBar()->ToggleTool( PlayStream_Event, false ); GetToolBar()->ToggleTool( PlayStream_Event, false );
} }
static int DoInteract( intf_thread_t *, interaction_dialog_t *, int )
{
fprintf( stderr, "Doing interaction \n" );
}
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
/***************************************************************************** /*****************************************************************************
* Definition of DragAndDrop class. * Definition of DragAndDrop class.
......
...@@ -125,32 +125,41 @@ void intf_InteractionManage( playlist_t *p_playlist ) ...@@ -125,32 +125,41 @@ void intf_InteractionManage( playlist_t *p_playlist )
{ {
interaction_dialog_t *p_dialog = p_interaction->pp_dialogs[i_index]; interaction_dialog_t *p_dialog = p_interaction->pp_dialogs[i_index];
if( p_dialog->b_have_answer ) switch( p_dialog->i_status )
{ {
case ANSWERED_DIALOG:
/// \todo Signal we have an answer /// \todo Signal we have an answer
// - If have answer, signal what is waiting // - If have answer, signal what is waiting
// (vlc_cond ? dangerous in case of pb ?) // (vlc_cond ? dangerous in case of pb ?)
// Ask interface to hide it // Ask interface to hide it
msg_Dbg( p_interaction, "Hiding dialog %i", p_dialog->i_id );
p_interaction->p_intf->pf_interact( p_interaction->p_intf, p_interaction->p_intf->pf_interact( p_interaction->p_intf,
p_dialog, INTERACT_HIDE ); p_dialog, INTERACT_HIDE );
p_dialog->i_status = HIDING_DIALOG;
} break;
case UPDATED_DIALOG:
if( p_dialog->b_updated )
{
p_dialog->b_finished = VLC_FALSE;
p_interaction->p_intf->pf_interact( p_interaction->p_intf, p_interaction->p_intf->pf_interact( p_interaction->p_intf,
p_dialog, INTERACT_UPDATE ); p_dialog, INTERACT_UPDATE );
} p_dialog->i_status = SENT_DIALOG;
msg_Dbg( p_interaction, "Updating dialog %i, %i widgets",
if( p_dialog->b_finished && !p_dialog->b_reusable ) p_dialog->i_id, p_dialog->i_widgets );
break;
case HIDDEN_DIALOG:
if( !p_dialog->b_reusable )
{ {
/// \todo Destroy the dialog /// \todo Destroy the dialog
} }
break;
case NEW_DIALOG:
// This is truly a new dialog, send it. // This is truly a new dialog, send it.
p_interaction->p_intf->pf_interact( p_interaction->p_intf, p_interaction->p_intf->pf_interact( p_interaction->p_intf,
p_dialog, INTERACT_NEW ); p_dialog, INTERACT_NEW );
msg_Dbg( p_interaction, "Creating dialog %i, %i widgets",
p_dialog->i_id, p_dialog->i_widgets );
p_dialog->i_status = SENT_DIALOG;
break;
}
} }
vlc_object_release( p_interaction->p_intf ); vlc_object_release( p_interaction->p_intf );
...@@ -167,7 +176,8 @@ void intf_InteractionManage( playlist_t *p_playlist ) ...@@ -167,7 +176,8 @@ void intf_InteractionManage( playlist_t *p_playlist )
new->pp_widgets = NULL; \ new->pp_widgets = NULL; \
new->psz_title = NULL; \ new->psz_title = NULL; \
new->psz_description = NULL; \ new->psz_description = NULL; \
new->i_id = 0; new->i_id = 0; \
new->i_status = NEW_DIALOG;
#define INTERACT_FREE( new ) \ #define INTERACT_FREE( new ) \
if( new->psz_title ) free( new->psz_title ); \ if( new->psz_title ) free( new->psz_title ); \
...@@ -194,6 +204,11 @@ void __intf_UserFatal( vlc_object_t *p_this, int i_id, ...@@ -194,6 +204,11 @@ void __intf_UserFatal( vlc_object_t *p_this, int i_id,
if( !p_new ) if( !p_new )
{ {
INTERACT_INIT( p_new ); INTERACT_INIT( p_new );
if( i_id > 0 ) p_new->i_id = i_id ;
}
else
{
p_new->i_status = UPDATED_DIALOG;
} }
p_new->i_type = INTERACT_FATAL; p_new->i_type = INTERACT_FATAL;
......
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