summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp225
-rw-r--r--core/multimedia/opieplayer/videowidget.h14
2 files changed, 146 insertions, 93 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index 1b38206..6ed0108 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -35,49 +35,49 @@
35#ifdef Q_WS_QWS 35#ifdef Q_WS_QWS
36# define USE_DIRECT_PAINTER 36# define USE_DIRECT_PAINTER
37# include <qdirectpainter_qws.h> 37# include <qdirectpainter_qws.h>
38# include <qgfxraster_qws.h> 38# include <qgfxraster_qws.h>
39#endif 39#endif
40 40
41 41
42extern MediaPlayerState *mediaPlayerState; 42extern MediaPlayerState *mediaPlayerState;
43 43
44 44
45static const int xo = 2; // movable x offset 45static const int xo = 2; // movable x offset
46static const int yo = 0; // movable y offset 46static const int yo = 0; // movable y offset
47 47
48 48
49struct MediaButton { 49struct MediaButton {
50// int xPos, yPos; 50// int xPos, yPos;
51 bool isToggle, isHeld, isDown; 51 bool isToggle, isHeld, isDown;
52// int controlType; 52// int controlType;
53}; 53};
54 54
55 55
56// Layout information for the videoButtons (and if it is a toggle button or not) 56// Layout information for the videoButtons (and if it is a toggle button or not)
57MediaButton videoButtons[] = { 57MediaButton videoButtons[] = {
58 { FALSE, FALSE, FALSE }, // stop 58 { FALSE, FALSE, FALSE }, // stop
59 { TRUE, FALSE, FALSE }, // play 59 { FALSE, FALSE, FALSE }, // play
60 { FALSE, FALSE, FALSE }, // previous 60 { FALSE, FALSE, FALSE }, // previous
61 { FALSE, FALSE, FALSE }, // next 61 { FALSE, FALSE, FALSE }, // next
62 { FALSE, FALSE, FALSE }, // volUp 62 { FALSE, FALSE, FALSE }, // volUp
63 { FALSE, FALSE, FALSE }, // volDown 63 { FALSE, FALSE, FALSE }, // volDown
64 { TRUE, FALSE, FALSE } // fullscreen 64 { TRUE, FALSE, FALSE } // fullscreen
65}; 65};
66 66
67//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 67//static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton));
68 68
69const char *skinV_mask_file_names[7] = { 69const char *skinV_mask_file_names[7] = {
70 "stop","play","back","fwd","up","down","full" 70 "stop","play","back","fwd","up","down","full"
71}; 71};
72 72
73static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 73static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
74 74
75VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : 75VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
76 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) 76 QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 )
77{ 77{
78 setCaption( tr("OpiePlayer") ); 78 setCaption( tr("OpiePlayer") );
79 Config cfg("OpiePlayer"); 79 Config cfg("OpiePlayer");
80 80
81 cfg.setGroup("Options"); 81 cfg.setGroup("Options");
82 skin = cfg.readEntry("Skin","default"); 82 skin = cfg.readEntry("Skin","default");
83 83
@@ -123,56 +123,56 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) :
123 for ( int i = 0; i < 7; i++ ) 123 for ( int i = 0; i < 7; i++ )
124 { 124 {
125 buttonPixUp[i] = NULL; 125 buttonPixUp[i] = NULL;
126 buttonPixDown[i] = NULL; 126 buttonPixDown[i] = NULL;
127 } 127 }
128 128
129 setBackgroundPixmap( *pixBg ); 129 setBackgroundPixmap( *pixBg );
130 130
131 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 ); 131 currentFrame = new QImage( 220 + 2, 160, (QPixmap::defaultDepth() == 16) ? 16 : 32 );
132 132
133 slider = new QSlider( Qt::Horizontal, this ); 133 slider = new QSlider( Qt::Horizontal, this );
134 slider->setMinValue( 0 ); 134 slider->setMinValue( 0 );
135 slider->setMaxValue( 1 ); 135 slider->setMaxValue( 1 );
136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
137 slider->setFocusPolicy( QWidget::NoFocus ); 137 slider->setFocusPolicy( QWidget::NoFocus );
138// slider->setGeometry( QRect( 7, 250, 220, 20 ) ); 138// slider->setGeometry( QRect( 7, 250, 220, 20 ) );
139 139
140 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); 140 connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
141 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); 141 connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
142 142
143 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 143 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
144 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); 144 connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
145 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); 145 connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
146 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 146 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
147 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 147// connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
148 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 148 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
149 149
150 // Intialise state 150 // Intialise state
151 setLength( mediaPlayerState->length() ); 151 setLength( mediaPlayerState->length() );
152 setPosition( mediaPlayerState->position() ); 152 setPosition( mediaPlayerState->position() );
153 setFullscreen( mediaPlayerState->fullscreen() ); 153 setFullscreen( mediaPlayerState->fullscreen() );
154 setPaused( mediaPlayerState->paused() ); 154// setPaused( mediaPlayerState->paused() );
155 setPlaying( mediaPlayerState->playing() ); 155 setPlaying( mediaPlayerState->playing() );
156} 156}
157 157
158 158
159VideoWidget::~VideoWidget() { 159VideoWidget::~VideoWidget() {
160 160
161 for ( int i = 0; i < 7; i++ ) 161 for ( int i = 0; i < 7; i++ )
162 { 162 {
163 delete buttonPixUp[i]; 163 delete buttonPixUp[i];
164 delete buttonPixDown[i]; 164 delete buttonPixDown[i];
165 } 165 }
166 166
167 delete pixBg; 167 delete pixBg;
168 delete imgUp; 168 delete imgUp;
169 delete imgDn; 169 delete imgDn;
170 delete imgButtonMask; 170 delete imgButtonMask;
171 for ( int i = 0; i < 7; i++ ) 171 for ( int i = 0; i < 7; i++ )
172 { 172 {
173 delete masks[i]; 173 delete masks[i];
174 } 174 }
175 175
176// for ( int i = 0; i < 3; i++ ) 176// for ( int i = 0; i < 3; i++ )
177// delete pixmaps[i]; 177// delete pixmaps[i];
178// delete currentFrame; 178// delete currentFrame;
@@ -298,188 +298,235 @@ void VideoWidget::toggleButton( int i ) {
298 videoButtons[i].isDown = !videoButtons[i].isDown; 298 videoButtons[i].isDown = !videoButtons[i].isDown;
299 QPainter p(this); 299 QPainter p(this);
300 paintButton ( &p, i ); 300 paintButton ( &p, i );
301} 301}
302 302
303 303
304void VideoWidget::paintButton( QPainter *p, int i ) { 304void VideoWidget::paintButton( QPainter *p, int i ) {
305 if ( videoButtons[i].isDown ) 305 if ( videoButtons[i].isDown )
306 { 306 {
307 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 307 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
308 } 308 }
309 else 309 else
310 { 310 {
311 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 311 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
312 } 312 }
313// int x = videoButtons[i].xPos; 313// int x = videoButtons[i].xPos;
314// int y = videoButtons[i].yPos; 314// int y = videoButtons[i].yPos;
315// int offset = 10 + videoButtons[i].isDown; 315// int offset = 10 + videoButtons[i].isDown;
316// p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] ); 316// p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] );
317// p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); 317// p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 );
318} 318}
319 319
320 320
321void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 321void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
322 322 for ( int i = 0; i < numVButtons; i++ ) {
323 for ( int i = 0; i < numVButtons; i++ ) 323 if ( event->state() == QMouseEvent::LeftButton ) {
324 { 324 // The test to see if the mouse click is inside the button or not
325 if ( event->state() == QMouseEvent::LeftButton ) 325 int x = event->pos().x() - xoff;
326 { 326 int y = event->pos().y() - yoff;
327 // The test to see if the mouse click is inside the button or not 327
328 int x = event->pos().x() - xoff; 328 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
329 int y = event->pos().y() - yoff; 329 && y < imgButtonMask->height()
330 330 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
331 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 331
332 && y < imgButtonMask->height() 332 if ( isOnButton && !videoButtons[i].isHeld ) {
333 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 333 videoButtons[i].isHeld = TRUE;
334 334 toggleButton(i);
335 if ( isOnButton && !videoButtons[i].isHeld ) 335
336 { 336 switch (i) {
337 videoButtons[i].isHeld = TRUE; 337 case VideoVolUp:
338 toggleButton(i); 338 emit moreClicked();
339 339 return;
340 case VideoVolDown:
341 emit lessClicked();
342 return;
343 }
344 } else if ( !isOnButton && videoButtons[i].isHeld ) {
345 videoButtons[i].isHeld = FALSE;
346 toggleButton(i);
347 }
348 } else {
349
350 if ( videoButtons[i].isHeld ) {
351 videoButtons[i].isHeld = FALSE;
352 if ( !videoButtons[i].isToggle ) {
353 setToggleButton( i, FALSE );
354 }
355
356 switch(i) {
357
358 case VideoPlay: {
359 qDebug("play");
360 if( !mediaPlayerState->playing()) {
361 mediaPlayerState->setPlaying( true);
362 setToggleButton( i-1, false );
363 setToggleButton( i, false );
364 return;
365 }
366 if( mediaPlayerState->isPaused ) {
367 qDebug("isPaused");
368 setToggleButton( i, FALSE );
369 mediaPlayerState->setPaused( FALSE );
370 return;
371 } else if( !mediaPlayerState->isPaused ) {
372 qDebug("is not paused");
373 setToggleButton( i, TRUE );
374 mediaPlayerState->setPaused( TRUE );
375 return;
376 } else {
377 return;
378 }
379 }
380
381 case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return;
382 case VideoNext: mediaPlayerState->setNext(); return;
383 case VideoPrevious: mediaPlayerState->setPrev(); return;
384 case VideoVolUp: emit moreReleased(); return;
385 case VideoVolDown: emit lessReleased(); return;
386 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
387 }
388 }
389 }
390 }
391
392// for ( int i = 0; i < numVButtons; i++ )
393// {
394// if ( event->state() == QMouseEvent::LeftButton )
395// {
396// // The test to see if the mouse click is inside the button or not
397// int x = event->pos().x() - xoff;
398// int y = event->pos().y() - yoff;
399
400// bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
401// && y < imgButtonMask->height()
402// && imgButtonMask->pixelIndex( x, y ) == i + 1 );
403
404// if ( isOnButton && !videoButtons[i].isHeld )
405// {
406// qDebug("key %d", i);
407
408// videoButtons[i].isHeld = TRUE;
409// toggleButton(i);
340// switch (i) { 410// switch (i) {
341// case VideoVolUp: 411// case VideoVolUp:
342// emit moreClicked(); 412// emit moreClicked();
343// return; 413// return;
344// case VideoVolDown: 414// case VideoVolDown:
345// emit lessClicked(); 415// emit lessClicked();
346// return; 416// return;
347// } 417// }
348 } 418// } else if ( !isOnButton && videoButtons[i].isHeld ) {
349 else if ( !isOnButton && videoButtons[i].isHeld ) 419// videoButtons[i].isHeld = FALSE;
350 { 420// toggleButton(i);
351 videoButtons[i].isHeld = FALSE; 421// }
352 toggleButton(i);
353 }
354 }
355 else
356 {
357 422
358 if ( videoButtons[i].isHeld )
359 {
360 videoButtons[i].isHeld = FALSE;
361 if ( !videoButtons[i].isToggle )
362 {
363 setToggleButton( i, FALSE );
364 }
365 qDebug("key %d", i);
366 switch(i)
367 {
368// case VideoPlay:
369// {
370// if( mediaPlayerState->isPaused )
371// {
372// setToggleButton( i, FALSE );
373// mediaPlayerState->setPaused( FALSE );
374// return;
375// }
376// else if( !mediaPlayerState->isPaused )
377// {
378// setToggleButton( i, TRUE );
379// mediaPlayerState->setPaused( TRUE );
380// return;
381// }
382// else
383// {
384// return;
385// }
386// }
387 423
388 case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; 424// } else {
389 case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
390// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
391 case VideoNext: mediaPlayerState->setNext(); return;
392 case VideoPrevious: mediaPlayerState->setPrev(); return;
393// case VideoPlayList: mediaPlayerState->setList(); return;
394 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
395
396// case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
397// case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return;
398// case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return;
399// case VideoVolUp: emit moreReleased(); return;
400// case VideoVolDown: emit lessReleased(); return;
401// case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
402 }
403 }
404 }
405 }
406 425
426// if ( videoButtons[i].isHeld )
427// {
428// videoButtons[i].isHeld = FALSE;
429// if ( !videoButtons[i].isToggle ) {
430// setToggleButton( i, FALSE );
431// }
432// qDebug("key %d", i);
433// switch(i) {
434// case VideoPlay:
435// {
436// if( mediaPlayerState->isPaused ) {
437// setToggleButton( i, FALSE );
438// mediaPlayerState->setPaused( FALSE );
439// return;
440// }
441// else if( !mediaPlayerState->isPaused ) {
442// setToggleButton( i, TRUE );
443// mediaPlayerState->setPaused( TRUE );
444// return;
445// } else {
446// return;
447// }
448// }
449
450// case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
451// // case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
452// // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
453// case VideoNext: mediaPlayerState->setNext(); return;
454// case VideoPrevious: mediaPlayerState->setPrev(); return;
455// case VideoVolUp: emit moreReleased(); return;
456// case VideoVolDown: emit lessReleased(); return;
457// // case VideoPlayList: mediaPlayerState->setList(); return;
458// case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
459// }
460// }
461// }
462// }
407 463
408 464
409 465
410 466
411 467
412// for ( int i = 0; i < numButtons; i++ ) { 468// for ( int i = 0; i < numButtons; i++ ) {
413// int x = videoButtons[i].xPos; 469// int x = videoButtons[i].xPos;
414// int y = videoButtons[i].yPos; 470// int y = videoButtons[i].yPos;
415// if ( event->state() == QMouseEvent::LeftButton ) { 471// if ( event->state() == QMouseEvent::LeftButton ) {
416// // The test to see if the mouse click is inside the circular button or not 472// // The test to see if the mouse click is inside the circular button or not
417// // (compared with the radius squared to avoid a square-root of our distance) 473// // (compared with the radius squared to avoid a square-root of our distance)
418// int radius = 16; 474// int radius = 16;
419// QPoint center = QPoint( x + radius, y + radius ); 475// QPoint center = QPoint( x + radius, y + radius );
420// QPoint dXY = center - event->pos(); 476// QPoint dXY = center - event->pos();
421// int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); 477// int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y();
422// bool isOnButton = dist <= (radius * radius); 478// bool isOnButton = dist <= (radius * radius);
423// if ( isOnButton != videoButtons[i].isHeld ) { 479// if ( isOnButton != videoButtons[i].isHeld ) {
424// videoButtons[i].isHeld = isOnButton; 480// videoButtons[i].isHeld = isOnButton;
425// toggleButton(i); 481// toggleButton(i);
426// } 482// }
427// } else { 483// } else {
428// if ( videoButtons[i].isHeld ) { 484// if ( videoButtons[i].isHeld ) {
429// videoButtons[i].isHeld = FALSE; 485// videoButtons[i].isHeld = FALSE;
430// if ( !videoButtons[i].isToggle ) 486// if ( !videoButtons[i].isToggle )
431// setToggleButton( i, FALSE ); 487// setToggleButton( i, FALSE );
432// } 488// }
433// } 489// }
434 490
435// switch (i) {
436// case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return;
437// case VideoStop: mediaPlayerState->setPlaying(FALSE); return;
438// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
439// case VideoNext: mediaPlayerState->setNext(); return;
440// case VideoPrevious: mediaPlayerState->setPrev(); return;
441// case VideoPlayList: mediaPlayerState->setList(); return;
442// case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
443// }
444 491
445// } 492// }
446} 493}
447 494
448 495
449void VideoWidget::mousePressEvent( QMouseEvent *event ) { 496void VideoWidget::mousePressEvent( QMouseEvent *event ) {
450 mouseMoveEvent( event ); 497 mouseMoveEvent( event );
451} 498}
452 499
453 500
454void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 501void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
455 if ( mediaPlayerState->fullscreen() ) 502 if ( mediaPlayerState->fullscreen() )
456 { 503 {
457 mediaPlayerState->setFullscreen( FALSE ); 504 mediaPlayerState->setFullscreen( FALSE );
458 makeVisible(); 505 makeVisible();
459
460 mouseMoveEvent( event );
461 } 506 }
507 mouseMoveEvent( event );
508// }
462} 509}
463 510
464 511
465void VideoWidget::makeVisible() { 512void VideoWidget::makeVisible() {
466 if ( mediaPlayerState->fullscreen() ) 513 if ( mediaPlayerState->fullscreen() )
467 { 514 {
468 setBackgroundMode( QWidget::NoBackground ); 515 setBackgroundMode( QWidget::NoBackground );
469 showFullScreen(); 516 showFullScreen();
470 resize( qApp->desktop()->size() ); 517 resize( qApp->desktop()->size() );
471 slider->hide(); 518 slider->hide();
472 } 519 }
473 else 520 else
474 { 521 {
475 setBackgroundPixmap( *pixBg ); 522 setBackgroundPixmap( *pixBg );
476 showNormal(); 523 showNormal();
477 showMaximized(); 524 showMaximized();
478 slider->show(); 525 slider->show();
479 } 526 }
480} 527}
481 528
482 529
483void VideoWidget::paintEvent( QPaintEvent * pe) { 530void VideoWidget::paintEvent( QPaintEvent * pe) {
484 QPainter p( this ); 531 QPainter p( this );
485 532
diff --git a/core/multimedia/opieplayer/videowidget.h b/core/multimedia/opieplayer/videowidget.h
index fd86cd2..e9778f1 100644
--- a/core/multimedia/opieplayer/videowidget.h
+++ b/core/multimedia/opieplayer/videowidget.h
@@ -7,78 +7,84 @@
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef VIDEO_WIDGET_H 20#ifndef VIDEO_WIDGET_H
21#define VIDEO_WIDGET_H 21#define VIDEO_WIDGET_H
22 22
23 23
24#include <qwidget.h> 24#include <qwidget.h>
25 25
26class QPixmap; 26class QPixmap;
27class QSlider; 27class QSlider;
28 28
29 29
30enum VideoButtons { 30enum VideoButtons {
31 VideoPrevious,
32 VideoStop, 31 VideoStop,
33 VideoPlay, 32 VideoPlay,
34 VideoPause, 33// VideoPause,
34 VideoPrevious,
35 VideoNext, 35 VideoNext,
36 VideoPlayList, 36 VideoVolUp,
37 VideoVolDown,
38// VideoPlayList,
37 VideoFullscreen 39 VideoFullscreen
38}; 40};
39 41
40class VideoWidget : public QWidget { 42class VideoWidget : public QWidget {
41 Q_OBJECT 43 Q_OBJECT
42public: 44public:
43 VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 45 VideoWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
44 ~VideoWidget(); 46 ~VideoWidget();
45 47
46 bool playVideo(); 48 bool playVideo();
47 49
48public slots: 50public slots:
49 void updateSlider( long, long ); 51 void updateSlider( long, long );
50 void sliderPressed( ); 52 void sliderPressed( );
51 void sliderReleased( ); 53 void sliderReleased( );
52 void setPaused( bool b) { setToggleButton( VideoPause, b ); } 54// void setPaused( bool b) { setToggleButton( VideoPause, b ); }
53 void setPlaying( bool b) { setToggleButton( VideoPlay, b ); } 55 void setPlaying( bool b) { setToggleButton( VideoPlay, b ); }
54 void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); } 56 void setFullscreen( bool b ) { setToggleButton( VideoFullscreen, b ); }
55 void makeVisible(); 57 void makeVisible();
56 void setPosition( long ); 58 void setPosition( long );
57 void setLength( long ); 59 void setLength( long );
58 void setView( char ); 60 void setView( char );
59 61
60signals: 62signals:
63 void moreClicked();
64 void lessClicked();
65 void moreReleased();
66 void lessReleased();
61 void sliderMoved( long ); 67 void sliderMoved( long );
62 68
63protected: 69protected:
64 void resizeEvent( QResizeEvent * ); 70 void resizeEvent( QResizeEvent * );
65 void paintEvent( QPaintEvent *pe ); 71 void paintEvent( QPaintEvent *pe );
66 void mouseMoveEvent( QMouseEvent *event ); 72 void mouseMoveEvent( QMouseEvent *event );
67 void mousePressEvent( QMouseEvent *event ); 73 void mousePressEvent( QMouseEvent *event );
68 void mouseReleaseEvent( QMouseEvent *event ); 74 void mouseReleaseEvent( QMouseEvent *event );
69 void closeEvent( QCloseEvent *event ); 75 void closeEvent( QCloseEvent *event );
70 void keyReleaseEvent( QKeyEvent *e); 76 void keyReleaseEvent( QKeyEvent *e);
71 77
72private: 78private:
73 QPixmap *pixBg; 79 QPixmap *pixBg;
74 QImage *imgUp; 80 QImage *imgUp;
75 QImage *imgDn; 81 QImage *imgDn;
76 QImage *imgButtonMask; 82 QImage *imgButtonMask;
77 QBitmap *masks[7]; 83 QBitmap *masks[7];
78 QString backgroundPix; 84 QString backgroundPix;
79 QPixmap *buttonPixUp[7]; 85 QPixmap *buttonPixUp[7];
80 QPixmap *buttonPixDown[7]; 86 QPixmap *buttonPixDown[7];
81 QString skin; 87 QString skin;
82 QSlider *slider; 88 QSlider *slider;
83 QPixmap *pixmaps[3]; 89 QPixmap *pixmaps[3];
84 QImage *currentFrame; 90 QImage *currentFrame;