author | simon <simon> | 2002-12-09 16:12:41 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 16:12:41 (UTC) |
commit | eeb797c68aca5cad9989b8438facebee13eede5e (patch) (side-by-side diff) | |
tree | 74a95774f68967a1b4ecd01d1c2296ebb7019d0c /noncore/multimedia/opieplayer2 | |
parent | d8aead05894e6a28b5aab45807ff2e6f27620f97 (diff) | |
download | opie-eeb797c68aca5cad9989b8438facebee13eede5e.zip opie-eeb797c68aca5cad9989b8438facebee13eede5e.tar.gz opie-eeb797c68aca5cad9989b8438facebee13eede5e.tar.bz2 |
- starting to migrate the videowidget to MediaWidget::Command and friends
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 40 |
2 files changed, 21 insertions, 21 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index efba6f3..3bf01b6 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -30,17 +30,17 @@ #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, Undefined }; + enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; enum ButtonType { NormalButton, ToggleButton }; struct Button { Button() : command( Undefined ), type( NormalButton ), isHeld( false ), isDown( false ) {} Command command; diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 8409e5c..4867ef1 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -54,38 +54,36 @@ namespace { const int xo = 2; // movable x offset const int yo = 0; // movable y offset -const char * const skinV_mask_file_names[7] = { -"play","stop","fwd","back","up","down","full" +const MediaWidget::SkinButtonInfo skinInfo[] = +{ + { MediaWidget::Play, "play", MediaWidget::ToggleButton }, + { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, + { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, + { MediaWidget::Previous, "back", MediaWidget::NormalButton }, + { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, + { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, + { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } }; +const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); + } 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; - Button toggleButton = defaultButton; - toggleButton.type = ToggleButton; - - buttons.push_back( toggleButton ); // play - buttons.push_back( toggleButton ); // stop - buttons.push_back( toggleButton ); // next - buttons.push_back( toggleButton ); // previous - buttons.push_back( toggleButton ); // volUp - buttons.push_back( toggleButton ); // volDown - buttons.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"); cfg.setGroup("Options"); @@ -94,34 +92,36 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye QString skinPath = "opieplayer2/skins/" + skin; backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); buttonMask.fill( 0 ); - uint i = 0; - for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it, ++i ) { - Button &button = *it; + for ( uint i = 0; i < buttonCount; i++ ) { + Button button; + button.command = skinInfo[ i ].command; + button.type = skinInfo[ i ].type; - QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); - button.mask = QBitmap( filename ); + QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinInfo[i].fileName + ".png" ); + button.mask =QBitmap( filename ); if ( !button.mask.isNull() ) { QImage imgMask = button.mask.convertToImage(); uchar **dest = buttonMask.jumpTable(); for ( int y = 0; y < imgUp.height(); y++ ) { uchar *line = dest[y]; - for ( int x = 0; x < imgUp.width(); x++ ) { + for ( int x = 0; x < imgUp.width(); x++ ) if ( !qRed( imgMask.pixel( x, y ) ) ) line[x] = i + 1; - } } } + + buttons.push_back( button ); } setBackgroundPixmap( backgroundPixmap ); slider = new QSlider( Qt::Horizontal, this ); slider->setMinValue( 0 ); slider->setMaxValue( 1 ); slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |