summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-12 02:36:55 (UTC)
committer llornkcor <llornkcor>2002-11-12 02:36:55 (UTC)
commitc829e55b85c20034f0ae07336fd3f5b9a03d9a48 (patch) (side-by-side diff)
tree4bf1909c70c90a9fb1a70ad0d129f38e06d5ee80
parent03932444a6873eae016b934e540fd76a1197a0c1 (diff)
downloadopie-c829e55b85c20034f0ae07336fd3f5b9a03d9a48.zip
opie-c829e55b85c20034f0ae07336fd3f5b9a03d9a48.tar.gz
opie-c829e55b85c20034f0ae07336fd3f5b9a03d9a48.tar.bz2
fix playlist adding when two file share the same basename but different paths. made it faster adding files to playlist
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp147
1 files changed, 58 insertions, 89 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 8e88e9b..a6a9eca 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -210,6 +210,7 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
if ( mediaPlayerState->playlist() ) {
if( QFileInfo( lnk.file() ).exists() ||
- lnk.file().left(4) == "http" )
+ lnk.file().left(4) == "http" ) {
d->selectedFiles->addToSelection( lnk );
+ }
// writeCurrentM3u();
}
@@ -266,5 +267,8 @@ void PlayListWidget::addAllToList() {
}
}
- writeCurrentM3u();
+ tabWidget->setCurrentPage(0);
+
+ writeCurrentM3u();
+ d->selectedFiles->first();
}
@@ -279,5 +283,7 @@ void PlayListWidget::addAllMusicToList() {
}
}
- writeCurrentM3u();
+ tabWidget->setCurrentPage(0);
+ writeCurrentM3u();
+ d->selectedFiles->first();
}
@@ -292,5 +298,7 @@ void PlayListWidget::addAllVideoToList() {
}
}
+ tabWidget->setCurrentPage(0);
writeCurrentM3u();
+ d->selectedFiles->first();
}
@@ -424,9 +432,9 @@ bool PlayListWidget::last() {
void PlayListWidget::loadList( const DocLnk & lnk) {
QString name = lnk.name();
- qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
+ // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
if( name.length()>0) {
setCaption("OpiePlayer: "+name);
- qDebug("<<<<<<<<<<<<load list "+ lnk.file());
+// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
clearList();
readm3u(lnk.file());
@@ -446,51 +454,30 @@ void PlayListWidget::setPlaylist( bool shown ) {
void PlayListWidget::addSelected() {
- qDebug("addSelected");
- switch (whichList()) {
- case 0: //playlist
- break;
- case 1: { //audio
- QListViewItemIterator it( audioView );
- // iterate through all items of the listview
- for ( ; it.current(); ++it ) {
- if ( it.current()->isSelected() ) {
- QListIterator<DocLnk> dit( files.children() );
- for ( ; dit.current(); ++dit ) {
- if( dit.current()->name() == it.current()->text(0) ) {
- if( QFileInfo( dit.current()->file()).exists()) {
- d->selectedFiles->addToSelection( **dit );
- audioView->setSelected( it.current(),FALSE);
- }
- }
- }
- }
- }
-// tabWidget->setCurrentPage(0);
- writeCurrentM3u();
- d->selectedFiles->next();
- }
- break;
- case 2: { // video
- QListViewItemIterator it( videoView );
- // iterate through all items of the listview
- for ( ; it.current(); ++it ) {
- if ( it.current()->isSelected() ) {
- QListIterator<DocLnk> dit( vFiles.children() );
- for ( ; dit.current(); ++dit ) {
- if( dit.current()->name() == it.current()->text(0) ) {
- if(QFileInfo( dit.current()->file()).exists()) {
- d->selectedFiles->addToSelection( **dit );
- videoView->setSelected( it.current(),FALSE);
- }
- }
- }
- }
- }
-// tabWidget->setCurrentPage(0);
- writeCurrentM3u();
+ qDebug("addSelected");
+ DocLnk lnk;
+ QString filename;
+ switch (whichList()) {
+
+ case 0: //playlist
+ return;
+ break;
+ case 1: { //audio
+ filename=audioView->currentItem()->text(3);
+ // d->selectedFiles->next();
+ }
+ break;
- }
- break;
- };
+ case 2: { // video
+ filename=videoView->currentItem()->text(3);
+ // tabWidget->setCurrentPage(0);
+
+ }
+ break;
+ };
+ lnk.setName( QFileInfo(filename).baseName() ); //sets name
+ lnk.setFile( filename ); //sets file name
+ d->selectedFiles->addToSelection( lnk);
+ tabWidget->setCurrentPage(0);
+ writeCurrentM3u();
}
@@ -511,43 +498,25 @@ void PlayListWidget::playIt( QListViewItem *it) {
void PlayListWidget::addToSelection( QListViewItem *it) {
- d->setDocumentUsed = FALSE;
+ d->setDocumentUsed = FALSE;
- if(it) {
- switch ( whichList()) {
- case 1: {
- QListIterator<DocLnk> dit( files.children() );
- for ( ; dit.current(); ++dit ) {
- if( dit.current()->name() == it->text(0)) {
- if(QFileInfo( dit.current()->file()).exists()) {
- d->selectedFiles->addToSelection( **dit );
-// qDebug("blah "+ dit.current()->name());
-// d->selectedFiles->setSelectedItem( dit.current()->name());
- }
- }
- }
- writeCurrentM3u();
- }
- break;
- case 2: {
- QListIterator<DocLnk> dit( vFiles.children() );
- for ( ; dit.current(); ++dit ) {
- if( dit.current()->name() == it->text(0)) {
- if( QFileInfo( dit.current()->file()).exists() ) {
- d->selectedFiles->addToSelection( **dit );
-// qDebug("blah "+ dit.current()->name());
-// d->selectedFiles->setSelectedItem( dit.current()->name());
- }
- }
- }
- writeCurrentM3u();
-
- }
- break;
- case 0:
- break;
- };
- tabWidget->setCurrentPage(0);
+ if(it) {
+ switch ( whichList()) {
+ case 0: //playlist
+ return;
+ break;
+ };
+ // case 1: {
+ DocLnk lnk;
+ QString filename;
+
+ filename=it->text(3);
+ lnk.setName( QFileInfo(filename).baseName() ); //sets name
+ lnk.setFile( filename ); //sets file name
+ d->selectedFiles->addToSelection( lnk);
+
+ writeCurrentM3u();
+ tabWidget->setCurrentPage(0);
- }
+ }
}
@@ -920,5 +889,5 @@ void PlayListWidget::writem3u() {
if( d->selectedFiles->first()) {
- m3uList = new Om3u(filename, IO_ReadWrite);
+ m3uList = new Om3u(filename, IO_ReadWrite);
do {