Diffstat (limited to 'noncore/multimedia/opieplayer2/xinecontrol.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index a392f4a..70f2ffd 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -1,171 +1,171 @@ | |||
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 | 39 | ||
40 | #include "xinecontrol.h" | 40 | #include "xinecontrol.h" |
41 | #include "mediaplayerstate.h" | 41 | #include "mediaplayerstate.h" |
42 | #include "xinevideowidget.h" | 42 | #include "xinevideowidget.h" |
43 | 43 | ||
44 | XineControl::XineControl( XineVideoWidget *xineWidget, | 44 | XineControl::XineControl( XineVideoWidget *xineWidget, |
45 | MediaPlayerState &_mediaPlayerState, | 45 | MediaPlayerState &_mediaPlayerState, |
46 | QObject *parent, const char *name ) | 46 | QObject *parent, const char *name ) |
47 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) | 47 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) |
48 | { | 48 | { |
49 | libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); | 49 | libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); |
50 | 50 | ||
51 | init(); | 51 | init(); |
52 | } | 52 | } |
53 | 53 | ||
54 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, | 54 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, |
55 | MediaPlayerState &_mediaPlayerState, | 55 | MediaPlayerState &_mediaPlayerState, |
56 | QObject *parent, const char *name ) | 56 | QObject *parent, const char *name ) |
57 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) | 57 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) |
58 | { | 58 | { |
59 | xine->ensureInitialized(); | 59 | xine->ensureInitialized(); |
60 | 60 | ||
61 | xine->setWidget( xineWidget ); | 61 | xine->setWidget( xineWidget ); |
62 | 62 | ||
63 | init(); | 63 | init(); |
64 | } | 64 | } |
65 | 65 | ||
66 | void XineControl::init() | 66 | void XineControl::init() |
67 | { | 67 | { |
68 | connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); | 68 | connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
69 | connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); | 69 | connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) ); |
70 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 70 | connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) ); |
71 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 71 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) ); |
72 | connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 72 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) ); |
73 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 73 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) ); |
74 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 74 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
75 | connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); | 75 | connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) ); |
76 | 76 | ||
77 | disabledSuspendScreenSaver = FALSE; | 77 | disabledSuspendScreenSaver = FALSE; |
78 | } | 78 | } |
79 | 79 | ||
80 | XineControl::~XineControl() { | 80 | XineControl::~XineControl() { |
81 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 81 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
82 | if ( disabledSuspendScreenSaver ) { | 82 | if ( disabledSuspendScreenSaver ) { |
83 | disabledSuspendScreenSaver = FALSE; | 83 | disabledSuspendScreenSaver = FALSE; |
84 | // Re-enable the suspend mode | 84 | // Re-enable the suspend mode |
85 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 85 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | delete libXine; | 88 | delete libXine; |
89 | } | 89 | } |
90 | 90 | ||
91 | void XineControl::play( const QString& fileName ) { | 91 | void XineControl::play( const QString& fileName ) { |
92 | 92 | ||
93 | hasVideoChannel = FALSE; | 93 | hasVideoChannel = FALSE; |
94 | hasAudioChannel = FALSE; | 94 | hasAudioChannel = FALSE; |
95 | m_fileName = fileName; | 95 | m_fileName = fileName; |
96 | 96 | ||
97 | qDebug("<<FILENAME: " + fileName + ">>>>"); | 97 | qDebug("<<FILENAME: " + fileName + ">>>>"); |
98 | 98 | ||
99 | if ( !libXine->play( fileName, 0, 0 ) ) { | 99 | if ( !libXine->play( fileName, 0, 0 ) ) { |
100 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 100 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
101 | // toggle stop so the the play button is reset | 101 | // toggle stop so the the play button is reset |
102 | mediaPlayerState.setPlaying( false ); | 102 | mediaPlayerState.setPlaying( false ); |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | mediaPlayerState.setPlaying( true ); | 105 | mediaPlayerState.setPlaying( true ); |
106 | 106 | ||
107 | MediaPlayerState::DisplayType displayType; | 107 | MediaPlayerState::DisplayType displayType; |
108 | if ( !libXine->hasVideo() ) { | 108 | if ( !libXine->hasVideo() ) { |
109 | displayType = MediaPlayerState::Audio; | 109 | displayType = MediaPlayerState::Audio; |
110 | qDebug("HAS AUDIO"); | 110 | qDebug("HAS AUDIO"); |
111 | libXine->setShowVideo( false ); | 111 | libXine->setShowVideo( false ); |
112 | hasAudioChannel = TRUE; | 112 | hasAudioChannel = TRUE; |
113 | } else { | 113 | } else { |
114 | displayType = MediaPlayerState::Video; | 114 | displayType = MediaPlayerState::Video; |
115 | qDebug("HAS VIDEO"); | 115 | qDebug("HAS VIDEO"); |
116 | libXine->setShowVideo( true ); | 116 | libXine->setShowVideo( true ); |
117 | hasVideoChannel = TRUE; | 117 | hasVideoChannel = TRUE; |
118 | } | 118 | } |
119 | // determine if slider is shown | 119 | // determine if slider is shown |
120 | mediaPlayerState.setIsSeekable( libXine->isSeekable() ); | 120 | mediaPlayerState.setIsSeekable( libXine->isSeekable() ); |
121 | 121 | ||
122 | // which gui (video / audio) | 122 | // which gui (video / audio) |
123 | mediaPlayerState.setDisplayType( displayType ); | 123 | mediaPlayerState.setDisplayType( displayType ); |
124 | 124 | ||
125 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 125 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
126 | if ( !disabledSuspendScreenSaver ) { | 126 | if ( !disabledSuspendScreenSaver ) { |
127 | disabledSuspendScreenSaver = TRUE; | 127 | disabledSuspendScreenSaver = TRUE; |
128 | // Stop the screen from blanking and power saving state | 128 | // Stop the screen from blanking and power saving state |
129 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) | 129 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
130 | << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 130 | << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
131 | } | 131 | } |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | length(); | 134 | length(); |
135 | position(); | 135 | position(); |
136 | } | 136 | } |
137 | 137 | ||
138 | void XineControl::nextMedia() { | 138 | void XineControl::nextMedia() { |
139 | mediaPlayerState.setNext(); | 139 | mediaPlayerState.setNext(); |
140 | } | 140 | } |
141 | 141 | ||
142 | void XineControl::setGamma( int value ) { | 142 | void XineControl::setGamma( int value ) { |
143 | libXine->setGamma( value ); | 143 | libXine->setGamma( value ); |
144 | } | 144 | } |
145 | 145 | ||
146 | void XineControl::stop( bool isSet ) { | 146 | void XineControl::stop( bool isSet ) { |
147 | if ( !isSet ) { | 147 | if ( !isSet ) { |
148 | libXine->stop(); | 148 | libXine->stop(); |
149 | 149 | ||
150 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 150 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
151 | if ( disabledSuspendScreenSaver ) { | 151 | if ( disabledSuspendScreenSaver ) { |
152 | disabledSuspendScreenSaver = FALSE; | 152 | disabledSuspendScreenSaver = FALSE; |
153 | // Re-enable the suspend mode | 153 | // Re-enable the suspend mode |
154 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 154 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
155 | } | 155 | } |
156 | #endif | 156 | #endif |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Pause playback | 161 | * Pause playback |
162 | * @isSet | 162 | * @isSet |
163 | */ | 163 | */ |
164 | void XineControl::pause( bool isSet) { | 164 | void XineControl::pause( bool isSet) { |
165 | libXine->pause( isSet ); | 165 | libXine->pause( isSet ); |
166 | } | 166 | } |
167 | 167 | ||
168 | 168 | ||
169 | /** | 169 | /** |
170 | * get current time in playback | 170 | * get current time in playback |
171 | */ | 171 | */ |