summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index b82171e..1fae689 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -224,134 +224,134 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
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 ) {
if (mediaPlayerState->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 );
showMaximized();
} else {
killTimers();
hide();
}
}
static QString timeAsString( long length ) {
length /= 44100;
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 ) );
if ( max == 0 ) {
return;
}
// Will flicker too much if we don't do this
// Scale to something reasonable
- int width = slider->width();
+ int width = slider.width();
int val = int((double)i * width / max);
if ( !audioSliderBeingMoved ) {
- if ( slider->value() != val ) {
- slider->setValue( val );
+ if ( slider.value() != val ) {
+ slider.setValue( val );
}
- if ( slider->maxValue() != width ) {
- slider->setMaxValue( width );
+ 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);
paintButton ( &p, i );
}
void AudioWidget::paintButton( QPainter *p, int i ) {
if ( audioButtons[i].isDown )
p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
else
p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
}
void AudioWidget::timerEvent( QTimerEvent * ) {
// static int frame = 0;
// if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
// frame = frame >= 7 ? 0 : frame + 1;
// }
}
void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( int i = 0; i < numButtons; i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
int x = event->pos().x() - xoff;
int y = event->pos().y() - yoff;
bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
&& y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 );
if ( isOnButton && i == AudioVolumeUp )
qDebug("on up");