summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp21
3 files changed, 18 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index c148820..12f91a9 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -117,13 +117,13 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
for ( int x = 0; x < imgUp.width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
line[x] = i + 1;
}
}
- buttons.push_back( button );
+ buttons.insert( i, button );
}
setBackgroundPixmap( pixBg );
songInfo.setFocusPolicy( QWidget::NoFocus );
// changeTextColor( &songInfo );
@@ -205,13 +205,13 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10;
QPoint p = upperLeftOfButtonMask;
QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p );
QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p );
- for ( uint i = 0; i < buttons.size(); i++ ) {
+ for ( uint i = 0; i < buttons.count(); i++ ) {
if ( !buttons[i].mask.isNull() ) {
buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask );
buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask );
}
}
}
@@ -348,13 +348,13 @@ void AudioWidget::timerEvent( QTimerEvent * ) {
mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
}
}
void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
- for ( unsigned int i = 0; i < buttons.size(); i++ ) {
+ for ( unsigned int i = 0; i < buttons.count(); i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
if ( isOnButton && !buttons[i].isHeld ) {
buttons[i].isHeld = TRUE;
@@ -411,19 +411,19 @@ void AudioWidget::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 ( unsigned int i = 0; i < buttons.size(); i++ )
+ for ( unsigned int i = 0; i < buttons.count(); i++ )
paintButton( p, i );
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
- for ( unsigned int i = 0; i < buttons.size(); i++ )
+ for ( unsigned int i = 0; i < buttons.count(); i++ )
paintButton( p, i );
}
}
void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
switch ( e->key() ) {
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 504b705..49bf024 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -48,12 +48,14 @@ public:
QBitmap mask;
QPixmap pixUp;
QPixmap pixDown;
};
typedef std::vector<Button> ButtonVector;
+ // when the transition is done this should be Command -> Button
+ typedef QMap<int, Button> ButtonMap;
struct SkinButtonInfo
{
Command command;
const char *fileName;
ButtonType type;
@@ -88,13 +90,13 @@ protected:
void toggleButton( int buttonId );
MediaPlayerState &mediaPlayerState;
PlayListWidget &playList;
- ButtonVector buttons;
+ ButtonMap buttons;
QImage buttonMask;
QPoint upperLeftOfButtonMask;
};
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 380c703..7d85d63 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -71,20 +71,19 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
setCaption( tr("OpiePlayer - Video") );
Button defaultButton;
Button toggleButton = defaultButton;
toggleButton.type = ToggleButton;
- buttons.reserve( 7 );
- buttons.push_back( toggleButton ); // play
- buttons.push_back( defaultButton ); // stop
- buttons.push_back( defaultButton ); // next
- buttons.push_back( defaultButton ); // previous
- buttons.push_back( defaultButton ); // volUp
- buttons.push_back( defaultButton ); // volDown
- buttons.push_back( toggleButton ); //fullscreen
+ buttons.insert( 0, toggleButton ); // play
+ buttons.insert( 1, toggleButton ); // stop
+ buttons.insert( 2, toggleButton ); // next
+ buttons.insert( 3, toggleButton ); // previous
+ buttons.insert( 4, toggleButton ); // volUp
+ buttons.insert( 5, toggleButton ); // volDown
+ buttons.insert( 6, 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() ) );
@@ -268,13 +267,13 @@ void VideoWidget::paintButton( QPainter &p, int i ) {
} else {
p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
}
}
void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
- for ( unsigned int i = 0; i < buttons.size(); i++ ) {
+ for ( unsigned int i = 0; i < buttons.count(); i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
if ( isOnButton && !buttons[i].isHeld ) {
buttons[i].isHeld = TRUE;
@@ -410,20 +409,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 ( unsigned int i = 0; i < buttons.size(); i++ ) {
+ for ( unsigned int i = 0; i < buttons.count(); i++ ) {
paintButton( p, i );
}
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
- for ( unsigned int i = 0; i < buttons.size(); i++ )
+ for ( unsigned int i = 0; i < buttons.count(); i++ )
paintButton( p, i );
}
//slider->repaint( TRUE );
}
}