-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 32 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
9 files changed, 36 insertions, 40 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index f6e6086..b573c45 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -88,7 +88,7 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); -AudioWidget::AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : +AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : - MediaWidget( mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { + MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { setCaption( tr("OpiePlayer") ); diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index f092699..52a358c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -53,5 +53,5 @@ class AudioWidget : public MediaWidget { Q_OBJECT public: - AudioWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); + AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~AudioWidget(); void setTickerText( const QString &text ) { songInfo.setText( text ); } diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index 7fc7b94..ffc7cb6 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp @@ -5,6 +5,4 @@ #include "mediaplayer.h" -PlayListWidget *playList; - int main(int argc, char **argv) { QPEApplication a(argc,argv); @@ -12,7 +10,6 @@ int main(int argc, char **argv) { MediaPlayerState st( 0, "mediaPlayerState" ); PlayListWidget pl( st, 0, "playList" ); - playList = &pl; pl.showMaximized(); - MediaPlayer mp( st, 0, "mediaPlayer" ); + MediaPlayer mp( pl, st, 0, "mediaPlayer" ); QObject::connect( &pl, SIGNAL( skinSelected() ), &mp, SLOT( recreateAudioAndVideoWidgets() ) ); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index a9c74c4..8acc488 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -25,12 +25,10 @@ -extern VideoWidget *videoUI; -extern PlayListWidget *playList; #define FBIOBLANK 0x4611 -MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) - : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { +MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) + : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { audioUI = 0; @@ -40,5 +38,5 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, fd=-1;fl=-1; - playList->setCaption( tr( "OpiePlayer: Initializating" ) ); + playList.setCaption( tr( "OpiePlayer: Initializating" ) ); qApp->processEvents(); @@ -58,5 +56,5 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); - playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); + playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); } @@ -88,5 +86,5 @@ void MediaPlayer::setPlaying( bool play ) { QString tickerText, time, fileName; - if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) { + if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { //if playing in file list.. play in a different way // random and looping settings enabled causes problems here, @@ -101,5 +99,5 @@ void MediaPlayer::setPlaying( bool play ) { } - PlayListWidget::Entry playListEntry = playList->currentEntry(); + PlayListWidget::Entry playListEntry = playList.currentEntry(); fileName = playListEntry.name; xineControl->play( playListEntry.file ); @@ -127,9 +125,9 @@ void MediaPlayer::setPlaying( bool play ) { void MediaPlayer::prev() { - if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist - if ( playList->prev() ) { + if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist + if ( playList.prev() ) { play(); } else if ( mediaPlayerState.isLooping() ) { - if ( playList->last() ) { + if ( playList.last() ) { play(); } @@ -143,9 +141,9 @@ void MediaPlayer::prev() { void MediaPlayer::next() { - if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist - if ( playList->next() ) { + if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist + if ( playList.next() ) { play(); } else if ( mediaPlayerState.isLooping() ) { - if ( playList->first() ) { + if ( playList.first() ) { play(); } @@ -340,5 +338,5 @@ void MediaPlayer::cleanUp() {// this happens on closing Config cfg( "OpiePlayer" ); mediaPlayerState.writeConfig( cfg ); - playList->writeDefaultPlaylist( ); + playList.writeDefaultPlaylist( ); // QPEApplication::grabKeyboard(); @@ -351,6 +349,6 @@ void MediaPlayer::recreateAudioAndVideoWidgets() delete audioUI; delete videoUI; - audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" ); - videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" ); + audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); + videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 0d6f722..dc306c4 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -40,4 +40,6 @@ #include "xinecontrol.h" +#include "playlistwidget.h" + class DocLnk; class VolumeControl; @@ -49,5 +51,5 @@ class MediaPlayer : public QObject { Q_OBJECT public: - MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); + MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); ~MediaPlayer(); @@ -78,4 +80,5 @@ private: VolumeControl *volControl; MediaPlayerState &mediaPlayerState; + PlayListWidget &playList; AudioWidget *audioUI; VideoWidget *videoUI; diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 2992fd6..ed5bc5a 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -22,8 +22,6 @@ #include "playlistwidget.h" -extern PlayListWidget *playList; - -MediaWidget::MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) - : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ) +MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) + : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), @@ -49,6 +47,6 @@ void MediaWidget::handleCommand( Command command, bool buttonDown ) case Play: mediaPlayerState.togglePaused(); case Stop: mediaPlayerState.setPlaying(FALSE); return; - case Next: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; - case Previous: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; + case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; + case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; case Loop: mediaPlayerState.setLooping( buttonDown ); return; case VolumeUp: emit moreReleased(); return; diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index e3f09ce..2d92d65 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -24,4 +24,5 @@ #include "mediaplayerstate.h" +#include "playlistwidget.h" class MediaWidget : public QWidget @@ -31,5 +32,5 @@ public: enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; - MediaWidget( MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); + MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); virtual ~MediaWidget(); @@ -51,4 +52,5 @@ protected: MediaPlayerState &mediaPlayerState; + PlayListWidget &playList; }; diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index c0039b1..b7305fe 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -54,5 +54,4 @@ -extern PlayListWidget *playList; @@ -82,8 +81,7 @@ static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); -VideoWidget::VideoWidget(MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : -MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { - - +VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) + : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) +{ setCaption( tr("OpiePlayer - Video") ); @@ -333,6 +331,6 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; - case VideoNext: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; - case VideoPrevious: if( playList->currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; + case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; + case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; case VideoVolUp: emit moreReleased(); return; case VideoVolDown: emit lessReleased(); return; diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index ae0e687..f996803 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -59,5 +59,5 @@ class VideoWidget : public MediaWidget { Q_OBJECT public: - VideoWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); + VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~VideoWidget(); |