summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/audiowidget.cpp
authorsimon <simon>2002-12-08 22:26:34 (UTC)
committer simon <simon>2002-12-08 22:26:34 (UTC)
commit3b5f97272ded8a40da3853476371b4edc41d1a34 (patch) (unidiff)
treecc965571aa2f8ca62bf859e49acc91b440b96f1a /noncore/multimedia/opieplayer2/audiowidget.cpp
parent5d3f3d429bb6247741a30c00a344302a2c9a20c0 (diff)
downloadopie-3b5f97272ded8a40da3853476371b4edc41d1a34.zip
opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.gz
opie-3b5f97272ded8a40da3853476371b4edc41d1a34.tar.bz2
- share the imgButtonMask member variable in the base class
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index a9d5a88..022aa82 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -96,34 +96,34 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
96 96
97 Config cfg("OpiePlayer"); 97 Config cfg("OpiePlayer");
98 cfg.setGroup("Options"); 98 cfg.setGroup("Options");
99 skin = cfg.readEntry("Skin","default"); 99 skin = cfg.readEntry("Skin","default");
100 //skin = "scaleTest"; 100 //skin = "scaleTest";
101 // color of background, frame, degree of transparency 101 // color of background, frame, degree of transparency
102 102
103 QString skinPath = "opieplayer2/skins/" + skin; 103 QString skinPath = "opieplayer2/skins/" + skin;
104 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 104 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
105 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 105 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
106 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 106 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
107 107
108 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 108 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
109 imgButtonMask.fill( 0 ); 109 buttonMask.fill( 0 );
110 110
111 for ( int i = 0; i < 10; i++ ) { 111 for ( int i = 0; i < 10; i++ ) {
112 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 112 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
113 masks[i] = new QBitmap( filename ); 113 masks[i] = new QBitmap( filename );
114 114
115 if ( !masks[i]->isNull() ) { 115 if ( !masks[i]->isNull() ) {
116 QImage imgMask = masks[i]->convertToImage(); 116 QImage imgMask = masks[i]->convertToImage();
117 uchar **dest = imgButtonMask.jumpTable(); 117 uchar **dest = buttonMask.jumpTable();
118 for ( int y = 0; y < imgUp.height(); y++ ) { 118 for ( int y = 0; y < imgUp.height(); y++ ) {
119 uchar *line = dest[y]; 119 uchar *line = dest[y];
120 for ( int x = 0; x < imgUp.width(); x++ ) 120 for ( int x = 0; x < imgUp.width(); x++ )
121 if ( !qRed( imgMask.pixel( x, y ) ) ) 121 if ( !qRed( imgMask.pixel( x, y ) ) )
122 line[x] = i + 1; 122 line[x] = i + 1;
123 } 123 }
124 } 124 }
125 125
126 } 126 }
127 127
128 for ( int i = 0; i < 10; i++ ) { 128 for ( int i = 0; i < 10; i++ ) {
129 buttonPixUp[i] = 0l; 129 buttonPixUp[i] = 0l;
@@ -375,27 +375,27 @@ void AudioWidget::timerEvent( QTimerEvent * ) {
375 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 375 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
376 } 376 }
377} 377}
378 378
379 379
380void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 380void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
381 for ( unsigned int i = 0; i < buttons.size(); i++ ) { 381 for ( unsigned int i = 0; i < buttons.size(); i++ ) {
382 if ( event->state() == QMouseEvent::LeftButton ) { 382 if ( event->state() == QMouseEvent::LeftButton ) {
383 // The test to see if the mouse click is inside the button or not 383 // The test to see if the mouse click is inside the button or not
384 int x = event->pos().x() - xoff; 384 int x = event->pos().x() - xoff;
385 int y = event->pos().y() - yoff; 385 int y = event->pos().y() - yoff;
386 386
387 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() 387 bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width()
388 && y < imgButtonMask.height() 388 && y < buttonMask.height()
389 && imgButtonMask.pixelIndex( x, y ) == i + 1 ); 389 && buttonMask.pixelIndex( x, y ) == i + 1 );
390 390
391 if ( isOnButton && !buttons[i].isHeld ) { 391 if ( isOnButton && !buttons[i].isHeld ) {
392 buttons[i].isHeld = TRUE; 392 buttons[i].isHeld = TRUE;
393 toggleButton(i); 393 toggleButton(i);
394 switch (i) { 394 switch (i) {
395 case VolumeUp: 395 case VolumeUp:
396 emit moreClicked(); 396 emit moreClicked();
397 return; 397 return;
398 case VolumeDown: 398 case VolumeDown:
399 emit lessClicked(); 399 emit lessClicked();
400 return; 400 return;
401 case Forward: 401 case Forward: