summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/audiowidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 714509e..c3e206c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -95,41 +95,42 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
95 // color of background, frame, degree of transparency 95 // color of background, frame, degree of transparency
96 96
97 QString skinPath = "opieplayer2/skins/" + skin; 97 QString skinPath = "opieplayer2/skins/" + skin;
98 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 98 backgroundPixmap = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
99 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 99 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
100 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 100 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
101 101
102 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 102 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
103 buttonMask.fill( 0 ); 103 buttonMask.fill( 0 );
104 104
105 for ( uint i = 0; i < buttonCount; i++ ) { 105 for ( uint i = 0; i < buttonCount; i++ ) {
106 Button button; 106 Button button;
107 button.command = skinInfo[ i ].command;
107 button.type = skinInfo[ i ].type; 108 button.type = skinInfo[ i ].type;
108 109
109 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); 110 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" );
110 button.mask =QBitmap( filename ); 111 button.mask =QBitmap( filename );
111 112
112 if ( !button.mask.isNull() ) { 113 if ( !button.mask.isNull() ) {
113 QImage imgMask = button.mask.convertToImage(); 114 QImage imgMask = button.mask.convertToImage();
114 uchar **dest = buttonMask.jumpTable(); 115 uchar **dest = buttonMask.jumpTable();
115 for ( int y = 0; y < imgUp.height(); y++ ) { 116 for ( int y = 0; y < imgUp.height(); y++ ) {
116 uchar *line = dest[y]; 117 uchar *line = dest[y];
117 for ( int x = 0; x < imgUp.width(); x++ ) 118 for ( int x = 0; x < imgUp.width(); x++ )
118 if ( !qRed( imgMask.pixel( x, y ) ) ) 119 if ( !qRed( imgMask.pixel( x, y ) ) )
119 line[x] = i + 1; 120 line[x] = i + 1;
120 } 121 }
121 } 122 }
122 123
123 buttons.insert( i, button ); 124 buttons.push_back( button );
124 } 125 }
125 126
126 setBackgroundPixmap( backgroundPixmap ); 127 setBackgroundPixmap( backgroundPixmap );
127 128
128 songInfo.setFocusPolicy( QWidget::NoFocus ); 129 songInfo.setFocusPolicy( QWidget::NoFocus );
129// changeTextColor( &songInfo ); 130// changeTextColor( &songInfo );
130// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 131// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
131// songInfo.setFrameStyle( QFrame::NoFrame); 132// songInfo.setFrameStyle( QFrame::NoFrame);
132 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 133 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
133// songInfo.setForegroundColor(Qt::white); 134// songInfo.setForegroundColor(Qt::white);
134 135
135 slider.setFixedHeight( 20 ); 136 slider.setFixedHeight( 20 );
@@ -199,25 +200,25 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
199 slider.setFixedWidth( w - 110 ); 200 slider.setFixedWidth( w - 110 );
200 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 201 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
201 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 202 slider.setBackgroundOrigin( QWidget::ParentOrigin );
202 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 203 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
203 204
204 upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; 205 upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2;
205 upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; 206 upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10;
206 QPoint p = upperLeftOfButtonMask; 207 QPoint p = upperLeftOfButtonMask;
207 208
208 QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p ); 209 QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p );
209 QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); 210 QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p );
210 211
211 for ( uint i = 0; i < buttons.count(); i++ ) { 212 for ( uint i = 0; i < buttons.size(); i++ ) {
212 if ( !buttons[i].mask.isNull() ) { 213 if ( !buttons[i].mask.isNull() ) {
213 buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); 214 buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask );
214 buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); 215 buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask );
215 } 216 }
216 } 217 }
217} 218}
218 219
219void AudioWidget::sliderPressed() { 220void AudioWidget::sliderPressed() {
220 audioSliderBeingMoved = TRUE; 221 audioSliderBeingMoved = TRUE;
221} 222}
222 223
223 224
@@ -325,25 +326,25 @@ void AudioWidget::stopSkip() {
325 326
326 327
327void AudioWidget::timerEvent( QTimerEvent * ) { 328void AudioWidget::timerEvent( QTimerEvent * ) {
328 if ( skipDirection == +1 ) { 329 if ( skipDirection == +1 ) {
329 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 330 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
330 } else if ( skipDirection == -1 ) { 331 } else if ( skipDirection == -1 ) {
331 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 332 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
332 } 333 }
333} 334}
334 335
335 336
336void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 337void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
337 for ( unsigned int i = 0; i < buttons.count(); i++ ) { 338 for ( unsigned int i = 0; i < buttons.size(); i++ ) {
338 339
339 Button &button = buttons[ i ]; 340 Button &button = buttons[ i ];
340 341
341 if ( event->state() == QMouseEvent::LeftButton ) { 342 if ( event->state() == QMouseEvent::LeftButton ) {
342 // The test to see if the mouse click is inside the button or not 343 // The test to see if the mouse click is inside the button or not
343 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); 344 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
344 345
345 if ( isOnButton && !button.isHeld ) { 346 if ( isOnButton && !button.isHeld ) {
346 button.isHeld = TRUE; 347 button.isHeld = TRUE;
347 toggleButton( button ); 348 toggleButton( button );
348 switch (i) { 349 switch (i) {
349 case VolumeUp: 350 case VolumeUp: