author | llornkcor <llornkcor> | 2002-04-27 15:32:47 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-27 15:32:47 (UTC) |
commit | d0a9aaaca068af74d845743b0bf4f13f6f179f27 (patch) (side-by-side diff) | |
tree | 4b4c83adeb464aca2e5a8439ba82d0494db6859e | |
parent | 320532727fc7dfbe9760d0eea0e17b8e1230fc8e (diff) | |
download | opie-d0a9aaaca068af74d845743b0bf4f13f6f179f27.zip opie-d0a9aaaca068af74d845743b0bf4f13f6f179f27.tar.gz opie-d0a9aaaca068af74d845743b0bf4f13f6f179f27.tar.bz2 |
fix bug
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index aa48961..ac8c935 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp @@ -215,156 +215,153 @@ void AudioWidget::paintButton( QPainter *p, int i ) { p->drawPixmap( x + offset, y + offset, *pixmaps[2], 18 * i, 0, 18, 18 ); } 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 ); } } 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); qDebug("button toggled1 %d",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); qDebug("button toggled2 %d",i); } } else { if ( audioButtons[i].isHeld ) { audioButtons[i].isHeld = FALSE; if ( !audioButtons[i].isToggle ) setToggleButton( i, FALSE ); qDebug("button toggled3 %d",i); 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; } } } } } void AudioWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { mouseMoveEvent( event ); } void AudioWidget::showEvent( QShowEvent* ) { QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); mouseMoveEvent( &event ); } void AudioWidget::closeEvent( QCloseEvent* ) { mediaPlayerState->setList(); } void AudioWidget::paintEvent( QPaintEvent * ) { QPainter p( this ); for ( int i = 0; i < numButtons; i++ ) paintButton( &p, i ); } -void AudioWidget::showMe() { - show(); -} void AudioWidget::keyReleaseEvent( QKeyEvent *e) { switch ( e->key() ) { ////////////////////////////// Zaurus keys case Key_Home: break; case Key_F9: //activity hide(); // qDebug("Audio F9"); break; case Key_F10: //contacts break; case Key_F11: //menu break; case Key_F12: //home break; case Key_F13: //mail break; case Key_Space: { if(mediaPlayerState->playing()) { // toggleButton(1); mediaPlayerState->setPlaying(FALSE); // toggleButton(1); } else { // toggleButton(0); mediaPlayerState->setPlaying(TRUE); // toggleButton(0); } } break; case Key_Down: toggleButton(6); emit lessClicked(); emit lessReleased(); toggleButton(6); break; case Key_Up: toggleButton(5); emit moreClicked(); emit moreReleased(); toggleButton(5); break; case Key_Right: // toggleButton(3); mediaPlayerState->setNext(); // toggleButton(3); break; case Key_Left: // toggleButton(4); mediaPlayerState->setPrev(); // toggleButton(4); break; case Key_Escape: break; }; } |