-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 |
2 files changed, 4 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 8f34736..adef247 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -51,49 +51,51 @@ | |||
51 | #include "playlistwidget.h" | 51 | #include "playlistwidget.h" |
52 | 52 | ||
53 | namespace | 53 | namespace |
54 | { | 54 | { |
55 | 55 | ||
56 | const int xo = -2; // movable x offset | 56 | const int xo = -2; // movable x offset |
57 | const int yo = 22; // movable y offset | 57 | const int yo = 22; // movable y offset |
58 | 58 | ||
59 | const char * const skin_mask_file_names[10] = { | 59 | const char * const skin_mask_file_names[10] = { |
60 | "play", "stop", "next", "prev", "up", | 60 | "play", "stop", "next", "prev", "up", |
61 | "down", "loop", "playlist", "forward", "back" | 61 | "down", "loop", "playlist", "forward", "back" |
62 | }; | 62 | }; |
63 | 63 | ||
64 | void changeTextColor( QWidget * w) { | 64 | void changeTextColor( QWidget * w) { |
65 | QPalette p = w->palette(); | 65 | QPalette p = w->palette(); |
66 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 66 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
67 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 67 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
68 | w->setPalette( p ); | 68 | w->setPalette( p ); |
69 | } | 69 | } |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 73 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
74 | 74 | ||
75 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { | 75 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
76 | audioSliderBeingMoved( false ) | ||
77 | { | ||
76 | 78 | ||
77 | Button defaultButton; | 79 | Button defaultButton; |
78 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; | 80 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; |
79 | Button toggleButton; | 81 | Button toggleButton; |
80 | toggleButton.isToggle = true; | 82 | toggleButton.isToggle = true; |
81 | toggleButton.isHeld = toggleButton.isDown = false; | 83 | toggleButton.isHeld = toggleButton.isDown = false; |
82 | 84 | ||
83 | buttons.reserve( 10 ); | 85 | buttons.reserve( 10 ); |
84 | buttons.push_back( toggleButton ); // play | 86 | buttons.push_back( toggleButton ); // play |
85 | buttons.push_back( defaultButton ); // stop | 87 | buttons.push_back( defaultButton ); // stop |
86 | buttons.push_back( defaultButton ); // next | 88 | buttons.push_back( defaultButton ); // next |
87 | buttons.push_back( defaultButton ); // previous | 89 | buttons.push_back( defaultButton ); // previous |
88 | buttons.push_back( defaultButton ); // volume up | 90 | buttons.push_back( defaultButton ); // volume up |
89 | buttons.push_back( defaultButton ); // volume down | 91 | buttons.push_back( defaultButton ); // volume down |
90 | buttons.push_back( toggleButton ); // repeat/loop | 92 | buttons.push_back( toggleButton ); // repeat/loop |
91 | buttons.push_back( defaultButton ); // playlist | 93 | buttons.push_back( defaultButton ); // playlist |
92 | buttons.push_back( defaultButton ); // forward | 94 | buttons.push_back( defaultButton ); // forward |
93 | buttons.push_back( defaultButton ); // back | 95 | buttons.push_back( defaultButton ); // back |
94 | 96 | ||
95 | setCaption( tr("OpiePlayer") ); | 97 | setCaption( tr("OpiePlayer") ); |
96 | 98 | ||
97 | Config cfg("OpiePlayer"); | 99 | Config cfg("OpiePlayer"); |
98 | cfg.setGroup("Options"); | 100 | cfg.setGroup("Options"); |
99 | skin = cfg.readEntry("Skin","default"); | 101 | skin = cfg.readEntry("Skin","default"); |
@@ -211,51 +213,48 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
211 | 213 | ||
212 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 214 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
213 | slider.setFixedWidth( w - 110 ); | 215 | slider.setFixedWidth( w - 110 ); |
214 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 216 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
215 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 217 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
216 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 218 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
217 | 219 | ||
218 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; | 220 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; |
219 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; | 221 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; |
220 | QPoint p = upperLeftOfButtonMask; | 222 | QPoint p = upperLeftOfButtonMask; |
221 | 223 | ||
222 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 224 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); |
223 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 225 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
224 | 226 | ||
225 | for ( int i = 0; i < 10; i++ ) { | 227 | for ( int i = 0; i < 10; i++ ) { |
226 | if ( !masks[i]->isNull() ) { | 228 | if ( !masks[i]->isNull() ) { |
227 | delete buttonPixUp[i]; | 229 | delete buttonPixUp[i]; |
228 | delete buttonPixDown[i]; | 230 | delete buttonPixDown[i]; |
229 | buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); | 231 | buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); |
230 | buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); | 232 | buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); |
231 | } | 233 | } |
232 | } | 234 | } |
233 | } | 235 | } |
234 | 236 | ||
235 | static bool audioSliderBeingMoved = FALSE; | ||
236 | |||
237 | |||
238 | void AudioWidget::sliderPressed() { | 237 | void AudioWidget::sliderPressed() { |
239 | audioSliderBeingMoved = TRUE; | 238 | audioSliderBeingMoved = TRUE; |
240 | } | 239 | } |
241 | 240 | ||
242 | 241 | ||
243 | void AudioWidget::sliderReleased() { | 242 | void AudioWidget::sliderReleased() { |
244 | audioSliderBeingMoved = FALSE; | 243 | audioSliderBeingMoved = FALSE; |
245 | if ( slider.width() == 0 ) | 244 | if ( slider.width() == 0 ) |
246 | return; | 245 | return; |
247 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 246 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
248 | mediaPlayerState.setPosition( val ); | 247 | mediaPlayerState.setPosition( val ); |
249 | } | 248 | } |
250 | 249 | ||
251 | void AudioWidget::setPosition( long i ) { | 250 | void AudioWidget::setPosition( long i ) { |
252 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 251 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
253 | updateSlider( i, mediaPlayerState.length() ); | 252 | updateSlider( i, mediaPlayerState.length() ); |
254 | } | 253 | } |
255 | 254 | ||
256 | 255 | ||
257 | void AudioWidget::setLength( long max ) { | 256 | void AudioWidget::setLength( long max ) { |
258 | updateSlider( mediaPlayerState.position(), max ); | 257 | updateSlider( mediaPlayerState.position(), max ); |
259 | } | 258 | } |
260 | 259 | ||
261 | 260 | ||
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 4598d51..8426490 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -86,29 +86,30 @@ protected: | |||
86 | void mouseReleaseEvent( QMouseEvent *event ); | 86 | void mouseReleaseEvent( QMouseEvent *event ); |
87 | void timerEvent( QTimerEvent *event ); | 87 | void timerEvent( QTimerEvent *event ); |
88 | void keyReleaseEvent( QKeyEvent *e); | 88 | void keyReleaseEvent( QKeyEvent *e); |
89 | private slots: | 89 | private slots: |
90 | void skipFor(); | 90 | void skipFor(); |
91 | void skipBack(); | 91 | void skipBack(); |
92 | void stopSkip(); | 92 | void stopSkip(); |
93 | private: | 93 | private: |
94 | void setToggleButton( int, bool ); | 94 | void setToggleButton( int, bool ); |
95 | virtual void paintButton( QPainter &p, int i ); | 95 | virtual void paintButton( QPainter &p, int i ); |
96 | int skipDirection; | 96 | int skipDirection; |
97 | QString skin; | 97 | QString skin; |
98 | QPixmap pixBg; | 98 | QPixmap pixBg; |
99 | QImage imgUp; | 99 | QImage imgUp; |
100 | QImage imgDn; | 100 | QImage imgDn; |
101 | QBitmap *masks[10]; | 101 | QBitmap *masks[10]; |
102 | QPixmap *buttonPixUp[10]; | 102 | QPixmap *buttonPixUp[10]; |
103 | QPixmap *buttonPixDown[10]; | 103 | QPixmap *buttonPixDown[10]; |
104 | 104 | ||
105 | QPixmap *pixmaps[4]; | 105 | QPixmap *pixmaps[4]; |
106 | OTicker songInfo; | 106 | OTicker songInfo; |
107 | QSlider slider; | 107 | QSlider slider; |
108 | QLineEdit time; | 108 | QLineEdit time; |
109 | bool isStreaming : 1; | 109 | bool isStreaming : 1; |
110 | bool audioSliderBeingMoved : 1; | ||
110 | }; | 111 | }; |
111 | 112 | ||
112 | 113 | ||
113 | #endif // AUDIO_WIDGET_H | 114 | #endif // AUDIO_WIDGET_H |
114 | 115 | ||