author | simon <simon> | 2002-12-09 14:06:14 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 14:06:14 (UTC) |
commit | 17f319bb44feb947a26be333a4c7e6fef7020c87 (patch) (side-by-side diff) | |
tree | e02e34fb78ad4e4896cc07fd2a81d1a475e772a6 /noncore/multimedia/opieplayer2/audiowidget.cpp | |
parent | 46bca195f0dacc3b596eb1537ae47bc2117ce8e4 (diff) | |
download | opie-17f319bb44feb947a26be333a4c7e6fef7020c87.zip opie-17f319bb44feb947a26be333a4c7e6fef7020c87.tar.gz opie-17f319bb44feb947a26be333a4c7e6fef7020c87.tar.bz2 |
- re-organizing a bit the button storage. more to come.
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 56b75f2..3b33209 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -47,80 +47,80 @@ #include <stdio.h> #include "audiowidget.h" #include "mediaplayerstate.h" #include "playlistwidget.h" namespace { const int xo = -2; // movable x offset const int yo = 22; // movable y offset -const char * const skin_mask_file_names[10] = { - "play", "stop", "next", "prev", "up", - "down", "loop", "playlist", "forward", "back" +const MediaWidget::SkinButtonInfo skinInfo[] = +{ + { MediaWidget::Play, "play", MediaWidget::ToggleButton }, + { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, + { MediaWidget::Next, "next", MediaWidget::NormalButton }, + { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, + { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, + { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, + { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, + { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, + { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, + { MediaWidget::Back, "back", MediaWidget::NormalButton } }; +const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); + void changeTextColor( QWidget * w) { QPalette p = w->palette(); p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); w->setPalette( p ); } } AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), audioSliderBeingMoved( false ) { - Button defaultButton; - - Button toggleButton = defaultButton; - toggleButton.buttonType = ToggleButton; - - buttons.reserve( 10 ); - buttons.push_back( toggleButton ); // play - buttons.push_back( defaultButton ); // stop - buttons.push_back( defaultButton ); // next - buttons.push_back( defaultButton ); // previous - buttons.push_back( defaultButton ); // volume up - buttons.push_back( defaultButton ); // volume down - buttons.push_back( toggleButton ); // repeat/loop - buttons.push_back( defaultButton ); // playlist - buttons.push_back( defaultButton ); // forward - buttons.push_back( defaultButton ); // back + for ( uint i = 0; i < buttonCount; ++i ) { + Button button; + button.buttonType = skinInfo[ i ].buttonType; + buttons.push_back( button ); + } setCaption( tr("OpiePlayer") ); Config cfg("OpiePlayer"); cfg.setGroup("Options"); skin = cfg.readEntry("Skin","default"); //skin = "scaleTest"; // color of background, frame, degree of transparency QString skinPath = "opieplayer2/skins/" + skin; pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); buttonMask.fill( 0 ); - masks.reserve( 10 ); + masks.reserve( buttonCount ); for ( uint i = 0; i < masks.capacity(); i++ ) { - QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); + QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); masks.push_back( QBitmap( filename ) ); if ( !masks[i].isNull() ) { QImage imgMask = masks[i].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++ ) if ( !qRed( imgMask.pixel( x, y ) ) ) line[x] = i + 1; } } |