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
int i_widgets; //< Nu,ber of 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_updated; //< Update for this one ?
vlc_bool_t b_finished; //< Hidden by interface
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
*/
enum
{
DIALOG_FIRST,
DIALOG_NOACCESS,
DIALOG_NOCODEC,
DIALOG_NOAUDIO,
......
......@@ -62,6 +62,11 @@
#include "../../../share/vlc16x16.xpm"
#endif
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int DoInteract( intf_thread_t *, interaction_dialog_t *, int );
/*****************************************************************************
* Local class declarations.
*****************************************************************************/
......@@ -335,6 +340,8 @@ Interface::Interface( intf_thread_t *_p_intf, long style ):
extra_frame = 0;
playlist_manager = 0;
p_intf->pf_interact = DoInteract;
/* Give our interface a nice little icon */
SetIcon( wxIcon( vlc_xpm ) );
......@@ -1155,6 +1162,14 @@ void Interface::TogglePlayButton( int i_playing_status )
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
/*****************************************************************************
* Definition of DragAndDrop class.
......
......@@ -125,32 +125,41 @@ void intf_InteractionManage( playlist_t *p_playlist )
{
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
// - If have answer, signal what is waiting
// (vlc_cond ? dangerous in case of pb ?)
// 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_dialog, INTERACT_HIDE );
}
if( p_dialog->b_updated )
{
p_dialog->b_finished = VLC_FALSE;
p_dialog->i_status = HIDING_DIALOG;
break;
case UPDATED_DIALOG:
p_interaction->p_intf->pf_interact( p_interaction->p_intf,
p_dialog, INTERACT_UPDATE );
}
if( p_dialog->b_finished && !p_dialog->b_reusable )
p_dialog->i_status = SENT_DIALOG;
msg_Dbg( p_interaction, "Updating dialog %i, %i widgets",
p_dialog->i_id, p_dialog->i_widgets );
break;
case HIDDEN_DIALOG:
if( !p_dialog->b_reusable )
{
/// \todo Destroy the dialog
}
break;
case NEW_DIALOG:
// This is truly a new dialog, send it.
p_interaction->p_intf->pf_interact( p_interaction->p_intf,
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 );
......@@ -167,7 +176,8 @@ void intf_InteractionManage( playlist_t *p_playlist )
new->pp_widgets = NULL; \
new->psz_title = NULL; \
new->psz_description = NULL; \
new->i_id = 0;
new->i_id = 0; \
new->i_status = NEW_DIALOG;
#define INTERACT_FREE( new ) \
if( new->psz_title ) free( new->psz_title ); \
......@@ -194,6 +204,11 @@ void __intf_UserFatal( vlc_object_t *p_this, int i_id,
if( !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;
......
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