summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 6b656ee..dc90a62 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -256,115 +256,116 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
xoff = ( w - imgUp->width() ) / 2;
yoff = (( h - imgUp->height() ) / 2) - 10;
QPoint p( xoff, yoff );
QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
for ( int i = 0; i < 11; i++ ) {
if ( !masks[i]->isNull() ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
}
}
delete pixUp;
delete pixDn;
}
static bool audioSliderBeingMoved = FALSE;
void AudioWidget::sliderPressed() {
audioSliderBeingMoved = TRUE;
}
void AudioWidget::sliderReleased() {
audioSliderBeingMoved = FALSE;
if ( slider.width() == 0 )
return;
long val = long((double)slider.value() * mediaPlayerState->length() / slider.width());
mediaPlayerState->setPosition( val );
}
void AudioWidget::setPosition( long i ) {
// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
updateSlider( i, mediaPlayerState->length() );
}
void AudioWidget::setLength( long max ) {
updateSlider( mediaPlayerState->position(), max );
}
void AudioWidget::setView( char view ) {
- slider.show();
// this isnt working for some reason
-// if ( mediaPlayerState->streaming() ) {
-// qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
-// if( !slider.isHidden()) slider.hide();
-// disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
-// disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
-// } else {
+ if ( mediaPlayerState->streaming() ) {
+ qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
+ if( !slider.isHidden()) {
+ slider.hide();
+ }
+ disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
+ disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
+ } else {
// this stops the slider from being moved, thus
// does not stop stream when it reaches the end
- // slider.show();
+ slider.show();
connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
-// }
+ }
if ( view == 'a' ) {
- startTimer( 150 );
+ // startTimer( 150 );
showMaximized();
} else {
killTimers();
hide();
}
}
static QString timeAsString( long length ) {
int minutes = length / 60;
int seconds = length % 60;
return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 );
}
void AudioWidget::updateSlider( long i, long max ) {
time.setText( timeAsString( i ) + " / " + timeAsString( max ) );
// qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ;
if ( max == 0 ) {
return;
}
// Will flicker too much if we don't do this
// Scale to something reasonable
int width = slider.width();
int val = int((double)i * width / max);
if ( !audioSliderBeingMoved ) {
if ( slider.value() != val ) {
slider.setValue( val );
}
if ( slider.maxValue() != width ) {
slider.setMaxValue( width );
}
}
}
void AudioWidget::setToggleButton( int i, bool down ) {
if ( down != audioButtons[i].isDown ) {
toggleButton( i );
}
}
void AudioWidget::toggleButton( int i ) {
audioButtons[i].isDown = !audioButtons[i].isDown;
QPainter p(this);