-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 26 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 |
2 files changed, 12 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index b78ce24..889667c 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -55,9 +55,10 @@ #include <stdlib.h> #include <assert.h> PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) - : PlayListWidgetGui( mediaPlayerState, parent, name ) { + : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) +{ d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", this , SLOT(addSelected() ) ); @@ -476,10 +477,9 @@ void PlayListWidget::loadList( const DocLnk & lnk) { void PlayListWidget::addSelected() { assert( inFileListMode() ); - QListView *fileListView = currentFileListView(); - QListViewItemIterator it( fileListView ); + QListViewItemIterator it( currentFileListView ); for ( ; it.current(); ++it ) if ( it.current()->isSelected() ) { QString filename = it.current()->text(3); @@ -489,9 +489,9 @@ void PlayListWidget::addSelected() { d->selectedFiles->addToSelection( lnk ); } - fileListView->clearSelection(); + currentFileListView->clearSelection(); tabWidget->setCurrentPage( 0 ); writeCurrentM3u(); } @@ -541,8 +541,10 @@ void PlayListWidget::tabChanged(QWidget *) { d->tbPlay, SLOT( setEnabled( bool ) ) ); disconnect( videoView, SIGNAL( itemsSelected( bool ) ), d->tbPlay, SLOT( setEnabled( bool ) ) ); + currentFileListView = 0; + switch ( currentTab() ) { case CurrentPlayList: { if( !tbDeletePlaylist->isHidden() ) { @@ -567,8 +569,10 @@ void PlayListWidget::tabChanged(QWidget *) { connect( audioView, SIGNAL( itemsSelected( bool ) ), d->tbPlay, SLOT( setEnabled( bool ) ) ); d->tbPlay->setEnabled( audioView->hasSelection() ); + + currentFileListView = audioView; } break; case VideoFiles: { @@ -582,8 +586,10 @@ void PlayListWidget::tabChanged(QWidget *) { connect( videoView, SIGNAL( itemsSelected( bool ) ), d->tbPlay, SLOT( setEnabled( bool ) ) ); d->tbPlay->setEnabled( videoView->hasSelection() ); + + currentFileListView = videoView; } break; case PlayLists: { @@ -624,18 +630,8 @@ void PlayListWidget::deletePlaylist() { void PlayListWidget::playSelected() { btnPlay( TRUE); } -QListView *PlayListWidget::currentFileListView() const -{ - switch ( currentTab() ) { - case AudioFiles: return audioView; - case VideoFiles: return videoView; - default: assert( false ); - } - return 0; -} - bool PlayListWidget::inFileListMode() const { TabType tab = currentTab(); return tab == AudioFiles || tab == VideoFiles; @@ -1008,6 +1004,6 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const return Entry( currentFileListPathName() ); } QString PlayListWidget::currentFileListPathName() const { - return currentFileListView()->currentItem()->text( 3 ); + return currentFileListView->currentItem()->text( 3 ); } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 5c8f30c..e8bf211 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -97,10 +97,8 @@ private: void readm3u(const QString &); void readPls(const QString &); void initializeStates(); - QListView *currentFileListView() const; - bool inFileListMode() const; private slots: void populateSkinsMenu(); @@ -132,8 +130,9 @@ private: bool fromSetDocument; bool insanityBool; QString setDocFileRef, currentPlayList; int selected; + QListView *currentFileListView; }; #endif // PLAY_LIST_WIDGET_H |