-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 @@ | |||
55 | #include <stdlib.h> | 55 | #include <stdlib.h> |
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", |
63 | this , SLOT(addSelected() ) ); | 64 | this , SLOT(addSelected() ) ); |
@@ -476,10 +477,9 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
476 | 477 | ||
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); |
485 | 485 | ||
@@ -489,9 +489,9 @@ void PlayListWidget::addSelected() { | |||
489 | 489 | ||
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(); |
497 | } | 497 | } |
@@ -541,8 +541,10 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
541 | d->tbPlay, SLOT( setEnabled( bool ) ) ); | 541 | d->tbPlay, SLOT( setEnabled( bool ) ) ); |
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 | { |
548 | if( !tbDeletePlaylist->isHidden() ) { | 550 | if( !tbDeletePlaylist->isHidden() ) { |
@@ -567,8 +569,10 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
567 | connect( audioView, SIGNAL( itemsSelected( bool ) ), | 569 | connect( audioView, SIGNAL( itemsSelected( bool ) ), |
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: |
574 | { | 578 | { |
@@ -582,8 +586,10 @@ void PlayListWidget::tabChanged(QWidget *) { | |||
582 | connect( videoView, SIGNAL( itemsSelected( bool ) ), | 586 | connect( videoView, SIGNAL( itemsSelected( bool ) ), |
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: |
589 | { | 595 | { |
@@ -624,18 +630,8 @@ void PlayListWidget::deletePlaylist() { | |||
624 | void PlayListWidget::playSelected() { | 630 | 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(); |
641 | return tab == AudioFiles || tab == VideoFiles; | 637 | return tab == AudioFiles || tab == VideoFiles; |
@@ -1008,6 +1004,6 @@ PlayListWidget::Entry PlayListWidget::currentEntry() const | |||
1008 | return Entry( currentFileListPathName() ); | 1004 | return Entry( currentFileListPathName() ); |
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 | |||
@@ -97,10 +97,8 @@ private: | |||
97 | void readm3u(const QString &); | 97 | void readm3u(const QString &); |
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: |
106 | void populateSkinsMenu(); | 104 | void populateSkinsMenu(); |
@@ -132,8 +130,9 @@ private: | |||
132 | bool fromSetDocument; | 130 | bool fromSetDocument; |
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 |
139 | 138 | ||