#include "../src/dialogs.hpp"
#include "cmd_change_skin.hpp"
+#include <vlc_interaction.h>
template<int TYPE = 0> class CmdDialogs;
virtual string getType() const { return "dialog"; }
};
+class CmdInteraction: public CmdGeneric
+{
+ public:
+ CmdInteraction( intf_thread_t *pIntf, interaction_dialog_t *
+ p_dialog ): CmdGeneric( pIntf ), m_pDialog( p_dialog )
+ {}
+ virtual ~CmdInteraction() {}
+
+ /// This method does the real job of the command
+ virtual void execute()
+ {
+ if( m_pDialog->i_type == INTERACT_PROGRESS )
+ {
+ /// \todo Handle progress in the interface
+ }
+ else
+ {
+ /// Get the dialogs provider
+ Dialogs *pDialogs = Dialogs::instance( getIntf() );
+ if( pDialogs == NULL )
+ {
+ return;
+ }
+ pDialogs->showInteraction( m_pDialog );
+ }
+ }
+
+ virtual string getType() const { return "interaction"; }
+ private:
+ interaction_dialog_t *m_pDialog;
+};
#endif
}
}
+void Dialogs::showInteraction( interaction_dialog_t *p_dialog )
+{
+ intf_dialog_args_t *p_arg =
+ (intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) );
+ memset( p_arg, 0, sizeof(intf_dialog_args_t) );
+
+ p_arg->p_dialog = p_dialog;
+ p_arg->p_intf = getIntf();
+
+ if( m_pProvider && m_pProvider->pf_show_dialog )
+ {
+ m_pProvider->pf_show_dialog( m_pProvider, INTF_DIALOG_INTERACTION,
+ 0, p_arg );
+ }
+}
#include "skin_common.hpp"
#include <string>
+struct interaction_dialog_t ;
// Dialogs provider
class Dialogs: public SkinObject
/// Show the popup menu
void showPopupMenu( bool bShow );
+ /// Show an interaction dialog
+ void showInteraction( interaction_dialog_t * );
+
private:
// Private because it's a singleton
Dialogs( intf_thread_t *pIntf );
#include "../commands/cmd_quit.hpp"
#include "../commands/cmd_resize.hpp"
#include "../commands/cmd_vars.hpp"
+#include "../commands/cmd_dialogs.hpp"
#include "../utils/var_bool.hpp"
#include <sstream>
// Called when our skins2 demux wants us to load a new skin
var_AddCallback( pIntf, "skin-to-load", onSkinToLoad, this );
+ // Called when we have an interaction dialog to display
+ var_Create( pIntf, "interaction", VLC_VAR_ADDRESS );
+ var_AddCallback( pIntf, "interaction", onInteraction, this );
+ pIntf->b_interaction = VLC_TRUE;
+
// Callbacks for vout requests
getIntf()->pf_request_window = &getWindow;
getIntf()->pf_release_window = &releaseWindow;
return VLC_SUCCESS;
}
+int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
+ vlc_value_t oldVal, vlc_value_t newVal,
+ void *pParam )
+{
+ VlcProc *pThis = (VlcProc*)pParam;
+ interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);
+
+ CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );
+ AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ return VLC_SUCCESS;
+}
+
void VlcProc::updateStreamName( playlist_t *p_playlist )
{
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam );
+ /// Callback for interaction variable
+ static int onInteraction( vlc_object_t *pObj, const char *pVariable,
+ vlc_value_t oldVal, vlc_value_t newVal,
+ void *pParam );
+
/// Callback to request a vout window
static void *getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
int *pXHint, int *pYHint,
p_arg->p_dialog = p_dialog;
p_arg->p_intf = p_intf;
- p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_INTERACTION,
- 0, p_arg );
+ if( p_dialog->i_type == INTERACT_PROGRESS )
+ {
+ /// \todo Handle progress in the interface
+ }
+ else
+ {
+ p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_INTERACTION,
+ 0, p_arg );
+ }
}
static int InteractCallback( vlc_object_t *p_this,