author | llornkcor <llornkcor> | 2002-10-08 21:32:13 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-08 21:32:13 (UTC) |
commit | ca0c224318a50c6618691fb30f39aa1d9b0b8a4f (patch) (unidiff) | |
tree | 961917745cbb5bccf220735b9b62705d4651ffe7 | |
parent | 9fdf7460f752f979497ee743ba67ddba52c1a7d7 (diff) | |
download | opie-ca0c224318a50c6618691fb30f39aa1d9b0b8a4f.zip opie-ca0c224318a50c6618691fb30f39aa1d9b0b8a4f.tar.gz opie-ca0c224318a50c6618691fb30f39aa1d9b0b8a4f.tar.bz2 |
fix addAll* from menu
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c0d3108..d53c423 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -36,48 +36,50 @@ | |||
36 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
37 | #include <qpe/mimetype.h> | 37 | #include <qpe/mimetype.h> |
38 | #include <qpe/global.h> | 38 | #include <qpe/global.h> |
39 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
40 | 40 | ||
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include <qmessagebox.h> | 42 | #include <qmessagebox.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qtextstream.h> | 44 | #include <qtextstream.h> |
45 | 45 | ||
46 | #include "playlistselection.h" | 46 | #include "playlistselection.h" |
47 | #include "playlistwidget.h" | 47 | #include "playlistwidget.h" |
48 | #include "mediaplayerstate.h" | 48 | #include "mediaplayerstate.h" |
49 | #include "inputDialog.h" | 49 | #include "inputDialog.h" |
50 | #include "om3u.h" | 50 | #include "om3u.h" |
51 | 51 | ||
52 | //only needed for the random play | 52 | //only needed for the random play |
53 | #include <stdlib.h> | 53 | #include <stdlib.h> |
54 | 54 | ||
55 | #include "audiowidget.h" | 55 | #include "audiowidget.h" |
56 | #include "videowidget.h" | 56 | #include "videowidget.h" |
57 | 57 | ||
58 | extern MediaPlayerState *mediaPlayerState; | 58 | extern MediaPlayerState *mediaPlayerState; |
59 | 59 | ||
60 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; | ||
61 | // no m3u's here please | ||
60 | 62 | ||
61 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 63 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
62 | : PlayListWidgetGui( parent, name, fl ) { | 64 | : PlayListWidgetGui( parent, name, fl ) { |
63 | 65 | ||
64 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 66 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
65 | "opieplayer2/add_to_playlist", | 67 | "opieplayer2/add_to_playlist", |
66 | this , SLOT(addSelected() ) ); | 68 | this , SLOT(addSelected() ) ); |
67 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 69 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
68 | "opieplayer2/remove_from_playlist", | 70 | "opieplayer2/remove_from_playlist", |
69 | this , SLOT(removeSelected() ) ); | 71 | this , SLOT(removeSelected() ) ); |
70 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 72 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
71 | this , SLOT( btnPlay( bool) ), TRUE ); | 73 | this , SLOT( btnPlay( bool) ), TRUE ); |
72 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 74 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
73 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); | 75 | mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); |
74 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 76 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
75 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); | 77 | mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); |
76 | 78 | ||
77 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 79 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
78 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), | 80 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), |
79 | this, SLOT( addAllMusicToList() ) ); | 81 | this, SLOT( addAllMusicToList() ) ); |
80 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), | 82 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), |
81 | this, SLOT( addAllVideoToList() ) ); | 83 | this, SLOT( addAllVideoToList() ) ); |
82 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), | 84 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), |
83 | this, SLOT( addAllToList() ) ); | 85 | this, SLOT( addAllToList() ) ); |
@@ -184,149 +186,155 @@ void PlayListWidget::writeDefaultPlaylist() { | |||
184 | QString currentString = config.readEntry( "CurrentPlaylist", filename); | 186 | QString currentString = config.readEntry( "CurrentPlaylist", filename); |
185 | if( currentString == filename) { | 187 | if( currentString == filename) { |
186 | Om3u *m3uList; | 188 | Om3u *m3uList; |
187 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); | 189 | // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); |
188 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 190 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
189 | d->selectedFiles->first(); | 191 | d->selectedFiles->first(); |
190 | do { | 192 | do { |
191 | // qDebug(d->selectedFiles->current()->file()); | 193 | // qDebug(d->selectedFiles->current()->file()); |
192 | m3uList->add( d->selectedFiles->current()->file() ); | 194 | m3uList->add( d->selectedFiles->current()->file() ); |
193 | } | 195 | } |
194 | while ( d->selectedFiles->next() ); | 196 | while ( d->selectedFiles->next() ); |
195 | 197 | ||
196 | m3uList->write(); | 198 | m3uList->write(); |
197 | m3uList->close(); | 199 | m3uList->close(); |
198 | if(m3uList) delete m3uList; | 200 | if(m3uList) delete m3uList; |
199 | } | 201 | } |
200 | } | 202 | } |
201 | 203 | ||
202 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 204 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
203 | d->setDocumentUsed = FALSE; | 205 | d->setDocumentUsed = FALSE; |
204 | if ( mediaPlayerState->playlist() ) { | 206 | if ( mediaPlayerState->playlist() ) { |
205 | if( QFileInfo( lnk.file() ).exists() || | 207 | if( QFileInfo( lnk.file() ).exists() || |
206 | lnk.file().left(4) == "http" ) | 208 | lnk.file().left(4) == "http" ) |
207 | d->selectedFiles->addToSelection( lnk ); | 209 | d->selectedFiles->addToSelection( lnk ); |
208 | writeCurrentM3u(); | 210 | // writeCurrentM3u(); |
209 | } | 211 | } |
210 | else | 212 | else |
211 | mediaPlayerState->setPlaying( TRUE ); | 213 | mediaPlayerState->setPlaying( TRUE ); |
212 | } | 214 | } |
213 | 215 | ||
214 | 216 | ||
215 | void PlayListWidget::clearList() { | 217 | void PlayListWidget::clearList() { |
216 | while ( first() ) { | 218 | while ( first() ) { |
217 | d->selectedFiles->removeSelected(); | 219 | d->selectedFiles->removeSelected(); |
218 | } | 220 | } |
219 | } | 221 | } |
220 | 222 | ||
221 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 223 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
222 | switch (mouse) { | 224 | switch (mouse) { |
223 | case 1: | 225 | case 1: |
224 | break; | 226 | break; |
225 | case 2: | 227 | case 2: |
226 | { | 228 | { |
227 | QPopupMenu m; | 229 | QPopupMenu m; |
228 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 230 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
229 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 231 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
230 | m.exec( QCursor::pos() ); | 232 | m.exec( QCursor::pos() ); |
231 | } | 233 | } |
232 | break; | 234 | break; |
233 | } | 235 | } |
234 | } | 236 | } |
235 | 237 | ||
236 | 238 | ||
237 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 239 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
238 | switch (mouse) { | 240 | switch (mouse) { |
239 | case 1: | 241 | case 1: |
240 | break; | 242 | break; |
241 | case 2: | 243 | case 2: |
242 | { | 244 | { |
243 | QPopupMenu m; | 245 | QPopupMenu m; |
244 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 246 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
245 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 247 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
246 | m.exec( QCursor::pos() ); | 248 | m.exec( QCursor::pos() ); |
247 | } | 249 | } |
248 | break; | 250 | break; |
249 | } | 251 | } |
250 | } | 252 | } |
251 | 253 | ||
252 | 254 | ||
253 | void PlayListWidget::addAllToList() { | 255 | void PlayListWidget::addAllToList() { |
254 | DocLnkSet filesAll; | 256 | DocLnkSet filesAll; |
255 | Global::findDocuments(&filesAll, "video/*;audio/*"); | 257 | Global::findDocuments(&filesAll, "video/*;"+audioMimes); |
256 | QListIterator<DocLnk> Adit( filesAll.children() ); | 258 | QListIterator<DocLnk> Adit( filesAll.children() ); |
257 | for ( ; Adit.current(); ++Adit ) { | 259 | for ( ; Adit.current(); ++Adit ) { |
258 | if( QFileInfo( Adit.current()->file() ).exists() ) { | 260 | if( QFileInfo( Adit.current()->file() ).exists() ) { |
259 | d->selectedFiles->addToSelection( **Adit ); | 261 | d->selectedFiles->addToSelection( **Adit ); |
260 | } | 262 | } |
261 | } | 263 | } |
262 | writeCurrentM3u(); | 264 | writeCurrentM3u(); |
263 | } | 265 | } |
264 | 266 | ||
265 | 267 | ||
266 | void PlayListWidget::addAllMusicToList() { | 268 | void PlayListWidget::addAllMusicToList() { |
269 | if(!audioScan) | ||
270 | scanForAudio(); | ||
267 | QListIterator<DocLnk> dit( files.children() ); | 271 | QListIterator<DocLnk> dit( files.children() ); |
268 | for ( ; dit.current(); ++dit ) { | 272 | for ( ; dit.current(); ++dit ) { |
269 | if( QFileInfo(dit.current()->file() ).exists() ) { | 273 | if( QFileInfo(dit.current()->file() ).exists() ) { |
270 | d->selectedFiles->addToSelection( **dit ); | 274 | d->selectedFiles->addToSelection( **dit ); |
271 | } | 275 | } |
272 | } | 276 | } |
273 | writeCurrentM3u(); | 277 | writeCurrentM3u(); |
274 | } | 278 | } |
275 | 279 | ||
276 | 280 | ||
277 | void PlayListWidget::addAllVideoToList() { | 281 | void PlayListWidget::addAllVideoToList() { |
282 | if(!videoScan) | ||
283 | scanForVideo(); | ||
278 | QListIterator<DocLnk> dit( vFiles.children() ); | 284 | QListIterator<DocLnk> dit( vFiles.children() ); |
279 | for ( ; dit.current(); ++dit ) { | 285 | for ( ; dit.current(); ++dit ) { |
280 | if( QFileInfo( dit.current()->file() ).exists() ) { | 286 | if( QFileInfo( dit.current()->file() ).exists() ) { |
281 | d->selectedFiles->addToSelection( **dit ); | 287 | d->selectedFiles->addToSelection( **dit ); |
282 | } | 288 | } |
283 | } | 289 | } |
284 | writeCurrentM3u(); | 290 | writeCurrentM3u(); |
285 | } | 291 | } |
286 | 292 | ||
287 | 293 | ||
288 | void PlayListWidget::setDocument( const QString& fileref ) { | 294 | void PlayListWidget::setDocument( const QString& fileref ) { |
289 | qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); | 295 | qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); |
290 | fromSetDocument = TRUE; | 296 | fromSetDocument = TRUE; |
291 | if ( fileref.isNull() ) { | 297 | if ( fileref.isNull() ) { |
292 | QMessageBox::critical( 0, tr( "Invalid File" ), | 298 | QMessageBox::critical( 0, tr( "Invalid File" ), |
293 | tr( "There was a problem in getting the file." ) ); | 299 | tr( "There was a problem in getting the file." ) ); |
294 | return; | 300 | return; |
295 | } | 301 | } |
296 | 302 | ||
297 | clearList(); | 303 | clearList(); |
298 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u | 304 | if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u |
299 | readm3u( fileref ); | 305 | readm3u( fileref ); |
300 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { | 306 | } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { |
301 | readm3u( DocLnk( fileref).file() ); | 307 | readm3u( DocLnk( fileref).file() ); |
302 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls | 308 | } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls |
303 | readPls( fileref ); | 309 | readPls( fileref ); |
304 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { | 310 | } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { |
305 | readPls( DocLnk( fileref).file() ); | 311 | readPls( DocLnk( fileref).file() ); |
306 | } else { | 312 | } else { |
307 | clearList(); | 313 | clearList(); |
308 | addToSelection( DocLnk( fileref ) ); | 314 | addToSelection( DocLnk( fileref ) ); |
315 | writeCurrentM3u(); | ||
316 | |||
309 | d->setDocumentUsed = TRUE; | 317 | d->setDocumentUsed = TRUE; |
310 | mediaPlayerState->setPlaying( FALSE ); | 318 | mediaPlayerState->setPlaying( FALSE ); |
311 | mediaPlayerState->setPlaying( TRUE ); | 319 | mediaPlayerState->setPlaying( TRUE ); |
312 | } | 320 | } |
313 | } | 321 | } |
314 | 322 | ||
315 | 323 | ||
316 | void PlayListWidget::useSelectedDocument() { | 324 | void PlayListWidget::useSelectedDocument() { |
317 | d->setDocumentUsed = FALSE; | 325 | d->setDocumentUsed = FALSE; |
318 | } | 326 | } |
319 | 327 | ||
320 | 328 | ||
321 | const DocLnk *PlayListWidget::current() { // this is fugly | 329 | const DocLnk *PlayListWidget::current() { // this is fugly |
322 | switch ( whichList() ) { | 330 | switch ( whichList() ) { |
323 | case 0: //playlist | 331 | case 0: //playlist |
324 | { | 332 | { |
325 | // qDebug("playlist"); | 333 | // qDebug("playlist"); |
326 | if ( mediaPlayerState->playlist() ) { | 334 | if ( mediaPlayerState->playlist() ) { |
327 | return d->selectedFiles->current(); | 335 | return d->selectedFiles->current(); |
328 | } else if ( d->setDocumentUsed && d->current ) { | 336 | } else if ( d->setDocumentUsed && d->current ) { |
329 | return d->current; | 337 | return d->current; |
330 | } else { | 338 | } else { |
331 | return &(d->files->selectedDocument()); | 339 | return &(d->files->selectedDocument()); |
332 | } | 340 | } |
@@ -591,49 +599,49 @@ void PlayListWidget::deletePlaylist() { | |||
591 | case 0: // Yes clicked, | 599 | case 0: // Yes clicked, |
592 | QFile().remove(playLists->selectedDocument().file()); | 600 | QFile().remove(playLists->selectedDocument().file()); |
593 | QFile().remove(playLists->selectedDocument().linkFile()); | 601 | QFile().remove(playLists->selectedDocument().linkFile()); |
594 | playLists->reread(); | 602 | playLists->reread(); |
595 | break; | 603 | break; |
596 | case 1: // Cancel | 604 | case 1: // Cancel |
597 | break; | 605 | break; |
598 | }; | 606 | }; |
599 | } | 607 | } |
600 | 608 | ||
601 | 609 | ||
602 | void PlayListWidget::playSelected() { | 610 | void PlayListWidget::playSelected() { |
603 | btnPlay( TRUE); | 611 | btnPlay( TRUE); |
604 | } | 612 | } |
605 | 613 | ||
606 | 614 | ||
607 | void PlayListWidget::scanForAudio() { | 615 | void PlayListWidget::scanForAudio() { |
608 | // qDebug("scan for audio"); | 616 | // qDebug("scan for audio"); |
609 | files.detachChildren(); | 617 | files.detachChildren(); |
610 | QListIterator<DocLnk> sdit( files.children() ); | 618 | QListIterator<DocLnk> sdit( files.children() ); |
611 | for ( ; sdit.current(); ++sdit ) { | 619 | for ( ; sdit.current(); ++sdit ) { |
612 | delete sdit.current(); | 620 | delete sdit.current(); |
613 | } | 621 | } |
614 | // Global::findDocuments( &files, "audio/*"); | 622 | // Global::findDocuments( &files, "audio/*"); |
615 | Global::findDocuments( &files, "audio/mpeg;audio/x-wav;audio/x-ogg"); | 623 | Global::findDocuments( &files, audioMimes); |
616 | audioScan = TRUE; | 624 | audioScan = TRUE; |
617 | } | 625 | } |
618 | 626 | ||
619 | void PlayListWidget::scanForVideo() { | 627 | void PlayListWidget::scanForVideo() { |
620 | // qDebug("scan for video"); | 628 | // qDebug("scan for video"); |
621 | vFiles.detachChildren(); | 629 | vFiles.detachChildren(); |
622 | QListIterator<DocLnk> sdit( vFiles.children() ); | 630 | QListIterator<DocLnk> sdit( vFiles.children() ); |
623 | for ( ; sdit.current(); ++sdit ) { | 631 | for ( ; sdit.current(); ++sdit ) { |
624 | delete sdit.current(); | 632 | delete sdit.current(); |
625 | } | 633 | } |
626 | Global::findDocuments(&vFiles, "video/*"); | 634 | Global::findDocuments(&vFiles, "video/*"); |
627 | videoScan = TRUE; | 635 | videoScan = TRUE; |
628 | } | 636 | } |
629 | 637 | ||
630 | void PlayListWidget::populateAudioView() { | 638 | void PlayListWidget::populateAudioView() { |
631 | audioView->clear(); | 639 | audioView->clear(); |
632 | StorageInfo storageInfo; | 640 | StorageInfo storageInfo; |
633 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 641 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
634 | if(!audioScan) { | 642 | if(!audioScan) { |
635 | scanForAudio(); | 643 | scanForAudio(); |
636 | } | 644 | } |
637 | 645 | ||
638 | QListIterator<DocLnk> dit( files.children() ); | 646 | QListIterator<DocLnk> dit( files.children() ); |
639 | QListIterator<FileSystem> it ( fs ); | 647 | QListIterator<FileSystem> it ( fs ); |
@@ -823,58 +831,59 @@ void PlayListWidget::readPls( const QString &filename ) { | |||
823 | lnk.setFile( s ); | 831 | lnk.setFile( s ); |
824 | } else { //if its a url | 832 | } else { //if its a url |
825 | if( name.right( 1 ).find( '/' ) == -1) { | 833 | if( name.right( 1 ).find( '/' ) == -1) { |
826 | s += "/"; | 834 | s += "/"; |
827 | } | 835 | } |
828 | lnk.setFile( s ); | 836 | lnk.setFile( s ); |
829 | } | 837 | } |
830 | lnk.setType( "audio/x-mpegurl" ); | 838 | lnk.setType( "audio/x-mpegurl" ); |
831 | 839 | ||
832 | lnk.writeLink(); | 840 | lnk.writeLink(); |
833 | d->selectedFiles->addToSelection( lnk ); | 841 | d->selectedFiles->addToSelection( lnk ); |
834 | } | 842 | } |
835 | 843 | ||
836 | m3uList->close(); | 844 | m3uList->close(); |
837 | if(m3uList) delete m3uList; | 845 | if(m3uList) delete m3uList; |
838 | } | 846 | } |
839 | 847 | ||
840 | /* | 848 | /* |
841 | writes current playlist to current m3u file */ | 849 | writes current playlist to current m3u file */ |
842 | void PlayListWidget::writeCurrentM3u() { | 850 | void PlayListWidget::writeCurrentM3u() { |
843 | qDebug("writing to current m3u"); | 851 | qDebug("writing to current m3u"); |
844 | Config cfg( "OpiePlayer" ); | 852 | Config cfg( "OpiePlayer" ); |
845 | cfg.setGroup("PlayList"); | 853 | cfg.setGroup("PlayList"); |
846 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 854 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
847 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 855 | |
848 | Om3u *m3uList; | 856 | Om3u *m3uList; |
849 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite |IO_Truncate ); | 857 | m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); |
850 | d->selectedFiles->first(); | 858 | d->selectedFiles->first(); |
851 | 859 | qDebug( d->selectedFiles->current()->file()); | |
852 | do { | 860 | do { |
853 | m3uList->add( d->selectedFiles->current()->file()); | 861 | qDebug( d->selectedFiles->current()->file()); |
862 | m3uList->add( d->selectedFiles->current()->file() ); | ||
854 | } | 863 | } |
855 | while ( d->selectedFiles->next() ); | 864 | while ( d->selectedFiles->next() ); |
856 | // qDebug( list ); | 865 | qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
857 | m3uList->write(); | 866 | m3uList->write(); |
858 | m3uList->close(); | 867 | m3uList->close(); |
859 | 868 | ||
860 | if(m3uList) delete m3uList; | 869 | if(m3uList) delete m3uList; |
861 | } | 870 | } |
862 | 871 | ||
863 | /* | 872 | /* |
864 | writes current playlist to m3u file */ | 873 | writes current playlist to m3u file */ |
865 | void PlayListWidget::writem3u() { | 874 | void PlayListWidget::writem3u() { |
866 | InputDialog *fileDlg; | 875 | InputDialog *fileDlg; |
867 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 876 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
868 | fileDlg->exec(); | 877 | fileDlg->exec(); |
869 | QString name, filename, list; | 878 | QString name, filename, list; |
870 | Om3u *m3uList; | 879 | Om3u *m3uList; |
871 | 880 | ||
872 | if( fileDlg->result() == 1 ) { | 881 | if( fileDlg->result() == 1 ) { |
873 | name = fileDlg->text(); | 882 | name = fileDlg->text(); |
874 | // qDebug( filename ); | 883 | // qDebug( filename ); |
875 | 884 | ||
876 | if( name.left( 1) != "/" ) { | 885 | if( name.left( 1) != "/" ) { |
877 | filename = QPEApplication::documentDir() + "/" + name; | 886 | filename = QPEApplication::documentDir() + "/" + name; |
878 | } | 887 | } |
879 | 888 | ||
880 | if( name.right( 3 ) != "m3u" ) { | 889 | if( name.right( 3 ) != "m3u" ) { |