Commit 1ec9641c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

[Qt] Various cleaning.

parent 28b5e483
...@@ -21,21 +21,18 @@ ...@@ -21,21 +21,18 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <QEvent>
#include <QApplication>
#include <QSignalMapper>
#include <QFileDialog>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_intf_strings.h>
#include "qt4.hpp" #include "qt4.hpp"
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
#include "main_interface.hpp" #include "main_interface.hpp"
#include "menus.hpp" #include "menus.hpp"
#include <vlc_intf_strings.h>
#include "input_manager.hpp" #include "input_manager.hpp"
#include "recents.hpp" #include "recents.hpp"
...@@ -53,6 +50,12 @@ ...@@ -53,6 +50,12 @@
#include "dialogs/gototime.hpp" #include "dialogs/gototime.hpp"
#include "dialogs/podcast_configuration.hpp" #include "dialogs/podcast_configuration.hpp"
#include <QEvent>
#include <QApplication>
#include <QSignalMapper>
#include <QFileDialog>
DialogsProvider* DialogsProvider::instance = NULL; DialogsProvider* DialogsProvider::instance = NULL;
DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) : DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
...@@ -60,6 +63,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) : ...@@ -60,6 +63,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
{ {
b_isDying = false; b_isDying = false;
/* Various signal mappers for the menus */
menusMapper = new QSignalMapper(); menusMapper = new QSignalMapper();
CONNECT( menusMapper, mapped(QObject *), this, menuAction( QObject *) ); CONNECT( menusMapper, mapped(QObject *), this, menuAction( QObject *) );
...@@ -101,7 +105,7 @@ void DialogsProvider::quit() ...@@ -101,7 +105,7 @@ void DialogsProvider::quit()
void DialogsProvider::customEvent( QEvent *event ) void DialogsProvider::customEvent( QEvent *event )
{ {
if( event->type() == DialogEvent_Type ) if( event->type() == (int)DialogEvent_Type )
{ {
DialogEvent *de = static_cast<DialogEvent*>(event); DialogEvent *de = static_cast<DialogEvent*>(event);
switch( de->i_dialog ) switch( de->i_dialog )
...@@ -148,7 +152,7 @@ void DialogsProvider::customEvent( QEvent *event ) ...@@ -148,7 +152,7 @@ void DialogsProvider::customEvent( QEvent *event )
QVLCMenu::MiscPopupMenu( p_intf ); break; QVLCMenu::MiscPopupMenu( p_intf ); break;
case INTF_DIALOG_WIZARD: case INTF_DIALOG_WIZARD:
case INTF_DIALOG_STREAMWIZARD: case INTF_DIALOG_STREAMWIZARD:
openThenStreamingDialogs(); break; openAndStreamingDialogs(); break;
#ifdef UPDATE_CHECK #ifdef UPDATE_CHECK
case INTF_DIALOG_UPDATEVLC: case INTF_DIALOG_UPDATEVLC:
updateDialog(); break; updateDialog(); break;
...@@ -233,20 +237,7 @@ void DialogsProvider::podcastConfigureDialog() ...@@ -233,20 +237,7 @@ void DialogsProvider::podcastConfigureDialog()
PodcastConfigDialog::getInstance( p_intf )->toggleVisible(); PodcastConfigDialog::getInstance( p_intf )->toggleVisible();
} }
/* Generic open file */
/****************************************************************************
* All the open/add stuff
* Open Dialog first - Simple Open then
****************************************************************************/
void DialogsProvider::openDialog( int i_tab )
{
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
}
void DialogsProvider::openDialog()
{
openDialog( OPEN_FILE_TAB );
}
void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
{ {
if( p_arg == NULL ) if( p_arg == NULL )
...@@ -309,7 +300,19 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) ...@@ -309,7 +300,19 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
free( p_arg->psz_extensions ); free( p_arg->psz_extensions );
free( p_arg ); free( p_arg );
} }
/****************************************************************************
* All the open/add stuff
* Open Dialog first - Simple Open then
****************************************************************************/
void DialogsProvider::openDialog( int i_tab )
{
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
}
void DialogsProvider::openDialog()
{
openDialog( OPEN_FILE_TAB );
}
void DialogsProvider::openFileDialog() void DialogsProvider::openFileDialog()
{ {
openDialog( OPEN_FILE_TAB ); openDialog( OPEN_FILE_TAB );
...@@ -330,8 +333,8 @@ void DialogsProvider::openCaptureDialog() ...@@ -330,8 +333,8 @@ void DialogsProvider::openCaptureDialog()
/* Same as the open one, but force the enqueue */ /* Same as the open one, but force the enqueue */
void DialogsProvider::PLAppendDialog() void DialogsProvider::PLAppendDialog()
{ {
OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_ENQUEUE) OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
->showTab( OPEN_FILE_TAB ); OPEN_AND_ENQUEUE )->showTab( OPEN_FILE_TAB );
} }
void DialogsProvider::MLAppendDialog() void DialogsProvider::MLAppendDialog()
...@@ -511,7 +514,6 @@ void DialogsProvider::saveAPlaylist() ...@@ -511,7 +514,6 @@ void DialogsProvider::saveAPlaylist()
delete qfd; delete qfd;
} }
/**************************************************************************** /****************************************************************************
* Sout emulation * Sout emulation
****************************************************************************/ ****************************************************************************/
...@@ -536,20 +538,49 @@ void DialogsProvider::streamingDialog( QWidget *parent, QString mrl, ...@@ -536,20 +538,49 @@ void DialogsProvider::streamingDialog( QWidget *parent, QString mrl,
} }
} }
void DialogsProvider::openThenStreamingDialogs() void DialogsProvider::openAndStreamingDialogs()
{ {
OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM ) OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM )
->showTab( OPEN_FILE_TAB ); ->showTab( OPEN_FILE_TAB );
} }
void DialogsProvider::openThenTranscodingDialogs() void DialogsProvider::openAndTranscodingDialogs()
{ {
OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE ) OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE )
->showTab( OPEN_FILE_TAB ); ->showTab( OPEN_FILE_TAB );
} }
void DialogsProvider::loadSubtitlesFile()
{
input_thread_t *p_input = THEMIM->getInput();
if( !p_input ) return;
input_item_t *p_item = input_GetItem( p_input );
if( !p_item ) return;
char *path = input_item_GetURI( p_item );
if( !path ) path = strdup( "" );
char *sep = strrchr( path, DIR_SEP_CHAR );
if( sep ) *sep = '\0';
QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
EXT_FILTER_SUBTITLE,
path );
free( path );
QString qsFile;
foreach( qsFile, qsl )
{
if( !input_AddSubtitles( p_input, qtu( toNativeSeparators( qsFile ) ),
true ) )
msg_Warn( p_intf, "unable to load subtitles from '%s'",
qtu( qsFile ) );
}
}
/**************************************************************************** /****************************************************************************
* Menus / Interaction * Menus
****************************************************************************/ ****************************************************************************/
void DialogsProvider::menuAction( QObject *data ) void DialogsProvider::menuAction( QObject *data )
...@@ -559,20 +590,37 @@ void DialogsProvider::menuAction( QObject *data ) ...@@ -559,20 +590,37 @@ void DialogsProvider::menuAction( QObject *data )
void DialogsProvider::menuUpdateAction( QObject *data ) void DialogsProvider::menuUpdateAction( QObject *data )
{ {
MenuFunc * f = qobject_cast<MenuFunc *>(data); MenuFunc *func = qobject_cast<MenuFunc *>(data);
f->doFunc( p_intf ); assert( func );
func->doFunc( p_intf );
} }
void DialogsProvider::SDMenuAction( QString data ) void DialogsProvider::SDMenuAction( QString data )
{ {
char *psz_sd = strdup( qtu( data ) ); char *psz_sd = qtu( data );
if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) ) if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) )
playlist_ServicesDiscoveryAdd( THEPL, psz_sd ); playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
else else
playlist_ServicesDiscoveryRemove( THEPL, psz_sd ); playlist_ServicesDiscoveryRemove( THEPL, psz_sd );
free( psz_sd );
} }
/**
* Play the MRL contained in the Recently played menu.
**/
void DialogsProvider::playMRL( const QString &mrl )
{
input_item_t *p_input = input_item_New( p_intf,
qtu( mrl ), NULL );
playlist_AddInput( THEPL, p_input, PLAYLIST_GO,
PLAYLIST_END, true, pl_Unlocked );
vlc_gc_decref( p_input );
RecentsMRL::getInstance( p_intf )->addRecent( mrl );
}
/*************************************
* Interactions
*************************************/
void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg ) void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
{ {
InteractionDialog *qdialog; InteractionDialog *qdialog;
...@@ -618,44 +666,3 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg ) ...@@ -618,44 +666,3 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
} }
} }
void DialogsProvider::loadSubtitlesFile()
{
input_thread_t *p_input = THEMIM->getInput();
if( !p_input )
return;
input_item_t *p_item = input_GetItem( p_input );
if( !p_item )
return;
char *path = input_item_GetURI( p_item );
if( !path )
path = strdup( "" );
char *sep = strrchr( path, DIR_SEP_CHAR );
if( sep )
*sep = '\0';
QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
EXT_FILTER_SUBTITLE,
path );
free( path );
QString qsFile;
foreach( qsFile, qsl )
{
if( !input_AddSubtitles( p_input, qtu( toNativeSeparators( qsFile ) ),
true ) )
msg_Warn( p_intf, "unable to load subtitles from '%s'",
qtu( qsFile ) );
}
}
/**
* Play the MRL contained in the Recently played menu.
**/
void DialogsProvider::playMRL( const QString &mrl )
{
input_item_t *p_input = input_item_New( p_intf,
qtu( mrl ), NULL );
playlist_AddInput( THEPL, p_input, PLAYLIST_GO,
PLAYLIST_END, true, pl_Unlocked );
vlc_gc_decref( p_input );
RecentsMRL::getInstance( p_intf )->addRecent( mrl );
}
...@@ -37,9 +37,6 @@ ...@@ -37,9 +37,6 @@
#include "dialogs/interaction.hpp" #include "dialogs/interaction.hpp"
#include "dialogs/open.hpp" #include "dialogs/open.hpp"
#include <QObject>
#include <QApplication>
#define ADD_FILTER_MEDIA( string ) \ #define ADD_FILTER_MEDIA( string ) \
string += qtr( "Media Files" ); \ string += qtr( "Media Files" ); \
string += " ( "; \ string += " ( "; \
...@@ -125,14 +122,13 @@ private: ...@@ -125,14 +122,13 @@ private:
DialogsProvider( intf_thread_t *); DialogsProvider( intf_thread_t *);
intf_thread_t *p_intf; intf_thread_t *p_intf;
static DialogsProvider *instance; static DialogsProvider *instance;
void addFromSimple( bool, bool );
bool b_isDying; bool b_isDying;
void openDialog( int );
void addFromSimple( bool, bool );
public slots: public slots:
void doInteraction( intf_dialog_args_t * ); void doInteraction( intf_dialog_args_t * );
void menuAction( QObject *);
void menuUpdateAction( QObject * );
void SDMenuAction( QString );
void playMRL( const QString & ); void playMRL( const QString & );
void playlistDialog(); void playlistDialog();
...@@ -153,13 +149,13 @@ public slots: ...@@ -153,13 +149,13 @@ public slots:
void gotoTimeDialog(); void gotoTimeDialog();
void podcastConfigureDialog(); void podcastConfigureDialog();
void openFileGenericDialog( intf_dialog_args_t * );
void simpleOpenDialog(); void simpleOpenDialog();
void simplePLAppendDialog(); void simplePLAppendDialog();
void simpleMLAppendDialog(); void simpleMLAppendDialog();
void openDialog(); void openDialog();
void openDialog( int );
void openFileGenericDialog( intf_dialog_args_t * );
void openDiscDialog(); void openDiscDialog();
void openFileDialog(); void openFileDialog();
void openNetDialog(); void openNetDialog();
...@@ -167,14 +163,15 @@ public slots: ...@@ -167,14 +163,15 @@ public slots:
void PLAppendDialog(); void PLAppendDialog();
void MLAppendDialog(); void MLAppendDialog();
void PLOpenDir(); void PLOpenDir();
void PLAppendDir(); void PLAppendDir();
void MLAppendDir(); void MLAppendDir();
void streamingDialog( QWidget *parent, QString mrl = "", void streamingDialog( QWidget *parent, QString mrl = "",
bool b_stream = true ); bool b_stream = true );
void openThenStreamingDialogs(); void openAndStreamingDialogs();
void openThenTranscodingDialogs(); void openAndTranscodingDialogs();
void openAPlaylist(); void openAPlaylist();
void saveAPlaylist(); void saveAPlaylist();
...@@ -182,6 +179,10 @@ public slots: ...@@ -182,6 +179,10 @@ public slots:
void loadSubtitlesFile(); void loadSubtitlesFile();
void quit(); void quit();
private slots:
void menuAction( QObject *);
void menuUpdateAction( QObject * );
void SDMenuAction( QString );
}; };
#endif #endif
...@@ -66,7 +66,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) : ...@@ -66,7 +66,7 @@ InputManager::InputManager( QObject *parent, intf_thread_t *_p_intf) :
QObject( parent ), p_intf( _p_intf ) QObject( parent ), p_intf( _p_intf )
{ {
i_old_playing_status = END_S; i_old_playing_status = END_S;
old_name = ""; oldName = "";
artUrl = ""; artUrl = "";
p_input = NULL; p_input = NULL;
i_rate = 0; i_rate = 0;
...@@ -95,7 +95,6 @@ void InputManager::setInput( input_thread_t *_p_input ) ...@@ -95,7 +95,6 @@ void InputManager::setInput( input_thread_t *_p_input )
emit statusChanged( PLAYING_S ); emit statusChanged( PLAYING_S );
UpdateMeta(); UpdateMeta();
UpdateArt(); UpdateArt();
UpdateSPU();
UpdateTeletext(); UpdateTeletext();
UpdateNavigation(); UpdateNavigation();
UpdateVout(); UpdateVout();
...@@ -120,7 +119,7 @@ void InputManager::delInput() ...@@ -120,7 +119,7 @@ void InputManager::delInput()
delCallbacks(); delCallbacks();
i_old_playing_status = END_S; i_old_playing_status = END_S;
i_input_id = 0; i_input_id = 0;
old_name = ""; oldName = "";
artUrl = ""; artUrl = "";
b_video = false; b_video = false;
timeA = 0; timeA = 0;
...@@ -133,7 +132,6 @@ void InputManager::delInput() ...@@ -133,7 +132,6 @@ void InputManager::delInput()
emit voutChanged( false ); emit voutChanged( false );
vlc_object_release( p_input ); vlc_object_release( p_input );
p_input = NULL; p_input = NULL;
UpdateSPU();
UpdateTeletext(); UpdateTeletext();
} }
} }
...@@ -187,21 +185,21 @@ void InputManager::delCallbacks() ...@@ -187,21 +185,21 @@ void InputManager::delCallbacks()
/* Convert the event from the callbacks in actions */ /* Convert the event from the callbacks in actions */
void InputManager::customEvent( QEvent *event ) void InputManager::customEvent( QEvent *event )
{ {
int type = event->type(); int i_type = event->type();
IMEvent *ple = static_cast<IMEvent *>(event); IMEvent *ple = static_cast<IMEvent *>(event);
if ( type != PositionUpdate_Type && if ( i_type != PositionUpdate_Type &&
type != ItemChanged_Type && i_type != ItemChanged_Type &&
type != ItemRateChanged_Type && i_type != ItemRateChanged_Type &&
type != ItemTitleChanged_Type && i_type != ItemTitleChanged_Type &&
type != ItemSpuChanged_Type && i_type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type && i_type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type && i_type != ItemStateChanged_Type &&
type != StatisticsUpdate_Type && i_type != StatisticsUpdate_Type &&
type != InterfaceVoutUpdate_Type ) i_type != InterfaceVoutUpdate_Type )
return; return;
if( type == ItemStateChanged_Type ) if( i_type == ItemStateChanged_Type )
{ {
UpdateNavigation(); UpdateNavigation();
UpdateTeletext(); UpdateTeletext();
...@@ -209,23 +207,23 @@ void InputManager::customEvent( QEvent *event ) ...@@ -209,23 +207,23 @@ void InputManager::customEvent( QEvent *event )
if( !hasInput() ) return; if( !hasInput() ) return;
if( ( type != PositionUpdate_Type && if( ( i_type != PositionUpdate_Type &&
type != ItemRateChanged_Type && i_type != ItemRateChanged_Type &&
type != ItemSpuChanged_Type && i_type != ItemSpuChanged_Type &&
type != ItemTeletextChanged_Type && i_type != ItemTeletextChanged_Type &&
type != ItemStateChanged_Type && i_type != ItemStateChanged_Type &&
type != StatisticsUpdate_Type && i_type != StatisticsUpdate_Type &&
type != InterfaceVoutUpdate_Type i_type != InterfaceVoutUpdate_Type
) )
&& ( i_input_id != ple->i_id ) ) && ( i_input_id != ple->i_id ) )
return; return;
if( type != PositionUpdate_Type && if( i_type != PositionUpdate_Type &&
type != StatisticsUpdate_Type ) i_type != StatisticsUpdate_Type )
msg_Dbg( p_intf, "New Event: type %i", type ); msg_Dbg( p_intf, "New Event: type %i", i_type );
/* Actions */ /* Actions */
switch( type ) switch( i_type )
{ {
case PositionUpdate_Type: case PositionUpdate_Type:
UpdatePosition(); UpdatePosition();
...@@ -259,6 +257,8 @@ void InputManager::customEvent( QEvent *event ) ...@@ -259,6 +257,8 @@ void InputManager::customEvent( QEvent *event )
case InterfaceVoutUpdate_Type: case InterfaceVoutUpdate_Type:
UpdateVout(); UpdateVout();
break; break;
default:
msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
} }
} }
...@@ -289,6 +289,7 @@ void InputManager::UpdateNavigation() ...@@ -289,6 +289,7 @@ void InputManager::UpdateNavigation()
if( val.i_int > 0 ) if( val.i_int > 0 )
{ {
emit titleChanged( true ); emit titleChanged( true );
/* p_input != NULL since val.i_int != 0 */
val.i_int = 0; val.i_int = 0;
var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL ); var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val, NULL );
emit chapterChanged( (val.i_int > 0) ); emit chapterChanged( (val.i_int > 0) );
...@@ -365,10 +366,10 @@ void InputManager::UpdateMeta() ...@@ -365,10 +366,10 @@ void InputManager::UpdateMeta()
free( psz_name ); free( psz_name );
} }
if( old_name != text ) if( oldName != text )
{ {
emit nameChanged( text ); emit nameChanged( text );
old_name=text; oldName=text;
} }
} }
...@@ -402,7 +403,8 @@ void InputManager::UpdateVout() ...@@ -402,7 +403,8 @@ void InputManager::UpdateVout()
{ {
bool b_old_video = b_video; bool b_old_video = b_video;
vlc_object_t *p_vout = (vlc_object_t*)vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD ); vlc_object_t *p_vout = (vlc_object_t*)vlc_object_find( p_input,
VLC_OBJECT_VOUT, FIND_CHILD );
b_video = p_vout != NULL; b_video = p_vout != NULL;
if( p_vout ) if( p_vout )
vlc_object_release( p_vout ); vlc_object_release( p_vout );
...@@ -637,7 +639,6 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf ) ...@@ -637,7 +639,6 @@ MainInputManager::MainInputManager( intf_thread_t *_p_intf )
p_input = NULL; p_input = NULL;
im = new InputManager( this, p_intf ); im = new InputManager( this, p_intf );
// var_AddCallback( THEPL, "item-change", PLItemChanged, this );
var_AddCallback( THEPL, "item-change", ItemChanged, im ); var_AddCallback( THEPL, "item-change", ItemChanged, im );
var_AddCallback( THEPL, "playlist-current", PLItemChanged, this ); var_AddCallback( THEPL, "playlist-current", PLItemChanged, this );
var_AddCallback( THEPL, "activity", PLItemChanged, this ); var_AddCallback( THEPL, "activity", PLItemChanged, this );
...@@ -669,7 +670,6 @@ MainInputManager::~MainInputManager() ...@@ -669,7 +670,6 @@ MainInputManager::~MainInputManager()
var_DelCallback( THEPL, "activity", PLItemChanged, this ); var_DelCallback( THEPL, "activity", PLItemChanged, this );
var_DelCallback( THEPL, "item-change", ItemChanged, im ); var_DelCallback( THEPL, "item-change", ItemChanged, im );
// var_DelCallback( THEPL, "item-change", PLItemChanged, this );
var_DelCallback( THEPL, "playlist-current", PLItemChanged, this ); var_DelCallback( THEPL, "playlist-current", PLItemChanged, this );
} }
...@@ -688,7 +688,7 @@ void MainInputManager::customEvent( QEvent *event ) ...@@ -688,7 +688,7 @@ void MainInputManager::customEvent( QEvent *event )
} }
/* Should be PLItemChanged Event */ /* Should be PLItemChanged Event */
if( VLC_OBJECT_INTF == p_intf->i_object_type ) /* FIXME: don't use object type */ if( !p_intf->p_sys->b_isDialogProvider )
{ {
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
if( p_input && ( p_input->b_dead || !vlc_object_alive (p_input) ) ) if( p_input && ( p_input->b_dead || !vlc_object_alive (p_input) ) )
...@@ -751,18 +751,6 @@ void MainInputManager::togglePlayPause() ...@@ -751,18 +751,6 @@ void MainInputManager::togglePlayPause()
getIM()->togglePlayPause(); getIM()->togglePlayPause();
} }
bool MainInputManager::teletextState()
{
if( getIM()->hasInput() )
{
const int i_teletext_es = var_GetInteger( getInput(), "teletext-es" );
const int i_spu_es = var_GetInteger( getInput(), "spu-es" );
return i_teletext_es >= 0 && i_teletext_es == i_spu_es;
}
return false;
}
/* Static callbacks */ /* Static callbacks */
/* IM */ /* IM */
...@@ -771,11 +759,12 @@ static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var, ...@@ -771,11 +759,12 @@ static int InterfaceChanged( vlc_object_t *p_this, const char *psz_var,
{ {
/* FIXME remove that static variable */ /* FIXME remove that static variable */
static int counter = 0; static int counter = 0;
InputManager *im = (InputManager*)param; InputManager *im = (InputManager*)param;
counter = ++counter % 4; counter = ++counter % 4;
if(!counter) if(!counter) return VLC_SUCCESS;
return VLC_SUCCESS;
IMEvent *event = new IMEvent( PositionUpdate_Type, 0 ); IMEvent *event = new IMEvent( PositionUpdate_Type, 0 );
QApplication::postEvent( im, static_cast<QEvent*>(event) ); QApplication::postEvent( im, static_cast<QEvent*>(event) );
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -56,11 +56,13 @@ enum { ...@@ -56,11 +56,13 @@ enum {
class IMEvent : public QEvent class IMEvent : public QEvent
{ {
public: friend class InputManager;
public:
IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) ) IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
{ i_id = id ; } ; { i_id = id ; } ;
virtual ~IMEvent() {}; virtual ~IMEvent() {};
private:
int i_id; int i_id;
}; };
...@@ -79,22 +81,24 @@ public: ...@@ -79,22 +81,24 @@ public:
bool hasAudio(); bool hasAudio();
bool hasVideo() { return hasInput() && b_video; } bool hasVideo() { return hasInput() && b_video; }
QString getName() { return old_name; } QString getName() { return oldName; }
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
input_thread_t *p_input; input_thread_t *p_input;
int i_input_id; int i_input_id;
int i_old_playing_status; int i_old_playing_status;
QString old_name; QString oldName;
QString artUrl; QString artUrl;
int i_rate; int i_rate;
bool b_video; bool b_video;
mtime_t timeA, timeB; mtime_t timeA, timeB;
void customEvent( QEvent * ); void customEvent( QEvent * );
void addCallbacks(); void addCallbacks();
void delCallbacks(); void delCallbacks();
void UpdateRate(); void UpdateRate();
void UpdateMeta(); void UpdateMeta();
void UpdateStatus(); void UpdateStatus();
...@@ -176,19 +180,20 @@ public: ...@@ -176,19 +180,20 @@ public:
private: private:
MainInputManager( intf_thread_t * ); MainInputManager( intf_thread_t * );
static MainInputManager *instance;
void customEvent( QEvent * ); void customEvent( QEvent * );
InputManager *im; InputManager *im;
input_thread_t *p_input; input_thread_t *p_input;
intf_thread_t *p_intf; intf_thread_t *p_intf;
static MainInputManager *instance;
public slots: public slots:
bool teletextState();
void togglePlayPause(); void togglePlayPause();
void stop(); void stop();
void next(); void next();
void prev(); void prev();
signals: signals:
void inputChanged( input_thread_t * ); void inputChanged( input_thread_t * );
void volumeChanged(); void volumeChanged();
......
...@@ -1085,7 +1085,7 @@ void MainInterface::customEvent( QEvent *event ) ...@@ -1085,7 +1085,7 @@ void MainInterface::customEvent( QEvent *event )
} }
#endif #endif
/*else */ /*else */
if ( event->type() == SetVideoOnTopEvent_Type ) if ( event->type() == (int)SetVideoOnTopEvent_Type )
{ {
SetVideoOnTopQtEvent* p_event = (SetVideoOnTopQtEvent*)event; SetVideoOnTopQtEvent* p_event = (SetVideoOnTopQtEvent*)event;
if( p_event->OnTop() ) if( p_event->OnTop() )
......
...@@ -64,8 +64,8 @@ class VideoWidget; ...@@ -64,8 +64,8 @@ class VideoWidget;
class QSettings; class QSettings;
#if defined(Q_WS_WIN)
#include <QApplication> #include <QApplication>
#if defined(Q_WS_WIN)
class WinQtApp : public QApplication class WinQtApp : public QApplication
{ {
......
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