author | harlekin <harlekin> | 2003-06-18 20:19:16 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-06-18 20:19:16 (UTC) |
commit | 9bfda722eeba2f5861393e9f5f41170fab502da8 (patch) (side-by-side diff) | |
tree | eb01205e55bfe4f59d48d4c45b60013f1bd434ee | |
parent | db7c5730e22188f365eb9d52aed961066fbda026 (diff) | |
download | opie-9bfda722eeba2f5861393e9f5f41170fab502da8.zip opie-9bfda722eeba2f5861393e9f5f41170fab502da8.tar.gz opie-9bfda722eeba2f5861393e9f5f41170fab502da8.tar.bz2 |
separate Add URL from Add file
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.cpp | 69 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.h | 35 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 80 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 |
4 files changed, 139 insertions, 48 deletions
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index 2c4be1b..ebde9c6 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp @@ -1,69 +1,74 @@ +/* + This file is part of the Opie Project + + Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + + #include "inputDialog.h" #include <qpe/resource.h> #include <qpe/qpeapplication.h> -#include <qpe/config.h> -#include <opie/ofiledialog.h> #include <qfileinfo.h> #include <qlineedit.h> #include <qlayout.h> #include <qvariant.h> #include <qpushbutton.h> #include <qwhatsthis.h> InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) { setName( "InputDialog" ); } resize( 234, 115); setMaximumSize( QSize( 240, 40)); setCaption( tr( name ) ); QPushButton *browserButton; - browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); - browserButton->setGeometry( QRect( 205, 10, 22, 22)); - connect( browserButton, SIGNAL(released()),this,SLOT(browse())); + //browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); + //browserButton->setGeometry( QRect( 205, 10, 22, 22)); + //connect( browserButton, SIGNAL(released()),this,SLOT(browse())); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); LineEdit1->setFocus(); } /* * return the current text(input) */ QString InputDialog::text() const { - return LineEdit1->text(); + return LineEdit1->text(); } /* * Destroys the object and frees any allocated resources */ InputDialog::~InputDialog() { } -void InputDialog::browse() { - Config cfg( "OpiePlayer" ); - cfg.setGroup("Dialog"); - MimeTypes types; - QStringList audio, video, all; - audio << "audio/*"; - audio << "playlist/plain"; - audio << "audio/x-mpegurl"; - - video << "video/*"; - video << "playlist/plain"; - - all += audio; - all += video; - types.insert("All Media Files", all ); - types.insert("Audio", audio ); - types.insert("Video", video ); - - QString str = OFileDialog::getOpenFileName( 1, - cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", - types, 0 ); - if(str.left(2) == "//") str=str.right(str.length()-1); - LineEdit1->setText(str); - cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); -} - diff --git a/noncore/multimedia/opieplayer2/inputDialog.h b/noncore/multimedia/opieplayer2/inputDialog.h index 0f36ea4..f64f6d4 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.h +++ b/noncore/multimedia/opieplayer2/inputDialog.h @@ -1,25 +1,56 @@ +/* + This file is part of the Opie Project + + Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 L. Potter <ljp@llornkcor.com> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + + #ifndef INPUTDIALOG_H #define INPUTDIALOG_H #include <qvariant.h> #include <qdialog.h> class QLineEdit; class InputDialog : public QDialog { Q_OBJECT public: InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~InputDialog(); QString text()const; private: QLineEdit* LineEdit1; -protected slots: - void browse(); }; #endif // INPUTDIALOG_H diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c91a565..4e31670 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -1,121 +1,126 @@ /* This file is part of the Opie Project - Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qpe/qpetoolbar.h> #include <qpe/qpeapplication.h> #include <qpe/storage.h> #include <qpe/mimetype.h> #include <qpe/global.h> #include <qpe/resource.h> +#include <qpe/config.h> + +#include <opie/ofiledialog.h> #include <qdatetime.h> #include <qdir.h> #include <qmessagebox.h> #include <qregexp.h> #include <qtextstream.h> #include "playlistselection.h" #include "playlistwidget.h" #include "mediaplayerstate.h" #include "inputDialog.h" #include "om3u.h" #include "playlistfileview.h" //only needed for the random play #include <stdlib.h> #include <assert.h> PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) : PlayListWidgetGui( mediaPlayerState, parent, name ) , currentFileListView( 0 ) { d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", this , SLOT(addSelected() ) ); d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", this , SLOT(removeSelected() ) ); d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", this , SLOT( btnPlay( bool) ), TRUE ); d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); pmPlayList->insertSeparator(-1); // (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), // this, SLOT( saveList() ) ); (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), this, SLOT(writem3u() ) ); pmPlayList->insertSeparator(-1); - (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), + (void)new MenuItem( pmPlayList, tr( "Add File" ), this,SLOT( openFile() ) ); + (void)new MenuItem( pmPlayList, tr("Add URL"), + this,SLOT( openURL() ) ); pmPlayList->insertSeparator(-1); (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), audioView, SLOT( scanFiles() ) ); (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), videoView, SLOT( scanFiles() ) ); pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), &mediaPlayerState, SLOT( toggleFullscreen() ) ); Config cfg( "OpiePlayer" ); bool b= cfg.readBoolEntry("FullScreen", 0); mediaPlayerState.setFullscreen( b ); pmView->setItemChecked( -16, b ); (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp() ) ); (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected() ) ); (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown() ) ); // QVBox *stretch2 = new QVBox( vbox1 ); connect( tbDeletePlaylist, ( SIGNAL( released() ) ), SLOT( deletePlaylist() ) ); connect( pmView, SIGNAL( activated( int ) ), this, SLOT( pmViewActivated( int ) ) ); connect( skinsMenu, SIGNAL( activated( int ) ) , this, SLOT( skinsMenuActivated( int ) ) ); connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); @@ -298,75 +303,75 @@ void PlayListWidget::addAllMusicToList() { d->selectedFiles->addToSelection( lnk); } 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); } 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 + if( extension.find( "m3u", 0, false) != -1 || extension.find( "pls", 0, false) != -1 ) { readListFromFile( fileref ); } else { clearList(); DocLnk lnk; lnk.setName( fileInfo.baseName() ); //sets name lnk.setFile( fileref ); //sets file name addToSelection( lnk ); writeCurrentM3u(); d->setDocumentUsed = TRUE; mediaPlayerState.setPlaying( FALSE ); mediaPlayerState.setPlaying( TRUE ); } } void PlayListWidget::useSelectedDocument() { d->setDocumentUsed = FALSE; } const DocLnk *PlayListWidget::current() const { // this is fugly assert( currentTab() == CurrentPlayList ); const DocLnk *lnk = d->selectedFiles->current(); if ( !lnk ) { d->selectedFiles->first(); lnk = d->selectedFiles->current(); } assert( lnk ); return lnk; @@ -573,139 +578,188 @@ void PlayListWidget::tabChanged(QWidget *) { void PlayListWidget::btnPlay(bool b) { // mediaPlayerState->setPlaying(false); mediaPlayerState.setPlaying(b); insanityBool=FALSE; } void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), (tr("You really want to delete\nthis playlist?")), (tr("Yes")), (tr("No")), 0 )){ case 0: // Yes clicked, QFile().remove(playLists->selectedDocument().file()); QFile().remove(playLists->selectedDocument().linkFile()); playLists->reread(); break; case 1: // Cancel break; }; } void PlayListWidget::playSelected() { btnPlay( TRUE); } 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 +void PlayListWidget::openURL() { + // http://66.28.164.33:2080 + // http://somafm.com/star0242.m3u QString filename, name; InputDialog *fileDlg; - fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); + fileDlg = new InputDialog(this,tr("Add 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; } 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 ); } 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::openFile() { + + QString filename, name; + + Config cfg( "OpiePlayer" ); + cfg.setGroup("Dialog"); + MimeTypes types; + QStringList audio, video, all; + audio << "audio/*"; + audio << "playlist/plain"; + audio << "audio/x-mpegurl"; + + video << "video/*"; + video << "playlist/plain"; + + all += audio; + all += video; + types.insert("All Media Files", all ); + types.insert("Audio", audio ); + types.insert("Video", video ); + + QString str = OFileDialog::getOpenFileName( 1, + cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", + types, 0 ); + if(str.left(2) == "//") str=str.right(str.length()-1); + cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); + + + if( !str.isEmpty() ) { + qDebug( "Selected filename is " + str ); + filename = str; + DocLnk lnk; + Config cfg( "OpiePlayer" ); + cfg.setGroup("PlayList"); + + if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { + readListFromFile( 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()); + } + } +} + + 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(); DocLnk lnk; for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { s = *it; // 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->close(); delete m3uList; d->selectedFiles->setSelectedItem( s); setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); } // 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()) { @@ -715,65 +769,65 @@ void PlayListWidget::readListFromFile( const QString &filename ) { m3uList->add( d->selectedFiles->current()->file() ); } while ( d->selectedFiles->next() ); // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); m3uList->write(); m3uList->close(); } delete m3uList; } /* writes current playlist to m3u file */ void PlayListWidget::writem3u() { InputDialog *fileDlg; fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); fileDlg->exec(); QString name, filename, list; Om3u *m3uList; if( fileDlg->result() == 1 ) { name = fileDlg->text(); // qDebug( filename ); if( name.find("/",0,true) != -1) {// assume they specify a file path filename = name; name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); } else //otherwise dump it somewhere noticable filename = QPEApplication::documentDir() + "/" + name; if( filename.right( 3 ) != "m3u" ) //needs filename extension filename += ".m3u"; - + if( d->selectedFiles->first()) { //ramble through playlist view m3uList = new Om3u( filename, IO_ReadWrite | IO_Truncate); do { m3uList->add( d->selectedFiles->current()->file()); } while ( d->selectedFiles->next() ); // qDebug( list ); m3uList->write(); m3uList->close(); delete m3uList; delete fileDlg; DocLnk lnk; lnk.setFile( filename); lnk.setIcon("opieplayer2/playlist2"); lnk.setName( name); //sets file name // qDebug(filename); Config config( "OpiePlayer" ); config.setGroup( "PlayList" ); config.writeEntry("CurrentPlaylist",filename); currentPlayList=filename; if(!lnk.writeLink()) { qDebug("Writing doclink did not work"); } setCaption(tr("OpiePlayer: ") + name); } @@ -902,64 +956,64 @@ PlayListWidget::TabType PlayListWidget::currentTab() const int index = tabWidget->currentPageIndex(); assert( index < TabTypeCount && index >= 0 ); return indexToTabType[ index ]; } PlayListWidget::Entry PlayListWidget::currentEntry() const { if ( currentTab() == CurrentPlayList ) { const DocLnk *lnk = current(); return Entry( lnk->name(), lnk->file() ); } return Entry( currentFileListPathName() ); } QString PlayListWidget::currentFileListPathName() const { return currentFileListView->currentItem()->text( 3 ); } void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { qDebug("qcop message "+msg ); QDataStream stream ( data, IO_ReadOnly ); if ( msg == "play()" ) { //plays current selection btnPlay( true); } else if ( msg == "stop()" ) { mediaPlayerState.setPlaying( false); } else if ( msg == "togglePause()" ) { mediaPlayerState.togglePaused(); } else if ( msg == "next()" ) { //select next in list - mediaPlayerState.setNext(); + mediaPlayerState.setNext(); } else if ( msg == "prev()" ) { //select previous in list - mediaPlayerState.setPrev(); + mediaPlayerState.setPrev(); } else if ( msg == "toggleLooping()" ) { //loop or not loop mediaPlayerState.toggleLooping(); } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled mediaPlayerState.toggleShuffled(); } else if ( msg == "volUp()" ) { //volume more // emit moreClicked(); // emit moreReleased(); } else if ( msg == "volDown()" ) { //volume less // emit lessClicked(); // emit lessReleased(); } else if ( msg == "play(QString)" ) { //play this now QString file; stream >> file; setDocument( (const QString &) file); } else if ( msg == "add(QString)" ) { //add to playlist QString file; stream >> file; QFileInfo fileInfo(file); DocLnk lnk; lnk.setName( fileInfo.baseName() ); //sets name lnk.setFile( file ); //sets file name addToSelection( lnk ); } else if ( msg == "rem(QString)" ) { //remove from playlist QString file; stream >> file; } - + } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 54e9d16..5230b03 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h @@ -1,36 +1,36 @@ /* This file is part of the Opie Project - Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 L. Potter <ljp@llornkcor.com> Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef PLAY_LIST_WIDGET_H #define PLAY_LIST_WIDGET_H @@ -82,61 +82,62 @@ public: public slots: bool first(); bool last(); bool next(); bool prev(); void writeDefaultPlaylist( ); QString currentFileListPathName() const; protected: QCopChannel * channel; void keyReleaseEvent( QKeyEvent *e); signals: void skinSelected(); private: int defaultSkinIndex; /* void readm3u(const QString &); */ /* void readPls(const QString &); */ void readListFromFile(const QString &); void initializeStates(); bool inFileListMode() const; private slots: void qcopReceive(const QCString&, const QByteArray&); void populateSkinsMenu(); void skinsMenuActivated(int); void pmViewActivated(int); void writem3u(); void writeCurrentM3u(); void openFile(); + void openURL(); void setDocument( const QString& fileref ); void addToSelection( const DocLnk& ); // Add a media file to the playlist void addToSelection( QListViewItem* ); // Add a media file to the playlist void clearList(); void addAllToList(); void addAllMusicToList(); void addAllVideoToList(); void saveList(); // Save the playlist void loadList( const DocLnk &); // Load a playlist void playIt( QListViewItem *); void btnPlay(bool); void deletePlaylist(); void addSelected(); void removeSelected(); void tabChanged(QWidget*); void viewPressed( int, QListViewItem *, const QPoint&, int); void playlistViewPressed( int, QListViewItem *, const QPoint&, int); void playSelected(); private: bool fromSetDocument; bool insanityBool; QString setDocFileRef, currentPlayList; int selected; QListView *currentFileListView; }; #endif // PLAY_LIST_WIDGET_H |