author | simon <simon> | 2002-12-02 20:20:28 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 20:20:28 (UTC) |
commit | abeed050bedee6e2697ea417ed74ab621361da48 (patch) (side-by-side diff) | |
tree | f1abe40769dee855617c55db5fc37625c5518a27 | |
parent | e1ef407b16b652755f9c8eefce0f617ec3996998 (diff) | |
download | opie-abeed050bedee6e2697ea417ed74ab621361da48.zip opie-abeed050bedee6e2697ea417ed74ab621361da48.tar.gz opie-abeed050bedee6e2697ea417ed74ab621361da48.tar.bz2 |
- the playlist no more uses the mediaplayerstate as singleton
-rw-r--r-- | noncore/multimedia/opieplayer2/main.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 48 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 12 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.h | 4 |
5 files changed, 35 insertions, 34 deletions
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp index 24aba6c..02fdbf3 100644 --- a/noncore/multimedia/opieplayer2/main.cpp +++ b/noncore/multimedia/opieplayer2/main.cpp @@ -17,5 +17,5 @@ int main(int argc, char **argv) { MediaPlayerState st( 0, "mediaPlayerState" ); mediaPlayerState = &st; - PlayListWidget pl( 0, "playList" ); + PlayListWidget pl( st, 0, "playList" ); playList = &pl; pl.showMaximized(); diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index b08204e..7ba342b 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -65,6 +65,6 @@ QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; // no m3u's here please -PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) - : PlayListWidgetGui( parent, name, fl ) { +PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) + : PlayListWidgetGui( mediaPlayerState, parent, name ) { d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), @@ -77,7 +77,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) this , SLOT( btnPlay( bool) ), TRUE ); d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", - mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); + &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", - mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); + &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); @@ -103,9 +103,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), - mediaPlayerState, SLOT( toggleFullscreen() ) ); + &mediaPlayerState, SLOT( toggleFullscreen() ) ); Config cfg( "OpiePlayer" ); bool b= cfg.readBoolEntry("FullScreen", 0); - mediaPlayerState->setFullscreen( b ); + mediaPlayerState.setFullscreen( b ); pmView->setItemChecked( -16, b ); @@ -142,14 +142,14 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), this, SLOT( tabChanged( QWidget* ) ) ); - connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), + connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); - connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), + connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); - connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), + connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); connect ( gammaSlider, SIGNAL( valueChanged( int ) ), - mediaPlayerState, SLOT( setVideoGamma( int ) ) ); + &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); // see which skins are installed @@ -173,7 +173,7 @@ PlayListWidget::~PlayListWidget() { void PlayListWidget::initializeStates() { - d->tbPlay->setOn( mediaPlayerState->isPlaying() ); - d->tbLoop->setOn( mediaPlayerState->isLooping() ); - d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); + d->tbPlay->setOn( mediaPlayerState.isPlaying() ); + d->tbLoop->setOn( mediaPlayerState.isLooping() ); + d->tbShuffle->setOn( mediaPlayerState.isShuffled() ); d->playListFrame->show(); } @@ -405,6 +405,6 @@ void PlayListWidget::setDocument( const QString& fileref ) { d->setDocumentUsed = TRUE; - mediaPlayerState->setPlaying( FALSE ); - mediaPlayerState->setPlaying( TRUE ); + mediaPlayerState.setPlaying( FALSE ); + mediaPlayerState.setPlaying( TRUE ); } } @@ -430,5 +430,5 @@ const DocLnk *PlayListWidget::current() const { // this is fugly bool PlayListWidget::prev() { - if ( mediaPlayerState->isShuffled() ) { + if ( mediaPlayerState.isShuffled() ) { const DocLnk *cur = current(); int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); @@ -444,5 +444,5 @@ bool PlayListWidget::prev() { } else { if ( !d->selectedFiles->prev() ) { - if ( mediaPlayerState->isLooping() ) { + if ( mediaPlayerState.isLooping() ) { return d->selectedFiles->last(); } else { @@ -457,9 +457,9 @@ bool PlayListWidget::prev() { bool PlayListWidget::next() { //qDebug("<<<<<<<<<<<<next()"); - if ( mediaPlayerState->isShuffled() ) { + if ( mediaPlayerState.isShuffled() ) { return prev(); } else { if ( !d->selectedFiles->next() ) { - if ( mediaPlayerState->isLooping() ) { + if ( mediaPlayerState.isLooping() ) { return d->selectedFiles->first(); } else { @@ -531,6 +531,6 @@ void PlayListWidget::removeSelected() { void PlayListWidget::playIt( QListViewItem *it) { if(!it) return; - mediaPlayerState->setPlaying(FALSE); - mediaPlayerState->setPlaying(TRUE); + mediaPlayerState.setPlaying(FALSE); + mediaPlayerState.setPlaying(TRUE); d->selectedFiles->unSelect(); } @@ -615,5 +615,5 @@ void PlayListWidget::tabChanged(QWidget *) { void PlayListWidget::btnPlay(bool b) { // mediaPlayerState->setPlaying(false); - mediaPlayerState->setPlaying(b); + mediaPlayerState.setPlaying(b); insanityBool=FALSE; } @@ -1050,6 +1050,6 @@ void PlayListWidget::pmViewActivated(int index) { case -16: { - mediaPlayerState->toggleFullscreen(); - bool b=mediaPlayerState->isFullscreen(); + mediaPlayerState.toggleFullscreen(); + bool b=mediaPlayerState.isFullscreen(); pmView->setItemChecked( index, b); Config cfg( "OpiePlayer" ); diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index fa2837a..3f52e63 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -70,5 +70,5 @@ public: }; - PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); + PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~PlayListWidget(); DocLnkSet files; @@ -135,4 +135,5 @@ private slots: void playlistViewPressed( int, QListViewItem *, const QPoint&, int); void playSelected(); + }; diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 8be7a2f..f47ddcc 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp @@ -60,8 +60,6 @@ #include "mediaplayerstate.h" -extern MediaPlayerState *mediaPlayerState; - -PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl ) - : QMainWindow( parent, name, fl ) { +PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name ) + : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) { d = new PlayListWidgetPrivate; @@ -222,7 +220,7 @@ void PlayListWidgetGui::setActiveWindow() { // qDebug("SETTING active window"); // When we get raised we need to ensure that it switches views - MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); - mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate - mediaPlayerState->setDisplayType( origDisplayType ); // now switch back + MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); + mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate + mediaPlayerState.setDisplayType( origDisplayType ); // now switch back } diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h index 4eefb93..9b5252a 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h @@ -50,4 +50,5 @@ class PlayListWidgetPrivate; class PlayListSelection; +class MediaPlayerState; class Config; @@ -96,5 +97,5 @@ class PlayListWidgetGui : public QMainWindow { Q_OBJECT public: - PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 ); + PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 ); ~PlayListWidgetGui(); @@ -123,4 +124,5 @@ protected: void setView( char ); + MediaPlayerState &mediaPlayerState; }; |