author | simon <simon> | 2002-12-09 20:13:12 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 20:13:12 (UTC) |
commit | accc4e231dc34744e75d32af77eeb98f46006c27 (patch) (unidiff) | |
tree | 1ee00b2439fb186f7851da602166b1571b9bc600 | |
parent | 2d2d57e3b7988f4246319cdfd0dc7fa90110db8e (diff) | |
download | opie-accc4e231dc34744e75d32af77eeb98f46006c27.zip opie-accc4e231dc34744e75d32af77eeb98f46006c27.tar.gz opie-accc4e231dc34744e75d32af77eeb98f46006c27.tar.bz2 |
- minor cleanup
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
4 files changed, 2 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 8e9bbf1..23d12ec 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -208,192 +208,187 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
208 | 208 | ||
209 | QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p ); | 209 | QPixmap pixUp = combineImageWithBackground( imgUp, backgroundPixmap, p ); |
210 | QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); | 210 | QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); |
211 | 211 | ||
212 | for ( uint i = 0; i < buttons.size(); i++ ) { | 212 | for ( uint i = 0; i < buttons.size(); i++ ) { |
213 | if ( !buttons[i].mask.isNull() ) { | 213 | if ( !buttons[i].mask.isNull() ) { |
214 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); | 214 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); |
215 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); | 215 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | void AudioWidget::sliderPressed() { | 220 | void AudioWidget::sliderPressed() { |
221 | audioSliderBeingMoved = TRUE; | 221 | audioSliderBeingMoved = TRUE; |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | void AudioWidget::sliderReleased() { | 225 | void AudioWidget::sliderReleased() { |
226 | audioSliderBeingMoved = FALSE; | 226 | audioSliderBeingMoved = FALSE; |
227 | if ( slider.width() == 0 ) | 227 | if ( slider.width() == 0 ) |
228 | return; | 228 | return; |
229 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 229 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
230 | mediaPlayerState.setPosition( val ); | 230 | mediaPlayerState.setPosition( val ); |
231 | } | 231 | } |
232 | 232 | ||
233 | void AudioWidget::setPosition( long i ) { | 233 | void AudioWidget::setPosition( long i ) { |
234 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 234 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
235 | updateSlider( i, mediaPlayerState.length() ); | 235 | updateSlider( i, mediaPlayerState.length() ); |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | void AudioWidget::setLength( long max ) { | 239 | void AudioWidget::setLength( long max ) { |
240 | updateSlider( mediaPlayerState.position(), max ); | 240 | updateSlider( mediaPlayerState.position(), max ); |
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 244 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
245 | if ( mediaType == MediaPlayerState::Audio ) { | 245 | if ( mediaType == MediaPlayerState::Audio ) { |
246 | // startTimer( 150 ); | 246 | // startTimer( 150 ); |
247 | showMaximized(); | 247 | showMaximized(); |
248 | return; | 248 | return; |
249 | } | 249 | } |
250 | 250 | ||
251 | killTimers(); | 251 | killTimers(); |
252 | hide(); | 252 | hide(); |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | void AudioWidget::setSeekable( bool isSeekable ) { | 256 | void AudioWidget::setSeekable( bool isSeekable ) { |
257 | 257 | ||
258 | if ( !isSeekable ) { | 258 | if ( !isSeekable ) { |
259 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 259 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
260 | if( !slider.isHidden()) { | 260 | if( !slider.isHidden()) { |
261 | slider.hide(); | 261 | slider.hide(); |
262 | } | 262 | } |
263 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 263 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
264 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 264 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
265 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 265 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
266 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 266 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
267 | } else { | 267 | } else { |
268 | // this stops the slider from being moved, thus | 268 | // this stops the slider from being moved, thus |
269 | // does not stop stream when it reaches the end | 269 | // does not stop stream when it reaches the end |
270 | slider.show(); | 270 | slider.show(); |
271 | qDebug( " CONNECT SET POSTION " ); | 271 | qDebug( " CONNECT SET POSTION " ); |
272 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 272 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
273 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 273 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
274 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 274 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
275 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 275 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | static QString timeAsString( long length ) { | 280 | static QString timeAsString( long length ) { |
281 | int minutes = length / 60; | 281 | int minutes = length / 60; |
282 | int seconds = length % 60; | 282 | int seconds = length % 60; |
283 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 283 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
284 | } | 284 | } |
285 | 285 | ||
286 | void AudioWidget::updateSlider( long i, long max ) { | 286 | void AudioWidget::updateSlider( long i, long max ) { |
287 | 287 | ||
288 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 288 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
289 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 289 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
290 | 290 | ||
291 | if ( max == 0 ) { | 291 | if ( max == 0 ) { |
292 | return; | 292 | return; |
293 | } | 293 | } |
294 | // Will flicker too much if we don't do this | 294 | // Will flicker too much if we don't do this |
295 | // Scale to something reasonable | 295 | // Scale to something reasonable |
296 | int width = slider.width(); | 296 | int width = slider.width(); |
297 | int val = int((double)i * width / max); | 297 | int val = int((double)i * width / max); |
298 | if ( !audioSliderBeingMoved ) { | 298 | if ( !audioSliderBeingMoved ) { |
299 | if ( slider.value() != val ) { | 299 | if ( slider.value() != val ) { |
300 | slider.setValue( val ); | 300 | slider.setValue( val ); |
301 | } | 301 | } |
302 | 302 | ||
303 | if ( slider.maxValue() != width ) { | 303 | if ( slider.maxValue() != width ) { |
304 | slider.setMaxValue( width ); | 304 | slider.setMaxValue( width ); |
305 | } | 305 | } |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | void AudioWidget::skipFor() { | 309 | void AudioWidget::skipFor() { |
310 | skipDirection = +1; | 310 | skipDirection = +1; |
311 | startTimer( 50 ); | 311 | startTimer( 50 ); |
312 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 312 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
313 | } | 313 | } |
314 | 314 | ||
315 | void AudioWidget::skipBack() { | 315 | void AudioWidget::skipBack() { |
316 | skipDirection = -1; | 316 | skipDirection = -1; |
317 | startTimer( 50 ); | 317 | startTimer( 50 ); |
318 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 318 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | 322 | ||
323 | void AudioWidget::stopSkip() { | 323 | void AudioWidget::stopSkip() { |
324 | killTimers(); | 324 | killTimers(); |
325 | } | 325 | } |
326 | 326 | ||
327 | 327 | ||
328 | void AudioWidget::timerEvent( QTimerEvent * ) { | 328 | void AudioWidget::timerEvent( QTimerEvent * ) { |
329 | if ( skipDirection == +1 ) { | 329 | if ( skipDirection == +1 ) { |
330 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 330 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
331 | } else if ( skipDirection == -1 ) { | 331 | } else if ( skipDirection == -1 ) { |
332 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 332 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
336 | void AudioWidget::showEvent( QShowEvent* ) { | ||
337 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | ||
338 | mouseMoveEvent( &event ); | ||
339 | } | ||
340 | |||
341 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 336 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
342 | switch ( e->key() ) { | 337 | switch ( e->key() ) { |
343 | ////////////////////////////// Zaurus keys | 338 | ////////////////////////////// Zaurus keys |
344 | case Key_Home: | 339 | case Key_Home: |
345 | break; | 340 | break; |
346 | case Key_F9: //activity | 341 | case Key_F9: //activity |
347 | hide(); | 342 | hide(); |
348 | // qDebug("Audio F9"); | 343 | // qDebug("Audio F9"); |
349 | e->accept(); | 344 | e->accept(); |
350 | break; | 345 | break; |
351 | case Key_F10: //contacts | 346 | case Key_F10: //contacts |
352 | break; | 347 | break; |
353 | case Key_F11: //menu | 348 | case Key_F11: //menu |
354 | mediaPlayerState.toggleBlank(); | 349 | mediaPlayerState.toggleBlank(); |
355 | e->accept(); | 350 | e->accept(); |
356 | break; | 351 | break; |
357 | case Key_F12: //home | 352 | case Key_F12: //home |
358 | break; | 353 | break; |
359 | case Key_F13: //mail | 354 | case Key_F13: //mail |
360 | mediaPlayerState.toggleBlank(); | 355 | mediaPlayerState.toggleBlank(); |
361 | e->accept(); | 356 | e->accept(); |
362 | break; | 357 | break; |
363 | case Key_Space: { | 358 | case Key_Space: { |
364 | e->accept(); | 359 | e->accept(); |
365 | mediaPlayerState.togglePaused(); | 360 | mediaPlayerState.togglePaused(); |
366 | } | 361 | } |
367 | break; | 362 | break; |
368 | case Key_Down: | 363 | case Key_Down: |
369 | // toggleButton(6); | 364 | // toggleButton(6); |
370 | emit lessClicked(); | 365 | emit lessClicked(); |
371 | emit lessReleased(); | 366 | emit lessReleased(); |
372 | // toggleButton(6); | 367 | // toggleButton(6); |
373 | e->accept(); | 368 | e->accept(); |
374 | break; | 369 | break; |
375 | case Key_Up: | 370 | case Key_Up: |
376 | // toggleButton(5); | 371 | // toggleButton(5); |
377 | emit moreClicked(); | 372 | emit moreClicked(); |
378 | emit moreReleased(); | 373 | emit moreReleased(); |
379 | // toggleButton(5); | 374 | // toggleButton(5); |
380 | e->accept(); | 375 | e->accept(); |
381 | break; | 376 | break; |
382 | case Key_Right: | 377 | case Key_Right: |
383 | // toggleButton(3); | 378 | // toggleButton(3); |
384 | mediaPlayerState.setNext(); | 379 | mediaPlayerState.setNext(); |
385 | // toggleButton(3); | 380 | // toggleButton(3); |
386 | e->accept(); | 381 | e->accept(); |
387 | break; | 382 | break; |
388 | case Key_Left: | 383 | case Key_Left: |
389 | // toggleButton(4); | 384 | // toggleButton(4); |
390 | mediaPlayerState.setPrev(); | 385 | mediaPlayerState.setPrev(); |
391 | // toggleButton(4); | 386 | // toggleButton(4); |
392 | e->accept(); | 387 | e->accept(); |
393 | break; | 388 | break; |
394 | case Key_Escape: { | 389 | case Key_Escape: { |
395 | } | 390 | } |
396 | break; | 391 | break; |
397 | 392 | ||
398 | }; | 393 | }; |
399 | } | 394 | } |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index e2e2314..53982a1 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -1,100 +1,99 @@ | |||
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 <qpainter.h> | 37 | #include <qpainter.h> |
38 | #include <qdrawutil.h> | 38 | #include <qdrawutil.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include <qstring.h> | 40 | #include <qstring.h> |
41 | #include <qslider.h> | 41 | #include <qslider.h> |
42 | #include <qframe.h> | 42 | #include <qframe.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qimage.h> | 44 | #include <qimage.h> |
45 | 45 | ||
46 | #include <opie/oticker.h> | 46 | #include <opie/oticker.h> |
47 | 47 | ||
48 | #include "mediawidget.h" | 48 | #include "mediawidget.h" |
49 | 49 | ||
50 | class QPixmap; | 50 | class QPixmap; |
51 | 51 | ||
52 | class AudioWidget : public MediaWidget { | 52 | class AudioWidget : public MediaWidget { |
53 | Q_OBJECT | 53 | Q_OBJECT |
54 | public: | 54 | public: |
55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 55 | AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
56 | ~AudioWidget(); | 56 | ~AudioWidget(); |
57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 57 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
58 | public slots: | 58 | public slots: |
59 | void updateSlider( long, long ); | 59 | void updateSlider( long, long ); |
60 | void sliderPressed( ); | 60 | void sliderPressed( ); |
61 | void sliderReleased( ); | 61 | void sliderReleased( ); |
62 | void setLooping( bool b) { setToggleButton( Loop, b ); } | 62 | void setLooping( bool b) { setToggleButton( Loop, b ); } |
63 | void setPosition( long ); | 63 | void setPosition( long ); |
64 | void setSeekable( bool ); | 64 | void setSeekable( bool ); |
65 | 65 | ||
66 | public: | 66 | public: |
67 | virtual void setLength( long ); | 67 | virtual void setLength( long ); |
68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } | 68 | virtual void setPlaying( bool b) { setToggleButton( Play, b ); } |
69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 69 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
70 | 70 | ||
71 | signals: | 71 | signals: |
72 | void sliderMoved(long); | 72 | void sliderMoved(long); |
73 | 73 | ||
74 | protected: | 74 | protected: |
75 | void doBlank(); | 75 | void doBlank(); |
76 | void doUnblank(); | 76 | void doUnblank(); |
77 | void showEvent( QShowEvent *se ); | ||
78 | void resizeEvent( QResizeEvent *re ); | 77 | void resizeEvent( QResizeEvent *re ); |
79 | void timerEvent( QTimerEvent *event ); | 78 | void timerEvent( QTimerEvent *event ); |
80 | void keyReleaseEvent( QKeyEvent *e); | 79 | void keyReleaseEvent( QKeyEvent *e); |
81 | private slots: | 80 | private slots: |
82 | void skipFor(); | 81 | void skipFor(); |
83 | void skipBack(); | 82 | void skipBack(); |
84 | void stopSkip(); | 83 | void stopSkip(); |
85 | private: | 84 | private: |
86 | int skipDirection; | 85 | int skipDirection; |
87 | QString skin; | 86 | QString skin; |
88 | QImage imgUp; | 87 | QImage imgUp; |
89 | QImage imgDn; | 88 | QImage imgDn; |
90 | 89 | ||
91 | OTicker songInfo; | 90 | OTicker songInfo; |
92 | QSlider slider; | 91 | QSlider slider; |
93 | QLineEdit time; | 92 | QLineEdit time; |
94 | bool isStreaming : 1; | 93 | bool isStreaming : 1; |
95 | bool audioSliderBeingMoved : 1; | 94 | bool audioSliderBeingMoved : 1; |
96 | }; | 95 | }; |
97 | 96 | ||
98 | 97 | ||
99 | #endif // AUDIO_WIDGET_H | 98 | #endif // AUDIO_WIDGET_H |
100 | 99 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 04b09f9..4901e47 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -124,247 +124,241 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
124 | slider = new QSlider( Qt::Horizontal, this ); | 124 | slider = new QSlider( Qt::Horizontal, this ); |
125 | slider->setMinValue( 0 ); | 125 | slider->setMinValue( 0 ); |
126 | slider->setMaxValue( 1 ); | 126 | slider->setMaxValue( 1 ); |
127 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 127 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
128 | //slider->setFocusPolicy( QWidget::NoFocus ); | 128 | //slider->setFocusPolicy( QWidget::NoFocus ); |
129 | 129 | ||
130 | resizeEvent( NULL ); | 130 | resizeEvent( NULL ); |
131 | 131 | ||
132 | setLength( mediaPlayerState.length() ); | 132 | setLength( mediaPlayerState.length() ); |
133 | setPosition( mediaPlayerState.position() ); | 133 | setPosition( mediaPlayerState.position() ); |
134 | setFullscreen( mediaPlayerState.isFullscreen() ); | 134 | setFullscreen( mediaPlayerState.isFullscreen() ); |
135 | setPlaying( mediaPlayerState.isPlaying() ); | 135 | setPlaying( mediaPlayerState.isPlaying() ); |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | VideoWidget::~VideoWidget() | 139 | VideoWidget::~VideoWidget() |
140 | { | 140 | { |
141 | } | 141 | } |
142 | 142 | ||
143 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 143 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
144 | QPixmap pix( img.width(), img.height() ); | 144 | QPixmap pix( img.width(), img.height() ); |
145 | QPainter p( &pix ); | 145 | QPainter p( &pix ); |
146 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 146 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
147 | p.drawImage( 0, 0, img ); | 147 | p.drawImage( 0, 0, img ); |
148 | return new QPixmap( pix ); | 148 | return new QPixmap( pix ); |
149 | } | 149 | } |
150 | 150 | ||
151 | QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { | 151 | QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) { |
152 | QPixmap pixmap( pix ); | 152 | QPixmap pixmap( pix ); |
153 | pixmap.setMask( mask ); | 153 | pixmap.setMask( mask ); |
154 | return pixmap; | 154 | return pixmap; |
155 | } | 155 | } |
156 | 156 | ||
157 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 157 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
158 | int h = height(); | 158 | int h = height(); |
159 | int w = width(); | 159 | int w = width(); |
160 | //int Vh = 160; | 160 | //int Vh = 160; |
161 | //int Vw = 220; | 161 | //int Vw = 220; |
162 | 162 | ||
163 | slider->setFixedWidth( w - 20 ); | 163 | slider->setFixedWidth( w - 20 ); |
164 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 164 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
165 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 165 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
166 | slider->setFocusPolicy( QWidget::NoFocus ); | 166 | slider->setFocusPolicy( QWidget::NoFocus ); |
167 | slider->setBackgroundPixmap( backgroundPixmap ); | 167 | slider->setBackgroundPixmap( backgroundPixmap ); |
168 | 168 | ||
169 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; | 169 | upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; |
170 | if(w>h) | 170 | if(w>h) |
171 | upperLeftOfButtonMask.ry() = 0; | 171 | upperLeftOfButtonMask.ry() = 0; |
172 | else | 172 | else |
173 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 173 | upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
174 | QPoint p = upperLeftOfButtonMask; | 174 | QPoint p = upperLeftOfButtonMask; |
175 | 175 | ||
176 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); | 176 | QPixmap *pixUp = combineVImageWithBackground( imgUp, backgroundPixmap, p ); |
177 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); | 177 | QPixmap *pixDn = combineVImageWithBackground( imgDn, backgroundPixmap, p ); |
178 | 178 | ||
179 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { | 179 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { |
180 | Button &button = *it; | 180 | Button &button = *it; |
181 | 181 | ||
182 | if ( !button.mask.isNull() ) { | 182 | if ( !button.mask.isNull() ) { |
183 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); | 183 | button.pixUp = maskVPixToMask( *pixUp, button.mask ); |
184 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); | 184 | button.pixDown = maskVPixToMask( *pixDn, button.mask ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | delete pixUp; | 188 | delete pixUp; |
189 | delete pixDn; | 189 | delete pixDn; |
190 | } | 190 | } |
191 | 191 | ||
192 | void VideoWidget::sliderPressed() { | 192 | void VideoWidget::sliderPressed() { |
193 | videoSliderBeingMoved = TRUE; | 193 | videoSliderBeingMoved = TRUE; |
194 | } | 194 | } |
195 | 195 | ||
196 | void VideoWidget::sliderReleased() { | 196 | void VideoWidget::sliderReleased() { |
197 | videoSliderBeingMoved = FALSE; | 197 | videoSliderBeingMoved = FALSE; |
198 | if ( slider->width() == 0 ) { | 198 | if ( slider->width() == 0 ) { |
199 | return; | 199 | return; |
200 | } | 200 | } |
201 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); | 201 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); |
202 | mediaPlayerState.setPosition( val ); | 202 | mediaPlayerState.setPosition( val ); |
203 | } | 203 | } |
204 | 204 | ||
205 | void VideoWidget::setPosition( long i ) { | 205 | void VideoWidget::setPosition( long i ) { |
206 | updateSlider( i, mediaPlayerState.length() ); | 206 | updateSlider( i, mediaPlayerState.length() ); |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | ||
210 | void VideoWidget::setLength( long max ) { | 210 | void VideoWidget::setLength( long max ) { |
211 | updateSlider( mediaPlayerState.position(), max ); | 211 | updateSlider( mediaPlayerState.position(), max ); |
212 | } | 212 | } |
213 | 213 | ||
214 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | 214 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) |
215 | { | 215 | { |
216 | if ( displayType == MediaPlayerState::Video ) { | 216 | if ( displayType == MediaPlayerState::Video ) { |
217 | makeVisible(); | 217 | makeVisible(); |
218 | return; | 218 | return; |
219 | } | 219 | } |
220 | 220 | ||
221 | // Effectively blank the view next time we show it so it looks nicer | 221 | // Effectively blank the view next time we show it so it looks nicer |
222 | scaledWidth = 0; | 222 | scaledWidth = 0; |
223 | scaledHeight = 0; | 223 | scaledHeight = 0; |
224 | hide(); | 224 | hide(); |
225 | } | 225 | } |
226 | 226 | ||
227 | void VideoWidget::updateSlider( long i, long max ) { | 227 | void VideoWidget::updateSlider( long i, long max ) { |
228 | // Will flicker too much if we don't do this | 228 | // Will flicker too much if we don't do this |
229 | if ( max == 0 ) { | 229 | if ( max == 0 ) { |
230 | return; | 230 | return; |
231 | } | 231 | } |
232 | int width = slider->width(); | 232 | int width = slider->width(); |
233 | int val = int((double)i * width / max); | 233 | int val = int((double)i * width / max); |
234 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 234 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
235 | if ( slider->value() != val ) { | 235 | if ( slider->value() != val ) { |
236 | slider->setValue( val ); | 236 | slider->setValue( val ); |
237 | } | 237 | } |
238 | if ( slider->maxValue() != width ) { | 238 | if ( slider->maxValue() != width ) { |
239 | slider->setMaxValue( width ); | 239 | slider->setMaxValue( width ); |
240 | } | 240 | } |
241 | } | 241 | } |
242 | } | 242 | } |
243 | 243 | ||
244 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 244 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
245 | if ( mediaPlayerState.isFullscreen() ) { | 245 | if ( mediaPlayerState.isFullscreen() ) { |
246 | mediaPlayerState.setFullscreen( FALSE ); | 246 | mediaPlayerState.setFullscreen( FALSE ); |
247 | makeVisible(); | 247 | makeVisible(); |
248 | } | 248 | } |
249 | MediaWidget::mouseReleaseEvent( event ); | 249 | MediaWidget::mouseReleaseEvent( event ); |
250 | } | 250 | } |
251 | 251 | ||
252 | void VideoWidget::showEvent( QShowEvent* ) { | 252 | void VideoWidget::backToNormal() { |
253 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | ||
254 | mouseMoveEvent( &event ); | ||
255 | } | ||
256 | |||
257 | |||
258 | void VideoWidget::backToNormal() { | ||
259 | mediaPlayerState.setFullscreen( FALSE ); | 253 | mediaPlayerState.setFullscreen( FALSE ); |
260 | makeVisible(); | 254 | makeVisible(); |
261 | } | 255 | } |
262 | 256 | ||
263 | void VideoWidget::makeVisible() { | 257 | void VideoWidget::makeVisible() { |
264 | if ( mediaPlayerState.isFullscreen() ) { | 258 | if ( mediaPlayerState.isFullscreen() ) { |
265 | setBackgroundMode( QWidget::NoBackground ); | 259 | setBackgroundMode( QWidget::NoBackground ); |
266 | showFullScreen(); | 260 | showFullScreen(); |
267 | resize( qApp->desktop()->size() ); | 261 | resize( qApp->desktop()->size() ); |
268 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 262 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
269 | 263 | ||
270 | slider->hide(); | 264 | slider->hide(); |
271 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 265 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
272 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 266 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
273 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 267 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
274 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 268 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
275 | 269 | ||
276 | } else { | 270 | } else { |
277 | showNormal(); | 271 | showNormal(); |
278 | showMaximized(); | 272 | showMaximized(); |
279 | setBackgroundPixmap( backgroundPixmap ); | 273 | setBackgroundPixmap( backgroundPixmap ); |
280 | QWidget *d = QApplication::desktop(); | 274 | QWidget *d = QApplication::desktop(); |
281 | int w = d->width(); | 275 | int w = d->width(); |
282 | int h = d->height(); | 276 | int h = d->height(); |
283 | 277 | ||
284 | if(w>h) { | 278 | if(w>h) { |
285 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 279 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
286 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 280 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
287 | } else { | 281 | } else { |
288 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 282 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
289 | } | 283 | } |
290 | 284 | ||
291 | if ( !mediaPlayerState.isSeekable() ) { | 285 | if ( !mediaPlayerState.isSeekable() ) { |
292 | if( !slider->isHidden()) { | 286 | if( !slider->isHidden()) { |
293 | slider->hide(); | 287 | slider->hide(); |
294 | } | 288 | } |
295 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 289 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
296 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 290 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
297 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 291 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
298 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 292 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
299 | } else { | 293 | } else { |
300 | slider->show(); | 294 | slider->show(); |
301 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 295 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
302 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 296 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
303 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 297 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
304 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 298 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
305 | } | 299 | } |
306 | } | 300 | } |
307 | } | 301 | } |
308 | 302 | ||
309 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 303 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
310 | switch ( e->key() ) { | 304 | switch ( e->key() ) { |
311 | ////////////////////////////// Zaurus keys | 305 | ////////////////////////////// Zaurus keys |
312 | case Key_Home: | 306 | case Key_Home: |
313 | break; | 307 | break; |
314 | case Key_F9: //activity | 308 | case Key_F9: //activity |
315 | break; | 309 | break; |
316 | case Key_F10: //contacts | 310 | case Key_F10: //contacts |
317 | // hide(); | 311 | // hide(); |
318 | break; | 312 | break; |
319 | case Key_F11: //menu | 313 | case Key_F11: //menu |
320 | break; | 314 | break; |
321 | case Key_F12: //home | 315 | case Key_F12: //home |
322 | break; | 316 | break; |
323 | case Key_F13: //mail | 317 | case Key_F13: //mail |
324 | break; | 318 | break; |
325 | case Key_Space: { | 319 | case Key_Space: { |
326 | if(mediaPlayerState.isPlaying()) { | 320 | if(mediaPlayerState.isPlaying()) { |
327 | mediaPlayerState.setPlaying(FALSE); | 321 | mediaPlayerState.setPlaying(FALSE); |
328 | } else { | 322 | } else { |
329 | mediaPlayerState.setPlaying(TRUE); | 323 | mediaPlayerState.setPlaying(TRUE); |
330 | } | 324 | } |
331 | } | 325 | } |
332 | break; | 326 | break; |
333 | case Key_Down: | 327 | case Key_Down: |
334 | // toggleButton(6); | 328 | // toggleButton(6); |
335 | emit lessClicked(); | 329 | emit lessClicked(); |
336 | emit lessReleased(); | 330 | emit lessReleased(); |
337 | // toggleButton(6); | 331 | // toggleButton(6); |
338 | break; | 332 | break; |
339 | case Key_Up: | 333 | case Key_Up: |
340 | // toggleButton(5); | 334 | // toggleButton(5); |
341 | emit moreClicked(); | 335 | emit moreClicked(); |
342 | emit moreReleased(); | 336 | emit moreReleased(); |
343 | // toggleButton(5); | 337 | // toggleButton(5); |
344 | break; | 338 | break; |
345 | case Key_Right: | 339 | case Key_Right: |
346 | mediaPlayerState.setNext(); | 340 | mediaPlayerState.setNext(); |
347 | break; | 341 | break; |
348 | case Key_Left: | 342 | case Key_Left: |
349 | mediaPlayerState.setPrev(); | 343 | mediaPlayerState.setPrev(); |
350 | break; | 344 | break; |
351 | case Key_Escape: | 345 | case Key_Escape: |
352 | break; | 346 | break; |
353 | 347 | ||
354 | }; | 348 | }; |
355 | } | 349 | } |
356 | 350 | ||
357 | XineVideoWidget* VideoWidget::vidWidget() { | 351 | XineVideoWidget* VideoWidget::vidWidget() { |
358 | return videoFrame; | 352 | return videoFrame; |
359 | } | 353 | } |
360 | 354 | ||
361 | 355 | ||
362 | void VideoWidget::setFullscreen ( bool b ) { | 356 | void VideoWidget::setFullscreen ( bool b ) { |
363 | setToggleButton( FullScreen, b ); | 357 | setToggleButton( FullScreen, b ); |
364 | } | 358 | } |
365 | 359 | ||
366 | 360 | ||
367 | void VideoWidget::setPlaying( bool b) { | 361 | void VideoWidget::setPlaying( bool b) { |
368 | setToggleButton( Play, b ); | 362 | setToggleButton( Play, b ); |
369 | } | 363 | } |
370 | 364 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 985c094..21a4e9e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -1,103 +1,102 @@ | |||
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 VIDEO_WIDGET_H | 34 | #ifndef VIDEO_WIDGET_H |
35 | #define VIDEO_WIDGET_H | 35 | #define VIDEO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qimage.h> | 38 | #include <qimage.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include "xinevideowidget.h" | 40 | #include "xinevideowidget.h" |
41 | 41 | ||
42 | #include "mediawidget.h" | 42 | #include "mediawidget.h" |
43 | 43 | ||
44 | class QPixmap; | 44 | class QPixmap; |
45 | class QSlider; | 45 | class QSlider; |
46 | 46 | ||
47 | class VideoWidget : public MediaWidget { | 47 | class VideoWidget : public MediaWidget { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 50 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
51 | ~VideoWidget(); | 51 | ~VideoWidget(); |
52 | 52 | ||
53 | 53 | ||
54 | XineVideoWidget* vidWidget(); | 54 | XineVideoWidget* vidWidget(); |
55 | public slots: | 55 | public slots: |
56 | void updateSlider( long, long ); | 56 | void updateSlider( long, long ); |
57 | void sliderPressed( ); | 57 | void sliderPressed( ); |
58 | void sliderReleased( ); | 58 | void sliderReleased( ); |
59 | void setFullscreen( bool b ); | 59 | void setFullscreen( bool b ); |
60 | virtual void makeVisible(); | 60 | virtual void makeVisible(); |
61 | void backToNormal(); | 61 | void backToNormal(); |
62 | void setPosition( long ); | 62 | void setPosition( long ); |
63 | 63 | ||
64 | public: | 64 | public: |
65 | virtual void setPlaying( bool b); | 65 | virtual void setPlaying( bool b); |
66 | virtual void setLength( long ); | 66 | virtual void setLength( long ); |
67 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 67 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
68 | 68 | ||
69 | signals: | 69 | signals: |
70 | void moreClicked(); | 70 | void moreClicked(); |
71 | void lessClicked(); | 71 | void lessClicked(); |
72 | void sliderMoved( long ); | 72 | void sliderMoved( long ); |
73 | void videoResized ( const QSize &s ); | 73 | void videoResized ( const QSize &s ); |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | 76 | ||
77 | void resizeEvent( QResizeEvent * ); | 77 | void resizeEvent( QResizeEvent * ); |
78 | void showEvent( QShowEvent *se ); | ||
79 | void mouseReleaseEvent( QMouseEvent *event ); | 78 | void mouseReleaseEvent( QMouseEvent *event ); |
80 | void keyReleaseEvent( QKeyEvent *e); | 79 | void keyReleaseEvent( QKeyEvent *e); |
81 | 80 | ||
82 | private: | 81 | private: |
83 | // Ticker songInfo; | 82 | // Ticker songInfo; |
84 | QImage imgUp; | 83 | QImage imgUp; |
85 | QImage imgDn; | 84 | QImage imgDn; |
86 | QString skin; | 85 | QString skin; |
87 | 86 | ||
88 | 87 | ||
89 | 88 | ||
90 | QString backgroundPix; | 89 | QString backgroundPix; |
91 | QSlider *slider; | 90 | QSlider *slider; |
92 | QImage *currentFrame; | 91 | QImage *currentFrame; |
93 | int scaledWidth; | 92 | int scaledWidth; |
94 | int scaledHeight; | 93 | int scaledHeight; |
95 | XineVideoWidget* videoFrame; | 94 | XineVideoWidget* videoFrame; |
96 | 95 | ||
97 | bool videoSliderBeingMoved; | 96 | bool videoSliderBeingMoved; |
98 | }; | 97 | }; |
99 | 98 | ||
100 | #endif // VIDEO_WIDGET_H | 99 | #endif // VIDEO_WIDGET_H |
101 | 100 | ||
102 | 101 | ||
103 | 102 | ||