summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-12-16 03:37:40 (UTC)
committer llornkcor <llornkcor>2002-12-16 03:37:40 (UTC)
commit4b4d676971c9682c181d905669795fc5ba8bf13f (patch) (side-by-side diff)
treea1575f71515c1c81d3969a9db6b5b749f7005f65
parentffefde3701c0aed084872d05710d78b7201efaa8 (diff)
downloadopie-4b4d676971c9682c181d905669795fc5ba8bf13f.zip
opie-4b4d676971c9682c181d905669795fc5ba8bf13f.tar.gz
opie-4b4d676971c9682c181d905669795fc5ba8bf13f.tar.bz2
remove some commented code
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp97
1 files changed, 0 insertions, 97 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 707f4d2..e9615f1 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -226,157 +226,113 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , in
}
break;
}
}
void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
switch (mouse) {
case LeftButton:
break;
case RightButton:
{
QPopupMenu m;
m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
m.exec( QCursor::pos() );
}
break;
}
}
void PlayListWidget::addAllToList() {
-// QTime t;
-// t.start();
audioView->populateView();
QListViewItemIterator audioIt( audioView );
DocLnk lnk;
QString filename;
// iterate through all items of the listview
for ( ; audioIt.current(); ++audioIt ) {
filename = audioIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
videoView->populateView();
QListViewItemIterator videoIt( videoView );
for ( ; videoIt.current(); ++videoIt ) {
filename = videoIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
- // d->selectedFiles->addToSelection( );
- // if ( it.current()->isSelected() )
- // lst->append( audioIt.current() );
- // }
-
-
-// if(!audioScan)
-// scanForAudio();
-// if(!videoScan)
-// scanForVideo();
-
-// DocLnkSet filesAll;
-// Global::findDocuments(&filesAll, "video/*;"+audioMimes);
-// QListIterator<DocLnk> Adit( filesAll.children() );
-// for ( ; Adit.current(); ++Adit ) {
-// if( QFileInfo( Adit.current()->file() ).exists() ) {
-// d->selectedFiles->addToSelection( **Adit );
-// }
-// }
-
- // qDebug("elapsed time %d", t.elapsed() );
-
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::addAllMusicToList() {
audioView->populateView();
QListViewItemIterator audioIt( audioView );
DocLnk lnk;
QString filename;
// iterate through all items of the listview
for ( ; audioIt.current(); ++audioIt ) {
filename = audioIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
- /* if(!audioScan)
- scanForAudio();
- QListIterator<DocLnk> dit( files.children() );
- for ( ; dit.current(); ++dit ) {
- if( QFileInfo(dit.current()->file() ).exists() ) {
- d->selectedFiles->addToSelection( **dit );
- }
- }
- */
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::addAllVideoToList() {
videoView->populateView();
QListViewItemIterator videoIt( videoView );
DocLnk lnk;
QString filename;
for ( ; videoIt.current(); ++videoIt ) {
filename = videoIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
-
-
- /* if(!videoScan)
- scanForVideo();
- QListIterator<DocLnk> dit( vFiles.children() );
- for ( ; dit.current(); ++dit ) {
- if( QFileInfo( dit.current()->file() ).exists() ) {
- d->selectedFiles->addToSelection( **dit );
- }
- }
-*/
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::setDocument( const QString& fileref ) {
// qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
fromSetDocument = TRUE;
QFileInfo fileInfo(fileref);
if ( !fileInfo.exists() ) {
QMessageBox::warning( this, tr( "Invalid File" ),
tr( "There was a problem in getting the file." ) );
return;
}
clearList();
QString extension = fileInfo.extension(false);
if( extension.find( "m3u", 0, false) != -1
|| extension.find( "pls", 0, false) != -1 ) {
readListFromFile( fileref );
} else {
@@ -451,103 +407,98 @@ bool PlayListWidget::next() {
}
}
return TRUE;
}
}
bool PlayListWidget::first() {
return d->selectedFiles->first();
}
bool PlayListWidget::last() {
return d->selectedFiles->last();
}
void PlayListWidget::saveList() {
writem3u();
}
void PlayListWidget::loadList( const DocLnk & lnk) {
QString name = lnk.name();
- // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
if( name.length()>0) {
setCaption("OpiePlayer: "+name);
-// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
clearList();
-// readm3u(lnk.file());
readListFromFile(lnk.file());
tabWidget->setCurrentPage(0);
}
}
void PlayListWidget::addSelected() {
assert( inFileListMode() );
QListViewItemIterator it( currentFileListView );
for ( ; it.current(); ++it )
if ( it.current()->isSelected() ) {
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 );
}
currentFileListView->clearSelection();
-// tabWidget->setCurrentPage( 0 );
writeCurrentM3u();
}
void PlayListWidget::removeSelected() {
d->selectedFiles->removeSelected( );
writeCurrentM3u();
}
void PlayListWidget::playIt( QListViewItem *it) {
if(!it) return;
mediaPlayerState.setPlaying(FALSE);
mediaPlayerState.setPlaying(TRUE);
d->selectedFiles->unSelect();
}
void PlayListWidget::addToSelection( QListViewItem *it) {
d->setDocumentUsed = FALSE;
if(it) {
if ( currentTab() == CurrentPlayList )
return;
- // 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);
}
}
void PlayListWidget::tabChanged(QWidget *) {
d->tbPlay->setEnabled( true );
disconnect( audioView, SIGNAL( itemsSelected( bool ) ),
d->tbPlay, SLOT( setEnabled( bool ) ) );
disconnect( videoView, SIGNAL( itemsSelected( bool ) ),
d->tbPlay, SLOT( setEnabled( bool ) ) );
@@ -652,61 +603,59 @@ 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->text();
qDebug( "Selected filename is " + filename );
// Om3u *m3uList;
DocLnk lnk;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
if(filename.left(4) == "http") {
QString m3uFile, m3uFilePath;
if(filename.find(":",8,TRUE) != -1) { //found a port
m3uFile = filename.left( filename.find( ":",8,TRUE));
m3uFile = m3uFile.right( 7);
} else if(filename.left(4) == "http"){
m3uFile=filename;
m3uFile = m3uFile.right( m3uFile.length() - 7);
} else{
m3uFile=filename;
}
-// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
lnk.setName( filename ); //sets name
lnk.setFile( filename ); //sets file name
// lnk.setIcon("opieplayer2/musicfile");
d->selectedFiles->addToSelection( lnk );
writeCurrentM3u();
d->selectedFiles->setSelectedItem( lnk.name());
}
else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
readListFromFile( filename );
-// readPls( filename );
} else {
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
writeCurrentM3u();
d->selectedFiles->setSelectedItem( lnk.name());
}
}
delete fileDlg;
}
void PlayListWidget::readListFromFile( const QString &filename ) {
qDebug( "read list filename " + filename );
QFileInfo fi(filename);
Om3u *m3uList;
QString s, name;
m3uList = new Om3u( filename, IO_ReadOnly );
if(fi.extension(false).find("m3u",0,false) != -1 )
m3uList->readM3u();
else if(fi.extension(false).find("pls",0,false) != -1 )
m3uList->readPls();
@@ -716,102 +665,56 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
// qDebug(s);
if(s.left(4)=="http") {
lnk.setName( s ); //sets file name
lnk.setIcon("opieplayer2/musicfile");
lnk.setFile( s ); //sets file name
} else { //is file
lnk.setName( QFileInfo(s).baseName());
if(s.left(1) != "/") {
lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
} else {
lnk.setFile( s);
}
}
d->selectedFiles->addToSelection( lnk );
}
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
config.writeEntry("CurrentPlaylist",filename);
config.write();
currentPlayList=filename;
-// m3uList->write();
m3uList->close();
delete m3uList;
d->selectedFiles->setSelectedItem( s);
setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
}
-// /*
-// reads pls and adds files/urls to playlist */
-// void PlayListWidget::readPls( const QString &filename ) {
-
-// qDebug( "pls filename is " + filename );
-// Om3u *m3uList;
-// QString s, name;
-// m3uList = new Om3u( filename, IO_ReadOnly );
-// m3uList->readPls();
-
-// for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
-// s = *it;
-// // s.replace( QRegExp( "%20" )," " );
-// DocLnk lnk( s );
-// QFileInfo f( s );
-// QString name = f.baseName();
-
-// if( name.left( 4 ) == "http" ) {
-// name = s.right( s.length() - 7);
-// } else {
-// name = s;
-// }
-
-// name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
-
-// lnk.setName( name );
-// if( s.at( s.length() - 4) == '.') {// if this is probably a file
-// lnk.setFile( s );
-// } else { //if its a url
-// // if( name.right( 1 ).find( '/' ) == -1) {
-// // s += "/";
-// // }
-// lnk.setFile( s );
-// }
-// lnk.setType( "audio/x-mpegurl" );
-
-// lnk.writeLink();
-// d->selectedFiles->addToSelection( lnk );
-// }
-
-// m3uList->close();
-// delete m3uList;
-// }
-
-// /*
// writes current playlist to current m3u file */
void PlayListWidget::writeCurrentM3u() {
qDebug("writing to current m3u");
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
Om3u *m3uList;
m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
if( d->selectedFiles->first()) {
do {
// qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
// qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
m3uList->write();
m3uList->close();
}
delete m3uList;
}