author | llornkcor <llornkcor> | 2002-04-21 17:51:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-21 17:51:24 (UTC) |
commit | 53a4a3f6398640d182a067a8ffef9b402cd35d7a (patch) (unidiff) | |
tree | 3c989e5ebde8cab36d0a089aa6d63e5e017c86d8 | |
parent | 746afd0d27f33eed5451b54819773cf055858964 (diff) | |
download | opie-53a4a3f6398640d182a067a8ffef9b402cd35d7a.zip opie-53a4a3f6398640d182a067a8ffef9b402cd35d7a.tar.gz opie-53a4a3f6398640d182a067a8ffef9b402cd35d7a.tar.bz2 |
added f9= hide/show audio widget, f10= hide/show video widget, fixed laylist stuff, and fixed slier for the last time
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.cpp | 20 | ||||
-rw-r--r-- | core/multimedia/opieplayer/audiowidget.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/loopcontrol.cpp | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.cpp | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayer.h | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/mediaplayerstate.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 26 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.h | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 1 |
9 files changed, 54 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index e2e3603..94b979f 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -16,24 +16,25 @@ | |||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qpixmap.h> | 24 | #include <qpixmap.h> |
25 | #include <qbutton.h> | 25 | #include <qbutton.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qframe.h> | 27 | #include <qframe.h> |
28 | #include <qlayout.h> | ||
28 | 29 | ||
29 | #include "audiowidget.h" | 30 | #include "audiowidget.h" |
30 | #include "mediaplayerstate.h" | 31 | #include "mediaplayerstate.h" |
31 | 32 | ||
32 | extern MediaPlayerState *mediaPlayerState; | 33 | extern MediaPlayerState *mediaPlayerState; |
33 | 34 | ||
34 | 35 | ||
35 | static const int xo = -2; // movable x offset | 36 | static const int xo = -2; // movable x offset |
36 | static const int yo = 22; // movable y offset | 37 | static const int yo = 22; // movable y offset |
37 | 38 | ||
38 | 39 | ||
39 | struct MediaButton { | 40 | struct MediaButton { |
@@ -54,65 +55,72 @@ MediaButton audioButtons[] = { | |||
54 | { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down | 55 | { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down |
55 | { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop | 56 | { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop |
56 | { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist | 57 | { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist |
57 | }; | 58 | }; |
58 | 59 | ||
59 | 60 | ||
60 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 61 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
61 | 62 | ||
62 | 63 | ||
63 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 64 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
64 | QWidget( parent, name, f ) | 65 | QWidget( parent, name, f ) |
65 | { | 66 | { |
66 | // QPEApplication::grabKeyboard(); | ||
67 | setCaption( tr("OpiePlayer") ); | 67 | setCaption( tr("OpiePlayer") ); |
68 | |||
69 | // QGridLayout *layout = new QGridLayout( this ); | ||
70 | // layout->setSpacing( 2); | ||
71 | // layout->setMargin( 2); | ||
72 | |||
68 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); | 73 | setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); |
69 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsAll" ) ); | 74 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsAll" ) ); |
70 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsBig" ) ); | 75 | pixmaps[1] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaButtonsBig" ) ); |
71 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls" ) ); | 76 | pixmaps[2] = new QPixmap( Resource::loadPixmap( "opieplayer/mediaControls" ) ); |
72 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "opieplayer/animatedButton" ) ); | 77 | pixmaps[3] = new QPixmap( Resource::loadPixmap( "opieplayer/animatedButton" ) ); |
73 | 78 | ||
74 | songInfo = new Ticker( this ); | 79 | songInfo = new Ticker( this ); |
75 | songInfo->setFocusPolicy( QWidget::NoFocus ); | 80 | songInfo->setFocusPolicy( QWidget::NoFocus ); |
76 | songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); | 81 | songInfo->setGeometry( QRect( 7, 3, 220, 20 ) ); |
82 | // layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 ); | ||
77 | 83 | ||
78 | slider = new QSlider( Qt::Horizontal, this ); | 84 | slider = new QSlider( Qt::Horizontal, this ); |
79 | slider->setFixedWidth( 220 ); | 85 | slider->setFixedWidth( 220 ); |
80 | slider->setFixedHeight( 20 ); | 86 | slider->setFixedHeight( 20 ); |
81 | slider->setMinValue( 0 ); | 87 | slider->setMinValue( 0 ); |
82 | slider->setMaxValue( 1 ); | 88 | slider->setMaxValue( 1 ); |
83 | slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); | 89 | slider->setBackgroundPixmap( Resource::loadPixmap( "opieplayer/metalFinish" ) ); |
84 | slider->setFocusPolicy( QWidget::NoFocus ); | 90 | slider->setFocusPolicy( QWidget::NoFocus ); |
85 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); | 91 | slider->setGeometry( QRect( 7, 262, 220, 20 ) ); |
92 | // layout->addMultiCellWidget( slider, 4, 4, 0, 2 ); | ||
86 | 93 | ||
87 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 94 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
88 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 95 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
89 | 96 | ||
90 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 97 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
91 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 98 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
92 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 99 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
93 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 100 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
94 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 101 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
95 | 102 | ||
96 | // Intialise state | 103 | // Intialise state |
97 | setLength( mediaPlayerState->length() ); | 104 | setLength( mediaPlayerState->length() ); |
98 | setPosition( mediaPlayerState->position() ); | 105 | setPosition( mediaPlayerState->position() ); |
99 | setLooping( mediaPlayerState->fullscreen() ); | 106 | setLooping( mediaPlayerState->fullscreen() ); |
100 | setPaused( mediaPlayerState->paused() ); | 107 | setPaused( mediaPlayerState->paused() ); |
101 | setPlaying( mediaPlayerState->playing() ); | 108 | setPlaying( mediaPlayerState->playing() ); |
102 | 109 | ||
103 | } | 110 | } |
104 | 111 | ||
105 | 112 | ||
106 | AudioWidget::~AudioWidget() { | 113 | AudioWidget::~AudioWidget() { |
114 | mediaPlayerState->isStreaming = FALSE; | ||
107 | for ( int i = 0; i < 4; i++ ) | 115 | for ( int i = 0; i < 4; i++ ) |
108 | delete pixmaps[i]; | 116 | delete pixmaps[i]; |
109 | } | 117 | } |
110 | 118 | ||
111 | 119 | ||
112 | static bool audioSliderBeingMoved = FALSE; | 120 | static bool audioSliderBeingMoved = FALSE; |
113 | 121 | ||
114 | 122 | ||
115 | void AudioWidget::sliderPressed() { | 123 | void AudioWidget::sliderPressed() { |
116 | audioSliderBeingMoved = TRUE; | 124 | audioSliderBeingMoved = TRUE; |
117 | } | 125 | } |
118 | 126 | ||
@@ -128,38 +136,40 @@ void AudioWidget::sliderReleased() { | |||
128 | 136 | ||
129 | void AudioWidget::setPosition( long i ) { | 137 | void AudioWidget::setPosition( long i ) { |
130 | updateSlider( i, mediaPlayerState->length() ); | 138 | updateSlider( i, mediaPlayerState->length() ); |
131 | } | 139 | } |
132 | 140 | ||
133 | 141 | ||
134 | void AudioWidget::setLength( long max ) { | 142 | void AudioWidget::setLength( long max ) { |
135 | updateSlider( mediaPlayerState->position(), max ); | 143 | updateSlider( mediaPlayerState->position(), max ); |
136 | } | 144 | } |
137 | 145 | ||
138 | 146 | ||
139 | void AudioWidget::setView( char view ) { | 147 | void AudioWidget::setView( char view ) { |
148 | |||
140 | if (mediaPlayerState->isStreaming) { | 149 | if (mediaPlayerState->isStreaming) { |
141 | if( !slider->isHidden()) slider->hide(); | 150 | if( !slider->isHidden()) slider->hide(); |
142 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 151 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
143 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 152 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
144 | } else { | 153 | } else { |
145 | // this stops the slider from being moved, thus | 154 | // this stops the slider from being moved, thus |
146 | // does not stop stream when it reaches the end | 155 | // does not stop stream when it reaches the end |
147 | if( slider->isHidden()) slider->show(); | 156 | slider->show(); |
148 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 157 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
149 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 158 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
150 | } | 159 | } |
151 | 160 | ||
152 | if ( view == 'a' ) { | 161 | if ( view == 'a' ) { |
153 | startTimer( 150 ); | 162 | startTimer( 150 ); |
163 | // show(); | ||
154 | showMaximized(); | 164 | showMaximized(); |
155 | } else { | 165 | } else { |
156 | killTimers(); | 166 | killTimers(); |
157 | hide(); | 167 | hide(); |
158 | } | 168 | } |
159 | } | 169 | } |
160 | 170 | ||
161 | 171 | ||
162 | void AudioWidget::updateSlider( long i, long max ) { | 172 | void AudioWidget::updateSlider( long i, long max ) { |
163 | if ( max == 0 ) | 173 | if ( max == 0 ) |
164 | return; | 174 | return; |
165 | // Will flicker too much if we don't do this | 175 | // Will flicker too much if we don't do this |
@@ -281,32 +291,36 @@ void AudioWidget::showEvent( QShowEvent* ) { | |||
281 | 291 | ||
282 | void AudioWidget::closeEvent( QCloseEvent* ) { | 292 | void AudioWidget::closeEvent( QCloseEvent* ) { |
283 | mediaPlayerState->setList(); | 293 | mediaPlayerState->setList(); |
284 | } | 294 | } |
285 | 295 | ||
286 | 296 | ||
287 | void AudioWidget::paintEvent( QPaintEvent * ) { | 297 | void AudioWidget::paintEvent( QPaintEvent * ) { |
288 | QPainter p( this ); | 298 | QPainter p( this ); |
289 | for ( int i = 0; i < numButtons; i++ ) | 299 | for ( int i = 0; i < numButtons; i++ ) |
290 | paintButton( &p, i ); | 300 | paintButton( &p, i ); |
291 | } | 301 | } |
292 | 302 | ||
293 | 303 | void AudioWidget::showMe() { | |
304 | show(); | ||
305 | } | ||
294 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | 306 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) |
295 | { | 307 | { |
296 | switch ( e->key() ) { | 308 | switch ( e->key() ) { |
297 | ////////////////////////////// Zaurus keys | 309 | ////////////////////////////// Zaurus keys |
298 | case Key_Home: | 310 | case Key_Home: |
299 | break; | 311 | break; |
300 | case Key_F9: //activity | 312 | case Key_F9: //activity |
313 | hide(); | ||
314 | // qDebug("Audio F9"); | ||
301 | break; | 315 | break; |
302 | case Key_F10: //contacts | 316 | case Key_F10: //contacts |
303 | break; | 317 | break; |
304 | case Key_F11: //menu | 318 | case Key_F11: //menu |
305 | break; | 319 | break; |
306 | case Key_F12: //home | 320 | case Key_F12: //home |
307 | break; | 321 | break; |
308 | case Key_F13: //mail | 322 | case Key_F13: //mail |
309 | break; | 323 | break; |
310 | case Key_Space: { | 324 | case Key_Space: { |
311 | if(mediaPlayerState->playing()) { | 325 | if(mediaPlayerState->playing()) { |
312 | // toggleButton(1); | 326 | // toggleButton(1); |
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index 4ffd167..41ae4b6 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h | |||
@@ -121,25 +121,25 @@ signals: | |||
121 | void lessReleased(); | 121 | void lessReleased(); |
122 | void sliderMoved(long); | 122 | void sliderMoved(long); |
123 | 123 | ||
124 | protected: | 124 | protected: |
125 | void paintEvent( QPaintEvent *pe ); | 125 | void paintEvent( QPaintEvent *pe ); |
126 | void showEvent( QShowEvent *se ); | 126 | void showEvent( QShowEvent *se ); |
127 | void mouseMoveEvent( QMouseEvent *event ); | 127 | void mouseMoveEvent( QMouseEvent *event ); |
128 | void mousePressEvent( QMouseEvent *event ); | 128 | void mousePressEvent( QMouseEvent *event ); |
129 | void mouseReleaseEvent( QMouseEvent *event ); | 129 | void mouseReleaseEvent( QMouseEvent *event ); |
130 | void timerEvent( QTimerEvent *event ); | 130 | void timerEvent( QTimerEvent *event ); |
131 | void closeEvent( QCloseEvent *event ); | 131 | void closeEvent( QCloseEvent *event ); |
132 | void keyReleaseEvent( QKeyEvent *e); | 132 | void keyReleaseEvent( QKeyEvent *e); |
133 | 133 | void showMe(); | |
134 | private: | 134 | private: |
135 | void toggleButton( int ); | 135 | void toggleButton( int ); |
136 | void setToggleButton( int, bool ); | 136 | void setToggleButton( int, bool ); |
137 | void paintButton( QPainter *p, int i ); | 137 | void paintButton( QPainter *p, int i ); |
138 | QPixmap *pixmaps[4]; | 138 | QPixmap *pixmaps[4]; |
139 | Ticker *songInfo; | 139 | Ticker *songInfo; |
140 | QSlider *slider; | 140 | QSlider *slider; |
141 | }; | 141 | }; |
142 | 142 | ||
143 | 143 | ||
144 | #endif // AUDIO_WIDGET_H | 144 | #endif // AUDIO_WIDGET_H |
145 | 145 | ||
diff --git a/core/multimedia/opieplayer/loopcontrol.cpp b/core/multimedia/opieplayer/loopcontrol.cpp index 7005886..faa8e56 100644 --- a/core/multimedia/opieplayer/loopcontrol.cpp +++ b/core/multimedia/opieplayer/loopcontrol.cpp | |||
@@ -426,27 +426,24 @@ bool LoopControl::init( const QString& filename ) { | |||
426 | framerate = 25; | 426 | framerate = 25; |
427 | } | 427 | } |
428 | 428 | ||
429 | if ( total_video_frames == 1 ) { | 429 | if ( total_video_frames == 1 ) { |
430 | DecodeLoopDebug(( "Cannot seek to frame" )); | 430 | DecodeLoopDebug(( "Cannot seek to frame" )); |
431 | } | 431 | } |
432 | 432 | ||
433 | } | 433 | } |
434 | 434 | ||
435 | current_frame = 0; | 435 | current_frame = 0; |
436 | prev_frame = -1; | 436 | prev_frame = -1; |
437 | 437 | ||
438 | if( fileName.left(7) == "http://") | ||
439 | mediaPlayerState->isStreaming = TRUE; | ||
440 | |||
441 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); | 438 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( setPosition( long ) ) ); |
442 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); | 439 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( setPaused( bool ) ) ); |
443 | 440 | ||
444 | audioMutex->unlock(); | 441 | audioMutex->unlock(); |
445 | 442 | ||
446 | return TRUE; | 443 | return TRUE; |
447 | } | 444 | } |
448 | 445 | ||
449 | 446 | ||
450 | void LoopControl::play() { | 447 | void LoopControl::play() { |
451 | qDebug("LC- play"); | 448 | qDebug("LC- play"); |
452 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 449 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
diff --git a/core/multimedia/opieplayer/mediaplayer.cpp b/core/multimedia/opieplayer/mediaplayer.cpp index e0c4dba..ab46a7d 100644 --- a/core/multimedia/opieplayer/mediaplayer.cpp +++ b/core/multimedia/opieplayer/mediaplayer.cpp | |||
@@ -36,38 +36,41 @@ | |||
36 | 36 | ||
37 | #include "mediaplayerstate.h" | 37 | #include "mediaplayerstate.h" |
38 | 38 | ||
39 | 39 | ||
40 | extern AudioWidget *audioUI; | 40 | extern AudioWidget *audioUI; |
41 | extern PlayListWidget *playList; | 41 | extern PlayListWidget *playList; |
42 | extern LoopControl *loopControl; | 42 | extern LoopControl *loopControl; |
43 | extern MediaPlayerState *mediaPlayerState; | 43 | extern MediaPlayerState *mediaPlayerState; |
44 | 44 | ||
45 | 45 | ||
46 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 46 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
47 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 47 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
48 | QPEApplication::grabKeyboard(); | ||
48 | 49 | ||
49 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 50 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
50 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 52 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
52 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 53 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
53 | 54 | ||
54 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 55 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
55 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 56 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
56 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 57 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
57 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 58 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
58 | } | 59 | } |
59 | 60 | ||
60 | 61 | ||
61 | MediaPlayer::~MediaPlayer() { | 62 | MediaPlayer::~MediaPlayer() { |
63 | QPEApplication::grabKeyboard(); | ||
64 | QPEApplication::ungrabKeyboard(); | ||
62 | } | 65 | } |
63 | 66 | ||
64 | 67 | ||
65 | void MediaPlayer::pauseCheck( bool b ) { | 68 | void MediaPlayer::pauseCheck( bool b ) { |
66 | // Only pause if playing | 69 | // Only pause if playing |
67 | if ( b && !mediaPlayerState->playing() ) | 70 | if ( b && !mediaPlayerState->playing() ) |
68 | mediaPlayerState->setPaused( FALSE ); | 71 | mediaPlayerState->setPaused( FALSE ); |
69 | } | 72 | } |
70 | 73 | ||
71 | 74 | ||
72 | void MediaPlayer::play() { | 75 | void MediaPlayer::play() { |
73 | mediaPlayerState->setPlaying( FALSE ); | 76 | mediaPlayerState->setPlaying( FALSE ); |
diff --git a/core/multimedia/opieplayer/mediaplayer.h b/core/multimedia/opieplayer/mediaplayer.h index d6e90cb..0354d21 100644 --- a/core/multimedia/opieplayer/mediaplayer.h +++ b/core/multimedia/opieplayer/mediaplayer.h | |||
@@ -38,21 +38,22 @@ public: | |||
38 | private slots: | 38 | private slots: |
39 | void setPlaying( bool ); | 39 | void setPlaying( bool ); |
40 | void pauseCheck( bool ); | 40 | void pauseCheck( bool ); |
41 | void play(); | 41 | void play(); |
42 | void next(); | 42 | void next(); |
43 | void prev(); | 43 | void prev(); |
44 | void startIncreasingVolume(); | 44 | void startIncreasingVolume(); |
45 | void startDecreasingVolume(); | 45 | void startDecreasingVolume(); |
46 | void stopChangingVolume(); | 46 | void stopChangingVolume(); |
47 | 47 | ||
48 | protected: | 48 | protected: |
49 | void timerEvent( QTimerEvent *e ); | 49 | void timerEvent( QTimerEvent *e ); |
50 | // void keyReleaseEvent( QKeyEvent *e); | ||
50 | 51 | ||
51 | private: | 52 | private: |
52 | int volumeDirection; | 53 | int volumeDirection; |
53 | const DocLnk *currentFile; | 54 | const DocLnk *currentFile; |
54 | }; | 55 | }; |
55 | 56 | ||
56 | 57 | ||
57 | #endif // MEDIA_PLAYER_H | 58 | #endif // MEDIA_PLAYER_H |
58 | 59 | ||
diff --git a/core/multimedia/opieplayer/mediaplayerstate.cpp b/core/multimedia/opieplayer/mediaplayerstate.cpp index 4e14436..3ac9ac4 100644 --- a/core/multimedia/opieplayer/mediaplayerstate.cpp +++ b/core/multimedia/opieplayer/mediaplayerstate.cpp | |||
@@ -94,24 +94,28 @@ static QValueList<MediaPlayerPlugin> pluginList; | |||
94 | 94 | ||
95 | 95 | ||
96 | // Find the first decoder which supports this type of file | 96 | // Find the first decoder which supports this type of file |
97 | MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { | 97 | MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { |
98 | MediaPlayerDecoder *tmpDecoder = NULL; | 98 | MediaPlayerDecoder *tmpDecoder = NULL; |
99 | QValueList<MediaPlayerPlugin>::Iterator it; | 99 | QValueList<MediaPlayerPlugin>::Iterator it; |
100 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { | 100 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { |
101 | if ( (*it).decoder->isFileSupported( file ) ) { | 101 | if ( (*it).decoder->isFileSupported( file ) ) { |
102 | tmpDecoder = (*it).decoder; | 102 | tmpDecoder = (*it).decoder; |
103 | break; | 103 | break; |
104 | } | 104 | } |
105 | } | 105 | } |
106 | if(file.left(4)=="http") | ||
107 | isStreaming = TRUE; | ||
108 | else | ||
109 | isStreaming = FALSE; | ||
106 | return decoder = tmpDecoder; | 110 | return decoder = tmpDecoder; |
107 | } | 111 | } |
108 | 112 | ||
109 | 113 | ||
110 | MediaPlayerDecoder *MediaPlayerState::curDecoder() { | 114 | MediaPlayerDecoder *MediaPlayerState::curDecoder() { |
111 | return decoder; | 115 | return decoder; |
112 | } | 116 | } |
113 | 117 | ||
114 | 118 | ||
115 | // ### hack to get true sample count | 119 | // ### hack to get true sample count |
116 | MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { | 120 | MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { |
117 | return libmpeg3decoder; | 121 | return libmpeg3decoder; |
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 7c76400..faa6e3f 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -50,29 +50,33 @@ | |||
50 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
51 | #include <qregexp.h> | 51 | #include <qregexp.h> |
52 | 52 | ||
53 | //#include <qtimer.h> | 53 | //#include <qtimer.h> |
54 | 54 | ||
55 | #include "playlistselection.h" | 55 | #include "playlistselection.h" |
56 | #include "playlistwidget.h" | 56 | #include "playlistwidget.h" |
57 | #include "mediaplayerstate.h" | 57 | #include "mediaplayerstate.h" |
58 | 58 | ||
59 | #include "inputDialog.h" | 59 | #include "inputDialog.h" |
60 | 60 | ||
61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
62 | #include "audiowidget.h" | ||
63 | #include "videowidget.h" | ||
62 | 64 | ||
63 | #define BUTTONS_ON_TOOLBAR | 65 | #define BUTTONS_ON_TOOLBAR |
64 | #define SIDE_BUTTONS | 66 | #define SIDE_BUTTONS |
65 | #define CAN_SAVE_LOAD_PLAYLISTS | 67 | #define CAN_SAVE_LOAD_PLAYLISTS |
66 | 68 | ||
69 | extern AudioWidget *audioUI; | ||
70 | extern VideoWidget *videoUI; | ||
67 | extern MediaPlayerState *mediaPlayerState; | 71 | extern MediaPlayerState *mediaPlayerState; |
68 | 72 | ||
69 | // class myFileSelector { | 73 | // class myFileSelector { |
70 | 74 | ||
71 | // }; | 75 | // }; |
72 | class PlayListWidgetPrivate { | 76 | class PlayListWidgetPrivate { |
73 | public: | 77 | public: |
74 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 78 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
75 | QFrame *playListFrame; | 79 | QFrame *playListFrame; |
76 | FileSelector *files; | 80 | FileSelector *files; |
77 | PlayListSelection *selectedFiles; | 81 | PlayListSelection *selectedFiles; |
78 | bool setDocumentUsed; | 82 | bool setDocumentUsed; |
@@ -192,24 +196,25 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
192 | // Add the playlist area | 196 | // Add the playlist area |
193 | 197 | ||
194 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 198 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
195 | d->playListFrame = vbox3; | 199 | d->playListFrame = vbox3; |
196 | d->playListFrame ->setMinimumSize(235,260); | 200 | d->playListFrame ->setMinimumSize(235,260); |
197 | 201 | ||
198 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 202 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
199 | 203 | ||
200 | d->selectedFiles = new PlayListSelection( hbox2); | 204 | d->selectedFiles = new PlayListSelection( hbox2); |
201 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 205 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
202 | 206 | ||
203 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 207 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
208 | |||
204 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 209 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
205 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 210 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
206 | 211 | ||
207 | 212 | ||
208 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 213 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
209 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 214 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
210 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 215 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
211 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 216 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
212 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 217 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
213 | 218 | ||
214 | QWidget *aTab; | 219 | QWidget *aTab; |
215 | aTab = new QWidget( tabWidget, "aTab" ); | 220 | aTab = new QWidget( tabWidget, "aTab" ); |
@@ -731,25 +736,27 @@ void PlayListWidget::addSelected() { | |||
731 | tabWidget->setCurrentPage(0); | 736 | tabWidget->setCurrentPage(0); |
732 | } | 737 | } |
733 | break; | 738 | break; |
734 | }; | 739 | }; |
735 | } | 740 | } |
736 | 741 | ||
737 | void PlayListWidget::removeSelected() { | 742 | void PlayListWidget::removeSelected() { |
738 | d->selectedFiles->removeSelected( ); | 743 | d->selectedFiles->removeSelected( ); |
739 | } | 744 | } |
740 | 745 | ||
741 | void PlayListWidget::playIt( QListViewItem *it) { | 746 | void PlayListWidget::playIt( QListViewItem *it) { |
742 | // d->setDocumentUsed = FALSE; | 747 | // d->setDocumentUsed = FALSE; |
748 | mediaPlayerState->setPlaying(FALSE); | ||
743 | mediaPlayerState->setPlaying(TRUE); | 749 | mediaPlayerState->setPlaying(TRUE); |
750 | d->selectedFiles->unSelect(); | ||
744 | } | 751 | } |
745 | 752 | ||
746 | void PlayListWidget::addToSelection( QListViewItem *it) { | 753 | void PlayListWidget::addToSelection( QListViewItem *it) { |
747 | d->setDocumentUsed = FALSE; | 754 | d->setDocumentUsed = FALSE; |
748 | 755 | ||
749 | if(it) { | 756 | if(it) { |
750 | switch (tabWidget->currentPageIndex()) { | 757 | switch (tabWidget->currentPageIndex()) { |
751 | case 1: { | 758 | case 1: { |
752 | QListIterator<DocLnk> dit( files.children() ); | 759 | QListIterator<DocLnk> dit( files.children() ); |
753 | for ( ; dit.current(); ++dit ) { | 760 | for ( ; dit.current(); ++dit ) { |
754 | if( dit.current()->name() == it->text(0)) { | 761 | if( dit.current()->name() == it->text(0)) { |
755 | d->selectedFiles->addToSelection( **dit ); | 762 | d->selectedFiles->addToSelection( **dit ); |
@@ -871,30 +878,32 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& | |||
871 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 878 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
872 | m.insertSeparator(); | 879 | m.insertSeparator(); |
873 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 880 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
874 | m.exec( QCursor::pos() ); | 881 | m.exec( QCursor::pos() ); |
875 | } | 882 | } |
876 | break; | 883 | break; |
877 | }; | 884 | }; |
878 | } | 885 | } |
879 | 886 | ||
880 | void PlayListWidget::playSelected() | 887 | void PlayListWidget::playSelected() |
881 | { | 888 | { |
882 | btnPlay( TRUE); | 889 | btnPlay( TRUE); |
890 | d->selectedFiles->unSelect(); | ||
883 | } | 891 | } |
884 | 892 | ||
885 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) | 893 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) |
886 | { | 894 | { |
887 | switch (mouse) { | 895 | switch (mouse) { |
888 | case 1: | 896 | case 1: |
897 | |||
889 | break; | 898 | break; |
890 | case 2:{ | 899 | case 2:{ |
891 | QPopupMenu m; | 900 | QPopupMenu m; |
892 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 901 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
893 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 902 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
894 | // m.insertSeparator(); | 903 | // m.insertSeparator(); |
895 | m.exec( QCursor::pos() ); | 904 | m.exec( QCursor::pos() ); |
896 | } | 905 | } |
897 | break; | 906 | break; |
898 | }; | 907 | }; |
899 | 908 | ||
900 | } | 909 | } |
@@ -1029,12 +1038,29 @@ void PlayListWidget::openFile() { | |||
1029 | lnk.setIcon("opieplayer/MPEGPlayer"); | 1038 | lnk.setIcon("opieplayer/MPEGPlayer"); |
1030 | 1039 | ||
1031 | if(!lnk.writeLink()) | 1040 | if(!lnk.writeLink()) |
1032 | qDebug("Writing doclink did not work"); | 1041 | qDebug("Writing doclink did not work"); |
1033 | d->selectedFiles->addToSelection( lnk); | 1042 | d->selectedFiles->addToSelection( lnk); |
1034 | // if(fileDlg2) | 1043 | // if(fileDlg2) |
1035 | // delete fileDlg2; | 1044 | // delete fileDlg2; |
1036 | } | 1045 | } |
1037 | 1046 | ||
1038 | if(fileDlg) | 1047 | if(fileDlg) |
1039 | delete fileDlg; | 1048 | delete fileDlg; |
1040 | } | 1049 | } |
1050 | |||
1051 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | ||
1052 | { | ||
1053 | switch ( e->key() ) { | ||
1054 | ////////////////////////////// Zaurus keys | ||
1055 | case Key_F9: //activity | ||
1056 | if(audioUI->isHidden()) | ||
1057 | audioUI->showMaximized(); | ||
1058 | break; | ||
1059 | case Key_F10: //contacts | ||
1060 | if( videoUI->isHidden()) | ||
1061 | videoUI->showMaximized(); | ||
1062 | |||
1063 | break; | ||
1064 | |||
1065 | } | ||
1066 | } | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.h b/core/multimedia/opieplayer/playlistwidget.h index 02cdba6..16b9905 100644 --- a/core/multimedia/opieplayer/playlistwidget.h +++ b/core/multimedia/opieplayer/playlistwidget.h | |||
@@ -58,25 +58,25 @@ public: | |||
58 | FileSelector* playLists; | 58 | FileSelector* playLists; |
59 | QPushButton *tbDeletePlaylist; | 59 | QPushButton *tbDeletePlaylist; |
60 | public slots: | 60 | public slots: |
61 | bool first(); | 61 | bool first(); |
62 | bool last(); | 62 | bool last(); |
63 | bool next(); | 63 | bool next(); |
64 | bool prev(); | 64 | bool prev(); |
65 | /* void setFullScreen(); */ | 65 | /* void setFullScreen(); */ |
66 | /* void setScaled(); */ | 66 | /* void setScaled(); */ |
67 | protected: | 67 | protected: |
68 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | 68 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
69 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | 69 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
70 | 70 | void keyReleaseEvent( QKeyEvent *e); | |
71 | private: | 71 | private: |
72 | void initializeStates(); | 72 | void initializeStates(); |
73 | void readConfig( Config& cfg ); | 73 | void readConfig( Config& cfg ); |
74 | void writeConfig( Config& cfg ) const; | 74 | void writeConfig( Config& cfg ) const; |
75 | PlayListWidgetPrivate *d; // Private implementation data | 75 | PlayListWidgetPrivate *d; // Private implementation data |
76 | void populateAudioView(); | 76 | void populateAudioView(); |
77 | void populateVideoView(); | 77 | void populateVideoView(); |
78 | private slots: | 78 | private slots: |
79 | void openFile(); | 79 | void openFile(); |
80 | void setDocument( const QString& fileref ); | 80 | void setDocument( const QString& fileref ); |
81 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 81 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
82 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 82 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 70b4a95..d0cb764 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -423,24 +423,25 @@ bool VideoWidget::playVideo() { | |||
423 | 423 | ||
424 | 424 | ||
425 | 425 | ||
426 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) | 426 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) |
427 | { | 427 | { |
428 | switch ( e->key() ) { | 428 | switch ( e->key() ) { |
429 | ////////////////////////////// Zaurus keys | 429 | ////////////////////////////// Zaurus keys |
430 | case Key_Home: | 430 | case Key_Home: |
431 | break; | 431 | break; |
432 | case Key_F9: //activity | 432 | case Key_F9: //activity |
433 | break; | 433 | break; |
434 | case Key_F10: //contacts | 434 | case Key_F10: //contacts |
435 | hide(); | ||
435 | break; | 436 | break; |
436 | case Key_F11: //menu | 437 | case Key_F11: //menu |
437 | break; | 438 | break; |
438 | case Key_F12: //home | 439 | case Key_F12: //home |
439 | break; | 440 | break; |
440 | case Key_F13: //mail | 441 | case Key_F13: //mail |
441 | break; | 442 | break; |
442 | case Key_Space: { | 443 | case Key_Space: { |
443 | if(mediaPlayerState->playing()) { | 444 | if(mediaPlayerState->playing()) { |
444 | mediaPlayerState->setPlaying(FALSE); | 445 | mediaPlayerState->setPlaying(FALSE); |
445 | } else { | 446 | } else { |
446 | mediaPlayerState->setPlaying(TRUE); | 447 | mediaPlayerState->setPlaying(TRUE); |