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
@@ -15,9 +15,9 @@ int 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;
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
@@ -63,10 +63,10 @@ extern MediaPlayerState *mediaPlayerState;
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() ) );
@@ -75,11 +75,11 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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() ) );
@@ -101,13 +101,13 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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() ) );
@@ -140,18 +140,18 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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;
@@ -171,11 +171,11 @@ PlayListWidget::~PlayListWidget() {
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() {
@@ -403,10 +403,10 @@ void PlayListWidget::setDocument( const QString& fileref ) {
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
@@ -428,9 +428,9 @@ const DocLnk *PlayListWidget::current() const { // this is fugly
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() )
@@ -442,9 +442,9 @@ bool PlayListWidget::prev() {
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 }
@@ -455,13 +455,13 @@ bool PlayListWidget::prev() {
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 }
@@ -529,10 +529,10 @@ void PlayListWidget::removeSelected() {
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
@@ -613,9 +613,9 @@ void PlayListWidget::tabChanged(QWidget *) {
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() {
@@ -1048,10 +1048,10 @@ void 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 }
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
@@ -68,9 +68,9 @@ public:
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;
@@ -133,8 +133,9 @@ private slots:
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
@@ -58,12 +58,10 @@
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
@@ -220,9 +218,9 @@ void PlayListWidgetGui::setView( char view ) {
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
@@ -48,8 +48,9 @@
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;
@@ -94,9 +95,9 @@ public:
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;
@@ -121,8 +122,9 @@ protected:
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