Diffstat (limited to 'core/multimedia/opieplayer/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 3901446..cda3f77 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -199,62 +199,64 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
199 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); | 199 | p.drawPixmap( x + 14, y + 8, *pixmaps[3], 32 * frame, 0, 32, 32 ); |
200 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); | 200 | p.drawPixmap( x + 37, y + 37, *pixmaps[2], 18 * AudioPlay, 0, 6, 3 ); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 205 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
206 | for ( int i = 0; i < numButtons; i++ ) { | 206 | for ( int i = 0; i < numButtons; i++ ) { |
207 | int size = audioButtons[i].isBig; | 207 | int size = audioButtons[i].isBig; |
208 | int x = audioButtons[i].xPos; | 208 | int x = audioButtons[i].xPos; |
209 | int y = audioButtons[i].yPos; | 209 | int y = audioButtons[i].yPos; |
210 | if ( event->state() == QMouseEvent::LeftButton ) { | 210 | if ( event->state() == QMouseEvent::LeftButton ) { |
211 | // The test to see if the mouse click is inside the circular button or not | 211 | // The test to see if the mouse click is inside the circular button or not |
212 | // (compared with the radius squared to avoid a square-root of our distance) | 212 | // (compared with the radius squared to avoid a square-root of our distance) |
213 | int radius = 32 + 13 * size; | 213 | int radius = 32 + 13 * size; |
214 | QPoint center = QPoint( x + radius, y + radius ); | 214 | QPoint center = QPoint( x + radius, y + radius ); |
215 | QPoint dXY = center - event->pos(); | 215 | QPoint dXY = center - event->pos(); |
216 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 216 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
217 | bool isOnButton = dist <= (radius * radius); | 217 | bool isOnButton = dist <= (radius * radius); |
218 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); | 218 | // QRect r( x, y, 64 + 22*size, 64 + 22*size ); |
219 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code | 219 | // bool isOnButton = r.contains( event->pos() ); // Rectangular Button code |
220 | if ( isOnButton && !audioButtons[i].isHeld ) { | 220 | if ( isOnButton && !audioButtons[i].isHeld ) { |
221 | audioButtons[i].isHeld = TRUE; | 221 | audioButtons[i].isHeld = TRUE; |
222 | toggleButton(i); | 222 | toggleButton(i); |
223 | qDebug("button toggled %d",i); | 223 | qDebug("button toggled1 %d",i); |
224 | switch (i) { | 224 | switch (i) { |
225 | case AudioVolumeUp: emit moreClicked(); return; | 225 | case AudioVolumeUp: emit moreClicked(); return; |
226 | case AudioVolumeDown: emit lessClicked(); return; | 226 | case AudioVolumeDown: emit lessClicked(); return; |
227 | } | 227 | } |
228 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 228 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
229 | audioButtons[i].isHeld = FALSE; | 229 | audioButtons[i].isHeld = FALSE; |
230 | toggleButton(i); | 230 | toggleButton(i); |
231 | qDebug("button toggled2 %d",i); | ||
231 | } | 232 | } |
232 | } else { | 233 | } else { |
233 | if ( audioButtons[i].isHeld ) { | 234 | if ( audioButtons[i].isHeld ) { |
234 | audioButtons[i].isHeld = FALSE; | 235 | audioButtons[i].isHeld = FALSE; |
235 | if ( !audioButtons[i].isToggle ) | 236 | if ( !audioButtons[i].isToggle ) |
236 | setToggleButton( i, FALSE ); | 237 | setToggleButton( i, FALSE ); |
238 | qDebug("button toggled3 %d",i); | ||
237 | switch (i) { | 239 | switch (i) { |
238 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; | 240 | case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; |
239 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 241 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
240 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; | 242 | case AudioPause: mediaPlayerState->setPaused(audioButtons[i].isDown); return; |
241 | case AudioNext: mediaPlayerState->setNext(); return; | 243 | case AudioNext: mediaPlayerState->setNext(); return; |
242 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 244 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
243 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 245 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
244 | case AudioVolumeUp: emit moreReleased(); return; | 246 | case AudioVolumeUp: emit moreReleased(); return; |
245 | case AudioVolumeDown: emit lessReleased(); return; | 247 | case AudioVolumeDown: emit lessReleased(); return; |
246 | case AudioPlayList: mediaPlayerState->setList(); return; | 248 | case AudioPlayList: mediaPlayerState->setList(); return; |
247 | } | 249 | } |
248 | } | 250 | } |
249 | } | 251 | } |
250 | } | 252 | } |
251 | } | 253 | } |
252 | 254 | ||
253 | 255 | ||
254 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 256 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
255 | mouseMoveEvent( event ); | 257 | mouseMoveEvent( event ); |
256 | } | 258 | } |
257 | 259 | ||
258 | 260 | ||
259 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 261 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
260 | mouseMoveEvent( event ); | 262 | mouseMoveEvent( event ); |