Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 5411a64..8d8e4e5 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -12,4 +12,5 @@ #include "playlistwidget.h" #include "audiowidget.h" +#include "volumecontrol.h" #include "mediaplayerstate.h" @@ -40,7 +41,11 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); + volControl = new VolumeControl; + } MediaPlayer::~MediaPlayer() { + delete xineControl; + delete volControl; } @@ -126,7 +131,5 @@ void MediaPlayer::startDecreasingVolume() { volumeDirection = -1; startTimer( 100 ); - // da kommt demnächst osound denk ich mal - /////////////////////////// lets just move those change volume here - // AudioDevice::decreaseVolume(); + volControl->decVol(2); } @@ -135,5 +138,5 @@ void MediaPlayer::startIncreasingVolume() { volumeDirection = +1; startTimer( 100 ); - // AudioDevice::increaseVolume(); + volControl->incVol(2); } @@ -155,18 +158,19 @@ void MediaPlayer::stopChangingVolume() { void MediaPlayer::timerEvent( QTimerEvent * ) { - // if ( volumeDirection == +1 ) - // AudioDevice::increaseVolume(); - // else if ( volumeDirection == -1 ) - // AudioDevice::decreaseVolume(); + if ( volumeDirection == +1 ) { + volControl->incVol(2); + } else if ( volumeDirection == -1 ) { + volControl->decVol(2); + } -// Display an on-screen display volume - unsigned int l, r, v; bool m; // TODO FIXME -// AudioDevice::getVolume( l, r, m ); -// v = ((l + r) * 11) / (2*0xFFFF); + int v; + v = volControl->getVolume(); + v = v / 10; - if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) + if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { return; + } int w = audioUI->width(); @@ -174,7 +178,8 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { if ( drawnOnScreenDisplay ) { - if ( onScreenDisplayVolume > v ) + if ( onScreenDisplayVolume > v ) { audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); } + } drawnOnScreenDisplay = TRUE; @@ -192,10 +197,11 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { for ( unsigned int i = 0; i < 10; i++ ) { - if ( v > i ) + if ( v > i ) { p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); - else + } else { p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); } } +} void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |