summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayer.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp32
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
@@ -21,28 +21,26 @@
// for setBacklight()
#include <linux/fb.h>
#include <sys/file.h>
#include <sys/ioctl.h>
-extern VideoWidget *videoUI;
-extern PlayListWidget *playList;
#define FBIOBLANK 0x4611
-MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
- : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ) {
+MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
+ : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
audioUI = 0;
videoUI = 0;
xineControl = 0;
recreateAudioAndVideoWidgets();
fd=-1;fl=-1;
- playList->setCaption( tr( "OpiePlayer: Initializating" ) );
+ playList.setCaption( tr( "OpiePlayer: Initializating" ) );
qApp->processEvents();
// QPEApplication::grabKeyboard(); // EVIL
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
@@ -54,13 +52,13 @@ MediaPlayer::MediaPlayer( MediaPlayerState &_mediaPlayerState, QObject *parent,
connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
volControl = new VolumeControl;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
- playList->setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
+ playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
}
MediaPlayer::~MediaPlayer() {
delete xineControl;
delete volControl;
}
@@ -84,26 +82,26 @@ void MediaPlayer::setPlaying( bool play ) {
if ( mediaPlayerState.isPaused() ) {
mediaPlayerState.setPaused( FALSE );
return;
}
QString tickerText, time, fileName;
- if ( playList->currentTab() != PlayListWidget::CurrentPlayList ) {
+ if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
//if playing in file list.. play in a different way
// random and looping settings enabled causes problems here,
// since there is no selected file in the playlist, but a selected file in the file list,
// so we remember and shutoff
l = mediaPlayerState.isLooping();
if(l) {
mediaPlayerState.setLooping( false );
}
r = mediaPlayerState.isShuffled();
mediaPlayerState.setShuffled( false );
}
- PlayListWidget::Entry playListEntry = playList->currentEntry();
+ PlayListWidget::Entry playListEntry = playList.currentEntry();
fileName = playListEntry.name;
xineControl->play( playListEntry.file );
long seconds = mediaPlayerState.length();
time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
@@ -123,33 +121,33 @@ void MediaPlayer::setPlaying( bool play ) {
}
audioUI->setTickerText( tickerText );
}
void MediaPlayer::prev() {
- if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
- if ( playList->prev() ) {
+ if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
+ if ( playList.prev() ) {
play();
} else if ( mediaPlayerState.isLooping() ) {
- if ( playList->last() ) {
+ if ( playList.last() ) {
play();
}
} else {
mediaPlayerState.setList();
}
}
}
void MediaPlayer::next() {
- if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
- if ( playList->next() ) {
+ if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
+ if ( playList.next() ) {
play();
} else if ( mediaPlayerState.isLooping() ) {
- if ( playList->first() ) {
+ if ( playList.first() ) {
play();
}
} else {
mediaPlayerState.setList();
}
} else { //if playing from file list, let's just stop
@@ -336,25 +334,25 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
}
}
void MediaPlayer::cleanUp() {// this happens on closing
Config cfg( "OpiePlayer" );
mediaPlayerState.writeConfig( cfg );
- playList->writeDefaultPlaylist( );
+ playList.writeDefaultPlaylist( );
// QPEApplication::grabKeyboard();
// QPEApplication::ungrabKeyboard();
}
void MediaPlayer::recreateAudioAndVideoWidgets()
{
delete xineControl;
delete audioUI;
delete videoUI;
- audioUI = new AudioWidget( mediaPlayerState, 0, "audioUI" );
- videoUI = new VideoWidget( mediaPlayerState, 0, "videoUI" );
+ audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
+ videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );