author | simon <simon> | 2002-12-02 15:00:35 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 15:00:35 (UTC) |
commit | 77147a2001cf991e3581bcb2401143e20a3973d4 (patch) (side-by-side diff) | |
tree | 2f42819217f97431082a54459d6a7cfe76ea5702 /noncore | |
parent | f90e42128a496a0fb5a67c3148c30ef46092624b (diff) | |
download | opie-77147a2001cf991e3581bcb2401143e20a3973d4.zip opie-77147a2001cf991e3581bcb2401143e20a3973d4.tar.gz opie-77147a2001cf991e3581bcb2401143e20a3973d4.tar.bz2 |
- simplified addSelected
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 46 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
2 files changed, 18 insertions, 30 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 92da73b..c9ae225 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -536,39 +536,19 @@ void PlayListWidget::setPlaylist( bool shown ) { void PlayListWidget::addSelected() { - qDebug("addSelected"); - DocLnk lnk; - QString filename; - switch (whichList()) { + assert( inFileListMode() ); - case 0: //playlist - return; - break; - case 1: { //audio - QListViewItemIterator it( audioView ); - for ( ; it.current(); ++it ) { + QListView *fileListView = currentFileListView(); + QListViewItemIterator it( fileListView ); + for ( ; it.current(); ++it ) if ( it.current()->isSelected() ) { - filename=it.current()->text(3); - lnk.setName( QFileInfo(filename).baseName() ); //sets name - lnk.setFile( filename ); //sets file name - d->selectedFiles->addToSelection( lnk); - - } - } - audioView->clearSelection(); - } - break; + QString filename = it.current()->text(3); - case 2: { // video - QListViewItemIterator it( videoView ); - for ( ; it.current(); ++it ) { - if ( it.current()->isSelected() ) { - filename=it.current()->text(3); + DocLnk lnk; lnk.setName( QFileInfo(filename).baseName() ); //sets name lnk.setFile( filename ); //sets file name + d->selectedFiles->addToSelection( lnk); } - } - videoView->clearSelection(); - } - break; - }; + + fileListView->clearSelection(); + tabWidget->setCurrentPage(0); @@ -801,2 +781,8 @@ QListView *PlayListWidget::currentFileListView() const +bool PlayListWidget::inFileListMode() const +{ + TabType tab = currentTab(); + return tab == AudioFiles || tab == VideoFiles; +} + void PlayListWidget::openFile() { diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index a608eae..238a75c 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -94,2 +94,4 @@ private: + bool inFileListMode() const; + private slots: |