summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-10 12:07:08 (UTC)
committer harlekin <harlekin>2002-08-10 12:07:08 (UTC)
commit918a4ff2294a50bf57e7e6d764fb2e66bbdf8c5d (patch) (side-by-side diff)
tree99fffaecbff5ef8e86da124ff6c1d9a153785fa7
parent62f9bc4e906784d201d758b9c0bba05a294a31be (diff)
downloadopie-918a4ff2294a50bf57e7e6d764fb2e66bbdf8c5d.zip
opie-918a4ff2294a50bf57e7e6d764fb2e66bbdf8c5d.tar.gz
opie-918a4ff2294a50bf57e7e6d764fb2e66bbdf8c5d.tar.bz2
do not suspend while playing media files
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp30
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h1
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
@@ -24,44 +24,55 @@
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qtimer.h>
+#include <qpe/qcopenvelope_qws.h>
+#include <qpe/qpeapplication.h>
#include "xinecontrol.h"
#include "mediaplayerstate.h"
#include "videowidget.h"
extern MediaPlayerState *mediaPlayerState;
extern VideoWidget *videoUI;
XineControl::XineControl( QObject *parent, const char *name )
: QObject( parent, name ) {
libXine = new XINE::Lib(videoUI->vidWidget() );
connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & )));
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
+
+ disabledSuspendScreenSaver = FALSE;
}
XineControl::~XineControl() {
+#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+ if ( disabledSuspendScreenSaver ) {
+ disabledSuspendScreenSaver = FALSE;
+ // Re-enable the suspend mode
+ QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
+ }
+#endif
delete libXine;
}
void XineControl::play( const QString& fileName ) {
m_fileName = fileName;
libXine->play( fileName );
mediaPlayerState->setPlaying( true );
// default to audio view until we know how to handle video
// MediaDetect mdetect;
char whichGui = mdetect.videoOrAudio( fileName );
if (whichGui == 'f') {
qDebug("Nicht erkannter Dateityp");
@@ -70,37 +81,56 @@ void XineControl::play( const QString& fileName ) {
if (whichGui == 'a') {
libXine->setShowVideo( false );
} else {
libXine->setShowVideo( true );
}
// determine if slider is shown
// mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) );
mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
// which gui (video / audio)
mediaPlayerState->setView( whichGui );
+
+#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+ if ( !disabledSuspendScreenSaver ) {
+ disabledSuspendScreenSaver = TRUE;
+ // Stop the screen from blanking and power saving state
+ QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
+ << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
+ }
+#endif
+
length();
position();
}
void XineControl::nextMedia() {
mediaPlayerState->setNext();
}
void XineControl::stop( bool isSet ) {
if ( !isSet) {
libXine->stop( );
mediaPlayerState->setList();
//mediaPlayerState->setPlaying( false );
+
+#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+ if ( disabledSuspendScreenSaver ) {
+ disabledSuspendScreenSaver = FALSE;
+ // Re-enable the suspend mode
+ QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
+ }
+#endif
+
} else {
// play again
}
}
/**
* Pause playback
* @isSet
*/
void XineControl::pause( bool isSet) {
if (isSet) {
libXine->pause();
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
@@ -55,19 +55,20 @@ public slots:
// get length of media file and set it
void length();
long position();
void nextMedia();
void videoResized ( const QSize &s );
private:
XINE::Lib *libXine;
MediaDetect mdetect;
long m_currentTime;
long m_position;
QString m_fileName;
+ bool disabledSuspendScreenSaver;
signals:
void positionChanged( long );
};
#endif