From 0090a335a7162f4b0d34f78850ebf9a8bd544c01 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 02 Dec 2002 20:36:40 +0000 Subject: - removed last traces of mediaPlayerState singleton. yay :) --- (limited to 'noncore') diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index fd47ea5..7d11ca0 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp @@ -6,7 +6,6 @@ #include "videowidget.h" #include "mediaplayer.h" -MediaPlayerState *mediaPlayerState; PlayListWidget *playList; AudioWidget *audioUI; VideoWidget *videoUI; @@ -15,7 +14,6 @@ int main(int argc, char **argv) { QPEApplication a(argc,argv); MediaPlayerState st( 0, "mediaPlayerState" ); - mediaPlayerState = &st; PlayListWidget pl( st, 0, "playList" ); playList = &pl; pl.showMaximized(); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 424259b..eccb5d9 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -60,7 +60,7 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); volControl = new VolumeControl; - xineControl = new XineControl(); + xineControl = new XineControl( mediaPlayerState ); Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index e7d5a7b..071ef7c 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -40,20 +40,19 @@ #include "mediaplayerstate.h" #include "videowidget.h" -extern MediaPlayerState *mediaPlayerState; extern VideoWidget *videoUI; -XineControl::XineControl( QObject *parent, const char *name ) - : QObject( parent, name ) { +XineControl::XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) + : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ) { libXine = new XINE::Lib( videoUI->vidWidget() ); connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); - connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); - connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); - connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); - connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); - connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); - connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); + connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); + connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); + connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); + connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); + connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); disabledSuspendScreenSaver = FALSE; @@ -80,10 +79,10 @@ void XineControl::play( const QString& fileName ) { if ( !libXine->play( fileName, 0, 0 ) ) { QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); // toggle stop so the the play button is reset - mediaPlayerState->setPlaying( false ); + mediaPlayerState.setPlaying( false ); return; } - mediaPlayerState->setPlaying( true ); + mediaPlayerState.setPlaying( true ); MediaPlayerState::DisplayType displayType; // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); @@ -99,10 +98,10 @@ void XineControl::play( const QString& fileName ) { hasVideoChannel = TRUE; } // determine if slider is shown - mediaPlayerState->setIsSeekable( libXine->isSeekable() ); + mediaPlayerState.setIsSeekable( libXine->isSeekable() ); // which gui (video / audio) - mediaPlayerState->setDisplayType( displayType ); + mediaPlayerState.setDisplayType( displayType ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) if ( !disabledSuspendScreenSaver ) { @@ -118,7 +117,7 @@ void XineControl::play( const QString& fileName ) { } void XineControl::nextMedia() { - mediaPlayerState->setNext(); + mediaPlayerState.setNext(); } void XineControl::setGamma( int value ) { @@ -167,7 +166,7 @@ long XineControl::currentTime() { */ void XineControl::length() { m_length = libXine->length(); - mediaPlayerState->setLength( m_length ); + mediaPlayerState.setLength( m_length ); } @@ -177,10 +176,10 @@ void XineControl::length() { */ long XineControl::position() { m_position = ( currentTime() ); - mediaPlayerState->updatePosition( m_position ); + mediaPlayerState.updatePosition( m_position ); long emitPos = (long)m_position; emit positionChanged( emitPos ); - if( mediaPlayerState->isPlaying() ) { + if( mediaPlayerState.isPlaying() ) { // needs to be stopped the media is stopped QTimer::singleShot( 1000, this, SLOT( position() ) ); } diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index b1300a8..00486f2 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -37,10 +37,12 @@ #include "lib.h" #include +#include "mediaplayerstate.h" + class XineControl : public QObject { Q_OBJECT public: - XineControl( QObject *parent = 0, const char *name =0 ); + XineControl( MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); ~XineControl(); bool hasVideo() const { return hasVideoChannel; } @@ -106,6 +108,7 @@ private: bool disabledSuspendScreenSaver : 1; bool hasVideoChannel : 1; bool hasAudioChannel : 1; + MediaPlayerState &mediaPlayerState; signals: void positionChanged( long ); -- cgit v0.9.0.2