author | simon <simon> | 2002-12-09 14:41:19 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 14:41:19 (UTC) |
commit | 174c4a427750a3829ffd81a87454be8abf61ee30 (patch) (unidiff) | |
tree | e6b8d73afe4426707698396cc3c0086d712983f9 | |
parent | 3f88070b9be5209cdd88caa0afd7f7294d3b1764 (diff) | |
download | opie-174c4a427750a3829ffd81a87454be8abf61ee30.zip opie-174c4a427750a3829ffd81a87454be8abf61ee30.tar.gz opie-174c4a427750a3829ffd81a87454be8abf61ee30.tar.bz2 |
- merged the two button setup loops
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 87e06ee..c148820 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -77,61 +77,59 @@ void changeTextColor( QWidget * w) { | |||
77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
79 | w->setPalette( p ); | 79 | w->setPalette( p ); |
80 | } | 80 | } |
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
85 | 85 | ||
86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), | 86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
87 | audioSliderBeingMoved( false ) | 87 | audioSliderBeingMoved( false ) |
88 | { | 88 | { |
89 | for ( uint i = 0; i < buttonCount; ++i ) { | ||
90 | Button button; | ||
91 | button.type = skinInfo[ i ].type; | ||
92 | buttons.push_back( button ); | ||
93 | } | ||
94 | |||
95 | setCaption( tr("OpiePlayer") ); | 89 | setCaption( tr("OpiePlayer") ); |
96 | 90 | ||
97 | Config cfg("OpiePlayer"); | 91 | Config cfg("OpiePlayer"); |
98 | cfg.setGroup("Options"); | 92 | cfg.setGroup("Options"); |
99 | skin = cfg.readEntry("Skin","default"); | 93 | skin = cfg.readEntry("Skin","default"); |
100 | //skin = "scaleTest"; | 94 | //skin = "scaleTest"; |
101 | // color of background, frame, degree of transparency | 95 | // color of background, frame, degree of transparency |
102 | 96 | ||
103 | QString skinPath = "opieplayer2/skins/" + skin; | 97 | QString skinPath = "opieplayer2/skins/" + skin; |
104 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 98 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
105 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 99 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
106 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 100 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
107 | 101 | ||
108 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 102 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
109 | buttonMask.fill( 0 ); | 103 | buttonMask.fill( 0 ); |
110 | 104 | ||
111 | for ( uint i = 0; i < buttons.size(); i++ ) { | 105 | for ( uint i = 0; i < buttonCount; i++ ) { |
106 | Button button; | ||
107 | button.type = skinInfo[ i ].type; | ||
108 | |||
112 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); | 109 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); |
113 | buttons[ i ].mask =QBitmap( filename ); | 110 | button.mask =QBitmap( filename ); |
114 | 111 | ||
115 | if ( !buttons[i].mask.isNull() ) { | 112 | if ( !button.mask.isNull() ) { |
116 | QImage imgMask = buttons[i].mask.convertToImage(); | 113 | QImage imgMask = button.mask.convertToImage(); |
117 | uchar **dest = buttonMask.jumpTable(); | 114 | uchar **dest = buttonMask.jumpTable(); |
118 | for ( int y = 0; y < imgUp.height(); y++ ) { | 115 | for ( int y = 0; y < imgUp.height(); y++ ) { |
119 | uchar *line = dest[y]; | 116 | uchar *line = dest[y]; |
120 | for ( int x = 0; x < imgUp.width(); x++ ) | 117 | for ( int x = 0; x < imgUp.width(); x++ ) |
121 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 118 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
122 | line[x] = i + 1; | 119 | line[x] = i + 1; |
123 | } | 120 | } |
124 | } | 121 | } |
125 | 122 | ||
123 | buttons.push_back( button ); | ||
126 | } | 124 | } |
127 | 125 | ||
128 | setBackgroundPixmap( pixBg ); | 126 | setBackgroundPixmap( pixBg ); |
129 | 127 | ||
130 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 128 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
131 | // changeTextColor( &songInfo ); | 129 | // changeTextColor( &songInfo ); |
132 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 130 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
133 | // songInfo.setFrameStyle( QFrame::NoFrame); | 131 | // songInfo.setFrameStyle( QFrame::NoFrame); |
134 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 132 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
135 | // songInfo.setForegroundColor(Qt::white); | 133 | // songInfo.setForegroundColor(Qt::white); |
136 | 134 | ||
137 | slider.setFixedHeight( 20 ); | 135 | slider.setFixedHeight( 20 ); |