author | simon <simon> | 2002-12-09 16:45:41 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 16:45:41 (UTC) |
commit | dbe0046eb82c8ee61ce7fc704d3b376730abc17f (patch) (unidiff) | |
tree | d8729a7844dc889024090afe1ffac1c6f3a3ab1b /noncore/multimedia/opieplayer2/videowidget.cpp | |
parent | 1bb6aa52f2db85f65f75278310c328218caeae65 (diff) | |
download | opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.zip opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.gz opie-dbe0046eb82c8ee61ce7fc704d3b376730abc17f.tar.bz2 |
- yay, mouseMoveEvent is no more duplicated code :)
Diffstat (limited to 'noncore/multimedia/opieplayer2/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index cc586cc..41844e1 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -234,64 +234,24 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
234 | int width = slider->width(); | 234 | int width = slider->width(); |
235 | int val = int((double)i * width / max); | 235 | int val = int((double)i * width / max); |
236 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 236 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
237 | if ( slider->value() != val ) { | 237 | if ( slider->value() != val ) { |
238 | slider->setValue( val ); | 238 | slider->setValue( val ); |
239 | } | 239 | } |
240 | if ( slider->maxValue() != width ) { | 240 | if ( slider->maxValue() != width ) { |
241 | slider->setMaxValue( width ); | 241 | slider->setMaxValue( width ); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | ||
247 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | ||
248 | Button &button = *it; | ||
249 | Command command = button.command; | ||
250 | |||
251 | if ( event->state() == QMouseEvent::LeftButton ) { | ||
252 | // The test to see if the mouse click is inside the button or not | ||
253 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command ); | ||
254 | |||
255 | if ( isOnButton && !button.isHeld ) { | ||
256 | button.isHeld = TRUE; | ||
257 | toggleButton( button ); | ||
258 | |||
259 | switch ( command ) { | ||
260 | case VolumeUp: | ||
261 | emit moreClicked(); | ||
262 | return; | ||
263 | case VolumeDown: | ||
264 | emit lessClicked(); | ||
265 | return; | ||
266 | default: break; | ||
267 | } | ||
268 | } else if ( !isOnButton && button.isHeld ) { | ||
269 | button.isHeld = FALSE; | ||
270 | toggleButton( button ); | ||
271 | } | ||
272 | } else { | ||
273 | |||
274 | if ( button.isHeld ) { | ||
275 | button.isHeld = FALSE; | ||
276 | if ( button.type != ToggleButton ) { | ||
277 | setToggleButton( button, FALSE ); | ||
278 | } | ||
279 | |||
280 | handleCommand( command, button.isDown ); | ||
281 | } | ||
282 | } | ||
283 | } | ||
284 | } | ||
285 | |||
286 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 246 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
287 | mouseMoveEvent( event ); | 247 | mouseMoveEvent( event ); |
288 | } | 248 | } |
289 | 249 | ||
290 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 250 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
291 | if ( mediaPlayerState.isFullscreen() ) { | 251 | if ( mediaPlayerState.isFullscreen() ) { |
292 | mediaPlayerState.setFullscreen( FALSE ); | 252 | mediaPlayerState.setFullscreen( FALSE ); |
293 | makeVisible(); | 253 | makeVisible(); |
294 | } | 254 | } |
295 | mouseMoveEvent( event ); | 255 | mouseMoveEvent( event ); |
296 | } | 256 | } |
297 | 257 | ||