summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp42
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h7
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
58 58
59const char * const skin_mask_file_names[10] = { 59const MediaWidget::SkinButtonInfo skinInfo[] =
60 "play", "stop", "next", "prev", "up", 60{
61 "down", "loop", "playlist", "forward", "back" 61 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
62 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
63 { MediaWidget::Next, "next", MediaWidget::NormalButton },
64 { MediaWidget::Previous, "prev", MediaWidget::NormalButton },
65 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
66 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
67 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
68 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
69 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
70 { MediaWidget::Back, "back", MediaWidget::NormalButton }
62}; 71};
63 72
73const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
74
64void changeTextColor( QWidget * w) { 75void changeTextColor( QWidget * w) {
@@ -77,18 +88,7 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
77{ 88{
78 Button defaultButton; 89 for ( uint i = 0; i < buttonCount; ++i ) {
79 90 Button button;
80 Button toggleButton = defaultButton; 91 button.buttonType = skinInfo[ i ].buttonType;
81 toggleButton.buttonType = ToggleButton; 92 buttons.push_back( button );
82 93 }
83 buttons.reserve( 10 );
84 buttons.push_back( toggleButton ); // play
85 buttons.push_back( defaultButton ); // stop
86 buttons.push_back( defaultButton ); // next
87 buttons.push_back( defaultButton ); // previous
88 buttons.push_back( defaultButton ); // volume up
89 buttons.push_back( defaultButton ); // volume down
90 buttons.push_back( toggleButton ); // repeat/loop
91 buttons.push_back( defaultButton ); // playlist
92 buttons.push_back( defaultButton ); // forward
93 buttons.push_back( defaultButton ); // back
94 94
@@ -110,6 +110,6 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
110 110
111 masks.reserve( 10 ); 111 masks.reserve( buttonCount );
112 112
113 for ( uint i = 0; i < masks.capacity(); i++ ) { 113 for ( uint i = 0; i < masks.capacity(); i++ ) {
114 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 114 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" );
115 masks.push_back( QBitmap( filename ) ); 115 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:
49 49
50 struct SkinButtonInfo
51 {
52 Command command;
53 const char *fileName;
54 ButtonType buttonType;
55 };
56
50 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 57 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );