summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -22,26 +22,31 @@
#include <qwidget.h>
#include "mediaplayerstate.h"
#include "playlistwidget.h"
+#include <vector>
+
class MediaWidget : public QWidget
{
Q_OBJECT
public:
enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back };
struct Button
{
-// Button() : isToggle( false ), isHeld( false ), isDown( false ) {}
+ //Button() : isToggle( false ), isHeld( false ), isDown( false ) {}
+// Button( bool toggle, bool held, bool down )
+// : isToggle( toggle ), isHeld( held ), isDown( down ) {}
bool isToggle : 1;
bool isHeld : 1;
bool isDown : 1;
};
+ typedef std::vector<Button> ButtonVector;
MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
virtual ~MediaWidget();
public slots:
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 @@
namespace
{
const int xo = 2; // movable x offset
const int yo = 0; // movable y offset
+/*
MediaWidget::Button videoButtons[] = {
{ FALSE, FALSE, FALSE }, // stop
{ TRUE, FALSE, FALSE }, // play
{ FALSE, FALSE, FALSE }, // previous
{ FALSE, FALSE, FALSE }, // next
{ FALSE, FALSE, FALSE }, // volUp
{ FALSE, FALSE, FALSE }, // volDown
{ TRUE, FALSE, FALSE } // fullscreen
};
+*/
const char * const skinV_mask_file_names[7] = {
"stop","play","back","fwd","up","down","full"
};
-const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button));
+//const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button));
}
VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
: MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
{
setCaption( tr("OpiePlayer - Video") );
+ Button defaultButton;
+ defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
+ Button toggleButton;
+ toggleButton.isToggle = true;
+ toggleButton.isHeld = toggleButton.isDown = false;
+
+ videoButtons.reserve( 7 );
+ videoButtons.push_back( defaultButton ); // stop
+ videoButtons.push_back( toggleButton ); // play
+ videoButtons.push_back( defaultButton ); // previous
+ videoButtons.push_back( defaultButton ); // next
+ videoButtons.push_back( defaultButton ); // volUp
+ videoButtons.push_back( defaultButton ); // volDown
+ videoButtons.push_back( toggleButton ); //fullscreen
+
videoFrame = new XineVideoWidget ( this, "Video frame" );
connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
Config cfg("OpiePlayer");
@@ -273,13 +290,13 @@ void VideoWidget::paintButton( QPainter *p, int i ) {
} else {
p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
}
}
void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
- for ( int i = 0; i < numVButtons; i++ ) {
+ for ( unsigned int i = 0; i < videoButtons.size(); i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
int x = event->pos().x() - xoff;
int y = event->pos().y() - yoff;
bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width()
@@ -420,20 +437,20 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
if ( !pe->erased() ) {
// Combine with background and double buffer
QPixmap pix( pe->rect().size() );
QPainter p( &pix );
p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() );
- for ( int i = 0; i < numVButtons; i++ ) {
+ for ( unsigned int i = 0; i < videoButtons.size(); i++ ) {
paintButton( &p, i );
}
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
- for ( int i = 0; i < numVButtons; i++ )
+ for ( unsigned int i = 0; i < videoButtons.size(); i++ )
paintButton( &p, i );
}
//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
@@ -117,12 +117,14 @@ private:
QSlider *slider;
QPixmap *pixmaps[3];
QImage *currentFrame;
int scaledWidth;
int scaledHeight;
XineVideoWidget* videoFrame;
+
+ ButtonVector videoButtons;
};
#endif // VIDEO_WIDGET_H