author | llornkcor <llornkcor> | 2002-04-20 23:28:58 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-20 23:28:58 (UTC) |
commit | 7ae1d2a136454122b28c50df2f7807a4780d507c (patch) (unidiff) | |
tree | fbc1cf37200a05d004c0a3595bd6391ed6e5f001 /core | |
parent | e657b8203c7b649fd3df96afbe7f8b1d24b5b8ed (diff) | |
download | opie-7ae1d2a136454122b28c50df2f7807a4780d507c.zip opie-7ae1d2a136454122b28c50df2f7807a4780d507c.tar.gz opie-7ae1d2a136454122b28c50df2f7807a4780d507c.tar.bz2 |
url stuff
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 98 |
1 files changed, 58 insertions, 40 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 218fd49..250645c 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -32,4 +32,5 @@ | |||
32 | #include <qpe/global.h> | 32 | #include <qpe/global.h> |
33 | #include <qpe/resource.h> | 33 | #include <qpe/resource.h> |
34 | |||
34 | #include <qaction.h> | 35 | #include <qaction.h> |
35 | #include <qimage.h> | 36 | #include <qimage.h> |
@@ -48,4 +49,5 @@ | |||
48 | #include <qlineedit.h> | 49 | #include <qlineedit.h> |
49 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
51 | #include <qregexp.h> | ||
50 | 52 | ||
51 | //#include <qtimer.h> | 53 | //#include <qtimer.h> |
@@ -118,5 +120,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
118 | 120 | ||
119 | setCaption( tr("OpiePlayer") ); | 121 | setCaption( tr("OpiePlayer") ); |
120 | setIcon( Resource::loadPixmap( "MPEGPlayer" ) ); | 122 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); |
121 | 123 | ||
122 | setToolBarsMovable( FALSE ); | 124 | setToolBarsMovable( FALSE ); |
@@ -132,5 +134,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
132 | QPEToolBar *bar = new QPEToolBar( this ); | 134 | QPEToolBar *bar = new QPEToolBar( this ); |
133 | bar->setLabel( tr( "Play Operations" ) ); | 135 | bar->setLabel( tr( "Play Operations" ) ); |
134 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "mpegplayer/play_current_list", | 136 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
135 | // this , SLOT( addSelected()) ); | 137 | // this , SLOT( addSelected()) ); |
136 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 138 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
@@ -139,14 +141,14 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
139 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 141 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
140 | 142 | ||
141 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "mpegplayer/add_to_playlist", | 143 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
142 | this , SLOT(addSelected()) ); | 144 | this , SLOT(addSelected()) ); |
143 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "mpegplayer/remove_from_playlist", | 145 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
144 | this , SLOT(removeSelected()) ); | 146 | this , SLOT(removeSelected()) ); |
145 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | 147 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); |
146 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play", | 148 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
147 | this , SLOT( btnPlay(bool) ), TRUE ); | 149 | this , SLOT( btnPlay(bool) ), TRUE ); |
148 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle", | 150 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
149 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 151 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
150 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop", | 152 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
151 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 153 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
152 | tbDeletePlaylist->hide(); | 154 | tbDeletePlaylist->hide(); |
@@ -169,5 +171,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
169 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 171 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
170 | fullScreenButton->addTo(pmView); | 172 | fullScreenButton->addTo(pmView); |
171 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0); | 173 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); |
172 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 174 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
173 | scaleButton->addTo(pmView); | 175 | scaleButton->addTo(pmView); |
@@ -205,7 +207,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
205 | 207 | ||
206 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 208 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
207 | new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 209 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
208 | new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 210 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
209 | new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 211 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
210 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 212 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
211 | 213 | ||
@@ -430,12 +432,13 @@ void PlayListWidget::setDocument(const QString& fileref) { | |||
430 | } | 432 | } |
431 | // qDebug("setDocument "+fileref); | 433 | // qDebug("setDocument "+fileref); |
432 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 434 | // if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
433 | clearList(); | 435 | // clearList(); |
434 | addToSelection( DocLnk( fileref ) ); | 436 | // addToSelection( DocLnk( fileref ) ); |
435 | d->setDocumentUsed = TRUE; | 437 | // d->setDocumentUsed = TRUE; |
436 | d->selectedFiles->first(); | 438 | // d->selectedFiles->first(); |
437 | qApp->processEvents(); | 439 | // qApp->processEvents(); |
438 | } | 440 | // } |
439 | else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | 441 | // else |
442 | if(fileref.find("playlist",0,TRUE) != -1) {//is playlist | ||
440 | clearList(); | 443 | clearList(); |
441 | loadList(DocLnk(fileref)); | 444 | loadList(DocLnk(fileref)); |
@@ -620,5 +623,5 @@ void PlayListWidget::saveList() { | |||
620 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 623 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
621 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 624 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
622 | lnk.setIcon("mpegplayer/playlist2"); | 625 | lnk.setIcon("opieplayer/playlist2"); |
623 | lnk.setName( filename); //sets file name | 626 | lnk.setName( filename); //sets file name |
624 | // qDebug(filename); | 627 | // qDebug(filename); |
@@ -947,5 +950,5 @@ void PlayListWidget::populateAudioView() { | |||
947 | if ( QFile( dit.current()->file()).exists() ) { | 950 | if ( QFile( dit.current()->file()).exists() ) { |
948 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 951 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); |
949 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | 952 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
950 | } | 953 | } |
951 | } | 954 | } |
@@ -971,5 +974,5 @@ void PlayListWidget::populateVideoView() { | |||
971 | if ( QFile( Vdit.current()->file()).exists() ) { | 974 | if ( QFile( Vdit.current()->file()).exists() ) { |
972 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 975 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); |
973 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 976 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
974 | } | 977 | } |
975 | } | 978 | } |
@@ -977,5 +980,5 @@ void PlayListWidget::populateVideoView() { | |||
977 | 980 | ||
978 | void PlayListWidget::openFile() { | 981 | void PlayListWidget::openFile() { |
979 | QString filename; | 982 | QString filename, name; |
980 | InputDialog *fileDlg; | 983 | InputDialog *fileDlg; |
981 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 984 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
@@ -983,21 +986,36 @@ void PlayListWidget::openFile() { | |||
983 | if( fileDlg->result() == 1 ) { | 986 | if( fileDlg->result() == 1 ) { |
984 | filename = fileDlg->LineEdit1->text(); | 987 | filename = fileDlg->LineEdit1->text(); |
988 | |||
989 | // InputDialog *fileDlg2; | ||
990 | // fileDlg2 = new InputDialog(this,tr("Name"),TRUE, 0); | ||
991 | // fileDlg2->exec(); | ||
992 | // if( fileDlg2->result() == 1 ) { | ||
993 | // name = fileDlg2->LineEdit1->text(); | ||
994 | // } | ||
995 | //http://205.188.234.129:8030 | ||
996 | qDebug(filename); | ||
997 | DocLnk lnk; | ||
998 | // if(filename.left(7) == "http://") | ||
999 | // name= filename.right(filename.length()-filename.find("http://")-7); | ||
1000 | // else name = filename; | ||
1001 | // qDebug("name is "+name); | ||
1002 | // lnk.setComment(filename); | ||
1003 | lnk.setName(filename); //sets file name | ||
1004 | if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") | ||
1005 | filename += "/"; | ||
1006 | lnk.setFile(filename); //sets File property | ||
1007 | |||
1008 | lnk.setType("audio/x-mpegurl"); | ||
1009 | lnk.setExec("opieplayer"); | ||
1010 | lnk.setIcon("opieplayer/MPEGPlayer"); | ||
1011 | |||
1012 | if(!lnk.writeLink()) | ||
1013 | qDebug("Writing doclink did not work"); | ||
1014 | d->selectedFiles->addToSelection( lnk); | ||
1015 | // if(fileDlg2) | ||
1016 | // delete fileDlg2; | ||
985 | } | 1017 | } |
986 | qDebug(filename); | 1018 | |
987 | DocLnk lnk; | ||
988 | QString name = filename.right(filename.length()-filename.find("http://")-7); | ||
989 | qDebug(name); | ||
990 | lnk.setName( name); //sets file name | ||
991 | // lnk.setComment(); | ||
992 | lnk.setFile(filename); //sets File property | ||
993 | // problem is, the launcher sees this as a broken link and does not display it :( | ||
994 | lnk.setType("audio/x-mpegurl"); | ||
995 | lnk.setExec("opieplayer"); | ||
996 | lnk.setIcon("opieplayer/MPEGPlayer"); | ||
997 | |||
998 | if(!lnk.writeLink()) | ||
999 | qDebug("Writing doclink did not work"); | ||
1000 | d->selectedFiles->addToSelection( lnk); | ||
1001 | if(fileDlg) | 1019 | if(fileDlg) |
1002 | delete fileDlg; | 1020 | delete fileDlg; |
1003 | } | 1021 | } |