summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp98
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
@@ -22,40 +22,42 @@
22 22
23#include <qpe/qpemenubar.h> 23#include <qpe/qpemenubar.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/fileselector.h> 25#include <qpe/fileselector.h>
26#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
27#include <qpe/lnkproperties.h> 27#include <qpe/lnkproperties.h>
28#include <qpe/storage.h> 28#include <qpe/storage.h>
29 29
30#include <qpe/applnk.h> 30#include <qpe/applnk.h>
31#include <qpe/config.h> 31#include <qpe/config.h>
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>
36#include <qfile.h> 37#include <qfile.h>
37#include <qdir.h> 38#include <qdir.h>
38#include <qlayout.h> 39#include <qlayout.h>
39#include <qlabel.h> 40#include <qlabel.h>
40#include <qlist.h> 41#include <qlist.h>
41#include <qlistbox.h> 42#include <qlistbox.h>
42#include <qmainwindow.h> 43#include <qmainwindow.h>
43#include <qmessagebox.h> 44#include <qmessagebox.h>
44#include <qtoolbutton.h> 45#include <qtoolbutton.h>
45#include <qtabwidget.h> 46#include <qtabwidget.h>
46#include <qlistview.h> 47#include <qlistview.h>
47#include <qpoint.h> 48#include <qpoint.h>
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>
52 54
53#include "playlistselection.h" 55#include "playlistselection.h"
54#include "playlistwidget.h" 56#include "playlistwidget.h"
55#include "mediaplayerstate.h" 57#include "mediaplayerstate.h"
56 58
57#include "inputDialog.h" 59#include "inputDialog.h"
58 60
59#include <stdlib.h> 61#include <stdlib.h>
60 62
61#define BUTTONS_ON_TOOLBAR 63#define BUTTONS_ON_TOOLBAR
@@ -108,76 +110,76 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
108 110
109 d = new PlayListWidgetPrivate; 111 d = new PlayListWidgetPrivate;
110 d->setDocumentUsed = FALSE; 112 d->setDocumentUsed = FALSE;
111 d->current = NULL; 113 d->current = NULL;
112 fromSetDocument = FALSE; 114 fromSetDocument = FALSE;
113 insanityBool=FALSE; 115 insanityBool=FALSE;
114// menuTimer = new QTimer( this ,"menu timer"), 116// menuTimer = new QTimer( this ,"menu timer"),
115// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); 117// connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) );
116 118
117 setBackgroundMode( PaletteButton ); 119 setBackgroundMode( PaletteButton );
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 );
123 125
124 // Create Toolbar 126 // Create Toolbar
125 QPEToolBar *toolbar = new QPEToolBar( this ); 127 QPEToolBar *toolbar = new QPEToolBar( this );
126 toolbar->setHorizontalStretchable( TRUE ); 128 toolbar->setHorizontalStretchable( TRUE );
127 129
128 // Create Menubar 130 // Create Menubar
129 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 131 QPEMenuBar *menu = new QPEMenuBar( toolbar );
130 menu->setMargin( 0 ); 132 menu->setMargin( 0 );
131 133
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");
137 tbDeletePlaylist->setFlat(TRUE); 139 tbDeletePlaylist->setFlat(TRUE);
138 tbDeletePlaylist->setFixedSize(20,20); 140 tbDeletePlaylist->setFixedSize(20,20);
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();
153 155
154 QPopupMenu *pmPlayList = new QPopupMenu( this ); 156 QPopupMenu *pmPlayList = new QPopupMenu( this );
155 menu->insertItem( tr( "File" ), pmPlayList ); 157 menu->insertItem( tr( "File" ), pmPlayList );
156 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 158 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
157 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 159 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
158 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 160 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
159 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 161 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
160// pmPlayList->insertSeparator(-1); 162// pmPlayList->insertSeparator(-1);
161 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 163 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
162 pmPlayList->insertSeparator(-1); 164 pmPlayList->insertSeparator(-1);
163 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 165 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
164 166
165 QPopupMenu *pmView = new QPopupMenu( this ); 167 QPopupMenu *pmView = new QPopupMenu( this );
166 menu->insertItem( tr( "View" ), pmView ); 168 menu->insertItem( tr( "View" ), pmView );
167 169
168 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); 170 fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
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);
174 176
175 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 177 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
176 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 178 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
177 179
178 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 180 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
179 181
180 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 182 tabWidget = new QTabWidget( hbox6, "tabWidget" );
181 tabWidget->setTabShape(QTabWidget::Triangular); 183 tabWidget->setTabShape(QTabWidget::Triangular);
182 184
183 QWidget *pTab; 185 QWidget *pTab;
@@ -195,27 +197,27 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
195 197
196 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 198 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
197 199
198 d->selectedFiles = new PlayListSelection( hbox2); 200 d->selectedFiles = new PlayListSelection( hbox2);
199 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 201 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
200 202
201 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 203 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
202 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 204 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
203 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 205 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
204 206
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
212 QWidget *aTab; 214 QWidget *aTab;
213 aTab = new QWidget( tabWidget, "aTab" ); 215 aTab = new QWidget( tabWidget, "aTab" );
214 audioView = new QListView( aTab, "Audioview" ); 216 audioView = new QListView( aTab, "Audioview" );
215 audioView->setMinimumSize(233,260); 217 audioView->setMinimumSize(233,260);
216 audioView->addColumn( tr("Title"),140); 218 audioView->addColumn( tr("Title"),140);
217 audioView->addColumn(tr("Size"), -1); 219 audioView->addColumn(tr("Size"), -1);
218 audioView->addColumn(tr("Media"),-1); 220 audioView->addColumn(tr("Media"),-1);
219 audioView->setColumnAlignment(1, Qt::AlignRight); 221 audioView->setColumnAlignment(1, Qt::AlignRight);
220 audioView->setColumnAlignment(2, Qt::AlignRight); 222 audioView->setColumnAlignment(2, Qt::AlignRight);
221 audioView->setAllColumnsShowFocus(TRUE); 223 audioView->setAllColumnsShowFocus(TRUE);
@@ -420,32 +422,33 @@ void PlayListWidget::addAllVideoToList() {
420 d->selectedFiles->addToSelection( **dit ); 422 d->selectedFiles->addToSelection( **dit );
421} 423}
422 424
423 425
424void PlayListWidget::setDocument(const QString& fileref) { 426void PlayListWidget::setDocument(const QString& fileref) {
425 qDebug(fileref); 427 qDebug(fileref);
426 fromSetDocument = TRUE; 428 fromSetDocument = TRUE;
427 if ( fileref.isNull() ) { 429 if ( fileref.isNull() ) {
428 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 430 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
429 return; 431 return;
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));
442 d->selectedFiles->first(); 445 d->selectedFiles->first();
443 } else { 446 } else {
444 clearList(); 447 clearList();
445 addToSelection( DocLnk( fileref ) ); 448 addToSelection( DocLnk( fileref ) );
446 d->setDocumentUsed = TRUE; 449 d->setDocumentUsed = TRUE;
447 mediaPlayerState->setPlaying( FALSE ); 450 mediaPlayerState->setPlaying( FALSE );
448 qApp->processEvents(); 451 qApp->processEvents();
449 mediaPlayerState->setPlaying( TRUE ); 452 mediaPlayerState->setPlaying( TRUE );
450 qApp->processEvents(); 453 qApp->processEvents();
451 setCaption(tr("OpiePlayer")); 454 setCaption(tr("OpiePlayer"));
@@ -610,25 +613,25 @@ void PlayListWidget::saveList() {
610// if( playLists->selected()->name() == filename) { 613// if( playLists->selected()->name() == filename) {
611 614
612// qDebug("same name so delete lnk"); 615// qDebug("same name so delete lnk");
613// QFile().remove(playLists->selected()->file()); 616// QFile().remove(playLists->selected()->file());
614// QFile().remove(playLists->selected()->linkFile()); 617// QFile().remove(playLists->selected()->linkFile());
615// playLists->reread(); 618// playLists->reread();
616// } 619// }
617// qDebug("new doclnk"); 620// qDebug("new doclnk");
618 DocLnk lnk; 621 DocLnk lnk;
619// lnk.setComment( ""); 622// lnk.setComment( "");
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);
625 if(!lnk.writeLink()) 628 if(!lnk.writeLink())
626 qDebug("Writing doclink did not work"); 629 qDebug("Writing doclink did not work");
627 } 630 }
628 Config config( "OpiePlayer" ); 631 Config config( "OpiePlayer" );
629 config.writeEntry("CurrentPlaylist",filename); 632 config.writeEntry("CurrentPlaylist",filename);
630 setCaption(tr("OpiePlayer: ")+filename); 633 setCaption(tr("OpiePlayer: ")+filename);
631 d->selectedFiles->first(); 634 d->selectedFiles->first();
632 if(fileDlg) 635 if(fileDlg)
633 delete fileDlg; 636 delete fileDlg;
634} 637}
@@ -937,67 +940,82 @@ void PlayListWidget::populateAudioView() {
937 audioView->clear(); 940 audioView->clear();
938 QString storage; 941 QString storage;
939 for ( ; dit.current(); ++dit ) { 942 for ( ; dit.current(); ++dit ) {
940 for( ; it.current(); ++it ){ 943 for( ; it.current(); ++it ){
941 const QString name = (*it)->name(); 944 const QString name = (*it)->name();
942 const QString path = (*it)->path(); 945 const QString path = (*it)->path();
943 if(dit.current()->file().find(path) != -1 ) storage=name; 946 if(dit.current()->file().find(path) != -1 ) storage=name;
944 } 947 }
945 948
946 QListViewItem * newItem; 949 QListViewItem * newItem;
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 }
952} 955}
953 956
954void PlayListWidget::populateVideoView() { 957void PlayListWidget::populateVideoView() {
955 StorageInfo storageInfo; 958 StorageInfo storageInfo;
956 const QList<FileSystem> &fs = storageInfo.fileSystems(); 959 const QList<FileSystem> &fs = storageInfo.fileSystems();
957 960
958 Global::findDocuments(&vFiles, "video/*"); 961 Global::findDocuments(&vFiles, "video/*");
959 QListIterator<DocLnk> Vdit( vFiles.children() ); 962 QListIterator<DocLnk> Vdit( vFiles.children() );
960 QListIterator<FileSystem> it ( fs ); 963 QListIterator<FileSystem> it ( fs );
961 videoView->clear(); 964 videoView->clear();
962 QString storage; 965 QString storage;
963 for ( ; Vdit.current(); ++Vdit ) { 966 for ( ; Vdit.current(); ++Vdit ) {
964 for( ; it.current(); ++it ){ 967 for( ; it.current(); ++it ){
965 const QString name = (*it)->name(); 968 const QString name = (*it)->name();
966 const QString path = (*it)->path(); 969 const QString path = (*it)->path();
967 if( Vdit.current()->file().find(path) != -1 ) storage=name; 970 if( Vdit.current()->file().find(path) != -1 ) storage=name;
968 } 971 }
969 972
970 QListViewItem * newItem; 973 QListViewItem * newItem;
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 }
976} 979}
977 980
978void PlayListWidget::openFile() { 981void 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);
982 fileDlg->exec(); 985 fileDlg->exec();
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}