summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/main.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp48
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.h4
5 files changed, 35 insertions, 34 deletions
diff --git a/noncore/multimedia/opieplayer2/main.cpp b/noncore/multimedia/opieplayer2/main.cpp
index 24aba6c..02fdbf3 100644
--- a/noncore/multimedia/opieplayer2/main.cpp
+++ b/noncore/multimedia/opieplayer2/main.cpp
@@ -7,25 +7,25 @@
7#include "mediaplayer.h" 7#include "mediaplayer.h"
8 8
9MediaPlayerState *mediaPlayerState; 9MediaPlayerState *mediaPlayerState;
10PlayListWidget *playList; 10PlayListWidget *playList;
11AudioWidget *audioUI; 11AudioWidget *audioUI;
12VideoWidget *videoUI; 12VideoWidget *videoUI;
13 13
14int main(int argc, char **argv) { 14int main(int argc, char **argv) {
15 QPEApplication a(argc,argv); 15 QPEApplication a(argc,argv);
16 16
17 MediaPlayerState st( 0, "mediaPlayerState" ); 17 MediaPlayerState st( 0, "mediaPlayerState" );
18 mediaPlayerState = &st; 18 mediaPlayerState = &st;
19 PlayListWidget pl( 0, "playList" ); 19 PlayListWidget pl( st, 0, "playList" );
20 playList = &pl; 20 playList = &pl;
21 pl.showMaximized(); 21 pl.showMaximized();
22 AudioWidget aw( 0, "audioUI" ); 22 AudioWidget aw( 0, "audioUI" );
23 audioUI = &aw; 23 audioUI = &aw;
24 VideoWidget vw( 0, "videoUI" ); 24 VideoWidget vw( 0, "videoUI" );
25 videoUI = &vw; 25 videoUI = &vw;
26 a.processEvents(); 26 a.processEvents();
27 MediaPlayer mp( st, 0, "mediaPlayer" ); 27 MediaPlayer mp( st, 0, "mediaPlayer" );
28 28
29 a.showMainDocumentWidget(&pl); 29 a.showMainDocumentWidget(&pl);
30 30
31 return a.exec(); 31 return a.exec();
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index b08204e..7ba342b 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -55,67 +55,67 @@
55#include <assert.h> 55#include <assert.h>
56 56
57#include "audiowidget.h" 57#include "audiowidget.h"
58#include "videowidget.h" 58#include "videowidget.h"
59 59
60extern MediaPlayerState *mediaPlayerState; 60extern MediaPlayerState *mediaPlayerState;
61// extern AudioWidget *audioUI; 61// extern AudioWidget *audioUI;
62// extern VideoWidget *videoUI; 62// extern VideoWidget *videoUI;
63 63
64QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; 64QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
65// no m3u's here please 65// no m3u's here please
66 66
67PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 67PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
68 : PlayListWidgetGui( parent, name, fl ) { 68 : PlayListWidgetGui( mediaPlayerState, parent, name ) {
69 69
70 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 70 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
71 "opieplayer2/add_to_playlist", 71 "opieplayer2/add_to_playlist",
72 this , SLOT(addSelected() ) ); 72 this , SLOT(addSelected() ) );
73 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 73 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
74 "opieplayer2/remove_from_playlist", 74 "opieplayer2/remove_from_playlist",
75 this , SLOT(removeSelected() ) ); 75 this , SLOT(removeSelected() ) );
76 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 76 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
77 this , SLOT( btnPlay( bool) ), TRUE ); 77 this , SLOT( btnPlay( bool) ), TRUE );
78 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 78 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
79 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 79 &mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE );
80 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 80 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
81 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 81 &mediaPlayerState, SLOT( setLooping( bool ) ), TRUE );
82 82
83 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 83 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
84 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 84 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
85 this, SLOT( addAllMusicToList() ) ); 85 this, SLOT( addAllMusicToList() ) );
86 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 86 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
87 this, SLOT( addAllVideoToList() ) ); 87 this, SLOT( addAllVideoToList() ) );
88 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 88 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
89 this, SLOT( addAllToList() ) ); 89 this, SLOT( addAllToList() ) );
90 pmPlayList->insertSeparator(-1); 90 pmPlayList->insertSeparator(-1);
91// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), 91// (void)new MenuItem( pmPlayList, tr( "Save PlayList" ),
92// this, SLOT( saveList() ) ); 92// this, SLOT( saveList() ) );
93 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 93 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
94 this, SLOT(writem3u() ) ); 94 this, SLOT(writem3u() ) );
95 pmPlayList->insertSeparator(-1); 95 pmPlayList->insertSeparator(-1);
96 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 96 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
97 this,SLOT( openFile() ) ); 97 this,SLOT( openFile() ) );
98 pmPlayList->insertSeparator(-1); 98 pmPlayList->insertSeparator(-1);
99 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 99 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
100 this,SLOT( scanForAudio() ) ); 100 this,SLOT( scanForAudio() ) );
101 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 101 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
102 this,SLOT( scanForVideo() ) ); 102 this,SLOT( scanForVideo() ) );
103 103
104 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 104 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
105 mediaPlayerState, SLOT( toggleFullscreen() ) ); 105 &mediaPlayerState, SLOT( toggleFullscreen() ) );
106 106
107 Config cfg( "OpiePlayer" ); 107 Config cfg( "OpiePlayer" );
108 bool b= cfg.readBoolEntry("FullScreen", 0); 108 bool b= cfg.readBoolEntry("FullScreen", 0);
109 mediaPlayerState->setFullscreen( b ); 109 mediaPlayerState.setFullscreen( b );
110 pmView->setItemChecked( -16, b ); 110 pmView->setItemChecked( -16, b );
111 111
112 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 112 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
113 d->selectedFiles, SLOT(moveSelectedUp() ) ); 113 d->selectedFiles, SLOT(moveSelectedUp() ) );
114 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 114 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
115 d->selectedFiles, SLOT(removeSelected() ) ); 115 d->selectedFiles, SLOT(removeSelected() ) );
116 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 116 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
117 d->selectedFiles, SLOT(moveSelectedDown() ) ); 117 d->selectedFiles, SLOT(moveSelectedDown() ) );
118 // QVBox *stretch2 = new QVBox( vbox1 ); 118 // QVBox *stretch2 = new QVBox( vbox1 );
119 119
120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 120 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
121 SLOT( deletePlaylist() ) ); 121 SLOT( deletePlaylist() ) );
@@ -132,58 +132,58 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 132 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
133 this, SLOT( addToSelection( QListViewItem *) ) ); 133 this, SLOT( addToSelection( QListViewItem *) ) );
134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 134 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 135 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 136 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
137 this,SLOT( playIt( QListViewItem *) ) ); 137 this,SLOT( playIt( QListViewItem *) ) );
138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 138 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
139 this, SLOT( addToSelection( QListViewItem *) ) ); 139 this, SLOT( addToSelection( QListViewItem *) ) );
140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 140 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
141 this, SLOT( loadList( const DocLnk & ) ) ); 141 this, SLOT( loadList( const DocLnk & ) ) );
142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 142 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
143 this, SLOT( tabChanged( QWidget* ) ) ); 143 this, SLOT( tabChanged( QWidget* ) ) );
144 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), 144 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ),
145 d->tbPlay, SLOT( setOn( bool ) ) ); 145 d->tbPlay, SLOT( setOn( bool ) ) );
146 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 146 connect( &mediaPlayerState, SIGNAL( loopingToggled( bool ) ),
147 d->tbLoop, SLOT( setOn( bool ) ) ); 147 d->tbLoop, SLOT( setOn( bool ) ) );
148 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 148 connect( &mediaPlayerState, SIGNAL( shuffledToggled( bool ) ),
149 d->tbShuffle, SLOT( setOn( bool ) ) ); 149 d->tbShuffle, SLOT( setOn( bool ) ) );
150 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 150 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
151 this, SLOT( playIt( QListViewItem *) ) ); 151 this, SLOT( playIt( QListViewItem *) ) );
152 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 152 connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
153 mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 153 &mediaPlayerState, SLOT( setVideoGamma( int ) ) );
154 154
155 // see which skins are installed 155 // see which skins are installed
156 videoScan=false; 156 videoScan=false;
157 audioScan=false; 157 audioScan=false;
158 audioPopulated=false; 158 audioPopulated=false;
159 videoPopulated=false; 159 videoPopulated=false;
160 populateSkinsMenu(); 160 populateSkinsMenu();
161 initializeStates(); 161 initializeStates();
162 162
163 cfg.setGroup("PlayList"); 163 cfg.setGroup("PlayList");
164 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 164 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
165 loadList(DocLnk( currentPlaylist ) ); 165 loadList(DocLnk( currentPlaylist ) );
166} 166}
167 167
168 168
169PlayListWidget::~PlayListWidget() { 169PlayListWidget::~PlayListWidget() {
170 delete d; 170 delete d;
171} 171}
172 172
173 173
174void PlayListWidget::initializeStates() { 174void PlayListWidget::initializeStates() {
175 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 175 d->tbPlay->setOn( mediaPlayerState.isPlaying() );
176 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 176 d->tbLoop->setOn( mediaPlayerState.isLooping() );
177 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 177 d->tbShuffle->setOn( mediaPlayerState.isShuffled() );
178 d->playListFrame->show(); 178 d->playListFrame->show();
179} 179}
180 180
181void PlayListWidget::writeDefaultPlaylist() { 181void PlayListWidget::writeDefaultPlaylist() {
182 182
183 Config config( "OpiePlayer" ); 183 Config config( "OpiePlayer" );
184 config.setGroup( "PlayList" ); 184 config.setGroup( "PlayList" );
185 QString filename=QPEApplication::documentDir() + "/default.m3u"; 185 QString filename=QPEApplication::documentDir() + "/default.m3u";
186 QString currentString = config.readEntry( "CurrentPlaylist", filename); 186 QString currentString = config.readEntry( "CurrentPlaylist", filename);
187 if( currentString == filename) { 187 if( currentString == filename) {
188 Om3u *m3uList; 188 Om3u *m3uList;
189 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 189 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
@@ -395,81 +395,81 @@ void PlayListWidget::setDocument( const QString& fileref ) {
395 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) { 395 } else if( DocLnk( fileref).file().find( "m3u", 0, TRUE) != -1 ) {
396 readm3u( DocLnk( fileref).file() ); 396 readm3u( DocLnk( fileref).file() );
397 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls 397 } else if( fileref.find( "pls", 0, TRUE) != -1 ) { //is pls
398 readPls( fileref ); 398 readPls( fileref );
399 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) { 399 } else if( DocLnk( fileref).file().find( "pls", 0, TRUE) != -1 ) {
400 readPls( DocLnk( fileref).file() ); 400 readPls( DocLnk( fileref).file() );
401 } else { 401 } else {
402 clearList(); 402 clearList();
403 addToSelection( DocLnk( fileref ) ); 403 addToSelection( DocLnk( fileref ) );
404 writeCurrentM3u(); 404 writeCurrentM3u();
405 405
406 d->setDocumentUsed = TRUE; 406 d->setDocumentUsed = TRUE;
407 mediaPlayerState->setPlaying( FALSE ); 407 mediaPlayerState.setPlaying( FALSE );
408 mediaPlayerState->setPlaying( TRUE ); 408 mediaPlayerState.setPlaying( TRUE );
409 } 409 }
410} 410}
411 411
412 412
413void PlayListWidget::useSelectedDocument() { 413void PlayListWidget::useSelectedDocument() {
414 d->setDocumentUsed = FALSE; 414 d->setDocumentUsed = FALSE;
415} 415}
416 416
417 417
418const DocLnk *PlayListWidget::current() const { // this is fugly 418const DocLnk *PlayListWidget::current() const { // this is fugly
419 assert( currentTab() == CurrentPlayList ); 419 assert( currentTab() == CurrentPlayList );
420 420
421 const DocLnk *lnk = d->selectedFiles->current(); 421 const DocLnk *lnk = d->selectedFiles->current();
422 if ( !lnk ) { 422 if ( !lnk ) {
423 d->selectedFiles->first(); 423 d->selectedFiles->first();
424 lnk = d->selectedFiles->current(); 424 lnk = d->selectedFiles->current();
425 } 425 }
426 assert( lnk ); 426 assert( lnk );
427 return lnk; 427 return lnk;
428} 428}
429 429
430 430
431bool PlayListWidget::prev() { 431bool PlayListWidget::prev() {
432 if ( mediaPlayerState->isShuffled() ) { 432 if ( mediaPlayerState.isShuffled() ) {
433 const DocLnk *cur = current(); 433 const DocLnk *cur = current();
434 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 434 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
435 for ( int i = 0; i < j; i++ ) { 435 for ( int i = 0; i < j; i++ ) {
436 if ( !d->selectedFiles->next() ) 436 if ( !d->selectedFiles->next() )
437 d->selectedFiles->first(); 437 d->selectedFiles->first();
438 } 438 }
439 if ( cur == current() ) 439 if ( cur == current() )
440 if ( !d->selectedFiles->next() ) { 440 if ( !d->selectedFiles->next() ) {
441 d->selectedFiles->first(); 441 d->selectedFiles->first();
442 } 442 }
443 return TRUE; 443 return TRUE;
444 } else { 444 } else {
445 if ( !d->selectedFiles->prev() ) { 445 if ( !d->selectedFiles->prev() ) {
446 if ( mediaPlayerState->isLooping() ) { 446 if ( mediaPlayerState.isLooping() ) {
447 return d->selectedFiles->last(); 447 return d->selectedFiles->last();
448 } else { 448 } else {
449 return FALSE; 449 return FALSE;
450 } 450 }
451 } 451 }
452 return TRUE; 452 return TRUE;
453 } 453 }
454} 454}
455 455
456 456
457bool PlayListWidget::next() { 457bool PlayListWidget::next() {
458//qDebug("<<<<<<<<<<<<next()"); 458//qDebug("<<<<<<<<<<<<next()");
459 if ( mediaPlayerState->isShuffled() ) { 459 if ( mediaPlayerState.isShuffled() ) {
460 return prev(); 460 return prev();
461 } else { 461 } else {
462 if ( !d->selectedFiles->next() ) { 462 if ( !d->selectedFiles->next() ) {
463 if ( mediaPlayerState->isLooping() ) { 463 if ( mediaPlayerState.isLooping() ) {
464 return d->selectedFiles->first(); 464 return d->selectedFiles->first();
465 } else { 465 } else {
466 return FALSE; 466 return FALSE;
467 } 467 }
468 } 468 }
469 return TRUE; 469 return TRUE;
470 } 470 }
471} 471}
472 472
473 473
474bool PlayListWidget::first() { 474bool PlayListWidget::first() {
475 return d->selectedFiles->first(); 475 return d->selectedFiles->first();
@@ -521,26 +521,26 @@ void PlayListWidget::addSelected() {
521 writeCurrentM3u(); 521 writeCurrentM3u();
522} 522}
523 523
524 524
525void PlayListWidget::removeSelected() { 525void PlayListWidget::removeSelected() {
526 d->selectedFiles->removeSelected( ); 526 d->selectedFiles->removeSelected( );
527 writeCurrentM3u(); 527 writeCurrentM3u();
528} 528}
529 529
530 530
531void PlayListWidget::playIt( QListViewItem *it) { 531void PlayListWidget::playIt( QListViewItem *it) {
532 if(!it) return; 532 if(!it) return;
533 mediaPlayerState->setPlaying(FALSE); 533 mediaPlayerState.setPlaying(FALSE);
534 mediaPlayerState->setPlaying(TRUE); 534 mediaPlayerState.setPlaying(TRUE);
535 d->selectedFiles->unSelect(); 535 d->selectedFiles->unSelect();
536} 536}
537 537
538 538
539void PlayListWidget::addToSelection( QListViewItem *it) { 539void PlayListWidget::addToSelection( QListViewItem *it) {
540 d->setDocumentUsed = FALSE; 540 d->setDocumentUsed = FALSE;
541 541
542 if(it) { 542 if(it) {
543 if ( currentTab() == CurrentPlayList ) 543 if ( currentTab() == CurrentPlayList )
544 return; 544 return;
545 // case 1: { 545 // case 1: {
546 DocLnk lnk; 546 DocLnk lnk;
@@ -605,25 +605,25 @@ void PlayListWidget::tabChanged(QWidget *) {
605 playLists->reread(); 605 playLists->reread();
606 d->tbAddToList->setEnabled(FALSE); 606 d->tbAddToList->setEnabled(FALSE);
607 607
608 d->tbPlay->setEnabled( false ); 608 d->tbPlay->setEnabled( false );
609 } 609 }
610 break; 610 break;
611 }; 611 };
612} 612}
613 613
614 614
615void PlayListWidget::btnPlay(bool b) { 615void PlayListWidget::btnPlay(bool b) {
616// mediaPlayerState->setPlaying(false); 616// mediaPlayerState->setPlaying(false);
617 mediaPlayerState->setPlaying(b); 617 mediaPlayerState.setPlaying(b);
618 insanityBool=FALSE; 618 insanityBool=FALSE;
619} 619}
620 620
621void PlayListWidget::deletePlaylist() { 621void PlayListWidget::deletePlaylist() {
622 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 622 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
623 (tr("You really want to delete\nthis playlist?")), 623 (tr("You really want to delete\nthis playlist?")),
624 (tr("Yes")), (tr("No")), 0 )){ 624 (tr("Yes")), (tr("No")), 0 )){
625 case 0: // Yes clicked, 625 case 0: // Yes clicked,
626 QFile().remove(playLists->selectedDocument().file()); 626 QFile().remove(playLists->selectedDocument().file());
627 QFile().remove(playLists->selectedDocument().linkFile()); 627 QFile().remove(playLists->selectedDocument().linkFile());
628 playLists->reread(); 628 playLists->reread();
629 break; 629 break;
@@ -1040,26 +1040,26 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
1040 case Key_Up: 1040 case Key_Up:
1041 if ( !d->selectedFiles->prev() ) 1041 if ( !d->selectedFiles->prev() )
1042 // d->selectedFiles->last(); 1042 // d->selectedFiles->last();
1043 break; 1043 break;
1044 } 1044 }
1045} 1045}
1046 1046
1047void PlayListWidget::pmViewActivated(int index) { 1047void PlayListWidget::pmViewActivated(int index) {
1048// qDebug("%d", index); 1048// qDebug("%d", index);
1049 switch(index) { 1049 switch(index) {
1050 case -16: 1050 case -16:
1051 { 1051 {
1052 mediaPlayerState->toggleFullscreen(); 1052 mediaPlayerState.toggleFullscreen();
1053 bool b=mediaPlayerState->isFullscreen(); 1053 bool b=mediaPlayerState.isFullscreen();
1054 pmView->setItemChecked( index, b); 1054 pmView->setItemChecked( index, b);
1055 Config cfg( "OpiePlayer" ); 1055 Config cfg( "OpiePlayer" );
1056 cfg.writeEntry( "FullScreen", b ); 1056 cfg.writeEntry( "FullScreen", b );
1057 } 1057 }
1058 break; 1058 break;
1059 }; 1059 };
1060} 1060}
1061 1061
1062void PlayListWidget::populateSkinsMenu() { 1062void PlayListWidget::populateSkinsMenu() {
1063 int item = 0; 1063 int item = 0;
1064 defaultSkinIndex = 0; 1064 defaultSkinIndex = 0;
1065 QString skinName; 1065 QString skinName;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index fa2837a..3f52e63 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -60,25 +60,25 @@ public:
60 60
61 struct Entry 61 struct Entry
62 { 62 {
63 Entry( const QString &_name, const QString &_fileName ) 63 Entry( const QString &_name, const QString &_fileName )
64 : name( _name ), file( _fileName ) {} 64 : name( _name ), file( _fileName ) {}
65 Entry( const QString &_fileName ) 65 Entry( const QString &_fileName )
66 : name( _fileName ), file( _fileName ) {} 66 : name( _fileName ), file( _fileName ) {}
67 67
68 QString name; 68 QString name;
69 QString file; 69 QString file;
70 }; 70 };
71 71
72 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 72 PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 );
73 ~PlayListWidget(); 73 ~PlayListWidget();
74 DocLnkSet files; 74 DocLnkSet files;
75 DocLnkSet vFiles; 75 DocLnkSet vFiles;
76 bool fromSetDocument; 76 bool fromSetDocument;
77 bool insanityBool; 77 bool insanityBool;
78 QString setDocFileRef, currentPlayList; 78 QString setDocFileRef, currentPlayList;
79 // retrieve the current playlist entry (media file link) 79 // retrieve the current playlist entry (media file link)
80 const DocLnk *current() const; 80 const DocLnk *current() const;
81 void useSelectedDocument(); 81 void useSelectedDocument();
82 int selected; 82 int selected;
83 TabType currentTab() const; 83 TabType currentTab() const;
84 84
@@ -125,16 +125,17 @@ private slots:
125 void addAllVideoToList(); 125 void addAllVideoToList();
126 void saveList(); // Save the playlist 126 void saveList(); // Save the playlist
127 void loadList( const DocLnk &); // Load a playlist 127 void loadList( const DocLnk &); // Load a playlist
128 void playIt( QListViewItem *); 128 void playIt( QListViewItem *);
129 void btnPlay(bool); 129 void btnPlay(bool);
130 void deletePlaylist(); 130 void deletePlaylist();
131 void addSelected(); 131 void addSelected();
132 void removeSelected(); 132 void removeSelected();
133 void tabChanged(QWidget*); 133 void tabChanged(QWidget*);
134 void viewPressed( int, QListViewItem *, const QPoint&, int); 134 void viewPressed( int, QListViewItem *, const QPoint&, int);
135 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 135 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
136 void playSelected(); 136 void playSelected();
137
137}; 138};
138 139
139#endif // PLAY_LIST_WIDGET_H 140#endif // PLAY_LIST_WIDGET_H
140 141
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 8be7a2f..f47ddcc 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -50,28 +50,26 @@
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 54
55//only needed for the random play 55//only needed for the random play
56#include <stdlib.h> 56#include <stdlib.h>
57 57
58#include "audiowidget.h" 58#include "audiowidget.h"
59#include "videowidget.h" 59#include "videowidget.h"
60#include "mediaplayerstate.h" 60#include "mediaplayerstate.h"
61 61
62extern MediaPlayerState *mediaPlayerState; 62PlayListWidgetGui::PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent, const char* name )
63 63 : QMainWindow( parent, name ), mediaPlayerState( _mediaPlayerState ) {
64PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl )
65 : QMainWindow( parent, name, fl ) {
66 64
67 d = new PlayListWidgetPrivate; 65 d = new PlayListWidgetPrivate;
68 d->setDocumentUsed = FALSE; 66 d->setDocumentUsed = FALSE;
69 67
70 setBackgroundMode( PaletteButton ); 68 setBackgroundMode( PaletteButton );
71 setToolBarsMovable( FALSE ); 69 setToolBarsMovable( FALSE );
72 70
73 // Create Toolbar 71 // Create Toolbar
74 QPEToolBar *toolbar = new QPEToolBar( this ); 72 QPEToolBar *toolbar = new QPEToolBar( this );
75 toolbar->setHorizontalStretchable( TRUE ); 73 toolbar->setHorizontalStretchable( TRUE );
76 74
77 // Create Menubar 75 // Create Menubar
@@ -212,17 +210,17 @@ PlayListWidgetGui::~PlayListWidgetGui() {
212 210
213void PlayListWidgetGui::setView( char view ) { 211void PlayListWidgetGui::setView( char view ) {
214 if ( view == 'l' ) 212 if ( view == 'l' )
215 showMaximized(); 213 showMaximized();
216 else 214 else
217 hide(); 215 hide();
218} 216}
219 217
220 218
221void PlayListWidgetGui::setActiveWindow() { 219void PlayListWidgetGui::setActiveWindow() {
222 // qDebug("SETTING active window"); 220 // qDebug("SETTING active window");
223 // When we get raised we need to ensure that it switches views 221 // When we get raised we need to ensure that it switches views
224 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); 222 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState.displayType();
225 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate 223 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
226 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back 224 mediaPlayerState.setDisplayType( origDisplayType ); // now switch back
227} 225}
228 226
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.h b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
index 4eefb93..9b5252a 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.h
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.h
@@ -40,24 +40,25 @@
40#include <qpe/qpemenubar.h> 40#include <qpe/qpemenubar.h>
41 41
42#include <qtabwidget.h> 42#include <qtabwidget.h>
43#include <qpe/fileselector.h> 43#include <qpe/fileselector.h>
44#include <qpushbutton.h> 44#include <qpushbutton.h>
45#include <qpopupmenu.h> 45#include <qpopupmenu.h>
46#include <qaction.h> 46#include <qaction.h>
47#include <qslider.h> 47#include <qslider.h>
48#include <qlcdnumber.h> 48#include <qlcdnumber.h>
49 49
50class PlayListWidgetPrivate; 50class PlayListWidgetPrivate;
51class PlayListSelection; 51class PlayListSelection;
52class MediaPlayerState;
52 53
53class Config; 54class Config;
54class QPEToolBar; 55class QPEToolBar;
55class QListViewItem; 56class QListViewItem;
56class QListView; 57class QListView;
57class QPoint; 58class QPoint;
58class QAction; 59class QAction;
59class QLabel; 60class QLabel;
60 61
61class PlayListWidgetPrivate { 62class PlayListWidgetPrivate {
62public: 63public:
63 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 64 QToolButton *tbPlay, *tbFull, *tbLoop, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
@@ -86,25 +87,25 @@ class MenuItem : public QAction {
86 87
87public: 88public:
88 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 89 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
89 : QAction( text, QString::null, 0, 0 ) { 90 : QAction( text, QString::null, 0, 0 ) {
90 connect( this, SIGNAL( activated() ), handler, slot ); 91 connect( this, SIGNAL( activated() ), handler, slot );
91 addTo( parent ); 92 addTo( parent );
92 } 93 }
93}; 94};
94 95
95class PlayListWidgetGui : public QMainWindow { 96class PlayListWidgetGui : public QMainWindow {
96 Q_OBJECT 97 Q_OBJECT
97public: 98public:
98 PlayListWidgetGui( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 99 PlayListWidgetGui( MediaPlayerState &_mediaPlayerState, QWidget* parent=0, const char* name=0 );
99 ~PlayListWidgetGui(); 100 ~PlayListWidgetGui();
100 101
101protected: 102protected:
102 QTabWidget * tabWidget; 103 QTabWidget * tabWidget;
103 QListView *audioView, *videoView, *playlistView; 104 QListView *audioView, *videoView, *playlistView;
104 QLabel *libString; 105 QLabel *libString;
105 QPopupMenu *pmView ; 106 QPopupMenu *pmView ;
106 QPopupMenu *gammaMenu; 107 QPopupMenu *gammaMenu;
107 QSlider *gammaSlider; 108 QSlider *gammaSlider;
108 QLCDNumber *gammaLCD; 109 QLCDNumber *gammaLCD;
109 bool fromSetDocument; 110 bool fromSetDocument;
110 bool insanityBool; 111 bool insanityBool;
@@ -113,16 +114,17 @@ protected:
113 QPushButton *tbDeletePlaylist; 114 QPushButton *tbDeletePlaylist;
114 int selected; 115 int selected;
115 QPopupMenu *pmPlayList; 116 QPopupMenu *pmPlayList;
116 FileSelector* playLists; 117 FileSelector* playLists;
117 QPopupMenu *skinsMenu; 118 QPopupMenu *skinsMenu;
118 PlayListWidgetPrivate *d; // Private implementation data 119 PlayListWidgetPrivate *d; // Private implementation data
119 QVBox *vbox1; 120 QVBox *vbox1;
120 QVBox *vbox5; 121 QVBox *vbox5;
121 QPEToolBar *bar; 122 QPEToolBar *bar;
122 void setActiveWindow(); // need to handle this to show the right view 123 void setActiveWindow(); // need to handle this to show the right view
123 void setView( char ); 124 void setView( char );
124 125
126 MediaPlayerState &mediaPlayerState;
125}; 127};
126 128
127#endif 129#endif
128 130