summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp58
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h2
2 files changed, 24 insertions, 36 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
@@ -534,45 +534,25 @@ 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;
-
- case 2: { // video
- QListViewItemIterator it( videoView );
- 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);
+ 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 );
}
- }
- videoView->clearSelection();
- }
- break;
- };
- tabWidget->setCurrentPage(0);
- writeCurrentM3u();
+
+ fileListView->clearSelection();
+
+ tabWidget->setCurrentPage( 0 );
+ writeCurrentM3u();
}
@@ -799,6 +779,12 @@ QListView *PlayListWidget::currentFileListView() const
return 0;
}
+bool PlayListWidget::inFileListMode() const
+{
+ TabType tab = currentTab();
+ return tab == AudioFiles || tab == VideoFiles;
+}
+
void PlayListWidget::openFile() {
// http://66.28.164.33:2080
// http://somafm.com/star0242.m3u
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
@@ -92,6 +92,8 @@ private:
QListView *currentFileListView() const;
+ bool inFileListMode() const;
+
private slots:
void populateSkinsMenu();
void skinsMenuActivated(int);