-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index d7447b7..200ec16 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -963,314 +963,318 @@ void PlayListWidget::listDelete() { // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); // prop.showMaximized(); // prop.exec(); // } // } } break; }; } void PlayListWidget::scanForAudio() { qDebug("scan for audio"); files.detachChildren(); QListIterator<DocLnk> sdit( files.children() ); for ( ; sdit.current(); ++sdit ) { delete sdit.current(); } Global::findDocuments(&files, "audio/*"); audioScan = TRUE; } void PlayListWidget::scanForVideo() { qDebug("scan for video"); vFiles.detachChildren(); QListIterator<DocLnk> sdit( vFiles.children() ); for ( ; sdit.current(); ++sdit ) { delete sdit.current(); } Global::findDocuments(&vFiles, "video/*"); videoScan = TRUE; } void PlayListWidget::populateAudioView() { audioView->clear(); StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); if(!audioScan) scanForAudio(); QListIterator<DocLnk> dit( files.children() ); QListIterator<FileSystem> it ( fs ); QString storage; for ( ; dit.current(); ++dit ) { for( ; it.current(); ++it ){ const QString name = (*it)->name(); const QString path = (*it)->path(); if(dit.current()->file().find(path) != -1 ) storage=name; } QListViewItem * newItem; if ( QFile( dit.current()->file()).exists() ) { // qDebug(dit.current()->name()); newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); } } } void PlayListWidget::populateVideoView() { videoView->clear(); StorageInfo storageInfo; const QList<FileSystem> &fs = storageInfo.fileSystems(); if(!videoScan ) scanForVideo(); QListIterator<DocLnk> Vdit( vFiles.children() ); QListIterator<FileSystem> it ( fs ); videoView->clear(); QString storage; for ( ; Vdit.current(); ++Vdit ) { for( ; it.current(); ++it ){ const QString name = (*it)->name(); const QString path = (*it)->path(); if( Vdit.current()->file().find(path) != -1 ) storage=name; } QListViewItem * newItem; if ( QFile( Vdit.current()->file()).exists() ) { newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); } } } void PlayListWidget::openFile() { QString filename, name; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { filename = fileDlg->LineEdit1->text(); // http://205.188.234.129:8030 // http://66.28.68.70:8000 + filename.replace(QRegExp("%20")," "); + qDebug("Selected filename is "+filename); if(filename.right(3) == "m3u") readm3u( filename); else if(filename.right(3) == "pls") readPls( filename); else { DocLnk lnk; lnk.setName(filename); //sets file name if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") filename += "/"; lnk.setFile(filename); //sets File property lnk.setType("audio/x-mpegurl"); lnk.setExec("opieplayer"); lnk.setIcon("opieplayer/MPEGPlayer"); if(!lnk.writeLink()) qDebug("Writing doclink did not work"); d->selectedFiles->addToSelection( lnk); // if(fileDlg2) // delete fileDlg2; } } if(fileDlg) delete fileDlg; } void PlayListWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_F9: //activity // if(audioUI->isHidden()) // audioUI->showMaximized(); break; case Key_F10: //contacts // if( videoUI->isHidden()) // videoUI->showMaximized(); break; case Key_F11: //menu break; case Key_F12: //home // doBlank(); break; case Key_F13: //mail // doUnblank(); break; case Key_Q: //add to playlist qDebug("Add"); addSelected(); break; case Key_R: //remove from playlist removeSelected(); break; // case Key_P: //play // qDebug("Play"); // playSelected(); // break; case Key_Space: qDebug("Play"); // playSelected(); puh break; case Key_1: tabWidget->setCurrentPage(0); break; case Key_2: tabWidget->setCurrentPage(1); break; case Key_3: tabWidget->setCurrentPage(2); break; case Key_4: tabWidget->setCurrentPage(3); break; } } void PlayListWidget::keyPressEvent( QKeyEvent *e) { // qDebug("Key press"); // switch ( e->key() ) { // ////////////////////////////// Zaurus keys // case Key_A: //add to playlist // qDebug("Add"); // addSelected(); // break; // case Key_R: //remove from playlist // removeSelected(); // break; // case Key_P: //play // qDebug("Play"); // playSelected(); // break; // case Key_Space: // qDebug("Play"); // playSelected(); // break; // } } void PlayListWidget::doBlank() { qDebug("do blanking"); fd=open("/dev/fb0",O_RDWR); if (fd != -1) { ioctl(fd,FBIOBLANK,1); // close(fd); } } void PlayListWidget::doUnblank() { // this crashes opieplayer with a segfault // int fd; // fd=open("/dev/fb0",O_RDWR); qDebug("do unblanking"); if (fd != -1) { ioctl(fd,FBIOBLANK,0); close(fd); } QCopEnvelope h("QPE/System", "setBacklight(int)"); h <<-3;// v[1]; // -3 Force on } void PlayListWidget::readm3u(const QString &filename) { qDebug("m3u filename is "+filename); QFile f(filename); if(f.open(IO_ReadOnly)) { QTextStream t(&f); QString s;//, first, second; int i=0; while ( !t.atEnd()) { // Lview->insertLine(t.readLine(),-1); s=t.readLine(); if(s.find("#",0,TRUE) == -1) { if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat if(s.left(2) == "E:" || s.left(2) == "P:") { s=s.right(s.length()-2); DocLnk lnk( s ); QFileInfo f(s); QString name = f.baseName(); name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); lnk.setName( name); s=s.replace( QRegExp("\\"),"/"); lnk.setFile( s); // lnk.setIcon(opieplayer/MPEGPlayer); qDebug("add "+name); d->selectedFiles->addToSelection( lnk); } else { // is url + s.replace(QRegExp("%20")," "); DocLnk lnk( s); QString name = s.right( s.length() - 7); // name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); lnk.setName(name); lnk.setFile( s+"/"); // lnk.setFile( filename); // lnk.setComment( s+"/"); lnk.setType("audio/x-mpegurl"); // lnk.setIcon( "opieplayer/MPEGPlayer"); // qDebug("add "+s); d->selectedFiles->addToSelection( lnk); } i++; } } } } } void PlayListWidget::writem3u(const QString &filename) { } void PlayListWidget::readPls(const QString &filename) { qDebug("pls filename is "+filename); QFile f(filename); if(f.open(IO_ReadOnly)) { QTextStream t(&f); QString s;//, first, second; int i=0; while ( !t.atEnd()) { s=t.readLine(); if(s.left(4) == "File") { s=s.right(s.length() - 6); + s.replace(QRegExp("%20")," "); qDebug("adding "+s+" to playlist"); // numberofentries=2 // File1=http // Title // Length // Version // File2=http s=s.replace( QRegExp("\\"),"/"); // Lview->insertLine(t.readLine(),-1); // s=t.readLine(); // s=s.right(s.length()-2); DocLnk lnk( s ); QFileInfo f(s); QString name = f.baseName(); name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); // QFileInfo f(s); // QString name = f.baseName(); // // name = name.left(name.length()-4); // name = name.right(name.findRev("/",0,TRUE)); lnk.setName( name); lnk.setFile( s+"/"); lnk.setType("audio/x-mpegurl"); qDebug("DocLnk add "+name); d->selectedFiles->addToSelection( lnk); } } i++; } } |