author | simon <simon> | 2002-12-02 23:31:57 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 23:31:57 (UTC) |
commit | 22e232bdb4bae5e28013a4d14bfda3c068827557 (patch) (unidiff) | |
tree | bcefd6ed54318bb075cd71455b82236606634cd4 /noncore/multimedia/opieplayer2/mediaplayer.cpp | |
parent | 24a00c944aace8d7627c1eb0d7cc0ebf40731c57 (diff) | |
download | opie-22e232bdb4bae5e28013a4d14bfda3c068827557.zip opie-22e232bdb4bae5e28013a4d14bfda3c068827557.tar.gz opie-22e232bdb4bae5e28013a4d14bfda3c068827557.tar.bz2 |
- yay, last singleton gone. global playList variable is no more :)
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index a9c74c4..8acc488 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -24,14 +24,12 @@ | |||
24 | #include <sys/ioctl.h> | 24 | #include <sys/ioctl.h> |
25 | 25 | ||
26 | 26 | ||
27 | extern VideoWidget *videoUI; | ||
28 | extern PlayListWidget *playList; | ||
29 | 27 | ||
30 | 28 | ||
31 | #define FBIOBLANK 0x4611 | 29 | #define FBIOBLANK 0x4611 |
32 | 30 | ||
33 | MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 31 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
34 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) { | 32 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { |
35 | 33 | ||
36 | audioUI = 0; | 34 | audioUI = 0; |
37 | videoUI = 0; | 35 | videoUI = 0; |
@@ -39,7 +37,7 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, | |||
39 | recreateAudioAndVideoWidgets(); | 37 | recreateAudioAndVideoWidgets(); |
40 | 38 | ||
41 | fd=-1;fl=-1; | 39 | fd=-1;fl=-1; |
42 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); | 40 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); |
43 | 41 | ||
44 | qApp->processEvents(); | 42 | qApp->processEvents(); |
45 | // QPEApplication::grabKeyboard(); // EVIL | 43 | // QPEApplication::grabKeyboard(); // EVIL |
@@ -57,7 +55,7 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, | |||
57 | Config cfg( "OpiePlayer" ); | 55 | Config cfg( "OpiePlayer" ); |
58 | cfg.setGroup("PlayList"); | 56 | cfg.setGroup("PlayList"); |
59 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 57 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
60 | playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 58 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
61 | } | 59 | } |
62 | 60 | ||
63 | MediaPlayer::~MediaPlayer() { | 61 | MediaPlayer::~MediaPlayer() { |
@@ -87,7 +85,7 @@ void MediaPlayer::setPlaying( bool play ) { | |||
87 | } | 85 | } |
88 | 86 | ||
89 | QString tickerText, time, fileName; | 87 | QString tickerText, time, fileName; |
90 | if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) { | 88 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { |
91 | //if playing in file list.. play in a different way | 89 | //if playing in file list.. play in a different way |
92 | // random and looping settings enabled causes problems here, | 90 | // random and looping settings enabled causes problems here, |
93 | // since there is no selected file in the playlist, but a selected file in the file list, | 91 | // since there is no selected file in the playlist, but a selected file in the file list, |
@@ -100,7 +98,7 @@ void MediaPlayer::setPlaying( bool play ) { | |||
100 | mediaPlayerState.setShuffled( false ); | 98 | mediaPlayerState.setShuffled( false ); |
101 | } | 99 | } |
102 | 100 | ||
103 | PlayListWidget::Entry playListEntry = playList->currentEntry(); | 101 | PlayListWidget::Entry playListEntry = playList.currentEntry(); |
104 | fileName = playListEntry.name; | 102 | fileName = playListEntry.name; |
105 | xineControl->play( playListEntry.file ); | 103 | xineControl->play( playListEntry.file ); |
106 | 104 | ||
@@ -126,11 +124,11 @@ void MediaPlayer::setPlaying( bool play ) { | |||
126 | 124 | ||
127 | 125 | ||
128 | void MediaPlayer::prev() { | 126 | void MediaPlayer::prev() { |
129 | if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist | 127 | if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist |
130 | if ( playList->prev() ) { | 128 | if ( playList.prev() ) { |
131 | play(); | 129 | play(); |
132 | } else if ( mediaPlayerState.isLooping() ) { | 130 | } else if ( mediaPlayerState.isLooping() ) { |
133 | if ( playList->last() ) { | 131 | if ( playList.last() ) { |
134 | play(); | 132 | play(); |
135 | } | 133 | } |
136 | } else { | 134 | } else { |
@@ -142,11 +140,11 @@ void MediaPlayer::prev() { | |||
142 | 140 | ||
143 | void MediaPlayer::next() { | 141 | void MediaPlayer::next() { |
144 | 142 | ||
145 | if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist | 143 | if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist |
146 | if ( playList->next() ) { | 144 | if ( playList.next() ) { |
147 | play(); | 145 | play(); |
148 | } else if ( mediaPlayerState.isLooping() ) { | 146 | } else if ( mediaPlayerState.isLooping() ) { |
149 | if ( playList->first() ) { | 147 | if ( playList.first() ) { |
150 | play(); | 148 | play(); |
151 | } | 149 | } |
152 | } else { | 150 | } else { |
@@ -339,7 +337,7 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | |||
339 | void MediaPlayer::cleanUp() {// this happens on closing | 337 | void MediaPlayer::cleanUp() {// this happens on closing |
340 | Config cfg( "OpiePlayer" ); | 338 | Config cfg( "OpiePlayer" ); |
341 | mediaPlayerState.writeConfig( cfg ); | 339 | mediaPlayerState.writeConfig( cfg ); |
342 | playList->writeDefaultPlaylist( ); | 340 | playList.writeDefaultPlaylist( ); |
343 | 341 | ||
344 | // QPEApplication::grabKeyboard(); | 342 | // QPEApplication::grabKeyboard(); |
345 | // QPEApplication::ungrabKeyboard(); | 343 | // QPEApplication::ungrabKeyboard(); |
@@ -350,8 +348,8 @@ void MediaPlayer::recreateAudioAndVideoWidgets() | |||
350 | delete xineControl; | 348 | delete xineControl; |
351 | delete audioUI; | 349 | delete audioUI; |
352 | delete videoUI; | 350 | delete videoUI; |
353 | audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" ); | 351 | audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); |
354 | videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" ); | 352 | videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); |
355 | 353 | ||
356 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 354 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
357 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 355 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |