summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-04 11:20:48 (UTC)
committer simon <simon>2002-12-04 11:20:48 (UTC)
commit84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95 (patch) (unidiff)
treebb84499e28cfb1d518e3cebf504eb9279257ced9
parent9b30090fddf1cc2e8ffbff70b164213118106167 (diff)
downloadopie-84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95.zip
opie-84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95.tar.gz
opie-84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95.tar.bz2
- merged popuplateAudioView and popuplateVideoView into one
PlayListFileView::popuplateView method
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp34
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp72
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp4
4 files changed, 40 insertions, 74 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index 1e2ef89..0ed1061 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -1,36 +1,66 @@
1 1
2#include "playlistfileview.h" 2#include "playlistfileview.h"
3 3
4#include <qfile.h>
4#include <qpe/global.h> 5#include <qpe/global.h>
6#include <qpe/resource.h>
5 7
6PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name ) 8PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name )
7 : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_scannedFiles( false ) 9 : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false )
8{ 10{
9 addColumn( tr( "Title" ), 140); 11 addColumn( tr( "Title" ), 140);
10 addColumn( tr( "Size" ), -1 ); 12 addColumn( tr( "Size" ), -1 );
11 addColumn(tr( "Media" ), 0 ); 13 addColumn(tr( "Media" ), 0 );
12 addColumn(tr( "Path" ), -1 ); 14 addColumn(tr( "Path" ), -1 );
13 setColumnAlignment( 1, Qt::AlignRight ); 15 setColumnAlignment( 1, Qt::AlignRight );
14 setColumnAlignment( 2, Qt::AlignRight ); 16 setColumnAlignment( 2, Qt::AlignRight );
15 setAllColumnsShowFocus( TRUE ); 17 setAllColumnsShowFocus( TRUE );
16 setSorting( 3, TRUE ); 18 setSorting( 3, TRUE );
17 setMultiSelection( TRUE ); 19 setMultiSelection( TRUE );
18 setSelectionMode( QListView::Extended ); 20 setSelectionMode( QListView::Extended );
19} 21}
20 22
21PlayListFileView::~PlayListFileView() 23PlayListFileView::~PlayListFileView()
22{ 24{
23} 25}
24 26
25void PlayListFileView::scanFiles() 27void PlayListFileView::scanFiles()
26{ 28{
27 m_files.detachChildren(); 29 m_files.detachChildren();
28 QListIterator<DocLnk> sdit( m_files.children() ); 30 QListIterator<DocLnk> sdit( m_files.children() );
29 for ( ; sdit.current(); ++sdit ) 31 for ( ; sdit.current(); ++sdit )
30 delete sdit.current(); 32 delete sdit.current();
31 33
32 Global::findDocuments( &m_files, m_mimeTypePattern ); 34 Global::findDocuments( &m_files, m_mimeTypePattern );
33} 35}
34 36
37void PlayListFileView::populateView()
38{
39 clear();
40
41 if( !m_scannedFiles ) {
42 scanFiles();
43 m_scannedFiles = true;
44 }
45
46 QString storage;
47 QListIterator<DocLnk> dit( m_files.children() );
48 for ( ; dit.current(); ++dit ) {
49
50 QListViewItem *newItem;
51
52 if ( QFile::exists( dit.current()->file() ) ||
53 dit.current()->file().left( 4 ) == "http" ) {
54
55 unsigned long size = QFile( dit.current()->file() ).size();
56
57 newItem = new QListViewItem( this, dit.current()->name(),
58 QString::number( size ), "" /*storage*/,
59 dit.current()->file() );
60 newItem->setPixmap( 0, Resource::loadPixmap( m_itemPixmapName ) );
61 }
62 }
63}
64
35/* vim: et sw=4 ts=4 65/* vim: et sw=4 ts=4
36 */ 66 */
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index 4e17966..a00349e 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -1,31 +1,33 @@
1#ifndef PLAYLISTFILEVIEW_H 1#ifndef PLAYLISTFILEVIEW_H
2#define PLAYLISTFILEVIEW_H 2#define PLAYLISTFILEVIEW_H
3 3
4#include "playlistview.h" 4#include "playlistview.h"
5 5
6#include <qpe/applnk.h> 6#include <qpe/applnk.h>
7 7
8class PlayListFileView : public PlayListView 8class PlayListFileView : public PlayListView
9{ 9{
10 Q_OBJECT 10 Q_OBJECT
11public: 11public:
12 PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 ); 12 PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 );
13 virtual ~PlayListFileView(); 13 virtual ~PlayListFileView();
14 14
15 // both temporarily accessible that way until the caller code has 15 // both temporarily accessible that way until the caller code has
16 // been migrated into this class 16 // been migrated into this class
17 DocLnkSet &files() { return m_files; } 17 DocLnkSet &files() { return m_files; }
18 bool &scannedFiles() { return m_scannedFiles; } 18 bool &scannedFiles() { return m_scannedFiles; }
19 19
20public slots: 20public slots:
21 void scanFiles(); 21 void scanFiles();
22 void populateView();
22 23
23private: 24private:
24 QString m_mimeTypePattern; 25 QString m_mimeTypePattern;
26 QString m_itemPixmapName;
25 DocLnkSet m_files; 27 DocLnkSet m_files;
26 bool m_scannedFiles; 28 bool m_scannedFiles;
27}; 29};
28 30
29#endif // PLAYLISTFILEVIEW_H 31#endif // PLAYLISTFILEVIEW_H
30/* vim: et sw=4 ts=4 32/* vim: et sw=4 ts=4
31 */ 33 */
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 12b8a71..460a0bf 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -266,840 +266,774 @@ void PlayListWidget::addAllToList() {
266 lnk.setName( QFileInfo(filename).baseName() ); //sets name 266 lnk.setName( QFileInfo(filename).baseName() ); //sets name
267 lnk.setFile( filename ); //sets file name 267 lnk.setFile( filename ); //sets file name
268 d->selectedFiles->addToSelection( lnk); 268 d->selectedFiles->addToSelection( lnk);
269 } 269 }
270 270
271 if(!videoView->scannedFiles()) { 271 if(!videoView->scannedFiles()) {
272 if(videoView->childCount() < 1) 272 if(videoView->childCount() < 1)
273 populateVideoView(); 273 populateVideoView();
274 } 274 }
275 275
276 QListViewItemIterator videoIt( videoView ); 276 QListViewItemIterator videoIt( videoView );
277 for ( ; videoIt.current(); ++videoIt ) { 277 for ( ; videoIt.current(); ++videoIt ) {
278 filename = videoIt.current()->text(3); 278 filename = videoIt.current()->text(3);
279 lnk.setName( QFileInfo(filename).baseName() ); //sets name 279 lnk.setName( QFileInfo(filename).baseName() ); //sets name
280 lnk.setFile( filename ); //sets file name 280 lnk.setFile( filename ); //sets file name
281 d->selectedFiles->addToSelection( lnk); 281 d->selectedFiles->addToSelection( lnk);
282 } 282 }
283 283
284 // d->selectedFiles->addToSelection( ); 284 // d->selectedFiles->addToSelection( );
285 // if ( it.current()->isSelected() ) 285 // if ( it.current()->isSelected() )
286 // lst->append( audioIt.current() ); 286 // lst->append( audioIt.current() );
287 // } 287 // }
288 288
289 289
290// if(!audioScan) 290// if(!audioScan)
291// scanForAudio(); 291// scanForAudio();
292// if(!videoScan) 292// if(!videoScan)
293// scanForVideo(); 293// scanForVideo();
294 294
295// DocLnkSet filesAll; 295// DocLnkSet filesAll;
296// Global::findDocuments(&filesAll, "video/*;"+audioMimes); 296// Global::findDocuments(&filesAll, "video/*;"+audioMimes);
297// QListIterator<DocLnk> Adit( filesAll.children() ); 297// QListIterator<DocLnk> Adit( filesAll.children() );
298// for ( ; Adit.current(); ++Adit ) { 298// for ( ; Adit.current(); ++Adit ) {
299// if( QFileInfo( Adit.current()->file() ).exists() ) { 299// if( QFileInfo( Adit.current()->file() ).exists() ) {
300// d->selectedFiles->addToSelection( **Adit ); 300// d->selectedFiles->addToSelection( **Adit );
301// } 301// }
302// } 302// }
303 303
304 // qDebug("elapsed time %d", t.elapsed() ); 304 // qDebug("elapsed time %d", t.elapsed() );
305 305
306 tabWidget->setCurrentPage(0); 306 tabWidget->setCurrentPage(0);
307 307
308 writeCurrentM3u(); 308 writeCurrentM3u();
309 d->selectedFiles->first(); 309 d->selectedFiles->first();
310} 310}
311 311
312 312
313void PlayListWidget::addAllMusicToList() { 313void PlayListWidget::addAllMusicToList() {
314 314
315 if(!audioView->scannedFiles()) { 315 if(!audioView->scannedFiles()) {
316 if(audioView->childCount() < 1) 316 if(audioView->childCount() < 1)
317 populateAudioView(); 317 populateAudioView();
318 } 318 }
319 319
320 QListViewItemIterator audioIt( audioView ); 320 QListViewItemIterator audioIt( audioView );
321 DocLnk lnk; 321 DocLnk lnk;
322 QString filename; 322 QString filename;
323 // iterate through all items of the listview 323 // iterate through all items of the listview
324 for ( ; audioIt.current(); ++audioIt ) { 324 for ( ; audioIt.current(); ++audioIt ) {
325 filename = audioIt.current()->text(3); 325 filename = audioIt.current()->text(3);
326 lnk.setName( QFileInfo(filename).baseName() ); //sets name 326 lnk.setName( QFileInfo(filename).baseName() ); //sets name
327 lnk.setFile( filename ); //sets file name 327 lnk.setFile( filename ); //sets file name
328 d->selectedFiles->addToSelection( lnk); 328 d->selectedFiles->addToSelection( lnk);
329 } 329 }
330 330
331 /* if(!audioScan) 331 /* if(!audioScan)
332 scanForAudio(); 332 scanForAudio();
333 QListIterator<DocLnk> dit( files.children() ); 333 QListIterator<DocLnk> dit( files.children() );
334 for ( ; dit.current(); ++dit ) { 334 for ( ; dit.current(); ++dit ) {
335 if( QFileInfo(dit.current()->file() ).exists() ) { 335 if( QFileInfo(dit.current()->file() ).exists() ) {
336 d->selectedFiles->addToSelection( **dit ); 336 d->selectedFiles->addToSelection( **dit );
337 } 337 }
338 } 338 }
339 */ 339 */
340 tabWidget->setCurrentPage(0); 340 tabWidget->setCurrentPage(0);
341 writeCurrentM3u(); 341 writeCurrentM3u();
342 d->selectedFiles->first(); 342 d->selectedFiles->first();
343} 343}
344 344
345 345
346void PlayListWidget::addAllVideoToList() { 346void PlayListWidget::addAllVideoToList() {
347 347
348 if(!videoView->scannedFiles()) { 348 if(!videoView->scannedFiles()) {
349 if(videoView->childCount() < 1) 349 if(videoView->childCount() < 1)
350 populateVideoView(); 350 populateVideoView();
351 } 351 }
352 352
353 QListViewItemIterator videoIt( videoView ); 353 QListViewItemIterator videoIt( videoView );
354 DocLnk lnk; 354 DocLnk lnk;
355 QString filename; 355 QString filename;
356 for ( ; videoIt.current(); ++videoIt ) { 356 for ( ; videoIt.current(); ++videoIt ) {
357 filename = videoIt.current()->text(3); 357 filename = videoIt.current()->text(3);
358 lnk.setName( QFileInfo(filename).baseName() ); //sets name 358 lnk.setName( QFileInfo(filename).baseName() ); //sets name
359 lnk.setFile( filename ); //sets file name 359 lnk.setFile( filename ); //sets file name
360 d->selectedFiles->addToSelection( lnk); 360 d->selectedFiles->addToSelection( lnk);
361 } 361 }
362 362
363 363
364 /* if(!videoScan) 364 /* if(!videoScan)
365 scanForVideo(); 365 scanForVideo();
366 QListIterator<DocLnk> dit( vFiles.children() ); 366 QListIterator<DocLnk> dit( vFiles.children() );
367 for ( ; dit.current(); ++dit ) { 367 for ( ; dit.current(); ++dit ) {
368 if( QFileInfo( dit.current()->file() ).exists() ) { 368 if( QFileInfo( dit.current()->file() ).exists() ) {
369 d->selectedFiles->addToSelection( **dit ); 369 d->selectedFiles->addToSelection( **dit );
370 } 370 }
371 } 371 }
372*/ 372*/
373 tabWidget->setCurrentPage(0); 373 tabWidget->setCurrentPage(0);
374 writeCurrentM3u(); 374 writeCurrentM3u();
375 d->selectedFiles->first(); 375 d->selectedFiles->first();
376} 376}
377 377
378 378
379void PlayListWidget::setDocument( const QString& fileref ) { 379void PlayListWidget::setDocument( const QString& fileref ) {
380 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref ); 380 // qDebug( "<<<<<<<<set document>>>>>>>>>> "+fileref );
381 fromSetDocument = TRUE; 381 fromSetDocument = TRUE;
382 if ( fileref.isNull() ) { 382 if ( fileref.isNull() ) {
383 QMessageBox::warning( this, tr( "Invalid File" ), 383 QMessageBox::warning( this, tr( "Invalid File" ),
384 tr( "There was a problem in getting the file." ) ); 384 tr( "There was a problem in getting the file." ) );
385 return; 385 return;
386 } 386 }
387 387
388 clearList(); 388 clearList();
389 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u 389 if( fileref.find( "m3u", 0, TRUE) != -1 ) { //is m3u
390 readm3u( fileref ); 390 readm3u( fileref );
391 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 391 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
392 readm3u( DocLnk( fileref).file() ); 392 readm3u( DocLnk( fileref).file() );
393 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 393 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
394 readPls( fileref ); 394 readPls( fileref );
395 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 395 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
396 readPls( DocLnk( fileref).file() ); 396 readPls( DocLnk( fileref).file() );
397 } else { 397 } else {
398 clearList(); 398 clearList();
399 addToSelection( DocLnk( fileref ) ); 399 addToSelection( DocLnk( fileref ) );
400 writeCurrentM3u(); 400 writeCurrentM3u();
401 401
402 d->setDocumentUsed = TRUE; 402 d->setDocumentUsed = TRUE;
403 mediaPlayerState.setPlaying( FALSE ); 403 mediaPlayerState.setPlaying( FALSE );
404 mediaPlayerState.setPlaying( TRUE ); 404 mediaPlayerState.setPlaying( TRUE );
405 } 405 }
406} 406}
407 407
408 408
409void PlayListWidget::useSelectedDocument() { 409void PlayListWidget::useSelectedDocument() {
410 d->setDocumentUsed = FALSE; 410 d->setDocumentUsed = FALSE;
411} 411}
412 412
413 413
414const DocLnk *PlayListWidget::current() const { // this is fugly 414const DocLnk *PlayListWidget::current() const { // this is fugly
415 assert( currentTab() == CurrentPlayList ); 415 assert( currentTab() == CurrentPlayList );
416 416
417 const DocLnk *lnk = d->selectedFiles->current(); 417 const DocLnk *lnk = d->selectedFiles->current();
418 if ( !lnk ) { 418 if ( !lnk ) {
419 d->selectedFiles->first(); 419 d->selectedFiles->first();
420 lnk = d->selectedFiles->current(); 420 lnk = d->selectedFiles->current();
421 } 421 }
422 assert( lnk ); 422 assert( lnk );
423 return lnk; 423 return lnk;
424} 424}
425 425
426 426
427bool PlayListWidget::prev() { 427bool PlayListWidget::prev() {
428 if ( mediaPlayerState.isShuffled() ) { 428 if ( mediaPlayerState.isShuffled() ) {
429 const DocLnk *cur = current(); 429 const DocLnk *cur = current();
430 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 430 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
431 for ( int i = 0; i < j; i++ ) { 431 for ( int i = 0; i < j; i++ ) {
432 if ( !d->selectedFiles->next() ) 432 if ( !d->selectedFiles->next() )
433 d->selectedFiles->first(); 433 d->selectedFiles->first();
434 } 434 }
435 if ( cur == current() ) 435 if ( cur == current() )
436 if ( !d->selectedFiles->next() ) { 436 if ( !d->selectedFiles->next() ) {
437 d->selectedFiles->first(); 437 d->selectedFiles->first();
438 } 438 }
439 return TRUE; 439 return TRUE;
440 } else { 440 } else {
441 if ( !d->selectedFiles->prev() ) { 441 if ( !d->selectedFiles->prev() ) {
442 if ( mediaPlayerState.isLooping() ) { 442 if ( mediaPlayerState.isLooping() ) {
443 return d->selectedFiles->last(); 443 return d->selectedFiles->last();
444 } else { 444 } else {
445 return FALSE; 445 return FALSE;
446 } 446 }
447 } 447 }
448 return TRUE; 448 return TRUE;
449 } 449 }
450} 450}
451 451
452 452
453bool PlayListWidget::next() { 453bool PlayListWidget::next() {
454//qDebug("<<<<<<<<<<<<next()"); 454//qDebug("<<<<<<<<<<<<next()");
455 if ( mediaPlayerState.isShuffled() ) { 455 if ( mediaPlayerState.isShuffled() ) {
456 return prev(); 456 return prev();
457 } else { 457 } else {
458 if ( !d->selectedFiles->next() ) { 458 if ( !d->selectedFiles->next() ) {
459 if ( mediaPlayerState.isLooping() ) { 459 if ( mediaPlayerState.isLooping() ) {
460 return d->selectedFiles->first(); 460 return d->selectedFiles->first();
461 } else { 461 } else {
462 return FALSE; 462 return FALSE;
463 } 463 }
464 } 464 }
465 return TRUE; 465 return TRUE;
466 } 466 }
467} 467}
468 468
469 469
470bool PlayListWidget::first() { 470bool PlayListWidget::first() {
471 return d->selectedFiles->first(); 471 return d->selectedFiles->first();
472} 472}
473 473
474 474
475bool PlayListWidget::last() { 475bool PlayListWidget::last() {
476 return d->selectedFiles->last(); 476 return d->selectedFiles->last();
477} 477}
478 478
479 479
480 void PlayListWidget::saveList() { 480 void PlayListWidget::saveList() {
481 writem3u(); 481 writem3u();
482 } 482 }
483 483
484 484
485void PlayListWidget::loadList( const DocLnk & lnk) { 485void PlayListWidget::loadList( const DocLnk & lnk) {
486 QString name = lnk.name(); 486 QString name = lnk.name();
487 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); 487 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name);
488 488
489 if( name.length()>0) { 489 if( name.length()>0) {
490 setCaption("OpiePlayer: "+name); 490 setCaption("OpiePlayer: "+name);
491// qDebug("<<<<<<<<<<<<load list "+ lnk.file()); 491// qDebug("<<<<<<<<<<<<load list "+ lnk.file());
492 clearList(); 492 clearList();
493 readm3u(lnk.file()); 493 readm3u(lnk.file());
494 tabWidget->setCurrentPage(0); 494 tabWidget->setCurrentPage(0);
495 } 495 }
496} 496}
497 497
498void PlayListWidget::addSelected() { 498void PlayListWidget::addSelected() {
499 assert( inFileListMode() ); 499 assert( inFileListMode() );
500 500
501 QListView *fileListView = currentFileListView(); 501 QListView *fileListView = currentFileListView();
502 QListViewItemIterator it( fileListView ); 502 QListViewItemIterator it( fileListView );
503 for ( ; it.current(); ++it ) 503 for ( ; it.current(); ++it )
504 if ( it.current()->isSelected() ) { 504 if ( it.current()->isSelected() ) {
505 QString filename = it.current()->text(3); 505 QString filename = it.current()->text(3);
506 506
507 DocLnk lnk; 507 DocLnk lnk;
508 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 508 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
509 lnk.setFile( filename ); //sets file name 509 lnk.setFile( filename ); //sets file name
510 510
511 d->selectedFiles->addToSelection( lnk ); 511 d->selectedFiles->addToSelection( lnk );
512 } 512 }
513 513
514 fileListView->clearSelection(); 514 fileListView->clearSelection();
515 515
516 tabWidget->setCurrentPage( 0 ); 516 tabWidget->setCurrentPage( 0 );
517 writeCurrentM3u(); 517 writeCurrentM3u();
518} 518}
519 519
520 520
521void PlayListWidget::removeSelected() { 521void PlayListWidget::removeSelected() {
522 d->selectedFiles->removeSelected( ); 522 d->selectedFiles->removeSelected( );
523 writeCurrentM3u(); 523 writeCurrentM3u();
524} 524}
525 525
526 526
527void PlayListWidget::playIt( QListViewItem *it) { 527void PlayListWidget::playIt( QListViewItem *it) {
528 if(!it) return; 528 if(!it) return;
529 mediaPlayerState.setPlaying(FALSE); 529 mediaPlayerState.setPlaying(FALSE);
530 mediaPlayerState.setPlaying(TRUE); 530 mediaPlayerState.setPlaying(TRUE);
531 d->selectedFiles->unSelect(); 531 d->selectedFiles->unSelect();
532} 532}
533 533
534 534
535void PlayListWidget::addToSelection( QListViewItem *it) { 535void PlayListWidget::addToSelection( QListViewItem *it) {
536 d->setDocumentUsed = FALSE; 536 d->setDocumentUsed = FALSE;
537 537
538 if(it) { 538 if(it) {
539 if ( currentTab() == CurrentPlayList ) 539 if ( currentTab() == CurrentPlayList )
540 return; 540 return;
541 // case 1: { 541 // case 1: {
542 DocLnk lnk; 542 DocLnk lnk;
543 QString filename; 543 QString filename;
544 544
545 filename=it->text(3); 545 filename=it->text(3);
546 lnk.setName( QFileInfo(filename).baseName() ); //sets name 546 lnk.setName( QFileInfo(filename).baseName() ); //sets name
547 lnk.setFile( filename ); //sets file name 547 lnk.setFile( filename ); //sets file name
548 d->selectedFiles->addToSelection( lnk); 548 d->selectedFiles->addToSelection( lnk);
549 549
550 writeCurrentM3u(); 550 writeCurrentM3u();
551 tabWidget->setCurrentPage(0); 551 tabWidget->setCurrentPage(0);
552 552
553 } 553 }
554} 554}
555 555
556 556
557void PlayListWidget::tabChanged(QWidget *) { 557void PlayListWidget::tabChanged(QWidget *) {
558 558
559 d->tbPlay->setEnabled( true ); 559 d->tbPlay->setEnabled( true );
560 560
561 switch ( currentTab() ) { 561 switch ( currentTab() ) {
562 case CurrentPlayList: 562 case CurrentPlayList:
563 { 563 {
564 if( !tbDeletePlaylist->isHidden() ) { 564 if( !tbDeletePlaylist->isHidden() ) {
565 tbDeletePlaylist->hide(); 565 tbDeletePlaylist->hide();
566 } 566 }
567 d->tbRemoveFromList->setEnabled(TRUE); 567 d->tbRemoveFromList->setEnabled(TRUE);
568 d->tbAddToList->setEnabled(FALSE); 568 d->tbAddToList->setEnabled(FALSE);
569 569
570 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); 570 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
571 } 571 }
572 break; 572 break;
573 case AudioFiles: 573 case AudioFiles:
574 { 574 {
575 // audioView->clear(); 575 // audioView->clear();
576 if(!audioPopulated) populateAudioView(); 576 if(!audioPopulated) populateAudioView();
577 577
578 if( !tbDeletePlaylist->isHidden() ) { 578 if( !tbDeletePlaylist->isHidden() ) {
579 tbDeletePlaylist->hide(); 579 tbDeletePlaylist->hide();
580 } 580 }
581 d->tbRemoveFromList->setEnabled(FALSE); 581 d->tbRemoveFromList->setEnabled(FALSE);
582 d->tbAddToList->setEnabled(TRUE); 582 d->tbAddToList->setEnabled(TRUE);
583 } 583 }
584 break; 584 break;
585 case VideoFiles: 585 case VideoFiles:
586 { 586 {
587 // videoView->clear(); 587 // videoView->clear();
588 if(!videoPopulated) populateVideoView(); 588 if(!videoPopulated) populateVideoView();
589 if( !tbDeletePlaylist->isHidden() ) { 589 if( !tbDeletePlaylist->isHidden() ) {
590 tbDeletePlaylist->hide(); 590 tbDeletePlaylist->hide();
591 } 591 }
592 d->tbRemoveFromList->setEnabled(FALSE); 592 d->tbRemoveFromList->setEnabled(FALSE);
593 d->tbAddToList->setEnabled(TRUE); 593 d->tbAddToList->setEnabled(TRUE);
594 } 594 }
595 break; 595 break;
596 case PlayLists: 596 case PlayLists:
597 { 597 {
598 if( tbDeletePlaylist->isHidden() ) { 598 if( tbDeletePlaylist->isHidden() ) {
599 tbDeletePlaylist->show(); 599 tbDeletePlaylist->show();
600 } 600 }
601 playLists->reread(); 601 playLists->reread();
602 d->tbAddToList->setEnabled(FALSE); 602 d->tbAddToList->setEnabled(FALSE);
603 603
604 d->tbPlay->setEnabled( false ); 604 d->tbPlay->setEnabled( false );
605 } 605 }
606 break; 606 break;
607 }; 607 };
608} 608}
609 609
610 610
611void PlayListWidget::btnPlay(bool b) { 611void PlayListWidget::btnPlay(bool b) {
612// mediaPlayerState->setPlaying(false); 612// mediaPlayerState->setPlaying(false);
613 mediaPlayerState.setPlaying(b); 613 mediaPlayerState.setPlaying(b);
614 insanityBool=FALSE; 614 insanityBool=FALSE;
615} 615}
616 616
617void PlayListWidget::deletePlaylist() { 617void PlayListWidget::deletePlaylist() {
618 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 618 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
619 (tr("You really want to delete\nthis playlist?")), 619 (tr("You really want to delete\nthis playlist?")),
620 (tr("Yes")), (tr("No")), 0 )){ 620 (tr("Yes")), (tr("No")), 0 )){
621 case 0: // Yes clicked, 621 case 0: // Yes clicked,
622 QFile().remove(playLists->selectedDocument().file()); 622 QFile().remove(playLists->selectedDocument().file());
623 QFile().remove(playLists->selectedDocument().linkFile()); 623 QFile().remove(playLists->selectedDocument().linkFile());
624 playLists->reread(); 624 playLists->reread();
625 break; 625 break;
626 case 1: // Cancel 626 case 1: // Cancel
627 break; 627 break;
628 }; 628 };
629} 629}
630 630
631 631
632void PlayListWidget::playSelected() { 632void PlayListWidget::playSelected() {
633 btnPlay( TRUE); 633 btnPlay( TRUE);
634} 634}
635 635
636 636
637void PlayListWidget::scanForAudio() { 637void PlayListWidget::scanForAudio() {
638 audioView->scanFiles(); 638 audioView->scanFiles();
639 audioView->scannedFiles() = true; 639 audioView->scannedFiles() = true;
640 populateAudioView(); 640 populateAudioView();
641} 641}
642 642
643void PlayListWidget::scanForVideo() { 643void PlayListWidget::scanForVideo() {
644 videoView->scanFiles(); 644 videoView->scanFiles();
645 videoView->scannedFiles() = true; 645 videoView->scannedFiles() = true;
646 populateVideoView(); 646 populateVideoView();
647} 647}
648 648
649void PlayListWidget::populateAudioView() { 649void PlayListWidget::populateAudioView() {
650 audioView->clear(); 650 audioView->populateView();
651 StorageInfo storageInfo; 651 audioPopulated = true;
652 // const QList<FileSystem> &fs = storageInfo.fileSystems();
653 if(!audioView->scannedFiles()) {
654 scanForAudio();
655 }
656
657 QListIterator<DocLnk> dit( audioView->files().children() );
658 // QListIterator<FileSystem> it ( fs );
659 audioView->clear();
660
661 QString storage;
662 for ( ; dit.current(); ++dit ) {
663// // for( ; it.current(); ++it ){
664// const QString name = (*dit)->name();
665// const QString path = (*dit)->path();
666// if(dit.current()->file().find(path) != -1 ) {
667// storage = name;
668// // }
669// }
670
671 QListViewItem * newItem;
672 if ( QFile( dit.current()->file()).exists() ||
673 dit.current()->file().left(4) == "http" ) {
674 long size;
675 if( dit.current()->file().left(4) == "http" )
676 size=0;
677 else
678 size = QFile( dit.current()->file() ).size();
679
680 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
681 QString::number(size ), "" /*storage*/,
682 dit.current()->file() );
683 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
684// qDebug("<<<< "+dit.current()->file());
685 }
686 }
687 audioPopulated=true;
688} 652}
689 653
690
691void PlayListWidget::populateVideoView() { 654void PlayListWidget::populateVideoView() {
692 videoView->clear(); 655 videoView->populateView();
693 StorageInfo storageInfo;
694 // const QList<FileSystem> &fs = storageInfo.fileSystems();
695
696 if(!videoView->scannedFiles()) {
697 scanForVideo();
698 }
699
700 QListIterator<DocLnk> Vdit( videoView->files().children() );
701// QListIterator<FileSystem> it ( fs );
702 videoView->clear();
703 QString storage, pathName;
704 for ( ; Vdit.current(); ++Vdit ) {
705// // for( ; it.current(); ++it ) {
706// const QString name = (*Vdit)->name();
707// const QString path = (*Vdit)->path();
708// if( Vdit.current()->file().find(path) != -1 ) {
709// storage=name;
710// pathName=path;
711// // }
712// }
713
714 QListViewItem * newItem;
715 if ( QFile( Vdit.current()->file() ).exists() ) {
716 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
717 QString::number( QFile( Vdit.current()->file() ).size() ),
718 ""/*storage*/, Vdit.current()->file());
719 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
720 }
721 }
722 videoPopulated=true; 656 videoPopulated=true;
723} 657}
724 658
725QListView *PlayListWidget::currentFileListView() const 659QListView *PlayListWidget::currentFileListView() const
726{ 660{
727 switch ( currentTab() ) { 661 switch ( currentTab() ) {
728 case AudioFiles: return audioView; 662 case AudioFiles: return audioView;
729 case VideoFiles: return videoView; 663 case VideoFiles: return videoView;
730 default: assert( false ); 664 default: assert( false );
731 } 665 }
732 return 0; 666 return 0;
733} 667}
734 668
735bool PlayListWidget::inFileListMode() const 669bool PlayListWidget::inFileListMode() const
736{ 670{
737 TabType tab = currentTab(); 671 TabType tab = currentTab();
738 return tab == AudioFiles || tab == VideoFiles; 672 return tab == AudioFiles || tab == VideoFiles;
739} 673}
740 674
741void PlayListWidget::openFile() { 675void PlayListWidget::openFile() {
742 // http://66.28.164.33:2080 676 // http://66.28.164.33:2080
743 // http://somafm.com/star0242.m3u 677 // http://somafm.com/star0242.m3u
744 QString filename, name; 678 QString filename, name;
745 InputDialog *fileDlg; 679 InputDialog *fileDlg;
746 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 680 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
747 fileDlg->exec(); 681 fileDlg->exec();
748 if( fileDlg->result() == 1 ) { 682 if( fileDlg->result() == 1 ) {
749 filename = fileDlg->text(); 683 filename = fileDlg->text();
750 qDebug( "Selected filename is " + filename ); 684 qDebug( "Selected filename is " + filename );
751 // Om3u *m3uList; 685 // Om3u *m3uList;
752 DocLnk lnk; 686 DocLnk lnk;
753 Config cfg( "OpiePlayer" ); 687 Config cfg( "OpiePlayer" );
754 cfg.setGroup("PlayList"); 688 cfg.setGroup("PlayList");
755 689
756 if(filename.left(4) == "http") { 690 if(filename.left(4) == "http") {
757 QString m3uFile, m3uFilePath; 691 QString m3uFile, m3uFilePath;
758 if(filename.find(":",8,TRUE) != -1) { //found a port 692 if(filename.find(":",8,TRUE) != -1) { //found a port
759 m3uFile = filename.left( filename.find( ":",8,TRUE)); 693 m3uFile = filename.left( filename.find( ":",8,TRUE));
760 m3uFile = m3uFile.right( 7); 694 m3uFile = m3uFile.right( 7);
761 } else if(filename.left(4) == "http"){ 695 } else if(filename.left(4) == "http"){
762 m3uFile=filename; 696 m3uFile=filename;
763 m3uFile = m3uFile.right( m3uFile.length() - 7); 697 m3uFile = m3uFile.right( m3uFile.length() - 7);
764 } else{ 698 } else{
765 m3uFile=filename; 699 m3uFile=filename;
766 } 700 }
767 701
768// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 702// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
769 lnk.setName( filename ); //sets name 703 lnk.setName( filename ); //sets name
770 lnk.setFile( filename ); //sets file name 704 lnk.setFile( filename ); //sets file name
771 705
772// lnk.setIcon("opieplayer2/musicfile"); 706// lnk.setIcon("opieplayer2/musicfile");
773 707
774 d->selectedFiles->addToSelection( lnk ); 708 d->selectedFiles->addToSelection( lnk );
775 writeCurrentM3u(); 709 writeCurrentM3u();
776 d->selectedFiles->setSelectedItem( lnk.name()); 710 d->selectedFiles->setSelectedItem( lnk.name());
777 } 711 }
778 else if( filename.right( 3) == "m3u" ) { 712 else if( filename.right( 3) == "m3u" ) {
779 readm3u( filename ); 713 readm3u( filename );
780 714
781 } else if( filename.right(3) == "pls" ) { 715 } else if( filename.right(3) == "pls" ) {
782 readPls( filename ); 716 readPls( filename );
783 } else { 717 } else {
784 lnk.setName( QFileInfo(filename).baseName() ); //sets name 718 lnk.setName( QFileInfo(filename).baseName() ); //sets name
785 lnk.setFile( filename ); //sets file name 719 lnk.setFile( filename ); //sets file name
786 d->selectedFiles->addToSelection( lnk); 720 d->selectedFiles->addToSelection( lnk);
787 writeCurrentM3u(); 721 writeCurrentM3u();
788 d->selectedFiles->setSelectedItem( lnk.name()); 722 d->selectedFiles->setSelectedItem( lnk.name());
789 } 723 }
790 } 724 }
791 725
792 if( fileDlg ) { 726 if( fileDlg ) {
793 delete fileDlg; 727 delete fileDlg;
794 } 728 }
795} 729}
796 730
797/* 731/*
798reads m3u and shows files/urls to playlist widget */ 732reads m3u and shows files/urls to playlist widget */
799void PlayListWidget::readm3u( const QString &filename ) { 733void PlayListWidget::readm3u( const QString &filename ) {
800 qDebug( "read m3u filename " + filename ); 734 qDebug( "read m3u filename " + filename );
801 735
802 Om3u *m3uList; 736 Om3u *m3uList;
803 QString s, name; 737 QString s, name;
804 m3uList = new Om3u( filename, IO_ReadOnly ); 738 m3uList = new Om3u( filename, IO_ReadOnly );
805 m3uList->readM3u(); 739 m3uList->readM3u();
806 DocLnk lnk; 740 DocLnk lnk;
807 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 741 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
808 s = *it; 742 s = *it;
809// qDebug("reading "+ s); 743// qDebug("reading "+ s);
810 if(s.left(4)=="http") { 744 if(s.left(4)=="http") {
811 lnk.setName( s ); //sets file name 745 lnk.setName( s ); //sets file name
812 lnk.setIcon("opieplayer2/musicfile"); 746 lnk.setIcon("opieplayer2/musicfile");
813 lnk.setFile( s ); //sets file name 747 lnk.setFile( s ); //sets file name
814 748
815 } else { 749 } else {
816 // if( QFileInfo( s ).exists() ) { 750 // if( QFileInfo( s ).exists() ) {
817 lnk.setName( QFileInfo(s).baseName()); 751 lnk.setName( QFileInfo(s).baseName());
818 // if(s.right(4) == '.') {//if regular file 752 // if(s.right(4) == '.') {//if regular file
819 if(s.left(1) != "/") { 753 if(s.left(1) != "/") {
820 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 754 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
821 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 755 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
822// lnk.setIcon(MimeType(s).pixmap() ); 756// lnk.setIcon(MimeType(s).pixmap() );
823// lnk.setIcon("SoundPlayer"); 757// lnk.setIcon("SoundPlayer");
824 } else { 758 } else {
825 // qDebug("set link2 "+s); 759 // qDebug("set link2 "+s);
826 lnk.setFile( s); 760 lnk.setFile( s);
827// lnk.setIcon(MimeType(s).pixmap() ); 761// lnk.setIcon(MimeType(s).pixmap() );
828// lnk.setIcon("SoundPlayer"); 762// lnk.setIcon("SoundPlayer");
829 } 763 }
830 } 764 }
831 d->selectedFiles->addToSelection( lnk ); 765 d->selectedFiles->addToSelection( lnk );
832 } 766 }
833 Config config( "OpiePlayer" ); 767 Config config( "OpiePlayer" );
834 config.setGroup( "PlayList" ); 768 config.setGroup( "PlayList" );
835 769
836 config.writeEntry("CurrentPlaylist",filename); 770 config.writeEntry("CurrentPlaylist",filename);
837 config.write(); 771 config.write();
838 currentPlayList=filename; 772 currentPlayList=filename;
839 773
840// m3uList->write(); 774// m3uList->write();
841 m3uList->close(); 775 m3uList->close();
842 if(m3uList) delete m3uList; 776 if(m3uList) delete m3uList;
843 777
844 d->selectedFiles->setSelectedItem( s); 778 d->selectedFiles->setSelectedItem( s);
845 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 779 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName());
846 780
847} 781}
848 782
849/* 783/*
850reads pls and adds files/urls to playlist */ 784reads pls and adds files/urls to playlist */
851void PlayListWidget::readPls( const QString &filename ) { 785void PlayListWidget::readPls( const QString &filename ) {
852 786
853 qDebug( "pls filename is " + filename ); 787 qDebug( "pls filename is " + filename );
854 Om3u *m3uList; 788 Om3u *m3uList;
855 QString s, name; 789 QString s, name;
856 m3uList = new Om3u( filename, IO_ReadOnly ); 790 m3uList = new Om3u( filename, IO_ReadOnly );
857 m3uList->readPls(); 791 m3uList->readPls();
858 792
859 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { 793 for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
860 s = *it; 794 s = *it;
861 // s.replace( QRegExp( "%20" )," " ); 795 // s.replace( QRegExp( "%20" )," " );
862 DocLnk lnk( s ); 796 DocLnk lnk( s );
863 QFileInfo f( s ); 797 QFileInfo f( s );
864 QString name = f.baseName(); 798 QString name = f.baseName();
865 799
866 if( name.left( 4 ) == "http" ) { 800 if( name.left( 4 ) == "http" ) {
867 name = s.right( s.length() - 7); 801 name = s.right( s.length() - 7);
868 } else { 802 } else {
869 name = s; 803 name = s;
870 } 804 }
871 805
872 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); 806 name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
873 807
874 lnk.setName( name ); 808 lnk.setName( name );
875 if( s.at( s.length() - 4) == '.') {// if this is probably a file 809 if( s.at( s.length() - 4) == '.') {// if this is probably a file
876 lnk.setFile( s ); 810 lnk.setFile( s );
877 } else { //if its a url 811 } else { //if its a url
878// if( name.right( 1 ).find( '/' ) == -1) { 812// if( name.right( 1 ).find( '/' ) == -1) {
879// s += "/"; 813// s += "/";
880// } 814// }
881 lnk.setFile( s ); 815 lnk.setFile( s );
882 } 816 }
883 lnk.setType( "audio/x-mpegurl" ); 817 lnk.setType( "audio/x-mpegurl" );
884 818
885 lnk.writeLink(); 819 lnk.writeLink();
886 d->selectedFiles->addToSelection( lnk ); 820 d->selectedFiles->addToSelection( lnk );
887 } 821 }
888 822
889 m3uList->close(); 823 m3uList->close();
890 if(m3uList) delete m3uList; 824 if(m3uList) delete m3uList;
891} 825}
892 826
893/* 827/*
894 writes current playlist to current m3u file */ 828 writes current playlist to current m3u file */
895void PlayListWidget::writeCurrentM3u() { 829void PlayListWidget::writeCurrentM3u() {
896 qDebug("writing to current m3u"); 830 qDebug("writing to current m3u");
897 Config cfg( "OpiePlayer" ); 831 Config cfg( "OpiePlayer" );
898 cfg.setGroup("PlayList"); 832 cfg.setGroup("PlayList");
899 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 833 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
900 834
901 Om3u *m3uList; 835 Om3u *m3uList;
902 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 836 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
903 if( d->selectedFiles->first()) { 837 if( d->selectedFiles->first()) {
904 838
905 do { 839 do {
906 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); 840 // qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
907 m3uList->add( d->selectedFiles->current()->file() ); 841 m3uList->add( d->selectedFiles->current()->file() );
908 } 842 }
909 while ( d->selectedFiles->next() ); 843 while ( d->selectedFiles->next() );
910 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 844 // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
911 m3uList->write(); 845 m3uList->write();
912 m3uList->close(); 846 m3uList->close();
913 847
914 if(m3uList) delete m3uList; 848 if(m3uList) delete m3uList;
915 } 849 }
916 850
917} 851}
918 852
919 /* 853 /*
920 writes current playlist to m3u file */ 854 writes current playlist to m3u file */
921void PlayListWidget::writem3u() { 855void PlayListWidget::writem3u() {
922 InputDialog *fileDlg; 856 InputDialog *fileDlg;
923 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 857 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
924 fileDlg->exec(); 858 fileDlg->exec();
925 QString name, filename, list; 859 QString name, filename, list;
926 Om3u *m3uList; 860 Om3u *m3uList;
927 861
928 if( fileDlg->result() == 1 ) { 862 if( fileDlg->result() == 1 ) {
929 name = fileDlg->text(); 863 name = fileDlg->text();
930// qDebug( filename ); 864// qDebug( filename );
931 865
932 if( name.left( 1) != "/" ) { 866 if( name.left( 1) != "/" ) {
933 filename = QPEApplication::documentDir() + "/" + name; 867 filename = QPEApplication::documentDir() + "/" + name;
934 } 868 }
935 869
936 if( name.right( 3 ) != "m3u" ) { 870 if( name.right( 3 ) != "m3u" ) {
937 filename = QPEApplication::documentDir() + "/" +name+".m3u"; 871 filename = QPEApplication::documentDir() + "/" +name+".m3u";
938 } 872 }
939 873
940 if( d->selectedFiles->first()) { 874 if( d->selectedFiles->first()) {
941 m3uList = new Om3u(filename, IO_ReadWrite); 875 m3uList = new Om3u(filename, IO_ReadWrite);
942 876
943 do { 877 do {
944 m3uList->add( d->selectedFiles->current()->file()); 878 m3uList->add( d->selectedFiles->current()->file());
945 } 879 }
946 while ( d->selectedFiles->next() ); 880 while ( d->selectedFiles->next() );
947 // qDebug( list ); 881 // qDebug( list );
948 m3uList->write(); 882 m3uList->write();
949 m3uList->close(); 883 m3uList->close();
950 if(m3uList) delete m3uList; 884 if(m3uList) delete m3uList;
951 885
952 if(fileDlg) delete fileDlg; 886 if(fileDlg) delete fileDlg;
953 887
954 DocLnk lnk; 888 DocLnk lnk;
955 lnk.setFile( filename); 889 lnk.setFile( filename);
956 lnk.setIcon("opieplayer2/playlist2"); 890 lnk.setIcon("opieplayer2/playlist2");
957 lnk.setName( name); //sets file name 891 lnk.setName( name); //sets file name
958 892
959 // qDebug(filename); 893 // qDebug(filename);
960 Config config( "OpiePlayer" ); 894 Config config( "OpiePlayer" );
961 config.setGroup( "PlayList" ); 895 config.setGroup( "PlayList" );
962 896
963 config.writeEntry("CurrentPlaylist",filename); 897 config.writeEntry("CurrentPlaylist",filename);
964 currentPlayList=filename; 898 currentPlayList=filename;
965 899
966 if(!lnk.writeLink()) { 900 if(!lnk.writeLink()) {
967 qDebug("Writing doclink did not work"); 901 qDebug("Writing doclink did not work");
968 } 902 }
969 903
970 setCaption(tr("OpiePlayer: ") + name); 904 setCaption(tr("OpiePlayer: ") + name);
971 } 905 }
972 } 906 }
973} 907}
974 908
975void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 909void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
976 switch ( e->key() ) { 910 switch ( e->key() ) {
977 ////////////////////////////// Zaurus keys 911 ////////////////////////////// Zaurus keys
978 case Key_F9: //activity 912 case Key_F9: //activity
979 // if(audioUI->isHidden()) 913 // if(audioUI->isHidden())
980 // audioUI->showMaximized(); 914 // audioUI->showMaximized();
981 break; 915 break;
982 case Key_F10: //contacts 916 case Key_F10: //contacts
983 // if( videoUI->isHidden()) 917 // if( videoUI->isHidden())
984 // videoUI->showMaximized(); 918 // videoUI->showMaximized();
985 break; 919 break;
986 case Key_F11: //menu 920 case Key_F11: //menu
987 break; 921 break;
988 case Key_F12: //home 922 case Key_F12: //home
989 // doBlank(); 923 // doBlank();
990 break; 924 break;
991 case Key_F13: //mail 925 case Key_F13: //mail
992 // doUnblank(); 926 // doUnblank();
993 break; 927 break;
994 case Key_Q: //add to playlist 928 case Key_Q: //add to playlist
995 addSelected(); 929 addSelected();
996 break; 930 break;
997 case Key_R: //remove from playlist 931 case Key_R: //remove from playlist
998 removeSelected(); 932 removeSelected();
999 break; 933 break;
1000 // case Key_P: //play 934 // case Key_P: //play
1001 // qDebug("Play"); 935 // qDebug("Play");
1002 // playSelected(); 936 // playSelected();
1003 // break; 937 // break;
1004 case Key_Space: 938 case Key_Space:
1005 // playSelected(); puh 939 // playSelected(); puh
1006 break; 940 break;
1007 case Key_1: 941 case Key_1:
1008 tabWidget->setCurrentPage( 0 ); 942 tabWidget->setCurrentPage( 0 );
1009 break; 943 break;
1010 case Key_2: 944 case Key_2:
1011 tabWidget->setCurrentPage( 1 ); 945 tabWidget->setCurrentPage( 1 );
1012 break; 946 break;
1013 case Key_3: 947 case Key_3:
1014 tabWidget->setCurrentPage( 2 ); 948 tabWidget->setCurrentPage( 2 );
1015 break; 949 break;
1016 case Key_4: 950 case Key_4:
1017 tabWidget->setCurrentPage( 3 ); 951 tabWidget->setCurrentPage( 3 );
1018 break; 952 break;
1019 case Key_Down: 953 case Key_Down:
1020 if ( !d->selectedFiles->next() ) 954 if ( !d->selectedFiles->next() )
1021 d->selectedFiles->first(); 955 d->selectedFiles->first();
1022 break; 956 break;
1023 case Key_Up: 957 case Key_Up:
1024 if ( !d->selectedFiles->prev() ) 958 if ( !d->selectedFiles->prev() )
1025 // d->selectedFiles->last(); 959 // d->selectedFiles->last();
1026 break; 960 break;
1027 } 961 }
1028} 962}
1029 963
1030void PlayListWidget::pmViewActivated(int index) { 964void PlayListWidget::pmViewActivated(int index) {
1031// qDebug("%d", index); 965// qDebug("%d", index);
1032 switch(index) { 966 switch(index) {
1033 case -16: 967 case -16:
1034 { 968 {
1035 mediaPlayerState.toggleFullscreen(); 969 mediaPlayerState.toggleFullscreen();
1036 bool b=mediaPlayerState.isFullscreen(); 970 bool b=mediaPlayerState.isFullscreen();
1037 pmView->setItemChecked( index, b); 971 pmView->setItemChecked( index, b);
1038 Config cfg( "OpiePlayer" ); 972 Config cfg( "OpiePlayer" );
1039 cfg.writeEntry( "FullScreen", b ); 973 cfg.writeEntry( "FullScreen", b );
1040 } 974 }
1041 break; 975 break;
1042 }; 976 };
1043} 977}
1044 978
1045void PlayListWidget::populateSkinsMenu() { 979void PlayListWidget::populateSkinsMenu() {
1046 int item = 0; 980 int item = 0;
1047 defaultSkinIndex = 0; 981 defaultSkinIndex = 0;
1048 QString skinName; 982 QString skinName;
1049 Config cfg( "OpiePlayer" ); 983 Config cfg( "OpiePlayer" );
1050 cfg.setGroup("Options" ); 984 cfg.setGroup("Options" );
1051 QString skin = cfg.readEntry( "Skin", "default" ); 985 QString skin = cfg.readEntry( "Skin", "default" );
1052 986
1053 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); 987 QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" );
1054 skinsDir.setFilter( QDir::Dirs ); 988 skinsDir.setFilter( QDir::Dirs );
1055 skinsDir.setSorting(QDir::Name ); 989 skinsDir.setSorting(QDir::Name );
1056 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 990 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1057 QFileInfoListIterator it( *skinslist ); 991 QFileInfoListIterator it( *skinslist );
1058 QFileInfo *fi; 992 QFileInfo *fi;
1059 while ( ( fi = it.current() ) ) { 993 while ( ( fi = it.current() ) ) {
1060 skinName = fi->fileName(); 994 skinName = fi->fileName();
1061// qDebug( fi->fileName() ); 995// qDebug( fi->fileName() );
1062 if( skinName != "." && skinName != ".." && skinName !="CVS" ) { 996 if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
1063 item = skinsMenu->insertItem( fi->fileName() ) ; 997 item = skinsMenu->insertItem( fi->fileName() ) ;
1064 } 998 }
1065 if( skinName == "default" ) { 999 if( skinName == "default" ) {
1066 defaultSkinIndex = item; 1000 defaultSkinIndex = item;
1067 } 1001 }
1068 if( skinName == skin ) { 1002 if( skinName == skin ) {
1069 skinsMenu->setItemChecked( item, TRUE ); 1003 skinsMenu->setItemChecked( item, TRUE );
1070 } 1004 }
1071 ++it; 1005 ++it;
1072 } 1006 }
1073} 1007}
1074 1008
1075void PlayListWidget::skinsMenuActivated( int item ) { 1009void PlayListWidget::skinsMenuActivated( int item ) {
1076 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { 1010 for(unsigned int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) {
1077 skinsMenu->setItemChecked( i, FALSE ); 1011 skinsMenu->setItemChecked( i, FALSE );
1078 } 1012 }
1079 skinsMenu->setItemChecked( item, TRUE ); 1013 skinsMenu->setItemChecked( item, TRUE );
1080 1014
1081 { 1015 {
1082 Config cfg( "OpiePlayer" ); 1016 Config cfg( "OpiePlayer" );
1083 cfg.setGroup("Options"); 1017 cfg.setGroup("Options");
1084 cfg.writeEntry("Skin", skinsMenu->text( item ) ); 1018 cfg.writeEntry("Skin", skinsMenu->text( item ) );
1085 } 1019 }
1086 1020
1087 emit skinSelected(); 1021 emit skinSelected();
1088} 1022}
1089 1023
1090PlayListWidget::TabType PlayListWidget::currentTab() const 1024PlayListWidget::TabType PlayListWidget::currentTab() const
1091{ 1025{
1092 static const TabType indexToTabType[ TabTypeCount ] = 1026 static const TabType indexToTabType[ TabTypeCount ] =
1093 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists }; 1027 { CurrentPlayList, AudioFiles, VideoFiles, PlayLists };
1094 1028
1095 int index = tabWidget->currentPageIndex(); 1029 int index = tabWidget->currentPageIndex();
1096 assert( index < TabTypeCount && index >= 0 ); 1030 assert( index < TabTypeCount && index >= 0 );
1097 1031
1098 return indexToTabType[ index ]; 1032 return indexToTabType[ index ];
1099} 1033}
1100 1034
1101PlayListWidget::Entry PlayListWidget::currentEntry() const 1035PlayListWidget::Entry PlayListWidget::currentEntry() const
1102{ 1036{
1103 if ( currentTab() == CurrentPlayList ) { 1037 if ( currentTab() == CurrentPlayList ) {
1104 const DocLnk *lnk = current(); 1038 const DocLnk *lnk = current();
1105 return Entry( lnk->name(), lnk->file() ); 1039 return Entry( lnk->name(), lnk->file() );
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index a219cfd..7f851bd 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -1,208 +1,208 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpemenubar.h> 34#include <qpe/qpemenubar.h>
35#include <qpe/qpetoolbar.h> 35#include <qpe/qpetoolbar.h>
36#include <qpe/fileselector.h> 36#include <qpe/fileselector.h>
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#include <qpe/storage.h> 38#include <qpe/storage.h>
39#include <qpe/mimetype.h> 39#include <qpe/mimetype.h>
40#include <qpe/config.h> 40#include <qpe/config.h>
41#include <qpe/global.h> 41#include <qpe/global.h>
42#include <qpe/resource.h> 42#include <qpe/resource.h>
43 43
44#include <qpopupmenu.h> 44#include <qpopupmenu.h>
45#include <qaction.h> 45#include <qaction.h>
46#include <qcursor.h> 46#include <qcursor.h>
47#include <qdir.h> 47#include <qdir.h>
48#include <qlayout.h> 48#include <qlayout.h>
49 49
50#include "playlistselection.h" 50#include "playlistselection.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52#include "mediaplayerstate.h" 52#include "mediaplayerstate.h"
53#include "inputDialog.h" 53#include "inputDialog.h"
54#include "playlistfileview.h" 54#include "playlistfileview.h"
55 55
56//only needed for the random play 56//only needed for the random play
57#include <stdlib.h> 57#include <stdlib.h>
58 58
59#include "audiowidget.h" 59#include "audiowidget.h"
60#include "videowidget.h" 60#include "videowidget.h"
61#include "mediaplayerstate.h" 61#include "mediaplayerstate.h"
62 62
63PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name ) 63PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name )
64 : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) { 64 : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) {
65 65
66 d = new PlayListWidgetPrivate; 66 d = new PlayListWidgetPrivate;
67 d->setDocumentUsed = FALSE; 67 d->setDocumentUsed = FALSE;
68 68
69 setBackgroundMode( PaletteButton ); 69 setBackgroundMode( PaletteButton );
70 setToolBarsMovable( FALSE ); 70 setToolBarsMovable( FALSE );
71 71
72 // Create Toolbar 72 // Create Toolbar
73 QPEToolBar *toolbar = new QPEToolBar( this ); 73 QPEToolBar *toolbar = new QPEToolBar( this );
74 toolbar->setHorizontalStretchable( TRUE ); 74 toolbar->setHorizontalStretchable( TRUE );
75 75
76 // Create Menubar 76 // Create Menubar
77 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 77 QPEMenuBar *menu = new QPEMenuBar( toolbar );
78 menu->setMargin( 0 ); 78 menu->setMargin( 0 );
79 79
80 bar = new QPEToolBar( this ); 80 bar = new QPEToolBar( this );
81 bar->setLabel( tr( "Play Operations" ) ); 81 bar->setLabel( tr( "Play Operations" ) );
82 82
83 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 83 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
84 tbDeletePlaylist->setFlat( TRUE ); 84 tbDeletePlaylist->setFlat( TRUE );
85 tbDeletePlaylist->setFixedSize( 20, 20 ); 85 tbDeletePlaylist->setFixedSize( 20, 20 );
86 86
87 tbDeletePlaylist->hide(); 87 tbDeletePlaylist->hide();
88 88
89 pmPlayList = new QPopupMenu( this ); 89 pmPlayList = new QPopupMenu( this );
90 menu->insertItem( tr( "File" ), pmPlayList ); 90 menu->insertItem( tr( "File" ), pmPlayList );
91 91
92 pmView = new QPopupMenu( this ); 92 pmView = new QPopupMenu( this );
93 menu->insertItem( tr( "View" ), pmView ); 93 menu->insertItem( tr( "View" ), pmView );
94 pmView->isCheckable(); 94 pmView->isCheckable();
95 95
96 skinsMenu = new QPopupMenu( this ); 96 skinsMenu = new QPopupMenu( this );
97 pmView->insertItem( tr( "Skins" ), skinsMenu ); 97 pmView->insertItem( tr( "Skins" ), skinsMenu );
98 skinsMenu->isCheckable(); 98 skinsMenu->isCheckable();
99 99
100 gammaMenu = new QPopupMenu( this ); 100 gammaMenu = new QPopupMenu( this );
101 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 101 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
102 102
103 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 103 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
104 gammaSlider->setRange( -40, 40 ); 104 gammaSlider->setRange( -40, 40 );
105 gammaSlider->setTickmarks( QSlider::Left ); 105 gammaSlider->setTickmarks( QSlider::Left );
106 gammaSlider->setTickInterval( 20 ); 106 gammaSlider->setTickInterval( 20 );
107 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 107 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
108 gammaSlider->setValue( 0 ); 108 gammaSlider->setValue( 0 );
109 gammaSlider->setMinimumHeight( 50 ); 109 gammaSlider->setMinimumHeight( 50 );
110 110
111 gammaLCD = new QLCDNumber( 3, gammaMenu ); 111 gammaLCD = new QLCDNumber( 3, gammaMenu );
112 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 112 gammaLCD-> setFrameShape ( QFrame::NoFrame );
113 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 113 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
114 114
115 gammaMenu->insertItem( gammaSlider ); 115 gammaMenu->insertItem( gammaSlider );
116 gammaMenu->insertItem( gammaLCD ); 116 gammaMenu->insertItem( gammaLCD );
117 117
118 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 118 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) );
119 119
120 vbox5 = new QVBox( this ); 120 vbox5 = new QVBox( this );
121 QVBox *vbox4 = new QVBox( vbox5 ); 121 QVBox *vbox4 = new QVBox( vbox5 );
122 QHBox *hbox6 = new QHBox( vbox4 ); 122 QHBox *hbox6 = new QHBox( vbox4 );
123 123
124 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 124 tabWidget = new QTabWidget( hbox6, "tabWidget" );
125 125
126 QWidget *pTab; 126 QWidget *pTab;
127 pTab = new QWidget( tabWidget, "pTab" ); 127 pTab = new QWidget( tabWidget, "pTab" );
128 tabWidget->insertTab( pTab, "Playlist"); 128 tabWidget->insertTab( pTab, "Playlist");
129 129
130 QGridLayout *Playout = new QGridLayout( pTab ); 130 QGridLayout *Playout = new QGridLayout( pTab );
131 Playout->setSpacing( 2); 131 Playout->setSpacing( 2);
132 Playout->setMargin( 2); 132 Playout->setMargin( 2);
133 133
134 // Add the playlist area 134 // Add the playlist area
135 QVBox *vbox3 = new QVBox( pTab ); 135 QVBox *vbox3 = new QVBox( pTab );
136 d->playListFrame = vbox3; 136 d->playListFrame = vbox3;
137 137
138 QHBox *hbox2 = new QHBox( vbox3 ); 138 QHBox *hbox2 = new QHBox( vbox3 );
139 d->selectedFiles = new PlayListSelection( hbox2 ); 139 d->selectedFiles = new PlayListSelection( hbox2 );
140 140
141 vbox1 = new QVBox( hbox2 ); 141 vbox1 = new QVBox( hbox2 );
142 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 142 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
143 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 143 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
144 144
145 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 145 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
146 146
147 QWidget *aTab; 147 QWidget *aTab;
148 aTab = new QWidget( tabWidget, "aTab" ); 148 aTab = new QWidget( tabWidget, "aTab" );
149 149
150 QGridLayout *Alayout = new QGridLayout( aTab ); 150 QGridLayout *Alayout = new QGridLayout( aTab );
151 Alayout->setSpacing( 2 ); 151 Alayout->setSpacing( 2 );
152 Alayout->setMargin( 2 ); 152 Alayout->setMargin( 2 );
153 // no m3u's here please 153 // no m3u's here please
154 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", aTab, "Audioview" ); 154 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;audio/x-ogg", "opieplayer2/musicfile", aTab, "Audioview" );
155 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 155 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
156 tabWidget->insertTab( aTab, tr( "Audio" ) ); 156 tabWidget->insertTab( aTab, tr( "Audio" ) );
157 157
158 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 158 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
159 159
160 QWidget *vTab; 160 QWidget *vTab;
161 vTab = new QWidget( tabWidget, "vTab" ); 161 vTab = new QWidget( tabWidget, "vTab" );
162 162
163 QGridLayout *Vlayout = new QGridLayout( vTab ); 163 QGridLayout *Vlayout = new QGridLayout( vTab );
164 Vlayout->setSpacing( 2 ); 164 Vlayout->setSpacing( 2 );
165 Vlayout->setMargin( 2 ); 165 Vlayout->setMargin( 2 );
166 videoView = new PlayListFileView( "video/*", vTab, "Videoview" ); 166 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" );
167 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 167 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
168 168
169 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 169 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
170 170
171 tabWidget->insertTab( vTab, tr( "Video" ) ); 171 tabWidget->insertTab( vTab, tr( "Video" ) );
172 172
173 //playlists list 173 //playlists list
174 QWidget *LTab; 174 QWidget *LTab;
175 LTab = new QWidget( tabWidget, "LTab" ); 175 LTab = new QWidget( tabWidget, "LTab" );
176 QGridLayout *Llayout = new QGridLayout( LTab ); 176 QGridLayout *Llayout = new QGridLayout( LTab );
177 Llayout->setSpacing( 2 ); 177 Llayout->setSpacing( 2 );
178 Llayout->setMargin( 2 ); 178 Llayout->setMargin( 2 );
179 179
180 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 180 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
181 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 181 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
182 182
183 tabWidget->insertTab( LTab, tr( "Lists" ) ); 183 tabWidget->insertTab( LTab, tr( "Lists" ) );
184 184
185 setCentralWidget( vbox5 ); 185 setCentralWidget( vbox5 );
186} 186}
187 187
188 188
189 189
190PlayListWidgetGui::~PlayListWidgetGui() { 190PlayListWidgetGui::~PlayListWidgetGui() {
191} 191}
192 192
193void PlayListWidgetGui::setView( char view ) { 193void PlayListWidgetGui::setView( char view ) {
194 if ( view == 'l' ) 194 if ( view == 'l' )
195 showMaximized(); 195 showMaximized();
196 else 196 else
197 hide(); 197 hide();
198} 198}
199 199
200 200
201void PlayListWidgetGui::setActiveWindow() { 201void PlayListWidgetGui::setActiveWindow() {
202 // qDebug("SETTING active window"); 202 // qDebug("SETTING active window");
203 // When we get raised we need to ensure that it switches views 203 // When we get raised we need to ensure that it switches views
204 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType(); 204 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType();
205 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate 205 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
206 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back 206 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back
207} 207}
208 208