-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 30 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 8b9413f..84ef3f3 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -28,16 +28,18 @@ | |||
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 <qpe/qcopenvelope_qws.h> | ||
37 | #include <qpe/qpeapplication.h> | ||
36 | #include "xinecontrol.h" | 38 | #include "xinecontrol.h" |
37 | #include "mediaplayerstate.h" | 39 | #include "mediaplayerstate.h" |
38 | #include "videowidget.h" | 40 | #include "videowidget.h" |
39 | 41 | ||
40 | extern MediaPlayerState *mediaPlayerState; | 42 | extern MediaPlayerState *mediaPlayerState; |
41 | extern VideoWidget *videoUI; | 43 | extern VideoWidget *videoUI; |
42 | XineControl::XineControl( QObject *parent, const char *name ) | 44 | XineControl::XineControl( QObject *parent, const char *name ) |
43 | : QObject( parent, name ) { | 45 | : QObject( parent, name ) { |
@@ -45,19 +47,28 @@ XineControl::XineControl( QObject *parent, const char *name ) | |||
45 | 47 | ||
46 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); | 48 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); |
47 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 49 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
48 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 50 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
49 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
50 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 52 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 53 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
52 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 54 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
55 | |||
56 | disabledSuspendScreenSaver = FALSE; | ||
53 | } | 57 | } |
54 | 58 | ||
55 | XineControl::~XineControl() { | 59 | XineControl::~XineControl() { |
60 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | ||
61 | if ( disabledSuspendScreenSaver ) { | ||
62 | disabledSuspendScreenSaver = FALSE; | ||
63 | // Re-enable the suspend mode | ||
64 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
65 | } | ||
66 | #endif | ||
56 | delete libXine; | 67 | delete libXine; |
57 | } | 68 | } |
58 | 69 | ||
59 | void XineControl::play( const QString& fileName ) { | 70 | void XineControl::play( const QString& fileName ) { |
60 | m_fileName = fileName; | 71 | m_fileName = fileName; |
61 | libXine->play( fileName ); | 72 | libXine->play( fileName ); |
62 | mediaPlayerState->setPlaying( true ); | 73 | mediaPlayerState->setPlaying( true ); |
63 | // default to audio view until we know how to handle video | 74 | // default to audio view until we know how to handle video |
@@ -74,29 +85,48 @@ void XineControl::play( const QString& fileName ) { | |||
74 | libXine->setShowVideo( true ); | 85 | libXine->setShowVideo( true ); |
75 | } | 86 | } |
76 | 87 | ||
77 | // determine if slider is shown | 88 | // determine if slider is shown |
78 | // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); | 89 | // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); |
79 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); | 90 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); |
80 | // which gui (video / audio) | 91 | // which gui (video / audio) |
81 | mediaPlayerState->setView( whichGui ); | 92 | mediaPlayerState->setView( whichGui ); |
93 | |||
94 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | ||
95 | if ( !disabledSuspendScreenSaver ) { | ||
96 | disabledSuspendScreenSaver = TRUE; | ||
97 | // Stop the screen from blanking and power saving state | ||
98 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) | ||
99 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | ||
100 | } | ||
101 | #endif | ||
102 | |||
82 | length(); | 103 | length(); |
83 | position(); | 104 | position(); |
84 | } | 105 | } |
85 | 106 | ||
86 | void XineControl::nextMedia() { | 107 | void XineControl::nextMedia() { |
87 | mediaPlayerState->setNext(); | 108 | mediaPlayerState->setNext(); |
88 | } | 109 | } |
89 | 110 | ||
90 | void XineControl::stop( bool isSet ) { | 111 | void XineControl::stop( bool isSet ) { |
91 | if ( !isSet) { | 112 | if ( !isSet) { |
92 | libXine->stop( ); | 113 | libXine->stop( ); |
93 | mediaPlayerState->setList(); | 114 | mediaPlayerState->setList(); |
94 | //mediaPlayerState->setPlaying( false ); | 115 | //mediaPlayerState->setPlaying( false ); |
116 | |||
117 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | ||
118 | if ( disabledSuspendScreenSaver ) { | ||
119 | disabledSuspendScreenSaver = FALSE; | ||
120 | // Re-enable the suspend mode | ||
121 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
122 | } | ||
123 | #endif | ||
124 | |||
95 | } else { | 125 | } else { |
96 | // play again | 126 | // play again |
97 | } | 127 | } |
98 | } | 128 | } |
99 | 129 | ||
100 | /** | 130 | /** |
101 | * Pause playback | 131 | * Pause playback |
102 | * @isSet | 132 | * @isSet |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 712e298..9ad221e 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h | |||
@@ -59,15 +59,16 @@ public slots: | |||
59 | void videoResized ( const QSize &s ); | 59 | void videoResized ( const QSize &s ); |
60 | 60 | ||
61 | private: | 61 | private: |
62 | XINE::Lib *libXine; | 62 | XINE::Lib *libXine; |
63 | MediaDetect mdetect; | 63 | MediaDetect mdetect; |
64 | long m_currentTime; | 64 | long m_currentTime; |
65 | long m_position; | 65 | long m_position; |
66 | QString m_fileName; | 66 | QString m_fileName; |
67 | bool disabledSuspendScreenSaver; | ||
67 | signals: | 68 | signals: |
68 | void positionChanged( long ); | 69 | void positionChanged( long ); |
69 | 70 | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | 73 | ||
73 | #endif | 74 | #endif |