summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/audiowidget.cpp
authorllornkcor <llornkcor>2002-02-24 21:51:51 (UTC)
committer llornkcor <llornkcor>2002-02-24 21:51:51 (UTC)
commit36b768c465c6ecddceb57ff1d7a5087e9848c897 (patch) (side-by-side diff)
tree4ddde589e2393ca136e24cda4fc456612149ae72 /core/multimedia/opieplayer/audiowidget.cpp
parentade25ac278169f0e0c9ee0771e754adb46cf7ce2 (diff)
downloadopie-36b768c465c6ecddceb57ff1d7a5087e9848c897.zip
opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.tar.gz
opie-36b768c465c6ecddceb57ff1d7a5087e9848c897.tar.bz2
changed mediaplayerplugininterface.h location
Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp122
1 files changed, 61 insertions, 61 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp
index 243c58c..0d88591 100644
--- a/core/multimedia/opieplayer/audiowidget.cpp
+++ b/core/multimedia/opieplayer/audiowidget.cpp
@@ -61,7 +61,7 @@ static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
QWidget( parent, name, f )
{
- setCaption( tr("MediaPlayer") );
+ setCaption( tr("OpiePlayer") );
setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) );
pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsAll" ) );
pixmaps[1] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButtonsBig" ) );
@@ -104,7 +104,7 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
AudioWidget::~AudioWidget() {
for ( int i = 0; i < 4; i++ )
- delete pixmaps[i];
+ delete pixmaps[i];
}
@@ -119,7 +119,7 @@ void AudioWidget::sliderPressed() {
void AudioWidget::sliderReleased() {
audioSliderBeingMoved = FALSE;
if ( slider->width() == 0 )
- return;
+ return;
long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
mediaPlayerState->setPosition( val );
}
@@ -137,34 +137,34 @@ void AudioWidget::setLength( long max ) {
void AudioWidget::setView( char view ) {
if ( view == 'a' ) {
- startTimer( 150 );
- showMaximized();
+ startTimer( 150 );
+ showMaximized();
} else {
- killTimers();
- hide();
+ killTimers();
+ hide();
}
}
void AudioWidget::updateSlider( long i, long max ) {
if ( max == 0 )
- return;
+ 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 );
+ 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 );
+ toggleButton( i );
}
@@ -188,61 +188,61 @@ void AudioWidget::paintButton( QPainter *p, int i ) {
void AudioWidget::timerEvent( QTimerEvent * ) {
static int frame = 0;
if ( !mediaPlayerState->paused() && audioButtons[ AudioPlay ].isDown ) {
- frame = frame >= 7 ? 0 : frame + 1;
- int x = audioButtons[AudioPlay].xPos;
- int y = audioButtons[AudioPlay].yPos;
- QPainter p( this );
- // Optimize to only draw the little bit of the changing images which is different
- p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 );
- p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 );
+ frame = frame >= 7 ? 0 : frame + 1;
+ int x = audioButtons[AudioPlay].xPos;
+ int y = audioButtons[AudioPlay].yPos;
+ QPainter p( this );
+ // Optimize to only draw the little bit of the changing images which is different
+ p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 );
+ p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 );
}
}
void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( int i = 0; i < numButtons; i++ ) {
- int size = audioButtons[i].isBig;
- int x = audioButtons[i].xPos;
- int y = audioButtons[i].yPos;
- if ( event->state() == QMouseEvent::LeftButton ) {
- // The test to see if the mouse click is inside the circular button or not
- // (compared with the radius squared to avoid a square-root of our distance)
- int radius = 32 + 13 * size;
- QPoint center = QPoint( x + radius, y + radius );
- QPoint dXY = center - event->pos();
- int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
- bool isOnButton = dist <= (radius * radius);
-// QRect r( x, y, 64 + 22*size, 64 + 22*size );
-// bool isOnButton = r.contains( event->pos() ); // Rectangular Button code
- if ( isOnButton && !audioButtons[i].isHeld ) {
- audioButtons[i].isHeld = TRUE;
- toggleButton(i);
- switch (i) {
+ int size = audioButtons[i].isBig;
+ int x = audioButtons[i].xPos;
+ int y = audioButtons[i].yPos;
+ if ( event->state() == QMouseEvent::LeftButton ) {
+ // The test to see if the mouse click is inside the circular button or not
+ // (compared with the radius squared to avoid a square-root of our distance)
+ int radius = 32 + 13 * size;
+ QPoint center = QPoint( x + radius, y + radius );
+ QPoint dXY = center - event->pos();
+ int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
+ bool isOnButton = dist <= (radius * radius);
+// QRect r( x, y, 64 + 22*size, 64 + 22*size );
+// bool isOnButton = r.contains( event->pos() ); // Rectangular Button code
+ if ( isOnButton && !audioButtons[i].isHeld ) {
+ audioButtons[i].isHeld = TRUE;
+ toggleButton(i);
+ switch (i) {
case AudioVolumeUp: emit moreClicked(); return;
case AudioVolumeDown: emit lessClicked(); return;
- }
- } else if ( !isOnButton && audioButtons[i].isHeld ) {
- audioButtons[i].isHeld = FALSE;
- toggleButton(i);
- }
- } else {
- if ( audioButtons[i].isHeld ) {
- audioButtons[i].isHeld = FALSE;
- if ( !audioButtons[i].isToggle )
- setToggleButton( i, FALSE );
- switch (i) {
- case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
- case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
- case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return;
- case AudioNext: mediaPlayerState->setNext(); return;
- case AudioPrevious: mediaPlayerState->setPrev(); return;
- case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
- case AudioVolumeUp: emit moreReleased(); return;
- case AudioVolumeDown: emit lessReleased(); return;
- case AudioPlayList: mediaPlayerState->setList(); return;
- }
- }
- }
+ }
+ } else if ( !isOnButton && audioButtons[i].isHeld ) {
+ audioButtons[i].isHeld = FALSE;
+ toggleButton(i);
+ }
+ } else {
+ if ( audioButtons[i].isHeld ) {
+ audioButtons[i].isHeld = FALSE;
+ if ( !audioButtons[i].isToggle )
+ setToggleButton( i, FALSE );
+ switch (i) {
+ case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return;
+ case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
+ case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return;
+ case AudioNext: mediaPlayerState->setNext(); return;
+ case AudioPrevious: mediaPlayerState->setPrev(); return;
+ case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
+ case AudioVolumeUp: emit moreReleased(); return;
+ case AudioVolumeDown: emit lessReleased(); return;
+ case AudioPlayList: mediaPlayerState->setList(); return;
+ }
+ }
+ }
}
}
@@ -271,7 +271,7 @@ void AudioWidget::closeEvent( QCloseEvent* ) {
void AudioWidget::paintEvent( QPaintEvent * ) {
QPainter p( this );
for ( int i = 0; i < numButtons; i++ )
- paintButton( &p, i );
+ paintButton( &p, i );
}