-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 15 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 46d374d..74bc390 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -115,97 +115,97 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | |||
115 | masks[i] = new QBitmap( filename ); | 115 | masks[i] = new QBitmap( filename ); |
116 | 116 | ||
117 | if ( !masks[i]->isNull() ) { | 117 | if ( !masks[i]->isNull() ) { |
118 | QImage imgMask = masks[i]->convertToImage(); | 118 | QImage imgMask = masks[i]->convertToImage(); |
119 | uchar **dest = imgButtonMask.jumpTable(); | 119 | uchar **dest = imgButtonMask.jumpTable(); |
120 | for ( int y = 0; y < imgUp.height(); y++ ) { | 120 | for ( int y = 0; y < imgUp.height(); y++ ) { |
121 | uchar *line = dest[y]; | 121 | uchar *line = dest[y]; |
122 | for ( int x = 0; x < imgUp.width(); x++ ) | 122 | for ( int x = 0; x < imgUp.width(); x++ ) |
123 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 123 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
124 | line[x] = i + 1; | 124 | line[x] = i + 1; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | } | 128 | } |
129 | 129 | ||
130 | for ( int i = 0; i < 10; i++ ) { | 130 | for ( int i = 0; i < 10; i++ ) { |
131 | buttonPixUp[i] = 0l; | 131 | buttonPixUp[i] = 0l; |
132 | buttonPixDown[i] = 0l; | 132 | buttonPixDown[i] = 0l; |
133 | } | 133 | } |
134 | 134 | ||
135 | setBackgroundPixmap( pixBg ); | 135 | setBackgroundPixmap( pixBg ); |
136 | 136 | ||
137 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 137 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
138 | // changeTextColor( &songInfo ); | 138 | // changeTextColor( &songInfo ); |
139 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 139 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
140 | // songInfo.setFrameStyle( QFrame::NoFrame); | 140 | // songInfo.setFrameStyle( QFrame::NoFrame); |
141 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 141 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
142 | // songInfo.setForegroundColor(Qt::white); | 142 | // songInfo.setForegroundColor(Qt::white); |
143 | 143 | ||
144 | slider.setFixedHeight( 20 ); | 144 | slider.setFixedHeight( 20 ); |
145 | slider.setMinValue( 0 ); | 145 | slider.setMinValue( 0 ); |
146 | slider.setMaxValue( 1 ); | 146 | slider.setMaxValue( 1 ); |
147 | slider.setFocusPolicy( QWidget::NoFocus ); | 147 | slider.setFocusPolicy( QWidget::NoFocus ); |
148 | slider.setBackgroundPixmap( pixBg ); | 148 | slider.setBackgroundPixmap( pixBg ); |
149 | 149 | ||
150 | // Config cofg("qpe"); | 150 | // Config cofg("qpe"); |
151 | // cofg.setGroup("Appearance"); | 151 | // cofg.setGroup("Appearance"); |
152 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | 152 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); |
153 | 153 | ||
154 | time.setFocusPolicy( QWidget::NoFocus ); | 154 | time.setFocusPolicy( QWidget::NoFocus ); |
155 | time.setAlignment( Qt::AlignCenter ); | 155 | time.setAlignment( Qt::AlignCenter ); |
156 | 156 | ||
157 | // time.setFrame(FALSE); | 157 | // time.setFrame(FALSE); |
158 | // changeTextColor( &time ); | 158 | // changeTextColor( &time ); |
159 | 159 | ||
160 | resizeEvent( NULL ); | 160 | resizeEvent( NULL ); |
161 | 161 | ||
162 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 162 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
163 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 163 | connect( mediaPlayerState, SIGNAL( mediaTypeChanged(MediaPlayerState::MediaType) ), this, SLOT( setMediaType(MediaPlayerState::MediaType) ) ); |
164 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 164 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
165 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 165 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
166 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 166 | connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
167 | 167 | ||
168 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 168 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
169 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 169 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
170 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 170 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
171 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 171 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
172 | 172 | ||
173 | // Intialise state | 173 | // Intialise state |
174 | setLength( mediaPlayerState->length() ); | 174 | setLength( mediaPlayerState->length() ); |
175 | setPosition( mediaPlayerState->position() ); | 175 | setPosition( mediaPlayerState->position() ); |
176 | setLooping( mediaPlayerState->isFullscreen() ); | 176 | setLooping( mediaPlayerState->isFullscreen() ); |
177 | // setPaused( mediaPlayerState->paused() ); | 177 | // setPaused( mediaPlayerState->paused() ); |
178 | setPlaying( mediaPlayerState->isPlaying() ); | 178 | setPlaying( mediaPlayerState->isPlaying() ); |
179 | 179 | ||
180 | } | 180 | } |
181 | 181 | ||
182 | AudioWidget::~AudioWidget() { | 182 | AudioWidget::~AudioWidget() { |
183 | 183 | ||
184 | for ( int i = 0; i < 10; i++ ) { | 184 | for ( int i = 0; i < 10; i++ ) { |
185 | delete buttonPixUp[i]; | 185 | delete buttonPixUp[i]; |
186 | delete buttonPixDown[i]; | 186 | delete buttonPixDown[i]; |
187 | } | 187 | } |
188 | for ( int i = 0; i < 10; i++ ) { | 188 | for ( int i = 0; i < 10; i++ ) { |
189 | delete masks[i]; | 189 | delete masks[i]; |
190 | } | 190 | } |
191 | // mediaPlayerState->setPlaying(false); | 191 | // mediaPlayerState->setPlaying(false); |
192 | } | 192 | } |
193 | 193 | ||
194 | namespace { | 194 | namespace { |
195 | 195 | ||
196 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 196 | QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
197 | QPixmap pix( img.width(), img.height() ); | 197 | QPixmap pix( img.width(), img.height() ); |
198 | QPainter p( &pix ); | 198 | QPainter p( &pix ); |
199 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 199 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
200 | p.drawImage( 0, 0, img ); | 200 | p.drawImage( 0, 0, img ); |
201 | return pix; | 201 | return pix; |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { | 205 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { |
206 | QPixmap *pixmap = new QPixmap( pix ); | 206 | QPixmap *pixmap = new QPixmap( pix ); |
207 | pixmap->setMask( mask ); | 207 | pixmap->setMask( mask ); |
208 | return pixmap; | 208 | return pixmap; |
209 | } | 209 | } |
210 | 210 | ||
211 | }; | 211 | }; |
@@ -219,106 +219,105 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
219 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 219 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
220 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 220 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
221 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 221 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
222 | 222 | ||
223 | xoff = ( w - imgUp.width() ) / 2; | 223 | xoff = ( w - imgUp.width() ) / 2; |
224 | yoff = (( h - imgUp.height() ) / 2) - 10; | 224 | yoff = (( h - imgUp.height() ) / 2) - 10; |
225 | QPoint p( xoff, yoff ); | 225 | QPoint p( xoff, yoff ); |
226 | 226 | ||
227 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 227 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); |
228 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 228 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
229 | 229 | ||
230 | for ( int i = 0; i < 10; i++ ) { | 230 | for ( int i = 0; i < 10; i++ ) { |
231 | if ( !masks[i]->isNull() ) { | 231 | if ( !masks[i]->isNull() ) { |
232 | delete buttonPixUp[i]; | 232 | delete buttonPixUp[i]; |
233 | delete buttonPixDown[i]; | 233 | delete buttonPixDown[i]; |
234 | buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); | 234 | buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); |
235 | buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); | 235 | buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); |
236 | } | 236 | } |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | static bool audioSliderBeingMoved = FALSE; | 240 | static bool audioSliderBeingMoved = FALSE; |
241 | 241 | ||
242 | 242 | ||
243 | void AudioWidget::sliderPressed() { | 243 | void AudioWidget::sliderPressed() { |
244 | audioSliderBeingMoved = TRUE; | 244 | audioSliderBeingMoved = TRUE; |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | void AudioWidget::sliderReleased() { | 248 | void AudioWidget::sliderReleased() { |
249 | audioSliderBeingMoved = FALSE; | 249 | audioSliderBeingMoved = FALSE; |
250 | if ( slider.width() == 0 ) | 250 | if ( slider.width() == 0 ) |
251 | return; | 251 | return; |
252 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); | 252 | long val = long((double)slider.value() * mediaPlayerState->length() / slider.width()); |
253 | mediaPlayerState->setPosition( val ); | 253 | mediaPlayerState->setPosition( val ); |
254 | } | 254 | } |
255 | 255 | ||
256 | void AudioWidget::setPosition( long i ) { | 256 | void AudioWidget::setPosition( long i ) { |
257 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 257 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
258 | updateSlider( i, mediaPlayerState->length() ); | 258 | updateSlider( i, mediaPlayerState->length() ); |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | void AudioWidget::setLength( long max ) { | 262 | void AudioWidget::setLength( long max ) { |
263 | updateSlider( mediaPlayerState->position(), max ); | 263 | updateSlider( mediaPlayerState->position(), max ); |
264 | } | 264 | } |
265 | 265 | ||
266 | 266 | ||
267 | void AudioWidget::setView( char view ) { | 267 | void AudioWidget::setMediaType( MediaPlayerState::MediaType mediaType ) { |
268 | 268 | if ( mediaType == MediaPlayerState::Video ) { | |
269 | if ( view == 'a' ) { | ||
270 | // startTimer( 150 ); | ||
271 | showMaximized(); | ||
272 | } else { | ||
273 | killTimers(); | 269 | killTimers(); |
274 | hide(); | 270 | hide(); |
271 | return; | ||
275 | } | 272 | } |
276 | // qApp->processEvents(); | 273 | |
274 | // startTimer( 150 ); | ||
275 | showMaximized(); | ||
277 | } | 276 | } |
278 | 277 | ||
279 | 278 | ||
280 | void AudioWidget::setSeekable( bool isSeekable ) { | 279 | void AudioWidget::setSeekable( bool isSeekable ) { |
281 | 280 | ||
282 | if ( !isSeekable ) { | 281 | if ( !isSeekable ) { |
283 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 282 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
284 | if( !slider.isHidden()) { | 283 | if( !slider.isHidden()) { |
285 | slider.hide(); | 284 | slider.hide(); |
286 | } | 285 | } |
287 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 286 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
288 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 287 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
289 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 288 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
290 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 289 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
291 | } else { | 290 | } else { |
292 | // this stops the slider from being moved, thus | 291 | // this stops the slider from being moved, thus |
293 | // does not stop stream when it reaches the end | 292 | // does not stop stream when it reaches the end |
294 | slider.show(); | 293 | slider.show(); |
295 | qDebug( " CONNECT SET POSTION " ); | 294 | qDebug( " CONNECT SET POSTION " ); |
296 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 295 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
297 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 296 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
298 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 297 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
299 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 298 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
300 | } | 299 | } |
301 | } | 300 | } |
302 | 301 | ||
303 | 302 | ||
304 | static QString timeAsString( long length ) { | 303 | static QString timeAsString( long length ) { |
305 | int minutes = length / 60; | 304 | int minutes = length / 60; |
306 | int seconds = length % 60; | 305 | int seconds = length % 60; |
307 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 306 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
308 | } | 307 | } |
309 | 308 | ||
310 | void AudioWidget::updateSlider( long i, long max ) { | 309 | void AudioWidget::updateSlider( long i, long max ) { |
311 | 310 | ||
312 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 311 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
313 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 312 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
314 | 313 | ||
315 | if ( max == 0 ) { | 314 | if ( max == 0 ) { |
316 | return; | 315 | return; |
317 | } | 316 | } |
318 | // Will flicker too much if we don't do this | 317 | // Will flicker too much if we don't do this |
319 | // Scale to something reasonable | 318 | // Scale to something reasonable |
320 | int width = slider.width(); | 319 | int width = slider.width(); |
321 | int val = int((double)i * width / max); | 320 | int val = int((double)i * width / max); |
322 | if ( !audioSliderBeingMoved ) { | 321 | if ( !audioSliderBeingMoved ) { |
323 | if ( slider.value() != val ) { | 322 | if ( slider.value() != val ) { |
324 | slider.setValue( val ); | 323 | slider.setValue( val ); |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 54adb36..3f0c059 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -1,130 +1,132 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef AUDIO_WIDGET_H | 34 | #ifndef AUDIO_WIDGET_H |
35 | #define AUDIO_WIDGET_H | 35 | #define AUDIO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qpainter.h> | 38 | #include <qpainter.h> |
39 | #include <qdrawutil.h> | 39 | #include <qdrawutil.h> |
40 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qslider.h> | 42 | #include <qslider.h> |
43 | #include <qframe.h> | 43 | #include <qframe.h> |
44 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
45 | #include <qimage.h> | 45 | #include <qimage.h> |
46 | 46 | ||
47 | #include <opie/oticker.h> | 47 | #include <opie/oticker.h> |
48 | 48 | ||
49 | #include "mediaplayerstate.h" | ||
50 | |||
49 | class QPixmap; | 51 | class QPixmap; |
50 | 52 | ||
51 | namespace { | 53 | namespace { |
52 | 54 | ||
53 | enum AudioButtons { | 55 | enum AudioButtons { |
54 | AudioPlay=0, | 56 | AudioPlay=0, |
55 | AudioStop, | 57 | AudioStop, |
56 | AudioNext, | 58 | AudioNext, |
57 | AudioPrevious, | 59 | AudioPrevious, |
58 | AudioVolumeUp, | 60 | AudioVolumeUp, |
59 | AudioVolumeDown, | 61 | AudioVolumeDown, |
60 | AudioLoop, | 62 | AudioLoop, |
61 | AudioPlayList, | 63 | AudioPlayList, |
62 | AudioForward, | 64 | AudioForward, |
63 | AudioBack | 65 | AudioBack |
64 | }; | 66 | }; |
65 | }; | 67 | }; |
66 | 68 | ||
67 | class AudioWidget : public QWidget { | 69 | class AudioWidget : public QWidget { |
68 | Q_OBJECT | 70 | Q_OBJECT |
69 | public: | 71 | public: |
70 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 72 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
71 | ~AudioWidget(); | 73 | ~AudioWidget(); |
72 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 74 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
73 | public slots: | 75 | public slots: |
74 | void updateSlider( long, long ); | 76 | void updateSlider( long, long ); |
75 | void sliderPressed( ); | 77 | void sliderPressed( ); |
76 | void sliderReleased( ); | 78 | void sliderReleased( ); |
77 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 79 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
78 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | 80 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } |
79 | void setPosition( long ); | 81 | void setPosition( long ); |
80 | void setLength( long ); | 82 | void setLength( long ); |
81 | void setSeekable( bool ); | 83 | void setSeekable( bool ); |
82 | void setView( char ); | 84 | void setMediaType( MediaPlayerState::MediaType mediaType ); |
83 | 85 | ||
84 | signals: | 86 | signals: |
85 | void moreClicked(); | 87 | void moreClicked(); |
86 | void lessClicked(); | 88 | void lessClicked(); |
87 | void moreReleased(); | 89 | void moreReleased(); |
88 | void lessReleased(); | 90 | void lessReleased(); |
89 | void forwardClicked(); | 91 | void forwardClicked(); |
90 | void backClicked(); | 92 | void backClicked(); |
91 | void forwardReleased(); | 93 | void forwardReleased(); |
92 | void backReleased(); | 94 | void backReleased(); |
93 | void sliderMoved(long); | 95 | void sliderMoved(long); |
94 | 96 | ||
95 | protected: | 97 | protected: |
96 | void doBlank(); | 98 | void doBlank(); |
97 | void doUnblank(); | 99 | void doUnblank(); |
98 | void paintEvent( QPaintEvent *pe ); | 100 | void paintEvent( QPaintEvent *pe ); |
99 | void showEvent( QShowEvent *se ); | 101 | void showEvent( QShowEvent *se ); |
100 | void resizeEvent( QResizeEvent *re ); | 102 | void resizeEvent( QResizeEvent *re ); |
101 | void mouseMoveEvent( QMouseEvent *event ); | 103 | void mouseMoveEvent( QMouseEvent *event ); |
102 | void mousePressEvent( QMouseEvent *event ); | 104 | void mousePressEvent( QMouseEvent *event ); |
103 | void mouseReleaseEvent( QMouseEvent *event ); | 105 | void mouseReleaseEvent( QMouseEvent *event ); |
104 | void timerEvent( QTimerEvent *event ); | 106 | void timerEvent( QTimerEvent *event ); |
105 | void closeEvent( QCloseEvent *event ); | 107 | void closeEvent( QCloseEvent *event ); |
106 | void keyReleaseEvent( QKeyEvent *e); | 108 | void keyReleaseEvent( QKeyEvent *e); |
107 | private slots: | 109 | private slots: |
108 | void skipFor(); | 110 | void skipFor(); |
109 | void skipBack(); | 111 | void skipBack(); |
110 | void stopSkip(); | 112 | void stopSkip(); |
111 | private: | 113 | private: |
112 | void toggleButton( int ); | 114 | void toggleButton( int ); |
113 | void setToggleButton( int, bool ); | 115 | void setToggleButton( int, bool ); |
114 | void paintButton( QPainter *p, int i ); | 116 | void paintButton( QPainter *p, int i ); |
115 | int skipDirection; | 117 | int skipDirection; |
116 | QString skin; | 118 | QString skin; |
117 | QPixmap pixBg; | 119 | QPixmap pixBg; |
118 | QImage imgUp; | 120 | QImage imgUp; |
119 | QImage imgDn; | 121 | QImage imgDn; |
120 | QImage imgButtonMask; | 122 | QImage imgButtonMask; |
121 | QBitmap *masks[10]; | 123 | QBitmap *masks[10]; |
122 | QPixmap *buttonPixUp[10]; | 124 | QPixmap *buttonPixUp[10]; |
123 | QPixmap *buttonPixDown[10]; | 125 | QPixmap *buttonPixDown[10]; |
124 | 126 | ||
125 | QPixmap *pixmaps[4]; | 127 | QPixmap *pixmaps[4]; |
126 | OTicker songInfo; | 128 | OTicker songInfo; |
127 | QSlider slider; | 129 | QSlider slider; |
128 | QLineEdit time; | 130 | QLineEdit time; |
129 | int xoff, yoff; | 131 | int xoff, yoff; |
130 | bool isStreaming : 1; | 132 | bool isStreaming : 1; |