-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 25 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
3 files changed, 29 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 0b9d826..9cb75ae 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -22,26 +22,31 @@ | |||
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | 24 | ||
25 | #include "mediaplayerstate.h" | 25 | #include "mediaplayerstate.h" |
26 | #include "playlistwidget.h" | 26 | #include "playlistwidget.h" |
27 | 27 | ||
28 | #include <vector> | ||
29 | |||
28 | class MediaWidget : public QWidget | 30 | class MediaWidget : public QWidget |
29 | { | 31 | { |
30 | Q_OBJECT | 32 | Q_OBJECT |
31 | public: | 33 | public: |
32 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 34 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
33 | 35 | ||
34 | struct Button | 36 | struct Button |
35 | { | 37 | { |
36 | // Button() : isToggle( false ), isHeld( false ), isDown( false ) {} | 38 | //Button() : isToggle( false ), isHeld( false ), isDown( false ) {} |
39 | // Button( bool toggle, bool held, bool down ) | ||
40 | // : isToggle( toggle ), isHeld( held ), isDown( down ) {} | ||
37 | 41 | ||
38 | bool isToggle : 1; | 42 | bool isToggle : 1; |
39 | bool isHeld : 1; | 43 | bool isHeld : 1; |
40 | bool isDown : 1; | 44 | bool isDown : 1; |
41 | }; | 45 | }; |
46 | typedef std::vector<Button> ButtonVector; | ||
42 | 47 | ||
43 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 48 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
44 | virtual ~MediaWidget(); | 49 | virtual ~MediaWidget(); |
45 | 50 | ||
46 | public slots: | 51 | public slots: |
47 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 52 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 7c20c6d..efd756c 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -56,35 +56,52 @@ | |||
56 | namespace | 56 | namespace |
57 | { | 57 | { |
58 | 58 | ||
59 | const int xo = 2; // movable x offset | 59 | const int xo = 2; // movable x offset |
60 | const int yo = 0; // movable y offset | 60 | const int yo = 0; // movable y offset |
61 | 61 | ||
62 | /* | ||
62 | MediaWidget::Button videoButtons[] = { | 63 | MediaWidget::Button videoButtons[] = { |
63 | { FALSE, FALSE, FALSE }, // stop | 64 | { FALSE, FALSE, FALSE }, // stop |
64 | { TRUE, FALSE, FALSE }, // play | 65 | { TRUE, FALSE, FALSE }, // play |
65 | { FALSE, FALSE, FALSE }, // previous | 66 | { FALSE, FALSE, FALSE }, // previous |
66 | { FALSE, FALSE, FALSE }, // next | 67 | { FALSE, FALSE, FALSE }, // next |
67 | { FALSE, FALSE, FALSE }, // volUp | 68 | { FALSE, FALSE, FALSE }, // volUp |
68 | { FALSE, FALSE, FALSE }, // volDown | 69 | { FALSE, FALSE, FALSE }, // volDown |
69 | { TRUE, FALSE, FALSE } // fullscreen | 70 | { TRUE, FALSE, FALSE } // fullscreen |
70 | }; | 71 | }; |
72 | */ | ||
71 | 73 | ||
72 | const char * const skinV_mask_file_names[7] = { | 74 | const char * const skinV_mask_file_names[7] = { |
73 | "stop","play","back","fwd","up","down","full" | 75 | "stop","play","back","fwd","up","down","full" |
74 | }; | 76 | }; |
75 | 77 | ||
76 | const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button)); | 78 | //const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button)); |
77 | 79 | ||
78 | } | 80 | } |
79 | 81 | ||
80 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 82 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
81 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 83 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) |
82 | { | 84 | { |
83 | setCaption( tr("OpiePlayer - Video") ); | 85 | setCaption( tr("OpiePlayer - Video") ); |
84 | 86 | ||
87 | Button defaultButton; | ||
88 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; | ||
89 | Button toggleButton; | ||
90 | toggleButton.isToggle = true; | ||
91 | toggleButton.isHeld = toggleButton.isDown = false; | ||
92 | |||
93 | videoButtons.reserve( 7 ); | ||
94 | videoButtons.push_back( defaultButton ); // stop | ||
95 | videoButtons.push_back( toggleButton ); // play | ||
96 | videoButtons.push_back( defaultButton ); // previous | ||
97 | videoButtons.push_back( defaultButton ); // next | ||
98 | videoButtons.push_back( defaultButton ); // volUp | ||
99 | videoButtons.push_back( defaultButton ); // volDown | ||
100 | videoButtons.push_back( toggleButton ); //fullscreen | ||
101 | |||
85 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 102 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
86 | 103 | ||
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 104 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
88 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 105 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
89 | 106 | ||
90 | Config cfg("OpiePlayer"); | 107 | Config cfg("OpiePlayer"); |
@@ -273,13 +290,13 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
273 | } else { | 290 | } else { |
274 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 291 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
275 | } | 292 | } |
276 | } | 293 | } |
277 | 294 | ||
278 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 295 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
279 | for ( int i = 0; i < numVButtons; i++ ) { | 296 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { |
280 | if ( event->state() == QMouseEvent::LeftButton ) { | 297 | if ( event->state() == QMouseEvent::LeftButton ) { |
281 | // The test to see if the mouse click is inside the button or not | 298 | // The test to see if the mouse click is inside the button or not |
282 | int x = event->pos().x() - xoff; | 299 | int x = event->pos().x() - xoff; |
283 | int y = event->pos().y() - yoff; | 300 | int y = event->pos().y() - yoff; |
284 | 301 | ||
285 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() | 302 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() |
@@ -420,20 +437,20 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { | |||
420 | if ( !pe->erased() ) { | 437 | if ( !pe->erased() ) { |
421 | // Combine with background and double buffer | 438 | // Combine with background and double buffer |
422 | QPixmap pix( pe->rect().size() ); | 439 | QPixmap pix( pe->rect().size() ); |
423 | QPainter p( &pix ); | 440 | QPainter p( &pix ); |
424 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 441 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
425 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 442 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
426 | for ( int i = 0; i < numVButtons; i++ ) { | 443 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { |
427 | paintButton( &p, i ); | 444 | paintButton( &p, i ); |
428 | } | 445 | } |
429 | QPainter p2( this ); | 446 | QPainter p2( this ); |
430 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 447 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
431 | } else { | 448 | } else { |
432 | QPainter p( this ); | 449 | QPainter p( this ); |
433 | for ( int i = 0; i < numVButtons; i++ ) | 450 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) |
434 | paintButton( &p, i ); | 451 | paintButton( &p, i ); |
435 | } | 452 | } |
436 | //slider->repaint( TRUE ); | 453 | //slider->repaint( TRUE ); |
437 | } | 454 | } |
438 | } | 455 | } |
439 | 456 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index f996803..34558f8 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -117,12 +117,14 @@ private: | |||
117 | QSlider *slider; | 117 | QSlider *slider; |
118 | QPixmap *pixmaps[3]; | 118 | QPixmap *pixmaps[3]; |
119 | QImage *currentFrame; | 119 | QImage *currentFrame; |
120 | int scaledWidth; | 120 | int scaledWidth; |
121 | int scaledHeight; | 121 | int scaledHeight; |
122 | XineVideoWidget* videoFrame; | 122 | XineVideoWidget* videoFrame; |
123 | |||
124 | ButtonVector videoButtons; | ||
123 | }; | 125 | }; |
124 | 126 | ||
125 | #endif // VIDEO_WIDGET_H | 127 | #endif // VIDEO_WIDGET_H |
126 | 128 | ||
127 | 129 | ||
128 | 130 | ||