-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 28 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 2 |
2 files changed, 26 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 879d0b4..4172da0 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -60,8 +60,9 @@ struct MediaButton { | |||
60 | bool isToggle, isHeld, isDown; | 60 | bool isToggle, isHeld, isDown; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | //Layout information for the audioButtons (and if it is a toggle button or not) | 63 | //Layout information for the audioButtons (and if it is a toggle button or not) |
64 | /* | ||
64 | MediaWidget::Button audioButtons[] = { | 65 | MediaWidget::Button audioButtons[] = { |
65 | { TRUE, FALSE, FALSE }, // play | 66 | { TRUE, FALSE, FALSE }, // play |
66 | { FALSE, FALSE, FALSE }, // stop | 67 | { FALSE, FALSE, FALSE }, // stop |
67 | { FALSE, FALSE, FALSE }, // next | 68 | { FALSE, FALSE, FALSE }, // next |
@@ -72,8 +73,9 @@ MediaWidget::Button audioButtons[] = { | |||
72 | { FALSE, FALSE, FALSE }, // playlist | 73 | { FALSE, FALSE, FALSE }, // playlist |
73 | { FALSE, FALSE, FALSE }, // forward | 74 | { FALSE, FALSE, FALSE }, // forward |
74 | { FALSE, FALSE, FALSE } // back | 75 | { FALSE, FALSE, FALSE } // back |
75 | }; | 76 | }; |
77 | */ | ||
76 | 78 | ||
77 | const char * const skin_mask_file_names[10] = { | 79 | const char * const skin_mask_file_names[10] = { |
78 | "play", "stop", "next", "prev", "up", | 80 | "play", "stop", "next", "prev", "up", |
79 | "down", "loop", "playlist", "forward", "back" | 81 | "down", "loop", "playlist", "forward", "back" |
@@ -85,16 +87,34 @@ void changeTextColor( QWidget * w) { | |||
85 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 87 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
86 | w->setPalette( p ); | 88 | w->setPalette( p ); |
87 | } | 89 | } |
88 | 90 | ||
89 | const int numButtons = (sizeof(audioButtons)/sizeof(MediaWidget::Button)); | 91 | //const int numButtons = (sizeof(audioButtons)/sizeof(MediaWidget::Button)); |
90 | 92 | ||
91 | } | 93 | } |
92 | 94 | ||
93 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 95 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
94 | 96 | ||
95 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 97 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { |
96 | 98 | ||
99 | Button defaultButton; | ||
100 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; | ||
101 | Button toggleButton; | ||
102 | toggleButton.isToggle = true; | ||
103 | toggleButton.isHeld = toggleButton.isDown = false; | ||
104 | |||
105 | audioButtons.reserve( 10 ); | ||
106 | audioButtons.push_back( toggleButton ); // play | ||
107 | audioButtons.push_back( defaultButton ); // stop | ||
108 | audioButtons.push_back( defaultButton ); // next | ||
109 | audioButtons.push_back( defaultButton ); // previous | ||
110 | audioButtons.push_back( defaultButton ); // volume up | ||
111 | audioButtons.push_back( defaultButton ); // volume down | ||
112 | audioButtons.push_back( toggleButton ); // repeat/loop | ||
113 | audioButtons.push_back( defaultButton ); // playlist | ||
114 | audioButtons.push_back( defaultButton ); // forward | ||
115 | audioButtons.push_back( defaultButton ); // back | ||
116 | |||
97 | setCaption( tr("OpiePlayer") ); | 117 | setCaption( tr("OpiePlayer") ); |
98 | 118 | ||
99 | Config cfg("OpiePlayer"); | 119 | Config cfg("OpiePlayer"); |
100 | cfg.setGroup("Options"); | 120 | cfg.setGroup("Options"); |
@@ -379,9 +399,9 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
379 | } | 399 | } |
380 | 400 | ||
381 | 401 | ||
382 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 402 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
383 | for ( int i = 0; i < numButtons; i++ ) { | 403 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) { |
384 | if ( event->state() == QMouseEvent::LeftButton ) { | 404 | if ( event->state() == QMouseEvent::LeftButton ) { |
385 | // The test to see if the mouse click is inside the button or not | 405 | // The test to see if the mouse click is inside the button or not |
386 | int x = event->pos().x() - xoff; | 406 | int x = event->pos().x() - xoff; |
387 | int y = event->pos().y() - yoff; | 407 | int y = event->pos().y() - yoff; |
@@ -447,15 +467,15 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { | |||
447 | QPixmap pix( pe->rect().size() ); | 467 | QPixmap pix( pe->rect().size() ); |
448 | QPainter p( &pix ); | 468 | QPainter p( &pix ); |
449 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 469 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
450 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 470 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
451 | for ( int i = 0; i < numButtons; i++ ) | 471 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) |
452 | paintButton( &p, i ); | 472 | paintButton( &p, i ); |
453 | QPainter p2( this ); | 473 | QPainter p2( this ); |
454 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 474 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
455 | } else { | 475 | } else { |
456 | QPainter p( this ); | 476 | QPainter p( this ); |
457 | for ( int i = 0; i < numButtons; i++ ) | 477 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) |
458 | paintButton( &p, i ); | 478 | paintButton( &p, i ); |
459 | } | 479 | } |
460 | } | 480 | } |
461 | 481 | ||
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 52a358c..e09c5f8 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -109,8 +109,10 @@ private: | |||
109 | QSlider slider; | 109 | QSlider slider; |
110 | QLineEdit time; | 110 | QLineEdit time; |
111 | int xoff, yoff; | 111 | int xoff, yoff; |
112 | bool isStreaming : 1; | 112 | bool isStreaming : 1; |
113 | |||
114 | ButtonVector audioButtons; | ||
113 | }; | 115 | }; |
114 | 116 | ||
115 | 117 | ||
116 | #endif // AUDIO_WIDGET_H | 118 | #endif // AUDIO_WIDGET_H |