summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h7
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
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
@@ -25,6 +25,8 @@
25#include "mediaplayerstate.h" 25#include "mediaplayerstate.h"
26#include "playlistwidget.h" 26#include "playlistwidget.h"
27 27
28#include <vector>
29
28class MediaWidget : public QWidget 30class MediaWidget : public QWidget
29{ 31{
30 Q_OBJECT 32 Q_OBJECT
@@ -33,12 +35,15 @@ public:
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();
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
@@ -59,6 +59,7 @@ namespace
59const int xo = 2; // movable x offset 59const int xo = 2; // movable x offset
60const int yo = 0; // movable y offset 60const int yo = 0; // movable y offset
61 61
62/*
62MediaWidget::Button videoButtons[] = { 63MediaWidget::Button videoButtons[] = {
63 { FALSE, FALSE, FALSE }, // stop 64 { FALSE, FALSE, FALSE }, // stop
64 { TRUE, FALSE, FALSE }, // play 65 { TRUE, FALSE, FALSE }, // play
@@ -68,12 +69,13 @@ MediaWidget::Button videoButtons[] = {
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
72const char * const skinV_mask_file_names[7] = { 74const 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
76const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button)); 78//const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button));
77 79
78} 80}
79 81
@@ -82,6 +84,21 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
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 & )));
@@ -276,7 +293,7 @@ void VideoWidget::paintButton( QPainter *p, int i ) {
276} 293}
277 294
278void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 295void 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;
@@ -423,14 +440,14 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
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 );
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
@@ -120,6 +120,8 @@ private:
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