summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h9
3 files changed, 11 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 06b1a04..ed7e37f 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -174,195 +174,195 @@ void MediaPlayer::startIncreasingVolume() {
174 volumeDirection = +1; 174 volumeDirection = +1;
175 startTimer( 100 ); 175 startTimer( 100 );
176 volControl->incVol(2); 176 volControl->incVol(2);
177} 177}
178 178
179 179
180bool drawnOnScreenDisplay = FALSE; 180bool drawnOnScreenDisplay = FALSE;
181unsigned int onScreenDisplayVolume = 0; 181unsigned int onScreenDisplayVolume = 0;
182const int yoff = 110; 182const int yoff = 110;
183 183
184void MediaPlayer::stopChangingVolume() { 184void MediaPlayer::stopChangingVolume() {
185 killTimers(); 185 killTimers();
186 // Get rid of the on-screen display stuff 186 // Get rid of the on-screen display stuff
187 drawnOnScreenDisplay = FALSE; 187 drawnOnScreenDisplay = FALSE;
188 onScreenDisplayVolume = 0; 188 onScreenDisplayVolume = 0;
189 int w=0; 189 int w=0;
190 int h=0; 190 int h=0;
191 if( !xineControl->hasVideo() ) { 191 if( !xineControl->hasVideo() ) {
192 w = audioUI->width(); 192 w = audioUI->width();
193 h = audioUI->height(); 193 h = audioUI->height();
194 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 194 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
195 } else { 195 } else {
196 w = videoUI->width(); 196 w = videoUI->width();
197 h = videoUI->height(); 197 h = videoUI->height();
198 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 198 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
199 } 199 }
200} 200}
201 201
202 202
203void MediaPlayer::timerEvent( QTimerEvent * ) { 203void MediaPlayer::timerEvent( QTimerEvent * ) {
204 if ( volumeDirection == +1 ) { 204 if ( volumeDirection == +1 ) {
205 volControl->incVol( 2 ); 205 volControl->incVol( 2 );
206 } else if ( volumeDirection == -1 ) { 206 } else if ( volumeDirection == -1 ) {
207 volControl->decVol( 2 ); 207 volControl->decVol( 2 );
208 } 208 }
209 209
210 210
211 // TODO FIXME 211 // TODO FIXME
212 // huh?? 212 // huh??
213 unsigned int v= 0; 213 unsigned int v= 0;
214 v = volControl->volume(); 214 v = volControl->volume();
215 v = v / 10; 215 v = v / 10;
216 216
217 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 217 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
218 return; 218 return;
219 } 219 }
220 220
221 int w=0; int h=0; 221 int w=0; int h=0;
222 if( !xineControl->hasVideo() ) { 222 if( !xineControl->hasVideo() ) {
223 w = audioUI->width(); 223 w = audioUI->width();
224 h = audioUI->height(); 224 h = audioUI->height();
225 225
226 if ( drawnOnScreenDisplay ) { 226 if ( drawnOnScreenDisplay ) {
227 if ( onScreenDisplayVolume > v ) { 227 if ( onScreenDisplayVolume > v ) {
228 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 228 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
229 } 229 }
230 } 230 }
231 drawnOnScreenDisplay = TRUE; 231 drawnOnScreenDisplay = TRUE;
232 onScreenDisplayVolume = v; 232 onScreenDisplayVolume = v;
233 QPainter p( audioUI ); 233 QPainter p( audioUI );
234 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 234 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
235 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 235 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
236 236
237 QFont f; 237 QFont f;
238 f.setPixelSize( 20 ); 238 f.setPixelSize( 20 );
239 f.setBold( TRUE ); 239 f.setBold( TRUE );
240 p.setFont( f ); 240 p.setFont( f );
241 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 241 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
242 242
243 for ( unsigned int i = 0; i < 10; i++ ) { 243 for ( unsigned int i = 0; i < 10; i++ ) {
244 if ( v > i ) { 244 if ( v > i ) {
245 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 245 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
246 } else { 246 } else {
247 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 247 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
248 } 248 }
249 } 249 }
250 } else { 250 } else {
251 w = videoUI->width(); 251 w = videoUI->width();
252 h = videoUI->height(); 252 h = videoUI->height();
253 253
254 if ( drawnOnScreenDisplay ) { 254 if ( drawnOnScreenDisplay ) {
255 if ( onScreenDisplayVolume > v ) { 255 if ( onScreenDisplayVolume > v ) {
256 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 256 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
257 } 257 }
258 } 258 }
259 drawnOnScreenDisplay = TRUE; 259 drawnOnScreenDisplay = TRUE;
260 onScreenDisplayVolume = v; 260 onScreenDisplayVolume = v;
261 QPainter p( videoUI ); 261 QPainter p( videoUI );
262 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 262 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
263 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 263 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
264 264
265 QFont f; 265 QFont f;
266 f.setPixelSize( 20 ); 266 f.setPixelSize( 20 );
267 f.setBold( TRUE ); 267 f.setBold( TRUE );
268 p.setFont( f ); 268 p.setFont( f );
269 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 269 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
270 270
271 for ( unsigned int i = 0; i < 10; i++ ) { 271 for ( unsigned int i = 0; i < 10; i++ ) {
272 if ( v > i ) { 272 if ( v > i ) {
273 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 273 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
274 } else { 274 } else {
275 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 275 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
276 } 276 }
277 } 277 }
278 } 278 }
279} 279}
280 280
281 281
282void MediaPlayer::blank( bool b ) { 282void MediaPlayer::blank( bool b ) {
283 fd=open("/dev/fb0",O_RDWR); 283 fd=open("/dev/fb0",O_RDWR);
284#ifdef QT_QWS_EBX 284#ifdef QT_QWS_EBX
285 fl= open( "/dev/fl", O_RDWR ); 285 fl= open( "/dev/fl", O_RDWR );
286#endif 286#endif
287 if (fd != -1) { 287 if (fd != -1) {
288 if ( b ) { 288 if ( b ) {
289 qDebug("do blanking"); 289 qDebug("do blanking");
290#ifdef QT_QWS_EBX 290#ifdef QT_QWS_EBX
291 ioctl( fd, FBIOBLANK, 1 ); 291 ioctl( fd, FBIOBLANK, 1 );
292 if(fl !=-1) { 292 if(fl !=-1) {
293 ioctl( fl, 2 ); 293 ioctl( fl, 2 );
294 ::close(fl); 294 ::close(fl);
295 } 295 }
296#else 296#else
297 ioctl( fd, FBIOBLANK, 3 ); 297 ioctl( fd, FBIOBLANK, 3 );
298#endif 298#endif
299 isBlanked = TRUE; 299 isBlanked = TRUE;
300 } else { 300 } else {
301 qDebug("do unblanking"); 301 qDebug("do unblanking");
302 ioctl( fd, FBIOBLANK, 0); 302 ioctl( fd, FBIOBLANK, 0);
303#ifdef QT_QWS_EBX 303#ifdef QT_QWS_EBX
304 if(fl != -1) { 304 if(fl != -1) {
305 ioctl( fl, 1); 305 ioctl( fl, 1);
306 ::close(fl); 306 ::close(fl);
307 } 307 }
308#endif 308#endif
309 isBlanked = FALSE; 309 isBlanked = FALSE;
310 } 310 }
311 close( fd ); 311 close( fd );
312 } else { 312 } else {
313 qDebug("<< /dev/fb0 could not be opened >>"); 313 qDebug("<< /dev/fb0 could not be opened >>");
314 } 314 }
315} 315}
316 316
317void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 317void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
318 switch ( e->key() ) { 318 switch ( e->key() ) {
319////////////////////////////// Zaurus keys 319////////////////////////////// Zaurus keys
320 case Key_Home: 320 case Key_Home:
321 break; 321 break;
322 case Key_F9: //activity 322 case Key_F9: //activity
323 break; 323 break;
324 case Key_F10: //contacts 324 case Key_F10: //contacts
325 break; 325 break;
326 case Key_F11: //menu 326 case Key_F11: //menu
327 break; 327 break;
328 case Key_F12: //home 328 case Key_F12: //home
329 qDebug("Blank here"); 329 qDebug("Blank here");
330// mediaPlayerState->toggleBlank(); 330// mediaPlayerState->toggleBlank();
331 break; 331 break;
332 case Key_F13: //mail 332 case Key_F13: //mail
333 qDebug("Blank here"); 333 qDebug("Blank here");
334 // mediaPlayerState->toggleBlank(); 334 // mediaPlayerState->toggleBlank();
335 break; 335 break;
336 } 336 }
337} 337}
338 338
339void MediaPlayer::cleanUp() {// this happens on closing 339void MediaPlayer::cleanUp() {// this happens on closing
340 Config cfg( "OpiePlayer" ); 340 Config cfg( "OpiePlayer" );
341 mediaPlayerState.writeConfig( cfg ); 341 mediaPlayerState.writeConfig( cfg );
342 playList.writeDefaultPlaylist( ); 342 playList.writeDefaultPlaylist( );
343 343
344// QPEApplication::grabKeyboard(); 344// QPEApplication::grabKeyboard();
345// QPEApplication::ungrabKeyboard(); 345// QPEApplication::ungrabKeyboard();
346} 346}
347 347
348void MediaPlayer::recreateAudioAndVideoWidgets() 348void MediaPlayer::recreateAudioAndVideoWidgets()
349{ 349{
350 delete xineControl; 350 delete xineControl;
351 delete audioUI; 351 delete audioUI;
352 delete videoUI; 352 delete videoUI;
353 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 353 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
354 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 354 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
355 355
356 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 356 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
357 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 357 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
358 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 358 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
359 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 359 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
360 360
361 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 361 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
362 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 362 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
363 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 363 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
364 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 364 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
365 365
366 xineControl = new XineControl( videoUI, mediaPlayerState ); 366 xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState );
367} 367}
368 368
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index b4ae783..6f1cd9c 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,240 +1,242 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include "xinecontrol.h" 39#include "xinecontrol.h"
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41#include "videowidget.h"
42 41
43XineControl::XineControl( VideoWidget *videoWidget, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 42XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget,
44 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), videoUI( videoWidget ) { 43 MediaPlayerState &_mediaPlayerState,
44 QObject *parent, const char *name )
45 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState )
46{
45 47
46 libXine = new XINE::Lib( videoUI->vidWidget() ); 48 libXine = new XINE::Lib( xineWidget );
47 49
48 connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); 50 connect ( videoContainerWidget, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) );
49 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 51 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
50 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 52 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
51 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 53 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
52 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 54 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
53 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 55 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
54 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 56 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
55 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
56 58
57 disabledSuspendScreenSaver = FALSE; 59 disabledSuspendScreenSaver = FALSE;
58} 60}
59 61
60XineControl::~XineControl() { 62XineControl::~XineControl() {
61#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 63#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
62 if ( disabledSuspendScreenSaver ) { 64 if ( disabledSuspendScreenSaver ) {
63 disabledSuspendScreenSaver = FALSE; 65 disabledSuspendScreenSaver = FALSE;
64 // Re-enable the suspend mode 66 // Re-enable the suspend mode
65 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
66 } 68 }
67#endif 69#endif
68 delete libXine; 70 delete libXine;
69} 71}
70 72
71void XineControl::play( const QString& fileName ) { 73void XineControl::play( const QString& fileName ) {
72 hasVideoChannel = FALSE; 74 hasVideoChannel = FALSE;
73 hasAudioChannel = FALSE; 75 hasAudioChannel = FALSE;
74 m_fileName = fileName; 76 m_fileName = fileName;
75 77
76 qDebug("<<FILENAME: " + fileName + ">>>>"); 78 qDebug("<<FILENAME: " + fileName + ">>>>");
77 79
78 if ( !libXine->play( fileName, 0, 0 ) ) { 80 if ( !libXine->play( fileName, 0, 0 ) ) {
79 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
80 // toggle stop so the the play button is reset 82 // toggle stop so the the play button is reset
81 mediaPlayerState.setPlaying( false ); 83 mediaPlayerState.setPlaying( false );
82 return; 84 return;
83 } 85 }
84 mediaPlayerState.setPlaying( true ); 86 mediaPlayerState.setPlaying( true );
85 87
86 MediaPlayerState::DisplayType displayType; 88 MediaPlayerState::DisplayType displayType;
87 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 89 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
88 if ( !libXine->hasVideo() ) { 90 if ( !libXine->hasVideo() ) {
89 displayType = MediaPlayerState::Audio; 91 displayType = MediaPlayerState::Audio;
90 qDebug("HAS AUDIO"); 92 qDebug("HAS AUDIO");
91 libXine->setShowVideo( false ); 93 libXine->setShowVideo( false );
92 hasAudioChannel = TRUE; 94 hasAudioChannel = TRUE;
93 } else { 95 } else {
94 displayType = MediaPlayerState::Video; 96 displayType = MediaPlayerState::Video;
95 qDebug("HAS VIDEO"); 97 qDebug("HAS VIDEO");
96 libXine->setShowVideo( true ); 98 libXine->setShowVideo( true );
97 hasVideoChannel = TRUE; 99 hasVideoChannel = TRUE;
98 } 100 }
99 // determine if slider is shown 101 // determine if slider is shown
100 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 102 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
101 103
102 // which gui (video / audio) 104 // which gui (video / audio)
103 mediaPlayerState.setDisplayType( displayType ); 105 mediaPlayerState.setDisplayType( displayType );
104 106
105#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 107#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
106 if ( !disabledSuspendScreenSaver ) { 108 if ( !disabledSuspendScreenSaver ) {
107 disabledSuspendScreenSaver = TRUE; 109 disabledSuspendScreenSaver = TRUE;
108 // Stop the screen from blanking and power saving state 110 // Stop the screen from blanking and power saving state
109 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 111 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
110 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 112 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
111 } 113 }
112#endif 114#endif
113 115
114 length(); 116 length();
115 position(); 117 position();
116} 118}
117 119
118void XineControl::nextMedia() { 120void XineControl::nextMedia() {
119 mediaPlayerState.setNext(); 121 mediaPlayerState.setNext();
120} 122}
121 123
122void XineControl::setGamma( int value ) { 124void XineControl::setGamma( int value ) {
123 libXine->setGamma( value ); 125 libXine->setGamma( value );
124} 126}
125 127
126void XineControl::stop( bool isSet ) { 128void XineControl::stop( bool isSet ) {
127 if ( !isSet ) { 129 if ( !isSet ) {
128 libXine->stop(); 130 libXine->stop();
129 131
130#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 132#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
131 if ( disabledSuspendScreenSaver ) { 133 if ( disabledSuspendScreenSaver ) {
132 disabledSuspendScreenSaver = FALSE; 134 disabledSuspendScreenSaver = FALSE;
133 // Re-enable the suspend mode 135 // Re-enable the suspend mode
134 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 136 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
135 } 137 }
136#endif 138#endif
137 } 139 }
138} 140}
139 141
140/** 142/**
141 * Pause playback 143 * Pause playback
142 * @isSet 144 * @isSet
143 */ 145 */
144void XineControl::pause( bool isSet) { 146void XineControl::pause( bool isSet) {
145 if ( isSet ) { 147 if ( isSet ) {
146 libXine->pause(); 148 libXine->pause();
147 } else { 149 } else {
148 libXine->play( m_fileName, 0, m_currentTime ); 150 libXine->play( m_fileName, 0, m_currentTime );
149 } 151 }
150} 152}
151 153
152 154
153/** 155/**
154 * get current time in playback 156 * get current time in playback
155 */ 157 */
156long XineControl::currentTime() { 158long XineControl::currentTime() {
157 // todo: jede sekunde überprüfen 159 // todo: jede sekunde überprüfen
158 m_currentTime = libXine->currentTime(); 160 m_currentTime = libXine->currentTime();
159 return m_currentTime; 161 return m_currentTime;
160 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 162 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
161} 163}
162 164
163/** 165/**
164 * Set the length of the media file 166 * Set the length of the media file
165 */ 167 */
166void XineControl::length() { 168void XineControl::length() {
167 m_length = libXine->length(); 169 m_length = libXine->length();
168 mediaPlayerState.setLength( m_length ); 170 mediaPlayerState.setLength( m_length );
169} 171}
170 172
171 173
172/** 174/**
173 * Reports the position the xine backend is at right now 175 * Reports the position the xine backend is at right now
174 * @return long the postion in seconds 176 * @return long the postion in seconds
175 */ 177 */
176long XineControl::position() { 178long XineControl::position() {
177 m_position = ( currentTime() ); 179 m_position = ( currentTime() );
178 mediaPlayerState.updatePosition( m_position ); 180 mediaPlayerState.updatePosition( m_position );
179 long emitPos = (long)m_position; 181 long emitPos = (long)m_position;
180 emit positionChanged( emitPos ); 182 emit positionChanged( emitPos );
181 if( mediaPlayerState.isPlaying() ) { 183 if( mediaPlayerState.isPlaying() ) {
182 // needs to be stopped the media is stopped 184 // needs to be stopped the media is stopped
183 QTimer::singleShot( 1000, this, SLOT( position() ) ); 185 QTimer::singleShot( 1000, this, SLOT( position() ) );
184 } 186 }
185 // qDebug("POSITION : %d", m_position); 187 // qDebug("POSITION : %d", m_position);
186 return m_position; 188 return m_position;
187} 189}
188 190
189/** 191/**
190 * Set videoplayback to fullscreen 192 * Set videoplayback to fullscreen
191 * @param isSet 193 * @param isSet
192 */ 194 */
193void XineControl::setFullscreen( bool isSet ) { 195void XineControl::setFullscreen( bool isSet ) {
194 libXine->showVideoFullScreen( isSet ); 196 libXine->showVideoFullScreen( isSet );
195} 197}
196 198
197 199
198QString XineControl::getMetaInfo() { 200QString XineControl::getMetaInfo() {
199 201
200 QString returnString; 202 QString returnString;
201 203
202 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 204 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
203 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 205 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
204 } 206 }
205 207
206 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 208 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
207 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 209 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
208 } 210 }
209 211
210 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 212 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
211 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 213 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
212 } 214 }
213 215
214 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 216 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
215 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 217 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
216 } 218 }
217 219
218 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 220 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
219 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 221 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
220 } 222 }
221 223
222 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 224 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
223 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 225 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
224 } 226 }
225 return returnString; 227 return returnString;
226} 228}
227 229
228QString XineControl::getErrorCode() { 230QString XineControl::getErrorCode() {
229 231
230 int errorCode = libXine->error(); 232 int errorCode = libXine->error();
231 233
232 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 234 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
233 235
234 if ( errorCode == 1 ) { 236 if ( errorCode == 1 ) {
235 return tr( "No input plugin found for this media type" ); 237 return tr( "No input plugin found for this media type" );
236 } else if ( errorCode == 2 ) { 238 } else if ( errorCode == 2 ) {
237 return tr( "No demux plugin found for this media type" ); 239 return tr( "No demux plugin found for this media type" );
238 } else if ( errorCode == 3 ) { 240 } else if ( errorCode == 3 ) {
239 return tr( "Demuxing failed for this media type" ); 241 return tr( "Demuxing failed for this media type" );
240 } else if ( errorCode == 4 ) { 242 } else if ( errorCode == 4 ) {
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 24e966b..69a594f 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,123 +1,120 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef XINECONTROL_H 34#ifndef XINECONTROL_H
35#define XINECONTROL_H 35#define XINECONTROL_H
36 36
37#include "lib.h" 37#include "lib.h"
38#include <qobject.h> 38#include <qobject.h>
39 39
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41 41
42class VideoWidget;
43
44class XineControl : public QObject { 42class XineControl : public QObject {
45 Q_OBJECT 43 Q_OBJECT
46public: 44public:
47 XineControl( VideoWidget *videoWidget, MediaPlayerState &_mediaPlayerState, QObject *parent = 0, const char *name =0 ); 45 XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget,
46 MediaPlayerState &_mediaPlayerState,
47 QObject *parent = 0, const char *name =0 );
48 ~XineControl(); 48 ~XineControl();
49 49
50 bool hasVideo() const { return hasVideoChannel; } 50 bool hasVideo() const { return hasVideoChannel; }
51 bool hasAudio() const { return hasAudioChannel; } 51 bool hasAudio() const { return hasAudioChannel; }
52 52
53public slots: 53public slots:
54 void play( const QString& fileName ); 54 void play( const QString& fileName );
55 void stop( bool ); 55 void stop( bool );
56 56
57 /** 57 /**
58 * Pause the media stream 58 * Pause the media stream
59 * @param if pause or not 59 * @param if pause or not
60 */ 60 */
61 void pause( bool ); 61 void pause( bool );
62 62
63 /** 63 /**
64 * Set videos fullscreen 64 * Set videos fullscreen
65 * @param yes or no 65 * @param yes or no
66 */ 66 */
67 void setFullscreen( bool ); 67 void setFullscreen( bool );
68 68
69 /** 69 /**
70 * 70 *
71 */ 71 */
72 long currentTime(); 72 long currentTime();
73 void seekTo( long ); 73 void seekTo( long );
74 // get length of media file and set it 74 // get length of media file and set it
75 void length(); 75 void length();
76 long position(); 76 long position();
77 77
78 /** 78 /**
79 * Proceed to the next media file in playlist 79 * Proceed to the next media file in playlist
80 */ 80 */
81 void nextMedia(); 81 void nextMedia();
82 82
83 /** 83 /**
84 * Get as much info about the stream from xine as possible 84 * Get as much info about the stream from xine as possible
85 */ 85 */
86 QString getMetaInfo(); 86 QString getMetaInfo();
87 87
88 /** 88 /**
89 * get the error code and "translate" it for the user 89 * get the error code and "translate" it for the user
90 * 90 *
91 */ 91 */
92 QString getErrorCode(); 92 QString getErrorCode();
93 93
94 94
95 void videoResized ( const QSize &s ); 95 void videoResized ( const QSize &s );
96 96
97 /** 97 /**
98 * Set the gamma value of the video output 98 * Set the gamma value of the video output
99 * @param int value between -100 and 100, 0 is original 99 * @param int value between -100 and 100, 0 is original
100 */ 100 */
101 void setGamma( int ); 101 void setGamma( int );
102 102
103 103
104private: 104private:
105 XINE::Lib *libXine; 105 XINE::Lib *libXine;
106 long m_currentTime; 106 long m_currentTime;
107 long m_position; 107 long m_position;
108 int m_length; 108 int m_length;
109 QString m_fileName; 109 QString m_fileName;
110 bool disabledSuspendScreenSaver : 1; 110 bool disabledSuspendScreenSaver : 1;
111 bool hasVideoChannel : 1; 111 bool hasVideoChannel : 1;
112 bool hasAudioChannel : 1; 112 bool hasAudioChannel : 1;
113 MediaPlayerState &mediaPlayerState; 113 MediaPlayerState &mediaPlayerState;
114 114
115signals: 115signals:
116 void positionChanged( long ); 116 void positionChanged( long );
117
118private:
119 VideoWidget *videoUI;
120}; 117};
121 118
122 119
123#endif 120#endif