author | simon <simon> | 2002-12-09 09:47:04 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 09:47:04 (UTC) |
commit | 7ccd9b65ab621dbf8bf79c053141af81fb39ca4b (patch) (unidiff) | |
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 | |||
@@ -56,7 +56,8 @@ | |||
56 | #include <assert.h> | 56 | #include <assert.h> |
57 | 57 | ||
58 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 58 | PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
59 | : PlayListWidgetGui( mediaPlayerState, parent, name ) { | 59 | : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) |
60 | { | ||
60 | 61 | ||
61 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
62 | "opieplayer2/add_to_playlist", | 63 | "opieplayer2/add_to_playlist", |
@@ -477,8 +478,7 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
477 | void PlayListWidget::addSelected() { | 478 | void PlayListWidget::addSelected() { |
478 | assert( inFileListMode() ); | 479 | assert( inFileListMode() ); |
479 | 480 | ||
480 | QListView *fileListView = currentFileListView(); | 481 | QListViewItemIterator it( currentFileListView ); |
481 | QListViewItemIterator it( fileListView ); | ||
482 | for ( ; it.current(); ++it ) | 482 | for ( ; it.current(); ++it ) |
483 | if ( it.current()->isSelected() ) { | 483 | if ( it.current()->isSelected() ) { |
484 | QString filename = it.current()->text(3); | 484 | QString filename = it.current()->text(3); |
@@ -490,7 +490,7 @@ void PlayListWidget::addSelected() { | |||
490 | d->selectedFiles->addToSelection( lnk ); | 490 | d->selectedFiles->addToSelection( lnk ); |
491 | } | 491 | } |
492 | 492 | ||
493 | fileListView->clearSelection(); | 493 | currentFileListView->clearSelection(); |
494 | 494 | ||
495 | tabWidget->setCurrentPage( 0 ); | 495 | tabWidget->setCurrentPage( 0 ); |
496 | writeCurrentM3u(); | 496 | writeCurrentM3u(); |
@@ -542,6 +542,8 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
542 | disconnect( videoView, SIGNAL( itemsSelected( bool ) ), | 542 | disconnect( videoView, SIGNAL( itemsSelected( bool ) ), |
543 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 543 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
544 | 544 | ||
545 | currentFileListView = 0; | ||
546 | |||
545 | switch ( currentTab() ) { | 547 | switch ( currentTab() ) { |
546 | case CurrentPlayList: | 548 | case CurrentPlayList: |
547 | { | 549 | { |
@@ -568,6 +570,8 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
568 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 570 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
569 | 571 | ||
570 | d->tbPlay->setEnabled( audioView->hasSelection() ); | 572 | d->tbPlay->setEnabled( audioView->hasSelection() ); |
573 | |||
574 | currentFileListView = audioView; | ||
571 | } | 575 | } |
572 | break; | 576 | break; |
573 | case VideoFiles: | 577 | case VideoFiles: |
@@ -583,6 +587,8 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
583 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 587 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
584 | 588 | ||
585 | d->tbPlay->setEnabled( videoView->hasSelection() ); | 589 | d->tbPlay->setEnabled( videoView->hasSelection() ); |
590 | |||
591 | currentFileListView = videoView; | ||
586 | } | 592 | } |
587 | break; | 593 | break; |
588 | case PlayLists: | 594 | case PlayLists: |
@@ -625,16 +631,6 @@ void PlayListWidget::playSelected() { | |||
625 | btnPlay( TRUE); | 631 | btnPlay( TRUE); |
626 | } | 632 | } |
627 | 633 | ||
628 | QListView *PlayListWidget::currentFileListView() const | ||
629 | { | ||
630 | switch ( currentTab() ) { | ||
631 | case AudioFiles: return audioView; | ||
632 | case VideoFiles: return videoView; | ||
633 | default: assert( false ); | ||
634 | } | ||
635 | return 0; | ||
636 | } | ||
637 | |||
638 | bool PlayListWidget::inFileListMode() const | 634 | bool PlayListWidget::inFileListMode() const |
639 | { | 635 | { |
640 | TabType tab = currentTab(); | 636 | TabType tab = currentTab(); |
@@ -1009,5 +1005,5 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const | |||
1009 | } | 1005 | } |
1010 | 1006 | ||
1011 | QString PlayListWidget::currentFileListPathName() const { | 1007 | QString PlayListWidget::currentFileListPathName() const { |
1012 | return currentFileListView()->currentItem()->text( 3 ); | 1008 | return currentFileListView->currentItem()->text( 3 ); |
1013 | } | 1009 | } |
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 | |||
@@ -98,8 +98,6 @@ private: | |||
98 | void readPls(const QString &); | 98 | void readPls(const QString &); |
99 | void initializeStates(); | 99 | void initializeStates(); |
100 | 100 | ||
101 | QListView *currentFileListView() const; | ||
102 | |||
103 | bool inFileListMode() const; | 101 | bool inFileListMode() const; |
104 | 102 | ||
105 | private slots: | 103 | private slots: |
@@ -133,6 +131,7 @@ private: | |||
133 | bool insanityBool; | 131 | bool insanityBool; |
134 | QString setDocFileRef, currentPlayList; | 132 | QString setDocFileRef, currentPlayList; |
135 | int selected; | 133 | int selected; |
134 | QListView *currentFileListView; | ||
136 | }; | 135 | }; |
137 | 136 | ||
138 | #endif // PLAY_LIST_WIDGET_H | 137 | #endif // PLAY_LIST_WIDGET_H |