summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-06 19:35:38 (UTC)
committer llornkcor <llornkcor>2002-10-06 19:35:38 (UTC)
commit8b1192195153bef73ded8cc011b8002f3b81600a (patch) (unidiff)
tree809cd5935f576ce8daf805cec4ff96e6fe773338
parente99c8b4ed69d844bfab7cb1f1f5a514fdad3118f (diff)
downloadopie-8b1192195153bef73ded8cc011b8002f3b81600a.zip
opie-8b1192195153bef73ded8cc011b8002f3b81600a.tar.gz
opie-8b1192195153bef73ded8cc011b8002f3b81600a.tar.bz2
fix spelling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index c22822c..81693e1 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,247 +1,247 @@
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" 41#include "videowidget.h"
42 42
43extern MediaPlayerState *mediaPlayerState; 43extern MediaPlayerState *mediaPlayerState;
44extern VideoWidget *videoUI; 44extern VideoWidget *videoUI;
45XineControl::XineControl( QObject *parent, const char *name ) 45XineControl::XineControl( QObject *parent, const char *name )
46 : QObject( parent, name ) { 46 : QObject( parent, name ) {
47 47
48 libXine = new XINE::Lib(videoUI->vidWidget() ); 48 libXine = new XINE::Lib(videoUI->vidWidget() );
49 49
50 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); 50 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) );
51 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 51 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
52 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); 52 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
53 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 53 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
54 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 54 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
55 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 55 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
56 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 56 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
58 58
59 disabledSuspendScreenSaver = FALSE; 59 disabledSuspendScreenSaver = FALSE;
60} 60}
61 61
62XineControl::~XineControl() { 62XineControl::~XineControl() {
63#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 63#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
64 if ( disabledSuspendScreenSaver ) { 64 if ( disabledSuspendScreenSaver ) {
65 disabledSuspendScreenSaver = FALSE; 65 disabledSuspendScreenSaver = FALSE;
66 // Re-enable the suspend mode 66 // Re-enable the suspend mode
67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
68 } 68 }
69#endif 69#endif
70 delete libXine; 70 delete libXine;
71} 71}
72 72
73void XineControl::play( const QString& fileName ) { 73void XineControl::play( const QString& fileName ) {
74 hasVideoChannel = FALSE; 74 hasVideoChannel = FALSE;
75 hasAudioChannel = FALSE; 75 hasAudioChannel = FALSE;
76 m_fileName = fileName; 76 m_fileName = fileName;
77 77
78 //qDebug("<<FILENAME: " + fileName + ">>>>"); 78 //qDebug("<<FILENAME: " + fileName + ">>>>");
79 79
80 if ( !libXine->play( fileName ) ) { 80 if ( !libXine->play( fileName ) ) {
81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
82 return; 82 return;
83 } 83 }
84 mediaPlayerState->setPlaying( true ); 84 mediaPlayerState->setPlaying( true );
85 85
86 char whichGui; 86 char whichGui;
87 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 87 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
88 if ( !libXine->hasVideo() ) { 88 if ( !libXine->hasVideo() ) {
89 whichGui = 'a'; 89 whichGui = 'a';
90 qDebug("HAS AUDIO"); 90 qDebug("HAS AUDIO");
91 libXine->setShowVideo( false ); 91 libXine->setShowVideo( false );
92 hasAudioChannel = TRUE; 92 hasAudioChannel = TRUE;
93 } else { 93 } else {
94 whichGui = 'v'; 94 whichGui = 'v';
95 qDebug("HAS VIDEO"); 95 qDebug("HAS VIDEO");
96 libXine->setShowVideo( true ); 96 libXine->setShowVideo( true );
97 hasVideoChannel = TRUE; 97 hasVideoChannel = TRUE;
98 } 98 }
99 // determine if slider is shown 99 // determine if slider is shown
100 mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); 100 mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
101 // which gui (video / audio) 101 // which gui (video / audio)
102 mediaPlayerState->setView( whichGui ); 102 mediaPlayerState->setView( whichGui );
103 103
104#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 104#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
105 if ( !disabledSuspendScreenSaver ) { 105 if ( !disabledSuspendScreenSaver ) {
106 disabledSuspendScreenSaver = TRUE; 106 disabledSuspendScreenSaver = TRUE;
107 // Stop the screen from blanking and power saving state 107 // Stop the screen from blanking and power saving state
108 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 108 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
109 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 109 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
110 } 110 }
111#endif 111#endif
112 112
113 length(); 113 length();
114 position(); 114 position();
115} 115}
116 116
117void XineControl::nextMedia() { 117void XineControl::nextMedia() {
118 mediaPlayerState->setNext(); 118 mediaPlayerState->setNext();
119} 119}
120 120
121void XineControl::setGamma( int value ) { 121void XineControl::setGamma( int value ) {
122 libXine->setGamma( value ); 122 libXine->setGamma( value );
123} 123}
124 124
125void XineControl::stop( bool isSet ) { 125void XineControl::stop( bool isSet ) {
126 if ( !isSet ) { 126 if ( !isSet ) {
127 libXine->stop(); 127 libXine->stop();
128 128
129#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 129#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
130 if ( disabledSuspendScreenSaver ) { 130 if ( disabledSuspendScreenSaver ) {
131 disabledSuspendScreenSaver = FALSE; 131 disabledSuspendScreenSaver = FALSE;
132 // Re-enable the suspend mode 132 // Re-enable the suspend mode
133 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 133 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
134 } 134 }
135#endif 135#endif
136 } 136 }
137} 137}
138 138
139/** 139/**
140 * Pause playback 140 * Pause playback
141 * @isSet 141 * @isSet
142 */ 142 */
143void XineControl::pause( bool isSet) { 143void XineControl::pause( bool isSet) {
144 if ( isSet ) { 144 if ( isSet ) {
145 libXine->pause(); 145 libXine->pause();
146 } else { 146 } else {
147 libXine->play( m_fileName, 0, m_currentTime ); 147 libXine->play( m_fileName, 0, m_currentTime );
148 } 148 }
149} 149}
150 150
151 151
152/** 152/**
153 * get current time in playback 153 * get current time in playback
154 */ 154 */
155long XineControl::currentTime() { 155long XineControl::currentTime() {
156 // todo: jede sekunde überprüfen 156 // todo: jede sekunde überprüfen
157 m_currentTime = libXine->currentTime(); 157 m_currentTime = libXine->currentTime();
158 return m_currentTime; 158 return m_currentTime;
159 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 159 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
160} 160}
161 161
162/** 162/**
163 * Set the length of the media file 163 * Set the length of the media file
164 */ 164 */
165void XineControl::length() { 165void XineControl::length() {
166 m_length = libXine->length(); 166 m_length = libXine->length();
167 mediaPlayerState->setLength( m_length ); 167 mediaPlayerState->setLength( m_length );
168} 168}
169 169
170 170
171/** 171/**
172 * Reports the position the xine backend is at right now 172 * Reports the position the xine backend is at right now
173 * @return long the postion in seconds 173 * @return long the postion in seconds
174 */ 174 */
175long XineControl::position() { 175long XineControl::position() {
176 m_position = ( currentTime() ); 176 m_position = ( currentTime() );
177 mediaPlayerState->updatePosition( m_position ); 177 mediaPlayerState->updatePosition( m_position );
178 long emitPos = (long)m_position; 178 long emitPos = (long)m_position;
179 emit positionChanged( emitPos ); 179 emit positionChanged( emitPos );
180 if( mediaPlayerState->isPlaying ) { 180 if( mediaPlayerState->isPlaying ) {
181 // needs to be stopped the media is stopped 181 // needs to be stopped the media is stopped
182 QTimer::singleShot( 1000, this, SLOT( position() ) ); 182 QTimer::singleShot( 1000, this, SLOT( position() ) );
183 } 183 }
184 // qDebug("POSITION : %d", m_position); 184 // qDebug("POSITION : %d", m_position);
185 return m_position; 185 return m_position;
186} 186}
187 187
188/** 188/**
189 * Set videoplayback to fullscreen 189 * Set videoplayback to fullscreen
190 * @param isSet 190 * @param isSet
191 */ 191 */
192void XineControl::setFullscreen( bool isSet ) { 192void XineControl::setFullscreen( bool isSet ) {
193 libXine->showVideoFullScreen( isSet ); 193 libXine->showVideoFullScreen( isSet );
194} 194}
195 195
196 196
197QString XineControl::getMetaInfo() { 197QString XineControl::getMetaInfo() {
198 198
199 QString returnString; 199 QString returnString;
200 200
201 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 201 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
202 returnString += tr( " Titel: " + libXine->metaInfo( 0 ) ); 202 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
203 } 203 }
204 204
205 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 205 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
206 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 206 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
207 } 207 }
208 208
209 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 209 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
210 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 210 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
211 } 211 }
212 212
213 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 213 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
214 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 214 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
215 } 215 }
216 216
217 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 217 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
218 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 218 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
219 } 219 }
220 220
221 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 221 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
222 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 222 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
223 } 223 }
224 return returnString; 224 return returnString;
225} 225}
226 226
227QString XineControl::getErrorCode() { 227QString XineControl::getErrorCode() {
228 int errorCode = libXine->error(); 228 int errorCode = libXine->error();
229 229
230 if ( errorCode == 1 ) { 230 if ( errorCode == 1 ) {
231 return tr( "No input plugin found for this media type" ); 231 return tr( "No input plugin found for this media type" );
232 } else { 232 } else {
233 return tr( "Some other error" ); 233 return tr( "Some other error" );
234 } 234 }
235} 235}
236 236
237/** 237/**
238 * Seek to a position in the track 238 * Seek to a position in the track
239 * @param second the second to jump to 239 * @param second the second to jump to
240 */ 240 */
241void XineControl::seekTo( long second ) { 241void XineControl::seekTo( long second ) {
242 libXine->seekTo( (int)second ); 242 libXine->seekTo( (int)second );
243} 243}
244 244
245void XineControl::videoResized ( const QSize &s ) { 245void XineControl::videoResized ( const QSize &s ) {
246 libXine->resize( s ); 246 libXine->resize( s );
247} 247}