-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 42 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 7 |
2 files changed, 28 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 @@ -58,7 +58,18 @@ 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) { @@ -77,18 +88,7 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye { - 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 ); + } @@ -110,6 +110,6 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye - 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 ) ); diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index aa8891f..e0f2cf1 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -49,2 +49,9 @@ public: + struct SkinButtonInfo + { + Command command; + const char *fileName; + ButtonType buttonType; + }; + MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |