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 | |||
@@ -222,88 +222,48 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | |||
222 | 222 | ||
223 | // Effectively blank the view next time we show it so it looks nicer | 223 | // Effectively blank the view next time we show it so it looks nicer |
224 | scaledWidth = 0; | 224 | scaledWidth = 0; |
225 | scaledHeight = 0; | 225 | scaledHeight = 0; |
226 | hide(); | 226 | hide(); |
227 | } | 227 | } |
228 | 228 | ||
229 | void VideoWidget::updateSlider( long i, long max ) { | 229 | void VideoWidget::updateSlider( long i, long max ) { |
230 | // Will flicker too much if we don't do this | 230 | // Will flicker too much if we don't do this |
231 | if ( max == 0 ) { | 231 | if ( max == 0 ) { |
232 | return; | 232 | return; |
233 | } | 233 | } |
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 | ||
298 | void VideoWidget::showEvent( QShowEvent* ) { | 258 | void VideoWidget::showEvent( QShowEvent* ) { |
299 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 259 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
300 | mouseMoveEvent( &event ); | 260 | mouseMoveEvent( &event ); |
301 | } | 261 | } |
302 | 262 | ||
303 | 263 | ||
304 | void VideoWidget::backToNormal() { | 264 | void VideoWidget::backToNormal() { |
305 | mediaPlayerState.setFullscreen( FALSE ); | 265 | mediaPlayerState.setFullscreen( FALSE ); |
306 | makeVisible(); | 266 | makeVisible(); |
307 | } | 267 | } |
308 | 268 | ||
309 | void VideoWidget::makeVisible() { | 269 | void VideoWidget::makeVisible() { |