Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 142 |
1 files changed, 57 insertions, 85 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 7ea95ab..1fc7dd8 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -309,3 +309,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) LTab = new QWidget( tabWidget, "LTab" ); - playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy + playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); @@ -315,3 +315,2 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); -// playLists->setMinimumSize(233,260); @@ -360,8 +359,8 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) readConfig( cfg ); - QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); - loadList(DocLnk( currentPlaylist)); - setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); + + currentPlayList = cfg.readEntry("CurrentPlaylist","default"); + loadList(DocLnk( currentPlayList)); + setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); initializeStates(); - // audioUI->setFocus(); } @@ -423,11 +422,12 @@ void PlayListWidget::writeConfig( Config& cfg ) const { // of disk space, but check it anyway. - if ( !lnk->writeLink() ) { - QMessageBox::critical( 0, tr("Out of space"), - tr( "There was a problem saving " - "the playlist.\n" - "Your playlist " - "may be missing some entries\n" - "the next time you start it." ) - ); - } +// if ( !lnk->writeLink() ) { +// QMessageBox::critical( 0, tr("Out of space"), +// tr( "There was a problem saving " +// "the playlist.\n" +// "Your playlist " +// "may be missing some entries\n" +// "the next time you start it." ) +// ); +// } + } @@ -449,2 +449,3 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { mediaPlayerState->setPlaying( true); + } @@ -455,2 +456,7 @@ void PlayListWidget::clearList() { d->selectedFiles->removeSelected(); + Config cfg( "OpiePlayer" ); + cfg.setGroup("PlayList"); + cfg.writeEntry("CurrentPlaylist",""); + currentPlayList=""; + } @@ -499,6 +505,3 @@ void PlayListWidget::setDocument(const QString& fileref) { d->setDocumentUsed = TRUE; - d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true ); - mediaPlayerState->setPlaying( FALSE ); - qApp->processEvents(); - mediaPlayerState->setPlaying( TRUE ); + setDocumentEx(fileref); } @@ -506,3 +509,5 @@ void PlayListWidget::setDocument(const QString& fileref) { void PlayListWidget::setDocumentEx(const QString& fileref) { - + qDebug("opieplayer receive "+fileref); + clearList(); + DocLnk lnk; QFileInfo fileInfo(fileref); @@ -513,3 +518,3 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { } - qDebug("setDocument "+fileref); + // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref); QString extension = fileInfo.extension(false); @@ -523,5 +528,5 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { clearList(); - DocLnk lnk; lnk.setName( fileInfo.baseName() ); //sets name lnk.setFile( fileref ); //sets file name + lnk.setIcon("Sound"); //addToSelection( lnk ); @@ -531,9 +536,18 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { } else { - clearList(); - DocLnk lnk; + if( fileref.find(".desktop",0,TRUE) != -1) { + lnk = DocLnk(fileref); + } else { lnk.setName( fileInfo.baseName() ); //sets name lnk.setFile( fileref ); //sets file name + lnk.setIcon("Sound"); + } + addToSelection( lnk ); // addToSelection( DocLnk( fileref ) ); + lnk.removeLinkFile(); + // qApp->processEvents(); + } + setCaption(tr("OpiePlayer")); d->setDocumentUsed = TRUE; + d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true ); mediaPlayerState->setPlaying( FALSE ); @@ -541,5 +555,3 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { mediaPlayerState->setPlaying( TRUE ); - // qApp->processEvents(); - setCaption(tr("OpiePlayer")); - } + } @@ -548,4 +560,3 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { void PlayListWidget::setActiveWindow() { - qDebug("SETTING active window"); - + // qDebug("SETTING active window"); // When we get raised we need to ensure that it switches views @@ -563,18 +574,2 @@ void PlayListWidget::useSelectedDocument() { const DocLnk *PlayListWidget::current() { // this is fugly - -// if( fromSetDocument) { -// qDebug("from setDoc"); -// DocLnkSet files; -// Global::findDocuments(&files, "video/*;audio/*"); -// QListIterator<DocLnk> dit( files.children() ); -// for ( ; dit.current(); ++dit ) { -// if(dit.current()->linkFile() == setDocFileRef) { -// qDebug(setDocFileRef); -// return dit; -// } -// } -// } else - - qDebug("current"); - switch (tabWidget->currentPageIndex()) { @@ -582,3 +577,3 @@ const DocLnk *PlayListWidget::current() { // this is fugly { - qDebug("playlist"); + // qDebug("playlist"); if ( mediaPlayerState->playlist() ) { @@ -595,3 +590,3 @@ const DocLnk *PlayListWidget::current() { // this is fugly { - qDebug("audioView"); + // qDebug("audioView"); QListIterator<DocLnk> dit( files.children() ); @@ -599,3 +594,2 @@ const DocLnk *PlayListWidget::current() { // this is fugly if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { - qDebug("here"); insanityBool=TRUE; @@ -608,3 +602,2 @@ const DocLnk *PlayListWidget::current() { // this is fugly { - qDebug("videoView"); QListIterator<DocLnk> Vdit( vFiles.children() ); @@ -719,3 +712,2 @@ void PlayListWidget::setView( char view ) { void PlayListWidget::addSelected() { - qDebug("addSelected"); DocLnk lnk; @@ -769,3 +761,2 @@ void PlayListWidget::playIt( QListViewItem *) { // mediaPlayerState->curPosition =0; - qDebug("playIt"); // mediaPlayerState->setPlaying(FALSE); @@ -843,3 +834,2 @@ void PlayListWidget::tabChanged(QWidget *) { void PlayListWidget::btnPlay(bool b) { - qDebug("<<<<<<<<<<<<<<<BtnPlay %d", b); // mediaPlayerState->setPlaying(b); @@ -848,3 +838,2 @@ void PlayListWidget::btnPlay(bool b) { { - qDebug("1"); // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 @@ -861,3 +850,2 @@ void PlayListWidget::btnPlay(bool b) { { - qDebug("2"); // d->selectedFiles->unSelect(); @@ -873,3 +861,2 @@ void PlayListWidget::btnPlay(bool b) { { - qDebug("3"); @@ -924,3 +911,2 @@ void PlayListWidget::playSelected() { - qDebug("playSelected"); btnPlay( true); @@ -951,3 +937,3 @@ void PlayListWidget::listDelete() { cfg.setGroup("PlayList"); - QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); + currentPlayList = cfg.readEntry("CurrentPlaylist",""); QString file; @@ -1075,3 +1061,2 @@ void PlayListWidget::populateVideoView() { void PlayListWidget::openFile() { - qDebug("<<<<<<<<<OPEN File"); QString filename, name; @@ -1082,4 +1067,3 @@ void PlayListWidget::openFile() { filename = fileDlg->text(); - qDebug( "Selected filename is " + filename ); -// Om3u *m3uList; + // qDebug( "Selected filename is " + filename ); DocLnk lnk; @@ -1093,3 +1077,2 @@ void PlayListWidget::openFile() { -// m3uFile = filename.left( filename.find( ":",8,TRUE)); m3uFile = filename; @@ -1099,11 +1082,3 @@ void PlayListWidget::openFile() { filename = m3uFile; -// qDebug("1 "+m3uFile); -// } else if(filename.left(4) == "http"){ -// m3uFile=filename; -// m3uFile = m3uFile.right( m3uFile.length() - 7); -// qDebug("2 "+m3uFile); -// } else{ -// m3uFile=filename; -// qDebug("3 "+m3uFile); - } + = } lnk.setName( m3uFile ); //sets name @@ -1123,2 +1098,3 @@ void PlayListWidget::openFile() { d->selectedFiles->addToSelection( lnk); + lnk.removeLinkFile(); writeCurrentM3u(); @@ -1136,3 +1112,3 @@ reads m3u and shows files/urls to playlist widget */ void PlayListWidget::readm3u( const QString &filename ) { - qDebug( "read m3u filename " + filename ); + // qDebug( "read m3u filename " + filename ); @@ -1193,3 +1169,3 @@ void PlayListWidget::readPls( const QString &filename ) { - qDebug( "pls filename is " + filename ); + // qDebug( "pls filename is " + filename ); Om3u *m3uList; @@ -1236,8 +1212,8 @@ void PlayListWidget::readPls( const QString &filename ) { void PlayListWidget::writeCurrentM3u() { - qDebug("writing to current m3u"); + // qDebug("writing to current m3u"); Config cfg( "OpiePlayer" ); cfg.setGroup("PlayList"); - QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); + currentPlayList = cfg.readEntry("CurrentPlaylist",""); Om3u *m3uList; - m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); + m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); @@ -1245,3 +1221,3 @@ void PlayListWidget::writeCurrentM3u() { do { - qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); + // qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); m3uList->add( d->selectedFiles->current()->file() ); @@ -1249,3 +1225,3 @@ void PlayListWidget::writeCurrentM3u() { while ( d->selectedFiles->next() ); - qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); + // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); m3uList->write(); @@ -1306,3 +1282,3 @@ void PlayListWidget::writem3u() { if(!lnk.writeLink()) { - qDebug("Writing doclink did not work"); + // qDebug("Writing doclink did not work"); } @@ -1336,3 +1312,2 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) case Key_Q: //add to playlist - qDebug("Add"); addSelected(); @@ -1347,3 +1322,2 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) case Key_Space: - qDebug("Play"); // playSelected(); puh @@ -1400,3 +1374,3 @@ void PlayListWidget::keyPressEvent( QKeyEvent *) void PlayListWidget::doBlank() { - qDebug("do blanking"); + // qDebug("do blanking"); fd=open("/dev/fb0",O_RDWR); @@ -1412,3 +1386,3 @@ void PlayListWidget::doUnblank() { // fd=open("/dev/fb0",O_RDWR); - qDebug("do unblanking"); + // qDebug("do unblanking"); if (fd != -1) { @@ -1463,3 +1437,3 @@ void PlayListWidget::skinsMenuActivated( int item ) { void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { - qDebug("qcop message "+msg ); + // qDebug("qcop message "+msg ); QDataStream stream ( data, IO_ReadOnly ); @@ -1500,3 +1474,2 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { stream >> file; - } else if ( msg == "setDocument(QString)" ) { //loop or not loop @@ -1504,3 +1477,2 @@ void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { } - } |