summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-21 17:51:24 (UTC)
committer llornkcor <llornkcor>2002-04-21 17:51:24 (UTC)
commit53a4a3f6398640d182a067a8ffef9b402cd35d7a (patch) (unidiff)
tree3c989e5ebde8cab36d0a089aa6d63e5e017c86d8
parent746afd0d27f33eed5451b54819773cf055858964 (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiowidget.cpp32
-rw-r--r--core/multimedia/opieplayer/audiowidget.h2
-rw-r--r--core/multimedia/opieplayer/loopcontrol.cpp3
-rw-r--r--core/multimedia/opieplayer/mediaplayer.cpp3
-rw-r--r--core/multimedia/opieplayer/mediaplayer.h1
-rw-r--r--core/multimedia/opieplayer/mediaplayerstate.cpp12
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp28
-rw-r--r--core/multimedia/opieplayer/playlistwidget.h2
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp1
9 files changed, 65 insertions, 19 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
@@ -4,178 +4,188 @@
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
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
32extern MediaPlayerState *mediaPlayerState; 33extern MediaPlayerState *mediaPlayerState;
33 34
34 35
35static const int xo = -2; // movable x offset 36static const int xo = -2; // movable x offset
36static const int yo = 22; // movable y offset 37static const int yo = 22; // movable y offset
37 38
38 39
39struct MediaButton { 40struct MediaButton {
40 int xPos, yPos; 41 int xPos, yPos;
41 int color; 42 int color;
42 bool isToggle, isBig, isHeld, isDown; 43 bool isToggle, isBig, isHeld, isDown;
43}; 44};
44 45
45 46
46// Layout information for the audioButtons (and if it is a toggle button or not) 47// Layout information for the audioButtons (and if it is a toggle button or not)
47MediaButton audioButtons[] = { 48MediaButton audioButtons[] = {
48 { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play 49 { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play
49 { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop 50 { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop
50 { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause 51 { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause
51 { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next 52 { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next
52 { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous 53 { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous
53 { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up 54 { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up
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
60static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 61static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
61 62
62 63
63AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 64AudioWidget::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 ) );
77 82// layout->addMultiCellWidget( songInfo, 0, 0, 0, 2 );
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
106AudioWidget::~AudioWidget() { 113AudioWidget::~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
112static bool audioSliderBeingMoved = FALSE; 120static bool audioSliderBeingMoved = FALSE;
113 121
114 122
115void AudioWidget::sliderPressed() { 123void AudioWidget::sliderPressed() {
116 audioSliderBeingMoved = TRUE; 124 audioSliderBeingMoved = TRUE;
117} 125}
118 126
119 127
120void AudioWidget::sliderReleased() { 128void AudioWidget::sliderReleased() {
121 audioSliderBeingMoved = FALSE; 129 audioSliderBeingMoved = FALSE;
122 if ( slider->width() == 0 ) 130 if ( slider->width() == 0 )
123 return; 131 return;
124 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 132 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
125 mediaPlayerState->setPosition( val ); 133 mediaPlayerState->setPosition( val );
126} 134}
127 135
128 136
129void AudioWidget::setPosition( long i ) { 137void AudioWidget::setPosition( long i ) {
130 updateSlider( i, mediaPlayerState->length() ); 138 updateSlider( i, mediaPlayerState->length() );
131} 139}
132 140
133 141
134void AudioWidget::setLength( long max ) { 142void AudioWidget::setLength( long max ) {
135 updateSlider( mediaPlayerState->position(), max ); 143 updateSlider( mediaPlayerState->position(), max );
136} 144}
137 145
138 146
139void AudioWidget::setView( char view ) { 147void 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 );
154 showMaximized(); 163// show();
164 showMaximized();
155 } else { 165 } else {
156 killTimers(); 166 killTimers();
157 hide(); 167 hide();
158 } 168 }
159} 169}
160 170
161 171
162void AudioWidget::updateSlider( long i, long max ) { 172void 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
166 // Scale to something reasonable 176 // Scale to something reasonable
167 int width = slider->width(); 177 int width = slider->width();
168 int val = int((double)i * width / max); 178 int val = int((double)i * width / max);
169 if ( !audioSliderBeingMoved ) { 179 if ( !audioSliderBeingMoved ) {
170 if ( slider->value() != val ) 180 if ( slider->value() != val )
171 slider->setValue( val ); 181 slider->setValue( val );
172 if ( slider->maxValue() != width ) 182 if ( slider->maxValue() != width )
173 slider->setMaxValue( width ); 183 slider->setMaxValue( width );
174 } 184 }
175} 185}
176 186
177 187
178void AudioWidget::setToggleButton( int i, bool down ) { 188void AudioWidget::setToggleButton( int i, bool down ) {
179 if ( down != audioButtons[i].isDown ) 189 if ( down != audioButtons[i].isDown )
180 toggleButton( i ); 190 toggleButton( i );
181} 191}
@@ -269,56 +279,60 @@ void AudioWidget::mousePressEvent( QMouseEvent *event ) {
269 279
270 280
271void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 281void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
272 mouseMoveEvent( event ); 282 mouseMoveEvent( event );
273} 283}
274 284
275 285
276void AudioWidget::showEvent( QShowEvent* ) { 286void AudioWidget::showEvent( QShowEvent* ) {
277 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 287 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
278 mouseMoveEvent( &event ); 288 mouseMoveEvent( &event );
279} 289}
280 290
281 291
282void AudioWidget::closeEvent( QCloseEvent* ) { 292void AudioWidget::closeEvent( QCloseEvent* ) {
283 mediaPlayerState->setList(); 293 mediaPlayerState->setList();
284} 294}
285 295
286 296
287void AudioWidget::paintEvent( QPaintEvent * ) { 297void 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 303void AudioWidget::showMe() {
304 show();
305}
294void AudioWidget::keyReleaseEvent( QKeyEvent *e) 306void 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);
313 mediaPlayerState->setPlaying(FALSE); 327 mediaPlayerState->setPlaying(FALSE);
314// toggleButton(1); 328// toggleButton(1);
315 } else { 329 } else {
316// toggleButton(0); 330// toggleButton(0);
317 mediaPlayerState->setPlaying(TRUE); 331 mediaPlayerState->setPlaying(TRUE);
318// toggleButton(0); 332// toggleButton(0);
319 } 333 }
320 } 334 }
321 break; 335 break;
322 case Key_Down: 336 case Key_Down:
323 toggleButton(6); 337 toggleButton(6);
324 emit lessClicked(); 338 emit lessClicked();
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
@@ -109,37 +109,37 @@ public slots:
109 void sliderReleased( ); 109 void sliderReleased( );
110 void setPaused( bool b) { setToggleButton( AudioPause, b ); } 110 void setPaused( bool b) { setToggleButton( AudioPause, b ); }
111 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 111 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
112 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 112 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
113 void setPosition( long ); 113 void setPosition( long );
114 void setLength( long ); 114 void setLength( long );
115 void setView( char ); 115 void setView( char );
116 116
117signals: 117signals:
118 void moreClicked(); 118 void moreClicked();
119 void lessClicked(); 119 void lessClicked();
120 void moreReleased(); 120 void moreReleased();
121 void lessReleased(); 121 void lessReleased();
122 void sliderMoved(long); 122 void sliderMoved(long);
123 123
124protected: 124protected:
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();
134private: 134private:
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
@@ -414,51 +414,48 @@ bool LoopControl::init( const QString& filename ) {
414 } 414 }
415 415
416 if ( hasVideoChannel ) { 416 if ( hasVideoChannel ) {
417 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream ); 417 total_video_frames = mediaPlayerState->curDecoder()->videoFrames( stream );
418 418
419 mediaPlayerState->setLength( total_video_frames ); 419 mediaPlayerState->setLength( total_video_frames );
420 420
421 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream ); 421 framerate = mediaPlayerState->curDecoder()->videoFrameRate( stream );
422 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames )); 422 DecodeLoopDebug(( "Frame rate %g total %ld", framerate, total_video_frames ));
423 423
424 if ( framerate <= 1.0 ) { 424 if ( framerate <= 1.0 ) {
425 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" )); 425 DecodeLoopDebug(( "Crazy frame rate, resetting to sensible" ));
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
450void LoopControl::play() { 447void 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)
453 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) { 450 if ( !disabledSuspendScreenSaver || previousSuspendMode != hasVideoChannel ) {
454 disabledSuspendScreenSaver = TRUE; 451 disabledSuspendScreenSaver = TRUE;
455 previousSuspendMode = hasVideoChannel; 452 previousSuspendMode = hasVideoChannel;
456 // Stop the screen from blanking and power saving state 453 // Stop the screen from blanking and power saving state
457 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 454 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
458 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 455 << ( hasVideoChannel ? QPEApplication::Disable : QPEApplication::DisableSuspend );
459 } 456 }
460#endif 457#endif
461 458
462 playtime.start(); 459 playtime.start();
463 startTimers(); 460 startTimers();
464} 461}
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
@@ -24,62 +24,65 @@
24#include <qpe/config.h> 24#include <qpe/config.h>
25 25
26#include <qmainwindow.h> 26#include <qmainwindow.h>
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qfile.h> 29#include <qfile.h>
30 30
31#include "mediaplayer.h" 31#include "mediaplayer.h"
32#include "playlistwidget.h" 32#include "playlistwidget.h"
33#include "audiowidget.h" 33#include "audiowidget.h"
34#include "loopcontrol.h" 34#include "loopcontrol.h"
35#include "audiodevice.h" 35#include "audiodevice.h"
36 36
37#include "mediaplayerstate.h" 37#include "mediaplayerstate.h"
38 38
39 39
40extern AudioWidget *audioUI; 40extern AudioWidget *audioUI;
41extern PlayListWidget *playList; 41extern PlayListWidget *playList;
42extern LoopControl *loopControl; 42extern LoopControl *loopControl;
43extern MediaPlayerState *mediaPlayerState; 43extern MediaPlayerState *mediaPlayerState;
44 44
45 45
46MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 46MediaPlayer::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
61MediaPlayer::~MediaPlayer() { 62MediaPlayer::~MediaPlayer() {
63 QPEApplication::grabKeyboard();
64 QPEApplication::ungrabKeyboard();
62} 65}
63 66
64 67
65void MediaPlayer::pauseCheck( bool b ) { 68void 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
72void MediaPlayer::play() { 75void MediaPlayer::play() {
73 mediaPlayerState->setPlaying( FALSE ); 76 mediaPlayerState->setPlaying( FALSE );
74 mediaPlayerState->setPlaying( TRUE ); 77 mediaPlayerState->setPlaying( TRUE );
75} 78}
76 79
77 80
78void MediaPlayer::setPlaying( bool play ) { 81void MediaPlayer::setPlaying( bool play ) {
79 if ( !play ) { 82 if ( !play ) {
80 mediaPlayerState->setPaused( FALSE ); 83 mediaPlayerState->setPaused( FALSE );
81 loopControl->stop( FALSE ); 84 loopControl->stop( FALSE );
82 return; 85 return;
83 } 86 }
84 87
85 if ( mediaPlayerState->paused() ) { 88 if ( mediaPlayerState->paused() ) {
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
@@ -26,33 +26,34 @@
26#include <qpe/mediaplayerplugininterface.h> 26#include <qpe/mediaplayerplugininterface.h>
27 27
28 28
29class DocLnk; 29class DocLnk;
30 30
31 31
32class MediaPlayer : public QObject { 32class MediaPlayer : public QObject {
33 Q_OBJECT 33 Q_OBJECT
34public: 34public:
35 MediaPlayer( QObject *parent, const char *name ); 35 MediaPlayer( QObject *parent, const char *name );
36 ~MediaPlayer(); 36 ~MediaPlayer();
37 37
38private slots: 38private 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
48protected: 48protected:
49 void timerEvent( QTimerEvent *e ); 49 void timerEvent( QTimerEvent *e );
50// void keyReleaseEvent( QKeyEvent *e);
50 51
51private: 52private:
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
@@ -77,53 +77,57 @@ void MediaPlayerState::writeConfig( Config& cfg ) const {
77 cfg.writeEntry("Looping", isLooping ); 77 cfg.writeEntry("Looping", isLooping );
78 cfg.writeEntry("Shuffle", isShuffled ); 78 cfg.writeEntry("Shuffle", isShuffled );
79 cfg.writeEntry("UsePlayList", usePlaylist ); 79 cfg.writeEntry("UsePlayList", usePlaylist );
80} 80}
81 81
82 82
83struct MediaPlayerPlugin { 83struct MediaPlayerPlugin {
84#ifndef QT_NO_COMPONENT 84#ifndef QT_NO_COMPONENT
85 QLibrary *library; 85 QLibrary *library;
86#endif 86#endif
87 MediaPlayerPluginInterface *iface; 87 MediaPlayerPluginInterface *iface;
88 MediaPlayerDecoder *decoder; 88 MediaPlayerDecoder *decoder;
89 MediaPlayerEncoder *encoder; 89 MediaPlayerEncoder *encoder;
90}; 90};
91 91
92 92
93static QValueList<MediaPlayerPlugin> pluginList; 93static 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
97MediaPlayerDecoder *MediaPlayerState::newDecoder( const QString& file ) { 97MediaPlayerDecoder *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
110MediaPlayerDecoder *MediaPlayerState::curDecoder() { 114MediaPlayerDecoder *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
116MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() { 120MediaPlayerDecoder *MediaPlayerState::libMpeg3Decoder() {
117 return libmpeg3decoder; 121 return libmpeg3decoder;
118} 122}
119 123
120// ### hack to get true sample count 124// ### hack to get true sample count
121// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() { 125// MediaPlayerDecoder *MediaPlayerState::libWavDecoder() {
122// return libwavdecoder; 126// return libwavdecoder;
123// } 127// }
124 128
125void MediaPlayerState::loadPlugins() { 129void MediaPlayerState::loadPlugins() {
126 qDebug("load plugins"); 130 qDebug("load plugins");
127#ifndef QT_NO_COMPONENT 131#ifndef QT_NO_COMPONENT
128 QValueList<MediaPlayerPlugin>::Iterator mit; 132 QValueList<MediaPlayerPlugin>::Iterator mit;
129 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) { 133 for ( mit = pluginList.begin(); mit != pluginList.end(); ++mit ) {
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
@@ -38,53 +38,57 @@
38#include <qdir.h> 38#include <qdir.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qlist.h> 41#include <qlist.h>
42#include <qlistbox.h> 42#include <qlistbox.h>
43#include <qmainwindow.h> 43#include <qmainwindow.h>
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qtoolbutton.h> 45#include <qtoolbutton.h>
46#include <qtabwidget.h> 46#include <qtabwidget.h>
47#include <qlistview.h> 47#include <qlistview.h>
48#include <qpoint.h> 48#include <qpoint.h>
49#include <qlineedit.h> 49#include <qlineedit.h>
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
69extern AudioWidget *audioUI;
70extern VideoWidget *videoUI;
67extern MediaPlayerState *mediaPlayerState; 71extern MediaPlayerState *mediaPlayerState;
68 72
69// class myFileSelector { 73// class myFileSelector {
70 74
71// }; 75// };
72class PlayListWidgetPrivate { 76class PlayListWidgetPrivate {
73public: 77public:
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;
79 DocLnk *current; 83 DocLnk *current;
80}; 84};
81 85
82 86
83class ToolButton : public QToolButton { 87class ToolButton : public QToolButton {
84public: 88public:
85 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 89 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
86 : QToolButton( parent, name ) { 90 : QToolButton( parent, name ) {
87 setTextLabel( name ); 91 setTextLabel( name );
88 setPixmap( Resource::loadPixmap( icon ) ); 92 setPixmap( Resource::loadPixmap( icon ) );
89 setAutoRaise( TRUE ); 93 setAutoRaise( TRUE );
90 setFocusPolicy( QWidget::NoFocus ); 94 setFocusPolicy( QWidget::NoFocus );
@@ -180,49 +184,50 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
180 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 184 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
181 185
182 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 186 tabWidget = new QTabWidget( hbox6, "tabWidget" );
183 tabWidget->setTabShape(QTabWidget::Triangular); 187 tabWidget->setTabShape(QTabWidget::Triangular);
184 188
185 QWidget *pTab; 189 QWidget *pTab;
186 pTab = new QWidget( tabWidget, "pTab" ); 190 pTab = new QWidget( tabWidget, "pTab" );
187// playlistView = new QListView( pTab, "playlistview" ); 191// playlistView = new QListView( pTab, "playlistview" );
188// playlistView->setMinimumSize(236,260); 192// playlistView->setMinimumSize(236,260);
189 tabWidget->insertTab( pTab,"Playlist"); 193 tabWidget->insertTab( pTab,"Playlist");
190 194
191 195
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);
204 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 208
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" );
216 audioView = new QListView( aTab, "Audioview" ); 221 audioView = new QListView( aTab, "Audioview" );
217 audioView->setMinimumSize(233,260); 222 audioView->setMinimumSize(233,260);
218 audioView->addColumn( tr("Title"),140); 223 audioView->addColumn( tr("Title"),140);
219 audioView->addColumn(tr("Size"), -1); 224 audioView->addColumn(tr("Size"), -1);
220 audioView->addColumn(tr("Media"),-1); 225 audioView->addColumn(tr("Media"),-1);
221 audioView->setColumnAlignment(1, Qt::AlignRight); 226 audioView->setColumnAlignment(1, Qt::AlignRight);
222 audioView->setColumnAlignment(2, Qt::AlignRight); 227 audioView->setColumnAlignment(2, Qt::AlignRight);
223 audioView->setAllColumnsShowFocus(TRUE); 228 audioView->setAllColumnsShowFocus(TRUE);
224 229
225 audioView->setMultiSelection( TRUE ); 230 audioView->setMultiSelection( TRUE );
226 audioView->setSelectionMode( QListView::Extended); 231 audioView->setSelectionMode( QListView::Extended);
227 232
228 tabWidget->insertTab(aTab,tr("Audio")); 233 tabWidget->insertTab(aTab,tr("Audio"));
@@ -719,49 +724,51 @@ void PlayListWidget::addSelected() {
719// QString entryName; 724// QString entryName;
720// entryName.sprintf( "File%i", i + 1 ); 725// entryName.sprintf( "File%i", i + 1 );
721// QString linkFile = cfg.readEntry( entryName ); 726// QString linkFile = cfg.readEntry( entryName );
722// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { 727// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) {
723// int result= QMessageBox::warning(this,tr("OpiePlayer"), 728// int result= QMessageBox::warning(this,tr("OpiePlayer"),
724// tr("This is all ready in your playlist.\nContinue?"), 729// tr("This is all ready in your playlist.\nContinue?"),
725// tr("Yes"),tr("No"),0,0,1); 730// tr("Yes"),tr("No"),0,0,1);
726// if (result !=0) 731// if (result !=0)
727// return; 732// return;
728// } 733// }
729// } 734// }
730// addToSelection( videoView->selectedItem() ); 735// addToSelection( videoView->selectedItem() );
731 tabWidget->setCurrentPage(0); 736 tabWidget->setCurrentPage(0);
732 } 737 }
733 break; 738 break;
734 }; 739 };
735} 740}
736 741
737void PlayListWidget::removeSelected() { 742void PlayListWidget::removeSelected() {
738 d->selectedFiles->removeSelected( ); 743 d->selectedFiles->removeSelected( );
739} 744}
740 745
741void PlayListWidget::playIt( QListViewItem *it) { 746void 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
746void PlayListWidget::addToSelection( QListViewItem *it) { 753void 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 );
756 } 763 }
757 } 764 }
758 } 765 }
759 break; 766 break;
760 case 2: { 767 case 2: {
761 QListIterator<DocLnk> dit( vFiles.children() ); 768 QListIterator<DocLnk> dit( vFiles.children() );
762 for ( ; dit.current(); ++dit ) { 769 for ( ; dit.current(); ++dit ) {
763 if( dit.current()->name() == it->text(0)) { 770 if( dit.current()->name() == it->text(0)) {
764 d->selectedFiles->addToSelection( **dit ); 771 d->selectedFiles->addToSelection( **dit );
765 } 772 }
766 } 773 }
767 } 774 }
@@ -859,54 +866,56 @@ void PlayListWidget::deletePlaylist() {
859 }; 866 };
860 867
861} 868}
862 869
863void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 870void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
864{ 871{
865 switch (mouse) { 872 switch (mouse) {
866 case 1: 873 case 1:
867 break; 874 break;
868 case 2:{ 875 case 2:{
869 QPopupMenu m; 876 QPopupMenu m;
870 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 877 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
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
880void PlayListWidget::playSelected() 887void PlayListWidget::playSelected()
881{ 888{
882 btnPlay( TRUE); 889 btnPlay( TRUE);
890 d->selectedFiles->unSelect();
883} 891}
884 892
885void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 893void 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}
901 910
902void PlayListWidget::listDelete() { 911void PlayListWidget::listDelete() {
903 Config cfg( "OpiePlayer" ); 912 Config cfg( "OpiePlayer" );
904 cfg.setGroup("PlayList"); 913 cfg.setGroup("PlayList");
905 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 914 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
906 QString file; 915 QString file;
907 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 916 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
908 switch ( tabWidget->currentPageIndex()) { 917 switch ( tabWidget->currentPageIndex()) {
909 case 0: 918 case 0:
910 break; 919 break;
911 case 1: 920 case 1:
912 { 921 {
@@ -1017,24 +1026,41 @@ void PlayListWidget::openFile() {
1017// if(filename.left(7) == "http://") 1026// if(filename.left(7) == "http://")
1018// name= filename.right(filename.length()-filename.find("http://")-7); 1027// name= filename.right(filename.length()-filename.find("http://")-7);
1019// else name = filename; 1028// else name = filename;
1020// qDebug("name is "+name); 1029// qDebug("name is "+name);
1021// lnk.setComment(filename); 1030// lnk.setComment(filename);
1022 lnk.setName(filename); //sets file name 1031 lnk.setName(filename); //sets file name
1023 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") 1032 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3")
1024 filename += "/"; 1033 filename += "/";
1025 lnk.setFile(filename); //sets File property 1034 lnk.setFile(filename); //sets File property
1026 1035
1027 lnk.setType("audio/x-mpegurl"); 1036 lnk.setType("audio/x-mpegurl");
1028 lnk.setExec("opieplayer"); 1037 lnk.setExec("opieplayer");
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
1051void 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
@@ -46,49 +46,49 @@ public:
46 QAction *fullScreenButton, *scaleButton; 46 QAction *fullScreenButton, *scaleButton;
47 DocLnkSet files; 47 DocLnkSet files;
48 DocLnkSet vFiles; 48 DocLnkSet vFiles;
49 QListView *audioView, *videoView, *playlistView; 49 QListView *audioView, *videoView, *playlistView;
50 QLabel *libString; 50 QLabel *libString;
51 bool fromSetDocument; 51 bool fromSetDocument;
52 bool insanityBool; 52 bool insanityBool;
53 QString setDocFileRef; 53 QString setDocFileRef;
54 // retrieve the current playlist entry (media file link) 54 // retrieve the current playlist entry (media file link)
55 const DocLnk *current(); 55 const DocLnk *current();
56 void useSelectedDocument(); 56 void useSelectedDocument();
57/* QTimer * menuTimer; */ 57/* QTimer * menuTimer; */
58 FileSelector* playLists; 58 FileSelector* playLists;
59 QPushButton *tbDeletePlaylist; 59 QPushButton *tbDeletePlaylist;
60public slots: 60public 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(); */
67protected: 67protected:
68/* void contentsMousePressEvent( QMouseEvent * e ); */ 68/* void contentsMousePressEvent( QMouseEvent * e ); */
69/* void contentsMouseReleaseEvent( QMouseEvent * e ); */ 69/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
70 70void keyReleaseEvent( QKeyEvent *e);
71private: 71private:
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();
78private slots: 78private 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
83 void setActiveWindow(); // need to handle this to show the right view 83 void setActiveWindow(); // need to handle this to show the right view
84 void setPlaylist( bool ); // Show/Hide the playlist 84 void setPlaylist( bool ); // Show/Hide the playlist
85 void setView( char ); 85 void setView( char );
86 void clearList(); 86 void clearList();
87 void addAllToList(); 87 void addAllToList();
88 void addAllMusicToList(); 88 void addAllMusicToList();
89 void addAllVideoToList(); 89 void addAllVideoToList();
90 void saveList(); // Save the playlist 90 void saveList(); // Save the playlist
91 void loadList( const DocLnk &); // Load a playlist 91 void loadList( const DocLnk &); // Load a playlist
92 void playIt( QListViewItem *); 92 void playIt( QListViewItem *);
93 93
94 void btnPlay(bool); 94 void btnPlay(bool);
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
@@ -411,48 +411,49 @@ bool VideoWidget::playVideo() {
411 411
412 scaledWidth = w; 412 scaledWidth = w;
413 scaledHeight = h; 413 scaledHeight = h;
414 414
415 if ( result ) { 415 if ( result ) {
416 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 416 p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
417 } 417 }
418 418
419 } 419 }
420 420
421 return result; 421 return result;
422} 422}
423 423
424 424
425 425
426void VideoWidget::keyReleaseEvent( QKeyEvent *e) 426void 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);
447 } 448 }
448 } 449 }
449 break; 450 break;
450 case Key_Down: 451 case Key_Down:
451// toggleButton(6); 452// toggleButton(6);
452// emit lessClicked(); 453// emit lessClicked();
453// emit lessReleased(); 454// emit lessReleased();
454// toggleButton(6); 455// toggleButton(6);
455 break; 456 break;
456 case Key_Up: 457 case Key_Up:
457// toggleButton(5); 458// toggleButton(5);
458// emit moreClicked(); 459// emit moreClicked();