summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp190
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h16
2 files changed, 103 insertions, 103 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index fb375f0..fbcd775 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -115,3 +115,2 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
115 } 115 }
116
117 } 116 }
@@ -130,3 +129,4 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
130 slider->setFocusPolicy( QWidget::NoFocus ); 129 slider->setFocusPolicy( QWidget::NoFocus );
131 slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 130
131 resizeEvent( NULL );
132 132
@@ -134,8 +134,4 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
134 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 134 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
135
136 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 135 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
137 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
138 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
139 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 136 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
140
141 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 137 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
@@ -145,4 +141,2 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
145 setPosition( mediaPlayerState->position() ); 141 setPosition( mediaPlayerState->position() );
146
147 ////////////////////////// FIXME
148 setFullscreen( mediaPlayerState->fullscreen() ); 142 setFullscreen( mediaPlayerState->fullscreen() );
@@ -150,3 +144,2 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
150 setPlaying( mediaPlayerState->playing() ); 144 setPlaying( mediaPlayerState->playing() );
151 qDebug("finished videowidget");
152} 145}
@@ -155,3 +148,3 @@ QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) {
155VideoWidget::~VideoWidget() { 148VideoWidget::~VideoWidget() {
156 mediaPlayerState->setPlaying( FALSE ); 149
157 for ( int i = 0; i < 7; i++ ) { 150 for ( int i = 0; i < 7; i++ ) {
@@ -168,3 +161,3 @@ VideoWidget::~VideoWidget() {
168 } 161 }
169 162
170} 163}
@@ -192,5 +185,5 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
192 //videoFrame->width(); 185 //videoFrame->width();
193// songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) );
194 186
195 slider->setFixedWidth( w - 110 ); 187
188 slider->setFixedWidth( w - 20 );
196 slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); 189 slider->setGeometry( QRect( 15, h - 30, w - 90, 20 ) );
@@ -200,3 +193,2 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
200 193
201// time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
202 xoff = 0;// ( imgUp->width() ) / 2; 194 xoff = 0;// ( imgUp->width() ) / 2;
@@ -247,2 +239,18 @@ void VideoWidget::setLength( long max ) {
247void VideoWidget::setView( char view ) { 239void VideoWidget::setView( char view ) {
240
241 if ( mediaPlayerState->streaming() ) {
242 qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>");
243 if( !slider->isHidden()) {
244 slider->hide();
245 }
246 disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
247 disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
248 } else {
249 // this stops the slider from being moved, thus
250 // does not stop stream when it reaches the end
251 slider->show();
252 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
253 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
254 }
255
248 if ( view == 'v' ) { 256 if ( view == 'v' ) {
@@ -288,6 +296,7 @@ void VideoWidget::paintButton( QPainter *p, int i ) {
288 296
289 if ( videoButtons[i].isDown ) 297 if ( videoButtons[i].isDown ) {
290 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 298 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
291 else 299 } else {
292 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 300 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
301 }
293} 302}
@@ -297,3 +306,3 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
297 if ( event->state() == QMouseEvent::LeftButton ) { 306 if ( event->state() == QMouseEvent::LeftButton ) {
298 // The test to see if the mouse click is inside the button or not 307 // The test to see if the mouse click is inside the button or not
299 int x = event->pos().x() - xoff; 308 int x = event->pos().x() - xoff;
@@ -302,44 +311,25 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
302 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 311 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
303 && y < imgButtonMask->height() && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 312 && y < imgButtonMask->height()
304 if ( isOnButton != videoButtons[i].isHeld ) { 313 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
305 videoButtons[i].isHeld = isOnButton; 314
315 if ( isOnButton && !videoButtons[i].isHeld ) {
316 videoButtons[i].isHeld = TRUE;
306 toggleButton(i); 317 toggleButton(i);
307 } 318
308
309// qDebug("mouseMove event switch1 %d", i);
310 if( isOnButton)
311 switch (i) { 319 switch (i) {
312 case VideoStop:{ 320 case VideoVolUp:
313 setToggleButton( i, FALSE ); 321 qDebug("more clicked");
314 mediaPlayerState->setStop(TRUE); 322 emit moreClicked();
315 mediaPlayerState->setPlaying(FALSE); 323 return;
316 return; 324 case VideoVolDown:
317 } 325 qDebug("less clicked");
318 case VideoPlay: { 326 emit lessClicked();
319 327 return;
320 if( mediaPlayerState->isPaused) { 328 }
321 setToggleButton( i, FALSE ); 329 } else if ( !isOnButton && videoButtons[i].isHeld ) {
322 mediaPlayerState->setPaused( FALSE); 330 videoButtons[i].isHeld = FALSE;
323 return; 331 toggleButton(i);
324 } 332 }
325 else if( mediaPlayerState->isPlaying) {
326 setToggleButton( i, TRUE );
327 mediaPlayerState->setPaused( TRUE);
328 return;
329 }
330 else {
331 setToggleButton( i, FALSE );
332 mediaPlayerState->setPlaying( videoButtons[i].isDown );
333 return;
334 }
335 }
336 case VideoNext: qDebug("next"); mediaPlayerState->setNext(); return;
337 case VideoPrevious: qDebug("previous"); mediaPlayerState->setPrev(); return;
338 case VideoVolUp: return;
339 case VideoVolDown: return;
340 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
341
342 };
343
344 } else { 333 } else {
334
345 if ( videoButtons[i].isHeld ) { 335 if ( videoButtons[i].isHeld ) {
@@ -348,20 +338,31 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
348 setToggleButton( i, FALSE ); 338 setToggleButton( i, FALSE );
339 qDebug("button toggled3 %d",i);
349 } 340 }
350// qDebug("mouseMove event switch2 %d %d", i, VideoPlay); 341
351 switch (i) { 342 switch(i) {
352 case VideoPlay: { 343
353 if( mediaPlayerState->isPaused) { 344 case VideoPlay: {
354 mediaPlayerState->setPaused( FALSE); return; } 345 if( mediaPlayerState->isPaused ) {
355 else if( mediaPlayerState->isPlaying) { 346 qDebug("play again clicked");
356 mediaPlayerState->setPaused( TRUE); return; } 347 setToggleButton( i, FALSE );
357 else 348 mediaPlayerState->setPaused( FALSE );
358 mediaPlayerState->setPlaying( TRUE /*videoButtons[i].isDown*/ ); return; 349 return;
359 } 350 } else if( !mediaPlayerState->isPaused ) {
360 case VideoStop: mediaPlayerState->setPlaying(FALSE); return; 351 qDebug("pause now clicked");
352 setToggleButton( i, TRUE );
353 mediaPlayerState->setPaused( TRUE );
354 return;
355 } else {
356 // setToggleButton( i, TRUE );
357 // mediaPlayerState->setPlaying( videoButtons[i].isDown );
358 }
359 }
360
361 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
361// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; 362// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
362 case VideoNext: mediaPlayerState->setNext(); return; 363 case VideoNext: mediaPlayerState->setNext(); return;
363 case VideoPrevious: mediaPlayerState->setPrev(); return; 364 case VideoPrevious: mediaPlayerState->setPrev(); return;
364 case VideoVolUp: return; 365 case VideoVolUp: emit moreReleased(); return;
365 case VideoVolDown: return; 366 case VideoVolDown: emit lessReleased(); return;
366 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 367 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
367 } 368 }
@@ -385,2 +386,7 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
385 386
387void VideoWidget::showEvent( QShowEvent* ) {
388 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
389 mouseMoveEvent( &event );
390}
391
386 392
@@ -392,5 +398,5 @@ void VideoWidget::makeVisible() {
392 slider->hide(); 398 slider->hide();
393 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 399 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
394 } else { 400 } else {
395 showNormal(); 401 showNormal();
396 showMaximized(); 402 showMaximized();
@@ -407,5 +413,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
407 if ( mediaPlayerState->fullscreen() ) { 413 if ( mediaPlayerState->fullscreen() ) {
408 // Clear the background 414 // Clear the background
409 p.setBrush( QBrush( Qt::black ) ); 415 p.setBrush( QBrush( Qt::black ) );
410// videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); 416 // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) );
411 417
@@ -413,7 +419,7 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
413 419
414 // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) ); 420 // videoFrame->setGeometry( QRect( 0, 15 , 240 ,170 ) );
415 // draw the buttons 421 // draw the buttons
416 422
417 if ( !pe->erased() ) { 423 if ( !pe->erased() ) {
418 // Combine with background and double buffer 424 // Combine with background and double buffer
419 QPixmap pix( pe->rect().size() ); 425 QPixmap pix( pe->rect().size() );
@@ -422,4 +428,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
422 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 428 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
423 for ( int i = 0; i < numVButtons; i++ ) 429 for ( int i = 0; i < numVButtons; i++ ) {
424 paintButton( &p, i ); 430 paintButton( &p, i );
431 }
425 QPainter p2( this ); 432 QPainter p2( this );
@@ -431,7 +438,7 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
431 } 438 }
432// for ( int i = 0; i < numButtons; i++ ) { 439 // for ( int i = 0; i < numButtons; i++ ) {
433// paintButton( &p, i ); 440 // paintButton( &p, i );
434// } 441 // }
435 // draw the slider 442 // draw the slider
436 slider->repaint( TRUE ); 443 slider->repaint( TRUE );
437 } 444 }
@@ -445,15 +452,2 @@ void VideoWidget::closeEvent( QCloseEvent* ) {
445 452
446bool VideoWidget::playVideo() {
447 bool result = FALSE;
448
449 int stream = 0;
450
451 int sw = 240;
452 int sh = 320;
453 int dd = QPixmap::defaultDepth();
454 int w = height();
455 int h = width();
456
457 return true;
458}
459 453
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 92193a4..710ba9e 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -43,3 +43,3 @@ class QSlider;
43enum VideoButtons { 43enum VideoButtons {
44 VideoStop, 44 VideoStop = 0,
45 VideoPlay, 45 VideoPlay,
@@ -59,3 +59,3 @@ public:
59 59
60 bool playVideo(); 60
61 XineVideoWidget* vidWidget(); 61 XineVideoWidget* vidWidget();
@@ -74,9 +74,14 @@ public slots:
74signals: 74signals:
75 void moreClicked();
76 void lessClicked();
77 void moreReleased();
78 void lessReleased();
75 void sliderMoved( long ); 79 void sliderMoved( long );
76 void videoResized ( const QSize &s ); 80 void videoResized ( const QSize &s );
77 81
78protected: 82protected:
79 QString skin; 83
80 void resizeEvent( QResizeEvent * ); 84 void resizeEvent( QResizeEvent * );
81 void paintEvent( QPaintEvent *pe ); 85 void paintEvent( QPaintEvent *pe );
86 void showEvent( QShowEvent *se );
82 void mouseMoveEvent( QMouseEvent *event ); 87 void mouseMoveEvent( QMouseEvent *event );
@@ -96,5 +101,6 @@ private:
96 QPixmap *buttonPixDown[7]; 101 QPixmap *buttonPixDown[7];
102 QString skin;
97// QPixmap *pixmaps[4]; 103// QPixmap *pixmaps[4];
98 int xoff, yoff; 104 int xoff, yoff;
99 105
100 106