summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp5
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
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
@@ -288,101 +288,96 @@ void AudioWidget::updateSlider( long i, long max ) {
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
309void AudioWidget::skipFor() { 309void 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
315void AudioWidget::skipBack() { 315void 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
323void AudioWidget::stopSkip() { 323void AudioWidget::stopSkip() {
324 killTimers(); 324 killTimers();
325} 325}
326 326
327 327
328void AudioWidget::timerEvent( QTimerEvent * ) { 328void 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
336void AudioWidget::showEvent( QShowEvent* ) {
337 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
338 mouseMoveEvent( &event );
339}
340
341void AudioWidget::keyReleaseEvent( QKeyEvent *e) { 336void 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:
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
@@ -29,72 +29,71 @@
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
50class QPixmap; 50class QPixmap;
51 51
52class AudioWidget : public MediaWidget { 52class AudioWidget : public MediaWidget {
53 Q_OBJECT 53 Q_OBJECT
54public: 54public:
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 ); }
58public slots: 58public 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
66public: 66public:
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
71signals: 71signals:
72 void sliderMoved(long); 72 void sliderMoved(long);
73 73
74protected: 74protected:
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);
81private slots: 80private slots:
82 void skipFor(); 81 void skipFor();
83 void skipBack(); 82 void skipBack();
84 void stopSkip(); 83 void stopSkip();
85private: 84private:
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
@@ -204,106 +204,100 @@ void VideoWidget::sliderReleased() {
204 204
205void VideoWidget::setPosition( long i ) { 205void VideoWidget::setPosition( long i ) {
206 updateSlider( i, mediaPlayerState.length() ); 206 updateSlider( i, mediaPlayerState.length() );
207} 207}
208 208
209 209
210void VideoWidget::setLength( long max ) { 210void VideoWidget::setLength( long max ) {
211 updateSlider( mediaPlayerState.position(), max ); 211 updateSlider( mediaPlayerState.position(), max );
212} 212}
213 213
214void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 214void 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
227void VideoWidget::updateSlider( long i, long max ) { 227void 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
244void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 244void 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
252void VideoWidget::showEvent( QShowEvent* ) { 252void 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
263void VideoWidget::makeVisible() { 257void 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
309void VideoWidget::keyReleaseEvent( QKeyEvent *e) { 303void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
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
@@ -30,74 +30,73 @@
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
44class QPixmap; 44class QPixmap;
45class QSlider; 45class QSlider;
46 46
47class VideoWidget : public MediaWidget { 47class VideoWidget : public MediaWidget {
48 Q_OBJECT 48 Q_OBJECT
49public: 49public:
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();
55public slots: 55public 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
64public: 64public:
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
69signals: 69signals:
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
75protected: 75protected:
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
82private: 81private:
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