author | simon <simon> | 2002-12-09 09:47:04 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 09:47:04 (UTC) |
commit | 7ccd9b65ab621dbf8bf79c053141af81fb39ca4b (patch) (side-by-side diff) | |
tree | f0f06b67b5f041cf51eb4eb9e3e407e543f3d556 | |
parent | 88882051547c9c62f47fb83d87f1341ebccf99a7 (diff) | |
download | opie-7ccd9b65ab621dbf8bf79c053141af81fb39ca4b.zip opie-7ccd9b65ab621dbf8bf79c053141af81fb39ca4b.tar.gz opie-7ccd9b65ab621dbf8bf79c053141af81fb39ca4b.tar.bz2 |
- replaced currentFileListView method with a variable
-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 @@ -53,13 +53,14 @@ //only needed for the random play #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() ) ); d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", @@ -474,26 +475,25 @@ 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); DocLnk lnk; lnk.setName( QFileInfo( filename ).baseName() ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk ); } - fileListView->clearSelection(); + currentFileListView->clearSelection(); tabWidget->setCurrentPage( 0 ); writeCurrentM3u(); } @@ -539,12 +539,14 @@ void PlayListWidget::tabChanged(QWidget *) { disconnect( audioView, SIGNAL( itemsSelected( bool ) ), d->tbPlay, SLOT( setEnabled( bool ) ) ); disconnect( videoView, SIGNAL( itemsSelected( bool ) ), d->tbPlay, SLOT( setEnabled( bool ) ) ); + currentFileListView = 0; + switch ( currentTab() ) { case CurrentPlayList: { if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } @@ -565,12 +567,14 @@ void PlayListWidget::tabChanged(QWidget *) { d->tbAddToList->setEnabled(TRUE); connect( audioView, SIGNAL( itemsSelected( bool ) ), d->tbPlay, SLOT( setEnabled( bool ) ) ); d->tbPlay->setEnabled( audioView->hasSelection() ); + + currentFileListView = audioView; } break; case VideoFiles: { videoView->populateView(); if( !tbDeletePlaylist->isHidden() ) { @@ -580,12 +584,14 @@ void PlayListWidget::tabChanged(QWidget *) { d->tbAddToList->setEnabled(TRUE); connect( videoView, SIGNAL( itemsSelected( bool ) ), d->tbPlay, SLOT( setEnabled( bool ) ) ); d->tbPlay->setEnabled( videoView->hasSelection() ); + + currentFileListView = videoView; } break; case PlayLists: { if( tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->show(); @@ -622,22 +628,12 @@ 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; } @@ -1006,8 +1002,8 @@ 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 @@ -95,14 +95,12 @@ signals: private: int defaultSkinIndex; void readm3u(const QString &); void readPls(const QString &); void initializeStates(); - QListView *currentFileListView() const; - bool inFileListMode() const; private slots: void populateSkinsMenu(); void skinsMenuActivated(int); void pmViewActivated(int); @@ -130,10 +128,11 @@ private slots: private: bool fromSetDocument; bool insanityBool; QString setDocFileRef, currentPlayList; int selected; + QListView *currentFileListView; }; #endif // PLAY_LIST_WIDGET_H |